@things-factory/integration-ui 6.1.66 → 6.1.71

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 (113) hide show
  1. package/client/editors/{entity-editor.js → entity-editor.ts} +2 -2
  2. package/client/editors/{entity-selector.js → entity-selector.ts} +45 -57
  3. package/client/editors/{property-editor.js → property-editor.ts} +1 -0
  4. package/client/editors/{things-editor-entity-selector.js → things-editor-entity-selector.ts} +27 -31
  5. package/client/editors/{things-editor-http-body.js → things-editor-http-body.ts} +43 -48
  6. package/client/editors/{things-editor-http-headers.js → things-editor-http-headers.ts} +48 -58
  7. package/client/editors/{things-editor-http-parameters.js → things-editor-http-parameters.ts} +48 -58
  8. package/client/grist/{connection-selector.js → connection-selector.ts} +2 -2
  9. package/client/grist/{connector-selector.js → connector-selector.ts} +2 -2
  10. package/client/grist/{dynamic-selector.js → dynamic-selector.ts} +9 -7
  11. package/client/grist/{task-type-selector.js → task-type-selector.ts} +4 -2
  12. package/client/index.ts +2 -0
  13. package/client/pages/{connection.js → connection.ts} +39 -45
  14. package/client/pages/{integration-monitor.js → integration-monitor.ts} +54 -56
  15. package/client/pages/{scenario-detail.js → scenario-detail.ts} +41 -47
  16. package/client/pages/scenario-importer.ts +107 -0
  17. package/client/pages/{scenario.js → scenario.ts} +15 -21
  18. package/client/viewparts/{connections-monitor.js → connections-monitor.ts} +76 -82
  19. package/client/viewparts/{monitoring-summary.js → monitoring-summary.ts} +55 -61
  20. package/client/viewparts/{pending-q-monitor.js → pending-q-monitor.ts} +110 -114
  21. package/client/viewparts/{scenario-instance-log-view.js → scenario-instance-log-view.ts} +31 -35
  22. package/client/viewparts/{scenario-instance-monitor.js → scenario-instance-monitor.ts} +67 -73
  23. package/client/viewparts/{scenario-instance-view.js → scenario-instance-view.ts} +100 -104
  24. package/client/viewparts/{scenario-monitor.js → scenario-monitor.ts} +143 -149
  25. package/client/viewparts/scenarios-monitor.ts +147 -0
  26. package/dist-client/bootstrap.d.ts +4 -0
  27. package/dist-client/bootstrap.js +29 -0
  28. package/dist-client/bootstrap.js.map +1 -0
  29. package/dist-client/editors/entity-editor.d.ts +10 -0
  30. package/dist-client/editors/entity-editor.js +47 -0
  31. package/dist-client/editors/entity-editor.js.map +1 -0
  32. package/dist-client/editors/entity-selector.d.ts +34 -0
  33. package/dist-client/editors/entity-selector.js +305 -0
  34. package/dist-client/editors/entity-selector.js.map +1 -0
  35. package/dist-client/editors/property-editor.d.ts +20 -0
  36. package/dist-client/editors/property-editor.js +61 -0
  37. package/dist-client/editors/property-editor.js.map +1 -0
  38. package/dist-client/editors/things-editor-entity-selector.d.ts +15 -0
  39. package/dist-client/editors/things-editor-entity-selector.js +87 -0
  40. package/dist-client/editors/things-editor-entity-selector.js.map +1 -0
  41. package/dist-client/editors/things-editor-http-body.d.ts +22 -0
  42. package/dist-client/editors/things-editor-http-body.js +130 -0
  43. package/dist-client/editors/things-editor-http-body.js.map +1 -0
  44. package/dist-client/editors/things-editor-http-headers.d.ts +29 -0
  45. package/dist-client/editors/things-editor-http-headers.js +160 -0
  46. package/dist-client/editors/things-editor-http-headers.js.map +1 -0
  47. package/dist-client/editors/things-editor-http-parameters.d.ts +29 -0
  48. package/dist-client/editors/things-editor-http-parameters.js +160 -0
  49. package/dist-client/editors/things-editor-http-parameters.js.map +1 -0
  50. package/dist-client/grist/connection-selector.d.ts +5 -0
  51. package/dist-client/grist/connection-selector.js +31 -0
  52. package/dist-client/grist/connection-selector.js.map +1 -0
  53. package/dist-client/grist/connector-selector.d.ts +5 -0
  54. package/dist-client/grist/connector-selector.js +31 -0
  55. package/dist-client/grist/connector-selector.js.map +1 -0
  56. package/dist-client/grist/dynamic-selector.d.ts +8 -0
  57. package/dist-client/grist/dynamic-selector.js +33 -0
  58. package/dist-client/grist/dynamic-selector.js.map +1 -0
  59. package/dist-client/grist/task-type-selector.d.ts +7 -0
  60. package/dist-client/grist/task-type-selector.js +58 -0
  61. package/dist-client/grist/task-type-selector.js.map +1 -0
  62. package/dist-client/index.d.ts +2 -0
  63. package/dist-client/index.js +3 -0
  64. package/dist-client/index.js.map +1 -0
  65. package/dist-client/pages/connection.d.ts +53 -0
  66. package/dist-client/pages/connection.js +429 -0
  67. package/dist-client/pages/connection.js.map +1 -0
  68. package/dist-client/pages/integration-monitor.d.ts +28 -0
  69. package/dist-client/pages/integration-monitor.js +340 -0
  70. package/dist-client/pages/integration-monitor.js.map +1 -0
  71. package/dist-client/pages/scenario-detail.d.ts +1 -0
  72. package/dist-client/pages/scenario-detail.js +303 -0
  73. package/dist-client/pages/scenario-detail.js.map +1 -0
  74. package/dist-client/pages/scenario-importer.d.ts +9 -0
  75. package/dist-client/pages/scenario-importer.js +116 -0
  76. package/dist-client/pages/scenario-importer.js.map +1 -0
  77. package/dist-client/pages/scenario.d.ts +68 -0
  78. package/dist-client/pages/scenario.js +582 -0
  79. package/dist-client/pages/scenario.js.map +1 -0
  80. package/dist-client/route.d.ts +1 -0
  81. package/dist-client/route.js +14 -0
  82. package/dist-client/route.js.map +1 -0
  83. package/dist-client/tsconfig.tsbuildinfo +1 -0
  84. package/dist-client/viewparts/connections-monitor.d.ts +10 -0
  85. package/dist-client/viewparts/connections-monitor.js +169 -0
  86. package/dist-client/viewparts/connections-monitor.js.map +1 -0
  87. package/dist-client/viewparts/monitoring-summary.d.ts +12 -0
  88. package/dist-client/viewparts/monitoring-summary.js +135 -0
  89. package/dist-client/viewparts/monitoring-summary.js.map +1 -0
  90. package/dist-client/viewparts/pending-q-monitor.d.ts +17 -0
  91. package/dist-client/viewparts/pending-q-monitor.js +247 -0
  92. package/dist-client/viewparts/pending-q-monitor.js.map +1 -0
  93. package/dist-client/viewparts/scenario-instance-log-view.d.ts +21 -0
  94. package/dist-client/viewparts/scenario-instance-log-view.js +105 -0
  95. package/dist-client/viewparts/scenario-instance-log-view.js.map +1 -0
  96. package/dist-client/viewparts/scenario-instance-monitor.d.ts +15 -0
  97. package/dist-client/viewparts/scenario-instance-monitor.js +171 -0
  98. package/dist-client/viewparts/scenario-instance-monitor.js.map +1 -0
  99. package/dist-client/viewparts/scenario-instance-view.d.ts +29 -0
  100. package/dist-client/viewparts/scenario-instance-view.js +263 -0
  101. package/dist-client/viewparts/scenario-instance-view.js.map +1 -0
  102. package/dist-client/viewparts/scenario-monitor.d.ts +16 -0
  103. package/dist-client/viewparts/scenario-monitor.js +288 -0
  104. package/dist-client/viewparts/scenario-monitor.js.map +1 -0
  105. package/dist-client/viewparts/scenarios-monitor.d.ts +16 -0
  106. package/dist-client/viewparts/scenarios-monitor.js +167 -0
  107. package/dist-client/viewparts/scenarios-monitor.js.map +1 -0
  108. package/package.json +10 -7
  109. package/client/index.js +0 -0
  110. package/client/pages/scenario-importer.js +0 -118
  111. package/client/viewparts/scenarios-monitor.js +0 -153
  112. /package/client/{bootstrap.js → bootstrap.ts} +0 -0
  113. /package/client/{route.js → route.ts} +0 -0
