@genesislcap/pbc-notify-ui 1.0.63 → 14.308.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/api-extractor.json +4 -0
  2. package/dist/dts/components/foundation-inbox/components/inbox-subscription/inbox-subscription.d.ts.map +1 -1
  3. package/dist/dts/components/foundation-inbox/inbox.utils.d.ts.map +1 -1
  4. package/dist/dts/components/foundation-notification-dashboard/components/routes/tabs/email-distribution-route-management.d.ts.map +1 -1
  5. package/dist/dts/components/foundation-notification-dashboard/components/routes/tabs/email-user-route-management.d.ts.map +1 -1
  6. package/dist/dts/components/foundation-notification-dashboard/components/routes/tabs/log-route-management.d.ts.map +1 -1
  7. package/dist/dts/components/foundation-notification-dashboard/components/routes/tabs/ms-teams-route-management.d.ts.map +1 -1
  8. package/dist/dts/components/foundation-notification-dashboard/components/routes/tabs/screen-route-management.d.ts.map +1 -1
  9. package/dist/dts/components/foundation-notification-dashboard/components/rules/columns.d.ts.map +1 -1
  10. package/dist/dts/components/foundation-notification-dashboard/components/templates/columns.d.ts.map +1 -1
  11. package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.utils.d.ts.map +1 -1
  12. package/dist/dts/tsdoc-metadata.json +11 -0
  13. package/dist/dts/utils/gridConfig.d.ts.map +1 -1
  14. package/dist/dts/utils/humanize.d.ts.map +1 -1
  15. package/dist/dts/utils/toBoolean.d.ts.map +1 -1
  16. package/dist/dts/utils/updateArray.d.ts.map +1 -1
  17. package/dist/esm/components/foundation-notification-dashboard/components/routes/tabs/email-distribution-route-management.js +5 -0
  18. package/dist/esm/components/foundation-notification-dashboard/components/routes/tabs/email-user-route-management.js +5 -0
  19. package/dist/esm/components/foundation-notification-dashboard/components/routes/tabs/log-route-management.js +5 -0
  20. package/dist/esm/components/foundation-notification-dashboard/components/routes/tabs/ms-teams-route-management.js +5 -0
  21. package/dist/esm/components/foundation-notification-dashboard/components/routes/tabs/screen-route-management.js +6 -0
  22. package/dist/esm/index.federated.js +0 -1
  23. package/dist/pbc-notify-ui.api.json +889 -0
  24. package/dist/pbc-notify-ui.d.ts +252 -0
  25. package/dist/tsconfig.tsbuildinfo +1 -0
  26. package/docs/api/index.md +30 -0
  27. package/docs/api/pbc-notify-ui.foundationinbox.connectedcallback.md +18 -0
  28. package/docs/api/pbc-notify-ui.foundationinbox.disconnectedcallback.md +18 -0
  29. package/docs/api/pbc-notify-ui.foundationinbox.md +66 -0
  30. package/docs/api/pbc-notify-ui.foundationinboxcounter.connectedcallback.md +15 -0
  31. package/docs/api/pbc-notify-ui.foundationinboxcounter.disconnectedcallback.md +15 -0
  32. package/docs/api/pbc-notify-ui.foundationinboxcounter.inboxservice.md +11 -0
  33. package/docs/api/pbc-notify-ui.foundationinboxcounter.md +116 -0
  34. package/docs/api/pbc-notify-ui.foundationinboxcounter.value.md +11 -0
  35. package/docs/api/pbc-notify-ui.foundationinboxflyout.close.md +15 -0
  36. package/docs/api/pbc-notify-ui.foundationinboxflyout.connectedcallback.md +15 -0
  37. package/docs/api/pbc-notify-ui.foundationinboxflyout.disconnectedcallback.md +15 -0
  38. package/docs/api/pbc-notify-ui.foundationinboxflyout.flyout.md +11 -0
  39. package/docs/api/pbc-notify-ui.foundationinboxflyout.flyoutclosed.md +11 -0
  40. package/docs/api/pbc-notify-ui.foundationinboxflyout.loadremotes.md +15 -0
  41. package/docs/api/pbc-notify-ui.foundationinboxflyout.md +169 -0
  42. package/docs/api/pbc-notify-ui.foundationinboxflyout.open.md +15 -0
  43. package/docs/api/pbc-notify-ui.foundationinboxflyout.ready.md +11 -0
  44. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.auth.md +11 -0
  45. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.connectedcallback.md +15 -0
  46. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.haspermissions.md +11 -0
  47. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.md +122 -0
  48. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.ready.md +11 -0
  49. package/docs/api/pbc-notify-ui.md +60 -0
  50. package/docs/api-report.md.api.md +76 -0
  51. package/license.txt +46 -0
  52. package/package.json +26 -39
  53. package/src/components/components.ts +54 -0
  54. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.styles.ts +30 -0
  55. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.template.ts +16 -0
  56. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.ts +33 -0
  57. package/src/components/foundation-inbox/components/foundation-inbox-flyout/foundation-inbox-flyout.styles.ts +18 -0
  58. package/src/components/foundation-inbox/components/foundation-inbox-flyout/foundation-inbox-flyout.template.ts +22 -0
  59. package/src/components/foundation-inbox/components/foundation-inbox-flyout/foundation-inbox-flyout.ts +43 -0
  60. package/src/components/foundation-inbox/components/inbox-subscription/inbox-subscription.styles.ts +37 -0
  61. package/src/components/foundation-inbox/components/inbox-subscription/inbox-subscription.template.ts +50 -0
  62. package/src/components/foundation-inbox/components/inbox-subscription/inbox-subscription.ts +81 -0
  63. package/src/components/foundation-inbox/components/inbox-subscription/rule-parameter/rule-parameter.styles.ts +25 -0
  64. package/src/components/foundation-inbox/components/inbox-subscription/rule-parameter/rule-parameter.template.ts +96 -0
  65. package/src/components/foundation-inbox/components/inbox-subscription/rule-parameter/rule-parameter.ts +55 -0
  66. package/src/components/foundation-inbox/inbox-base/inbox-base.ts +320 -0
  67. package/src/components/foundation-inbox/inbox.styles.ts +309 -0
  68. package/src/components/foundation-inbox/inbox.template.ts +317 -0
  69. package/src/components/foundation-inbox/inbox.ts +26 -0
  70. package/src/components/foundation-inbox/inbox.types.ts +84 -0
  71. package/src/components/foundation-inbox/inbox.utils.ts +33 -0
  72. package/src/components/foundation-notification-dashboard/components/notify-audit/notify-audit-management.ts +96 -0
  73. package/src/components/foundation-notification-dashboard/components/routes/route-management.ts +56 -0
  74. package/src/components/foundation-notification-dashboard/components/routes/tabs/email-distribution-route-management.ts +58 -0
  75. package/src/components/foundation-notification-dashboard/components/routes/tabs/email-user-route-management.ts +68 -0
  76. package/src/components/foundation-notification-dashboard/components/routes/tabs/log-route-management.ts +43 -0
  77. package/src/components/foundation-notification-dashboard/components/routes/tabs/ms-teams-route-management.ts +48 -0
  78. package/src/components/foundation-notification-dashboard/components/routes/tabs/screen-route-management.ts +73 -0
  79. package/src/components/foundation-notification-dashboard/components/rules/columns.ts +48 -0
  80. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.template.ts +139 -0
  81. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.ts +255 -0
  82. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.types.ts +4 -0
  83. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.ts +159 -0
  84. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.ts +202 -0
  85. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.types.ts +28 -0
  86. package/src/components/foundation-notification-dashboard/components/rules/rule-management.ts +72 -0
  87. package/src/components/foundation-notification-dashboard/components/templates/columns.ts +48 -0
  88. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/parameter-builder/parameter-builder.styles.ts +59 -0
  89. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/parameter-builder/parameter-builder.template.ts +95 -0
  90. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/parameter-builder/parameter-builder.ts +124 -0
  91. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.template.ts +107 -0
  92. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.ts +185 -0
  93. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.template.ts +139 -0
  94. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.ts +246 -0
  95. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.types.ts +38 -0
  96. package/src/components/foundation-notification-dashboard/components/templates/template-management.ts +72 -0
  97. package/src/components/foundation-notification-dashboard/index.ts +1 -0
  98. package/src/components/foundation-notification-dashboard/notification-dashboard.styles.ts +21 -0
  99. package/src/components/foundation-notification-dashboard/notification-dashboard.tabs.ts +35 -0
  100. package/src/components/foundation-notification-dashboard/notification-dashboard.template.ts +58 -0
  101. package/src/components/foundation-notification-dashboard/notification-dashboard.ts +40 -0
  102. package/src/components/foundation-notification-dashboard/notification-dashboard.utils.ts +295 -0
  103. package/src/components/foundation-notification-dashboard/styles/condition-builder.styles.ts +66 -0
  104. package/src/components/foundation-notification-dashboard/styles/dynamic-rule.styles.ts +159 -0
  105. package/src/components/foundation-notification-dashboard/styles/management.styles.ts +21 -0
  106. package/src/components/foundation-notification-dashboard/types/expression-type.ts +13 -0
  107. package/src/components/foundation-notification-dashboard/types/logical-operator.ts +18 -0
  108. package/src/components/foundation-notification-dashboard/types/param-source-type.ts +11 -0
  109. package/src/components/foundation-notification-dashboard/types/param-type.ts +13 -0
  110. package/src/components/foundation-notification-dashboard/types/right-criteria.ts +6 -0
  111. package/src/components/foundation-notification-dashboard/types/rule-execution-strategy.ts +6 -0
  112. package/src/components/foundation-notification-dashboard/types/severity.ts +13 -0
  113. package/src/globals.d.ts +7 -0
  114. package/src/index.federated.ts +1 -0
  115. package/src/index.ts +4 -0
  116. package/src/notify.types.ts +143 -0
  117. package/src/sandbox.ts +83 -0
  118. package/src/services/alert.service.ts +36 -0
  119. package/src/services/inbox.service.ts +85 -0
  120. package/src/services/notify.service.ts +21 -0
  121. package/src/services/rule.service.ts +129 -0
  122. package/src/services/system.service.ts +43 -0
  123. package/src/services/template.service.ts +71 -0
  124. package/src/styles/scrollbar.styles.ts +15 -0
  125. package/src/utils/eventDetail.ts +5 -0
  126. package/src/utils/gridConfig.ts +14 -0
  127. package/src/utils/humanize.ts +14 -0
  128. package/src/utils/icons.ts +15 -0
  129. package/src/utils/index.ts +6 -0
  130. package/src/utils/logger.ts +3 -0
  131. package/src/utils/notifyPermissions.ts +6 -0
  132. package/src/utils/toBoolean.ts +7 -0
  133. package/src/utils/updateArray.ts +33 -0
  134. package/temp/api-report.md.api.md +76 -0
  135. package/tsconfig.json +11 -0
  136. package/.husky/commit-msg +0 -3
  137. package/.husky/pre-commit +0 -4
  138. package/README.md +0 -31
  139. package/commitlint.config.js +0 -25
  140. package/index.html +0 -28
  141. package/scripts/commitlint.js +0 -24
  142. package/sonar-project.properties +0 -5
