Skip to content

Commit

Permalink
[UXD][AAP-25027] AWX - updates to Notifiers section breadcrumbs & hea…
Browse files Browse the repository at this point in the history
…ders (#2727)

Co-authored-by: Maeve Hoffer <[email protected]>
  • Loading branch information
tiyiprh and daphnemaeve authored Aug 26, 2024
1 parent b9d1f3a commit f7c01af
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/awx/notifiers/notifiersSharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function testNotification(
const orgName = randomE2Ename();
cy.createAwxOrganization({ name: orgName }).then(() => {
cy.navigateTo('awx', 'notification-templates');
cy.get(`[data-cy="create-notifier"]`).click();
cy.getByDataCy('create-notifier').click();
cy.verifyPageTitle('Create notifier');

fillBasicData(notificationName, type);
Expand Down
25 changes: 19 additions & 6 deletions frontend/awx/administration/notifiers/NotifierForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ function NotifierForm(props: { mode: 'add' | 'edit' }) {

const optionsRequest = useOptions<NotificationTemplateOptions>(awxAPI`/notification_templates/`);

const breadcrumbs: ICatalogBreadcrumb[] = [
{ label: t('Notifications'), to: getPageUrl(AwxRoute.NotificationTemplates) },
{ label: mode === 'add' ? t('Add') : t('Edit') },
];

if (notifierRequest.error) {
return <AwxError error={notifierRequest.error} />;
}
Expand Down Expand Up @@ -106,6 +101,18 @@ function NotifierForm(props: { mode: 'add' | 'edit' }) {
(defaultValue as CustomizeMessageType).customize_messages = false;
}

const breadcrumbs: ICatalogBreadcrumb[] = [
{ label: t('Notifiers'), to: getPageUrl(AwxRoute.NotificationTemplates) },
{
label:
mode === 'add'
? t('Create notifier')
: notifierRequest?.data?.name
? t(`Edit ${notifierRequest.data.name}`)
: t('Edit notifier'),
},
];

if (defaultValue && !messagesEmpty) {
(defaultValue as CustomizeMessageType).customize_messages = true;
}
Expand Down Expand Up @@ -191,8 +198,14 @@ function NotifierForm(props: { mode: 'add' | 'edit' }) {
return (
<PageLayout>
<PageHeader
title={
mode === 'add'
? t('Create notifier')
: notifierRequest?.data?.name
? t(`Edit ${notifierRequest.data.name}`)
: t('Edit notifier')
}
breadcrumbs={breadcrumbs}
title={mode === 'edit' ? t('Edit notifier') : t('Create notifier')}
/>
<AwxPageForm<NotificationTemplate>
submitText={t('Save notifier')}
Expand Down

0 comments on commit f7c01af

Please sign in to comment.