-
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?
Conversation
@krishagarwal278: This pull request references CONSOLE-4693 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.20.0" version, but no target version was set. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
/label docs-approved |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: krishagarwal278 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @yanpzhan |
/retest |
1 similar comment
/retest |
There is not regression issue for the pr. |
@krishagarwal278: This pull request references CONSOLE-4693 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.20.0" version, but no target version was set. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@@ -208,7 +208,7 @@ const ConsolePluginsTable: React.FC<ConsolePluginsTableProps> = ({ obj, rows, lo | |||
const compare = React.useCallback<Comparator<ConsolePluginTableRow>>( | |||
(a, b) => { | |||
const { index, direction } = sortBy; | |||
const { id } = columns[index]; | |||
const { id } = columns[index ?? 0]; |
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;
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Returning HealthState.NOT_AVAILABLE
from the function if t
is undefined doesn't seem right to me, but I might be wrong.
cc: @vojtechszocs
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to be consistent with the default value for pluginName = obj?.metadata?.name
. The 'unknown' is used as the default in another place.
/label tide/merge-method-squash |
@@ -7,7 +7,7 @@ import { ConsolePluginCSPStatus } from './ConsoleOperatorConfig'; | |||
|
|||
const ConsolePluginCSPStatusDetail: React.FC<DetailsItemComponentProps> = ({ obj }) => { | |||
const pluginStore = usePluginStore(); | |||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | |||
const pluginName = React.useMemo(() => obj?.metadata?.name ?? 'unknown', [obj?.metadata?.name]); |
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.
Unsure of "unknown" and empty string "", which should be the default for plugin name.
Let's discus this in scrum.
Alternatively, we could make pluginInfo to either return an object or null, which would fix this SNC.
const pluginInfo = React.useMemo(() => {
return pluginName ? pluginStore.findDynamicPluginInfo(pluginName) : null;
}, [pluginStore, pluginName]);
e61e9db
to
3cf5241
Compare
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still throw an SNC error after making plugin.metadata.name
optional?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
The same as stated previously.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
The same as stated previously.
pluginName, | ||
]); | ||
const pluginManifest = React.useMemo( | ||
() => pluginStore.getDynamicPluginManifest(pluginName ?? ''), |
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.
The same as stated previously.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
The same as stated previously.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
The same as stated previously.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Could be fine without a fallback value.
/retest |
/label acknowledge-critical-fixes-only |
/retest |
@krishagarwal278: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
No description provided.