@genesislcap/pbc-notify-ui 1.0.0 → 1.0.1-prerelease-prerelease

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 (198) hide show
  1. package/README.md +17 -11
  2. package/dist/dts/components/components.d.ts.map +1 -1
  3. package/dist/dts/components/foundation-inbox/components/components.d.ts.map +1 -1
  4. package/dist/dts/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.d.ts +0 -3
  5. package/dist/dts/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.d.ts.map +1 -1
  6. package/dist/dts/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.styles.d.ts.map +1 -1
  7. package/dist/dts/components/foundation-inbox/inbox.d.ts +23 -24
  8. package/dist/dts/components/foundation-inbox/inbox.d.ts.map +1 -1
  9. package/dist/dts/components/foundation-inbox/inbox.styles.d.ts.map +1 -1
  10. package/dist/dts/components/foundation-inbox/inbox.template.d.ts.map +1 -1
  11. package/dist/dts/components/foundation-inbox/inbox.types.d.ts +7 -64
  12. package/dist/dts/components/foundation-inbox/inbox.types.d.ts.map +1 -1
  13. package/dist/dts/components/foundation-inbox/inbox.utils.d.ts +7 -6
  14. package/dist/dts/components/foundation-inbox/inbox.utils.d.ts.map +1 -1
  15. package/dist/dts/components/foundation-notification-dashboard/components/condition-builder/condition-builder.d.ts.map +1 -1
  16. package/dist/dts/components/foundation-notification-dashboard/components/parameter-builder/parameter-builder.template.d.ts.map +1 -1
  17. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-condition-builder/rule-condition-builder.d.ts +1 -1
  18. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-condition-builder/rule-condition-builder.d.ts.map +1 -1
  19. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-condition-builder/rule-condition-builder.template.d.ts.map +1 -1
  20. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.d.ts +2 -10
  21. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.d.ts.map +1 -1
  22. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.template.d.ts.map +1 -1
  23. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.types.d.ts +2 -2
  24. package/dist/dts/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.types.d.ts.map +1 -1
  25. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.d.ts +16 -31
  26. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.d.ts.map +1 -1
  27. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.styles.d.ts.map +1 -1
  28. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.template.d.ts.map +1 -1
  29. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.types.d.ts +2 -7
  30. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.types.d.ts.map +1 -1
  31. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.utils.d.ts +39 -0
  32. package/dist/dts/components/foundation-notification-dashboard/components/template-dialog/template-dialog.utils.d.ts.map +1 -1
  33. package/dist/dts/components/foundation-notification-dashboard/management/management.styles.d.ts +1 -0
  34. package/dist/dts/components/foundation-notification-dashboard/management/management.styles.d.ts.map +1 -1
  35. package/dist/dts/components/foundation-notification-dashboard/management/rule-management.d.ts.map +1 -1
  36. package/dist/dts/components/foundation-notification-dashboard/management/rule-template-management.d.ts +5 -5
  37. package/dist/dts/components/foundation-notification-dashboard/management/rule-template-management.d.ts.map +1 -1
  38. package/dist/dts/components/foundation-notification-dashboard/management/screen-route-management.d.ts.map +1 -1
  39. package/dist/dts/components/foundation-notification-dashboard/notification-dashboard.d.ts.map +1 -1
  40. package/dist/dts/components/foundation-notification-dashboard/types/severity.d.ts +2 -2
  41. package/dist/dts/components/foundation-notification-dashboard/types/severity.d.ts.map +1 -1
  42. package/dist/dts/services/alert.service.d.ts.map +1 -1
  43. package/dist/dts/services/notify.service.d.ts +1 -1
  44. package/dist/dts/services/notify.service.d.ts.map +1 -1
  45. package/dist/dts/services/rule-template.service.d.ts +2 -0
  46. package/dist/dts/services/rule-template.service.d.ts.map +1 -1
  47. package/dist/esm/components/components.js +0 -2
  48. package/dist/esm/components/foundation-inbox/components/components.js +1 -3
  49. package/dist/esm/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.js +0 -9
  50. package/dist/esm/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.styles.js +7 -0
  51. package/dist/esm/components/foundation-inbox/inbox.js +93 -100
  52. package/dist/esm/components/foundation-inbox/inbox.styles.js +15 -3
  53. package/dist/esm/components/foundation-inbox/inbox.template.js +8 -9
  54. package/dist/esm/components/foundation-inbox/inbox.types.js +1 -9
  55. package/dist/esm/components/foundation-inbox/inbox.utils.js +47 -29
  56. package/dist/esm/components/foundation-notification-dashboard/components/condition-builder/condition-builder.js +0 -3
  57. package/dist/esm/components/foundation-notification-dashboard/components/parameter-builder/parameter-builder.template.js +2 -0
  58. package/dist/esm/components/foundation-notification-dashboard/components/rule-dialog/rule-condition-builder/rule-condition-builder.js +21 -11
  59. package/dist/esm/components/foundation-notification-dashboard/components/rule-dialog/rule-condition-builder/rule-condition-builder.template.js +4 -2
  60. package/dist/esm/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.js +34 -95
  61. package/dist/esm/components/foundation-notification-dashboard/components/rule-dialog/rule-dialog.template.js +3 -4
  62. package/dist/esm/components/foundation-notification-dashboard/components/template-dialog/template-dialog.js +110 -157
  63. package/dist/esm/components/foundation-notification-dashboard/components/template-dialog/template-dialog.styles.js +15 -4
  64. package/dist/esm/components/foundation-notification-dashboard/components/template-dialog/template-dialog.template.js +69 -17
  65. package/dist/esm/components/foundation-notification-dashboard/components/template-dialog/template-dialog.utils.js +85 -2
  66. package/dist/esm/components/foundation-notification-dashboard/management/management.styles.js +19 -2
  67. package/dist/esm/components/foundation-notification-dashboard/management/rule-management.js +39 -28
  68. package/dist/esm/components/foundation-notification-dashboard/management/rule-template-management.js +64 -59
  69. package/dist/esm/components/foundation-notification-dashboard/management/screen-route-management.js +2 -1
  70. package/dist/esm/components/foundation-notification-dashboard/notification-dashboard.js +1 -1
  71. package/dist/esm/components/foundation-notification-dashboard/types/severity.js +3 -3
  72. package/dist/esm/services/alert.service.js +9 -2
  73. package/dist/esm/services/notify.service.js +17 -12
  74. package/dist/esm/services/rule-template.service.js +27 -1
  75. package/package.json +2 -1
  76. package/dist/dts/components/foundation-alerts/alerts.config.d.ts +0 -64
  77. package/dist/dts/components/foundation-alerts/alerts.config.d.ts.map +0 -1
  78. package/dist/dts/components/foundation-alerts/alerts.d.ts +0 -74
  79. package/dist/dts/components/foundation-alerts/alerts.d.ts.map +0 -1
  80. package/dist/dts/components/foundation-alerts/alerts.template.d.ts +0 -10
  81. package/dist/dts/components/foundation-alerts/alerts.template.d.ts.map +0 -1
  82. package/dist/dts/components/foundation-alerts/alerts.types.d.ts +0 -72
  83. package/dist/dts/components/foundation-alerts/alerts.types.d.ts.map +0 -1
  84. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.config.d.ts +0 -9
  85. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.config.d.ts.map +0 -1
  86. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.d.ts +0 -37
  87. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.d.ts.map +0 -1
  88. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.styles.d.ts +0 -2
  89. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.styles.d.ts.map +0 -1
  90. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.template.d.ts +0 -4
  91. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.template.d.ts.map +0 -1
  92. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.types.d.ts +0 -28
  93. package/dist/dts/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.types.d.ts.map +0 -1
  94. package/dist/dts/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.d.ts +0 -30
  95. package/dist/dts/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.d.ts.map +0 -1
  96. package/dist/dts/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.styles.d.ts +0 -2
  97. package/dist/dts/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.styles.d.ts.map +0 -1
  98. package/dist/dts/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.template.d.ts +0 -4
  99. package/dist/dts/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.template.d.ts.map +0 -1
  100. package/dist/dts/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.d.ts +0 -8
  101. package/dist/dts/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.d.ts.map +0 -1
  102. package/dist/dts/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.styles.d.ts +0 -2
  103. package/dist/dts/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.styles.d.ts.map +0 -1
  104. package/dist/dts/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.template.d.ts +0 -4
  105. package/dist/dts/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.template.d.ts.map +0 -1
  106. package/dist/dts/components/foundation-alerts/components/index.d.ts +0 -5
  107. package/dist/dts/components/foundation-alerts/components/index.d.ts.map +0 -1
  108. package/dist/dts/components/foundation-alerts/index.d.ts +0 -2
  109. package/dist/dts/components/foundation-alerts/index.d.ts.map +0 -1
  110. package/dist/dts/components/foundation-alerts/index.federated.d.ts +0 -1
  111. package/dist/dts/components/foundation-alerts/index.federated.d.ts.map +0 -1
  112. package/dist/dts/components/foundation-alerts/styles/index.d.ts +0 -2
  113. package/dist/dts/components/foundation-alerts/styles/index.d.ts.map +0 -1
  114. package/dist/dts/components/foundation-alerts/styles/styles.d.ts +0 -5
  115. package/dist/dts/components/foundation-alerts/styles/styles.d.ts.map +0 -1
  116. package/dist/dts/components/foundation-alerts/utils/getConditionObject.d.ts +0 -8
  117. package/dist/dts/components/foundation-alerts/utils/getConditionObject.d.ts.map +0 -1
  118. package/dist/dts/components/foundation-alerts/utils/getDateMilliseconds.d.ts +0 -2
  119. package/dist/dts/components/foundation-alerts/utils/getDateMilliseconds.d.ts.map +0 -1
  120. package/dist/dts/components/foundation-alerts/utils/getDateStringFormat.d.ts +0 -2
  121. package/dist/dts/components/foundation-alerts/utils/getDateStringFormat.d.ts.map +0 -1
  122. package/dist/dts/components/foundation-alerts/utils/index.d.ts +0 -5
  123. package/dist/dts/components/foundation-alerts/utils/index.d.ts.map +0 -1
  124. package/dist/dts/components/foundation-alerts/utils/logger.d.ts +0 -2
  125. package/dist/dts/components/foundation-alerts/utils/logger.d.ts.map +0 -1
  126. package/dist/dts/components/foundation-inbox/components/foundation-inbox-toast/foundation-inbox-toast.d.ts +0 -10
  127. package/dist/dts/components/foundation-inbox/components/foundation-inbox-toast/foundation-inbox-toast.d.ts.map +0 -1
  128. package/dist/dts/components/foundation-inbox/components/foundation-inbox-toast/foundation-inbox-toast.styles.d.ts +0 -2
  129. package/dist/dts/components/foundation-inbox/components/foundation-inbox-toast/foundation-inbox-toast.styles.d.ts.map +0 -1
  130. package/dist/dts/components/foundation-inbox/inbox.config.d.ts +0 -6
  131. package/dist/dts/components/foundation-inbox/inbox.config.d.ts.map +0 -1
  132. package/dist/dts/components/foundation-inbox/layouts/default.d.ts +0 -3
  133. package/dist/dts/components/foundation-inbox/layouts/default.d.ts.map +0 -1
  134. package/dist/dts/components/foundation-inbox/layouts/index.d.ts +0 -2
  135. package/dist/dts/components/foundation-inbox/layouts/index.d.ts.map +0 -1
  136. package/dist/dts/components/foundation-inbox/services/foundation-inbox.service.d.ts +0 -11
  137. package/dist/dts/components/foundation-inbox/services/foundation-inbox.service.d.ts.map +0 -1
  138. package/dist/dts/components/foundation-inbox/styles/index.d.ts +0 -2
  139. package/dist/dts/components/foundation-inbox/styles/index.d.ts.map +0 -1
  140. package/dist/dts/components/foundation-inbox/styles/styles.d.ts +0 -3
  141. package/dist/dts/components/foundation-inbox/styles/styles.d.ts.map +0 -1
  142. package/dist/dts/components/foundation-inbox/utils/getSeverityByMessageType.d.ts +0 -3
  143. package/dist/dts/components/foundation-inbox/utils/getSeverityByMessageType.d.ts.map +0 -1
  144. package/dist/dts/components/foundation-inbox/utils/index.d.ts +0 -4
  145. package/dist/dts/components/foundation-inbox/utils/index.d.ts.map +0 -1
  146. package/dist/dts/components/foundation-inbox/utils/logger.d.ts +0 -2
  147. package/dist/dts/components/foundation-inbox/utils/logger.d.ts.map +0 -1
  148. package/dist/dts/components/foundation-inbox/utils/transformMessageToNotify.d.ts +0 -3
  149. package/dist/dts/components/foundation-inbox/utils/transformMessageToNotify.d.ts.map +0 -1
  150. package/dist/dts/layouts/default.d.ts +0 -3
  151. package/dist/dts/layouts/default.d.ts.map +0 -1
  152. package/dist/dts/layouts/index.d.ts +0 -2
  153. package/dist/dts/layouts/index.d.ts.map +0 -1
  154. package/dist/dts/styles/index.d.ts +0 -2
  155. package/dist/dts/styles/index.d.ts.map +0 -1
  156. package/dist/dts/styles/styles.d.ts +0 -3
  157. package/dist/dts/styles/styles.d.ts.map +0 -1
  158. package/dist/esm/components/foundation-alerts/alerts.config.js +0 -78
  159. package/dist/esm/components/foundation-alerts/alerts.js +0 -246
  160. package/dist/esm/components/foundation-alerts/alerts.template.js +0 -82
  161. package/dist/esm/components/foundation-alerts/alerts.types.js +0 -18
  162. package/dist/esm/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.config.js +0 -52
  163. package/dist/esm/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.js +0 -182
  164. package/dist/esm/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.styles.js +0 -68
  165. package/dist/esm/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.template.js +0 -135
  166. package/dist/esm/components/foundation-alerts/components/foundation-alerts-condition-builder/foundation-alerts-condition-builder.types.js +0 -1
  167. package/dist/esm/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.js +0 -145
  168. package/dist/esm/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.styles.js +0 -194
  169. package/dist/esm/components/foundation-alerts/components/foundation-alerts-form/foundation-alerts-form.template.js +0 -96
  170. package/dist/esm/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.js +0 -33
  171. package/dist/esm/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.styles.js +0 -27
  172. package/dist/esm/components/foundation-alerts/components/foundation-alerts-navigation-button/foundation-alerts-navigation-button.template.js +0 -14
  173. package/dist/esm/components/foundation-alerts/components/index.js +0 -52
  174. package/dist/esm/components/foundation-alerts/index.federated.js +0 -1
  175. package/dist/esm/components/foundation-alerts/index.js +0 -1
  176. package/dist/esm/components/foundation-alerts/styles/index.js +0 -1
  177. package/dist/esm/components/foundation-alerts/styles/styles.js +0 -198
  178. package/dist/esm/components/foundation-alerts/utils/getConditionObject.js +0 -24
  179. package/dist/esm/components/foundation-alerts/utils/getDateMilliseconds.js +0 -5
  180. package/dist/esm/components/foundation-alerts/utils/getDateStringFormat.js +0 -12
  181. package/dist/esm/components/foundation-alerts/utils/index.js +0 -4
  182. package/dist/esm/components/foundation-alerts/utils/logger.js +0 -2
  183. package/dist/esm/components/foundation-inbox/components/foundation-inbox-toast/foundation-inbox-toast.js +0 -42
  184. package/dist/esm/components/foundation-inbox/components/foundation-inbox-toast/foundation-inbox-toast.styles.js +0 -25
  185. package/dist/esm/components/foundation-inbox/inbox.config.js +0 -27
  186. package/dist/esm/components/foundation-inbox/layouts/default.js +0 -27
  187. package/dist/esm/components/foundation-inbox/layouts/index.js +0 -1
  188. package/dist/esm/components/foundation-inbox/services/foundation-inbox.service.js +0 -109
  189. package/dist/esm/components/foundation-inbox/styles/index.js +0 -1
  190. package/dist/esm/components/foundation-inbox/styles/styles.js +0 -13
  191. package/dist/esm/components/foundation-inbox/utils/getSeverityByMessageType.js +0 -4
  192. package/dist/esm/components/foundation-inbox/utils/index.js +0 -3
  193. package/dist/esm/components/foundation-inbox/utils/logger.js +0 -2
  194. package/dist/esm/components/foundation-inbox/utils/transformMessageToNotify.js +0 -12
  195. package/dist/esm/layouts/default.js +0 -27
  196. package/dist/esm/layouts/index.js +0 -1
  197. package/dist/esm/styles/index.js +0 -1
  198. package/dist/esm/styles/styles.js +0 -13