@@ -0,0 +1,167 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist';
3
+ import '@material/mwc-icon-button';
4
+ import './scenario-monitor';
5
+ import { css, html, LitElement } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ import { i18next, localize } from '@operato/i18n';
8
+ import { ScrollbarStyles } from '@operato/styles';
9
+ function IS_SCENARIO_RUNNING(state) {
10
+ return state && state !== 'UNLOADED';
11
+ }
12
+ let ScenariosMonitor = class ScenariosMonitor extends localize(i18next)(LitElement) {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.running = false;
16
+ }
17
+ render() {
18
+ var scenarios = this.scenarios || [];
19
+ const mode = this.mode || 'brief';
20
+ const filter = this.filter || '';
21
+ return html `
22
+ <div info>
23
+ <h2>scenarios</h2>
24
+ <span>
25
+ <input .value=${filter} @change=${e => (this.filter = e.target.value)} placeholder="search" />
26
+ <mwc-icon @click=${e => (this.mode = 'brief')} ?active=${mode == 'brief'}>view_comfy</mwc-icon>
27
+ <mwc-icon @click=${e => (this.mode = 'detail')} ?active=${mode == 'detail'}>dehaze</mwc-icon>
28
+ </span>
29
+ </div>
30
+
31
+ <div content>
32
+ <pending-q-monitor
33
+ .pendings=${this.pendings}
34
+ .colorIndex=${this.colorIndex || {}}
35
+ .running=${this.running}
36
+ ></pending-q-monitor>
37
+
38
+ <div scenarios mode=${mode}>
39
+ <div flowbox>
40
+ ${scenarios
41
+ .filter(scenario => scenario.name.indexOf(filter) == 0)
42
+ .map(scenario => html `<scenario-monitor .scenario=${scenario} mode=${mode}></scenario-monitor>`)}
43
+ </div>
44
+ </div>
45
+ </div>
46
+ `;
47
+ }
48
+ };
49
+ ScenariosMonitor.styles = [
50
+ ScrollbarStyles,
51
+ css `
52
+ :host {
53
+ display: flex;
54
+ flex-direction: column;
55
+
56
+ overflow: hidden;
57
+ }
58
+
59
+ [info] {
60
+ display: flex;
61
+ margin-bottom: var(--margin-default);
62
+ padding: var(--padding-narrow) 0;
63
+ flex-direction: row;
64
+ align-items: center;
65
+ border-bottom: 2px solid var(--secondary-color);
66
+ }
67
+ [info] h2 {
68
+ margin: 0;
69
+ font: var(--subtitle-font);
70
+ color: var(--secondary-color);
71
+ text-transform: capitalize;
72
+ }
73
+
74
+ [info] > span {
75
+ display: flex;
76
+ margin-left: auto;
77
+ }
78
+ [info] input {
79
+ margin: var(--input-margin);
80
+ padding: var(--padding-narrow);
81
+ border: var(--border-dark-color);
82
+ border-radius: var(--border-radius);
83
+ font: var(--input-font);
84
+ }
85
+ [info] mwc-icon {
86
+ margin-left: var(--margin-narrow);
87
+ color: rgba(var(--secondary-color-rgb), 0.6);
88
+ line-height: 34px;
89
+ cursor: pointer;
90
+ }
91
+ [info] mwc-icon[active] {
92
+ color: var(--primary-color);
93
+ }
94
+
95
+ [content] {
96
+ flex: 1;
97
+
98
+ display: flex;
99
+ flex-direction: row;
100
+
101
+ overflow: hidden;
102
+ }
103
+
104
+ pending-q-monitor {
105
+ width: 100px;
106
+ }
107
+
108
+ [scenarios] {
109
+ flex: 1;
110
+
111
+ overflow: auto;
112
+ display: flex;
113
+ flex-direction: column;
114
+ }
115
+
116
+ [scenarios] [flowbox] {
117
+ display: flex;
118
+ flex-direction: column;
119
+ min-height: min-content;
120
+ }
121
+
122
+ [scenarios][mode='brief'] [flowbox] {
123
+ flex-flow: row wrap;
124
+ align-self: start;
125
+ }
126
+
127
+ scenario-monitor {
128
+ flex: none;
129
+ height: fit-content;
130
+ }
131
+
132
+ @media screen and (max-width: 480px) {
133
+ pending-q-monitor {
134
+ width: 80px;
135
+ }
136
+ }
137
+ `
138
+ ];
139
+ __decorate([
140
+ property({ type: Array }),
141
+ __metadata("design:type", Object)
142
+ ], ScenariosMonitor.prototype, "scenarios", void 0);
143
+ __decorate([
144
+ property({ type: String }),
145
+ __metadata("design:type", String)
146
+ ], ScenariosMonitor.prototype, "mode", void 0);
147
+ __decorate([
148
+ property({ type: String }),
149
+ __metadata("design:type", String)
150
+ ], ScenariosMonitor.prototype, "filter", void 0);
151
+ __decorate([
152
+ property({ type: Array }),
153
+ __metadata("design:type", Object)
154
+ ], ScenariosMonitor.prototype, "pendings", void 0);
155
+ __decorate([
156
+ property({ type: Object }),
157
+ __metadata("design:type", Object)
158
+ ], ScenariosMonitor.prototype, "colorIndex", void 0);
159
+ __decorate([
160
+ property({ type: Boolean }),
161
+ __metadata("design:type", Boolean)
162
+ ], ScenariosMonitor.prototype, "running", void 0);
163
+ ScenariosMonitor = __decorate([
164
+ customElement('scenarios-monitor')
165
+ ], ScenariosMonitor);
166
+ export { ScenariosMonitor };
167
+ //# sourceMappingURL=scenarios-monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarios-monitor.js","sourceRoot":"","sources":["../../client/viewparts/scenarios-monitor.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,2BAA2B,CAAA;AAClC,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,SAAS,mBAAmB,CAAC,KAAK;IAChC,OAAO,KAAK,IAAI,KAAK,KAAK,UAAU,CAAA;AACtC,CAAC;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA5D;;QAiGwB,YAAO,GAAY,KAAK,CAAA;IAkCvD,CAAC;IAhCC,MAAM;QACJ,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAA;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAA;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAEhC,OAAO,IAAI,CAAA;;;;0BAIW,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;6BAClD,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,IAAI,IAAI,OAAO;6BACrD,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,YAAY,IAAI,IAAI,QAAQ;;;;;;sBAM9D,IAAI,CAAC,QAAQ;wBACX,IAAI,CAAC,UAAU,IAAI,EAAE;qBACxB,IAAI,CAAC,OAAO;;;8BAGH,IAAI;;cAEpB,SAAS;aACR,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aACtD,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAA,+BAA+B,QAAQ,SAAS,IAAI,sBAAsB,CAAC;;;;KAIzG,CAAA;IACH,CAAC;;AAjIM,uBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsFF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mDAAe;AACzC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAc;AACzC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAgB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;kDAAc;AACxC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAgB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;iDAAyB;AAjG1C,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmI5B;SAnIY,gBAAgB","sourcesContent":["import '@operato/data-grist'\nimport '@material/mwc-icon-button'\nimport './scenario-monitor'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\nfunction IS_SCENARIO_RUNNING(state) {\n return state && state !== 'UNLOADED'\n}\n\n@customElement('scenarios-monitor')\nexport class ScenariosMonitor extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n [info] {\n display: flex;\n margin-bottom: var(--margin-default);\n padding: var(--padding-narrow) 0;\n flex-direction: row;\n align-items: center;\n border-bottom: 2px solid var(--secondary-color);\n }\n [info] h2 {\n margin: 0;\n font: var(--subtitle-font);\n color: var(--secondary-color);\n text-transform: capitalize;\n }\n\n [info] > span {\n display: flex;\n margin-left: auto;\n }\n [info] input {\n margin: var(--input-margin);\n padding: var(--padding-narrow);\n border: var(--border-dark-color);\n border-radius: var(--border-radius);\n font: var(--input-font);\n }\n [info] mwc-icon {\n margin-left: var(--margin-narrow);\n color: rgba(var(--secondary-color-rgb), 0.6);\n line-height: 34px;\n cursor: pointer;\n }\n [info] mwc-icon[active] {\n color: var(--primary-color);\n }\n\n [content] {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n\n overflow: hidden;\n }\n\n pending-q-monitor {\n width: 100px;\n }\n\n [scenarios] {\n flex: 1;\n\n overflow: auto;\n display: flex;\n flex-direction: column;\n }\n\n [scenarios] [flowbox] {\n display: flex;\n flex-direction: column;\n min-height: min-content;\n }\n\n [scenarios][mode='brief'] [flowbox] {\n flex-flow: row wrap;\n align-self: start;\n }\n\n scenario-monitor {\n flex: none;\n height: fit-content;\n }\n\n @media screen and (max-width: 480px) {\n pending-q-monitor {\n width: 80px;\n }\n }\n `\n ]\n\n @property({ type: Array }) scenarios: any\n @property({ type: String }) mode?: string\n @property({ type: String }) filter?: string\n @property({ type: Array }) pendings: any\n @property({ type: Object }) colorIndex: any\n @property({ type: Boolean }) running: boolean = false\n\n render() {\n var scenarios = this.scenarios || []\n const mode = this.mode || 'brief'\n const filter = this.filter || ''\n\n return html`\n <div info>\n <h2>scenarios</h2>\n <span>\n <input .value=${filter} @change=${e => (this.filter = e.target.value)} placeholder=\"search\" />\n <mwc-icon @click=${e => (this.mode = 'brief')} ?active=${mode == 'brief'}>view_comfy</mwc-icon>\n <mwc-icon @click=${e => (this.mode = 'detail')} ?active=${mode == 'detail'}>dehaze</mwc-icon>\n </span>\n </div>\n\n <div content>\n <pending-q-monitor\n .pendings=${this.pendings}\n .colorIndex=${this.colorIndex || {}}\n .running=${this.running}\n ></pending-q-monitor>\n\n <div scenarios mode=${mode}>\n <div flowbox>\n ${scenarios\n .filter(scenario => scenario.name.indexOf(filter) == 0)\n .map(scenario => html`<scenario-monitor .scenario=${scenario} mode=${mode}></scenario-monitor>`)}\n </div>\n </div>\n </div>\n `\n }\n}\n"]}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@things-factory/integration-ui",
3
- "version": "6.1.66",
3
+ "version": "6.1.71",
4
4
  "main": "dist-server/index.js",
