-
Notifications
You must be signed in to change notification settings - Fork 40
OU-1138 DashboardList Actions Delete, Duplicate, Rename Dashboards #752
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: customizable-dashboards
Are you sure you want to change the base?
OU-1138 DashboardList Actions Delete, Duplicate, Rename Dashboards #752
Conversation
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| const { addAlert } = useToast(); | ||
|
|
||
| const formGroupStyle = { | ||
| '--pf-v6-c-form__label-text--FontWeight': 'bold', |
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.
we should prefer to use patternfly react tokens
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.
Updated to:
const formGroupStyle = {
fontWeight: t_global_font_weight_200.value,
} as React.CSSProperties;
| import { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form'; | ||
| import { zodResolver } from '@hookform/resolvers/zod'; |
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.
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" /> |
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.
All titles and messages should include translations
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.
Got it.
| return null; | ||
| } | ||
|
|
||
| if (permissionsLoading || persesProjects.length === 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.
If there are no perses projects, this modal will be just open?
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.
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'; |
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.
translation
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.
Got it
| }; | ||
|
|
||
| const formGroupStyle = { | ||
| '--pf-v6-c-form__label-text--FontWeight': 'bold', |
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.
this seems duplicated in other components already
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.
Deleted the repeated const formGroupStyle.
| export const dashboardDisplayNameValidationSchema = z | ||
| .string() | ||
| .min(1, 'Required') | ||
| .max(75, 'Must be 75 or fewer characters long'); |
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.
how do we input translations to this validator?
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.
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" /> |
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.
| <ModalHeader title="Duplicate Dashboard" labelId="duplicate-modal-title" /> | |
| <ModalHeader title={t("Duplicate Dashboard")} labelId="duplicate-modal-title" /> |
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.
Got it
| ); | ||
| } | ||
|
|
||
| if (filteredProjects.length === 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.
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.
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.
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.
…form", remove unncessary logic is Action Modals
https://issues.redhat.com/browse/OU-1138
Screen.Recording.2026-02-02.at.7.12.59.PM.mov