add organization column notification template list (#13998)

This commit is contained in:
Erez Tamam 2023-07-12 22:11:47 +03:00 committed by GitHub
parent b8c48f7d50
commit 0edcd688a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 1 deletions

View File

@ -178,6 +178,7 @@ function NotificationTemplatesList() {
<HeaderCell sortKey="name">{t`Name`}</HeaderCell>
<HeaderCell>{t`Status`}</HeaderCell>
<HeaderCell sortKey="notification_type">{t`Type`}</HeaderCell>
<HeaderCell sortKey="organization">{t`Organization`}</HeaderCell>
<HeaderCell>{t`Actions`}</HeaderCell>
</HeaderRow>
}

View File

@ -20,6 +20,10 @@ const mockTemplates = {
url: '/notification_templates/1',
type: 'slack',
summary_fields: {
organization: {
id: 1,
name: 'Foo',
},
recent_notifications: [
{
status: 'success',
@ -36,6 +40,10 @@ const mockTemplates = {
id: 2,
url: '/notification_templates/2',
summary_fields: {
organization: {
id: 2,
name: 'Bar',
},
recent_notifications: [],
user_capabilities: {
delete: true,
@ -48,6 +56,10 @@ const mockTemplates = {
id: 3,
url: '/notification_templates/3',
summary_fields: {
organization: {
id: 3,
name: 'Test',
},
recent_notifications: [
{
status: 'failed',

View File

@ -121,6 +121,13 @@ function NotificationTemplateListItem({
{NOTIFICATION_TYPES[template.notification_type] ||
template.notification_type}
</Td>
<Td dataLabel={t`Oragnization`}>
<Link
to={`/organizations/${template.summary_fields.organization.id}/details`}
>
<b>{template.summary_fields.organization.name}</b>
</Link>
</Td>
<ActionsTd dataLabel={t`Actions`}>
<ActionItem visible tooltip={t`Test notification`}>
<Button

View File

@ -12,6 +12,10 @@ const template = {
notification_type: 'slack',
name: 'Test Notification',
summary_fields: {
organization: {
id: 1,
name: 'Foo',
},
user_capabilities: {
edit: true,
copy: true,
@ -39,7 +43,7 @@ describe('<NotificationTemplateListItem />', () => {
);
const cells = wrapper.find('Td');
expect(cells).toHaveLength(5);
expect(cells).toHaveLength(6);
expect(cells.at(1).text()).toEqual('Test Notification');
expect(cells.at(2).text()).toEqual('Success');
expect(cells.at(3).text()).toEqual('Slack');
@ -133,6 +137,10 @@ describe('<NotificationTemplateListItem />', () => {
template={{
...template,
summary_fields: {
organization: {
id: 3,
name: 'Test',
},
user_capabilities: {
copy: false,
edit: false,