@@ -1,20 +1,24 @@
1
1
  import { html, repeat, when } from "@microsoft/fast-element";
2
2
  import { PARAM_SOURCE_TYPE_DEFINED_GROUP, PARAM_SOURCE_TYPE_REQ_REP, PARAM_SOURCE_TYPE_USER_TEXT } from "../foundation-notification-dashboard/types/param-source-type";
3
3
  import { PARAM_TYPE_BOOLEAN, PARAM_TYPE_NUMBER, PARAM_TYPE_STRING } from "../foundation-notification-dashboard/types/param-type";
4
- import { RuleStatus } from "./inbox.types";
4
+ import { SEVERITY_CRITICAL, SEVERITY_INFORMATION, SEVERITY_SERIOUS, SEVERITY_WARNING } from "../foundation-notification-dashboard/types/severity";
5
+ import { EXPRESSION_TYPE_PLACEHOLDER } from "../foundation-notification-dashboard/types/expression-type";
6
+ import { chartPinkWebRGBA, primaryBlueWebRGBA, secondaryOrangeWebRGBA, warningYellowWebRGBA } from "@genesislcap/foundation-zero";
5
7
  export const EMPTY_HTML = html ``;
6
- const getFindIndexCondition = (parameters, parameter) => Object.values(parameters)
7
- .findIndex(p => p.PARAM_NAME === parameter.PARAM_NAME) === 0;
8
- export const createSubscribeComponent = (parameters) => html `
8
+ const isFirstElement = (parameters, parameter) => Object.values(parameters).findIndex(p => p.PARAM_NAME === parameter.PARAM_NAME) === 0;
9
+ export const createSubscribeComponent = (parameters, parametersOperatorsMap) => html `
9
10
  ${repeat(x => Object.values(parameters), html `
10
11
  <div class="control">
11
- <label>${x => x.PARAM_LABEL}</label>
12
+ <label>
13
+ <span style="font-weight: bold;">${x => x.PARAM_LABEL} </span>
14
+ <span>${x => humanize(parametersOperatorsMap[x.PARAM_NAME]).toLowerCase()}</span>
15
+ </label>
12
16
 
13
17
  <!-- USER_TEXT -->
14
18
  ${when(x => x.PARAM_SOURCE_TYPE === PARAM_SOURCE_TYPE_USER_TEXT, html `
15
19
  ${when(x => x.PARAM_TYPE === PARAM_TYPE_STRING, html `
16
20
  <zero-text-field
17
- autofocus=${x => getFindIndexCondition(parameters, x)}
21
+ autofocus=${x => isFirstElement(parameters, x)}
18
22
  class="input-field"
19
23
  @input=${(x, c) => c.parent.parameterEdit(x, c.event.target.value)}
20
24
  >
@@ -24,7 +28,7 @@ export const createSubscribeComponent = (parameters) => html `
24
28
  ${when(x => x.PARAM_TYPE === PARAM_TYPE_NUMBER, html `
25
29
  <zero-number-field
26
30
  hide-step
27
- autofocus=${x => getFindIndexCondition(parameters, x)}
31
+ autofocus=${x => isFirstElement(parameters, x)}
28
32
  class="input-field"
29
33
  @input=${(x, c) => c.parent.parameterEdit(x, c.event.target.value)}
30
34
  >
@@ -33,7 +37,7 @@ export const createSubscribeComponent = (parameters) => html `
33
37
 
34
38
  ${when(x => x.PARAM_TYPE === PARAM_TYPE_BOOLEAN, html `
35
39
  <zero-select
36
- autofocus=${x => getFindIndexCondition(parameters, x)}
40
+ autofocus=${x => isFirstElement(parameters, x)}
37
41
  class="input-field"
38
42
  @change=${(x, c) => console.log(x)}
39
43
  >
@@ -46,7 +50,7 @@ export const createSubscribeComponent = (parameters) => html `
46
50
  <!-- DEFINED_GROUP -->
47
51
  ${when(x => x.PARAM_SOURCE_TYPE === PARAM_SOURCE_TYPE_DEFINED_GROUP, html `
48
52
  <zero-select
49
- autofocus=${x => getFindIndexCondition(parameters, x)}
53
+ autofocus=${x => isFirstElement(parameters, x)}
50
54
  class="input-field"
51
55
  position="below"
52
56
  @change=${(x, c) => c.parent.parameterEdit(x, c.event.target.value)}
@@ -60,7 +64,7 @@ export const createSubscribeComponent = (parameters) => html `
60
64
  <!-- TODO: REQ_REP -->
61
65
  ${when(x => x.PARAM_SOURCE_TYPE === PARAM_SOURCE_TYPE_REQ_REP, html `
62
66
  <zero-select
63
- autofocus=${x => getFindIndexCondition(parameters, x)}
67
+ autofocus=${x => isFirstElement(parameters, x)}
64
68
  @change=${(x, c) => console.log(x)}
65
69
  >
66
70
  </zero-select>
@@ -68,32 +72,46 @@ export const createSubscribeComponent = (parameters) => html `
68
72
  </div>
69
73
  `)}
70
74
  `;
71
- export const getStatus = (ruleStatus) => ruleStatus == RuleStatus.ENABLED
75
+ export const humanize = (s) => {
76
+ if (!s) {
77
+ return '';
78
+ }
79
+ let i, frags = s.split('_');
80
+ for (i = 0; i < frags.length; i++) {
81
+ frags[i] = frags[i].charAt(0).toUpperCase() + frags[i].slice(1).toLowerCase();
82
+ }
83
+ return frags.join(' ');
84
+ };
85
+ export const getStatus = (ruleStatus) => ruleStatus == 'ENABLED'
72
86
  ? 'Active'
73
87
  : 'Paused';
74
- export const getIcon = (ruleStatus) => ruleStatus === RuleStatus.ENABLED
88
+ export const getIcon = (ruleStatus) => ruleStatus === 'ENABLED'
75
89
  ? 'pause'
76
90
  : 'play';
77
- export const getFormattedDate = (dateTime) => new Intl.DateTimeFormat('en-UK', {
78
- year: 'numeric',
79
- month: 'numeric',
80
- day: 'numeric',
81
- hour: 'numeric',
82
- minute: 'numeric',
83
- second: 'numeric'
84
- }).format(dateTime);
91
+ export const getFormattedDate = (dateTimeInMills) => {
92
+ const dateTime = new Date(dateTimeInMills);
93
+ return `${dateTime.toLocaleDateString()} ${dateTime.toLocaleTimeString()}`;
94
+ };
85
95
  export function getSeverityColor(severity) {
86
- switch (severity.toLowerCase()) {
87
- case 'information':
88
- return '#01C9FF'; // Blue
89
- case 'warning':
90
- return '#fff989'; // Yellow
91
- case 'serious':
92
- return '#E7700D'; // Orange
93
- case 'critical':
94
- return '#F9644D'; // Red
96
+ switch (severity.toUpperCase()) {
97
+ case SEVERITY_INFORMATION:
98
+ return primaryBlueWebRGBA(1);
99
+ case SEVERITY_CRITICAL:
100
+ return warningYellowWebRGBA(1);
101
+ case SEVERITY_SERIOUS:
102
+ return secondaryOrangeWebRGBA(1);
103
+ case SEVERITY_WARNING:
104
+ return chartPinkWebRGBA(1);
95
105
  default:
96
106
  console.error('Unexpected severity:', severity);
97
107
  return '#FF';
98
108
  }
99
109
  }
110
+ export function createParametersOperatorMap(conditions) {
111
+ return conditions.reduce((acc, condition) => {
112
+ if (condition.RIGHT.TYPE == EXPRESSION_TYPE_PLACEHOLDER) {
113
+ acc[condition.RIGHT.KEY] = condition.OPERATION;
114
+ }
115
+ return acc;
116
+ }, {});
117
+ }
@@ -21,7 +21,6 @@ let ConditionBuilder = class ConditionBuilder extends FASTElement {
21
21
  _super.connectedCallback.call(this);
22
22
  if (this.resource) {
23
23
  this.leftValueItems = yield this.systemService.getFields(this.resource);
24
- // this.leftValue = JSON.stringify(this.leftValueItems[0]);
25
24
  }
26
25
  this.rightValueItems = this.parameters;
27
26
  this.createRightValueItems();
@@ -50,7 +49,6 @@ let ConditionBuilder = class ConditionBuilder extends FASTElement {
50
49
  return __awaiter(this, void 0, void 0, function* () {
51
50
  if (this.resource) {
52
51
  this.leftValueItems = yield this.systemService.getFields(this.resource);
53
- // this.leftValue = JSON.stringify(this.leftValueItems[0]);
54
52
  }
55
53
  });
56
54
  }
@@ -64,7 +62,6 @@ let ConditionBuilder = class ConditionBuilder extends FASTElement {
64
62
  return __awaiter(this, void 0, void 0, function* () {
65
63
  if (this.resource) {
66
64
  this.leftValueItems = yield this.systemService.getFields(this.resource);
67
- // this.leftValue = JSON.stringify(this.leftValueItems[0]);
68
65
  }
69
66
  this.assignLeftValue();
70
67
  this.logicalOperator = this.condition.LOGICAL_OPERATOR;
@@ -22,6 +22,7 @@ export const ParameterBuilderTemplate = html `
22
22
  id="param-source-type"
23
23
  :value=${sync(x => x.sourceType)}
24
24
  class="param-source-type"
25
+ position="below"
25
26
  >
26
27
  ${repeat(x => ALL_PARAM_SOURCE_TYPES, html `
27
28
  <zero-option value=${x => x}>${x => x}</zero-option>
@@ -64,6 +65,7 @@ export const ParameterBuilderTemplate = html `
64
65
  id="param-type"
65
66
  :value=${sync(x => x.type)}
66
67
  class="param-type"
68
+ position="below"
67
69
  >
68
70
  ${repeat(x => ALL_PARAM_TYPES, html `
69
71
  <zero-option value=${x => x}>${x => x}</zero-option>
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
- import { customElement, DOM, FASTElement, observable } from '@microsoft/fast-element';
2
+ import { customElement, FASTElement, observable } from '@microsoft/fast-element';
3
3
  import { SystemService } from '../../../../../services/system.service';
4
4
  import { ConditionBuilderStyles as styles } from './rule-condition-builder.styles';
5
5
  import { ConditionBuilderTemplate as template } from './rule-condition-builder.template';
@@ -8,13 +8,17 @@ const name = 'rule-condition-builder';
8
8
  let RuleConditionBuilder = class RuleConditionBuilder extends FASTElement {
9
9
  constructor() {
10
10
  super(...arguments);
11
- /** Used to pause `Changed` methods while populating with existing data */
11
+ this.rightCriteria = RIGHT_CRITERIA.VALUE;
12
+ // Used to pause `changed` methods while populating with existing data
12
13
  this.formActive = true;
13
14
  }
14
15
  conditionChanged() {
15
16
  return __awaiter(this, void 0, void 0, function* () {
16
17
  this.formActive = false;
17
- yield this.assignLeftValue();
18
+ if (this.resource) {
19
+ this.resourceFields = yield this.systemService.getFields(this.resource);
20
+ }
21
+ this.assignLeftValue();
18
22
  this.logicalOperator = this.condition.LOGICAL_OPERATOR;
19
23
  this.rightCriteria = this.condition.RIGHT_CRITERIA;
20
24
  this.assignRightValue();
@@ -23,8 +27,11 @@ let RuleConditionBuilder = class RuleConditionBuilder extends FASTElement {
23
27
  }
24
28
  assignLeftValue() {
25
29
  return __awaiter(this, void 0, void 0, function* () {
26
- yield DOM.nextUpdate(); // need to wait for the options to be added to the DOM, which should happen before the next DOM update
27
- this.leftValue = this.condition.LEFT_VALUE;
30
+ this.leftValue = this.condition.LEFT_VALUE
31
+ ? typeof this.condition.LEFT_VALUE === 'string'
32
+ ? JSON.stringify(this.resourceFields.find(item => item.FIELD_NAME === this.condition.LEFT_VALUE)) // Edit
33
+ : JSON.stringify(this.condition.LEFT_VALUE)
34
+ : JSON.stringify(this.resourceFields[0]);
28
35
  this.$emit('edit', this.condition);
29
36
  });
30
37
  }
@@ -38,19 +45,19 @@ let RuleConditionBuilder = class RuleConditionBuilder extends FASTElement {
38
45
  this.$emit('edit', this.condition);
39
46
  }
40
47
  leftValueChanged() {
41
- if (this.formActive) {
42
- this.condition.LEFT_VALUE = this.leftValue;
48
+ if (this.condition) {
49
+ this.condition.LEFT_VALUE = JSON.parse(this.leftValue);
43
50
  this.$emit('edit', this.condition);
44
51
  }
45
52
  }
46
53
  logicalOperatorChanged() {
47
- if (this.formActive) {
54
+ if (this.condition) {
48
55
  this.condition.LOGICAL_OPERATOR = this.logicalOperator;
49
56
  this.$emit('edit', this.condition);
50
57
  }
51
58
  }
52
59
  rightCriteriaChanged() {
53
- if (this.formActive) {
60
+ if (this.condition) {
54
61
  this.condition.RIGHT_CRITERIA = this.rightCriteria;
55
62
  if (this.condition.RIGHT_CRITERIA === RIGHT_CRITERIA.VALUE) {
56
63
  this.rightValueText = '';
@@ -62,13 +69,13 @@ let RuleConditionBuilder = class RuleConditionBuilder extends FASTElement {
62
69
  }
63
70
  }
64
71
  rightValueTextChanged() {
65
- if (this.formActive) {
72
+ if (this.condition) {
66
73
  this.condition.RIGHT_VALUE = this.rightValueText;
67
74
  this.$emit('edit', this.condition);
68
75
  }
69
76
  }
70
77
  rightValueUserEntryChanged() {
71
- if (this.formActive) {
78
+ if (this.condition) {
72
79
  this.condition.RIGHT_VALUE = this.rightValueField;
73
80
  this.$emit('edit', this.condition);
74
81
  }
@@ -83,6 +90,9 @@ __decorate([
83
90
  __decorate([
84
91
  observable
85
92
  ], RuleConditionBuilder.prototype, "condition", void 0);
93
+ __decorate([
94
+ observable
95
+ ], RuleConditionBuilder.prototype, "resource", void 0);
86
96
  __decorate([
87
97
  observable
88
98
  ], RuleConditionBuilder.prototype, "resourceFields", void 0);
@@ -12,7 +12,7 @@ export const ConditionBuilderTemplate = html `
12
12
  position="below"
13
13
  >
14
14
  ${repeat(x => x.resourceFields, html `
15
- <zero-option value=${x => x.FIELD_NAME}>${x => x.FIELD_NAME}</zero-option>
15
+ <zero-option value=${x => JSON.stringify(x)}>${x => x.FIELD_NAME}</zero-option>
16
16
  `)}
17
17
  </zero-select>
18
18
 
@@ -41,7 +41,9 @@ export const ConditionBuilderTemplate = html `
41
41
  :value=${sync(x => x.rightValueText)}
42
42
  placeholder="Value"
43
43
  autocomplete="off"
44
- ></zero-text-field>
44
+ >
45
+ </zero-text-field>
46
+
45
47
  <zero-select
46
48
  class="right-criteria-user-entry ${x => classNames(['display-none', x.rightCriteria !== RIGHT_CRITERIA.FIELD])}"
47
49
  :value=${sync(x => x.rightValueField)}
@@ -3,28 +3,29 @@ import { customElement, FASTElement, observable } from '@microsoft/fast-element'
3
3
  import { NotifyService } from '../../../../services/notify.service';
4
4
  import { RuleService } from '../../../../services/rule.service';
5
5
  import { SystemService } from '../../../../services/system.service';
6
- import { EXPRESSION_TYPE_FIELD, EXPRESSION_TYPE_PLACEHOLDER } from '../../types/expression-type';
6
+ import { EXPRESSION_TYPE_PLACEHOLDER } from '../../types/expression-type';
7
7
  import { LOGICAL_OPERATOR_EQUALS } from '../../types/logical-operator';
8
8
  import { RULE_EXECUTION_UNLIMITED } from '../../types/rule-execution-strategy';
9
9
  import { SEVERITY_INFORMATION } from '../../types/severity';
10
- import { UUIDGenerator } from '../template-dialog/template-dialog.utils';
10
+ import { createAssignment, createConditions, getAssignmentValue, UUIDGenerator } from '../template-dialog/template-dialog.utils';
11
11
  import { RIGHT_CRITERIA } from './rule-condition-builder';
12
12
  import { ruleDialogStyles as styles } from './rule-dialog.styles';
13
13
  import { ruleDialogTemplate as template } from './rule-dialog.template';
14
14
  import { RuleDialogMode } from './rule-dialog.types';
15
+ import { showNotification } from '@genesislcap/foundation-notifications';
16
+ import { humanize } from '../../../foundation-inbox/inbox.utils';
15
17
  const name = 'rule-dialog';
16
18
  let RuleDialog = class RuleDialog extends FASTElement {
17
19
  constructor() {
18
20
  super(...arguments);
19
- this.resource = ''; // Tables, Views
21
+ this.resource = ''; // Tables + Views
20
22
  this.topic = '';
21
23
  this.severity = '';
22
24
  this.conditions = [];
23
25
  this.resources = [];
24
- this.isCompleteToSubmit = false;
25
26
  }
26
27
  openDialog(params) {
27
- var _a, _b;
28
+ var _a, _b, _c;
28
29
  return __awaiter(this, void 0, void 0, function* () {
29
30
  this.resources = yield this.systemService.getResources();
30
31
  this.topics = yield this.notifyService.getNotifyRouteTopics();
@@ -46,32 +47,32 @@ let RuleDialog = class RuleDialog extends FASTElement {
46
47
  this.description = rule.RULE_DESCRIPTION;
47
48
  this.resource = rule.RULE_TABLE;
48
49
  this.executionStrategy = rule.RULE_EXECUTION_STRATEGY;
50
+ // Conditions
49
51
  this.conditions = (_a = rule.RULE_EXPRESSION.CONDITIONS) === null || _a === void 0 ? void 0 : _a.map(condition => {
52
+ var _a, _b;
50
53
  return {
51
54
  ID: UUIDGenerator.createUuid(),
52
- LEFT_VALUE: condition.LEFT.TYPE == 'FIELD' ? condition.LEFT.NAME : null,
55
+ LEFT_VALUE: (_a = condition.LEFT.VALUE) !== null && _a !== void 0 ? _a : condition.LEFT.NAME,
53
56
  LOGICAL_OPERATOR: condition.OPERATION,
54
57
  RIGHT_CRITERIA: condition.RIGHT.TYPE === 'FIELD'
55
58
  ? RIGHT_CRITERIA.FIELD
56
59
  : RIGHT_CRITERIA.VALUE,
57
60
  RIGHT_VALUE: condition.RIGHT.TYPE === EXPRESSION_TYPE_PLACEHOLDER
58
61
  ? condition.RIGHT.KEY
59
- : condition.RIGHT.TYPE === EXPRESSION_TYPE_FIELD
60
- ? condition.RIGHT.NAME
61
- : condition.RIGHT.VALUE
62
+ : (_b = condition.RIGHT.VALUE) !== null && _b !== void 0 ? _b : condition.RIGHT.NAME
62
63
  };
63
64
  });
65
+ // Assignments
64
66
  const assignments = (_b = rule.RESULT_EXPRESSION) === null || _b === void 0 ? void 0 : _b.ASSIGNMENTS;
65
67
  if (assignments) {
66
- this.header = this.getAssignmentValue(assignments, 'HEADER');
67
- this.message = this.getAssignmentValue(assignments, 'MESSAGE');
68
- this.severity = this.getAssignmentValue(assignments, 'SEVERITY');
69
- this.topic = this.getAssignmentValue(assignments, 'TOPIC');
70
- this.tableId = this.getAssignmentValue(assignments, 'TABLE_ID');
68
+ this.header = getAssignmentValue(assignments, 'HEADER');
69
+ this.message = getAssignmentValue(assignments, 'BODY');
70
+ this.severity = (_c = getAssignmentValue(assignments, 'NOTIFY_SEVERITY')) === null || _c === void 0 ? void 0 : _c.toUpperCase();
71
+ this.topic = getAssignmentValue(assignments, 'TOPIC');
72
+ this.tableId = getAssignmentValue(assignments, 'TABLE_ENTITY_ID');
71
73
  }
72
74
  break;
73
75
  }
74
- this.verifyChangeComplete();
75
76
  this.dialog.show();
76
77
  });
77
78
  }
@@ -79,20 +80,16 @@ let RuleDialog = class RuleDialog extends FASTElement {
79
80
  return `${this.ruleDialogMode === RuleDialogMode.CREATE ? 'Create' : 'Edit'} Rule`;
80
81
  }
81
82
  submit() {
82
- if (!this.name || !this.description) {
83
- return;
84
- }
85
83
  const rule = Object.assign(Object.assign({}, (this.ruleDialogMode === RuleDialogMode.EDIT && { DYNAMIC_RULE_ID: this.ruleId })), { RULE_NAME: this.name, RULE_DESCRIPTION: this.description, RULE_TABLE: this.resource, RULE_EXECUTION_STRATEGY: this.executionStrategy, RULE_EXPRESSION: {
86
- CONDITIONS: this.transformConditions(this.conditions)
84
+ CONDITIONS: createConditions(this.conditions, null)
87
85
  }, RESULT_EXPRESSION: {
88
86
  ASSIGNMENTS: [
89
- this.createAssignment('TOPIC', this.topic),
90
- this.createAssignment('TABLE_NAME', this.resource),
91
- this.createAssignment('TABLE_ID', this.tableId),
92
- this.createAssignment('HEADER', this.header),
93
- this.createAssignment('MESSAGE', this.message),
94
- this.createAssignment('SEVERITY', this.severity),
95
- this.createAssignment('RULE_NAME', this.name)
87
+ createAssignment('TOPIC', this.topic),
88
+ createAssignment('TABLE_NAME', this.resource),
89
+ createAssignment('TABLE_ENTITY_ID', this.tableId),
90
+ createAssignment('HEADER', this.header),
91
+ createAssignment('BODY', this.message),
92
+ createAssignment('NOTIFY_SEVERITY', humanize(this.severity))
96
93
  ]
97
94
  } });
98
95
  switch (this.ruleDialogMode) {
@@ -109,20 +106,24 @@ let RuleDialog = class RuleDialog extends FASTElement {
109
106
  }
110
107
  }
111
108
  validateResponse(response) {
112
- var _a;
109
+ var _a, _b;
113
110
  if (response.MESSAGE_TYPE === 'EVENT_ACK') {
114
111
  this.close();
115
112
  return;
116
113
  }
117
- if (((_a = response.ERROR[0]) === null || _a === void 0 ? void 0 : _a.CODE) === 'DUPLICATE_KEY') {
118
- return;
119
- }
120
- }
121
- isConditionsValid() {
122
- return false;
114
+ showNotification({
115
+ title: (_a = response.ERROR[0]) === null || _a === void 0 ? void 0 : _a.CODE,
116
+ body: (_b = response.ERROR[0]) === null || _b === void 0 ? void 0 : _b.TEXT,
117
+ config: {
118
+ snackbar: {
119
+ type: 'error',
120
+ },
121
+ },
122
+ }, 'zero');
123
123
  }
124
124
  close() {
125
125
  this.dialog.close();
126
+ this.ruleId = null;
126
127
  this.name = null;
127
128
  this.description = null;
128
129
  this.header = null;
@@ -135,62 +136,26 @@ let RuleDialog = class RuleDialog extends FASTElement {
135
136
  this.severity = null;
136
137
  this.tableId = null;
137
138
  this.conditions = [];
138
- this.isCompleteToSubmit = false;
139
139
  }
140
140
  // #region Condition
141
141
  newCondition() {
142
142
  this.conditions.push(this.createEmptyCondition());
143
- this.verifyChangeComplete();
144
143
  }
145
144
  editCondition(editedCondition) {
146
- this.verifyChangeComplete();
147
145
  }
148
146
  deleteCondition(deletedCondition) {
149
147
  if (this.conditions.length <= 1) {
150
148
  return;
151
149
  }
152
150
  this.conditions = this.conditions.filter(condition => condition !== deletedCondition);
153
- this.verifyChangeComplete();
154
151
  }
155
152
  // #endregion
156
- nameChanged() {
157
- this.verifyChangeComplete();
158
- }
159
153
  resourceChanged() {
160
154
  return __awaiter(this, void 0, void 0, function* () {
161
155
  this.conditions = [this.createEmptyCondition()];
162
156
  this.resourceFields = yield this.systemService.getFields(this.resource);
163
157
  });
164
158
  }
165
- verifyChangeComplete() {
166
- if (!this.name || !this.description) {
167
- this.isCompleteToSubmit = false;
168
- return;
169
- }
170
- if (!this.isConditionsValid()) {
171
- this.isCompleteToSubmit = false;
172
- return;
173
- }
174
- this.isCompleteToSubmit = true;
175
- }
176
- transformConditions(conditions) {
177
- return conditions.map(condition => {
178
- return {
179
- LEFT: {
180
- TYPE: EXPRESSION_TYPE_FIELD,
181
- NAME: condition.LEFT_VALUE
182
- },
183
- OPERATION: condition.LOGICAL_OPERATOR,
184
- RIGHT: condition.RIGHT_CRITERIA === 'VALUE' ? {
185
- TYPE: 'STRING',
186
- VALUE: condition.RIGHT_VALUE,
187
- } : {
188
- TYPE: condition.RIGHT_CRITERIA,
189
- NAME: condition.RIGHT_VALUE,
190
- }
191
- };
192
- });
193
- }
194
159
  createEmptyCondition() {
195
160
  return {
196
161
  ID: null,
@@ -200,29 +165,6 @@ let RuleDialog = class RuleDialog extends FASTElement {
200
165
  RIGHT_VALUE: null,
201
166
  };
202
167
  }
203
- getAssignmentValue(assignments, field) {
204
- const expression = assignments.find(assignment => assignment.FIELD.NAME === field).VALUE;
205
- switch (expression.TYPE) {
206
- case 'FIELD':
207
- return expression.TYPE;
208
- case 'PLACEHOLDER':
209
- return expression.KEY;
210
- default:
211
- return String(expression.VALUE);
212
- }
213
- }
214
- createAssignment(field, value) {
215
- return {
216
- FIELD: {
217
- TYPE: 'FIELD',
218
- NAME: field
219
- },
220
- VALUE: {
221
- TYPE: 'STRING',
222
- VALUE: value
223
- }
224
- };
225
- }
226
168
  };
227
169
  __decorate([
228
170
  RuleService
@@ -275,9 +217,6 @@ __decorate([
275
217
  __decorate([
276
218
  observable
277
219
  ], RuleDialog.prototype, "resources", void 0);
278
- __decorate([
279
- observable
280
- ], RuleDialog.prototype, "isCompleteToSubmit", void 0);
281
220
  RuleDialog = __decorate([
282
221
  customElement({
283
222
  name,
@@ -92,17 +92,17 @@ export const ruleDialogTemplate = html `
92
92
  <div class="content-row condition">
93
93
  ${repeat(x => x.conditions, html `
94
94
  <rule-condition-builder
95
- :resourceFields=${(x, c) => c.parent.resourceFields}
95
+ :resource=${(x, c) => c.parent.resource}
96
96
  :condition=${x => x}
97
97
  @edit=${(x, c) => c.parent.editCondition(eventDetail(c))}
98
98
  @delete=${(x, c) => c.parent.deleteCondition(eventDetail(c))}
99
- ></rule-condition-builder>
99
+ >
100
+ </rule-condition-builder>
100
101
  `)}
101
102
  </div>
102
103
 
103
104
  <div class="content-row">
104
105
  <zero-button
105
- appearance="primary-gradient"
106
106
  @click=${x => x.newCondition()}
107
107
  >
108
108
  <zero-icon name="plus"></zero-icon>Condition
@@ -115,7 +115,6 @@ export const ruleDialogTemplate = html `
115
115
  <div class="template-dialog-footer">
116
116
  <div class="content-row" style="margin-left: auto; margin-bottom: 0px;">
117
117
  <zero-button
118
- appearance="primary-gradient"
119
118
  @click=${x => x.submit()}
120
119
  >
121
120
  Submit