@genesislcap/pbc-notify-ui 1.0.29 → 1.0.31
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.
- package/dist/dts/components/components.d.ts.map +1 -1
- package/dist/dts/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.d.ts.map +1 -1
- package/dist/dts/components/foundation-inbox/inbox-base/inbox-base.d.ts +9 -9
- package/dist/dts/components/foundation-inbox/inbox-base/inbox-base.d.ts.map +1 -1
- package/dist/dts/components/foundation-inbox/inbox.template.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.d.ts +12 -11
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.template.d.ts +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.template.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.types.d.ts +4 -12
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.types.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.d.ts +14 -9
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.types.d.ts +1 -6
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.types.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.d.ts +29 -0
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.d.ts.map +1 -0
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.template.d.ts +3 -0
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.template.d.ts.map +1 -0
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.d.ts +10 -6
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.template.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.types.d.ts +1 -8
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.types.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.tabs.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.utils.d.ts +55 -0
- package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.utils.d.ts.map +1 -0
- package/dist/dts/components/foundation-notification-dashboard/styles/condition-builder.styles.d.ts.map +1 -0
- package/dist/dts/components/foundation-notification-dashboard/styles/dynamic-rule.styles.d.ts +3 -0
- package/dist/dts/components/foundation-notification-dashboard/styles/dynamic-rule.styles.d.ts.map +1 -0
- package/dist/dts/components/foundation-notification-dashboard/types/logical-operator.d.ts +4 -0
- package/dist/dts/components/foundation-notification-dashboard/types/logical-operator.d.ts.map +1 -1
- package/dist/dts/notify.types.d.ts +60 -0
- package/dist/dts/notify.types.d.ts.map +1 -0
- package/dist/dts/services/inbox.service.d.ts.map +1 -1
- package/dist/esm/components/components.js +2 -2
- package/dist/esm/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.js +3 -3
- package/dist/esm/components/foundation-inbox/inbox-base/inbox-base.js +10 -12
- package/dist/esm/components/foundation-inbox/inbox.template.js +1 -2
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.js +84 -60
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.template.js +42 -28
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.types.js +5 -4
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.js +94 -102
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.js +11 -14
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.types.js +0 -7
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-management.js +2 -2
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.js +169 -0
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-condition-builder/template-condition-builder.template.js +66 -0
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.js +95 -115
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.template.js +16 -22
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-management.js +2 -2
- package/dist/esm/components/foundation-notification-dashboard/notification-dashboard.tabs.js +6 -4
- package/dist/esm/components/foundation-notification-dashboard/notification-dashboard.utils.js +276 -0
- package/dist/esm/components/foundation-notification-dashboard/{components/templates/template-dialog/condition-builder → styles}/condition-builder.styles.js +6 -6
- package/dist/esm/components/foundation-notification-dashboard/{components/templates/template-dialog/template-dialog.styles.js → styles/dynamic-rule.styles.js} +24 -8
- package/dist/esm/components/foundation-notification-dashboard/types/logical-operator.js +4 -0
- package/dist/esm/notify.types.js +70 -0
- package/dist/esm/services/inbox.service.js +1 -5
- package/package.json +1 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.styles.d.ts +0 -2
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.styles.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.styles.d.ts +0 -2
- package/dist/dts/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.styles.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.d.ts +0 -32
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.styles.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.template.d.ts +0 -3
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.template.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.styles.d.ts +0 -2
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.styles.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.utils.d.ts +0 -41
- package/dist/dts/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.utils.d.ts.map +0 -1
- package/dist/dts/components/foundation-notification-dashboard/styles/rules-and-templates.styles.d.ts +0 -2
- package/dist/dts/components/foundation-notification-dashboard/styles/rules-and-templates.styles.d.ts.map +0 -1
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-condition-builder/rule-condition-builder.styles.js +0 -53
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.styles.js +0 -95
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.js +0 -179
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/condition-builder/condition-builder.template.js +0 -42
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.utils.js +0 -119
- package/dist/esm/components/foundation-notification-dashboard/styles/rules-and-templates.styles.js +0 -17
- /package/dist/dts/components/foundation-notification-dashboard/{components/templates/template-dialog/condition-builder → styles}/condition-builder.styles.d.ts +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { sync } from '@genesislcap/foundation-utils';
|
|
2
2
|
import { html, ref, repeat } from '@microsoft/fast-element';
|
|
3
|
+
import { Severity, UpdateType } from '../../../../../notify.types';
|
|
3
4
|
import { eventDetail } from '../../../../../utils/eventDetail';
|
|
4
|
-
import { ALL_SEVERITIES } from '../../../types/severity';
|
|
5
|
-
import { UpdateType } from './rule-dialog.types';
|
|
6
5
|
export const RuleDialogTemplate = html `
|
|
7
|
-
<zero-modal ${ref('dialog')} class="
|
|
8
|
-
<div slot="top" class="
|
|
6
|
+
<zero-modal ${ref('dialog')} class="dialog" :onCloseCallback=${(x) => () => x.close()}>
|
|
7
|
+
<div slot="top" class="dialog-top">${(x) => x.ruleDialogTitle}</div>
|
|
9
8
|
|
|
10
|
-
<div class="
|
|
9
|
+
<div class="dialog-content">
|
|
11
10
|
<div class="content-row">
|
|
12
11
|
<div class="control">
|
|
13
12
|
<label>Name</label>
|
|
@@ -53,10 +52,11 @@ export const RuleDialogTemplate = html `
|
|
|
53
52
|
value-field="value"
|
|
54
53
|
label-field="value"
|
|
55
54
|
option-element="zero-option"
|
|
56
|
-
:data=${(_) =>
|
|
55
|
+
:data=${(_) => Object.values(Severity).map((value) => ({ value }))}
|
|
57
56
|
></options-datasource>
|
|
58
57
|
</zero-select>
|
|
59
58
|
</div>
|
|
59
|
+
|
|
60
60
|
<div class="control">
|
|
61
61
|
<label>Update Type</label>
|
|
62
62
|
<zero-multiselect
|
|
@@ -90,11 +90,11 @@ export const RuleDialogTemplate = html `
|
|
|
90
90
|
|
|
91
91
|
<div class="control">
|
|
92
92
|
<label>Condition(s)</label>
|
|
93
|
-
<div class="
|
|
94
|
-
<div class="content-row
|
|
93
|
+
<div class="items">
|
|
94
|
+
<div class="content-row item">
|
|
95
95
|
${repeat((x) => x.conditions, html `
|
|
96
96
|
<rule-condition-builder
|
|
97
|
-
:
|
|
97
|
+
:fields=${(x, c) => c.parent.fields}
|
|
98
98
|
:condition=${(x) => x}
|
|
99
99
|
@edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
|
|
100
100
|
@delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
|
|
@@ -103,16 +103,13 @@ export const RuleDialogTemplate = html `
|
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
105
|
<div class="content-row">
|
|
106
|
-
<zero-button @click=${(x) => x.newCondition()}>
|
|
107
|
-
<zero-icon name="plus"></zero-icon>
|
|
108
|
-
Condition
|
|
109
|
-
</zero-button>
|
|
106
|
+
<zero-button @click=${(x) => x.newCondition()}>+ Condition</zero-button>
|
|
110
107
|
</div>
|
|
111
108
|
</div>
|
|
112
109
|
</div>
|
|
113
110
|
</div>
|
|
114
111
|
|
|
115
|
-
<div slot="bottom" class="
|
|
112
|
+
<div slot="bottom" class="dialog-bottom">
|
|
116
113
|
<zero-button appearance="accent" @click=${(x) => x.submit()}>Submit</zero-button>
|
|
117
114
|
</div>
|
|
118
115
|
</zero-modal>
|
|
@@ -2,10 +2,3 @@ export const RuleDialogMode = {
|
|
|
2
2
|
CREATE: 'create',
|
|
3
3
|
EDIT: 'edit',
|
|
4
4
|
};
|
|
5
|
-
export var UpdateType;
|
|
6
|
-
(function (UpdateType) {
|
|
7
|
-
UpdateType["INSERT"] = "INSERT";
|
|
8
|
-
UpdateType["MODIFY"] = "MODIFY";
|
|
9
|
-
UpdateType["DELETE"] = "DELETE";
|
|
10
|
-
})(UpdateType || (UpdateType = {}));
|
|
11
|
-
export const defaultUpdateType = [UpdateType.INSERT];
|
package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-management.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __awaiter, __decorate } from "tslib";
|
|
|
2
2
|
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
3
3
|
import { css, customElement, FASTElement, html, ref, repeat } from '@microsoft/fast-element';
|
|
4
4
|
import { RuleService } from '../../../../services/rule.service';
|
|
5
|
-
import {
|
|
5
|
+
import { DynamicRuleManagementStyles } from '../../styles/dynamic-rule.styles';
|
|
6
6
|
import { RULE_MANAGEMENT_COLUMNS } from './columns';
|
|
7
7
|
import { RuleDialogMode } from './rule-dialog/rule-dialog.types';
|
|
8
8
|
let RuleManagement = class RuleManagement extends FASTElement {
|
|
@@ -63,7 +63,7 @@ RuleManagement = __decorate([
|
|
|
63
63
|
<rule-dialog ${ref('ruleDialog')}></rule-dialog>
|
|
64
64
|
`,
|
|
65
65
|
styles: css `
|
|
66
|
-
${
|
|
66
|
+
${DynamicRuleManagementStyles}
|
|
67
67
|
`,
|
|
68
68
|
})
|
|
69
69
|
], RuleManagement);
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { __awaiter, __decorate } from "tslib";
|
|
2
|
+
import { FASTElement, attr, customElement, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { LogicalOperator, RightCriteria, nullAndBlankLogicalOperatorValues, } from '../../../../../../notify.types';
|
|
4
|
+
import { logger } from '../../../../../../utils';
|
|
5
|
+
import { ConditionBuilderStyles } from '../../../../styles/condition-builder.styles';
|
|
6
|
+
import { TemplateConditionBuilderTemplate } from './template-condition-builder.template';
|
|
7
|
+
let TemplateConditionBuilder = class TemplateConditionBuilder extends FASTElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.leftValueItems = [];
|
|
11
|
+
this.rightCriteria = RightCriteria.VALUE;
|
|
12
|
+
this.rightValueItems = [];
|
|
13
|
+
// #endregion
|
|
14
|
+
}
|
|
15
|
+
deleteCondition() {
|
|
16
|
+
this.$emit('delete', this.condition);
|
|
17
|
+
}
|
|
18
|
+
conditionChanged() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (this.fields) {
|
|
21
|
+
this.leftValueItems = this.fields;
|
|
22
|
+
}
|
|
23
|
+
this.assignLeftValue();
|
|
24
|
+
this.logicalOperator = this.condition.LOGICAL_OPERATOR;
|
|
25
|
+
const rightValue = this.condition.RIGHT_VALUE;
|
|
26
|
+
this.rightCriteria = this.condition.RIGHT_CRITERIA;
|
|
27
|
+
this.condition.RIGHT_VALUE = rightValue;
|
|
28
|
+
this.assignRightValue();
|
|
29
|
+
this.$emit('edit', this.condition);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
parametersChanged() {
|
|
33
|
+
if (!Array.isArray(this.parameters) || !this.parameters) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.rightValueItems = this.parameters;
|
|
37
|
+
}
|
|
38
|
+
fieldsChanged() {
|
|
39
|
+
if (!Array.isArray(this.fields) || !this.fields.length) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.leftValueItems = this.fields;
|
|
43
|
+
this.leftValue = JSON.stringify(this.leftValueItems[0]);
|
|
44
|
+
}
|
|
45
|
+
logicalOperatorChanged() {
|
|
46
|
+
if (!this.condition) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (nullAndBlankLogicalOperatorValues.includes(LogicalOperator[this.logicalOperator])) {
|
|
50
|
+
this.rightCriteria = RightCriteria.VALUE;
|
|
51
|
+
this.clearRightValueText();
|
|
52
|
+
}
|
|
53
|
+
this.condition.LOGICAL_OPERATOR = this.logicalOperator;
|
|
54
|
+
this.$emit('edit', this.condition);
|
|
55
|
+
}
|
|
56
|
+
// #region LeftValue
|
|
57
|
+
assignLeftValue() {
|
|
58
|
+
// Add (fresh new; assign the 1st element)
|
|
59
|
+
if (!this.condition.LEFT_VALUE) {
|
|
60
|
+
this.leftValue = JSON.stringify(this.leftValueItems[0]);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Add (value changed)
|
|
64
|
+
if (typeof this.condition.LEFT_VALUE !== 'string') {
|
|
65
|
+
this.leftValue = JSON.stringify(this.condition.LEFT_VALUE);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Edit
|
|
69
|
+
this.leftValue = JSON.stringify(this.leftValueItems.find((item) => item.FIELD_NAME === this.condition.LEFT_VALUE));
|
|
70
|
+
}
|
|
71
|
+
leftValueChanged() {
|
|
72
|
+
if (!this.condition) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.condition.LEFT_VALUE = JSON.parse(this.leftValue);
|
|
76
|
+
this.$emit('edit', this.condition);
|
|
77
|
+
}
|
|
78
|
+
// #endregion
|
|
79
|
+
// #region RightValue
|
|
80
|
+
assignRightValue() {
|
|
81
|
+
var _a;
|
|
82
|
+
if (this.condition.RIGHT_CRITERIA === RightCriteria.VALUE) {
|
|
83
|
+
this.rightValueText = this.condition.RIGHT_VALUE;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (((_a = this.parameters) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
87
|
+
this.rightValueSelect = this.condition.RIGHT_VALUE;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.rightValueSelect = null;
|
|
91
|
+
}
|
|
92
|
+
rightCriteriaChanged() {
|
|
93
|
+
if (!this.condition) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.condition.RIGHT_CRITERIA = this.rightCriteria;
|
|
97
|
+
switch (this.rightCriteria) {
|
|
98
|
+
case RightCriteria.VALUE:
|
|
99
|
+
this.clearRightValueText();
|
|
100
|
+
break;
|
|
101
|
+
case RightCriteria.USER_ENTRY:
|
|
102
|
+
this.clearRightValueSelect();
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
logger.error(`Unknown RightCriteria: ${this.rightCriteria}`);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
this.$emit('edit', this.condition);
|
|
109
|
+
}
|
|
110
|
+
clearRightValueText() {
|
|
111
|
+
this.rightValueText = '';
|
|
112
|
+
}
|
|
113
|
+
clearRightValueSelect() {
|
|
114
|
+
var _a;
|
|
115
|
+
this.rightValueSelect = ((_a = this.parameters) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.parameters[0].UUID : null;
|
|
116
|
+
}
|
|
117
|
+
rightValueTextChanged() {
|
|
118
|
+
if (!this.condition) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.condition.RIGHT_VALUE = this.rightValueText;
|
|
122
|
+
this.$emit('edit', this.condition);
|
|
123
|
+
}
|
|
124
|
+
rightValueSelectChanged() {
|
|
125
|
+
if (!this.condition) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.condition.RIGHT_VALUE = this.rightValueSelect;
|
|
129
|
+
this.$emit('edit', this.condition);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
__decorate([
|
|
133
|
+
attr
|
|
134
|
+
], TemplateConditionBuilder.prototype, "condition", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
attr
|
|
137
|
+
], TemplateConditionBuilder.prototype, "parameters", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
attr
|
|
140
|
+
], TemplateConditionBuilder.prototype, "fields", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
observable
|
|
143
|
+
], TemplateConditionBuilder.prototype, "leftValue", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
observable
|
|
146
|
+
], TemplateConditionBuilder.prototype, "leftValueItems", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
observable
|
|
149
|
+
], TemplateConditionBuilder.prototype, "logicalOperator", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
observable
|
|
152
|
+
], TemplateConditionBuilder.prototype, "rightCriteria", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
observable
|
|
155
|
+
], TemplateConditionBuilder.prototype, "rightValueText", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
observable
|
|
158
|
+
], TemplateConditionBuilder.prototype, "rightValueSelect", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
observable
|
|
161
|
+
], TemplateConditionBuilder.prototype, "rightValueItems", void 0);
|
|
162
|
+
TemplateConditionBuilder = __decorate([
|
|
163
|
+
customElement({
|
|
164
|
+
name: 'template-condition-builder',
|
|
165
|
+
template: TemplateConditionBuilderTemplate,
|
|
166
|
+
styles: ConditionBuilderStyles,
|
|
167
|
+
})
|
|
168
|
+
], TemplateConditionBuilder);
|
|
169
|
+
export { TemplateConditionBuilder };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { sync } from '@genesislcap/foundation-utils';
|
|
2
|
+
import { html, repeat, when } from '@microsoft/fast-element';
|
|
3
|
+
import { classNames } from '@microsoft/fast-web-utilities';
|
|
4
|
+
import { LogicalOperator, RightCriteria, nullAndBlankLogicalOperatorValues, } from '../../../../../../notify.types';
|
|
5
|
+
export const TemplateConditionBuilderTemplate = html `
|
|
6
|
+
<div class="condition-builder">
|
|
7
|
+
<zero-select
|
|
8
|
+
:value=${sync((x) => x.leftValue)}
|
|
9
|
+
:initialValue=${sync((x) => x.leftValue)}
|
|
10
|
+
class="left-value"
|
|
11
|
+
>
|
|
12
|
+
${repeat((x) => x.leftValueItems, html `
|
|
13
|
+
<zero-option value=${(x) => JSON.stringify(x)}>${(x) => x.FIELD_NAME}</zero-option>
|
|
14
|
+
`)}
|
|
15
|
+
</zero-select>
|
|
16
|
+
|
|
17
|
+
<zero-select
|
|
18
|
+
class="logical-operator${(x) => classNames([
|
|
19
|
+
'-null-and-blank',
|
|
20
|
+
nullAndBlankLogicalOperatorValues.includes(LogicalOperator[x.logicalOperator]),
|
|
21
|
+
])}"
|
|
22
|
+
:value=${sync((x) => x.logicalOperator)}
|
|
23
|
+
>
|
|
24
|
+
${repeat((_) => Object.values(LogicalOperator), html `
|
|
25
|
+
<zero-option value=${(x) => x}>${(x) => x}</zero-option>
|
|
26
|
+
`)}
|
|
27
|
+
</zero-select>
|
|
28
|
+
|
|
29
|
+
${when((x) => !nullAndBlankLogicalOperatorValues.includes(LogicalOperator[x.logicalOperator]), html `
|
|
30
|
+
<zero-select class="right-criteria" :value=${sync((x) => x.rightCriteria)}>
|
|
31
|
+
${repeat((_) => Object.values(RightCriteria), html `
|
|
32
|
+
<zero-option value=${(x) => x}>${(x) => x}</zero-option>
|
|
33
|
+
`)}
|
|
34
|
+
</zero-select>
|
|
35
|
+
|
|
36
|
+
${when((x) => x.rightCriteria === RightCriteria.VALUE, html `
|
|
37
|
+
<zero-text-field
|
|
38
|
+
class="right-criteria-text"
|
|
39
|
+
:value=${sync((x) => x.rightValueText)}
|
|
40
|
+
placeholder="Value"
|
|
41
|
+
autocomplete="off"
|
|
42
|
+
></zero-text-field>
|
|
43
|
+
`)}
|
|
44
|
+
${when((x) => x.rightCriteria === RightCriteria.USER_ENTRY, html `
|
|
45
|
+
<zero-select class="right-criteria-select" :value=${sync((x) => x.rightValueSelect)}>
|
|
46
|
+
${(x) => rightValueItemsOptions(x.rightValueItems)}
|
|
47
|
+
</zero-select>
|
|
48
|
+
`)}
|
|
49
|
+
`)}
|
|
50
|
+
|
|
51
|
+
<zero-button appearance="icon" class="delete" @click=${(x) => x.deleteCondition()}>
|
|
52
|
+
<zero-icon
|
|
53
|
+
style="opacity: 0.5"
|
|
54
|
+
variant="regular"
|
|
55
|
+
name="trash-alt"
|
|
56
|
+
size="lg"
|
|
57
|
+
part="icon"
|
|
58
|
+
></zero-icon>
|
|
59
|
+
</zero-button>
|
|
60
|
+
</div>
|
|
61
|
+
`;
|
|
62
|
+
const rightValueItemsOptions = (rightValueItems) => html `
|
|
63
|
+
${repeat((x) => rightValueItems, html `
|
|
64
|
+
<zero-option value="${(x) => { var _a; return (_a = x.UUID) !== null && _a !== void 0 ? _a : ''; }}">${(x) => { var _a; return (_a = x.PARAM_NAME) !== null && _a !== void 0 ? _a : ''; }}</zero-option>
|
|
65
|
+
`)}
|
|
66
|
+
`;
|
|
@@ -1,88 +1,38 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
|
-
import { showNotification } from '@genesislcap/foundation-notifications';
|
|
3
2
|
import { customElement, FASTElement, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { Assignment, defaultUpdateType, Severity, } from '../../../../../notify.types';
|
|
4
4
|
import { NotifyService } from '../../../../../services/notify.service';
|
|
5
5
|
import { SystemService } from '../../../../../services/system.service';
|
|
6
6
|
import { TemplateService } from '../../../../../services/template.service';
|
|
7
7
|
import { humanize, logger } from '../../../../../utils';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { TemplateDialogStyles as styles } from './template-dialog.styles';
|
|
13
|
-
import { TemplateDialogTemplate as template } from './template-dialog.template';
|
|
14
|
-
import { TemplateDialogMode, } from './template-dialog.types';
|
|
15
|
-
import { createAssignment, createConditions, createEmptyCondition, createEmptyParameter, createParameterDetails, getAssignmentValue, UUIDGenerator, } from './template-dialog.utils';
|
|
16
|
-
const name = 'template-dialog';
|
|
8
|
+
import { DynamicRuleUtils, showNotificationError, TemplateUtils, } from '../../../notification-dashboard.utils';
|
|
9
|
+
import { DynamicRuleDialogStyles } from '../../../styles/dynamic-rule.styles';
|
|
10
|
+
import { TemplateDialogTemplate } from './template-dialog.template';
|
|
11
|
+
import { TemplateDialogMode } from './template-dialog.types';
|
|
17
12
|
let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
18
13
|
constructor() {
|
|
19
14
|
super(...arguments);
|
|
20
|
-
this.resource = ''; // Tables + Views
|
|
15
|
+
this.resource = ''; // TODO: Tables + Views
|
|
21
16
|
this.updateType = defaultUpdateType;
|
|
22
17
|
this.parameters = [];
|
|
23
18
|
this.conditions = [];
|
|
24
19
|
this.resources = [];
|
|
25
20
|
this.fields = [];
|
|
26
21
|
this.topics = [];
|
|
22
|
+
this.templateDialogMode = null;
|
|
23
|
+
// #endregion
|
|
27
24
|
}
|
|
28
25
|
openDialog(params) {
|
|
29
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
this.resources = yield this.systemService.getResources(); // TODO: Tables + Views
|
|
32
27
|
this.topics = yield this.notifyService.getNotifyRouteTopics();
|
|
28
|
+
this.resources = yield this.systemService.getResources(); // TODO: Tables + Views
|
|
33
29
|
this.templateDialogMode = params.mode;
|
|
34
30
|
switch (params.mode) {
|
|
35
31
|
case TemplateDialogMode.CREATE:
|
|
36
|
-
this.
|
|
37
|
-
this.resource = this.resources[0];
|
|
38
|
-
this.fields = yield this.systemService.getFields(this.resource);
|
|
39
|
-
this.topic = this.topics[0];
|
|
40
|
-
this.severity = SEVERITY_INFORMATION;
|
|
41
|
-
this.updateType = defaultUpdateType;
|
|
32
|
+
yield this.createTemplate();
|
|
42
33
|
break;
|
|
43
34
|
case TemplateDialogMode.EDIT:
|
|
44
|
-
|
|
45
|
-
this.templateId = ruleTemplate.DYNAMIC_RULE_ID;
|
|
46
|
-
this.name = ruleTemplate.RULE_NAME;
|
|
47
|
-
this.description = ruleTemplate.RULE_DESCRIPTION;
|
|
48
|
-
this.resource = ruleTemplate.RULE_TABLE;
|
|
49
|
-
this.updateType = ruleTemplate.TABLE_OPERATIONS;
|
|
50
|
-
this.fields = yield this.systemService.getFields(this.resource);
|
|
51
|
-
// Parameters
|
|
52
|
-
this.parameters = Object.keys(ruleTemplate.PARAMETERS).map((key) => {
|
|
53
|
-
return {
|
|
54
|
-
UUID: UUIDGenerator.createUuid(),
|
|
55
|
-
PARAM_NAME: ruleTemplate.PARAMETERS[key].PARAM_NAME,
|
|
56
|
-
PARAM_LABEL: ruleTemplate.PARAMETERS[key].PARAM_LABEL,
|
|
57
|
-
PARAM_TYPE: ruleTemplate.PARAMETERS[key].PARAM_TYPE,
|
|
58
|
-
PARAM_SOURCE_TYPE: ruleTemplate.PARAMETERS[key].PARAM_SOURCE_TYPE,
|
|
59
|
-
PARAM_SOURCE: ruleTemplate.PARAMETERS[key].PARAM_SOURCE,
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
// Conditions
|
|
63
|
-
this.conditions = ruleTemplate.RULE_EXPRESSION.CONDITIONS.map((condition) => {
|
|
64
|
-
var _a, _b;
|
|
65
|
-
return {
|
|
66
|
-
ID: UUIDGenerator.createUuid(),
|
|
67
|
-
LEFT_VALUE: (_a = condition.LEFT.VALUE) !== null && _a !== void 0 ? _a : condition.LEFT.NAME,
|
|
68
|
-
LOGICAL_OPERATOR: condition.OPERATION,
|
|
69
|
-
RIGHT_CRITERIA: condition.RIGHT.TYPE === EXPRESSION_TYPE_PLACEHOLDER
|
|
70
|
-
? RIGHT_CRITERIA_USER_ENTRY
|
|
71
|
-
: RIGHT_CRITERIA_VALUE,
|
|
72
|
-
RIGHT_VALUE: condition.RIGHT.TYPE === EXPRESSION_TYPE_PLACEHOLDER
|
|
73
|
-
? this.parameters.find((parameter) => parameter.PARAM_NAME === condition.RIGHT.KEY)
|
|
74
|
-
.UUID
|
|
75
|
-
: (_b = condition.RIGHT.VALUE) !== null && _b !== void 0 ? _b : condition.RIGHT.NAME,
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
// Assignments
|
|
79
|
-
const assignments = (_a = ruleTemplate.RESULT_EXPRESSION) === null || _a === void 0 ? void 0 : _a.ASSIGNMENTS;
|
|
80
|
-
if (assignments) {
|
|
81
|
-
this.header = getAssignmentValue(assignments, 'HEADER');
|
|
82
|
-
this.message = getAssignmentValue(assignments, 'BODY');
|
|
83
|
-
this.severity = (_b = getAssignmentValue(assignments, 'NOTIFY_SEVERITY')) === null || _b === void 0 ? void 0 : _b.toUpperCase();
|
|
84
|
-
this.topic = getAssignmentValue(assignments, 'TOPIC');
|
|
85
|
-
}
|
|
35
|
+
yield this.editTemplate(params.data);
|
|
86
36
|
break;
|
|
87
37
|
default:
|
|
88
38
|
logger.error('Error on TemplateDialogMode');
|
|
@@ -91,32 +41,75 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
91
41
|
this.dialog.show();
|
|
92
42
|
});
|
|
93
43
|
}
|
|
44
|
+
close() {
|
|
45
|
+
// Objects
|
|
46
|
+
this.templateId = null;
|
|
47
|
+
this.name = null;
|
|
48
|
+
this.description = null;
|
|
49
|
+
this.header = null;
|
|
50
|
+
this.message = null;
|
|
51
|
+
this.resource = null;
|
|
52
|
+
this.topic = null;
|
|
53
|
+
this.severity = null;
|
|
54
|
+
this.templateDialogMode = null;
|
|
55
|
+
// Arrays
|
|
56
|
+
this.resources = [];
|
|
57
|
+
this.topics = [];
|
|
58
|
+
this.conditions = [];
|
|
59
|
+
this.parameters = [];
|
|
60
|
+
this.updateType = [];
|
|
61
|
+
this.dialog.close();
|
|
62
|
+
this.$emit('close');
|
|
63
|
+
}
|
|
64
|
+
createTemplate() {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
this.conditions.push(DynamicRuleUtils.createEmptyCondition());
|
|
67
|
+
this.resource = this.resources[0];
|
|
68
|
+
this.fields = yield this.systemService.getFields(this.resource);
|
|
69
|
+
this.topic = this.topics[0];
|
|
70
|
+
this.severity = Severity.INFORMATION;
|
|
71
|
+
this.updateType = defaultUpdateType;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
editTemplate(data) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
var _a;
|
|
77
|
+
const template = data;
|
|
78
|
+
this.templateId = template.DYNAMIC_RULE_ID;
|
|
79
|
+
this.name = template.RULE_NAME;
|
|
80
|
+
this.description = template.RULE_DESCRIPTION;
|
|
81
|
+
this.resource = template.RULE_TABLE;
|
|
82
|
+
this.updateType = template.TABLE_OPERATIONS;
|
|
83
|
+
this.fields = yield this.systemService.getFields(this.resource);
|
|
84
|
+
this.parameters = TemplateUtils.getParameters(template.PARAMETERS);
|
|
85
|
+
this.conditions = TemplateUtils.getConditions(template.RULE_EXPRESSION.CONDITIONS, this.parameters);
|
|
86
|
+
this.attributeAssignments((_a = template.RESULT_EXPRESSION) === null || _a === void 0 ? void 0 : _a.ASSIGNMENTS);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
attributeAssignments(assignments) {
|
|
90
|
+
var _a;
|
|
91
|
+
if (!assignments || !assignments.length) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.header = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.HEADER);
|
|
95
|
+
this.message = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.BODY);
|
|
96
|
+
this.severity = (_a = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.NOTIFY_SEVERITY)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
97
|
+
this.topic = DynamicRuleUtils.getAssignmentValue(assignments, Assignment.TOPIC);
|
|
98
|
+
}
|
|
94
99
|
get templateDialogTitle() {
|
|
95
|
-
|
|
96
|
-
return `${mode} Template`;
|
|
100
|
+
return `${this.templateDialogMode === TemplateDialogMode.CREATE ? 'Create' : 'Edit'} Template`;
|
|
97
101
|
}
|
|
98
102
|
submit() {
|
|
99
|
-
const
|
|
100
|
-
DYNAMIC_RULE_ID: this.templateId,
|
|
101
|
-
})), { RULE_NAME: this.name, RULE_DESCRIPTION: this.description, RULE_TABLE: this.resource, TABLE_OPERATIONS: this.updateType, RULE_EXPRESSION: {
|
|
102
|
-
CONDITIONS: createConditions(this.conditions, this.parameters),
|
|
103
|
-
}, RAW_RULE_EXPRESSION: null, RESULT_EXPRESSION: {
|
|
104
|
-
ASSIGNMENTS: [
|
|
105
|
-
createAssignment('TOPIC', this.topic),
|
|
106
|
-
createAssignment('HEADER', this.header),
|
|
107
|
-
createAssignment('BODY', this.message),
|
|
108
|
-
createAssignment('NOTIFY_SEVERITY', humanize(this.severity)),
|
|
109
|
-
],
|
|
110
|
-
}, PARAMETER_DETAILS: createParameterDetails(this.parameters) });
|
|
103
|
+
const template = this.createTemplateObject();
|
|
111
104
|
switch (this.templateDialogMode) {
|
|
112
105
|
case TemplateDialogMode.CREATE:
|
|
113
106
|
this.templateService
|
|
114
|
-
.createRuleTemplate(
|
|
107
|
+
.createRuleTemplate(template)
|
|
115
108
|
.then((response) => this.validateResponse(response));
|
|
116
109
|
break;
|
|
117
110
|
case TemplateDialogMode.EDIT:
|
|
118
111
|
this.templateService
|
|
119
|
-
.editRuleTemplate(
|
|
112
|
+
.editRuleTemplate(template)
|
|
120
113
|
.then((response) => this.validateResponse(response));
|
|
121
114
|
break;
|
|
122
115
|
default:
|
|
@@ -124,42 +117,36 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
124
117
|
break;
|
|
125
118
|
}
|
|
126
119
|
}
|
|
120
|
+
createTemplateObject() {
|
|
121
|
+
return Object.assign(Object.assign({}, (this.templateDialogMode === TemplateDialogMode.EDIT && {
|
|
122
|
+
DYNAMIC_RULE_ID: this.templateId,
|
|
123
|
+
})), { RULE_NAME: this.name, RULE_DESCRIPTION: this.description, RULE_TABLE: this.resource, TABLE_OPERATIONS: this.updateType, RULE_EXPRESSION: {
|
|
124
|
+
CONDITIONS: DynamicRuleUtils.createConditions(this.conditions, this.parameters),
|
|
125
|
+
}, RAW_RULE_EXPRESSION: null, RESULT_EXPRESSION: {
|
|
126
|
+
ASSIGNMENTS: [
|
|
127
|
+
DynamicRuleUtils.createAssignment(Assignment.TOPIC, this.topic),
|
|
128
|
+
DynamicRuleUtils.createAssignment(Assignment.HEADER, this.header),
|
|
129
|
+
DynamicRuleUtils.createAssignment(Assignment.BODY, this.message),
|
|
130
|
+
DynamicRuleUtils.createAssignment(Assignment.NOTIFY_SEVERITY, humanize(this.severity)),
|
|
131
|
+
],
|
|
132
|
+
}, PARAMETER_DETAILS: TemplateUtils.createParameterDetails(this.parameters) });
|
|
133
|
+
}
|
|
127
134
|
validateResponse(response) {
|
|
128
|
-
var _a, _b;
|
|
129
135
|
if (response.MESSAGE_TYPE === 'EVENT_ACK') {
|
|
130
136
|
this.close();
|
|
131
137
|
return;
|
|
132
138
|
}
|
|
133
|
-
|
|
134
|
-
title: (_a = response.ERROR[0]) === null || _a === void 0 ? void 0 : _a.CODE,
|
|
135
|
-
body: (_b = response.ERROR[0]) === null || _b === void 0 ? void 0 : _b.TEXT,
|
|
136
|
-
config: {
|
|
137
|
-
snackbar: {
|
|
138
|
-
type: 'error',
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
}, 'zero');
|
|
139
|
+
showNotificationError(response.ERROR);
|
|
142
140
|
}
|
|
143
|
-
|
|
144
|
-
this
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.header = null;
|
|
149
|
-
this.message = null;
|
|
150
|
-
this.resource = null;
|
|
151
|
-
this.topic = null;
|
|
152
|
-
this.severity = null;
|
|
153
|
-
this.updateType = defaultUpdateType;
|
|
154
|
-
this.conditions = [];
|
|
155
|
-
this.parameters = [];
|
|
156
|
-
this.resources = [];
|
|
157
|
-
this.topics = [];
|
|
158
|
-
this.$emit('close');
|
|
141
|
+
resourceChanged() {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
this.conditions = [DynamicRuleUtils.createEmptyCondition()];
|
|
144
|
+
this.fields = yield this.systemService.getFields(this.resource);
|
|
145
|
+
});
|
|
159
146
|
}
|
|
160
147
|
// #region Condition
|
|
161
148
|
newCondition() {
|
|
162
|
-
this.conditions.push(createEmptyCondition());
|
|
149
|
+
this.conditions.push(DynamicRuleUtils.createEmptyCondition());
|
|
163
150
|
}
|
|
164
151
|
editCondition(editedCondition) { }
|
|
165
152
|
deleteCondition(deletedCondition) {
|
|
@@ -171,7 +158,7 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
171
158
|
// #endregion
|
|
172
159
|
// #region Parameter
|
|
173
160
|
newParameter() {
|
|
174
|
-
this.parameters = [...this.parameters, createEmptyParameter()];
|
|
161
|
+
this.parameters = [...this.parameters, TemplateUtils.createEmptyParameter()];
|
|
175
162
|
}
|
|
176
163
|
editParameter(editedParameter) {
|
|
177
164
|
this.parameters = [...this.parameters];
|
|
@@ -182,13 +169,6 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
182
169
|
}
|
|
183
170
|
this.parameters = this.parameters.filter((parameter) => parameter.UUID !== deletedParameter.UUID);
|
|
184
171
|
}
|
|
185
|
-
// #endregion
|
|
186
|
-
resourceChanged() {
|
|
187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
this.conditions = [createEmptyCondition()];
|
|
189
|
-
this.fields = yield this.systemService.getFields(this.resource);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
172
|
};
|
|
193
173
|
__decorate([
|
|
194
174
|
TemplateService
|
|
@@ -246,9 +226,9 @@ __decorate([
|
|
|
246
226
|
], TemplateDialog.prototype, "templateDialogMode", void 0);
|
|
247
227
|
TemplateDialog = __decorate([
|
|
248
228
|
customElement({
|
|
249
|
-
name,
|
|
250
|
-
template,
|
|
251
|
-
styles,
|
|
229
|
+
name: 'template-dialog',
|
|
230
|
+
template: TemplateDialogTemplate,
|
|
231
|
+
styles: DynamicRuleDialogStyles,
|
|
252
232
|
})
|
|
253
233
|
], TemplateDialog);
|
|
254
234
|
export { TemplateDialog };
|