5
- "browser": "client/index.js",
5
+ "browser": "dist-client/index.js",
6
6
  "things-factory": true,
7
7
  "author": "heartyoh <heartyoh@hatiolab.com>",
8
8
  "description": "User interface to manage integration scenario.",
@@ -17,10 +17,13 @@
17
17
  "directory": "packages/integration-ui"
18
18
  },
19
19
  "scripts": {
20
- "build": "tsc --p tsconfig.json",
21
- "build:server": "npm run clean:server && tsc",
22
- "clean:server": "rm -rf dist-server",
23
- "clean": "npm run clean:server",
20
+ "build": "npm run build:server && npm run build:client",
21
+ "copy:files": "copyfiles -e \"./client/**/*.{ts,js,json}\" -u 1 \"./client/**/*\" dist-client",
22
+ "build:client": "npm run copy:files && npx tsc --p ./client/tsconfig.json",
23
+ "build:server": "npx tsc --p ./server/tsconfig.json",
24
+ "clean:client": "npx rimraf dist-client",
25
+ "clean:server": "npx rimraf dist-server",
26
+ "clean": "npm run clean:server && npm run clean:client",
24
27
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
28
  },
26
29
  "dependencies": {
@@ -39,5 +42,5 @@
39
42
  "@things-factory/integration-base": "^6.1.66",
40
43
  "moment-timezone": "^0.5.40"
41
44
  },
