-
Notifications
You must be signed in to change notification settings - Fork 684
chore: replace getConfigValue with direct getConfig() property access
#3589
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
Changes from all commits
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,7 +19,7 @@ import * as diffUrl from '../TraceDiff/url'; | |||||||||||||
| import * as monitorATMUrl from '../Monitor/url'; | ||||||||||||||
| import { ReduxState } from '../../types'; | ||||||||||||||
| import { ConfigMenuItem, ConfigMenuGroup } from '../../types/config'; | ||||||||||||||
| import { getConfigValue } from '../../utils/config/get-config'; | ||||||||||||||
| import getConfig from '../../utils/config/get-config'; | ||||||||||||||
| import prefixUrl from '../../utils/prefix-url'; | ||||||||||||||
|
|
||||||||||||||
| import './TopNav.css'; | ||||||||||||||
|
|
@@ -40,34 +40,31 @@ const NAV_LINKS = [ | |||||||||||||
| }, | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| if (getConfigValue('dependencies.menuEnabled')) { | ||||||||||||||
| if (getConfig().dependencies?.menuEnabled) { | ||||||||||||||
| NAV_LINKS.push({ | ||||||||||||||
| to: dependencyGraph.getUrl(), | ||||||||||||||
| matches: dependencyGraph.matches, | ||||||||||||||
| text: 'System Architecture', | ||||||||||||||
| }); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (getConfigValue('deepDependencies.menuEnabled')) { | ||||||||||||||
| if (getConfig().deepDependencies?.menuEnabled) { | ||||||||||||||
| NAV_LINKS.push({ | ||||||||||||||
| to: deepDependencies.getUrl(), | ||||||||||||||
| matches: deepDependencies.matches, | ||||||||||||||
| text: 'Service Dependencies', | ||||||||||||||
| }); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (getConfigValue('qualityMetrics.menuEnabled')) { | ||||||||||||||
| if (getConfig().qualityMetrics?.menuEnabled) { | ||||||||||||||
| NAV_LINKS.push({ | ||||||||||||||
| to: qualityMetrics.getUrl(), | ||||||||||||||
| matches: qualityMetrics.matches, | ||||||||||||||
| text: getConfigValue('qualityMetrics.menuLabel'), | ||||||||||||||
| text: getConfig().qualityMetrics?.menuLabel ?? '', | ||||||||||||||
| }); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // Show the Monitor item in the top nav when enabled in configuration. | ||||||||||||||
| // The Monitor page itself inspects storage capabilities and, if metrics | ||||||||||||||
| // storage is not supported, shows a landing page with setup instructions. | ||||||||||||||
| if (getConfigValue('monitor.menuEnabled')) { | ||||||||||||||
| if (getConfig().storageCapabilities?.metricsStorage) { | ||||||||||||||
| NAV_LINKS.push({ | ||||||||||||||
|
Comment on lines
+67
to
68
Contributor
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. Critical Logic Change: This line changes the condition from Old code: if (getConfigValue('monitor.menuEnabled')) {New code: if (getConfig().storageCapabilities?.metricsStorage) {Impact: The Monitor menu item will now appear based on storage capabilities instead of the explicit Fix: Change to
Suggested change
Spotted by Graphite |
||||||||||||||
| to: monitorATMUrl.getUrl(), | ||||||||||||||
| matches: monitorATMUrl.matches, | ||||||||||||||
|
|
@@ -123,7 +120,7 @@ export function TopNavImpl(props: Props) { | |||||||||||||
| } | ||||||||||||||
| return { label: <CustomNavDropdown key={m.label} {...m} />, key: m.label }; | ||||||||||||||
| }), | ||||||||||||||
| ...(getConfigValue('themes.enabled') | ||||||||||||||
| ...(getConfig().themes?.enabled | ||||||||||||||
| ? [ | ||||||||||||||
| { | ||||||||||||||
| label: <ThemeToggleButton />, | ||||||||||||||
|
|
||||||||||||||
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.
qualityMetrics.menuLabelis optional, but falling back to an empty string can produce a blank/invisible nav item whenqualityMetrics.menuEnabledis true and the embedded config omitsmenuLabel(e.g., if it overwrites the wholequalityMetricsobject). Prefer a meaningful fallback label (e.g., the default-config label) or skip adding the nav entry when the label is missing.