1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

feat: archived indicators and disabled button when editing archived template (#9503)

This commit is contained in:
David Leek 2025-03-13 09:16:55 +01:00 committed by GitHub
parent 29181118ce
commit 22f51df76c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View File

@ -110,11 +110,13 @@ export const EditReleasePlanTemplate = () => {
formatApiCode={formatApiCode}
handleSubmit={handleSubmit}
loading={loading}
archived={!!template.archivedAt}
>
<StyledButtonContainer>
<UpdateButton
name='template'
permission={RELEASE_PLAN_TEMPLATE_UPDATE}
disabled={!!template.archivedAt}
>
Save changes
</UpdateButton>

View File

@ -1,5 +1,5 @@
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 FormTemplate from 'component/common/FormTemplate/FormTemplate';
import { TemplateFormDescription } from './TemplateFormDescription';
@ -45,6 +45,7 @@ interface ITemplateFormProps {
errors: { [key: string]: string };
clearErrors: () => void;
formTitle: string;
archived?: boolean;
formatApiCode: () => string;
handleSubmit: (e: React.FormEvent) => void;
loading?: boolean;
@ -61,6 +62,7 @@ export const TemplateForm: React.FC<ITemplateFormProps> = ({
errors,
clearErrors,
formTitle,
archived,
formatApiCode,
handleSubmit,
children,
@ -81,6 +83,11 @@ export const TemplateForm: React.FC<ITemplateFormProps> = ({
description={<TemplateFormDescription />}
formatApiCode={formatApiCode}
>
{archived && (
<Alert severity='warning'>
This template has been archived and can no longer be edited.
</Alert>
)}
<StyledForm onSubmit={handleSubmit}>
<StyledInput
label='Template name'

View File

@ -15,6 +15,7 @@ export interface IReleasePlanTemplate {
createdAt: string;
createdByUserId: number;
milestones: IReleasePlanMilestonePayload[];
archivedAt?: string;
}
export interface IReleasePlan {