@@ -0,0 +1,246 @@
1
+ import type { Modal } from '@genesislcap/rapid-design-system';
2
+ import { customElement, GenesisElement, observable, volatile } from '@genesislcap/web-core';
3
+ import {
4
+ Assignment,
5
+ ConditionBuilderEntity,
6
+ defaultUpdateType,
7
+ Severity,
8
+ UpdateType,
9
+ } from '../../../../../notify.types';
10
+ import { NotifyService } from '../../../../../services/notify.service';
11
+ import { Field, SystemService } from '../../../../../services/system.service';
12
+ import { TemplateService } from '../../../../../services/template.service';
13
+ import { humanize, logger } from '../../../../../utils';
14
+ import {
15
+ DynamicRuleUtils,
16
+ showNotificationError,
17
+ TemplateUtils,
18
+ isEmpty,
19
+ } from '../../../notification-dashboard.utils';
20
+ import { DynamicRuleDialogStyles } from '../../../styles/dynamic-rule.styles';
21
+ import { TemplateDialogTemplate } from './template-dialog.template';
22
+ import { ParameterBuilderEntity, Template, TemplateDialogMode } from './template-dialog.types';
23
+
24
+ @customElement({
25
+ name: 'template-dialog',
26
+ template: TemplateDialogTemplate,
27
+ styles: DynamicRuleDialogStyles,
28
+ })
29
+ export class TemplateDialog extends GenesisElement {
30
+ @TemplateService templateService: TemplateService;
31
+ @SystemService systemService: SystemService;
32
+ @NotifyService notifyService: NotifyService;
33
+
34
+ dialog: Modal;
35
+ @observable templateDialogMode: (typeof TemplateDialogMode)[keyof typeof TemplateDialogMode] =
36
+ null;
37
+
38
+ private templateId: string = null;
39
+ @observable name: string = null;
40
+ @observable description: string = null;
41
+ @observable header = null;
42
+ @observable message = null;
43
+ @observable resource: string = ''; // TODO: Tables + Views
44
+ @observable topic: string = '';
45
+ @observable severity: string = '';
46
+ @observable updateType: UpdateType[] = defaultUpdateType;
47
+
48
+ @observable parameters: Array<ParameterBuilderEntity> = [];
49
+ @observable conditions: Array<ConditionBuilderEntity> = [];
50
+
51
+ @observable resources: Array<string> = [];
52
+ @observable fields: Array<Field> = [];
53
+ @observable topics: Array<string> = [];
54
+
55
+ private requiredFields = () => [this.name, this.description, this.header, this.message];
56
+
57
+ public async openDialog(params: any) {
58
+ this.topics = await this.notifyService.getNotifyRouteTopics();
59
+ this.resources = await this.systemService.getResources(); // TODO: Tables + Views
60
+ this.templateDialogMode = params.mode;
61
+
62
+ switch (params.mode) {
63
+ case TemplateDialogMode.CREATE:
64
+ await this.createTemplate();
65
+ break;
66
+ case TemplateDialogMode.EDIT:
67
+ await this.editTemplate(params.data);
68
+ break;
69
+ default:
70
+ logger.error('Error on TemplateDialogMode');
71
+ break;
72
+ }
73
+
74
+ this.dialog.show();
75
+ }
76
+
77
+ close() {
78
+ // Objects
79
+ this.templateId = null;
80
+ this.name = null;
81
+ this.description = null;
82
+ this.header = null;
83
+ this.message = null;
84
+ this.resource = null;
85
+ this.topic = null;
86
+ this.severity = null;
87
+ this.templateDialogMode = null;
88
+
89
+ // Arrays
90
+ this.resources = [];
91
+ this.topics = [];
92
+ this.conditions = [];
93
+ this.parameters = [];
94
+ this.updateType = [];
95
+
96
+ this.dialog.close();
97
+ this.$emit('close');
98
+ }
99
+
100
+ private async createTemplate() {
101
+ this.conditions.push(DynamicRuleUtils.createEmptyCondition());
102
+ this.resource = this.resources[0];
103
+ this.fields = await this.systemService.getFields(this.resource);
104
+ this.topic = this.topics[0];
105
+ this.severity = Severity.INFORMATION;
106
+ this.updateType = defaultUpdateType;
107
+ }
108
+
109
+ private async editTemplate(data) {
110
+ const template = data;
111
+ this.templateId = template.DYNAMIC_RULE_ID;
112
+ this.name = template.RULE_NAME;
113
+ this.description = template.RULE_DESCRIPTION;
114
+ this.resource = template.RULE_TABLE;
115
+ this.updateType = template.TABLE_OPERATIONS;
116
+ this.fields = await this.systemService.getFields(this.resource);
117
+ this.parameters = TemplateUtils.getParameters(template.PARAMETERS);
118
+ this.conditions = TemplateUtils.getConditions(
119
+ template.RULE_EXPRESSION.CONDITIONS,
120
+ this.parameters,
121
+ );
122
+ this.attributeAssignments(template.RESULT_EXPRESSION?.ASSIGNMENTS);
123
+ }
124
+
125
+ private attributeAssignments(assignments) {
126
+ if (!assignments || !assignments.length) {
127
+ return;
128
+ }
129
+
130
+ this.header = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.HEADER);
131
+ this.message = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.BODY);
132
+ this.severity = DynamicRuleUtils.getAssignmentValue(
133
+ assignments,
134
+ Assignment.NOTIFY_SEVERITY,
135
+ )?.toUpperCase();
136
+ this.topic = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.TOPIC);
137
+ }
138
+
139
+ get templateDialogTitle(): string {
140
+ return `${this.templateDialogMode === TemplateDialogMode.CREATE ? 'Create' : 'Edit'} Template`;
141
+ }
142
+
143
+ submit() {
144
+ if (this.requiredFields().some((value) => isEmpty(value))) {
145
+ return;
146
+ }
147
+
148
+ const template: Template = this.createTemplateObject();
149
+
150
+ switch (this.templateDialogMode) {
151
+ case TemplateDialogMode.CREATE:
152
+ this.templateService
153
+ .createRuleTemplate(template)
154
+ .then((response) => this.validateResponse(response));
155
+ break;
156
+ case TemplateDialogMode.EDIT:
157
+ this.templateService
158
+ .editRuleTemplate(template)
159
+ .then((response) => this.validateResponse(response));
160
+ break;
161
+ default:
162
+ logger.error('Error on TemplateDialogMode');
163
+ break;
164
+ }
165
+ }
166
+
167
+ private createTemplateObject(): Template {
168
+ return {
169
+ ...(this.templateDialogMode === TemplateDialogMode.EDIT && {
170
+ DYNAMIC_RULE_ID: this.templateId,
171
+ }),
172
+ RULE_NAME: this.name,
173
+ RULE_DESCRIPTION: this.description,
174
+ RULE_TABLE: this.resource,
175
+ TABLE_OPERATIONS: this.updateType,
176
+ RULE_EXPRESSION: {
177
+ CONDITIONS: DynamicRuleUtils.createConditions(this.conditions, this.parameters),
178
+ },
179
+ RAW_RULE_EXPRESSION: null,
180
+ RESULT_EXPRESSION: {
181
+ ASSIGNMENTS: [
182
+ DynamicRuleUtils.createAssignment(Assignment.TOPIC, this.topic),
183
+ DynamicRuleUtils.createAssignment(Assignment.HEADER, this.header),
184
+ DynamicRuleUtils.createAssignment(Assignment.BODY, this.message),
185
+ DynamicRuleUtils.createAssignment(Assignment.NOTIFY_SEVERITY, humanize(this.severity)),
186
+ ],
187
+ },
188
+ PARAMETER_DETAILS: TemplateUtils.createParameterDetails(this.parameters),
189
+ };
190
+ }
191
+
192
+ validateResponse(response) {
193
+ if (response.MESSAGE_TYPE === 'EVENT_ACK') {
194
+ this.close();
195
+ return;
196
+ }
197
+
198
+ showNotificationError(response.ERROR);
199
+ }
200
+
201
+ async resourceChanged() {
202
+ this.conditions = [DynamicRuleUtils.createEmptyCondition()];
203
+ this.fields = await this.systemService.getFields(this.resource);
204
+ }
205
+
206
+ // #region Condition
207
+ newCondition() {
208
+ this.conditions.push(DynamicRuleUtils.createEmptyCondition());
209
+ }
210
+
211
+ editCondition(editedCondition: ConditionBuilderEntity) {}
212
+
213
+ deleteCondition(deletedCondition: ConditionBuilderEntity) {
214
+ if (this.conditions.length <= 1) {
215
+ return;
216
+ }
217
+
218
+ this.conditions = this.conditions.filter((condition) => condition !== deletedCondition);
219
+ }
220
+ // #endregion
221
+
222
+ // #region Parameter
223
+ newParameter() {
224
+ this.parameters = [...this.parameters, TemplateUtils.createEmptyParameter()];
225
+ }
226
+
227
+ editParameter(editedParameter: ParameterBuilderEntity) {
228
+ this.parameters = [...this.parameters];
229
+ }
230
+
231
+ deleteParameter(deletedParameter: ParameterBuilderEntity) {
232
+ if (this.conditions.find((condition) => condition.RIGHT_VALUE === deletedParameter.UUID)) {
233
+ return;
234
+ }
235
+
236
+ this.parameters = this.parameters.filter(
237
+ (parameter) => parameter.UUID !== deletedParameter.UUID,
238
+ );
239
+ }
240
+ // #endregion
241
+
242
+ @volatile
243
+ public get validateRequiredFields(): boolean {
244
+ return this.requiredFields().some((value) => isEmpty(value));
245
+ }
246
+ }
@@ -0,0 +1,38 @@
1
+ import { UpdateType } from '../../../../../notify.types';
2
+
3
+ export const TemplateDialogMode = {
4
+ CREATE: 'create',
5
+ EDIT: 'edit',
6
+ } as const;
7
+
8
+ export type TemplateDialogParams =
9
+ | {
10
+ mode: typeof TemplateDialogMode.CREATE;
11
+ }
12
+ | {
13
+ mode: typeof TemplateDialogMode.EDIT;
14
+ data: Template;
15
+ };
16
+
17
+ export type Template = {
18
+ DYNAMIC_RULE_ID?: string;
19
+ RULE_NAME: string;
20
+ RULE_DESCRIPTION: string;
21
+ RULE_TABLE: string;
22
+ RULE_EXPRESSION?: any;
23
+ TABLE_OPERATIONS: UpdateType[];
24
+ RAW_RULE_EXPRESSION?: string;
25
+ RESULT_EXPRESSION?: {
26
+ ASSIGNMENTS: Array<any>;
27
+ };
28
+ PARAMETER_DETAILS: any;
29
+ };
30
+
31
+ export type ParameterBuilderEntity = {
32
+ UUID?: string;
33
+ PARAM_NAME: string;
34
+ PARAM_LABEL: string;
35
+ PARAM_TYPE: string;
36
+ PARAM_SOURCE_TYPE: string;
37
+ PARAM_SOURCE: string;
38
+ };
@@ -0,0 +1,72 @@
1
+ import { showNotificationDialog } from '@genesislcap/foundation-notifications';
2
+ import { customElement, GenesisElement, html, ref, repeat } from '@genesislcap/web-core';
3
+ import { TemplateService } from '../../../../services/template.service';
4
+ import { DynamicRuleManagementStyles } from '../../styles/dynamic-rule.styles';
5
+ import { TEMPLATE_MANAGEMENT_COLUMNS } from './columns';
6
+ import type { TemplateDialog } from './template-dialog/template-dialog';
7
+ import { TemplateDialogMode } from './template-dialog/template-dialog.types';
8
+
9
+ @customElement({
10
+ name: 'template-management',
11
+ template: html<TemplateManagement>`
12
+ <div class="container">
13
+ <div class="header">
14
+ <rapid-button class="add" @click=${(x) => x.openTemplateDialog()}>
15
+ <rapid-icon name="plus" size="lg" variant="solid"></rapid-icon>
16
+ Add
17
+ </rapid-button>
18
+ </div>
19
+
20
+ <div class="grid">
21
+ <rapid-grid-pro only-template-col-defs>
22
+ <grid-pro-genesis-datasource resource-name="ALL_RULE_TEMPLATES">
23
+ ${repeat(
24
+ (x) => TEMPLATE_MANAGEMENT_COLUMNS(x),
25
+ html`
26
+ <grid-pro-column :definition=${(x) => x} />
27
+ `,
28
+ )}
29
+ </grid-pro-genesis-datasource>
30
+ </rapid-grid-pro>
31
+ </div>
32
+ </div>
33
+
34
+ <template-dialog ${ref('templateDialog')}></template-dialog>
35
+ `,
36
+ styles: DynamicRuleManagementStyles,
37
+ })
38
+ export class TemplateManagement extends GenesisElement {
39
+ @TemplateService templateService: TemplateService;
40
+ templateDialog: TemplateDialog;
41
+
42
+ openTemplateDialog() {
43
+ this.templateDialog.openDialog({ mode: TemplateDialogMode.CREATE });
44
+ }
45
+
46
+ async editTemplate(row) {
47
+ const template = await this.templateService.getRuleTemplateDetails(row.ID);
48
+ this.templateDialog.openDialog({ mode: TemplateDialogMode.EDIT, data: template });
49
+ }
50
+
51
+ deleteTemplate(template) {
52
+ showNotificationDialog(
53
+ {
54
+ title: 'Confirm Delete',
55
+ body: 'Do you really want to delete this template?',
56
+ dialog: {
57
+ dismissingAction: {
58
+ label: 'Dismiss',
59
+ action: () => null,
60
+ },
61
+ confirmingActions: [
62
+ {
63
+ label: 'Confirm',
64
+ action: () => this.templateService.deleteRuleTemplate(template.ID),
65
+ },
66
+ ],
67
+ },
68
+ },
69
+ 'rapid',
70
+ );
71
+ }
72
+ }
@@ -0,0 +1 @@
1
+ export * from './notification-dashboard';
@@ -0,0 +1,21 @@
1
+ import { css } from '@genesislcap/web-core';
2
+
3
+ /**
4
+ * @public
5
+ */
6
+ export const FoundationNotificationDashboardStyles = css`
7
+ .notification-dashboard,
8
+ rapid-tabs,
9
+ rapid-tab-panel {
10
+ height: 100%;
11
+ }
12
+
13
+ .no-permissions {
14
+ font-family: var(--body-font);
15
+ color: var(--neutral-foreground-rest);
16
+ height: 100%;
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ }
21
+ `;
@@ -0,0 +1,35 @@
1
+ export class NotificationDashboardTab {
2
+ id: string;
3
+ name: string;
4
+ component: string;
5
+ right: string;
6
+ }
7
+
8
+ export const NOTIFICATION_DASHBOARD_TABS: NotificationDashboardTab[] = [
9
+ {
10
+ id: 'rules',
11
+ name: 'Rules',
12
+ component: 'rule-management',
13
+ right: 'NotificationRuleView',
14
+ },
15
+ {
16
+ id: 'templates',
17
+ name: 'Templates',
18
+ component: 'template-management',
19
+ right: 'NotificationRuleTemplateView',
20
+ },
21
+ {
22
+ id: 'routes',
23
+ name: 'Routes',
24
+ component: 'route-management',
25
+ right: 'NotificationRouteView',
26
+ },
27
+ /* TODO: Not needed at the moment
28
+ {
29
+ id: 'notify-audit',
30
+ name: 'Notify Audit',
31
+ component: 'notify-audit-management',
32
+ right: 'NotificationAuditView',
33
+ },
34
+ */
35
+ ];
@@ -0,0 +1,58 @@
1
+ import { Auth } from '@genesislcap/foundation-comms';
2
+ import { html, repeat, when, whenElse } from '@genesislcap/web-core';
3
+ import type { FoundationNotificationDashboard } from './notification-dashboard';
4
+ import {
5
+ NOTIFICATION_DASHBOARD_TABS,
6
+ NotificationDashboardTab,
7
+ } from './notification-dashboard.tabs';
8
+
9
+ export const FoundationNotificationDashboardTemplate = html<FoundationNotificationDashboard>`
10
+ <div class="notification-dashboard">
11
+ ${whenElse(
12
+ (x) => x.hasPermissions,
13
+ html`
14
+ <rapid-tabs class="tabs">
15
+ <!-- Tabs -->
16
+ ${repeat(
17
+ (_) => NOTIFICATION_DASHBOARD_TABS,
18
+ html<NotificationDashboardTab>`
19
+ ${when(
20
+ (x, c) => (c.parent.auth as Auth).currentUser.hasPermission(x.right),
21
+ html<NotificationDashboardTab>`
22
+ <rapid-tab slot="${(x) => x.id}-tab">${(x) => x.name}</rapid-tab>
23
+ `,
24
+ )}
25
+ `,
26
+ )}
27
+
28
+ <!-- Panels -->
29
+ ${repeat(
30
+ (_) => NOTIFICATION_DASHBOARD_TABS,
31
+ html<NotificationDashboardTab>`
32
+ ${when(
33
+ (x, c) => (c.parent.auth as Auth).currentUser.hasPermission(x.right),
34
+ html`
35
+ ${
36
+ /* HTML Render */
37
+ (x) =>
38
+ html<NotificationDashboardTab>`
39
+ <rapid-tab-panel slot="${x.id}-tab"
40
+ id="${x.id}-tab-panel">
41
+ <${x.component}></${x.component}>
42
+ </rapid-tab-panel>
43
+ `
44
+ }
45
+ `,
46
+ )}
47
+ `,
48
+ )}
49
+ </rapid-tabs>
50
+ `,
51
+ html`
52
+ <div class="no-permissions">
53
+ <label>User has no permissions to view Notification Screens</label>
54
+ </div>
55
+ `,
56
+ )}
57
+ </div>
58
+ `;
@@ -0,0 +1,40 @@
1
+ import { Auth } from '@genesislcap/foundation-comms';
2
+ import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
+ import { loadRemotes } from '../components';
4
+ import { FoundationNotificationDashboardStyles as styles } from './notification-dashboard.styles';
5
+ import { NOTIFICATION_DASHBOARD_TABS } from './notification-dashboard.tabs';
6
+ import { FoundationNotificationDashboardTemplate as template } from './notification-dashboard.template';
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ @customElement({
12
+ name: 'foundation-notification-dashboard',
13
+ template,
14
+ styles,
15
+ })
16
+ export class FoundationNotificationDashboard extends GenesisElement {
17
+ @Auth auth: Auth;
18
+ @observable ready: boolean = false;
19
+ @observable hasPermissions: boolean = true;
20
+
21
+ async connectedCallback() {
22
+ super.connectedCallback();
23
+
24
+ this.hasPermissions = NOTIFICATION_DASHBOARD_TABS.some((tabCfg) =>
25
+ this.auth.currentUser.hasPermission(tabCfg.right),
26
+ );
27
+
28
+ await this.loadRemotes();
29
+ }
30
+
31
+ /**
32
+ * Load remote components
33
+ * @remarks With regards to module federation
34
+ * @internal
35
+ */
36
+ async loadRemotes() {
37
+ const remoteComponents = await loadRemotes();
38
+ this.ready = true;
39
+ }
40
+ }