mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
fix: lifecycle button permissions (#7395)
This commit is contained in:
parent
708183ce26
commit
7e565760f6
@ -8,6 +8,7 @@ import {
|
|||||||
DELETE_FEATURE,
|
DELETE_FEATURE,
|
||||||
UPDATE_FEATURE,
|
UPDATE_FEATURE,
|
||||||
} from 'component/providers/AccessProvider/permissions';
|
} from 'component/providers/AccessProvider/permissions';
|
||||||
|
import { Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
const currentTime = '2024-04-25T08:05:00.000Z';
|
const currentTime = '2024-04-25T08:05:00.000Z';
|
||||||
const twoMinutesAgo = '2024-04-25T08:03:00.000Z';
|
const twoMinutesAgo = '2024-04-25T08:03:00.000Z';
|
||||||
@ -22,6 +23,10 @@ const renderOpenTooltip = (
|
|||||||
loading = false,
|
loading = false,
|
||||||
) => {
|
) => {
|
||||||
render(
|
render(
|
||||||
|
<Routes>
|
||||||
|
<Route
|
||||||
|
path={'/projects/:projectId'}
|
||||||
|
element={
|
||||||
<FeatureLifecycleTooltip
|
<FeatureLifecycleTooltip
|
||||||
stage={stage}
|
stage={stage}
|
||||||
onArchive={onArchive}
|
onArchive={onArchive}
|
||||||
@ -30,8 +35,12 @@ const renderOpenTooltip = (
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
>
|
>
|
||||||
<span>child</span>
|
<span>child</span>
|
||||||
</FeatureLifecycleTooltip>,
|
</FeatureLifecycleTooltip>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Routes>,
|
||||||
{
|
{
|
||||||
|
route: '/projects/default',
|
||||||
permissions: [
|
permissions: [
|
||||||
{ permission: DELETE_FEATURE },
|
{ permission: DELETE_FEATURE },
|
||||||
{ permission: UPDATE_FEATURE },
|
{ permission: UPDATE_FEATURE },
|
||||||
|
@ -25,6 +25,7 @@ import { isSafeToArchive } from './isSafeToArchive';
|
|||||||
import { useLocationSettings } from 'hooks/useLocationSettings';
|
import { useLocationSettings } from 'hooks/useLocationSettings';
|
||||||
import { formatDateYMDHMS } from 'utils/formatDate';
|
import { formatDateYMDHMS } from 'utils/formatDate';
|
||||||
import { formatDistanceToNow, parseISO } from 'date-fns';
|
import { formatDistanceToNow, parseISO } from 'date-fns';
|
||||||
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
|
|
||||||
const TimeLabel = styled('span')(({ theme }) => ({
|
const TimeLabel = styled('span')(({ theme }) => ({
|
||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
@ -267,6 +268,8 @@ const LiveStageDescription: FC<{
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
}> = ({ children, onComplete, loading }) => {
|
}> = ({ children, onComplete, loading }) => {
|
||||||
|
const projectId = useRequiredPathParam('projectId');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BoldTitle>Is this feature complete?</BoldTitle>
|
<BoldTitle>Is this feature complete?</BoldTitle>
|
||||||
@ -285,6 +288,7 @@ const LiveStageDescription: FC<{
|
|||||||
size='small'
|
size='small'
|
||||||
onClick={onComplete}
|
onClick={onComplete}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
|
projectId={projectId}
|
||||||
>
|
>
|
||||||
Mark completed
|
Mark completed
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
@ -303,6 +307,8 @@ const SafeToArchive: FC<{
|
|||||||
onUncomplete: () => void;
|
onUncomplete: () => void;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
}> = ({ onArchive, onUncomplete, loading }) => {
|
}> = ({ onArchive, onUncomplete, loading }) => {
|
||||||
|
const projectId = useRequiredPathParam('projectId');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BoldTitle>Safe to archive</BoldTitle>
|
<BoldTitle>Safe to archive</BoldTitle>
|
||||||
@ -319,6 +325,7 @@ const SafeToArchive: FC<{
|
|||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
flexWrap: 'wrap',
|
||||||
gap: 2,
|
gap: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -329,6 +336,7 @@ const SafeToArchive: FC<{
|
|||||||
size='small'
|
size='small'
|
||||||
onClick={onUncomplete}
|
onClick={onUncomplete}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
|
projectId={projectId}
|
||||||
>
|
>
|
||||||
Revert to live
|
Revert to live
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
@ -339,6 +347,7 @@ const SafeToArchive: FC<{
|
|||||||
size='small'
|
size='small'
|
||||||
sx={{ mb: 2 }}
|
sx={{ mb: 2 }}
|
||||||
onClick={onArchive}
|
onClick={onArchive}
|
||||||
|
projectId={projectId}
|
||||||
>
|
>
|
||||||
Archive feature
|
Archive feature
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
|
Loading…
Reference in New Issue
Block a user