42
- "gitHead": "86447edc189a8432999c6dcfce0e32ee7dbd3e5f"
45
+ "gitHead": "468074de192c57950fc398df7c0eab3deeb2b7c6"
43
46
  }
package/client/index.js DELETED
File without changes
@@ -1,118 +0,0 @@
1
- import '@operato/data-grist'
2
-
3
- import gql from 'graphql-tag'
4
- import { css, html, LitElement } from 'lit'
5
-
6
- import { client } from '@operato/graphql'
7
- import { i18next } from '@operato/i18n'
8
- import { isMobileDevice } from '@operato/utils'
9
-
10
- export class ScenarioImporter extends LitElement {
11
- static get properties() {
12
- return {
13
- columns: Object,
14
- scenarios: Array
15
- }
16
- }
17
-
18
- constructor() {
19
- super()
20
- this.columns = {
21
- list: { fields: ['name', 'description'] },
22
- pagination: { infinite: true },
23
- columns: [
24
- {
25
- type: 'string',
26
- name: 'name',
27
- header: i18next.t('field.name'),
28
- width: 150
29
- },
30
- {
31
- type: 'string',
32
- name: 'type',
33
- header: i18next.t('field.type'),
34
- width: 100
35
- },
36
- {
37
- type: 'string',
38
- name: 'description',
39
- header: i18next.t('field.description'),
40
- width: 200
41
- },
42
- {
43
- type: 'crontab',
44
- name: 'schedule',
45
- header: i18next.t('field.schedule'),
46
- width: 80
47
- },
48
- {
49
- type: 'string',
50
- name: 'timezone',
51
- header: i18next.t('field.timezone'),
52
- width: 120
53
- },
54
- {
55
- type: 'checkbox',
56
- name: 'active',
57
- header: i18next.t('field.active'),
58
- width: 60
59
- }
60
- ]
61
- }
62
- }
63
-
64
- static get styles() {
65
- return [
66
- css`
67
- :host {
68
- display: flex;
69
- flex-direction: column;
70
-
71
- background-color: #fff;
72
- }
73
- ox-grist {
74
- flex: 1;
75
- }
76
- .button-container {
77
- display: flex;
78
- margin-left: auto;
79
- padding: var(--padding-default);
80
- }
81
- mwc-button {
82
- margin-left: var(--margin-default);
83
- }
84
- `
85
- ]
86
- }
87
-
88
- render() {
89
- return html`
90
- <ox-grist
91
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
92
- .config=${this.columns}
93
- .data="${{ records: this.scenarios }}"
94
- ></ox-grist>
95
-
96
- <div class="button-container">
97
- <mwc-button raised @click="${this.save.bind(this)}">${i18next.t('button.save')}</mwc-button>
98
- </div>
99
- `
100
- }
101
-
102
- async save() {
103
- const response = await client.mutate({
104
- mutation: gql`
105
- mutation importScenarios($scenarios: [ScenarioPatch!]!) {
106
- importScenarios(scenarios: $scenarios)
107
- }
108
- `,
109
- variables: { scenarios: this.scenarios }
110
- })
111
-
112
- if (response.errors?.length) return
113
-
114
- this.dispatchEvent(new CustomEvent('imported'))
115
- }
116
- }
117
-
118
- customElements.define('scenario-importer', ScenarioImporter)
@@ -1,153 +0,0 @@
1
- import '@operato/data-grist'
2
- import '@material/mwc-icon-button'
3
- import './scenario-monitor'
4
-
5
- import { css, html, LitElement } from 'lit'
6
-
7
- import { i18next, localize } from '@operato/i18n'
8
- import { ScrollbarStyles } from '@operato/styles'
9
-
10
- function IS_SCENARIO_RUNNING(state) {
11
- return state && state !== 'UNLOADED'
12
- }
13
-
14
- export class ScenariosMonitor extends localize(i18next)(LitElement) {
15
- static get properties() {
16
- return {
17
- scenarios: Array,
18
- mode: String,
19
- filter: String,
20
- pendings: Array,
21
- colorIndex: Object,
22
- running: Boolean
23
- }
24
- }
25
-
26
- static get styles() {
27
- return [
28
- ScrollbarStyles,
29
- css`
30
- :host {
31
- display: flex;
32
- flex-direction: column;
33
-
34
- overflow: hidden;
35
- }
36
-
37
- [info] {
38
- display: flex;
39
- margin-bottom: var(--margin-default);
40
- padding: var(--padding-narrow) 0;
41
- flex-direction: row;
42
- align-items: center;
43
- border-bottom: 2px solid var(--secondary-color);
44
- }
45
- [info] h2 {
46
- margin: 0;
47
- font: var(--subtitle-font);
48
- color: var(--secondary-color);
49
- text-transform: capitalize;
50
- }
51
-
52
- [info] > span {
53
- display: flex;
54
- margin-left: auto;
55
- }
56
- [info] input {
57
- margin: var(--input-margin);
58
- padding: var(--padding-narrow);
59
- border: var(--border-dark-color);
60
- border-radius: var(--border-radius);
61
- font: var(--input-font);
62
- }
63
- [info] mwc-icon {
64
- margin-left: var(--margin-narrow);
65
- color: rgba(var(--secondary-color-rgb), 0.6);
66
- line-height: 34px;
67
- cursor: pointer;
68
- }
69
- [info] mwc-icon[active] {
70
- color: var(--primary-color);
71
- }
72
-
73
- [content] {
74
- flex: 1;
75
-
76
- display: flex;
77
- flex-direction: row;
78
-
79
- overflow: hidden;
80
- }
81
-
82
- pending-q-monitor {
83
- width: 100px;
84
- }
85
-
86
- [scenarios] {
87
- flex: 1;
88
-
89
- overflow: auto;
90
- display: flex;
91
- flex-direction: column;
92
- }
93
-
94
- [scenarios] [flowbox] {
95
- display: flex;
96
- flex-direction: column;
97
- min-height: min-content;
98
- }
99
-
100
- [scenarios][mode='brief'] [flowbox] {
101
- flex-flow: row wrap;
102
- align-self: start;
103
- }
104
-
105
- scenario-monitor {
106
- flex: none;
107
- height: fit-content;
108
- }
109
-
110
- @media screen and (max-width: 480px) {
111
- pending-q-monitor {
112
- width: 80px;
113
- }
114
- }
115
- `
116
- ]
117
- }
118
-
119
- render() {
120
- var scenarios = this.scenarios || []
121
- const mode = this.mode || 'brief'
122
- const filter = this.filter || ''
123
-
124
- return html`
125
- <div info>
126
- <h2>scenarios</h2>
127
- <span>
128
- <input .value=${filter} @change=${e => (this.filter = e.target.value)} placeholder="search" />
129
- <mwc-icon @click=${e => (this.mode = 'brief')} ?active=${mode == 'brief'}>view_comfy</mwc-icon>
130
- <mwc-icon @click=${e => (this.mode = 'detail')} ?active=${mode == 'detail'}>dehaze</mwc-icon>
131
- </span>
132
- </div>
133
-
134
- <div content>
135
- <pending-q-monitor
136
- .pendings=${this.pendings}
137
- .colorIndex=${this.colorIndex || {}}
138
- .running=${this.running}
139
- ></pending-q-monitor>
140
-
141
- <div scenarios mode=${mode}>
142
- <div flowbox>
143
- ${scenarios
144
- .filter(scenario => scenario.name.indexOf(filter) == 0)
145
- .map(scenario => html`<scenario-monitor .scenario=${scenario} mode=${mode}></scenario-monitor>`)}
146
- </div>
147
- </div>
148
- </div>
149
- `
150
- }
151
- }
152
-
153
- window.customElements.define('scenarios-monitor', ScenariosMonitor)
File without changes
File without changes