@genesislcap/pbc-notify-ui 1.0.64 → 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 (132) 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/rules/columns.d.ts.map +1 -1
  5. package/dist/dts/components/foundation-notification-dashboard/components/templates/columns.d.ts.map +1 -1
  6. package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.utils.d.ts.map +1 -1
  7. package/dist/dts/tsdoc-metadata.json +11 -0
  8. package/dist/dts/utils/gridConfig.d.ts.map +1 -1
  9. package/dist/dts/utils/humanize.d.ts.map +1 -1
  10. package/dist/dts/utils/toBoolean.d.ts.map +1 -1
  11. package/dist/dts/utils/updateArray.d.ts.map +1 -1
  12. package/dist/esm/index.federated.js +0 -1
  13. package/dist/pbc-notify-ui.api.json +889 -0
  14. package/dist/pbc-notify-ui.d.ts +252 -0
  15. package/dist/tsconfig.tsbuildinfo +1 -0
  16. package/docs/api/index.md +30 -0
  17. package/docs/api/pbc-notify-ui.foundationinbox.connectedcallback.md +18 -0
  18. package/docs/api/pbc-notify-ui.foundationinbox.disconnectedcallback.md +18 -0
  19. package/docs/api/pbc-notify-ui.foundationinbox.md +66 -0
  20. package/docs/api/pbc-notify-ui.foundationinboxcounter.connectedcallback.md +15 -0
  21. package/docs/api/pbc-notify-ui.foundationinboxcounter.disconnectedcallback.md +15 -0
  22. package/docs/api/pbc-notify-ui.foundationinboxcounter.inboxservice.md +11 -0
  23. package/docs/api/pbc-notify-ui.foundationinboxcounter.md +116 -0
  24. package/docs/api/pbc-notify-ui.foundationinboxcounter.value.md +11 -0
  25. package/docs/api/pbc-notify-ui.foundationinboxflyout.close.md +15 -0
  26. package/docs/api/pbc-notify-ui.foundationinboxflyout.connectedcallback.md +15 -0
  27. package/docs/api/pbc-notify-ui.foundationinboxflyout.disconnectedcallback.md +15 -0
  28. package/docs/api/pbc-notify-ui.foundationinboxflyout.flyout.md +11 -0
  29. package/docs/api/pbc-notify-ui.foundationinboxflyout.flyoutclosed.md +11 -0
  30. package/docs/api/pbc-notify-ui.foundationinboxflyout.loadremotes.md +15 -0
  31. package/docs/api/pbc-notify-ui.foundationinboxflyout.md +169 -0
  32. package/docs/api/pbc-notify-ui.foundationinboxflyout.open.md +15 -0
  33. package/docs/api/pbc-notify-ui.foundationinboxflyout.ready.md +11 -0
  34. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.auth.md +11 -0
  35. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.connectedcallback.md +15 -0
  36. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.haspermissions.md +11 -0
  37. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.md +122 -0
  38. package/docs/api/pbc-notify-ui.foundationnotificationdashboard.ready.md +11 -0
  39. package/docs/api/pbc-notify-ui.md +60 -0
  40. package/docs/api-report.md.api.md +76 -0
  41. package/license.txt +46 -0
  42. package/package.json +26 -39
  43. package/src/components/components.ts +54 -0
  44. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.styles.ts +30 -0
  45. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.template.ts +16 -0
  46. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.ts +33 -0
  47. package/src/components/foundation-inbox/components/foundation-inbox-flyout/foundation-inbox-flyout.styles.ts +18 -0
  48. package/src/components/foundation-inbox/components/foundation-inbox-flyout/foundation-inbox-flyout.template.ts +22 -0
  49. package/src/components/foundation-inbox/components/foundation-inbox-flyout/foundation-inbox-flyout.ts +43 -0
  50. package/src/components/foundation-inbox/components/inbox-subscription/inbox-subscription.styles.ts +37 -0
  51. package/src/components/foundation-inbox/components/inbox-subscription/inbox-subscription.template.ts +50 -0
  52. package/src/components/foundation-inbox/components/inbox-subscription/inbox-subscription.ts +81 -0
  53. package/src/components/foundation-inbox/components/inbox-subscription/rule-parameter/rule-parameter.styles.ts +25 -0
  54. package/src/components/foundation-inbox/components/inbox-subscription/rule-parameter/rule-parameter.template.ts +96 -0
  55. package/src/components/foundation-inbox/components/inbox-subscription/rule-parameter/rule-parameter.ts +55 -0
  56. package/src/components/foundation-inbox/inbox-base/inbox-base.ts +320 -0
  57. package/src/components/foundation-inbox/inbox.styles.ts +309 -0
  58. package/src/components/foundation-inbox/inbox.template.ts +317 -0
  59. package/src/components/foundation-inbox/inbox.ts +26 -0
  60. package/src/components/foundation-inbox/inbox.types.ts +84 -0
  61. package/src/components/foundation-inbox/inbox.utils.ts +33 -0
  62. package/src/components/foundation-notification-dashboard/components/notify-audit/notify-audit-management.ts +96 -0
  63. package/src/components/foundation-notification-dashboard/components/routes/route-management.ts +56 -0
  64. package/src/components/foundation-notification-dashboard/components/routes/tabs/email-distribution-route-management.ts +58 -0
  65. package/src/components/foundation-notification-dashboard/components/routes/tabs/email-user-route-management.ts +68 -0
  66. package/src/components/foundation-notification-dashboard/components/routes/tabs/log-route-management.ts +43 -0
  67. package/src/components/foundation-notification-dashboard/components/routes/tabs/ms-teams-route-management.ts +48 -0
  68. package/src/components/foundation-notification-dashboard/components/routes/tabs/screen-route-management.ts +73 -0
  69. package/src/components/foundation-notification-dashboard/components/rules/columns.ts +48 -0
  70. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.template.ts +139 -0
  71. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.ts +255 -0
  72. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.types.ts +4 -0
  73. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.ts +159 -0
  74. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.ts +202 -0
  75. package/src/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.types.ts +28 -0
  76. package/src/components/foundation-notification-dashboard/components/rules/rule-management.ts +72 -0
  77. package/src/components/foundation-notification-dashboard/components/templates/columns.ts +48 -0
  78. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/parameter-builder/parameter-builder.styles.ts +59 -0
  79. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/parameter-builder/parameter-builder.template.ts +95 -0
  80. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/parameter-builder/parameter-builder.ts +124 -0
  81. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.template.ts +107 -0
  82. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.ts +185 -0
  83. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.template.ts +139 -0
  84. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.ts +246 -0
  85. package/src/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.types.ts +38 -0
  86. package/src/components/foundation-notification-dashboard/components/templates/template-management.ts +72 -0
  87. package/src/components/foundation-notification-dashboard/index.ts +1 -0
  88. package/src/components/foundation-notification-dashboard/notification-dashboard.styles.ts +21 -0
  89. package/src/components/foundation-notification-dashboard/notification-dashboard.tabs.ts +35 -0
  90. package/src/components/foundation-notification-dashboard/notification-dashboard.template.ts +58 -0
  91. package/src/components/foundation-notification-dashboard/notification-dashboard.ts +40 -0
  92. package/src/components/foundation-notification-dashboard/notification-dashboard.utils.ts +295 -0
  93. package/src/components/foundation-notification-dashboard/styles/condition-builder.styles.ts +66 -0
  94. package/src/components/foundation-notification-dashboard/styles/dynamic-rule.styles.ts +159 -0
  95. package/src/components/foundation-notification-dashboard/styles/management.styles.ts +21 -0
  96. package/src/components/foundation-notification-dashboard/types/expression-type.ts +13 -0
  97. package/src/components/foundation-notification-dashboard/types/logical-operator.ts +18 -0
  98. package/src/components/foundation-notification-dashboard/types/param-source-type.ts +11 -0
  99. package/src/components/foundation-notification-dashboard/types/param-type.ts +13 -0
  100. package/src/components/foundation-notification-dashboard/types/right-criteria.ts +6 -0
  101. package/src/components/foundation-notification-dashboard/types/rule-execution-strategy.ts +6 -0
  102. package/src/components/foundation-notification-dashboard/types/severity.ts +13 -0
  103. package/src/globals.d.ts +7 -0
  104. package/src/index.federated.ts +1 -0
  105. package/src/index.ts +4 -0
  106. package/src/notify.types.ts +143 -0
  107. package/src/sandbox.ts +83 -0
  108. package/src/services/alert.service.ts +36 -0
  109. package/src/services/inbox.service.ts +85 -0
  110. package/src/services/notify.service.ts +21 -0
  111. package/src/services/rule.service.ts +129 -0
  112. package/src/services/system.service.ts +43 -0
  113. package/src/services/template.service.ts +71 -0
  114. package/src/styles/scrollbar.styles.ts +15 -0
  115. package/src/utils/eventDetail.ts +5 -0
  116. package/src/utils/gridConfig.ts +14 -0
  117. package/src/utils/humanize.ts +14 -0
  118. package/src/utils/icons.ts +15 -0
  119. package/src/utils/index.ts +6 -0
  120. package/src/utils/logger.ts +3 -0
  121. package/src/utils/notifyPermissions.ts +6 -0
  122. package/src/utils/toBoolean.ts +7 -0
  123. package/src/utils/updateArray.ts +33 -0
  124. package/temp/api-report.md.api.md +76 -0
  125. package/tsconfig.json +11 -0
  126. package/.husky/commit-msg +0 -3
  127. package/.husky/pre-commit +0 -4
  128. package/README.md +0 -31
  129. package/commitlint.config.js +0 -25
  130. package/index.html +0 -28
  131. package/scripts/commitlint.js +0 -24
  132. package/sonar-project.properties +0 -5
