Skip to content

Conversation

krishagarwal278
Copy link
Member

Fixed SNC related errors in
/console-app/src/components/{packages/console-ap/src/components/ lightspeed | modals | nav | file-upload}

@krishagarwal278
Copy link
Member Author

/label px-approved
/label docs-approved

@openshift-ci openshift-ci bot requested review from jhadvig and kyoto August 18, 2025 20:34
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Aug 18, 2025
Copy link
Contributor

openshift-ci bot commented Aug 18, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: krishagarwal278
Once this PR has been reviewed and has the lgtm label, please assign mylanos for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Aug 18, 2025
@krishagarwal278 krishagarwal278 changed the title Fixed SNC errors in /components/ lightspeed | modals | nav | file-upload CONSOLE-4695: Fixed SNC errors in /components/ lightspeed | modals | nav | file-upload Aug 18, 2025
@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 18, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Aug 18, 2025

@krishagarwal278: This pull request references CONSOLE-4695 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 related errors in
/console-app/src/components/{packages/console-ap/src/components/ lightspeed | modals | nav | file-upload}

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.

@krishagarwal278
Copy link
Member Author

/jira refresh

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Aug 18, 2025

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

/jira refresh

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.

@krishagarwal278
Copy link
Member Author

/retest

@openshift-merge-robot openshift-merge-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 19, 2025
@logonoff
Copy link
Member

/cc

@openshift-ci openshift-ci bot requested a review from logonoff August 20, 2025 20:04
@@ -13,8 +13,8 @@ export type FileUploadContextType = {
setFileUpload: (file: File) => void;
};

export const FileUploadContext = createContext<FileUploadContextType>({
fileUpload: undefined,
export const FileUploadContext = React.createContext<FileUploadContextType>({
Copy link
Member

Choose a reason for hiding this comment

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

the namespace import returned as a result of merge conflict resolution

Suggested change
export const FileUploadContext = React.createContext<FileUploadContextType>({
export const FileUploadContext = createContext<FileUploadContextType>({

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, will remove namespace imports throughout this and other PRs

export const FileUploadContext = createContext<FileUploadContextType>({
fileUpload: undefined,
export const FileUploadContext = React.createContext<FileUploadContextType>({
fileUpload: undefined as any,
Copy link
Member

Choose a reason for hiding this comment

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

can we update FileUploadContextType to be File | undefined instead?

@@ -26,8 +26,8 @@ export const useValuesFileUploadContext = (): FileUploadContextType => {
const [fileUploadExtensions, resolved] = useResolvedExtensions<FileUpload>(isFileUpload);
const toastContext = useToast();
const [namespace] = useActiveNamespace();
const [file, setFile] = useState<File>(undefined);
const fileExtensions = useMemo(
const [file, setFile] = React.useState<File>(undefined as any);
Copy link
Member

Choose a reason for hiding this comment

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

i believe asserting types as any is an antipattern (as it inhibits type checking) and should be avoided in new/future code

Suggested change
const [file, setFile] = React.useState<File>(undefined as any);
const [file, setFile] = useState<File | undefined>(undefined);

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. It'll defeat the purpose of type checking. I'll revert instances of any wherever i notice it

close();
history.push(resourceObjPath(cloneResource, referenceFor(cloneResource)));
close?.();
history.push(resourceObjPath(cloneResource, referenceFor(cloneResource)) as any);
Copy link
Member

Choose a reason for hiding this comment

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

same comment about usage of as any

@@ -262,7 +264,7 @@ const ClonePVCModal = withHandlePromise((props: ClonePVCModalProps) => {
submitDisabled={!validSize || !pvcSC}
errorMessage={errorMessage}
submitText={t('console-app~Clone')}
cancel={cancel}
cancel={cancel as any}
Copy link
Member

Choose a reason for hiding this comment

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

same comment about usage of as any

Comment on lines 114 to 115
appendTo: () =>
document.querySelector("[data-test-id='perspective-switcher-toggle']") as HTMLElement,
Copy link
Member

Choose a reason for hiding this comment

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

does this work?

Suggested change
appendTo: () =>
document.querySelector("[data-test-id='perspective-switcher-toggle']") as HTMLElement,
appendTo: () =>
document.querySelector<HTMLElement>("[data-test-id='perspective-switcher-toggle']"),

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 it removed the type error earlier. We can also use generic type instead

@@ -151,7 +152,7 @@ const PinnedResource: React.FC<PinnedResourceProps> = ({
'oc-pinned-resource--dragging': draggable && isOver,
})}
>
{draggable ? <DraggableButton dragRef={drag} /> : null}
{draggable ? <DraggableButton dragRef={drag as any} /> : null}
Copy link
Member

Choose a reason for hiding this comment

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

insert as any comment here

@@ -268,7 +268,7 @@ export type ModalSubmitFooterProps = {
message?: string;
errorMessage?: string;
inProgress: boolean;
cancel: (e: React.SyntheticEvent<any, Event>) => void;
cancel?: (e: React.SyntheticEvent<any, Event>) => void;
Copy link
Member

Choose a reason for hiding this comment

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

given how we're trying to deprecate and rewrite these modals I don't think we should change the proptype if possible

@yanpzhan
Copy link
Contributor

Local tsc check passed against the files in pr code and regression test passed on cluster launched against the pr.
/label qe-approved

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

openshift-ci-robot commented Aug 21, 2025

@krishagarwal278: This pull request references CONSOLE-4695 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 related errors in
/console-app/src/components/{packages/console-ap/src/components/ lightspeed | modals | nav | file-upload}

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.

@krishagarwal278
Copy link
Member Author

/retest

1 similar comment
@krishagarwal278
Copy link
Member Author

/retest

Comment on lines +114 to +119
appendTo: () => {
const element = document.querySelector<HTMLElement>(
"[data-test-id='perspective-switcher-toggle']",
);
return element || document.body;
},
Copy link
Member

Choose a reason for hiding this comment

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

does e2e still work with this change?

Suggested change
appendTo: () => {
const element = document.querySelector<HTMLElement>(
"[data-test-id='perspective-switcher-toggle']",
);
return element || document.body;
},
appendTo: "inline"

@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 21, 2025
…/src/components/ lightspeed | modals | nav | file-upload}

	modified:   frontend/packages/console-app/src/components/file-upload/__tests__/file-upload-utils.spec.ts
	modified:   frontend/packages/console-app/src/components/modals/clone/clone-pvc-modal.tsx
	modified:   frontend/packages/console-app/src/components/modals/resource-limits/ResourceLimitsModalLauncher.tsx
	modified:   frontend/packages/console-app/src/components/modals/restore-pvc/restore-pvc-modal.tsx
	modified:   frontend/packages/console-app/src/components/nav/NavHeader.tsx
	modified:   frontend/packages/console-app/src/components/nav/PinnedResource.tsx
	modified:   frontend/packages/console-app/src/components/nav/PluginNavItem.tsx
	modified:   frontend/packages/console-app/src/components/nav/utils.ts
	modified:   frontend/public/components/factory/modal.tsx
@openshift-ci openshift-ci bot added the component/topology Related to topology label Aug 27, 2025
Copy link
Contributor

openshift-ci bot commented Aug 27, 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 3040319 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/core Related to console core functionality component/topology Related to topology 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. 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.

5 participants