Skip to content

Conversation

krishagarwal278
Copy link
Member

No description provided.

@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 12, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Aug 12, 2025

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

@openshift-ci openshift-ci bot requested review from Lucifergene and Mylanos August 12, 2025 20:30
@openshift-ci openshift-ci bot added component/helm Related to helm-plugin component/insights Related to insights plugin component/topology Related to topology labels Aug 12, 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 12, 2025
@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 12, 2025
@krishagarwal278
Copy link
Member Author

/assign @yapei
/assign @jhadvig

@yanpzhan
Copy link
Contributor

Checked on cluster launched against the pr. The regression test passed.
/label qe-approved

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

openshift-ci-robot commented Aug 14, 2025

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

@krishagarwal278
Copy link
Member Author

/retest

@jhadvig
Copy link
Member

jhadvig commented Aug 15, 2025

The frontend test is failing with a few valid issues
Screenshot 2025-08-15 at 14 04 00

@krishagarwal278
Copy link
Member Author

krishagarwal278 commented Aug 15, 2025

The frontend test is failing with a few valid issues Screenshot 2025-08-15 at 14 04 00

Yes, latest commit should address this failure

@@ -31,7 +31,7 @@ const HelmReleaseStatusDecorator: React.FC<HelmReleaseStatusDecoratorProps> = ({

return (
<Tooltip triggerRef={ref} content={label} position={TooltipPosition.left}>
<g ref={ref}>
<g ref={(ref as unknown) as React.RefObject<SVGGElement>}>
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 instead change the type of ref instead of coercing it like this?

const ref = useRef<SVGGElement>();

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in latest commit

@@ -25,7 +26,7 @@ const HelmReleasePanelDetailsTabSection: React.FC<{ element: GraphElement }> = (
<p>Status Box</p>
</>
) : (
<HelmReleaseOverview obj={secret} customData={undefined} />
<HelmReleaseOverview obj={secret} customData={(undefined as unknown) as HelmRelease} />
Copy link
Member

Choose a reason for hiding this comment

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

instead of forcing undefined to be a HelmRelease we should instead make HelmReleaseOverview accept undefined in this prop

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in latest commit

Copy link
Member

@logonoff logonoff left a comment

Choose a reason for hiding this comment

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

looking a lot better!

/>
</TableData>
<TableData className={tableColumnClasses.type}>{resource.kind}</TableData>
<TableData className={tableColumnClasses.status}>
<HelmReleaseResourceStatus resource={resource} />
</TableData>
<TableData className={tableColumnClasses.created}>
<Timestamp timestamp={resource.metadata.creationTimestamp} />
<Timestamp timestamp={resource.metadata?.creationTimestamp || ''} />
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can copy the timestamp changes from your other PR so we don't need the empty string fallback here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yes definitely. Making that change

@@ -232,7 +237,7 @@ const HelmInstallUpgradePage: React.FunctionComponent = () => {
onNamespaceChange={handleNamespaceChange}
hideApplications
>
<DocumentTitle>{config.title}</DocumentTitle>
<DocumentTitle>{config?.title || ''}</DocumentTitle>
Copy link
Member

Choose a reason for hiding this comment

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

i think we wouldn't want to set the title as empty string

Suggested change
<DocumentTitle>{config?.title || ''}</DocumentTitle>
{config?.title && <DocumentTitle>{config.title}</DocumentTitle> }

Comment on lines 252 to 254
helmActionConfig={config as HelmActionConfigType}
onVersionChange={setChartData}
chartError={chartError}
namespace={namespace}
chartIndexEntry={indexEntry}
chartError={chartError as Error}
Copy link
Member

Choose a reason for hiding this comment

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

are these type assertions still needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

RIght, it can be removed

@@ -110,7 +125,7 @@ const RepositoriesPage: React.FC<RepositoriesPageProps> = ({
<DocumentTitle>{t('helm-plugin~Helm Repositories')}</DocumentTitle>
<MultiListPage
namespace={namespace}
flatten={flatten}
flatten={flatten as Flatten}
Copy link
Member

Choose a reason for hiding this comment

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

is this type assertion still needed?

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, giving type errors when i remove it

const [{ dragging: labelDragging }, dragLabelRef] = useDragNode(noRegroupDragSourceSpec);
const nodeRefs = useCombineRefs(innerHoverRef, dragNodeRef);
const nodeRefs = useCombineRefs(innerHoverRef, dragNodeRef as React.Ref<Element>);
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 to remove the type assertion in line 90?

Suggested change
const nodeRefs = useCombineRefs(innerHoverRef, dragNodeRef as React.Ref<Element>);
const nodeRefs = useCombineRefs<SVGGElement>(innerHoverRef, dragNodeRef);

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 removing it in line 90 isn't give me errors

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 21, 2025
@openshift-ci openshift-ci bot added component/sdk Related to console-plugin-sdk plugin-api-changed Categorizes a PR as containing plugin API changes labels Aug 21, 2025
Copy link
Contributor

@Leo6Leo Leo6Leo left a comment

Choose a reason for hiding this comment

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

Thanks to @krishagarwal278 explanation on this PR. Based on my understanding, the PR is trying to solve all the errors generated after upgrading from i18next: ^21.10.0 to 23.0.0 and react-i18next: ^11.12.0 to ^13.2.2 which introduced this stricter typing policy and enabling the strictNullChecks compiler option.

After I enable the compiler option strictNullChecks: true, and complete the upgrade with the main branch code, there are errors shows up; but on this PR branch, no errors are observed after running yarn install.

Since I am not an React expert, I couldn't provide any insightful suggestions regarding how to improve code quality or whether it is adopting the best practices. But from my reading through the PR, all the changes make sense to me, and

  • There are no breaking functional changes that could break the whole application
  • You are adding more type safety

Therefore, I will go ahead and give lgtm for this PR after seeing the most of the CI tests are passing and the review comments are addressed.

@@ -10,7 +10,7 @@ import HelmChartSummary from './HelmChartSummary';

export interface HelmReleaseOverviewProps {
obj: K8sResourceKind;
customData: HelmRelease;
customData?: HelmRelease;
}

const HelmReleaseOverview: React.FC<HelmReleaseOverviewProps> = ({ obj, customData }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to update the FC to FCC, as I prob see @logonoff has suggested in some other PRs before.

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed nit

@Leo6Leo
Copy link
Contributor

Leo6Leo commented Aug 27, 2025

LGTM! Since I am not the React expert, I will leave this PR for others to take a second look.

chartName,
chartRepoName: helmChartRepoName || '',
appVersion,
chartVersion,
chartReadme,
yamlData: initialYamlData,
formData: initialFormData,
formSchema: initialFormSchema,
formData: initialFormData as Record<string, unknown>,
Copy link
Member

Choose a reason for hiding this comment

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

the type of formData is typically any in HelmInstallUpgradeFormData, should we be updating that to Record<string, unknown>?

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 we can revert back to any in HelmInstallUpgradeFormData without getting any errors

Comment on lines 55 to 61
let res: {
prop: string;
kind: string;
namespaced: boolean;
isList: boolean;
namespace?: string;
}[] = [];
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can deduplicate the type

Suggested change
let res: {
prop: string;
kind: string;
namespaced: boolean;
isList: boolean;
namespace?: string;
}[] = [];
let res: MultiListPageProps['resources'][] = [];


const flatten = (resourceLists) => {
const flatten = (resourceLists: Record<string, { data?: unknown[] }>) => {
Copy link
Member

Choose a reason for hiding this comment

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

if we do this, do we need the assertion in line 128? at least this way TS will check if flatten is a Flatten

Suggested change
const flatten = (resourceLists: Record<string, { data?: unknown[] }>) => {
const flatten: Flatten = (resourceLists: Record<string, { data?: unknown[] }>) => {

@@ -18,7 +18,7 @@ export const useHelmChartRepositoriesBreadcrumbs = (kindObj: K8sKind) => {
return useTabbedTableBreadcrumbsFor(
kindObj,
location,
params,
params as { string },
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can update the expected params type in useTabbedTableBreadcrumbsFor instead because this is the only place where that function is used I think

Copy link
Member Author

Choose a reason for hiding this comment

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

made params required in useTabbedTableBreadcrumbsFor

Comment on lines 138 to 142
typedDataModel.nodes?.push(
getTopologyNodeItem(resource, TYPE_HELM_WORKLOAD, data, WorkloadModelProps),
);
const groups = getTopologyHelmReleaseGroupItem(resource, helmResourcesMap, secrets);
mergeGroups(groups, typedDataModel.nodes);
mergeGroups(groups, typedDataModel.nodes as NodeModel[]);
Copy link
Member

Choose a reason for hiding this comment

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

node is always defined, do you think it would be nicer to do this in line 121, then remove the ?.push and the as NodeModel[]?

      const typedDataModel: Required<Omit<Model, 'graph'>> = {

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 it's cleaner that way. Removed ?. and as NodeModel[]

@@ -253,8 +259,8 @@ export const getHelmActionConfig = (
),
},
helmReleaseApi: `/api/helm/chart?url=${encodeURIComponent(
chartURL,
)}&namespace=${namespace}&indexEntry=${encodeURIComponent(chartIndexEntry)}`,
chartURL as string,
Copy link
Member

Choose a reason for hiding this comment

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

should chartURL be a required parameter?

chartURL,
)}&namespace=${namespace}&indexEntry=${encodeURIComponent(chartIndexEntry)}`,
chartURL as string,
)}&namespace=${namespace}&indexEntry=${encodeURIComponent(chartIndexEntry as string)}`,
Copy link
Member

Choose a reason for hiding this comment

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

should chartIndexEntry be required?

@@ -272,7 +278,7 @@ export const getHelmActionConfig = (
},
helmReleaseApi: `/api/helm/release?ns=${namespace}&name=${releaseName}`,
fetch: coFetchJSON.put,
redirectURL: getOriginRedirectURL(actionOrigin, namespace, releaseName),
redirectURL: getOriginRedirectURL(actionOrigin as string, namespace, releaseName),
Copy link
Member

Choose a reason for hiding this comment

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

should these be required too?

Copy link
Member Author

@krishagarwal278 krishagarwal278 Aug 27, 2025

Choose a reason for hiding this comment

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

replaced with either fallback value(includes undefined too in cases where it's required) or made it required instead of using as

@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 27, 2025
@openshift-ci openshift-ci bot added the component/shared Related to console-shared label Aug 27, 2025
Copy link
Member

@logonoff logonoff left a comment

Choose a reason for hiding this comment

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

/lgtm

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

openshift-ci bot commented Aug 27, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@krishagarwal278
Copy link
Member Author

/retest

@@ -697,7 +697,7 @@ export type ResourceEventStreamProps = {
};

export type TimestampProps = {
timestamp: string | number | Date;
timestamp: string | number | Date | null;
Copy link
Member

Choose a reason for hiding this comment

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

I think this is reasonable since the component clearly handles this case. We should update the documentation for the component to discuss what happens if null is passed.

};

const LabelComponent = ({ clusterID, ...props }) => (
<ExternalLink
href={`https://console.redhat.com/openshift/insights/advisor/clusters/${clusterID}?total_risk=${
riskSorting[props.datum.id] + 1
riskSorting[props.datum?.id as string] + 1
Copy link
Member

Choose a reason for hiding this comment

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

I see quite a few uses of as in the PR. It usually indicates that there is a problem with our type declarations. It would be better to fix that in most cases.

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

openshift-ci bot commented Aug 28, 2025

New changes are detected. LGTM label has been removed.

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 aa6ab2b 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
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/helm Related to helm-plugin component/insights Related to insights plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared 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. plugin-api-changed Categorizes a PR as containing plugin API changes 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.

9 participants