mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-14 01:16:17 +02:00
feat: archived indicators and disabled button when editing archived template (#9503)
This commit is contained in:
parent
29181118ce
commit
22f51df76c
@ -110,11 +110,13 @@ export const EditReleasePlanTemplate = () => {
|
|||||||
formatApiCode={formatApiCode}
|
formatApiCode={formatApiCode}
|
||||||
handleSubmit={handleSubmit}
|
handleSubmit={handleSubmit}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
archived={!!template.archivedAt}
|
||||||
>
|
>
|
||||||
<StyledButtonContainer>
|
<StyledButtonContainer>
|
||||||
<UpdateButton
|
<UpdateButton
|
||||||
name='template'
|
name='template'
|
||||||
permission={RELEASE_PLAN_TEMPLATE_UPDATE}
|
permission={RELEASE_PLAN_TEMPLATE_UPDATE}
|
||||||
|
disabled={!!template.archivedAt}
|
||||||
>
|
>
|
||||||
Save changes
|
Save changes
|
||||||
</UpdateButton>
|
</UpdateButton>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Input from 'component/common/Input/Input';
|
import Input from 'component/common/Input/Input';
|
||||||
import { styled, useTheme } from '@mui/material';
|
import { Alert, styled, useTheme } from '@mui/material';
|
||||||
import type { IReleasePlanMilestonePayload } from 'interfaces/releasePlans';
|
import type { IReleasePlanMilestonePayload } from 'interfaces/releasePlans';
|
||||||
import FormTemplate from 'component/common/FormTemplate/FormTemplate';
|
import FormTemplate from 'component/common/FormTemplate/FormTemplate';
|
||||||
import { TemplateFormDescription } from './TemplateFormDescription';
|
import { TemplateFormDescription } from './TemplateFormDescription';
|
||||||
@ -45,6 +45,7 @@ interface ITemplateFormProps {
|
|||||||
errors: { [key: string]: string };
|
errors: { [key: string]: string };
|
||||||
clearErrors: () => void;
|
clearErrors: () => void;
|
||||||
formTitle: string;
|
formTitle: string;
|
||||||
|
archived?: boolean;
|
||||||
formatApiCode: () => string;
|
formatApiCode: () => string;
|
||||||
handleSubmit: (e: React.FormEvent) => void;
|
handleSubmit: (e: React.FormEvent) => void;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
@ -61,6 +62,7 @@ export const TemplateForm: React.FC<ITemplateFormProps> = ({
|
|||||||
errors,
|
errors,
|
||||||
clearErrors,
|
clearErrors,
|
||||||
formTitle,
|
formTitle,
|
||||||
|
archived,
|
||||||
formatApiCode,
|
formatApiCode,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
children,
|
children,
|
||||||
@ -81,6 +83,11 @@ export const TemplateForm: React.FC<ITemplateFormProps> = ({
|
|||||||
description={<TemplateFormDescription />}
|
description={<TemplateFormDescription />}
|
||||||
formatApiCode={formatApiCode}
|
formatApiCode={formatApiCode}
|
||||||
>
|
>
|
||||||
|
{archived && (
|
||||||
|
<Alert severity='warning'>
|
||||||
|
This template has been archived and can no longer be edited.
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
<StyledForm onSubmit={handleSubmit}>
|
<StyledForm onSubmit={handleSubmit}>
|
||||||
<StyledInput
|
<StyledInput
|
||||||
label='Template name'
|
label='Template name'
|
||||||
|
@ -15,6 +15,7 @@ export interface IReleasePlanTemplate {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
createdByUserId: number;
|
createdByUserId: number;
|
||||||
milestones: IReleasePlanMilestonePayload[];
|
milestones: IReleasePlanMilestonePayload[];
|
||||||
|
archivedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IReleasePlan {
|
export interface IReleasePlan {
|
||||||
|
Loading…
Reference in New Issue
Block a user