Skip to content
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

Templates copy #2618

Merged
merged 18 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/assets/images/icons/Duplicate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions src/assets/images/icons/Flow/Duplicate.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/containers/Flow/FlowList/FlowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useLazyQuery, useMutation, useQuery } from '@apollo/client';
import { FormControl, MenuItem, Select } from '@mui/material';

import FlowIcon from 'assets/images/icons/Flow/Dark.svg?react';
import DuplicateIcon from 'assets/images/icons/Flow/Duplicate.svg?react';
import DuplicateIcon from 'assets/images/icons/Duplicate.svg?react';
import ExportIcon from 'assets/images/icons/Flow/Export.svg?react';
import ConfigureIcon from 'assets/images/icons/Configure/UnselectedDark.svg?react';
import PinIcon from 'assets/images/icons/Pin/Active.svg?react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';

import InteractiveMessageIcon from 'assets/images/icons/InteractiveMessage/Dark.svg?react';
import DownArrow from 'assets/images/icons/DownArrow.svg?react';
import DuplicateIcon from 'assets/images/icons/Flow/Duplicate.svg?react';
import DuplicateIcon from 'assets/images/icons/Duplicate.svg?react';
import { List } from 'containers/List/List';
import {
FILTER_INTERACTIVE_MESSAGES,
Expand Down
13 changes: 9 additions & 4 deletions src/containers/Template/Form/HSM/HSM.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,26 @@ describe('Add mode', () => {
const { queryByText } = within(container.querySelector('form') as HTMLElement);
const button: any = queryByText('Submit for Approval');
await user.click(button);

// we should have 2 errors
await waitFor(() => {
expect(queryByText('Title is required.')).toBeInTheDocument();
expect(queryByText('Message is required.')).toBeInTheDocument();
});

// we should have 2 errors

fireEvent.change(container.querySelector('input[name="label"]') as HTMLInputElement, {
target: {
value:
'We are not allowing a really long title, and we should trigger validation for this.',
},
});

await user.click(button);

// we should still have 2 errors
expect(queryByText('Title is required.')).toBeInTheDocument();
expect(queryByText('Message is required.')).toBeInTheDocument();
await waitFor(() => {
expect(queryByText('Title length is too long.')).toBeInTheDocument();
expect(queryByText('Message is required.')).toBeInTheDocument();
});
});
});
6 changes: 4 additions & 2 deletions src/containers/Template/Form/HSM/HSM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from 'react';
import { useQuery } from '@apollo/client';
import { EditorState } from 'draft-js';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { useParams, useLocation } from 'react-router-dom';
import Loading from 'components/UI/Layout/Loading/Loading';
import TemplateIcon from 'assets/images/icons/Template/UnselectedDark.svg?react';
import { GET_HSM_CATEGORIES } from 'graphql/queries/Template';
Expand Down Expand Up @@ -32,6 +32,7 @@ export const HSM = () => {
const [category, setCategory] = useState<any>({ label: '', id: '' });
const { t } = useTranslation();
const params = useParams();
const location: any = useLocation();

const { data: categoryList, loading } = useQuery(GET_HSM_CATEGORIES);

Expand Down Expand Up @@ -109,8 +110,9 @@ export const HSM = () => {
setSampleMessages(message);
};

const isCopyState = location.state === 'copy';
let disabled = false;
if (params.id) {
if (params.id && !isCopyState) {
disabled = true;
}

Expand Down
Loading
Loading