-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update main nav and UI for local Advisor Engine #932
base: develop
Are you sure you want to change the base?
Changes from all commits
f8751f0
5df20ca
1c101d6
1385802
620af29
1592aff
60de70c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -106,9 +106,15 @@ def self.register_scheduled_task(task_class, cronline) | |||||
Role::SYSTEM_ADMIN => plugin_permissions | ||||||
|
||||||
# Adding a sub menu after hosts menu | ||||||
divider :top_menu, caption: N_('RH Cloud'), parent: :configure_menu | ||||||
menu :top_menu, :inventory_upload, caption: N_('Inventory Upload'), url: '/foreman_rh_cloud/inventory_upload', url_hash: { controller: :react, action: :index }, parent: :configure_menu | ||||||
menu :top_menu, :insights_hits, caption: N_('Insights'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :configure_menu | ||||||
divider :top_menu, caption: N_('Insights'), parent: :configure_menu | ||||||
menu :top_menu, | ||||||
:inventory_upload, | ||||||
caption: N_('Inventory Upload'), | ||||||
url: '/foreman_rh_cloud/inventory_upload', | ||||||
url_hash: { controller: :react, action: :index }, | ||||||
parent: :configure_menu, | ||||||
if: -> { !ForemanRhCloud.with_local_advisor_engine? } | ||||||
menu :top_menu, :insights_hits, caption: N_('Recommendations'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :configure_menu | ||||||
|
||||||
register_facet InsightsFacet, :insights do | ||||||
configure_host do | ||||||
|
@@ -193,4 +199,8 @@ def self.register_scheduled_task(task_class, cronline) | |||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
def self.with_local_advisor_engine? | ||||||
SETTINGS&.[](:foreman_rh_cloud)&.[](:use_local_advisor_engine) || false | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use dig on a hash and I think it's safe to assume
Suggested change
|
||||||
end | ||||||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,11 @@ export const getInsightsSyncSettings = () => async dispatch => { | |
}, | ||
}, | ||
}); | ||
} catch ({ message }) { | ||
} catch (err) { | ||
const { message } = err; | ||
if (err?.response?.status === 422) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this catch any non-2xx code? Any network connection can fail so it could return 5xx. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since I send myself the 422 specifically for this check, I thought it made sense to check for it specifically as well. But I may end up re-architecting this whole thing anyway, stand by.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, perhaps it should raise a more specific exception than |
||
throw new Error(message, { cause: err }); | ||
} | ||
dispatch( | ||
addToast({ | ||
sticky: true, | ||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: is this easier to follow? I generally try to avoid
return
and rely on the visual indentation to follow the code.Though taking a step back, from an API perspective I wonder why this is even here in the first place. We already have an API to show settings:
/api/settings/:id
that supports both GET and PUT.Are there any permission checks on this controller to prevent unauthenticated users to change the setting or can any user change this for any organization?