@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.
- package/client/editors/{entity-editor.js → entity-editor.ts} +2 -2
- package/client/editors/{entity-selector.js → entity-selector.ts} +45 -57
- package/client/editors/{property-editor.js → property-editor.ts} +1 -0
- package/client/editors/{things-editor-entity-selector.js → things-editor-entity-selector.ts} +27 -31
- package/client/editors/{things-editor-http-body.js → things-editor-http-body.ts} +43 -48
- package/client/editors/{things-editor-http-headers.js → things-editor-http-headers.ts} +48 -58
- package/client/editors/{things-editor-http-parameters.js → things-editor-http-parameters.ts} +48 -58
- package/client/grist/{connection-selector.js → connection-selector.ts} +2 -2
- package/client/grist/{connector-selector.js → connector-selector.ts} +2 -2
- package/client/grist/{dynamic-selector.js → dynamic-selector.ts} +9 -7
- package/client/grist/{task-type-selector.js → task-type-selector.ts} +4 -2
- package/client/index.ts +2 -0
- package/client/pages/{connection.js → connection.ts} +39 -45
- package/client/pages/{integration-monitor.js → integration-monitor.ts} +54 -56
- package/client/pages/{scenario-detail.js → scenario-detail.ts} +41 -47
- package/client/pages/scenario-importer.ts +107 -0
- package/client/pages/{scenario.js → scenario.ts} +15 -21
- package/client/viewparts/{connections-monitor.js → connections-monitor.ts} +76 -82
- package/client/viewparts/{monitoring-summary.js → monitoring-summary.ts} +55 -61
- package/client/viewparts/{pending-q-monitor.js → pending-q-monitor.ts} +110 -114
- package/client/viewparts/{scenario-instance-log-view.js → scenario-instance-log-view.ts} +31 -35
- package/client/viewparts/{scenario-instance-monitor.js → scenario-instance-monitor.ts} +67 -73
- package/client/viewparts/{scenario-instance-view.js → scenario-instance-view.ts} +100 -104
- package/client/viewparts/{scenario-monitor.js → scenario-monitor.ts} +143 -149
- package/client/viewparts/scenarios-monitor.ts +147 -0
- package/dist-client/bootstrap.d.ts +4 -0
- package/dist-client/bootstrap.js +29 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/editors/entity-editor.d.ts +10 -0
- package/dist-client/editors/entity-editor.js +47 -0
- package/dist-client/editors/entity-editor.js.map +1 -0
- package/dist-client/editors/entity-selector.d.ts +34 -0
- package/dist-client/editors/entity-selector.js +305 -0
- package/dist-client/editors/entity-selector.js.map +1 -0
- package/dist-client/editors/property-editor.d.ts +20 -0
- package/dist-client/editors/property-editor.js +61 -0
- package/dist-client/editors/property-editor.js.map +1 -0
- package/dist-client/editors/things-editor-entity-selector.d.ts +15 -0
- package/dist-client/editors/things-editor-entity-selector.js +87 -0
- package/dist-client/editors/things-editor-entity-selector.js.map +1 -0
- package/dist-client/editors/things-editor-http-body.d.ts +22 -0
- package/dist-client/editors/things-editor-http-body.js +130 -0
- package/dist-client/editors/things-editor-http-body.js.map +1 -0
- package/dist-client/editors/things-editor-http-headers.d.ts +29 -0
- package/dist-client/editors/things-editor-http-headers.js +160 -0
- package/dist-client/editors/things-editor-http-headers.js.map +1 -0
- package/dist-client/editors/things-editor-http-parameters.d.ts +29 -0
- package/dist-client/editors/things-editor-http-parameters.js +160 -0
- package/dist-client/editors/things-editor-http-parameters.js.map +1 -0
- package/dist-client/grist/connection-selector.d.ts +5 -0
- package/dist-client/grist/connection-selector.js +31 -0
- package/dist-client/grist/connection-selector.js.map +1 -0
- package/dist-client/grist/connector-selector.d.ts +5 -0
- package/dist-client/grist/connector-selector.js +31 -0
- package/dist-client/grist/connector-selector.js.map +1 -0
- package/dist-client/grist/dynamic-selector.d.ts +8 -0
- package/dist-client/grist/dynamic-selector.js +33 -0
- package/dist-client/grist/dynamic-selector.js.map +1 -0
- package/dist-client/grist/task-type-selector.d.ts +7 -0
- package/dist-client/grist/task-type-selector.js +58 -0
- package/dist-client/grist/task-type-selector.js.map +1 -0
- package/dist-client/index.d.ts +2 -0
- package/dist-client/index.js +3 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/connection.d.ts +53 -0
- package/dist-client/pages/connection.js +429 -0
- package/dist-client/pages/connection.js.map +1 -0
- package/dist-client/pages/integration-monitor.d.ts +28 -0
- package/dist-client/pages/integration-monitor.js +340 -0
- package/dist-client/pages/integration-monitor.js.map +1 -0
- package/dist-client/pages/scenario-detail.d.ts +1 -0
- package/dist-client/pages/scenario-detail.js +303 -0
- package/dist-client/pages/scenario-detail.js.map +1 -0
- package/dist-client/pages/scenario-importer.d.ts +9 -0
- package/dist-client/pages/scenario-importer.js +116 -0
- package/dist-client/pages/scenario-importer.js.map +1 -0
- package/dist-client/pages/scenario.d.ts +68 -0
- package/dist-client/pages/scenario.js +582 -0
- package/dist-client/pages/scenario.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +14 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/connections-monitor.d.ts +10 -0
- package/dist-client/viewparts/connections-monitor.js +169 -0
- package/dist-client/viewparts/connections-monitor.js.map +1 -0
- package/dist-client/viewparts/monitoring-summary.d.ts +12 -0
- package/dist-client/viewparts/monitoring-summary.js +135 -0
- package/dist-client/viewparts/monitoring-summary.js.map +1 -0
- package/dist-client/viewparts/pending-q-monitor.d.ts +17 -0
- package/dist-client/viewparts/pending-q-monitor.js +247 -0
- package/dist-client/viewparts/pending-q-monitor.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-log-view.d.ts +21 -0
- package/dist-client/viewparts/scenario-instance-log-view.js +105 -0
- package/dist-client/viewparts/scenario-instance-log-view.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-monitor.d.ts +15 -0
- package/dist-client/viewparts/scenario-instance-monitor.js +171 -0
- package/dist-client/viewparts/scenario-instance-monitor.js.map +1 -0
- package/dist-client/viewparts/scenario-instance-view.d.ts +29 -0
- package/dist-client/viewparts/scenario-instance-view.js +263 -0
- package/dist-client/viewparts/scenario-instance-view.js.map +1 -0
- package/dist-client/viewparts/scenario-monitor.d.ts +16 -0
- package/dist-client/viewparts/scenario-monitor.js +288 -0
- package/dist-client/viewparts/scenario-monitor.js.map +1 -0
- package/dist-client/viewparts/scenarios-monitor.d.ts +16 -0
- package/dist-client/viewparts/scenarios-monitor.js +167 -0
- package/dist-client/viewparts/scenarios-monitor.js.map +1 -0
- package/package.json +10 -7
- package/client/index.js +0 -0
- package/client/pages/scenario-importer.js +0 -118
- package/client/viewparts/scenarios-monitor.js +0 -153
- /package/client/{bootstrap.js → bootstrap.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '../viewparts/monitoring-summary';
|
|
3
|
+
import '../viewparts/pending-q-monitor';
|
|
4
|
+
import '../viewparts/scenarios-monitor';
|
|
5
|
+
import '../viewparts/connections-monitor';
|
|
6
|
+
import gql from 'graphql-tag';
|
|
7
|
+
import { css, html } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { client, subscribe } from '@operato/graphql';
|
|
10
|
+
import { i18next, localize } from '@operato/i18n';
|
|
11
|
+
import { PageView } from '@operato/shell';
|
|
12
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
13
|
+
function IS_SCENARIO_RUNNING(state) {
|
|
14
|
+
return state && state !== 'UNLOADED';
|
|
15
|
+
}
|
|
16
|
+
function toColor(string) {
|
|
17
|
+
var hash = 0;
|
|
18
|
+
if (string.length === 0)
|
|
19
|
+
return hash;
|
|
20
|
+
for (var i = 0; i < string.length; i++) {
|
|
21
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
22
|
+
hash = hash & hash;
|
|
23
|
+
}
|
|
24
|
+
var color = '#';
|
|
25
|
+
for (var i = 0; i < 3; i++) {
|
|
26
|
+
var value = (hash >> (i * 8)) & 255;
|
|
27
|
+
color += ('00' + value.toString(16)).substr(-2);
|
|
28
|
+
}
|
|
29
|
+
return color;
|
|
30
|
+
}
|
|
31
|
+
let IntegrationMonitor = class IntegrationMonitor extends localize(i18next)(PageView) {
|
|
32
|
+
get context() {
|
|
33
|
+
return {
|
|
34
|
+
title: i18next.t('text.integration monitor'),
|
|
35
|
+
help: 'integration/ui/integration-monitor'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return html `
|
|
40
|
+
<integration-summary
|
|
41
|
+
.pendings=${this.pendings}
|
|
42
|
+
.scenarios=${this.scenarios}
|
|
43
|
+
.connections=${this.connections}
|
|
44
|
+
></integration-summary>
|
|
45
|
+
<content>
|
|
46
|
+
<scenarios-monitor
|
|
47
|
+
.scenarios=${this.scenarios}
|
|
48
|
+
.pendings=${this.pendings}
|
|
49
|
+
.colorIndex=${this.colorIndex || {}}
|
|
50
|
+
.running=${!!this.active}
|
|
51
|
+
></scenarios-monitor>
|
|
52
|
+
<connections-monitor .connections=${this.connections}></connections-monitor>
|
|
53
|
+
</content>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
async pageUpdated(changes) {
|
|
57
|
+
if ('active' in changes) {
|
|
58
|
+
if (this.active) {
|
|
59
|
+
await this.fetchScenarios();
|
|
60
|
+
await this.fetchConnections();
|
|
61
|
+
await this.startSubscribe();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
await this.stopSubscribe();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async fetchScenarios() {
|
|
69
|
+
const response = await client.query({
|
|
70
|
+
query: gql `
|
|
71
|
+
query {
|
|
72
|
+
responses: scenarios {
|
|
73
|
+
items {
|
|
74
|
+
id
|
|
75
|
+
name
|
|
76
|
+
description
|
|
77
|
+
active
|
|
78
|
+
state
|
|
79
|
+
schedule
|
|
80
|
+
timezone
|
|
81
|
+
instances {
|
|
82
|
+
instanceName
|
|
83
|
+
scenarioName
|
|
84
|
+
state
|
|
85
|
+
progress {
|
|
86
|
+
rate
|
|
87
|
+
steps
|
|
88
|
+
step
|
|
89
|
+
rounds
|
|
90
|
+
}
|
|
91
|
+
variables
|
|
92
|
+
data
|
|
93
|
+
message
|
|
94
|
+
}
|
|
95
|
+
updater {
|
|
96
|
+
id
|
|
97
|
+
name
|
|
98
|
+
}
|
|
99
|
+
updatedAt
|
|
100
|
+
}
|
|
101
|
+
total
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
});
|
|
106
|
+
var colorIndex = {};
|
|
107
|
+
this.scenarios = (response.data.responses.items || []).map(scenario => {
|
|
108
|
+
var color = toColor(scenario.id);
|
|
109
|
+
colorIndex[scenario.id] = color;
|
|
110
|
+
return Object.assign(Object.assign({}, scenario), { color });
|
|
111
|
+
});
|
|
112
|
+
this.colorIndex = colorIndex;
|
|
113
|
+
}
|
|
114
|
+
async fetchConnections() {
|
|
115
|
+
const response = await client.query({
|
|
116
|
+
query: gql `
|
|
117
|
+
query {
|
|
118
|
+
responses: connections {
|
|
119
|
+
items {
|
|
120
|
+
id
|
|
121
|
+
name
|
|
122
|
+
description
|
|
123
|
+
type
|
|
124
|
+
state
|
|
125
|
+
}
|
|
126
|
+
total
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
});
|
|
131
|
+
this.connections = response.data.responses.items || [];
|
|
132
|
+
// .map(connection => {
|
|
133
|
+
// var color = toColor(scenario.id)
|
|
134
|
+
// colorIndex[scenario.id] = color
|
|
135
|
+
// return {
|
|
136
|
+
// ...scenario,
|
|
137
|
+
// color
|
|
138
|
+
// }
|
|
139
|
+
// })
|
|
140
|
+
// this.colorIndex = colorIndex
|
|
141
|
+
}
|
|
142
|
+
async startSubscribe() {
|
|
143
|
+
if (this.scenarioInstanceStateSubscription) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.scenarioInstanceStateSubscription = await subscribe({
|
|
147
|
+
query: gql `
|
|
148
|
+
subscription {
|
|
149
|
+
scenarioInstanceState {
|
|
150
|
+
instanceName
|
|
151
|
+
scenarioName
|
|
152
|
+
state
|
|
153
|
+
progress {
|
|
154
|
+
rate
|
|
155
|
+
steps
|
|
156
|
+
step
|
|
157
|
+
rounds
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
`
|
|
162
|
+
}, {
|
|
163
|
+
next: async ({ data }) => {
|
|
164
|
+
if (data) {
|
|
165
|
+
var { scenarioName, instanceName, state } = data.scenarioInstanceState;
|
|
166
|
+
this.scenarios = this.scenarios || [];
|
|
167
|
+
var scenario = this.scenarios.find(scenario => scenario.name === scenarioName);
|
|
168
|
+
if (scenario) {
|
|
169
|
+
var idx = scenario.instances.findIndex(instance => instance.instanceName === instanceName);
|
|
170
|
+
if (idx == -1) {
|
|
171
|
+
if (IS_SCENARIO_RUNNING(state)) {
|
|
172
|
+
scenario.instances.push(data.scenarioInstanceState);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
if (!IS_SCENARIO_RUNNING(state)) {
|
|
177
|
+
scenario.instances.splice(idx, 1);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
scenario.instances.splice(idx, 1, data.scenarioInstanceState);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
this.scenarios = [];
|
|
186
|
+
await this.stopSubscribe();
|
|
187
|
+
await this.fetchScenarios();
|
|
188
|
+
await this.startSubscribe();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
/* change object intentionally to force to refresh scenario */
|
|
192
|
+
this.scenarios.splice(this.scenarios.indexOf(scenario), 1, Object.assign({}, scenario));
|
|
193
|
+
this.scenarios = [...this.scenarios];
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
start: subscription => {
|
|
197
|
+
console.log(subscription);
|
|
198
|
+
},
|
|
199
|
+
error: error => {
|
|
200
|
+
console.log(error);
|
|
201
|
+
},
|
|
202
|
+
complete: () => {
|
|
203
|
+
console.log('complete');
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
this.scenarioQueueStateSubscription = await subscribe({
|
|
207
|
+
query: gql `
|
|
208
|
+
subscription {
|
|
209
|
+
scenarioQueueState {
|
|
210
|
+
queue {
|
|
211
|
+
stuff
|
|
212
|
+
due
|
|
213
|
+
priority
|
|
214
|
+
tag
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
`
|
|
219
|
+
}, {
|
|
220
|
+
next: ({ data }) => {
|
|
221
|
+
if (data) {
|
|
222
|
+
this.pendings = data.scenarioQueueState.queue;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
this.connectionStateSubscription = await subscribe({
|
|
227
|
+
query: gql `
|
|
228
|
+
subscription {
|
|
229
|
+
connectionState {
|
|
230
|
+
id
|
|
231
|
+
name
|
|
232
|
+
description
|
|
233
|
+
type
|
|
234
|
+
state
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
`
|
|
238
|
+
}, {
|
|
239
|
+
next: async ({ data }) => {
|
|
240
|
+
if (data) {
|
|
241
|
+
var state = data.connectionState;
|
|
242
|
+
this.connections = this.connections || [];
|
|
243
|
+
var idx = this.connections.findIndex(connection => connection.id === state.id);
|
|
244
|
+
if (idx !== -1) {
|
|
245
|
+
this.connections[idx] = data.connectionState;
|
|
246
|
+
this.connections = [...this.connections];
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this.connections = [...this.connections, data.connectionState];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async stopSubscribe() {
|
|
256
|
+
var _a, _b, _c;
|
|
257
|
+
await ((_a = this.scenarioInstanceStateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe());
|
|
258
|
+
await ((_b = this.scenarioQueueStateSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe());
|
|
259
|
+
await ((_c = this.connectionStateSubscription) === null || _c === void 0 ? void 0 : _c.unsubscribe());
|
|
260
|
+
delete this.scenarioInstanceStateSubscription;
|
|
261
|
+
delete this.scenarioQueueStateSubscription;
|
|
262
|
+
delete this.connectionStateSubscription;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
IntegrationMonitor.ScenarioInstanceStatus = ['READY', 'STARTED', 'STOPPED', 'HALTED'];
|
|
266
|
+
IntegrationMonitor.styles = [
|
|
267
|
+
ScrollbarStyles,
|
|
268
|
+
css `
|
|
269
|
+
:host {
|
|
270
|
+
display: flex;
|
|
271
|
+
flex-direction: column;
|
|
272
|
+
|
|
273
|
+
overflow: hidden;
|
|
274
|
+
background-color: var(--main-section-background-color);
|
|
275
|
+
padding: var(--padding-wide);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
integration-summary {
|
|
279
|
+
margin-bottom: var(--margin-wide);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
content {
|
|
283
|
+
flex: 1;
|
|
284
|
+
display: flex;
|
|
285
|
+
flex-direction: row;
|
|
286
|
+
|
|
287
|
+
overflow: hidden;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
connections-monitor {
|
|
291
|
+
width: 180px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
scenarios-monitor {
|
|
295
|
+
flex: 1;
|
|
296
|
+
margin: 0 var(--margin-wide) 0 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media screen and (max-width: 480px) {
|
|
300
|
+
:host {
|
|
301
|
+
padding: var(--padding-default);
|
|
302
|
+
}
|
|
303
|
+
integration-summary {
|
|
304
|
+
margin-bottom: var(--margin-default);
|
|
305
|
+
}
|
|
306
|
+
content {
|
|
307
|
+
display: block;
|
|
308
|
+
overflow: auto;
|
|
309
|
+
}
|
|
310
|
+
scenarios-monitor {
|
|
311
|
+
min-height: 350px;
|
|
312
|
+
margin: 0 0 var(--margin-default) 0;
|
|
313
|
+
}
|
|
314
|
+
connections-monitor {
|
|
315
|
+
width: initial;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
`
|
|
319
|
+
];
|
|
320
|
+
__decorate([
|
|
321
|
+
property({ type: Array }),
|
|
322
|
+
__metadata("design:type", Object)
|
|
323
|
+
], IntegrationMonitor.prototype, "scenarios", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: Array }),
|
|
326
|
+
__metadata("design:type", Object)
|
|
327
|
+
], IntegrationMonitor.prototype, "pendings", void 0);
|
|
328
|
+
__decorate([
|
|
329
|
+
property({ type: Array }),
|
|
330
|
+
__metadata("design:type", Object)
|
|
331
|
+
], IntegrationMonitor.prototype, "connections", void 0);
|
|
332
|
+
__decorate([
|
|
333
|
+
property({ type: Object }),
|
|
334
|
+
__metadata("design:type", Object)
|
|
335
|
+
], IntegrationMonitor.prototype, "colorIndex", void 0);
|
|
336
|
+
IntegrationMonitor = __decorate([
|
|
337
|
+
customElement('integration-monitor')
|
|
338
|
+
], IntegrationMonitor);
|
|
339
|
+
export { IntegrationMonitor };
|
|
340
|
+
//# sourceMappingURL=integration-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-monitor.js","sourceRoot":"","sources":["../../client/pages/integration-monitor.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,gCAAgC,CAAA;AACvC,OAAO,gCAAgC,CAAA;AACvC,OAAO,kCAAkC,CAAA;AAEzC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,SAAS,mBAAmB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;qDAAe;AACzC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;oDAAc;AACxC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;uDAAiB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAgB;AA7DhC,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CAsU9B;SAtUY,kBAAkB","sourcesContent":["import '../viewparts/monitoring-summary'\nimport '../viewparts/pending-q-monitor'\nimport '../viewparts/scenarios-monitor'\nimport '../viewparts/connections-monitor'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client, subscribe } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nfunction IS_SCENARIO_RUNNING(state) {\n return state && state !== 'UNLOADED'\n}\n\nfunction toColor(string) {\n var hash = 0\n if (string.length === 0) return hash\n for (var i = 0; i < string.length; i++) {\n hash = string.charCodeAt(i) + ((hash << 5) - hash)\n hash = hash & hash\n }\n var color = '#'\n for (var i = 0; i < 3; i++) {\n var value = (hash >> (i * 8)) & 255\n color += ('00' + value.toString(16)).substr(-2)\n }\n return color\n}\n\n@customElement('integration-monitor')\nexport class IntegrationMonitor extends localize(i18next)(PageView) {\n static ScenarioInstanceStatus = ['READY', 'STARTED', 'STOPPED', 'HALTED']\n\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n background-color: var(--main-section-background-color);\n padding: var(--padding-wide);\n }\n\n integration-summary {\n margin-bottom: var(--margin-wide);\n }\n\n content {\n flex: 1;\n display: flex;\n flex-direction: row;\n\n overflow: hidden;\n }\n\n connections-monitor {\n width: 180px;\n }\n\n scenarios-monitor {\n flex: 1;\n margin: 0 var(--margin-wide) 0 0;\n }\n\n @media screen and (max-width: 480px) {\n :host {\n padding: var(--padding-default);\n }\n integration-summary {\n margin-bottom: var(--margin-default);\n }\n content {\n display: block;\n overflow: auto;\n }\n scenarios-monitor {\n min-height: 350px;\n margin: 0 0 var(--margin-default) 0;\n }\n connections-monitor {\n width: initial;\n }\n }\n `\n ]\n\n @property({ type: Array }) scenarios: any\n @property({ type: Array }) pendings: any\n @property({ type: Array }) connections: any\n @property({ type: Object }) colorIndex: any\n\n scenarioInstanceStateSubscription: any\n scenarioQueueStateSubscription: any\n connectionStateSubscription: any\n\n get context() {\n return {\n title: i18next.t('text.integration monitor'),\n help: 'integration/ui/integration-monitor'\n }\n }\n\n render() {\n return html`\n <integration-summary\n .pendings=${this.pendings}\n .scenarios=${this.scenarios}\n .connections=${this.connections}\n ></integration-summary>\n <content>\n <scenarios-monitor\n .scenarios=${this.scenarios}\n .pendings=${this.pendings}\n .colorIndex=${this.colorIndex || {}}\n .running=${!!this.active}\n ></scenarios-monitor>\n <connections-monitor .connections=${this.connections}></connections-monitor>\n </content>\n `\n }\n\n async pageUpdated(changes) {\n if ('active' in changes) {\n if (this.active) {\n await this.fetchScenarios()\n await this.fetchConnections()\n await this.startSubscribe()\n } else {\n await this.stopSubscribe()\n }\n }\n }\n\n async fetchScenarios() {\n const response = await client.query({\n query: gql`\n query {\n responses: scenarios {\n items {\n id\n name\n description\n active\n state\n schedule\n timezone\n instances {\n instanceName\n scenarioName\n state\n progress {\n rate\n steps\n step\n rounds\n }\n variables\n data\n message\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `\n })\n\n var colorIndex = {}\n this.scenarios = (response.data.responses.items || []).map(scenario => {\n var color = toColor(scenario.id)\n colorIndex[scenario.id] = color\n\n return {\n ...scenario,\n color\n }\n })\n this.colorIndex = colorIndex\n }\n\n async fetchConnections() {\n const response = await client.query({\n query: gql`\n query {\n responses: connections {\n items {\n id\n name\n description\n type\n state\n }\n total\n }\n }\n `\n })\n\n this.connections = response.data.responses.items || []\n // .map(connection => {\n // var color = toColor(scenario.id)\n // colorIndex[scenario.id] = color\n\n // return {\n // ...scenario,\n // color\n // }\n // })\n // this.colorIndex = colorIndex\n }\n\n async startSubscribe() {\n if (this.scenarioInstanceStateSubscription) {\n return\n }\n\n this.scenarioInstanceStateSubscription = await subscribe(\n {\n query: gql`\n subscription {\n scenarioInstanceState {\n instanceName\n scenarioName\n state\n progress {\n rate\n steps\n step\n rounds\n }\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n var { scenarioName, instanceName, state } = data.scenarioInstanceState\n\n this.scenarios = this.scenarios || []\n var scenario = this.scenarios.find(scenario => scenario.name === scenarioName)\n\n if (scenario) {\n var idx = scenario.instances.findIndex(instance => instance.instanceName === instanceName)\n if (idx == -1) {\n if (IS_SCENARIO_RUNNING(state)) {\n scenario.instances.push(data.scenarioInstanceState)\n }\n } else {\n if (!IS_SCENARIO_RUNNING(state)) {\n scenario.instances.splice(idx, 1)\n } else {\n scenario.instances.splice(idx, 1, data.scenarioInstanceState)\n }\n }\n } else {\n this.scenarios = []\n\n await this.stopSubscribe()\n await this.fetchScenarios()\n await this.startSubscribe()\n\n return\n }\n\n /* change object intentionally to force to refresh scenario */\n this.scenarios.splice(this.scenarios.indexOf(scenario), 1, { ...scenario })\n this.scenarios = [...this.scenarios]\n }\n },\n start: subscription => {\n console.log(subscription)\n },\n error: error => {\n console.log(error)\n },\n complete: () => {\n console.log('complete')\n }\n }\n )\n\n this.scenarioQueueStateSubscription = await subscribe(\n {\n query: gql`\n subscription {\n scenarioQueueState {\n queue {\n stuff\n due\n priority\n tag\n }\n }\n }\n `\n },\n {\n next: ({ data }) => {\n if (data) {\n this.pendings = data.scenarioQueueState.queue\n }\n }\n }\n )\n\n this.connectionStateSubscription = await subscribe(\n {\n query: gql`\n subscription {\n connectionState {\n id\n name\n description\n type\n state\n }\n }\n `\n },\n {\n next: async ({ data }) => {\n if (data) {\n var state = data.connectionState\n\n this.connections = this.connections || []\n var idx = this.connections.findIndex(connection => connection.id === state.id)\n\n if (idx !== -1) {\n this.connections[idx] = data.connectionState\n this.connections = [...this.connections]\n } else {\n this.connections = [...this.connections, data.connectionState]\n }\n }\n }\n }\n )\n }\n\n async stopSubscribe() {\n await this.scenarioInstanceStateSubscription?.unsubscribe()\n await this.scenarioQueueStateSubscription?.unsubscribe()\n await this.connectionStateSubscription?.unsubscribe()\n\n delete this.scenarioInstanceStateSubscription\n delete this.scenarioQueueStateSubscription\n delete this.connectionStateSubscription\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@operato/data-grist/ox-grist.js';
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@operato/data-grist/ox-grist.js';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
6
|
+
import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
7
|
+
import { client } from '@operato/graphql';
|
|
8
|
+
import { HelpDecoratedRenderer } from '@operato/help/help-decorated-renderer.js';
|
|
9
|
+
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { isMobileDevice } from '@operato/utils';
|
|
11
|
+
const SelectFields = ['name', 'description', 'sequence', 'task', 'connection', 'params', 'result', 'skip', 'log'];
|
|
12
|
+
let ScenarioDetail = class ScenarioDetail extends localize(i18next)(LitElement) {
|
|
13
|
+
render() {
|
|
14
|
+
return html `
|
|
15
|
+
<ox-grist
|
|
16
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
17
|
+
.config=${this.gristConfig}
|
|
18
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
19
|
+
></ox-grist>
|
|
20
|
+
<div class="button-container">
|
|
21
|
+
<mwc-button raised danger @click=${this._deleteSteps.bind(this)}>${i18next.t('button.delete')}</mwc-button>
|
|
22
|
+
<mwc-button raised @click=${this._updateSteps.bind(this)}>${i18next.t('button.save')}</mwc-button>
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
async firstUpdated() {
|
|
27
|
+
this.gristConfig = {
|
|
28
|
+
list: { fields: ['name', 'description', 'task'] },
|
|
29
|
+
columns: [
|
|
30
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
31
|
+
{
|
|
32
|
+
type: 'gutter',
|
|
33
|
+
gutterName: 'button',
|
|
34
|
+
icon: 'add',
|
|
35
|
+
handlers: {
|
|
36
|
+
click: 'record-copy'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
40
|
+
{
|
|
41
|
+
type: 'gutter',
|
|
42
|
+
gutterName: 'button',
|
|
43
|
+
icon: 'arrow_upward',
|
|
44
|
+
handlers: {
|
|
45
|
+
click: 'move-up'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'gutter',
|
|
50
|
+
gutterName: 'button',
|
|
51
|
+
icon: 'arrow_downward',
|
|
52
|
+
handlers: {
|
|
53
|
+
click: 'move-down'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'number',
|
|
58
|
+
name: 'sequence',
|
|
59
|
+
hidden: true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'string',
|
|
63
|
+
name: 'id',
|
|
64
|
+
hidden: true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'string',
|
|
68
|
+
name: 'name',
|
|
69
|
+
header: i18next.t('field.name'),
|
|
70
|
+
record: {
|
|
71
|
+
editable: true
|
|
72
|
+
},
|
|
73
|
+
width: 140
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'string',
|
|
77
|
+
name: 'description',
|
|
78
|
+
header: i18next.t('field.description'),
|
|
79
|
+
record: {
|
|
80
|
+
editable: true
|
|
81
|
+
},
|
|
82
|
+
width: 180
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
name: 'result',
|
|
87
|
+
header: i18next.t('field.result'),
|
|
88
|
+
record: {
|
|
89
|
+
editable: true
|
|
90
|
+
},
|
|
91
|
+
width: 80
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
name: 'skip',
|
|
96
|
+
header: i18next.t('field.skip'),
|
|
97
|
+
record: {
|
|
98
|
+
editable: true
|
|
99
|
+
},
|
|
100
|
+
width: 80
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
name: 'log',
|
|
105
|
+
header: i18next.t('field.log'),
|
|
106
|
+
record: {
|
|
107
|
+
editable: true
|
|
108
|
+
},
|
|
109
|
+
width: 80
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: 'connection',
|
|
113
|
+
name: 'connection',
|
|
114
|
+
header: i18next.t('field.connection'),
|
|
115
|
+
record: {
|
|
116
|
+
editable: true
|
|
117
|
+
},
|
|
118
|
+
width: 160
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'task-type',
|
|
122
|
+
name: 'task',
|
|
123
|
+
header: i18next.t('field.task'),
|
|
124
|
+
record: {
|
|
125
|
+
renderer: HelpDecoratedRenderer,
|
|
126
|
+
editable: true,
|
|
127
|
+
help: value => { var _a, _b; return (_b = (_a = this.taskTypes) === null || _a === void 0 ? void 0 : _a[value]) === null || _b === void 0 ? void 0 : _b.help; },
|
|
128
|
+
connectionName: async (value, column, record, row, field) => {
|
|
129
|
+
/* return connectionName */
|
|
130
|
+
return record.connection;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
width: 120
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'parameters',
|
|
137
|
+
name: 'params',
|
|
138
|
+
header: i18next.t('field.params'),
|
|
139
|
+
record: {
|
|
140
|
+
editable: true,
|
|
141
|
+
options: (value, column, record, row, field) => {
|
|
142
|
+
var _a;
|
|
143
|
+
var { name, parameterSpec: spec, help } = record.task ? (_a = this.taskTypes) === null || _a === void 0 ? void 0 : _a[record.task] : {};
|
|
144
|
+
const context = this.grist;
|
|
145
|
+
return { name, spec, help, context };
|
|
146
|
+
},
|
|
147
|
+
renderer: 'json5'
|
|
148
|
+
},
|
|
149
|
+
width: 200
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
rows: {
|
|
153
|
+
selectable: {
|
|
154
|
+
multiple: true
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
pagination: {
|
|
158
|
+
infinite: true
|
|
159
|
+
},
|
|
160
|
+
sorters: [
|
|
161
|
+
{
|
|
162
|
+
name: 'sequence'
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async fetchHandler({ page, limit, sorters = [] }) {
|
|
168
|
+
const response = await client.query({
|
|
169
|
+
query: gql `
|
|
170
|
+
query {
|
|
171
|
+
steps (
|
|
172
|
+
filters: {
|
|
173
|
+
name: "scenarioId",
|
|
174
|
+
value: "${this.scenario.id}",
|
|
175
|
+
operator: "eq"
|
|
176
|
+
},
|
|
177
|
+
sortings: { name: "sequence" }
|
|
178
|
+
) {
|
|
179
|
+
items {
|
|
180
|
+
id
|
|
181
|
+
${SelectFields.join('\n')}
|
|
182
|
+
}
|
|
183
|
+
total
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
`
|
|
187
|
+
});
|
|
188
|
+
return {
|
|
189
|
+
total: response.data.steps.total || 0,
|
|
190
|
+
records: response.data.steps.items || []
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async fetchTaskType(name) {
|
|
194
|
+
const response = await client.query({
|
|
195
|
+
query: gql `
|
|
196
|
+
query ($name: String!) {
|
|
197
|
+
taskType(name: $name) {
|
|
198
|
+
name
|
|
199
|
+
description
|
|
200
|
+
help
|
|
201
|
+
parameterSpec {
|
|
202
|
+
type
|
|
203
|
+
name
|
|
204
|
+
label
|
|
205
|
+
placeholder
|
|
206
|
+
property
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
`,
|
|
211
|
+
variables: {
|
|
212
|
+
name
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
return response.data.taskType;
|
|
216
|
+
}
|
|
217
|
+
async _updateSteps() {
|
|
218
|
+
let patches = this.grist._data.records;
|
|
219
|
+
if (patches && patches.length) {
|
|
220
|
+
patches = patches.map(patch => {
|
|
221
|
+
var patchField = {};
|
|
222
|
+
const dirtyFields = patch.__dirtyfields__;
|
|
223
|
+
for (let key in dirtyFields) {
|
|
224
|
+
patchField[key] = dirtyFields[key].after;
|
|
225
|
+
}
|
|
226
|
+
return Object.assign(Object.assign({}, patch.__origin__), patchField);
|
|
227
|
+
});
|
|
228
|
+
const response = await client.mutate({
|
|
229
|
+
mutation: gql `
|
|
230
|
+
mutation ($scenarioId: String!, $patches: [StepPatch!]!) {
|
|
231
|
+
updateMultipleStep(scenarioId: $scenarioId, patches: $patches) {
|
|
232
|
+
name
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
`,
|
|
236
|
+
variables: {
|
|
237
|
+
scenarioId: this.scenario.id,
|
|
238
|
+
patches
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
if (!response.errors) {
|
|
242
|
+
this.grist.fetch();
|
|
243
|
+
this.requestRefresh();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async _deleteSteps() {
|
|
248
|
+
this.grist.deleteSelectedRecords(true);
|
|
249
|
+
}
|
|
250
|
+
requestRefresh() {
|
|
251
|
+
this.dispatchEvent(new CustomEvent('requestRefresh'));
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
ScenarioDetail.styles = [
|
|
255
|
+
css `
|
|
256
|
+
:host {
|
|
257
|
+
display: flex;
|
|
258
|
+
flex-direction: column;
|
|
259
|
+
|
|
260
|
+
background-color: #fff;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
ox-grist {
|
|
264
|
+
flex: 1;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.button-container {
|
|
268
|
+
display: flex;
|
|
269
|
+
margin-left: auto;
|
|
270
|
+
padding: var(--padding-default);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
form {
|
|
274
|
+
position: relative;
|
|
275
|
+
}
|
|
276
|
+
[danger] {
|
|
277
|
+
--mdc-theme-primary: var(--mdc-danger-button-primary-color);
|
|
278
|
+
}
|
|
279
|
+
mwc-button {
|
|
280
|
+
margin-left: var(--margin-default);
|
|
281
|
+
}
|
|
282
|
+
`
|
|
283
|
+
];
|
|
284
|
+
__decorate([
|
|
285
|
+
property({ type: Object }),
|
|
286
|
+
__metadata("design:type", Object)
|
|
287
|
+
], ScenarioDetail.prototype, "scenario", void 0);
|
|
288
|
+
__decorate([
|
|
289
|
+
property({ type: Object }),
|
|
290
|
+
__metadata("design:type", Object)
|
|
291
|
+
], ScenarioDetail.prototype, "gristConfig", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
property({ type: Object }),
|
|
294
|
+
__metadata("design:type", Object)
|
|
295
|
+
], ScenarioDetail.prototype, "taskTypes", void 0);
|
|
296
|
+
__decorate([
|
|
297
|
+
query('ox-grist'),
|
|
298
|
+
__metadata("design:type", DataGrist)
|
|
299
|
+
], ScenarioDetail.prototype, "grist", void 0);
|
|
300
|
+
ScenarioDetail = __decorate([
|
|
301
|
+
customElement('scenario-detail')
|
|
302
|
+
], ScenarioDetail);
|
|
303
|
+
//# sourceMappingURL=scenario-detail.js.map
|