mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
feat: preview changes button (#7722)
This commit is contained in:
parent
4aa3a64530
commit
5668bfb7d4
@ -145,6 +145,9 @@ const uiConfig = () => {
|
|||||||
versionInfo: {
|
versionInfo: {
|
||||||
current: { oss: 'version', enterprise: 'version' },
|
current: { oss: 'version', enterprise: 'version' },
|
||||||
},
|
},
|
||||||
|
flags: {
|
||||||
|
changeRequestPlayground: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,6 +226,8 @@ test('should allow scheduling of approved change request and show the schedule d
|
|||||||
fireEvent.click(scheduleChangesButton);
|
fireEvent.click(scheduleChangesButton);
|
||||||
|
|
||||||
await screen.findByRole('dialog', { name: 'Schedule changes' });
|
await screen.findByRole('dialog', { name: 'Schedule changes' });
|
||||||
|
|
||||||
|
await screen.findByText('Preview changes');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should show a reschedule dialog when change request is scheduled and update schedule is selected', async () => {
|
test('should show a reschedule dialog when change request is scheduled and update schedule is selected', async () => {
|
||||||
@ -249,6 +254,7 @@ test('should show a reschedule dialog when change request is scheduled and updat
|
|||||||
const scheduleChangesButton = await screen.findByRole('menuitem', {
|
const scheduleChangesButton = await screen.findByRole('menuitem', {
|
||||||
name: 'Update schedule',
|
name: 'Update schedule',
|
||||||
});
|
});
|
||||||
|
await screen.findByText('Preview changes');
|
||||||
|
|
||||||
fireEvent.click(scheduleChangesButton);
|
fireEvent.click(scheduleChangesButton);
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ import {
|
|||||||
} from './ChangeRequestScheduledDialogs/changeRequestScheduledDialogs';
|
} from './ChangeRequestScheduledDialogs/changeRequestScheduledDialogs';
|
||||||
import { ScheduleChangeRequestDialog } from './ChangeRequestScheduledDialogs/ScheduleChangeRequestDialog';
|
import { ScheduleChangeRequestDialog } from './ChangeRequestScheduledDialogs/ScheduleChangeRequestDialog';
|
||||||
import type { PlausibleChangeRequestState } from '../changeRequest.types';
|
import type { PlausibleChangeRequestState } from '../changeRequest.types';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
|
|
||||||
const StyledAsideBox = styled(Box)(({ theme }) => ({
|
const StyledAsideBox = styled(Box)(({ theme }) => ({
|
||||||
width: '30%',
|
width: '30%',
|
||||||
@ -101,6 +103,8 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
const { isChangeRequestConfiguredForReview } =
|
const { isChangeRequestConfiguredForReview } =
|
||||||
useChangeRequestsEnabled(projectId);
|
useChangeRequestsEnabled(projectId);
|
||||||
const [disabled, setDisabled] = useState(false);
|
const [disabled, setDisabled] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const changeRequestPlaygroundEnabled = useUiFlag('changeRequestPlayground');
|
||||||
|
|
||||||
if (!changeRequest) {
|
if (!changeRequest) {
|
||||||
return null;
|
return null;
|
||||||
@ -376,6 +380,7 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
</ReviewButton>
|
</ReviewButton>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={changeRequest.state === 'Approved'}
|
condition={changeRequest.state === 'Approved'}
|
||||||
show={
|
show={
|
||||||
@ -414,6 +419,27 @@ export const ChangeRequestOverview: FC = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={
|
||||||
|
changeRequestPlaygroundEnabled &&
|
||||||
|
(changeRequest.state === 'In review' ||
|
||||||
|
changeRequest.state === 'Approved' ||
|
||||||
|
changeRequest.state === 'Scheduled')
|
||||||
|
}
|
||||||
|
show={
|
||||||
|
<StyledButton
|
||||||
|
variant='outlined'
|
||||||
|
onClick={() => {
|
||||||
|
navigate(
|
||||||
|
`/playground?changeRequest=${changeRequest.id}`,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Preview changes
|
||||||
|
</StyledButton>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={
|
condition={
|
||||||
changeRequest.state !== 'Applied' &&
|
changeRequest.state !== 'Applied' &&
|
||||||
|
Loading…
Reference in New Issue
Block a user