Skip to content

Conversation

krishagarwal278
Copy link
Member

Fixed SNC errors in storage, resource-quota, quick-starts, tour, tab, vpa

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 19, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Aug 19, 2025

@krishagarwal278: This pull request references CONSOLE-4697 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:

Fixed SNC errors in storage, resource-quota, quick-starts, tour, tab, vpa

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.

@openshift-ci openshift-ci bot requested review from jhadvig and TheRealJon August 19, 2025 16:03
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Aug 19, 2025
@krishagarwal278
Copy link
Member Author

/label docs-approved
/label px-approved

@openshift-ci openshift-ci bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR labels Aug 19, 2025
@krishagarwal278
Copy link
Member Author

/retest

Copy link
Contributor

@cajieh cajieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work so far!: 👍
I did a first pass, and added comments. Let me know if you have any questions.

@@ -169,7 +169,7 @@ const QuickStartConfiguration: React.FC<{ readonly: boolean }> = ({ readonly })
/>

<LoadError error={consoleConfigError} />
<SaveStatus {...saveStatus} />
<SaveStatus {...(saveStatus as SaveStatusProps)} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can avoid the use of as here by first checking for saveStatus. The type assertions with as should be last resort solutions, not quick fixes for type errors.

{saveStatus && <SaveStatus {...saveStatus} />}

@@ -40,7 +40,7 @@ const QUICKSTART_REDUX_STATE_LOCAL_STORAGE_KEY = 'bridge/quick-start-redux-state

const getInitialState = () =>
localStorage.getItem(QUICKSTART_REDUX_STATE_LOCAL_STORAGE_KEY)
? JSON.parse(localStorage.getItem(QUICKSTART_REDUX_STATE_LOCAL_STORAGE_KEY))
? JSON.parse(localStorage.getItem(QUICKSTART_REDUX_STATE_LOCAL_STORAGE_KEY) || '{}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we refactor this to be a bit cleaner?

const getInitialState = () => {
  const stored = localStorage.getItem(QUICKSTART_REDUX_STATE_LOCAL_STORAGE_KEY);
  return stored ? JSON.parse(stored) : {};
};

@@ -117,5 +117,5 @@ export const useQuickStarts = (filterDisabledQuickStarts = true): WatchK8sResult
);
}, [quickStarts, quickStartsLoaded, filterDisabledQuickStarts, preferredLanguage]);

return [bestMatchQuickStarts, quickStartsLoaded, quickStartsError];
return [bestMatchQuickStarts as QuickStart[], quickStartsLoaded, quickStartsError];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getBestMatch function's null return type is forcing us to use a type assertion as. While we could remove the null return type to fix this, I'm unsure about the potential impact on other parts of the codebase where it's used.
IMO, I think it's better to filter out the null values after the map function, since the useQuickStarts hook doesn't have a corresponding null return type. Something like:

.filter((quickStart) => quickStart !== null);

const nsUsed = nsQuotas.status.used?.[resourceName];
const clusterUsage = getUsedPercentage(clusterHard, clusterUsed);
const clusterHard = appliedClusterResourceQuota.status?.total?.hard?.[resourceName || ''];
const clusterUsed = appliedClusterResourceQuota.status?.total?.used?.[resourceName || ''];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure of the need for empty strings '' here. Was this done to fix other type issue? I ask because removing it doesn't seem to cause an error when "strictNullChecks": true is enabled.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i tried another fix.

    const clusterHard = clusterResourceQuota.status?.total?.hard?.[resourceName];
    const clusterUsed = clusterResourceQuota.status?.total?.used?.[resourceName];

    const { label, percent } = getLabelAndUsage({
      resourceName,
      used: clusterUsed ?? '',
      hard: clusterHard ?? '', 

const clusterHard = clusterResourceQuota.status.total.hard[resourceName];
const clusterUsed = clusterResourceQuota.status.total.used?.[resourceName];
const clusterHard = clusterResourceQuota.status?.total?.hard?.[resourceName || ''];
const clusterUsed = clusterResourceQuota.status?.total?.used?.[resourceName || ''];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

const hard = resourceQuota.status.hard[resourceName];
const used = resourceQuota.status.used?.[resourceName];
const hard = resourceQuota.status?.hard?.[resourceName || ''];
const used = resourceQuota.status?.used?.[resourceName || ''];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -32,7 +32,7 @@ const GuidedTour: React.FC = () => {
backButtonText={t('console-app~Back')}
/>
);
const step = steps[stepNumber - 1];
const step = steps?.[(stepNumber || 0) - 1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent potential issues with negative values, could we assign a default value to stepNumber before this block? This would ensure the if (startTour || stepNumber === 0) { check runs first.

onClick: () => {
onBack && onBack();
},
}}
step={step}
>
{showStepBadge ? <StepBadge stepNumber={step} totalSteps={totalSteps} /> : null}
{showStepBadge ? <StepBadge stepNumber={step || 0} totalSteps={totalSteps || 0} /> : null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default alternative mentioned above might work here as well.

@krishagarwal278
Copy link
Member Author

/retest

@yanpzhan
Copy link
Contributor

Local tsc check passed against the files in pr code.
But when access quickstart page '/quickstart' on cluster launched against the pr, the page loaded very slowly, once the quickstarts are loaded, clicking on one quickstart item has no response.
@krishagarwal278 Could you help to check if code change related quickstarts affects the page usage?

Copy link
Contributor

@cajieh cajieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The work looks good👍, although I added a nit.
Thank you.😁
/lgtm

onClick: () => {
onBack && onBack();
},
}}
step={step}
>
{showStepBadge ? <StepBadge stepNumber={step} totalSteps={totalSteps} /> : null}
{showStepBadge ? <StepBadge stepNumber={step ?? 0} totalSteps={totalSteps ?? 0} /> : null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The props default values might be cleaner than Nullish Coalescing Operator.

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 25, 2025
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2025
@cajieh
Copy link
Contributor

cajieh commented Aug 25, 2025

@krishagarwal278 Could you squash the commits?

@krishagarwal278
Copy link
Member Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 25, 2025
@cajieh
Copy link
Contributor

cajieh commented Aug 25, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2025
@krishagarwal278
Copy link
Member Author

/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Aug 25, 2025
@krishagarwal278
Copy link
Member Author

/test frontend

@yanpzhan
Copy link
Contributor

Checked the pr again, there is not regression issue now.
/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Aug 26, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Aug 26, 2025

@krishagarwal278: This pull request references CONSOLE-4697 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:

Fixed SNC errors in storage, resource-quota, quick-starts, tour, tab, vpa

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.

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2151cf2 and 2 for PR HEAD 94b544c in total

2 similar comments
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2151cf2 and 2 for PR HEAD 94b544c in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2151cf2 and 2 for PR HEAD 94b544c in total

@krishagarwal278
Copy link
Member Author

/retest

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2025
@cajieh
Copy link
Contributor

cajieh commented Aug 26, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2025
Copy link
Contributor

openshift-ci bot commented Aug 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cajieh, krishagarwal278

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2151cf2 and 2 for PR HEAD d3f5043 in total

1 similar comment
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 2151cf2 and 2 for PR HEAD d3f5043 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 9592eef and 2 for PR HEAD d3f5043 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 963a204 and 1 for PR HEAD d3f5043 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 02f0f4a and 0 for PR HEAD d3f5043 in total

Copy link
Contributor

openshift-ci bot commented Aug 28, 2025

@krishagarwal278: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/frontend d3f5043 link true /test frontend

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.

@openshift-ci-robot
Copy link
Contributor

/hold

Revision d3f5043 was retested 3 times: holding

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants