-
Notifications
You must be signed in to change notification settings - Fork 657
CONSOLE-4693: Enable strickNullCheck for packages/console-app/src/components/console-operator | dashboards-page | detect-namespace #15400
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ const ConsolePluginCSPStatusDetail: React.FC<DetailsItemComponentProps> = ({ obj | |
const pluginStore = usePluginStore(); | ||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName), [ | ||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName ?? ''), [ | ||
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. It would be better to be consistent with the default value for |
||
pluginStore, | ||
pluginName, | ||
]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ const ConsolePluginDescriptionDetail: React.FC<DetailsItemComponentProps> = ({ o | |
const pluginStore = usePluginStore(); | ||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName), [ | ||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName ?? ''), [ | ||
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. Does this still throw an SNC error after making |
||
pluginStore, | ||
pluginName, | ||
]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ const ConsolePluginEnabledStatusDetail: React.FC<DetailsItemComponentProps> = ({ | |
|
||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName), [ | ||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName ?? ''), [ | ||
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. The same as stated previously. |
||
pluginStore, | ||
pluginName, | ||
]); | ||
|
@@ -25,11 +25,11 @@ const ConsolePluginEnabledStatusDetail: React.FC<DetailsItemComponentProps> = ({ | |
|
||
return consoleOperatorConfigLoaded ? ( | ||
<ConsolePluginEnabledStatus | ||
pluginName={pluginName} | ||
pluginName={pluginName ?? ''} | ||
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. The same as stated previously. |
||
enabled={ | ||
developmentMode | ||
? (isLoadedDynamicPluginInfo(pluginInfo) && pluginInfo.enabled) ?? false | ||
: enabledPlugins.includes(pluginName) ?? false | ||
: enabledPlugins.includes(pluginName ?? '') ?? false | ||
} | ||
/> | ||
) : ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,10 @@ export const ConsolePluginManifestPage: React.FC<PageComponentProps> = ({ obj }) | |
const pluginStore = usePluginStore(); | ||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginManifest = React.useMemo(() => pluginStore.getDynamicPluginManifest(pluginName), [ | ||
pluginStore, | ||
pluginName, | ||
]); | ||
const pluginManifest = React.useMemo( | ||
() => pluginStore.getDynamicPluginManifest(pluginName ?? ''), | ||
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. The same as stated previously. |
||
[pluginStore, pluginName], | ||
); | ||
|
||
return ( | ||
<PaneBody> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ const ConsolePluginStatusDetail: React.FC<DetailsItemComponentProps> = ({ obj }) | |
const pluginStore = usePluginStore(); | ||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName), [ | ||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName ?? ''), [ | ||
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. The same as stated previously. |
||
pluginStore, | ||
pluginName, | ||
]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ const ConsolePluginVersionDetail: React.FC<DetailsItemComponentProps> = ({ obj } | |
const pluginStore = usePluginStore(); | ||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName), [ | ||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName ?? ''), [ | ||
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. The same as stated previously. |
||
pluginStore, | ||
pluginName, | ||
]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ const ClusterOperatorStatusRow: React.FC<OperatorRowProps<ClusterOperator>> = ({ | |
<Status value={operatorStatus.status.title} icon={operatorStatus.status.icon}> | ||
<ResourceLink | ||
kind={referenceForModel(ClusterOperatorModel)} | ||
name={operatorStatus.operators[0].metadata.name} | ||
name={operatorStatus.operators[0]?.metadata?.name ?? ''} | ||
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. Could be fine without a fallback value. |
||
hideIcon | ||
className="co-status-popup__title" | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,10 @@ export const getControlPlaneHealth: PrometheusHealthHandler = ( | |
resource, | ||
infrastructure, | ||
) => { | ||
if (!t) { | ||
return { state: HealthState.NOT_AVAILABLE }; | ||
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. Returning 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.
@vojtechszocs. Never mind. |
||
} | ||
|
||
const componentsHealth = responses.map(({ response, error }) => | ||
getControlPlaneComponentHealth(response, error, t), | ||
); | ||
|
@@ -105,7 +109,7 @@ export const getControlPlaneHealth: PrometheusHealthHandler = ( | |
const worstStatus = getWorstStatus(componentsHealth, t); | ||
|
||
const singleMasterMsg = | ||
worstStatus.state === HealthState.OK && isSingleNode(infrastructure) | ||
worstStatus.state === HealthState.OK && infrastructure && isSingleNode(infrastructure) | ||
? t('console-app~Single control plane node') | ||
: undefined; | ||
|
||
|
@@ -117,7 +121,7 @@ export const getControlPlaneHealth: PrometheusHealthHandler = ( | |
? worstStatus.count === 4 | ||
? worstStatus.message | ||
: `${pluralize(worstStatus.count, 'component')} ${worstStatus.message.toLowerCase()}` | ||
: null), | ||
: undefined), | ||
}; | ||
}; | ||
|
||
|
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.
Would default at destructuring not be cleaner?
const { index = 0, direction } = sortBy;