@things-factory/integration-ui 6.1.52 → 6.1.69
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} +38 -44
- 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} +14 -20
- 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 +428 -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 +581 -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/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- 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,29 @@
|
|
|
1
|
+
import './scenario-instance-log-view';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
declare const ScenarioInstanceView_base: (new (...args: any[]) => {
|
|
4
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
stateChanged(_state: unknown): void;
|
|
8
|
+
readonly isConnected: boolean;
|
|
9
|
+
}) & typeof LitElement;
|
|
10
|
+
export declare class ScenarioInstanceView extends ScenarioInstanceView_base {
|
|
11
|
+
static styles: import("lit").CSSResult[];
|
|
12
|
+
scenarioName?: string;
|
|
13
|
+
instanceName?: string;
|
|
14
|
+
instance?: any;
|
|
15
|
+
tab?: string;
|
|
16
|
+
step?: string;
|
|
17
|
+
key?: string;
|
|
18
|
+
contextPath?: string;
|
|
19
|
+
subscription: any;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
firstUpdated(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
stateChanged(state: any): void;
|
|
24
|
+
renderDataObject(data: any): import("lit-html").TemplateResult<1>;
|
|
25
|
+
renderVariableObject(data: any): import("lit-html").TemplateResult<1>;
|
|
26
|
+
startSubscribe(): Promise<void>;
|
|
27
|
+
stopSubscribe(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import './scenario-instance-log-view';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
+
import { connect } from 'pwa-helpers/connect-mixin';
|
|
7
|
+
import { subscribe } from '@operato/graphql';
|
|
8
|
+
import { store } from '@operato/shell';
|
|
9
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
10
|
+
let ScenarioInstanceView = class ScenarioInstanceView extends connect(store)(LitElement) {
|
|
11
|
+
render() {
|
|
12
|
+
const tab = this.tab || 'info';
|
|
13
|
+
const { scenarioName, instanceName, description, state, progress, variables, data, message } = this.instance || {};
|
|
14
|
+
const { rate = 0, steps = 0, step = 0, rounds = 0 } = progress || {};
|
|
15
|
+
const diagram = `${this.contextPath || ''}/scenario-view/${this.scenarioName}`;
|
|
16
|
+
return html `
|
|
17
|
+
<div content>
|
|
18
|
+
<div tab>
|
|
19
|
+
<span @click=${e => (this.tab = 'info')} ?active=${tab == 'info'}>info</span>
|
|
20
|
+
<span @click=${e => (this.tab = 'variables')} ?active=${tab == 'variables'}>variables</span>
|
|
21
|
+
<span @click=${e => (this.tab = 'data')} ?active=${tab == 'data'}>data</span>
|
|
22
|
+
<span @click=${e => (this.tab = 'log')} ?active=${tab == 'log'}>log</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div detail>
|
|
25
|
+
<div info ?active=${tab == 'info'}>
|
|
26
|
+
<ul>
|
|
27
|
+
<li>scenario name : <strong>${scenarioName}</strong></li>
|
|
28
|
+
<li>instance name : ${instanceName}</li>
|
|
29
|
+
<li>description : ${description}</li>
|
|
30
|
+
<li>state : ${state}</li>
|
|
31
|
+
<li>total steps : ${steps}</li>
|
|
32
|
+
<li>current step : ${step}</li>
|
|
33
|
+
<li>rounds : ${rounds}</li>
|
|
34
|
+
<li>messge : ${message}</li>
|
|
35
|
+
</ul>
|
|
36
|
+
<iframe diagram src="${diagram}"></iframe>
|
|
37
|
+
</div>
|
|
38
|
+
<div variables ?active=${tab == 'variables'}>${this.renderVariableObject(variables)}</div>
|
|
39
|
+
<div data ?active=${tab == 'data'}>${this.renderDataObject(data)}</div>
|
|
40
|
+
<scenario-instance-log-view
|
|
41
|
+
log
|
|
42
|
+
?active=${tab == 'log'}
|
|
43
|
+
.scenarioName=${this.scenarioName}
|
|
44
|
+
.instanceName=${this.instanceName}
|
|
45
|
+
></scenario-instance-log-view>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
firstUpdated() {
|
|
51
|
+
this.startSubscribe();
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
super.disconnectedCallback();
|
|
55
|
+
this.stopSubscribe();
|
|
56
|
+
}
|
|
57
|
+
stateChanged(state) {
|
|
58
|
+
this.contextPath = state.app.contextPath;
|
|
59
|
+
}
|
|
60
|
+
renderDataObject(data) {
|
|
61
|
+
const keys = Object.keys(data || {});
|
|
62
|
+
if (keys.length == 0) {
|
|
63
|
+
return html `<pre>no data</pre>`;
|
|
64
|
+
}
|
|
65
|
+
const currentStep = this.step || keys[0];
|
|
66
|
+
return html `
|
|
67
|
+
<ul keys>
|
|
68
|
+
${keys.map(step => html `<li @click=${e => (this.step = step)} ?active=${currentStep == step}>${step}</li>`)}
|
|
69
|
+
</ul>
|
|
70
|
+
<div value>
|
|
71
|
+
<pre>${data[currentStep] ? JSON.stringify(data[currentStep], null, 2) : ''}</pre>
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
renderVariableObject(data) {
|
|
76
|
+
const keys = Object.keys(data || {});
|
|
77
|
+
if (keys.length == 0) {
|
|
78
|
+
return html `<pre>no data</pre>`;
|
|
79
|
+
}
|
|
80
|
+
const currentKey = this.key || keys[0];
|
|
81
|
+
return html `
|
|
82
|
+
<ul keys>
|
|
83
|
+
${keys.map(key => html `<li @click=${e => (this.key = key)} ?active=${currentKey == key}>${key}</li>`)}
|
|
84
|
+
</ul>
|
|
85
|
+
<div value>
|
|
86
|
+
<pre>${data[currentKey] ? JSON.stringify(data[currentKey], null, 2) : ''}</pre>
|
|
87
|
+
</div>
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
async startSubscribe() {
|
|
91
|
+
this.subscription = await subscribe({
|
|
92
|
+
query: gql `
|
|
93
|
+
subscription ($instanceName: String, $scenarioName: String) {
|
|
94
|
+
scenarioInstanceState(instanceName: $instanceName, scenarioName: $scenarioName) {
|
|
95
|
+
instanceName
|
|
96
|
+
scenarioName
|
|
97
|
+
state
|
|
98
|
+
progress {
|
|
99
|
+
rate
|
|
100
|
+
steps
|
|
101
|
+
step
|
|
102
|
+
rounds
|
|
103
|
+
}
|
|
104
|
+
variables
|
|
105
|
+
data
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`,
|
|
109
|
+
variables: {
|
|
110
|
+
instanceName: this.instanceName,
|
|
111
|
+
scenarioName: this.scenarioName
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
next: async ({ data }) => {
|
|
115
|
+
data && (this.instance = data.scenarioInstanceState);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async stopSubscribe() {
|
|
120
|
+
var _a;
|
|
121
|
+
await ((_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe());
|
|
122
|
+
delete this.subscription;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
ScenarioInstanceView.styles = [
|
|
126
|
+
ScrollbarStyles,
|
|
127
|
+
css `
|
|
128
|
+
:host {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
background-color: var(--main-section-background-color);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[diagram] {
|
|
135
|
+
flex: 1;
|
|
136
|
+
height: 100%;
|
|
137
|
+
border: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[content] {
|
|
141
|
+
flex: 1;
|
|
142
|
+
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[tab] {
|
|
149
|
+
display: flex;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
[tab] span {
|
|
153
|
+
display: inline;
|
|
154
|
+
padding: var(--padding-wide) var(--padding-wide) var(--padding-narrow) var(--padding-wide);
|
|
155
|
+
border-bottom: 3px solid transparent;
|
|
156
|
+
color: var(--secondary-color);
|
|
157
|
+
text-transform: capitalize;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
[tab] span[active] {
|
|
161
|
+
border-color: var(--primary-color);
|
|
162
|
+
font-weight: bold;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
[detail] {
|
|
166
|
+
flex: 1;
|
|
167
|
+
background-color: var(--theme-white-color);
|
|
168
|
+
border-top: var(--border-dark-color);
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
padding: var(--padding-wide);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
[detail] > * {
|
|
174
|
+
display: none;
|
|
175
|
+
width: 100%;
|
|
176
|
+
height: 100%;
|
|
177
|
+
color: var(--secondary-color);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[detail] > [active] {
|
|
181
|
+
display: flex;
|
|
182
|
+
overflow: auto;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
pre {
|
|
186
|
+
margin: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
[detail] ul {
|
|
190
|
+
margin: 0;
|
|
191
|
+
padding: 0;
|
|
192
|
+
flex: 1;
|
|
193
|
+
list-style: inside '- ';
|
|
194
|
+
}
|
|
195
|
+
[detail] li {
|
|
196
|
+
padding: var(--padding-default) var(--padding-narrow) var(--padding-narrow) var(--padding-narrow);
|
|
197
|
+
border-bottom: var(--border-dark-color);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
li[active] {
|
|
201
|
+
font-weight: bold;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
[value] {
|
|
205
|
+
flex: 1;
|
|
206
|
+
overflow: auto;
|
|
207
|
+
padding: var(--padding-wide);
|
|
208
|
+
}
|
|
209
|
+
scenario-instance-log-view [active] {
|
|
210
|
+
padding: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@media only screen and (max-width: 460px) {
|
|
214
|
+
[info][active] {
|
|
215
|
+
display: block;
|
|
216
|
+
}
|
|
217
|
+
[detail] {
|
|
218
|
+
padding: var(--padding-default);
|
|
219
|
+
overflow: auto;
|
|
220
|
+
}
|
|
221
|
+
[detail] > * {
|
|
222
|
+
height: auto;
|
|
223
|
+
}
|
|
224
|
+
[diagram] {
|
|
225
|
+
width: 100%;
|
|
226
|
+
min-height: 500px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`
|
|
230
|
+
];
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: String }),
|
|
233
|
+
__metadata("design:type", String)
|
|
234
|
+
], ScenarioInstanceView.prototype, "scenarioName", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: String }),
|
|
237
|
+
__metadata("design:type", String)
|
|
238
|
+
], ScenarioInstanceView.prototype, "instanceName", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
property({ type: Object }),
|
|
241
|
+
__metadata("design:type", Object)
|
|
242
|
+
], ScenarioInstanceView.prototype, "instance", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property({ type: String }),
|
|
245
|
+
__metadata("design:type", String)
|
|
246
|
+
], ScenarioInstanceView.prototype, "tab", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: String }),
|
|
249
|
+
__metadata("design:type", String)
|
|
250
|
+
], ScenarioInstanceView.prototype, "step", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
property({ type: String }),
|
|
253
|
+
__metadata("design:type", String)
|
|
254
|
+
], ScenarioInstanceView.prototype, "key", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({ type: String }),
|
|
257
|
+
__metadata("design:type", String)
|
|
258
|
+
], ScenarioInstanceView.prototype, "contextPath", void 0);
|
|
259
|
+
ScenarioInstanceView = __decorate([
|
|
260
|
+
customElement('scenario-instance-view')
|
|
261
|
+
], ScenarioInstanceView);
|
|
262
|
+
export { ScenarioInstanceView };
|
|
263
|
+
//# sourceMappingURL=scenario-instance-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-instance-view.js","sourceRoot":"","sources":["../../client/viewparts/scenario-instance-view.ts"],"names":[],"mappings":";AAAA,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAG1C,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAsHlE,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,MAAM,CAAA;QAC9B,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;QAClH,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,G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C,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAa;AACxC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAqB;AAlHrC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAuPhC;SAvPY,oBAAoB","sourcesContent":["import './scenario-instance-log-view'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { subscribe } from '@operato/graphql'\nimport { store } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('scenario-instance-view')\nexport class ScenarioInstanceView extends connect(store)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--main-section-background-color);\n }\n\n [diagram] {\n flex: 1;\n height: 100%;\n border: none;\n }\n\n [content] {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n [tab] {\n display: flex;\n }\n\n [tab] span {\n display: inline;\n padding: var(--padding-wide) var(--padding-wide) var(--padding-narrow) var(--padding-wide);\n border-bottom: 3px solid transparent;\n color: var(--secondary-color);\n text-transform: capitalize;\n }\n\n [tab] span[active] {\n border-color: var(--primary-color);\n font-weight: bold;\n }\n\n [detail] {\n flex: 1;\n background-color: var(--theme-white-color);\n border-top: var(--border-dark-color);\n overflow: hidden;\n padding: var(--padding-wide);\n }\n\n [detail] > * {\n display: none;\n width: 100%;\n height: 100%;\n color: var(--secondary-color);\n }\n\n [detail] > [active] {\n display: flex;\n overflow: auto;\n }\n\n pre {\n margin: 0;\n }\n\n [detail] ul {\n margin: 0;\n padding: 0;\n flex: 1;\n list-style: inside '- ';\n }\n [detail] li {\n padding: var(--padding-default) var(--padding-narrow) var(--padding-narrow) var(--padding-narrow);\n border-bottom: var(--border-dark-color);\n }\n\n li[active] {\n font-weight: bold;\n }\n\n [value] {\n flex: 1;\n overflow: auto;\n padding: var(--padding-wide);\n }\n scenario-instance-log-view [active] {\n padding: 0;\n }\n\n @media only screen and (max-width: 460px) {\n [info][active] {\n display: block;\n }\n [detail] {\n padding: var(--padding-default);\n overflow: auto;\n }\n [detail] > * {\n height: auto;\n }\n [diagram] {\n width: 100%;\n min-height: 500px;\n }\n }\n `\n ]\n\n @property({ type: String }) scenarioName?: string\n @property({ type: String }) instanceName?: string\n @property({ type: Object }) instance?: any\n @property({ type: String }) tab?: string\n @property({ type: String }) step?: string\n @property({ type: String }) key?: string\n @property({ type: String }) contextPath?: string\n\n subscription: any\n\n render() {\n const tab = this.tab || 'info'\n const { scenarioName, instanceName, description, state, progress, variables, data, message } = this.instance || {}\n const { rate = 0, steps = 0, step = 0, rounds = 0 } = progress || {}\n const diagram = `${this.contextPath || ''}/scenario-view/${this.scenarioName}`\n\n return html`\n <div content>\n <div tab>\n <span @click=${e => (this.tab = 'info')} ?active=${tab == 'info'}>info</span>\n <span @click=${e => (this.tab = 'variables')} ?active=${tab == 'variables'}>variables</span>\n <span @click=${e => (this.tab = 'data')} ?active=${tab == 'data'}>data</span>\n <span @click=${e => (this.tab = 'log')} ?active=${tab == 'log'}>log</span>\n </div>\n <div detail>\n <div info ?active=${tab == 'info'}>\n <ul>\n <li>scenario name : <strong>${scenarioName}</strong></li>\n <li>instance name : ${instanceName}</li>\n <li>description : ${description}</li>\n <li>state : ${state}</li>\n <li>total steps : ${steps}</li>\n <li>current step : ${step}</li>\n <li>rounds : ${rounds}</li>\n <li>messge : ${message}</li>\n </ul>\n <iframe diagram src=\"${diagram}\"></iframe>\n </div>\n <div variables ?active=${tab == 'variables'}>${this.renderVariableObject(variables)}</div>\n <div data ?active=${tab == 'data'}>${this.renderDataObject(data)}</div>\n <scenario-instance-log-view\n log\n ?active=${tab == 'log'}\n .scenarioName=${this.scenarioName}\n .instanceName=${this.instanceName}\n ></scenario-instance-log-view>\n </div>\n </div>\n `\n }\n\n firstUpdated() {\n this.startSubscribe()\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.stopSubscribe()\n }\n\n stateChanged(state) {\n this.contextPath = state.app.contextPath\n }\n\n renderDataObject(data) {\n const keys = Object.keys(data || {})\n\n if (keys.length == 0) {\n return html`<pre>no data</pre>`\n }\n\n const currentStep = this.step || keys[0]\n\n return html`\n <ul keys>\n ${keys.map(step => html`<li @click=${e => (this.step = step)} ?active=${currentStep == step}>${step}</li>`)}\n </ul>\n <div value>\n <pre>${data[currentStep] ? JSON.stringify(data[currentStep], null, 2) : ''}</pre>\n </div>\n `\n }\n\n renderVariableObject(data) {\n const keys = Object.keys(data || {})\n\n if (keys.length == 0) {\n return html`<pre>no data</pre>`\n }\n\n const currentKey = this.key || keys[0]\n\n return html`\n <ul keys>\n ${keys.map(key => html`<li @click=${e => (this.key = key)} ?active=${currentKey == key}>${key}</li>`)}\n </ul>\n <div value>\n <pre>${data[currentKey] ? JSON.stringify(data[currentKey], null, 2) : ''}</pre>\n </div>\n `\n }\n\n async startSubscribe() {\n this.subscription = await subscribe(\n {\n query: gql`\n subscription ($instanceName: String, $scenarioName: String) {\n scenarioInstanceState(instanceName: $instanceName, scenarioName: $scenarioName) {\n instanceName\n scenarioName\n state\n progress {\n rate\n steps\n step\n rounds\n }\n variables\n data\n }\n }\n `,\n variables: {\n instanceName: this.instanceName,\n scenarioName: this.scenarioName\n }\n },\n {\n next: async ({ data }) => {\n data && (this.instance = data.scenarioInstanceState)\n }\n }\n )\n }\n\n async stopSubscribe() {\n await this.subscription?.unsubscribe()\n delete this.subscription\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import '@material/mwc-icon-button';
|
|
3
|
+
import './scenario-instance-monitor';
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
declare const ScenarioMonitor_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
6
|
+
export declare class ScenarioMonitor extends ScenarioMonitor_base {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
scenario: any;
|
|
9
|
+
mode?: string;
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
renderButtons(scenario: any): import("lit-html").TemplateResult<1>;
|
|
12
|
+
popupLogView(scenario: any): Promise<void>;
|
|
13
|
+
startScenario(scenario: any): Promise<void>;
|
|
14
|
+
stopScenario(scenario: any): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@operato/data-grist';
|
|
3
|
+
import '@material/mwc-icon-button';
|
|
4
|
+
import './scenario-instance-monitor';
|
|
5
|
+
import gql from 'graphql-tag';
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
8
|
+
import { client } from '@operato/graphql';
|
|
9
|
+
import { i18next, localize } from '@operato/i18n';
|
|
10
|
+
import { notify, openPopup } from '@operato/layout';
|
|
11
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
12
|
+
function IS_SCENARIO_RUNNING(state) {
|
|
13
|
+
return state && state !== 'UNLOADED';
|
|
14
|
+
}
|
|
15
|
+
let ScenarioMonitor = class ScenarioMonitor extends localize(i18next)(LitElement) {
|
|
16
|
+
render() {
|
|
17
|
+
const scenario = this.scenario || {};
|
|
18
|
+
const mode = this.mode;
|
|
19
|
+
const { id, name, description, schedule, color } = scenario;
|
|
20
|
+
const instances = scenario.instances || [];
|
|
21
|
+
return html `
|
|
22
|
+
<div desc>
|
|
23
|
+
<div detail-info>
|
|
24
|
+
<strong>${name}</strong>
|
|
25
|
+
${description}
|
|
26
|
+
<span>${instances.length}</span>
|
|
27
|
+
</div>
|
|
28
|
+
<div schedule>
|
|
29
|
+
<mwc-icon .style="background-color: ${color};">schedule</mwc-icon>
|
|
30
|
+
<pre>${schedule}</pre>
|
|
31
|
+
</div>
|
|
32
|
+
${this.renderButtons(scenario)}
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
${mode === 'detail'
|
|
36
|
+
? html `
|
|
37
|
+
<ul>
|
|
38
|
+
${instances.map(instance => html `
|
|
39
|
+
<li .style="border-color:${color};background-color:${color}">
|
|
40
|
+
<span></span>
|
|
41
|
+
<scenario-instance-monitor .instance=${instance} .color=${color}></scenario-instance-monitor>
|
|
42
|
+
</li>
|
|
43
|
+
`)}
|
|
44
|
+
</ul>
|
|
45
|
+
${this.renderButtons(scenario)}
|
|
46
|
+
`
|
|
47
|
+
: html ``}
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
renderButtons(scenario) {
|
|
51
|
+
const instances = scenario.instances || [];
|
|
52
|
+
const scenarioInstance = instances.find(instance => instance.instanceName == scenario.name);
|
|
53
|
+
return html `
|
|
54
|
+
<div buttons ?detail=${this.mode == 'detail'}>
|
|
55
|
+
<mwc-icon-button @click=${e => this.popupLogView(scenario)} icon="text_snippet"></mwc-icon-button>
|
|
56
|
+
${!scenarioInstance
|
|
57
|
+
? html ` <mwc-icon-button
|
|
58
|
+
icon="play_circle_outline"
|
|
59
|
+
@click=${e => this.startScenario(scenario)}
|
|
60
|
+
></mwc-icon-button>`
|
|
61
|
+
: html `
|
|
62
|
+
<mwc-icon-button
|
|
63
|
+
icon="pause_circle_outline"
|
|
64
|
+
@click=${e => this.stopScenario(scenario)}
|
|
65
|
+
stop
|
|
66
|
+
></mwc-icon-button>
|
|
67
|
+
`}
|
|
68
|
+
</div>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
async popupLogView(scenario) {
|
|
72
|
+
openPopup(html ` <scenario-instance-log-view .scenarioName=${scenario.name}></scenario-instance-log-view> `, {
|
|
73
|
+
size: 'large',
|
|
74
|
+
title: `${i18next.t('title.scenario-log')} (${scenario.name})`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async startScenario(scenario) {
|
|
78
|
+
var response = await client.mutate({
|
|
79
|
+
mutation: gql `
|
|
80
|
+
mutation ($scenarioName: String!) {
|
|
81
|
+
startScenario(scenarioName: $scenarioName) {
|
|
82
|
+
state
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`,
|
|
86
|
+
variables: {
|
|
87
|
+
scenarioName: scenario.name
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
notify({
|
|
91
|
+
level: 'info',
|
|
92
|
+
message: `${!IS_SCENARIO_RUNNING(response.data.startScenario.state) ? 'fail' : 'success'} to start instance : ${scenario.name}`
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async stopScenario(scenario) {
|
|
96
|
+
var response = await client.mutate({
|
|
97
|
+
mutation: gql `
|
|
98
|
+
mutation ($instanceName: String!) {
|
|
99
|
+
stopScenario(instanceName: $instanceName) {
|
|
100
|
+
state
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`,
|
|
104
|
+
variables: {
|
|
105
|
+
instanceName: scenario.name
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
notify({
|
|
109
|
+
level: 'info',
|
|
110
|
+
message: `${IS_SCENARIO_RUNNING(response.data.stopScenario.state) ? 'fail' : 'success'} to stop instance : ${scenario.name}`
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
ScenarioMonitor.styles = [
|
|
115
|
+
ScrollbarStyles,
|
|
116
|
+
css `
|
|
117
|
+
:host {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: row;
|
|
120
|
+
margin: var(--margin-default);
|
|
121
|
+
|
|
122
|
+
border: var(--border-dark-color);
|
|
123
|
+
background-color: var(--theme-white-color);
|
|
124
|
+
box-shadow: var(--box-shadow);
|
|
125
|
+
border-radius: var(--border-radius);
|
|
126
|
+
position: relative;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
[desc] {
|
|
131
|
+
position: relative;
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
padding: var(--padding-default);
|
|
135
|
+
width: 200px;
|
|
136
|
+
color: var(--secondary-color);
|
|
137
|
+
font-size: var(--fontsize-small);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[desc] [detail-info] {
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
text-overflow: ellipsis;
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
width: calc(100% - 25px);
|
|
145
|
+
height: 45px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[desc] strong {
|
|
149
|
+
display: block;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
text-overflow: ellipsis;
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
font-size: var(--fontsize-large);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
[desc] span {
|
|
157
|
+
display: block;
|
|
158
|
+
position: absolute;
|
|
159
|
+
top: 0px;
|
|
160
|
+
right: var(--padding-default);
|
|
161
|
+
font-size: 40px;
|
|
162
|
+
font-weight: bold;
|
|
163
|
+
text-align: right;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
[desc] [schedule] * {
|
|
167
|
+
vertical-align: middle;
|
|
168
|
+
display: inline;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[desc] [schedule] {
|
|
172
|
+
background-color: #f1f1f1;
|
|
173
|
+
border-radius: 20px;
|
|
174
|
+
margin: var(--margin-default) 0;
|
|
175
|
+
padding: var(--padding-narrow);
|
|
176
|
+
overflow: hidden;
|
|
177
|
+
text-overflow: ellipsis;
|
|
178
|
+
white-space: nowrap;
|
|
179
|
+
font-size: 12px;
|
|
180
|
+
line-height: 8px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[buttons] {
|
|
184
|
+
--mdc-icon-button-size: 24px;
|
|
185
|
+
--mdc-icon-size: 24px;
|
|
186
|
+
border-top: var(--border-dark-color);
|
|
187
|
+
padding: var(--padding-narrow) 0 0 0;
|
|
188
|
+
text-align: right;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
[buttons] mwc-icon-button {
|
|
192
|
+
color: var(--primary-color);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
[buttons][detail] {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column-reverse;
|
|
198
|
+
margin-bottom: auto;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
[desc] mwc-icon {
|
|
202
|
+
border-radius: 50%;
|
|
203
|
+
color: var(--theme-white-color);
|
|
204
|
+
font-size: 18px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
:host([mode='detail']) [schedule] {
|
|
208
|
+
margin: var(--margin-default) 0 0 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:host([mode='detail']) [desc] [buttons] {
|
|
212
|
+
display: none;
|
|
213
|
+
}
|
|
214
|
+
:host([mode='detail']) [buttons] {
|
|
215
|
+
border-top: none;
|
|
216
|
+
padding: var(--padding-default);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
ul {
|
|
220
|
+
flex: 1;
|
|
221
|
+
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: row;
|
|
224
|
+
flex-wrap: wrap;
|
|
225
|
+
list-style: none;
|
|
226
|
+
margin: 0;
|
|
227
|
+
padding: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
ul > li {
|
|
231
|
+
position: relative;
|
|
232
|
+
margin: var(--margin-default);
|
|
233
|
+
min-width: 140px;
|
|
234
|
+
max-width: 180px;
|
|
235
|
+
border: 1px solid black;
|
|
236
|
+
border-radius: var(--border-radius);
|
|
237
|
+
font-size: 12px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
li span {
|
|
241
|
+
display: block;
|
|
242
|
+
position: absolute;
|
|
243
|
+
width: 100%;
|
|
244
|
+
height: 100%;
|
|
245
|
+
background-color: rgba(255, 255, 255, 0.8);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@media screen and (max-width: 480px) {
|
|
249
|
+
:host {
|
|
250
|
+
margin: var(--margin-narrow);
|
|
251
|
+
max-width: 46%;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:host([mode='detail']) {
|
|
255
|
+
max-width: initial;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
[desc] {
|
|
259
|
+
padding: var(--padding-narrow);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
:host([mode='detail']) > [desc] {
|
|
263
|
+
max-width: 125px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
[desc] [detail-info] {
|
|
267
|
+
height: 38px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
[desc] span {
|
|
271
|
+
font-size: 36px;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
`
|
|
275
|
+
];
|
|
276
|
+
__decorate([
|
|
277
|
+
property({ type: Object }),
|
|
278
|
+
__metadata("design:type", Object)
|
|
279
|
+
], ScenarioMonitor.prototype, "scenario", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
property({ type: String }),
|
|
282
|
+
__metadata("design:type", String)
|
|
283
|
+
], ScenarioMonitor.prototype, "mode", void 0);
|
|
284
|
+
ScenarioMonitor = __decorate([
|
|
285
|
+
customElement('scenario-monitor')
|
|
286
|
+
], ScenarioMonitor);
|
|
287
|
+
export { ScenarioMonitor };
|
|
288
|
+
//# sourceMappingURL=scenario-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-monitor.js","sourceRoot":"","sources":["../../client/viewparts/scenario-monitor.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,2BAA2B,CAAA;AAClC,OAAO,6BAA6B,CAAA;AAEpC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,M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;SACH,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAQ;QACzB,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACjC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE;gBACT,YAAY,EAAE,QAAQ,CAAC,IAAI;aAC5B;SACF,CAAC,CAAA;QAEF,MAAM,CAAC;YACL,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,GAAG,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,uBACpF,QAAQ,CAAC,IACX,EAAE;SACH,CAAC,CAAA;IACJ,CAAC;;AArRM,sBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8JF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAc;AACzC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAc;AArK9B,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CAuR3B;SAvRY,eAAe","sourcesContent":["import '@operato/data-grist'\nimport '@material/mwc-icon-button'\nimport './scenario-instance-monitor'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { ScrollbarStyles } from '@operato/styles'\n\nfunction IS_SCENARIO_RUNNING(state) {\n return state && state !== 'UNLOADED'\n}\n\n@customElement('scenario-monitor')\nexport class ScenarioMonitor extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: row;\n margin: var(--margin-default);\n\n border: var(--border-dark-color);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n border-radius: var(--border-radius);\n position: relative;\n overflow: hidden;\n }\n\n [desc] {\n position: relative;\n display: flex;\n flex-direction: column;\n padding: var(--padding-default);\n width: 200px;\n color: var(--secondary-color);\n font-size: var(--fontsize-small);\n }\n\n [desc] [detail-info] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 25px);\n height: 45px;\n }\n\n [desc] strong {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--fontsize-large);\n }\n\n [desc] span {\n display: block;\n position: absolute;\n top: 0px;\n right: var(--padding-default);\n font-size: 40px;\n font-weight: bold;\n text-align: right;\n }\n\n [desc] [schedule] * {\n vertical-align: middle;\n display: inline;\n }\n\n [desc] [schedule] {\n background-color: #f1f1f1;\n border-radius: 20px;\n margin: var(--margin-default) 0;\n padding: var(--padding-narrow);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 12px;\n line-height: 8px;\n }\n\n [buttons] {\n --mdc-icon-button-size: 24px;\n --mdc-icon-size: 24px;\n border-top: var(--border-dark-color);\n padding: var(--padding-narrow) 0 0 0;\n text-align: right;\n }\n\n [buttons] mwc-icon-button {\n color: var(--primary-color);\n }\n\n [buttons][detail] {\n display: flex;\n flex-direction: column-reverse;\n margin-bottom: auto;\n }\n\n [desc] mwc-icon {\n border-radius: 50%;\n color: var(--theme-white-color);\n font-size: 18px;\n }\n\n :host([mode='detail']) [schedule] {\n margin: var(--margin-default) 0 0 0;\n }\n\n :host([mode='detail']) [desc] [buttons] {\n display: none;\n }\n :host([mode='detail']) [buttons] {\n border-top: none;\n padding: var(--padding-default);\n }\n\n ul {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n ul > li {\n position: relative;\n margin: var(--margin-default);\n min-width: 140px;\n max-width: 180px;\n border: 1px solid black;\n border-radius: var(--border-radius);\n font-size: 12px;\n }\n\n li span {\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.8);\n }\n\n @media screen and (max-width: 480px) {\n :host {\n margin: var(--margin-narrow);\n max-width: 46%;\n }\n\n :host([mode='detail']) {\n max-width: initial;\n }\n\n [desc] {\n padding: var(--padding-narrow);\n }\n\n :host([mode='detail']) > [desc] {\n max-width: 125px;\n }\n\n [desc] [detail-info] {\n height: 38px;\n }\n\n [desc] span {\n font-size: 36px;\n }\n }\n `\n ]\n\n @property({ type: Object }) scenario: any\n @property({ type: String }) mode?: string\n\n render() {\n const scenario = this.scenario || {}\n const mode = this.mode\n\n const { id, name, description, schedule, color } = scenario\n const instances = scenario.instances || []\n\n return html`\n <div desc>\n <div detail-info>\n <strong>${name}</strong>\n ${description}\n <span>${instances.length}</span>\n </div>\n <div schedule>\n <mwc-icon .style=\"background-color: ${color};\">schedule</mwc-icon>\n <pre>${schedule}</pre>\n </div>\n ${this.renderButtons(scenario)}\n </div>\n\n ${mode === 'detail'\n ? html`\n <ul>\n ${instances.map(\n instance => html`\n <li .style=\"border-color:${color};background-color:${color}\">\n <span></span>\n <scenario-instance-monitor .instance=${instance} .color=${color}></scenario-instance-monitor>\n </li>\n `\n )}\n </ul>\n ${this.renderButtons(scenario)}\n `\n : html``}\n `\n }\n\n renderButtons(scenario) {\n const instances = scenario.instances || []\n const scenarioInstance = instances.find(instance => instance.instanceName == scenario.name)\n\n return html`\n <div buttons ?detail=${this.mode == 'detail'}>\n <mwc-icon-button @click=${e => this.popupLogView(scenario)} icon=\"text_snippet\"></mwc-icon-button>\n ${!scenarioInstance\n ? html` <mwc-icon-button\n icon=\"play_circle_outline\"\n @click=${e => this.startScenario(scenario)}\n ></mwc-icon-button>`\n : html`\n <mwc-icon-button\n icon=\"pause_circle_outline\"\n @click=${e => this.stopScenario(scenario)}\n stop\n ></mwc-icon-button>\n `}\n </div>\n `\n }\n\n async popupLogView(scenario) {\n openPopup(html` <scenario-instance-log-view .scenarioName=${scenario.name}></scenario-instance-log-view> `, {\n size: 'large',\n title: `${i18next.t('title.scenario-log')} (${scenario.name})`\n })\n }\n\n async startScenario(scenario) {\n var response = await client.mutate({\n mutation: gql`\n mutation ($scenarioName: String!) {\n startScenario(scenarioName: $scenarioName) {\n state\n }\n }\n `,\n variables: {\n scenarioName: scenario.name\n }\n })\n\n notify({\n level: 'info',\n message: `${!IS_SCENARIO_RUNNING(response.data.startScenario.state) ? 'fail' : 'success'} to start instance : ${\n scenario.name\n }`\n })\n }\n\n async stopScenario(scenario) {\n var response = await client.mutate({\n mutation: gql`\n mutation ($instanceName: String!) {\n stopScenario(instanceName: $instanceName) {\n state\n }\n }\n `,\n variables: {\n instanceName: scenario.name\n }\n })\n\n notify({\n level: 'info',\n message: `${IS_SCENARIO_RUNNING(response.data.stopScenario.state) ? 'fail' : 'success'} to stop instance : ${\n scenario.name\n }`\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import '@material/mwc-icon-button';
|
|
3
|
+
import './scenario-monitor';
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
declare const ScenariosMonitor_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
6
|
+
export declare class ScenariosMonitor extends ScenariosMonitor_base {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
scenarios: any;
|
|
9
|
+
mode?: string;
|
|
10
|
+
filter?: string;
|
|
11
|
+
pendings: any;
|
|
12
|
+
colorIndex: any;
|
|
13
|
+
running: boolean;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|