Skip to content

Conversation

@zhuje
Copy link
Contributor

@zhuje zhuje commented Feb 3, 2026

https://issues.redhat.com/browse/OU-1138

Screen.Recording.2026-02-02.at.7.12.59.PM.mov

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zhuje

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

The pull request process is described here

Details 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 3, 2026
const { addAlert } = useToast();

const formGroupStyle = {
'--pf-v6-c-form__label-text--FontWeight': 'bold',
Copy link
Contributor

@jgbernalp jgbernalp Feb 3, 2026

Choose a reason for hiding this comment

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

we should prefer to use patternfly react tokens

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to:

const formGroupStyle = {
    fontWeight: t_global_font_weight_200.value,
  } as React.CSSProperties;

Comment on lines +41 to +42
import { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
Copy link
Contributor

@jgbernalp jgbernalp Feb 3, 2026

Choose a reason for hiding this comment

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

These dependencies are not directly installed, they come with the perses ui components. But we should reference them directly in dependencies if we are going to use this now directly in the plugin code

ouiaId="RenameModal"
aria-labelledby="rename-modal"
>
<ModalHeader title="Rename Dashboard" labelId="rename-modal-title" />
Copy link
Contributor

Choose a reason for hiding this comment

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

All titles and messages should include translations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it.

return null;
}

if (permissionsLoading || persesProjects.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are no perses projects, this modal will be just open?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, the modal won't open, and this isn't needed. I removed the block.

const selectedProject = filteredProjects.find((p) => p.metadata.name === selectedProjectName);
return selectedProject
? getResourceDisplayName(selectedProject)
: selectedProjectName || 'Select project';
Copy link
Contributor

Choose a reason for hiding this comment

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

translation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it

};

const formGroupStyle = {
'--pf-v6-c-form__label-text--FontWeight': 'bold',
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems duplicated in other components already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted the repeated const formGroupStyle.

export const dashboardDisplayNameValidationSchema = z
.string()
.min(1, 'Required')
.max(75, 'Must be 75 or fewer characters long');
Copy link
Contributor

Choose a reason for hiding this comment

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

how do we input translations to this validator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

export const createDashboardDisplayNameValidationSchema = (t?: (key: string) => string) =>
  z
    .string()
    .min(1, t ? t('Required') : 'Required')
    .max(75, t ? t('Must be 75 or fewer characters long') : 'Must be 75 or fewer characters long');

onClose={onClose}
aria-labelledby="duplicate-modal-title"
>
<ModalHeader title="Duplicate Dashboard" labelId="duplicate-modal-title" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<ModalHeader title="Duplicate Dashboard" labelId="duplicate-modal-title" />
<ModalHeader title={t("Duplicate Dashboard")} labelId="duplicate-modal-title" />

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it

);
}

if (filteredProjects.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this apply for other actions as well? I don't see this logic in other modals, if needed we should extract it so it can be reused on other modals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this applies only to the Duplicate Modal. It checks which projects the user has access to in the 'Select namespace' dropdown before they can create a new dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants