@genesislcap/pbc-notify-ui 1.0.30 → 1.0.32
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/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/rules/rule-management.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 +13 -7
- 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/components/templates/template-management.d.ts.map +1 -1
- package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.utils.d.ts +42 -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 +99 -101
- package/dist/esm/components/foundation-notification-dashboard/components/rules/rule-dialog/rule-dialog.template.js +30 -30
- 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 +3 -5
- 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 +106 -116
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.template.js +27 -31
- package/dist/esm/components/foundation-notification-dashboard/components/templates/template-management.js +3 -5
- package/dist/esm/components/foundation-notification-dashboard/notification-dashboard.utils.js +259 -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} +57 -16
- 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,88 +1,38 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { customElement, FASTElement, observable, volatile } 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, isEmpty, } 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.
|
|
15
|
+
this.templateDialogMode = null;
|
|
16
|
+
this.resource = ''; // TODO: Tables + Views
|
|
21
17
|
this.updateType = defaultUpdateType;
|
|
22
18
|
this.parameters = [];
|
|
23
19
|
this.conditions = [];
|
|
24
20
|
this.resources = [];
|
|
25
21
|
this.fields = [];
|
|
26
22
|
this.topics = [];
|
|
23
|
+
this.requiredFields = () => [this.name, this.description, this.header, this.message];
|
|
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,78 @@ 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
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
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
|
+
if (this.requiredFields().some((value) => isEmpty(value))) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const template = this.createTemplateObject();
|
|
111
107
|
switch (this.templateDialogMode) {
|
|
112
108
|
case TemplateDialogMode.CREATE:
|
|
113
109
|
this.templateService
|
|
114
|
-
.createRuleTemplate(
|
|
110
|
+
.createRuleTemplate(template)
|
|
115
111
|
.then((response) => this.validateResponse(response));
|
|
116
112
|
break;
|
|
117
113
|
case TemplateDialogMode.EDIT:
|
|
118
114
|
this.templateService
|
|
119
|
-
.editRuleTemplate(
|
|
115
|
+
.editRuleTemplate(template)
|
|
120
116
|
.then((response) => this.validateResponse(response));
|
|
121
117
|
break;
|
|
122
118
|
default:
|
|
@@ -124,42 +120,36 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
124
120
|
break;
|
|
125
121
|
}
|
|
126
122
|
}
|
|
123
|
+
createTemplateObject() {
|
|
124
|
+
return Object.assign(Object.assign({}, (this.templateDialogMode === TemplateDialogMode.EDIT && {
|
|
125
|
+
DYNAMIC_RULE_ID: this.templateId,
|
|
126
|
+
})), { RULE_NAME: this.name, RULE_DESCRIPTION: this.description, RULE_TABLE: this.resource, TABLE_OPERATIONS: this.updateType, RULE_EXPRESSION: {
|
|
127
|
+
CONDITIONS: DynamicRuleUtils.createConditions(this.conditions, this.parameters),
|
|
128
|
+
}, RAW_RULE_EXPRESSION: null, RESULT_EXPRESSION: {
|
|
129
|
+
ASSIGNMENTS: [
|
|
130
|
+
DynamicRuleUtils.createAssignment(Assignment.TOPIC, this.topic),
|
|
131
|
+
DynamicRuleUtils.createAssignment(Assignment.HEADER, this.header),
|
|
132
|
+
DynamicRuleUtils.createAssignment(Assignment.BODY, this.message),
|
|
133
|
+
DynamicRuleUtils.createAssignment(Assignment.NOTIFY_SEVERITY, humanize(this.severity)),
|
|
134
|
+
],
|
|
135
|
+
}, PARAMETER_DETAILS: TemplateUtils.createParameterDetails(this.parameters) });
|
|
136
|
+
}
|
|
127
137
|
validateResponse(response) {
|
|
128
|
-
var _a, _b;
|
|
129
138
|
if (response.MESSAGE_TYPE === 'EVENT_ACK') {
|
|
130
139
|
this.close();
|
|
131
140
|
return;
|
|
132
141
|
}
|
|
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');
|
|
142
|
+
showNotificationError(response.ERROR);
|
|
142
143
|
}
|
|
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');
|
|
144
|
+
resourceChanged() {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
this.conditions = [DynamicRuleUtils.createEmptyCondition()];
|
|
147
|
+
this.fields = yield this.systemService.getFields(this.resource);
|
|
148
|
+
});
|
|
159
149
|
}
|
|
160
150
|
// #region Condition
|
|
161
151
|
newCondition() {
|
|
162
|
-
this.conditions.push(createEmptyCondition());
|
|
152
|
+
this.conditions.push(DynamicRuleUtils.createEmptyCondition());
|
|
163
153
|
}
|
|
164
154
|
editCondition(editedCondition) { }
|
|
165
155
|
deleteCondition(deletedCondition) {
|
|
@@ -171,7 +161,7 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
171
161
|
// #endregion
|
|
172
162
|
// #region Parameter
|
|
173
163
|
newParameter() {
|
|
174
|
-
this.parameters = [...this.parameters, createEmptyParameter()];
|
|
164
|
+
this.parameters = [...this.parameters, TemplateUtils.createEmptyParameter()];
|
|
175
165
|
}
|
|
176
166
|
editParameter(editedParameter) {
|
|
177
167
|
this.parameters = [...this.parameters];
|
|
@@ -183,11 +173,8 @@ let TemplateDialog = class TemplateDialog extends FASTElement {
|
|
|
183
173
|
this.parameters = this.parameters.filter((parameter) => parameter.UUID !== deletedParameter.UUID);
|
|
184
174
|
}
|
|
185
175
|
// #endregion
|
|
186
|
-
|
|
187
|
-
return
|
|
188
|
-
this.conditions = [createEmptyCondition()];
|
|
189
|
-
this.fields = yield this.systemService.getFields(this.resource);
|
|
190
|
-
});
|
|
176
|
+
get validateRequiredFields() {
|
|
177
|
+
return this.requiredFields().some((value) => isEmpty(value));
|
|
191
178
|
}
|
|
192
179
|
};
|
|
193
180
|
__decorate([
|
|
@@ -199,6 +186,9 @@ __decorate([
|
|
|
199
186
|
__decorate([
|
|
200
187
|
NotifyService
|
|
201
188
|
], TemplateDialog.prototype, "notifyService", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
observable
|
|
191
|
+
], TemplateDialog.prototype, "templateDialogMode", void 0);
|
|
202
192
|
__decorate([
|
|
203
193
|
observable
|
|
204
194
|
], TemplateDialog.prototype, "templateId", void 0);
|
|
@@ -242,13 +232,13 @@ __decorate([
|
|
|
242
232
|
observable
|
|
243
233
|
], TemplateDialog.prototype, "topics", void 0);
|
|
244
234
|
__decorate([
|
|
245
|
-
|
|
246
|
-
], TemplateDialog.prototype, "
|
|
235
|
+
volatile
|
|
236
|
+
], TemplateDialog.prototype, "validateRequiredFields", null);
|
|
247
237
|
TemplateDialog = __decorate([
|
|
248
238
|
customElement({
|
|
249
|
-
name,
|
|
250
|
-
template,
|
|
251
|
-
styles,
|
|
239
|
+
name: 'template-dialog',
|
|
240
|
+
template: TemplateDialogTemplate,
|
|
241
|
+
styles: DynamicRuleDialogStyles,
|
|
252
242
|
})
|
|
253
243
|
], TemplateDialog);
|
|
254
244
|
export { TemplateDialog };
|
|
@@ -1,22 +1,19 @@
|
|
|
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 '../../rules/rule-dialog/rule-dialog.types';
|
|
6
5
|
export const TemplateDialogTemplate = 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.templateDialogTitle}</div>
|
|
9
8
|
|
|
10
|
-
<div class="
|
|
9
|
+
<div class="dialog-content">
|
|
11
10
|
<div class="content-row">
|
|
12
11
|
<div class="control">
|
|
13
|
-
<
|
|
14
|
-
<zero-text-field :value=${sync((x) => x.name)} autofocus></zero-text-field>
|
|
12
|
+
<zero-text-field :value=${sync((x) => x.name)} autofocus>Name</zero-text-field>
|
|
15
13
|
</div>
|
|
16
14
|
|
|
17
15
|
<div class="control">
|
|
18
|
-
<
|
|
19
|
-
<zero-text-field :value=${sync((x) => x.description)}></zero-text-field>
|
|
16
|
+
<zero-text-field :value=${sync((x) => x.description)}>Description</zero-text-field>
|
|
20
17
|
</div>
|
|
21
18
|
</div>
|
|
22
19
|
|
|
@@ -46,10 +43,11 @@ export const TemplateDialogTemplate = html `
|
|
|
46
43
|
value-field="value"
|
|
47
44
|
label-field="value"
|
|
48
45
|
option-element="zero-option"
|
|
49
|
-
:data=${(_) =>
|
|
46
|
+
:data=${(_) => Object.values(Severity).map((value) => ({ value }))}
|
|
50
47
|
></options-datasource>
|
|
51
48
|
</zero-select>
|
|
52
49
|
</div>
|
|
50
|
+
|
|
53
51
|
<div class="control">
|
|
54
52
|
<label>Update Type</label>
|
|
55
53
|
<zero-multiselect
|
|
@@ -71,20 +69,18 @@ export const TemplateDialogTemplate = html `
|
|
|
71
69
|
|
|
72
70
|
<div class="content-row">
|
|
73
71
|
<div class="control">
|
|
74
|
-
<
|
|
75
|
-
<zero-text-field :value=${sync((x) => x.header)}></zero-text-field>
|
|
72
|
+
<zero-text-field :value=${sync((x) => x.header)}>Header</zero-text-field>
|
|
76
73
|
</div>
|
|
77
74
|
|
|
78
75
|
<div class="control">
|
|
79
|
-
<
|
|
80
|
-
<zero-text-field :value=${sync((x) => x.message)}></zero-text-field>
|
|
76
|
+
<zero-text-field :value=${sync((x) => x.message)}>Message</zero-text-field>
|
|
81
77
|
</div>
|
|
82
78
|
</div>
|
|
83
79
|
|
|
84
80
|
<div class="control">
|
|
85
81
|
<label>Parameter(s)</label>
|
|
86
|
-
<div class="
|
|
87
|
-
<div class="content-row
|
|
82
|
+
<div class="items">
|
|
83
|
+
<div class="content-row item">
|
|
88
84
|
${repeat((x) => x.parameters, html `
|
|
89
85
|
<parameter-builder
|
|
90
86
|
:parameter=${(x) => x}
|
|
@@ -95,41 +91,41 @@ export const TemplateDialogTemplate = html `
|
|
|
95
91
|
</div>
|
|
96
92
|
|
|
97
93
|
<div class="content-row">
|
|
98
|
-
<zero-button @click=${(x) => x.newParameter()}>
|
|
99
|
-
<zero-icon name="plus"></zero-icon>
|
|
100
|
-
Parameter
|
|
101
|
-
</zero-button>
|
|
94
|
+
<zero-button @click=${(x) => x.newParameter()}>+ Parameter</zero-button>
|
|
102
95
|
</div>
|
|
103
96
|
</div>
|
|
104
97
|
</div>
|
|
105
98
|
|
|
106
99
|
<div class="control">
|
|
107
100
|
<label>Condition(s)</label>
|
|
108
|
-
<div class="
|
|
109
|
-
<div class="content-row
|
|
101
|
+
<div class="items">
|
|
102
|
+
<div class="content-row item">
|
|
110
103
|
${repeat((x) => x.conditions, html `
|
|
111
|
-
<condition-builder
|
|
112
|
-
:
|
|
104
|
+
<template-condition-builder
|
|
105
|
+
:fields=${(x, c) => c.parent.fields}
|
|
113
106
|
:parameters=${(x, c) => c.parent.parameters}
|
|
114
107
|
:condition=${(x) => x}
|
|
115
108
|
@edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
|
|
116
109
|
@delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
|
|
117
|
-
></condition-builder>
|
|
110
|
+
></template-condition-builder>
|
|
118
111
|
`)}
|
|
119
112
|
</div>
|
|
120
113
|
|
|
121
114
|
<div class="content-row">
|
|
122
|
-
<zero-button @click=${(x) => x.newCondition()}>
|
|
123
|
-
<zero-icon name="plus"></zero-icon>
|
|
124
|
-
Condition
|
|
125
|
-
</zero-button>
|
|
115
|
+
<zero-button @click=${(x) => x.newCondition()}>+ Condition</zero-button>
|
|
126
116
|
</div>
|
|
127
117
|
</div>
|
|
128
118
|
</div>
|
|
129
119
|
</div>
|
|
130
120
|
|
|
131
|
-
<div slot="bottom" class="
|
|
132
|
-
<zero-button
|
|
121
|
+
<div slot="bottom" class="dialog-bottom">
|
|
122
|
+
<zero-button
|
|
123
|
+
appearance="accent"
|
|
124
|
+
@click=${(x) => x.submit()}
|
|
125
|
+
?disabled=${(x) => x.validateRequiredFields}
|
|
126
|
+
>
|
|
127
|
+
Submit
|
|
128
|
+
</zero-button>
|
|
133
129
|
</div>
|
|
134
130
|
</zero-modal>
|
|
135
131
|
`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __awaiter, __decorate } from "tslib";
|
|
2
2
|
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
3
|
-
import {
|
|
3
|
+
import { customElement, FASTElement, html, ref, repeat } from '@microsoft/fast-element';
|
|
4
4
|
import { TemplateService } from '../../../../services/template.service';
|
|
5
|
-
import {
|
|
5
|
+
import { DynamicRuleManagementStyles } from '../../styles/dynamic-rule.styles';
|
|
6
6
|
import { TEMPLATE_MANAGEMENT_COLUMNS } from './columns';
|
|
7
7
|
import { TemplateDialogMode } from './template-dialog/template-dialog.types';
|
|
8
8
|
let TemplateManagement = class TemplateManagement extends FASTElement {
|
|
@@ -62,9 +62,7 @@ TemplateManagement = __decorate([
|
|
|
62
62
|
|
|
63
63
|
<template-dialog ${ref('templateDialog')}></template-dialog>
|
|
64
64
|
`,
|
|
65
|
-
styles:
|
|
66
|
-
${rulesAndTemplatesStyles}
|
|
67
|
-
`,
|
|
65
|
+
styles: DynamicRuleManagementStyles,
|
|
68
66
|
})
|
|
69
67
|
], TemplateManagement);
|
|
70
68
|
export { TemplateManagement };
|