@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,124 @@
1
+ import type { Select, TextField } from '@genesislcap/rapid-design-system';
2
+ import { attr, customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
+ import {
4
+ PARAM_SOURCE_TYPE_DEFINED_GROUP,
5
+ PARAM_SOURCE_TYPE_REQ_REP,
6
+ } from '../../../../types/param-source-type';
7
+ import { ParameterBuilderEntity } from '../template-dialog.types';
8
+ import { ParameterBuilderStyles as styles } from './parameter-builder.styles';
9
+ import { ParameterBuilderTemplate as template } from './parameter-builder.template';
10
+
11
+ const name = 'parameter-builder';
12
+
13
+ @customElement({
14
+ name,
15
+ template,
16
+ styles,
17
+ })
18
+ export class ParameterBuilder extends GenesisElement {
19
+ @attr parameter: ParameterBuilderEntity;
20
+
21
+ @observable name: string;
22
+ @observable label: string;
23
+ @observable type: string;
24
+ @observable sourceType: string;
25
+
26
+ @observable sourceSelected: string;
27
+ @observable sourceTyped: string;
28
+
29
+ sourceTextField: TextField;
30
+ sourceSelect: Select;
31
+
32
+ reqRepItems = ['REQUEST_1', 'REQUEST_2', 'REQUEST_3'];
33
+
34
+ async connectedCallback() {
35
+ super.connectedCallback();
36
+ }
37
+
38
+ disconnectedCallback() {
39
+ super.disconnectedCallback();
40
+ }
41
+
42
+ deleteParameter() {
43
+ this.$emit('delete', this.parameter as ParameterBuilderEntity);
44
+ }
45
+
46
+ // #region Changed Parameters
47
+ parameterChanged() {
48
+ this.name = this.parameter.PARAM_NAME;
49
+ this.label = this.parameter.PARAM_LABEL;
50
+ this.type = this.parameter.PARAM_TYPE;
51
+ const paramTemp = this.parameter.PARAM_SOURCE; // Can be cleaned
52
+ this.sourceType = this.parameter.PARAM_SOURCE_TYPE;
53
+
54
+ switch (this.sourceType) {
55
+ case PARAM_SOURCE_TYPE_REQ_REP:
56
+ this.sourceSelected = this.parameter.PARAM_SOURCE ?? paramTemp;
57
+ break;
58
+ case PARAM_SOURCE_TYPE_DEFINED_GROUP:
59
+ this.sourceTyped = this.parameter.PARAM_SOURCE ?? paramTemp;
60
+ break;
61
+ default:
62
+ break;
63
+ }
64
+ }
65
+
66
+ nameChanged() {
67
+ this.genericChanged('PARAM_NAME', this.name);
68
+ }
69
+
70
+ labelChanged() {
71
+ this.genericChanged('PARAM_LABEL', this.label);
72
+ }
73
+
74
+ typeChanged() {
75
+ this.genericChanged('PARAM_TYPE', this.type);
76
+ }
77
+
78
+ sourceTypeChanged() {
79
+ this.genericChanged('PARAM_SOURCE_TYPE', this.sourceType);
80
+
81
+ switch (this.sourceType) {
82
+ case PARAM_SOURCE_TYPE_REQ_REP:
83
+ this.sourceTyped = '';
84
+ break;
85
+ case PARAM_SOURCE_TYPE_DEFINED_GROUP:
86
+ this.sourceSelected = this.reqRepItems[0];
87
+ break;
88
+ default:
89
+ this.sourceSelected = this.reqRepItems[0];
90
+ this.sourceTyped = '';
91
+ break;
92
+ }
93
+ }
94
+
95
+ sourceSelectedChanged() {
96
+ if (this.sourceType !== PARAM_SOURCE_TYPE_REQ_REP) {
97
+ return;
98
+ }
99
+
100
+ this.genericChanged('PARAM_SOURCE', this.sourceSelected);
101
+ }
102
+
103
+ sourceTypedChanged() {
104
+ if (this.sourceType !== PARAM_SOURCE_TYPE_DEFINED_GROUP) {
105
+ return;
106
+ }
107
+
108
+ this.genericChanged('PARAM_SOURCE', this.sourceTyped);
109
+ }
110
+ // #endregion
111
+
112
+ private genericChanged(parameterAttribute, value) {
113
+ if (!this.parameter) {
114
+ return;
115
+ }
116
+
117
+ if (this.parameter[parameterAttribute] === value) {
118
+ return;
119
+ }
120
+
121
+ this.parameter[parameterAttribute] = value;
122
+ this.$emit('edit', this.parameter as ParameterBuilderEntity);
123
+ }
124
+ }
@@ -0,0 +1,107 @@
1
+ import { FieldTypeEnum } from '@genesislcap/foundation-comms';
2
+ import { sync } from '@genesislcap/foundation-utils';
3
+ import { classNames, html, repeat, when, whenElse } from '@genesislcap/web-core';
4
+ import {
5
+ LogicalOperator,
6
+ RightCriteria,
7
+ nullAndBlankLogicalOperatorValues,
8
+ } from '../../../../../../notify.types';
9
+ import { Field } from '../../../../../../services/system.service';
10
+ import type { TemplateConditionBuilder } from './template-condition-builder';
11
+
12
+ export const TemplateConditionBuilderTemplate = html<TemplateConditionBuilder>`
13
+ <div class="condition-builder">
14
+ <rapid-select
15
+ :value=${sync((x) => x.leftValue)}
16
+ :initialValue=${sync((x) => x.leftValue)}
17
+ class="left-value"
18
+ >
19
+ ${repeat(
20
+ (x) => x.leftValueItems,
21
+ html<Field>`
22
+ <rapid-option value=${(x) => JSON.stringify(x)}>${(x) => x.FIELD_NAME}</rapid-option>
23
+ `,
24
+ )}
25
+ </rapid-select>
26
+
27
+ <rapid-select
28
+ class="logical-operator${(x) =>
29
+ classNames([
30
+ '-null-and-blank',
31
+ nullAndBlankLogicalOperatorValues.includes(LogicalOperator[x.logicalOperator]),
32
+ ])}"
33
+ :value=${sync((x) => x.logicalOperator)}
34
+ >
35
+ ${repeat(
36
+ (_) => Object.values(LogicalOperator),
37
+ html`
38
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
39
+ `,
40
+ )}
41
+ </rapid-select>
42
+
43
+ ${when(
44
+ (x) => !nullAndBlankLogicalOperatorValues.includes(LogicalOperator[x.logicalOperator]),
45
+ html`
46
+ <rapid-select class="right-criteria" :value=${sync((x) => x.rightCriteria)}>
47
+ ${repeat(
48
+ (_) => Object.values(RightCriteria),
49
+ html`
50
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
51
+ `,
52
+ )}
53
+ </rapid-select>
54
+
55
+ ${when(
56
+ (x) => x.rightCriteria === RightCriteria.VALUE,
57
+ html<TemplateConditionBuilder>`
58
+ ${whenElse(
59
+ (x) => JSON.parse(x.leftValue ?? '{}').FIELD_TYPE === FieldTypeEnum.BOOLEAN,
60
+ html`
61
+ <rapid-select class="right-criteria-select" :value=${sync((x) => x.rightValueText)}>
62
+ <rapid-option value="true">true</rapid-option>
63
+ <rapid-option value="false">false</rapid-option>
64
+ </rapid-select>
65
+ `,
66
+ html`
67
+ <rapid-text-field
68
+ class="right-criteria-text"
69
+ :value=${sync((x) => x.rightValueText)}
70
+ placeholder="Value"
71
+ autocomplete="off"
72
+ ></rapid-text-field>
73
+ `,
74
+ )}
75
+ `,
76
+ )}
77
+ ${when(
78
+ (x) => x.rightCriteria === RightCriteria.USER_ENTRY,
79
+ html<TemplateConditionBuilder>`
80
+ <rapid-select class="right-criteria-select" :value=${sync((x) => x.rightValueSelect)}>
81
+ ${(x) => rightValueItemsOptions(x.rightValueItems)}
82
+ </rapid-select>
83
+ `,
84
+ )}
85
+ `,
86
+ )}
87
+
88
+ <rapid-button appearance="icon" class="delete" @click=${(x) => x.deleteCondition()}>
89
+ <rapid-icon
90
+ style="opacity: 0.5"
91
+ variant="regular"
92
+ name="trash-alt"
93
+ size="lg"
94
+ part="icon"
95
+ ></rapid-icon>
96
+ </rapid-button>
97
+ </div>
98
+ `;
99
+
100
+ const rightValueItemsOptions = (rightValueItems) => html`
101
+ ${repeat(
102
+ (x) => rightValueItems,
103
+ html`
104
+ <rapid-option value="${(x) => x.UUID ?? ''}">${(x) => x.PARAM_NAME ?? ''}</rapid-option>
105
+ `,
106
+ )}
107
+ `;
@@ -0,0 +1,185 @@
1
+ import { FieldTypeEnum } from '@genesislcap/foundation-comms';
2
+ import { attr, customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
+ import {
4
+ ConditionBuilderEntity,
5
+ LogicalOperator,
6
+ RightCriteria,
7
+ nullAndBlankLogicalOperatorValues,
8
+ } from '../../../../../../notify.types';
9
+ import { logger } from '../../../../../../utils';
10
+ import { ConditionBuilderStyles } from '../../../../styles/condition-builder.styles';
11
+ import { ParameterBuilderEntity } from '../template-dialog.types';
12
+ import { TemplateConditionBuilderTemplate } from './template-condition-builder.template';
13
+
14
+ @customElement({
15
+ name: 'template-condition-builder',
16
+ template: TemplateConditionBuilderTemplate,
17
+ styles: ConditionBuilderStyles,
18
+ })
19
+ export class TemplateConditionBuilder extends GenesisElement {
20
+ @attr condition: ConditionBuilderEntity;
21
+ @attr parameters: Array<ParameterBuilderEntity> = [];
22
+ @attr fields: Array<string> = [];
23
+
24
+ @observable leftValue: any = null;
25
+ @observable leftValueItems: Array<any> = [];
26
+
27
+ @observable logicalOperator: string = null;
28
+ @observable rightCriteria: string = RightCriteria.VALUE;
29
+ @observable rightValueText: string = null;
30
+ @observable rightValueSelect: string = null;
31
+ @observable rightValueItems: Array<any> = [];
32
+
33
+ deleteCondition() {
34
+ this.$emit('delete', this.condition as ConditionBuilderEntity);
35
+ }
36
+
37
+ async conditionChanged() {
38
+ if (this.fields) {
39
+ this.leftValueItems = this.fields;
40
+ }
41
+
42
+ const rightValue = this.condition.RIGHT_VALUE;
43
+ this.assignLeftValue();
44
+ this.logicalOperator = this.condition.LOGICAL_OPERATOR;
45
+ this.rightCriteria = this.condition.RIGHT_CRITERIA;
46
+ this.condition.RIGHT_VALUE = rightValue;
47
+ this.assignRightValue();
48
+
49
+ this.$emit('edit', this.condition as ConditionBuilderEntity);
50
+ }
51
+
52
+ parametersChanged() {
53
+ if (!Array.isArray(this.parameters) || !this.parameters) {
54
+ return;
55
+ }
56
+
57
+ this.rightValueItems = this.parameters;
58
+ }
59
+
60
+ fieldsChanged() {
61
+ if (!Array.isArray(this.fields) || !this.fields.length) {
62
+ return;
63
+ }
64
+
65
+ this.leftValueItems = this.fields;
66
+ this.leftValue = JSON.stringify(this.leftValueItems[0]);
67
+ }
68
+
69
+ logicalOperatorChanged() {
70
+ if (!this.condition) {
71
+ return;
72
+ }
73
+
74
+ if (nullAndBlankLogicalOperatorValues.includes(LogicalOperator[this.logicalOperator])) {
75
+ this.rightCriteria = RightCriteria.VALUE;
76
+ this.clearRightValueText();
77
+ }
78
+
79
+ this.condition.LOGICAL_OPERATOR = this.logicalOperator;
80
+ this.$emit('edit', this.condition as ConditionBuilderEntity);
81
+ }
82
+
83
+ // #region LeftValue
84
+ private assignLeftValue() {
85
+ if (!this.condition.LEFT_VALUE) {
86
+ // Add (fresh new; assign the 1st element)
87
+ this.leftValue = JSON.stringify(this.leftValueItems[0]);
88
+ } else if (typeof this.condition.LEFT_VALUE !== 'string') {
89
+ // Add (value changed)
90
+ this.leftValue = JSON.stringify(this.condition.LEFT_VALUE);
91
+ } else {
92
+ // Edit
93
+ this.leftValue = JSON.stringify(
94
+ this.leftValueItems.find((item) => item.FIELD_NAME === this.condition.LEFT_VALUE),
95
+ );
96
+ }
97
+
98
+ this.condition.LEFT_VALUE = JSON.parse(this.leftValue ?? '{}');
99
+ }
100
+
101
+ leftValueChanged() {
102
+ if (!this.condition) {
103
+ return;
104
+ }
105
+
106
+ this.condition.LEFT_VALUE = JSON.parse(this.leftValue ?? '{}');
107
+
108
+ if (this.condition.LEFT_VALUE.FIELD_TYPE === FieldTypeEnum.BOOLEAN) {
109
+ this.rightValueText = 'true';
110
+ } else {
111
+ this.clearRightValueText();
112
+ }
113
+
114
+ this.$emit('edit', this.condition as ConditionBuilderEntity);
115
+ }
116
+ // #endregion
117
+
118
+ // #region RightValue
119
+ private assignRightValue() {
120
+ if (this.condition.RIGHT_CRITERIA === RightCriteria.VALUE) {
121
+ this.rightValueText = this.condition.RIGHT_VALUE;
122
+ return;
123
+ }
124
+
125
+ if (this.parameters?.length > 0) {
126
+ this.rightValueSelect = this.condition.RIGHT_VALUE;
127
+ return;
128
+ }
129
+
130
+ this.rightValueSelect = null;
131
+ }
132
+
133
+ rightCriteriaChanged() {
134
+ if (!this.condition) {
135
+ return;
136
+ }
137
+
138
+ this.condition.RIGHT_CRITERIA = this.rightCriteria;
139
+
140
+ switch (this.rightCriteria) {
141
+ case RightCriteria.VALUE:
142
+ if (this.condition.LEFT_VALUE.FIELD_TYPE === FieldTypeEnum.BOOLEAN) {
143
+ this.rightValueText = 'true';
144
+ } else {
145
+ this.clearRightValueText();
146
+ }
147
+ break;
148
+ case RightCriteria.USER_ENTRY:
149
+ this.clearRightValueSelect();
150
+ break;
151
+ default:
152
+ logger.error(`Unknown RightCriteria: ${this.rightCriteria}`);
153
+ break;
154
+ }
155
+
156
+ this.$emit('edit', this.condition as ConditionBuilderEntity);
157
+ }
158
+
159
+ private clearRightValueText() {
160
+ this.rightValueText = '';
161
+ }
162
+
163
+ private clearRightValueSelect() {
164
+ this.rightValueSelect = this.parameters?.length > 0 ? this.parameters[0].UUID : null;
165
+ }
166
+
167
+ rightValueTextChanged() {
168
+ if (!this.condition) {
169
+ return;
170
+ }
171
+
172
+ this.condition.RIGHT_VALUE = this.rightValueText;
173
+ this.$emit('edit', this.condition as ConditionBuilderEntity);
174
+ }
175
+
176
+ rightValueSelectChanged() {
177
+ if (!this.condition) {
178
+ return;
179
+ }
180
+
181
+ this.condition.RIGHT_VALUE = this.rightValueSelect;
182
+ this.$emit('edit', this.condition as ConditionBuilderEntity);
183
+ }
184
+ // #endregion
185
+ }
@@ -0,0 +1,139 @@
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 { TemplateDialog } from './template-dialog';
6
+
7
+ export const TemplateDialogTemplate = html<TemplateDialog>`
8
+ <rapid-modal ${ref('dialog')} class="dialog" :onCloseCallback=${(x) => () => x.close()}>
9
+ <div slot="top" class="dialog-top">${(x) => x.templateDialogTitle}</div>
10
+
11
+ <div class="dialog-content">
12
+ <div class="content-row">
13
+ <div class="control">
14
+ <rapid-text-field :value=${sync((x) => x.name)} autofocus>Name</rapid-text-field>
15
+ </div>
16
+
17
+ <div class="control">
18
+ <rapid-text-field :value=${sync((x) => x.description)}>Description</rapid-text-field>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="content-row">
23
+ <div class="control">
24
+ <label>Resource</label>
25
+ <rapid-select :value=${sync((x) => x.resource)} position="below">
26
+ ${repeat(
27
+ (x) => x.resources,
28
+ html`
29
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
30
+ `,
31
+ )}
32
+ </rapid-select>
33
+ </div>
34
+
35
+ <div class="control">
36
+ <label>Topic</label>
37
+ <rapid-select :value=${sync((x) => x.topic)}>
38
+ ${repeat(
39
+ (x) => x.topics,
40
+ html`
41
+ <rapid-option value=${(x) => x}>${(x) => x}</rapid-option>
42
+ `,
43
+ )}
44
+ </rapid-select>
45
+ </div>
46
+
47
+ <div class="control">
48
+ <label>Severity</label>
49
+ <rapid-select :value=${sync((x) => x.severity)}>
50
+ <options-datasource
51
+ value-field="value"
52
+ label-field="value"
53
+ option-element="rapid-option"
54
+ :data=${(_) => Object.values(Severity).map((value) => ({ value }))}
55
+ ></options-datasource>
56
+ </rapid-select>
57
+ </div>
58
+
59
+ <div class="control">
60
+ <label>Update Type</label>
61
+ <rapid-multiselect
62
+ :selectedOptions=${(x) => x.updateType}
63
+ @selectionChange=${(x, c) => {
64
+ x.updateType = (c.event as CustomEvent).detail;
65
+ }}
66
+ search="false"
67
+ all="false"
68
+ >
69
+ <multiselect-datasource
70
+ value-field="value"
71
+ label-field="value"
72
+ :data=${() => Object.values(UpdateType).map((value) => ({ value, label: value }))}
73
+ ></multiselect-datasource>
74
+ </rapid-multiselect>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="content-row">
79
+ <div class="control">
80
+ <rapid-text-field :value=${sync((x) => x.header)}>Header</rapid-text-field>
81
+ </div>
82
+
83
+ <div class="control">
84
+ <rapid-text-field :value=${sync((x) => x.message)}>Message</rapid-text-field>
85
+ </div>
86
+ </div>
87
+
88
+ <div class="control">
89
+ <label>Parameter(s)</label>
90
+ <div class="items">
91
+ <div class="content-row item">
92
+ ${repeat(
93
+ (x) => x.parameters,
94
+ html`
95
+ <parameter-builder
96
+ :parameter=${(x) => x}
97
+ @edit=${(x, c) => c.parent.editParameter(eventDetail(c))}
98
+ @delete=${(x, c) => c.parent.deleteParameter(eventDetail(c))}
99
+ ></parameter-builder>
100
+ `,
101
+ )}
102
+ </div>
103
+
104
+ <div class="content-row">
105
+ <rapid-button @click=${(x) => x.newParameter()}>+ Parameter</rapid-button>
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ <div class="control">
111
+ <label>Condition(s)</label>
112
+ <div class="items">
113
+ <div class="content-row item">
114
+ ${repeat(
115
+ (x) => x.conditions,
116
+ html<ConditionBuilderEntity>`
117
+ <template-condition-builder
118
+ :fields=${(x, c) => c.parent.fields}
119
+ :parameters=${(x, c) => c.parent.parameters}
120
+ :condition=${(x) => x}
121
+ @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
122
+ @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
123
+ ></template-condition-builder>
124
+ `,
125
+ )}
126
+ </div>
127
+
128
+ <div class="content-row">
129
+ <rapid-button @click=${(x) => x.newCondition()}>+ Condition</rapid-button>
130
+ </div>
131
+ </div>
132
+ </div>
133
+ </div>
134
+
135
+ <div slot="bottom" class="dialog-bottom">
136
+ <rapid-button appearance="primary" @click=${(x) => x.submit()}>Submit</rapid-button>
137
+ </div>
138
+ </rapid-modal>
139
+ `;