Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
77ea81b
refactor: improve actions visibility in List component
akanshaaa19 Nov 26, 2025
dcfe1b0
remove unused 'insideMore' property from action items in multiple lists
akanshaaa19 Nov 26, 2025
846963f
refactor: update test cases to use data-testid for action buttons
akanshaaa19 Nov 26, 2025
03b6d3c
fix: trigger listing page
priyanshu6238 Nov 26, 2025
2f2904f
fix: trigger page
priyanshu6238 Nov 26, 2025
80a2169
refactor: update data-testid attributes for copy and edit icons in Fl…
akanshaaa19 Nov 26, 2025
b20586d
fix: deep scan
priyanshu6238 Nov 26, 2025
d126ac1
chore: checkout bug_bash_1126 branch in cypress testing setup
akanshaaa19 Nov 26, 2025
c171048
refactor: remove unused 'screen' import from TriggerList test file
akanshaaa19 Nov 26, 2025
d0eb795
Merge branch 'master' of github.com:glific/glific-frontend into enhan…
akanshaaa19 Nov 26, 2025
94ce9dd
Merge branch 'master' into refactor/trigger_page
priyanshu6238 Nov 26, 2025
6c7112d
Merge remote-tracking branch 'origin/enhancement/list-component' into…
priyanshu6238 Nov 26, 2025
bd6f252
refactor: trigger listing page
priyanshu6238 Nov 26, 2025
af68a66
fix: deep scan
priyanshu6238 Nov 26, 2025
cba1a75
fix: add test case
priyanshu6238 Nov 26, 2025
464f37d
fix: naming
priyanshu6238 Nov 26, 2025
5cf0ac4
fix: route
priyanshu6238 Nov 26, 2025
9c99802
Merge remote-tracking branch 'origin/bug_bash_1125' into refactor/tri…
priyanshu6238 Nov 26, 2025
c5565f2
fix: label
priyanshu6238 Nov 27, 2025
4331402
fix: naming
priyanshu6238 Nov 27, 2025
3ab3d90
fix: header naming
priyanshu6238 Nov 27, 2025
8847273
fix: description
priyanshu6238 Nov 27, 2025
4f856c4
refactor: add back button
priyanshu6238 Nov 27, 2025
e467738
fix: test case
priyanshu6238 Nov 27, 2025
b91d4fc
FIx: add props to trigger
priyanshu6238 Nov 27, 2025
beeb873
fix: back button
priyanshu6238 Nov 27, 2025
87b1b1f
fix: Remove save when it is in editing mode
priyanshu6238 Nov 27, 2025
a348cbd
fix: remove save button from hsm page
priyanshu6238 Nov 27, 2025
eb47434
Merge remote-tracking branch 'origin/bug_bash_1125' into refactor/tri…
priyanshu6238 Nov 27, 2025
2c7937f
Merge remote-tracking branch 'origin/bug_bash_1125' into refactor/tri…
priyanshu6238 Nov 27, 2025
726753c
fix: trigger page
priyanshu6238 Nov 27, 2025
e1b95df
fix: add global header for format layout
priyanshu6238 Nov 27, 2025
d87a547
refactor: add global header for hsm and add test case
priyanshu6238 Nov 27, 2025
41db357
fix: test case
priyanshu6238 Nov 27, 2025
c461e1f
fix: add new props
priyanshu6238 Nov 27, 2025
dbc9766
fix: add new props for cancel button
priyanshu6238 Nov 27, 2025
24b8050
fix: add new props for header
priyanshu6238 Nov 27, 2025
eb8d6dc
fix: view props
priyanshu6238 Nov 27, 2025
f7b3691
fix: header
priyanshu6238 Nov 28, 2025
69838a6
fix: button logic
priyanshu6238 Nov 28, 2025
2f2c51f
fix: cancel button
priyanshu6238 Nov 28, 2025
f8e5b88
Merge remote-tracking branch 'origin/bug_bash_1125' into refactor/tri…
priyanshu6238 Nov 28, 2025
2f74745
fix: props globally
priyanshu6238 Nov 28, 2025
47008f4
refactor: format layout
priyanshu6238 Nov 28, 2025
7580a6a
refactor: rename props
priyanshu6238 Nov 28, 2025
b6395ec
fix: deep scan
priyanshu6238 Nov 28, 2025
8435b34
fix: props
priyanshu6238 Dec 1, 2025
aeac5da
fix: format layout
priyanshu6238 Dec 1, 2025
21471d4
fix: isView condition
priyanshu6238 Dec 1, 2025
e24809c
refactor: remove console
priyanshu6238 Dec 1, 2025
be7fc8b
fix: header help function
priyanshu6238 Dec 1, 2025
fe5ac0a
Merge remote-tracking branch 'origin/bug_bash_1125' into refactor/tri…
priyanshu6238 Dec 1, 2025
97cc4d7
fix: test case
priyanshu6238 Dec 1, 2025
ed59c85
reafactor: isView props condition in formLayout
priyanshu6238 Dec 1, 2025
2cc70f7
fix: remove undefined type from headerHelp function
priyanshu6238 Dec 2, 2025
f3fcc67
Merge remote-tracking branch 'origin/bug_bash_1125' into refactor/tri…
priyanshu6238 Dec 2, 2025
ef8f9fe
fix: hsm page
priyanshu6238 Dec 2, 2025
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
11 changes: 8 additions & 3 deletions src/components/UI/Heading/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import AddIcon from 'assets/images/add.svg?react';
export interface HeadingProps {
formTitle: string;
helpData?: any;
showHeaderHelp?: boolean;
backLink?: string;
headerHelp?: string;
button?: {
Expand All @@ -20,7 +19,13 @@ export interface HeadingProps {
};
}

export const Heading = ({ formTitle, helpData, showHeaderHelp = true, backLink, headerHelp, button }: HeadingProps) => {
export const Heading = ({
formTitle,
helpData,
backLink,
headerHelp,
button,
}: HeadingProps) => {
const navigate = useNavigate();
const addIcon = <AddIcon className={styles.AddIcon} />;

Expand All @@ -37,7 +42,7 @@ export const Heading = ({ formTitle, helpData, showHeaderHelp = true, backLink,
</div>
{helpData ? <HelpIcon helpData={helpData} /> : ''}
</div>
<div className={styles.TextHeading}>{showHeaderHelp ? headerHelp || `Please enter below details.` : ''}</div>
{headerHelp && <div className={styles.TextHeading}>{headerHelp}</div>}
</div>
</div>
{button && button.show && (
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Consulting/Consulting.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ test('it renders consulting hours in edit mode', async () => {
});
});

test('Click in cancel button', async () => {
test('Click on Go Back button', async () => {
const { getByText } = render(consultingEditForm);

expect(getByText('Loading...')).toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ContactManagement/ContactManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ContactManagement = () => {

return (
<>
<Heading formTitle="Contact Management" showHeaderHelp={false} helpData={contactVariablesInfo} />
<Heading formTitle="Contact Management" helpData={contactVariablesInfo} />
<div className={styles.MainContainer}>
<div className={styles.Container}>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Flow/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export const Flow = () => {
customHandler={customHandler}
helpData={flowInfo}
backLinkButton={`/${backLink}`}
buttonState={{ text: 'Save', status: isTemplate }}
buttonState={{ text: 'Save', status: isTemplate, show: true }}
restrictButtonStatus={{ status: isTemplate }}
/>
);
Expand Down
62 changes: 38 additions & 24 deletions src/containers/Form/FormLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface FormLayoutProps {
text?: string;
status?: boolean;
styles?: string;
show?: boolean;
};
type?: string;
afterSave?: Function;
Expand All @@ -76,6 +77,7 @@ export interface FormLayoutProps {
languageAttributes?: any;
helpData?: HelpDataProps;
noHeading?: boolean;
isView?: boolean;
partialPage?: boolean;
confirmationState?: {
show: boolean;
Expand All @@ -86,7 +88,10 @@ export interface FormLayoutProps {
text?: string;
status?: boolean;
};
skipCancel?: boolean;
errorButtonState?: {
show?: boolean;
text?: string;
};
}

export const FormLayout = ({
Expand All @@ -95,9 +100,14 @@ export const FormLayout = ({
setStates,
validationSchema,
listItemName,
isView = false,
dialogMessage,
formFields,
redirectionLink,
errorButtonState = {
show: true,
text: 'Cancel',
},
listItem,
getItemQuery,
createItemQuery,
Expand All @@ -118,7 +128,7 @@ export const FormLayout = ({
advanceSearch,
cancelAction,
button = 'Save',
buttonState = { text: '', status: false, styles: '' },
buttonState = { text: '', status: false, styles: '', show: true },
type,
afterSave,
afterDelete,
Expand All @@ -140,7 +150,6 @@ export const FormLayout = ({
partialPage = false,
confirmationState,
restrictButtonStatus,
skipCancel = false,
}: FormLayoutProps) => {
const [showDialog, setShowDialog] = useState(false);
const [formSubmitted, setFormSubmitted] = useState(false);
Expand Down Expand Up @@ -584,22 +593,24 @@ export const FormLayout = ({
);
})}
<div className={buttonState.styles ? buttonState.styles : styles.Buttons}>
<Button
variant="contained"
color="primary"
onClick={() => {
formik.validateForm().then((errors) => {
onSaveButtonClick(errors);
formik.submitForm();
});
}}
className={styles.Button}
data-testid="submitActionButton"
loading={saveClick}
disabled={buttonState.status}
>
{buttonState.status ? buttonState.text : button}
</Button>
{buttonState.show && (
<Button
variant="contained"
color="primary"
onClick={() => {
formik.validateForm().then((errors) => {
onSaveButtonClick(errors);
formik.submitForm();
});
}}
className={styles.Button}
data-testid="submitActionButton"
loading={saveClick}
disabled={buttonState.status}
>
{buttonState.status ? buttonState.text : button}
</Button>
)}
{additionalAction ? (
<Button
variant="outlined"
Expand All @@ -618,9 +629,9 @@ export const FormLayout = ({
{additionalAction.label}
</Button>
) : null}
{!skipCancel && (
{errorButtonState?.show && (
<Button variant="outlined" color="secondary" onClick={cancelHandler} data-testid="cancelActionButton">
{t('Cancel')}
{errorButtonState?.text}
</Button>
)}

Expand Down Expand Up @@ -653,19 +664,22 @@ export const FormLayout = ({
}

let formTitle = '';
let headerHelp: string = `Please enter below details.`;

// set title if there is a title
if (title) {
formTitle = title;
} else if (type === 'copy') {
formTitle = `Copy ${listItemName}`; // case when copying an item
} else if (itemId) {
formTitle = `Edit ${listItemName}`; // case when editing a item
formTitle = isView ? `${listItemName}` : `Edit ${listItemName}`; // case when editing a item
} else {
formTitle = `Create a new ${listItemName}`; // case when adding a new item
}

let heading = <Heading backLink={backLinkButton} formTitle={formTitle} />;
if (isView) {
headerHelp = `Please view below details.`;
}
let heading = <Heading backLink={backLinkButton} formTitle={formTitle} headerHelp={headerHelp} />;

let confirmationDialog;
if (showConfirmationDialog) {
Expand Down
8 changes: 4 additions & 4 deletions src/containers/HSM/HSM.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Edit mode', () => {
</MockedProvider>
);
await waitFor(() => {
expect(getByText('Edit HSM Template')).toBeInTheDocument();
expect(getByText('HSM Template')).toBeInTheDocument();
});

await waitFor(() => {
Expand All @@ -72,7 +72,7 @@ describe('Edit mode', () => {
);

await waitFor(() => {
expect(getByText('Edit HSM Template')).toBeInTheDocument();
expect(getByText('HSM Template')).toBeInTheDocument();
});

await waitFor(() => {
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Add mode', () => {
render(template);

await waitFor(() => {
expect(screen.getByText('Add a new HSM Template')).toBeInTheDocument();
expect(screen.getByText('Create a new HSM Template')).toBeInTheDocument();
});

const inputs = screen.getAllByRole('textbox');
Expand Down Expand Up @@ -272,7 +272,7 @@ describe('Add mode', () => {
render(template);

await waitFor(() => {
expect(screen.getByText('Add a new HSM Template')).toBeInTheDocument();
expect(screen.getByText('Create a new HSM Template')).toBeInTheDocument();
});
fireEvent.click(screen.getByText('Add buttons'));

Expand Down
22 changes: 9 additions & 13 deletions src/containers/HSM/HSM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,16 @@ export const HSM = () => {
let backButton = location.state?.tag?.label ? `template?tag=${location.state?.tag?.label}` : 'template';

const { data: categoryList, loading: categoryLoading } = useQuery(GET_HSM_CATEGORIES);
const { data: shortCodes, loading: shortcodesLoading, refetch: refetchShortcodes} = useQuery(GET_SHORTCODES, {
const {
data: shortCodes,
loading: shortcodesLoading,
refetch: refetchShortcodes,
} = useQuery(GET_SHORTCODES, {
variables: {
filter: {
isHsm: true,
},
}
},
});

const { data: tag, loading: tagLoading } = useQuery(GET_TAGS, {
Expand Down Expand Up @@ -502,16 +506,6 @@ export const HSM = () => {
};

const fields = [
{
component: Checkbox,
name: 'isActive',
title: (
<Typography variant="h6" className={styles.IsActive}>
Active?
</Typography>
),
darkCheckbox: true,
},
{
component: AutoComplete,
name: 'language',
Expand Down Expand Up @@ -885,6 +879,7 @@ export const HSM = () => {
<FormLayout
{...queries}
states={states}
isView={isEditing}
setStates={setStates}
setPayload={setPayload}
validationSchema={isEditing ? Yup.object() : FormSchema}
Expand All @@ -896,10 +891,11 @@ export const HSM = () => {
icon={templateIcon}
getLanguageId={getLanguageId}
languageSupport={false}
errorButtonState={{ text: isEditing ? t('Go Back') : t('Cancel'), show: true }}
isAttachment
getQueryFetchPolicy="cache-and-network"
button={!isEditing ? t('Submit for Approval') : t('Save')}
buttonState={{ text: t('Validating URL'), status: validatingURL }}
buttonState={{ text: t('Validating URL'), status: validatingURL, show: !isEditing }}
saveOnPageChange={false}
type={mode}
copyNotification={copyMessage}
Expand Down
15 changes: 15 additions & 0 deletions src/containers/HSM/HSMList/HSMList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,21 @@ test('should navigate to create template page', async () => {
expect(mockedUsedNavigate).toHaveBeenCalledWith('/template/add');
});

test('should navigate to edit template page', async () => {
const { getByText } = render(template(syncTemplateQuery));

await waitFor(() => {
expect(getByText('HSM Templates')).toBeInTheDocument();
});

const viewIcons = await screen.findAllByTestId('view-icon', {}, { timeout: 5000 });
fireEvent.click(viewIcons[0]);

await waitFor(() => {
expect(mockedUsedNavigate).toHaveBeenCalledWith('/template/1/edit');
});
});

test('should navigate to create template page with selected tag', async () => {
const { getByText, getByTestId, getAllByRole } = render(template(syncTemplateQuery));

Expand Down
13 changes: 13 additions & 0 deletions src/containers/HSM/HSMList/HSMList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { templateInfo, templateStatusInfo } from 'common/HelpData';
import { setNotification } from 'common/notification';
import { WhatsAppToJsx } from 'common/RichEditor';
import { capitalizeFirstLetter, copyToClipboardMethod, exportCsvFile, getFileExtension } from 'common/utils';
import ViewIcon from 'assets/images/icons/ViewLight.svg?react';

import { AutoComplete } from 'components/UI/Form/AutoComplete/AutoComplete';
import { Button } from 'components/UI/Form/Button/Button';
Expand Down Expand Up @@ -386,7 +387,16 @@ export const HSMList = () => {
button.show = false;
}

const handleView = (id: any) => {
navigate(`/template/${id}/edit`);
};
let additionalAction: any = () => [
{
label: t('View'),
icon: <ViewIcon data-testid="view-icon" />,
parameter: 'id',
dialog: handleView,
},
{
label: t('Copy UUID'),
icon: <CopyAllOutlined data-testid="copy-button" />,
Expand Down Expand Up @@ -443,6 +453,9 @@ export const HSMList = () => {
{...queries}
filterList={filterTemplateStatus}
filters={selectedTag?.id ? { ...appliedFilters, tagIds: [parseInt(selectedTag.id)] } : appliedFilters}
restrictedAction={(item: any) => ({
edit: false,
})}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/InteractiveMessage/InteractiveMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ export const InteractiveMessage = () => {
getQueryFetchPolicy="cache-and-network"
afterSave={afterSave}
saveOnPageChange={false}
buttonState={{ text: t('Validating URL'), status: validatingURL }}
buttonState={{ text: t('Validating URL'), status: validatingURL, show: true }}
helpData={interactiveMessageInfo}
backLinkButton={`/${backButton}`}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/MyAccount/MyAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export const MyAccount = () => {

return (
<div>
<Heading formTitle={t('My Account')} showHeaderHelp={false} />
<Heading formTitle={t('My Account')} />
<div className={styles.MyAccount} data-testid="MyAccount">
{userForm}
<Typography variant="h6" className={styles.Title}>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Profile/Contact/ContactProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const ContactProfile = () => {

return (
<>
<Heading formTitle={t('Contact Profile')} showHeaderHelp={false} backLink={`/chat/${params.id}`} />
<Heading formTitle={t('Contact Profile')} backLink={`/chat/${params.id}`} />
<Box className={styles.ContactProfile}>
{drawer}
<Box className={styles.ProfileBody}>{profileBodyContent}</Box>
Expand Down
3 changes: 2 additions & 1 deletion src/containers/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,12 @@ export const Search = ({
afterSave={saveHandler}
helpData={searchInfo}
backLinkButton="/search"
skipCancel={chatFilters}
errorButtonState={{ text: t('Cancel'), show: !chatFilters }}
buttonState={
chatFilters
? {
styles: styles.Buttons,
show: true,
}
: undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('it renders component properly', async () => {
expect(getByText('Loading...')).toBeInTheDocument();
});

test('it renders component and clicks cancel', async () => {
test('it renders component and clicks Cancel Button', async () => {
const { getByText } = render(wrapper);
// loading is show initially
expect(getByText('Loading...')).toBeInTheDocument();
Expand Down
Loading
Loading