@@ -0,0 +1,159 @@
1
+ import { sync } from '@genesislcap/foundation-utils';
2
+ import { html, ref, repeat } from '@genesislcap/web-core';
3
+ import { ConditionBuilderEntity, Severity, UpdateType } from '../../../../../notify.types';
4
+ import { eventDetail } from '../../../../../utils/eventDetail';
5
+ import type { RuleDialog } from './rule-dialog';
6
+
7
+ export const RuleDialogTemplate = html<RuleDialog>`
8
+ <rapid-modal ${ref('dialog')} class="dialog" :onCloseCallback=${(x) => () => x.close()}>
9
+ <div slot="top" class="dialog-top">${(x) => x.ruleDialogTitle}</div>
10
+
11
+ <div class="dialog-content">
12
+ <div class="content-row">
13
+ <div class="control">
14
+ <rapid-text-field
15
+ :value=${sync((x) => x.name)}
16
+ @change="${(x) => x.validateRequiredFields()}"
17
+ autofocus
18
+ autocomplete="off"
19
+ required
20
+ >
21
+ Name
22
+ </rapid-text-field>
23
+ </div>
24
+
25
+ <div class="control">
26
+ <rapid-text-field
27
+ :value=${sync((x) => x.description)}
28
+ @change="${(x) => x.validateRequiredFields()}"
29
+ autocomplete="off"
30
+ required
31
+ >
32
+ Description
33
+ </rapid-text-field>
34
+ </div>
35
+ </div>
36
+
37
+ <div class="content-row">
38
+ <div class="control">
39
+ <label>Resource</label>
40
+ <rapid-select
41
+ :value=${sync((x) => x.resource)}
42
+ title=${(x) => x.resource}
43
+ position="below"
44
+ >
45
+ ${repeat(
46
+ (x) => x.resources,
47
+ html`
48
+ <rapid-option value=${(x) => x} title=${(x) => x}>${(x) => x}</rapid-option>
49
+ `,
50
+ )}
51
+ </rapid-select>
52
+ </div>
53
+
54
+ <div class="control">
55
+ <label>Topic</label>
56
+ <rapid-combobox
57
+ autocomplete="both"
58
+ :value=${sync((x) => x.topic)}
59
+ title=${(x) => x.topic}
60
+ >
61
+ ${repeat(
62
+ (x) => x.topics,
63
+ html`
64
+ <rapid-option value=${(x) => x} title=${(x) => x}>${(x) => x}</rapid-option>
65
+ `,
66
+ )}
67
+ </rapid-combobox>
68
+ </div>
69
+
70
+ <div class="control">
71
+ <label>Severity</label>
72
+ <rapid-select :value=${sync((x) => x.severity)}>
73
+ <options-datasource
74
+ value-field="value"
75
+ label-field="value"
76
+ option-element="rapid-option"
77
+ :data=${(_) => Object.values(Severity).map((value) => ({ value }))}
78
+ ></options-datasource>
79
+ </rapid-select>
80
+ </div>
81
+
82
+ <div class="control">
83
+ <label>Update Type</label>
84
+ <rapid-multiselect
85
+ :selectedOptions=${(x) => x.updateType}
86
+ @selectionChange=${(x, c) => {
87
+ x.updateType = (c.event as CustomEvent).detail;
88
+ }}
89
+ search="false"
90
+ all="false"
91
+ >
92
+ <multiselect-datasource
93
+ value-field="value"
94
+ label-field="value"
95
+ :data=${() => Object.values(UpdateType).map((value) => ({ value, label: value }))}
96
+ ></multiselect-datasource>
97
+ </rapid-multiselect>
98
+ </div>
99
+ </div>
100
+
101
+ <div class="content-row">
102
+ <div class="control">
103
+ <rapid-text-field
104
+ required
105
+ :value=${sync((x) => x.header)}
106
+ @change="${(x) => x.validateRequiredFields()}"
107
+ autocomplete="off"
108
+ >
109
+ Header
110
+ </rapid-text-field>
111
+ </div>
112
+
113
+ <div class="control">
114
+ <rapid-text-field
115
+ required
116
+ :value=${sync((x) => x.message)}
117
+ @change="${(x) => x.validateRequiredFields()}"
118
+ autocomplete="off"
119
+ >
120
+ Message
121
+ </rapid-text-field>
122
+ </div>
123
+ </div>
124
+
125
+ <div class="control">
126
+ <label>Condition(s)</label>
127
+ <div class="items">
128
+ <div class="content-row item">
129
+ ${repeat(
130
+ (x) => x.conditions,
131
+ html<ConditionBuilderEntity>`
132
+ <rule-condition-builder
133
+ :fields=${(x, c) => c.parent.fields}
134
+ :condition=${(x) => x}
135
+ @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
136
+ @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
137
+ ></rule-condition-builder>
138
+ `,
139
+ )}
140
+ </div>
141
+
142
+ <div class="content-row">
143
+ <rapid-button @click=${(x) => x.newCondition()}>+ Condition</rapid-button>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div>
148
+
149
+ <div slot="bottom" class="dialog-bottom">
150
+ <rapid-button
151
+ appearance="primary"
152
+ @click=${(x) => x.submit()}
153
+ ?disabled=${(x) => x.submitDisabled}
154
+ >
155
+ Submit
156
+ </rapid-button>
157
+ </div>
158
+ </rapid-modal>
159
+ `;
@@ -0,0 +1,202 @@
1
+ import type { Modal } from '@genesislcap/rapid-design-system';
2
+ import { customElement, GenesisElement, observable } 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 { RuleService } from '../../../../../services/rule.service';
12
+ import { Field, SystemService } from '../../../../../services/system.service';
13
+ import { humanize } from '../../../../../utils';
14
+ import {
15
+ DynamicRuleUtils,
16
+ RuleUtils,
17
+ showNotificationError,
18
+ isEmpty,
19
+ } from '../../../notification-dashboard.utils';
20
+ import { DynamicRuleDialogStyles } from '../../../styles/dynamic-rule.styles';
21
+ import { RuleDialogTemplate } from './rule-dialog.template';
22
+ import { Rule, RuleDialogMode, RuleDialogParams } from './rule-dialog.types';
23
+
24
+ @customElement({
25
+ name: 'rule-dialog',
26
+ template: RuleDialogTemplate,
27
+ styles: DynamicRuleDialogStyles,
28
+ })
29
+ export class RuleDialog extends GenesisElement {
30
+ @RuleService ruleService: RuleService;
31
+ @SystemService systemService: SystemService;
32
+ @NotifyService notifyService: NotifyService;
33
+
34
+ dialog: Modal;
35
+ @observable ruleDialogMode: (typeof RuleDialogMode)[keyof typeof RuleDialogMode];
36
+
37
+ private ruleId: string = null;
38
+ @observable name: string = '';
39
+ @observable description: string = '';
40
+ @observable resource: string = ''; // TODO: Tables + Views
41
+ @observable topic: string = '';
42
+ @observable severity: string = '';
43
+ @observable updateType: UpdateType[] = defaultUpdateType;
44
+ @observable header: string = '';
45
+ @observable message: string = '';
46
+ @observable conditions: Array<ConditionBuilderEntity> = [];
47
+ @observable submitDisabled: boolean;
48
+
49
+ @observable resources: Array<string> = [];
50
+ @observable fields: Array<Field> = [];
51
+ @observable topics: string[] = [];
52
+
53
+ public async openDialog(params: RuleDialogParams) {
54
+ this.topics = await this.notifyService.getNotifyRouteTopics();
55
+ this.resources = await this.systemService.getResources();
56
+ this.ruleDialogMode = params.mode;
57
+
58
+ switch (params.mode) {
59
+ case RuleDialogMode.CREATE:
60
+ await this.createRule();
61
+ this.submitDisabled = true;
62
+ break;
63
+ case RuleDialogMode.EDIT:
64
+ await this.editRule(params.data);
65
+ this.submitDisabled = false;
66
+ break;
67
+ }
68
+
69
+ this.dialog.show();
70
+ }
71
+
72
+ close() {
73
+ // Objects
74
+ this.ruleId = null;
75
+ this.name = null;
76
+ this.description = null;
77
+ this.header = null;
78
+ this.message = null;
79
+ this.resource = null;
80
+ this.topic = null;
81
+ this.severity = null;
82
+ this.ruleDialogMode = null;
83
+
84
+ // Arrays
85
+ this.resources = [];
86
+ this.topics = [];
87
+ this.conditions = [];
88
+ this.updateType = [];
89
+
90
+ this.dialog.close();
91
+ this.$emit('close');
92
+ }
93
+
94
+ private async createRule() {
95
+ this.conditions.push(DynamicRuleUtils.createEmptyCondition());
96
+ this.resource = this.resources[0];
97
+ this.fields = await this.systemService.getFields(this.resource);
98
+ this.topic = this.topics[0];
99
+ this.severity = Severity.INFORMATION;
100
+ this.updateType = defaultUpdateType;
101
+ }
102
+
103
+ private async editRule(data) {
104
+ const rule = data;
105
+ this.ruleId = rule.DYNAMIC_RULE_ID;
106
+ this.name = rule.RULE_NAME;
107
+ this.description = rule.RULE_DESCRIPTION;
108
+ this.resource = rule.RULE_TABLE;
109
+ this.updateType = rule.TABLE_OPERATIONS;
110
+ this.fields = await this.systemService.getFields(this.resource);
111
+ this.conditions = RuleUtils.getConditions(rule.RULE_EXPRESSION.CONDITIONS);
112
+ this.attributeAssignments(rule.RESULT_EXPRESSION?.ASSIGNMENTS);
113
+ }
114
+
115
+ private attributeAssignments(assignments) {
116
+ if (!assignments || !assignments.length) {
117
+ return;
118
+ }
119
+
120
+ this.header = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.HEADER);
121
+ this.message = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.BODY);
122
+ this.severity = DynamicRuleUtils.getAssignmentValue(
123
+ assignments,
124
+ Assignment.NOTIFY_SEVERITY,
125
+ )?.toUpperCase();
126
+ this.topic = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.TOPIC);
127
+ }
128
+
129
+ get ruleDialogTitle(): string {
130
+ return `${this.ruleDialogMode === RuleDialogMode.CREATE ? 'Create' : 'Edit'} Rule`;
131
+ }
132
+
133
+ submit() {
134
+ const rule: Rule = this.createRuleObject();
135
+
136
+ switch (this.ruleDialogMode) {
137
+ case RuleDialogMode.CREATE:
138
+ this.ruleService.createRule(rule).then((response) => this.validateResponse(response));
139
+ break;
140
+ case RuleDialogMode.EDIT:
141
+ this.ruleService.updateRule(rule).then((response) => this.validateResponse(response));
142
+ break;
143
+ }
144
+ }
145
+
146
+ private createRuleObject(): Rule {
147
+ return {
148
+ ...(this.ruleDialogMode === RuleDialogMode.EDIT && { DYNAMIC_RULE_ID: this.ruleId }),
149
+ RULE_NAME: this.name,
150
+ RULE_DESCRIPTION: this.description,
151
+ RULE_TABLE: this.resource,
152
+ TABLE_OPERATIONS: this.updateType,
153
+ RULE_EXPRESSION: {
154
+ CONDITIONS: DynamicRuleUtils.createConditions(this.conditions),
155
+ },
156
+ RESULT_EXPRESSION: {
157
+ ASSIGNMENTS: [
158
+ DynamicRuleUtils.createAssignment(Assignment.TOPIC, this.topic),
159
+ DynamicRuleUtils.createAssignment(Assignment.HEADER, this.header),
160
+ DynamicRuleUtils.createAssignment(Assignment.BODY, this.message),
161
+ DynamicRuleUtils.createAssignment(Assignment.NOTIFY_SEVERITY, humanize(this.severity)),
162
+ ],
163
+ },
164
+ };
165
+ }
166
+
167
+ validateResponse(response) {
168
+ if (response.MESSAGE_TYPE === 'EVENT_ACK') {
169
+ this.close();
170
+ return;
171
+ }
172
+
173
+ showNotificationError(response.ERROR);
174
+ }
175
+
176
+ async resourceChanged() {
177
+ this.conditions = [DynamicRuleUtils.createEmptyCondition()];
178
+ this.fields = await this.systemService.getFields(this.resource);
179
+ }
180
+
181
+ // #region Condition
182
+ newCondition() {
183
+ this.conditions.push(DynamicRuleUtils.createEmptyCondition());
184
+ }
185
+
186
+ editCondition(editedCondition: ConditionBuilderEntity) {}
187
+
188
+ deleteCondition(deletedCondition: ConditionBuilderEntity) {
189
+ if (this.conditions.length <= 1) {
190
+ return;
191
+ }
192
+
193
+ this.conditions = this.conditions.filter((condition) => condition !== deletedCondition);
194
+ }
195
+ // #endregion
196
+
197
+ public validateRequiredFields() {
198
+ this.submitDisabled = [this.name, this.description, this.header, this.message].some((value) =>
199
+ isEmpty(value),
200
+ );
201
+ }
202
+ }
@@ -0,0 +1,28 @@
1
+ import { UpdateType } from '../../../../../notify.types';
2
+
3
+ export const RuleDialogMode = {
4
+ CREATE: 'create',
5
+ EDIT: 'edit',
6
+ } as const;
7
+
8
+ export type RuleDialogParams =
9
+ | {
10
+ mode: typeof RuleDialogMode.CREATE;
11
+ }
12
+ | {
13
+ mode: typeof RuleDialogMode.EDIT;
14
+ data: Rule;
15
+ };
16
+
17
+ export type Rule = {
18
+ DYNAMIC_RULE_ID?: string;
19
+ RULE_NAME: string;
20
+ RULE_DESCRIPTION: string;
21
+ RULE_TABLE: string;
22
+ TABLE_OPERATIONS: UpdateType[];
23
+ RULE_EXPRESSION?: any;
24
+ RAW_RULE_EXPRESSION?: string;
25
+ RESULT_EXPRESSION?: {
26
+ ASSIGNMENTS: Array<any>;
27
+ };
28
+ };
@@ -0,0 +1,72 @@
1
+ import { showNotificationDialog } from '@genesislcap/foundation-notifications';
2
+ import { customElement, GenesisElement, html, ref, repeat } from '@genesislcap/web-core';
3
+ import { RuleService } from '../../../../services/rule.service';
4
+ import { DynamicRuleManagementStyles } from '../../styles/dynamic-rule.styles';
5
+ import { RULE_MANAGEMENT_COLUMNS } from './columns';
6
+ import { RuleDialog } from './rule-dialog/rule-dialog';
7
+ import { RuleDialogMode } from './rule-dialog/rule-dialog.types';
8
+
9
+ @customElement({
10
+ name: 'rule-management',
11
+ template: html<RuleManagement>`
12
+ <div class="container">
13
+ <div class="header">
14
+ <rapid-button class="add" @click=${(x) => x.openRuleDialog()}>
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_DYNAMIC_NOTIFY_RULES">
23
+ ${repeat(
24
+ (x) => RULE_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
+ <rule-dialog ${ref('ruleDialog')}></rule-dialog>
35
+ `,
36
+ styles: DynamicRuleManagementStyles,
37
+ })
38
+ export class RuleManagement extends GenesisElement {
39
+ @RuleService ruleService: RuleService;
40
+ ruleDialog: RuleDialog;
41
+
42
+ openRuleDialog() {
43
+ this.ruleDialog.openDialog({ mode: RuleDialogMode.CREATE });
44
+ }
45
+
46
+ async editRule(row) {
47
+ const rule = await this.ruleService.getRuleDetails(row.ID);
48
+ this.ruleDialog.openDialog({ mode: RuleDialogMode.EDIT, data: rule });
49
+ }
50
+
51
+ deleteRule(rule) {
52
+ showNotificationDialog(
53
+ {
54
+ title: 'Confirm Delete',
55
+ body: 'Do you really want to delete this rule?',
56
+ dialog: {
57
+ dismissingAction: {
58
+ label: 'Dismiss',
59
+ action: () => null,
60
+ },
61
+ confirmingActions: [
62
+ {
63
+ label: 'Confirm',
64
+ action: () => this.ruleService.deleteRule(rule.ID),
65
+ },
66
+ ],
67
+ },
68
+ },
69
+ 'rapid',
70
+ );
71
+ }
72
+ }
@@ -0,0 +1,48 @@
1
+ import { buttonCellRenderer } from '@genesislcap/foundation-entity-management';
2
+ import { deleteIcon, editIcon } from '../../../../utils';
3
+ import type { TemplateManagement } from './template-management';
4
+
5
+ export const TEMPLATE_MANAGEMENT_COLUMNS = (context: TemplateManagement) => [
6
+ {
7
+ field: 'NAME',
8
+ headerName: 'Name',
9
+ flex: 1,
10
+ },
11
+ {
12
+ field: 'DESCRIPTION',
13
+ headerName: 'Description',
14
+ flex: 1,
15
+ },
16
+ {
17
+ field: 'USER_NAME',
18
+ headerName: 'Username',
19
+ flex: 1,
20
+ },
21
+ {
22
+ field: 'RULE_TABLE',
23
+ headerName: 'Table',
24
+ flex: 1,
25
+ },
26
+ {
27
+ field: 'RULE_STATUS',
28
+ headerName: 'Status',
29
+ flex: 1,
30
+ },
31
+ {
32
+ field: 'RULE_EXPRESSION',
33
+ headerName: 'Expression',
34
+ flex: 1,
35
+ },
36
+ {
37
+ field: 'RESULT_EXPRESSION',
38
+ headerName: 'Result',
39
+ flex: 1,
40
+ },
41
+ {
42
+ field: 'RULE_EXECUTION_STRATEGY',
43
+ headerName: 'Execution Strategy',
44
+ flex: 1,
45
+ },
46
+ buttonCellRenderer('Edit', (e) => context.editTemplate(e), editIcon),
47
+ buttonCellRenderer('Delete', (e) => context.deleteTemplate(e), deleteIcon),
48
+ ];
@@ -0,0 +1,59 @@
1
+ import { css } from '@genesislcap/web-core';
2
+
3
+ const PARAM_SOURCE_WIDTH = '200';
4
+
5
+ export const ParameterBuilderStyles = css`
6
+ .parameter-builder {
7
+ display: flex;
8
+ gap: calc(var(--design-unit) * 2px);
9
+ margin-bottom: calc(var(--design-unit) * 2px);
10
+ }
11
+
12
+ rapid-button {
13
+ margin: 0;
14
+ }
15
+
16
+ .delete {
17
+ margin: 0;
18
+ display: flex;
19
+ justify-content: center;
20
+ height: calc(var(--design-unit) * 9px);
21
+ }
22
+
23
+ .delete:hover {
24
+ background-color: color-mix(in srgb, var(--neutral-foreground-rest), transparent 89%);
25
+ }
26
+
27
+ rapid-text-field {
28
+ width: 100%;
29
+ margin-bottom: 0;
30
+ }
31
+
32
+ rapid-text-field::part(root) {
33
+ height: calc(var(--design-unit) * 9px);
34
+ }
35
+
36
+ rapid-select {
37
+ min-width: auto;
38
+ }
39
+
40
+ rapid-select.param-type::part(control) {
41
+ width: 115px;
42
+ }
43
+
44
+ rapid-select.param-source-type::part(control) {
45
+ width: 160px;
46
+ }
47
+
48
+ rapid-select.param-source::part(control) {
49
+ width: ${PARAM_SOURCE_WIDTH}px;
50
+ }
51
+
52
+ rapid-text-field.param-source::part(root) {
53
+ width: calc(${PARAM_SOURCE_WIDTH}px + 2px);
54
+ }
55
+
56
+ rapid-select::part(listbox) {
57
+ max-height: 160px;
58
+ }
59
+ `;
@@ -0,0 +1,95 @@
1
+ import { sync } from '@genesislcap/foundation-utils';
2
+ import { html, ref, repeat, when } from '@genesislcap/web-core';
3
+ import {
4
+ ALL_PARAM_SOURCE_TYPES,
5
+ PARAM_SOURCE_TYPE_DEFINED_GROUP,
6
+ PARAM_SOURCE_TYPE_REQ_REP,
7
+ PARAM_SOURCE_TYPE_USER_TEXT,
8
+ } from '../../../../types/param-source-type';
9
+ import { ALL_PARAM_TYPES } from '../../../../types/param-type';
10
+ import type { ParameterBuilder } from './parameter-builder';
11
+
12
+ export const ParameterBuilderTemplate = html<ParameterBuilder>`
13
+ <div class="parameter-builder">
14
+ <rapid-text-field
15
+ id="param-name"
16
+ placeholder="Name"
17
+ :value=${sync((x) => x.name)}
18
+ ></rapid-text-field>
19
+
20
+ <rapid-text-field
21
+ id="param-label"
22
+ placeholder="Label"
23
+ :value=${sync((x) => x.label)}
24
+ ></rapid-text-field>
25
+
26
+ <rapid-select
27
+ id="param-source-type"
28
+ :value=${sync((x) => x.sourceType)}
29
+ class="param-source-type"
30
+ >
31
+ ${repeat(
32
+ (x) => ALL_PARAM_SOURCE_TYPES,
33
+ html`
34
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
35
+ `,
36
+ )}
37
+ </rapid-select>
38
+
39
+ ${when(
40
+ (x) => x.sourceType === PARAM_SOURCE_TYPE_USER_TEXT,
41
+ html<ParameterBuilder>`
42
+ <rapid-text-field class="param-source" disabled></rapid-text-field>
43
+ `,
44
+ )}
45
+ ${when(
46
+ (x) => x.sourceType === PARAM_SOURCE_TYPE_REQ_REP,
47
+ html<ParameterBuilder>`
48
+ <rapid-select
49
+ ${ref('sourceSelect')}
50
+ id="param-source"
51
+ :value=${sync((x) => x.sourceSelected)}
52
+ class="param-source"
53
+ ?disabled=${(x) => x.sourceType !== PARAM_SOURCE_TYPE_REQ_REP}
54
+ >
55
+ ${repeat(
56
+ (x) => x.reqRepItems,
57
+ html`
58
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
59
+ `,
60
+ )}
61
+ </rapid-select>
62
+ `,
63
+ )}
64
+ ${when(
65
+ (x) => x.sourceType === PARAM_SOURCE_TYPE_DEFINED_GROUP,
66
+ html<ParameterBuilder>`
67
+ <rapid-text-field
68
+ ${ref('sourceTextField')}
69
+ class="param-source"
70
+ placeholder="item1,item2,item3"
71
+ :value=${sync((x) => x.sourceTyped)}
72
+ ></rapid-text-field>
73
+ `,
74
+ )}
75
+
76
+ <rapid-select id="param-type" :value=${sync((x) => x.type)} class="param-type">
77
+ ${repeat(
78
+ (x) => ALL_PARAM_TYPES,
79
+ html`
80
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
81
+ `,
82
+ )}
83
+ </rapid-select>
84
+
85
+ <rapid-button appearance="icon" class="delete" @click=${(x) => x.deleteParameter()}>
86
+ <rapid-icon
87
+ style="opacity: 0.5"
88
+ variant="regular"
89
+ name="trash-alt"
90
+ size="lg"
91
+ part="icon"
92
+ ></rapid-icon>
93
+ </rapid-button>
94
+ </div>
95
+ `;