@api-client/ui 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bindings/base/StoreBindings.d.ts +1 -10
- package/dist/bindings/base/StoreBindings.d.ts.map +1 -1
- package/dist/bindings/base/StoreBindings.js +7 -98
- package/dist/bindings/base/StoreBindings.js.map +1 -1
- package/dist/elements/authorization/ui/CcAuthorization.d.ts +5 -3
- package/dist/elements/authorization/ui/CcAuthorization.d.ts.map +1 -1
- package/dist/elements/authorization/ui/CcAuthorization.js +21 -16
- package/dist/elements/authorization/ui/CcAuthorization.js.map +1 -1
- package/dist/elements/project/HttpProjectRequest.d.ts +6 -0
- package/dist/elements/project/HttpProjectRequest.d.ts.map +1 -1
- package/dist/elements/project/HttpProjectRequest.js +29 -4
- package/dist/elements/project/HttpProjectRequest.js.map +1 -1
- package/dist/elements/project/HttpProjectRequestHistory.d.ts +5 -3
- package/dist/elements/project/HttpProjectRequestHistory.d.ts.map +1 -1
- package/dist/elements/project/HttpProjectRequestHistory.js +53 -42
- package/dist/elements/project/HttpProjectRequestHistory.js.map +1 -1
- package/dist/elements/project/ProjectRunner.d.ts +11 -3
- package/dist/elements/project/ProjectRunner.d.ts.map +1 -1
- package/dist/elements/project/ProjectRunner.js +60 -20
- package/dist/elements/project/ProjectRunner.js.map +1 -1
- package/dist/elements/schema-design/DataModelVisualizationElement.d.ts.map +1 -1
- package/dist/elements/schema-design/DataModelVisualizationElement.js +18 -1
- package/dist/elements/schema-design/DataModelVisualizationElement.js.map +1 -1
- package/dist/events/EventTypes.d.ts +7 -23
- package/dist/events/EventTypes.d.ts.map +1 -1
- package/dist/events/EventTypes.js +7 -23
- package/dist/events/EventTypes.js.map +1 -1
- package/dist/events/Events.d.ts +0 -8
- package/dist/events/Events.d.ts.map +1 -1
- package/dist/events/StoreEvents.d.ts +1 -9
- package/dist/events/StoreEvents.d.ts.map +1 -1
- package/dist/events/StoreEvents.js +1 -21
- package/dist/events/StoreEvents.js.map +1 -1
- package/dist/events/http-client/models/CertificatesEvents.d.ts +1 -18
- package/dist/events/http-client/models/CertificatesEvents.d.ts.map +1 -1
- package/dist/events/http-client/models/CertificatesEvents.js +2 -24
- package/dist/events/http-client/models/CertificatesEvents.js.map +1 -1
- package/dist/pages/http-project/HttpProject.screen.d.ts +7 -0
- package/dist/pages/http-project/HttpProject.screen.d.ts.map +1 -1
- package/dist/pages/http-project/HttpProject.screen.js +11 -1
- package/dist/pages/http-project/HttpProject.screen.js.map +1 -1
- package/dist/pages/http-project/HttpProject.styles.d.ts.map +1 -1
- package/dist/pages/http-project/HttpProject.styles.js +2 -1
- package/dist/pages/http-project/HttpProject.styles.js.map +1 -1
- package/package.json +1 -1
- package/src/bindings/base/StoreBindings.ts +7 -101
- package/src/elements/authorization/ui/CcAuthorization.ts +24 -19
- package/src/elements/project/HttpProjectRequest.ts +33 -4
- package/src/elements/project/HttpProjectRequestHistory.ts +58 -48
- package/src/elements/project/ProjectRunner.ts +69 -22
- package/src/elements/schema-design/DataModelVisualizationElement.ts +18 -1
- package/src/events/EventTypes.ts +7 -23
- package/src/events/StoreEvents.ts +1 -23
- package/src/events/http-client/models/CertificatesEvents.ts +1 -29
- package/src/pages/http-project/HttpProject.screen.ts +12 -1
- package/src/pages/http-project/HttpProject.styles.ts +2 -1
- package/test/events/EventTypes.test.ts +22 -60
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { html, nothing, TemplateResult } from "lit";
|
|
2
2
|
import { state } from "lit/decorators.js";
|
|
3
3
|
import {
|
|
4
|
-
ICCAuthorization, HttpCertificate, Events as CoreEvents,
|
|
5
|
-
ContextStateDeleteEvent,
|
|
4
|
+
ICCAuthorization, HttpCertificate, Events as CoreEvents,
|
|
6
5
|
ICertificate,
|
|
6
|
+
BroadcastEvent,
|
|
7
|
+
BroadcastCreatedEvent,
|
|
8
|
+
DeletedBroadcastEvent,
|
|
7
9
|
} from '@api-client/core/build/browser.js';
|
|
8
10
|
import '@github/relative-time-element';
|
|
9
11
|
import { Authorization } from "./Authorization.js";
|
|
12
|
+
import { Events } from "../../../events/Events.js";
|
|
13
|
+
import type RadioElement from "../../../ui/input/RadioElement.js";
|
|
14
|
+
import { StoreBroadcast } from "../../../http-client/store/StoreBroadcast.js";
|
|
10
15
|
import '../../../define/ui/ui-button.js';
|
|
11
16
|
import '../../../define/ui/ui-radio.js';
|
|
12
|
-
import { Events } from "../../../events/Events.js";
|
|
13
|
-
import { EventTypes } from "../../../events/EventTypes.js";
|
|
14
|
-
import RadioElement from "../../../ui/input/RadioElement.js";
|
|
15
17
|
|
|
16
18
|
export default class CcAuthorization extends Authorization {
|
|
17
19
|
@state() items?: ICertificate[];
|
|
@@ -20,32 +22,36 @@ export default class CcAuthorization extends Authorization {
|
|
|
20
22
|
|
|
21
23
|
@state() loadingError?: string;
|
|
22
24
|
|
|
25
|
+
channel = new BroadcastChannel(StoreBroadcast.certificates);
|
|
26
|
+
|
|
23
27
|
constructor() {
|
|
24
28
|
super();
|
|
25
29
|
|
|
26
|
-
this.
|
|
27
|
-
this.handleCertificateDeleted = this.handleCertificateDeleted.bind(this);
|
|
30
|
+
this.handleBroadcast = this.handleBroadcast.bind(this);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
override connectedCallback(): void {
|
|
31
34
|
super.connectedCallback();
|
|
32
|
-
this.
|
|
33
|
-
this.eventsTarget.addEventListener(EventTypes.HttpClient.Model.Certificate.State.delete, this.handleCertificateDeleted);
|
|
35
|
+
this.channel.addEventListener('message', this.handleBroadcast);
|
|
34
36
|
this.queryCertificates();
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
override disconnectedCallback(): void {
|
|
38
40
|
super.disconnectedCallback();
|
|
39
|
-
this.
|
|
40
|
-
this.eventsTarget.removeEventListener(EventTypes.HttpClient.Model.Certificate.State.delete, this.handleCertificateDeleted);
|
|
41
|
+
this.channel.removeEventListener('message', this.handleBroadcast);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
protected
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
protected handleBroadcast(e: MessageEvent): void {
|
|
45
|
+
const event = e.data as BroadcastEvent;
|
|
46
|
+
switch (event.operation) {
|
|
47
|
+
case 'created': this.handleCreated(event as BroadcastCreatedEvent); break;
|
|
48
|
+
case 'deleted': this.handleDeleted(event as DeletedBroadcastEvent); break;
|
|
49
|
+
default:
|
|
48
50
|
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
protected handleCreated(event: BroadcastCreatedEvent): void {
|
|
54
|
+
const cert = event.data as ICertificate;
|
|
49
55
|
if (!this.items) {
|
|
50
56
|
this.items = [];
|
|
51
57
|
}
|
|
@@ -58,12 +64,11 @@ export default class CcAuthorization extends Authorization {
|
|
|
58
64
|
this.requestUpdate();
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
protected
|
|
67
|
+
protected handleDeleted(event: DeletedBroadcastEvent): void {
|
|
62
68
|
if (!this.items) {
|
|
63
69
|
return;
|
|
64
70
|
}
|
|
65
|
-
const
|
|
66
|
-
const { key } = e.detail;
|
|
71
|
+
const { key } = event;
|
|
67
72
|
const index = this.items.findIndex(i => i.key === key);
|
|
68
73
|
if (index >= 0) {
|
|
69
74
|
this.items.splice(index, 1);
|
|
@@ -35,6 +35,12 @@ function stopEvent(e: Event): void {
|
|
|
35
35
|
* The element will hook-up to the events to support project mutations.
|
|
36
36
|
*/
|
|
37
37
|
export default class HttpProjectRequest extends RequestEditor {
|
|
38
|
+
/**
|
|
39
|
+
* A reference to the global shared variables.
|
|
40
|
+
* Used with the communication with the execution server.
|
|
41
|
+
*/
|
|
42
|
+
@property({ type: Object }) sharedVariables?: Record<string, string>;
|
|
43
|
+
|
|
38
44
|
/**
|
|
39
45
|
* The source project
|
|
40
46
|
*/
|
|
@@ -272,11 +278,15 @@ export default class HttpProjectRequest extends RequestEditor {
|
|
|
272
278
|
}
|
|
273
279
|
|
|
274
280
|
protected prepareProxyInit(project: HttpProject, key: string, request: ProjectRequest): IHttpProjectProxyInit | IHttpProjectStoreProxyInit {
|
|
281
|
+
const { sharedVariables } = this;
|
|
275
282
|
const options: IProjectRunnerOptions = {
|
|
276
283
|
environment: request.environment,
|
|
277
284
|
request: [key],
|
|
278
285
|
recursive: true,
|
|
279
286
|
};
|
|
287
|
+
if (sharedVariables) {
|
|
288
|
+
options.variables = sharedVariables;
|
|
289
|
+
}
|
|
280
290
|
if (this.useNetStore) {
|
|
281
291
|
return {
|
|
282
292
|
kind: HttpProjectKind,
|
|
@@ -309,14 +319,33 @@ export default class HttpProjectRequest extends RequestEditor {
|
|
|
309
319
|
const init = this.prepareProxyInit(project, key, projectRequest);
|
|
310
320
|
this.loading = true;
|
|
311
321
|
const result = await this.proxyRequest(init);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
322
|
+
if (result && result.result) {
|
|
323
|
+
const [iteration] = result.result.iterations;
|
|
324
|
+
if (iteration) {
|
|
325
|
+
const { executed, variables } = iteration;
|
|
326
|
+
if (variables) {
|
|
327
|
+
this.mergeExecutedVariables(variables);
|
|
328
|
+
}
|
|
329
|
+
const [report] = executed;
|
|
330
|
+
if (report) {
|
|
331
|
+
this.addHistory(report);
|
|
332
|
+
this.requestUpdate();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
316
335
|
}
|
|
317
336
|
this.loading = false;
|
|
318
337
|
}
|
|
319
338
|
|
|
339
|
+
mergeExecutedVariables(vars: Record<string, string>): void {
|
|
340
|
+
const { sharedVariables } = this;
|
|
341
|
+
if (!sharedVariables) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
Object.keys(vars).forEach((key) => {
|
|
345
|
+
sharedVariables[key] = vars[key];
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
320
349
|
protected async addHistory(report: IRequestLog): Promise<void> {
|
|
321
350
|
const { appInfo, project, key } = this;
|
|
322
351
|
if (!appInfo) {
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorResponse, IHttpHistory, IResponse, IRequestLog,
|
|
3
|
-
RequestLog, IHistoryRequestListOptions,
|
|
4
|
-
|
|
3
|
+
RequestLog, IHistoryRequestListOptions, BroadcastEvent,
|
|
4
|
+
HistoryCreatedBroadcastEvent,
|
|
5
|
+
HistoryDeletedBroadcastEvent,
|
|
5
6
|
} from "@api-client/core/build/browser.js";
|
|
6
7
|
import { TemplateResult, html, PropertyValues, nothing } from "lit";
|
|
7
8
|
import { property, state } from "lit/decorators.js";
|
|
8
9
|
import ApiElement from "../ApiElement.js";
|
|
9
10
|
import { relativeDay } from "../../lib/time/Conversion.js";
|
|
10
|
-
import { HttpHistoryChart
|
|
11
|
+
import { HttpHistoryChart } from '../../lib/chart/HttpHistoryChart.js';
|
|
11
12
|
import { statusTemplate, } from '../http/HttpStatus.js';
|
|
12
13
|
import { Events } from '../../events/Events.js';
|
|
13
|
-
import {
|
|
14
|
-
import SegmentedButton from "../../ui/button/SegmentedButton.js";
|
|
14
|
+
import { StoreBroadcast } from "../../http-client/store/StoreBroadcast.js";
|
|
15
|
+
import type SegmentedButton from "../../ui/button/SegmentedButton.js";
|
|
15
16
|
import UiDialog, { UiDialogClosingReason } from "../../ui/dialog/UiDialog.js";
|
|
16
17
|
import '@github/relative-time-element';
|
|
17
18
|
import { SnackNotifications } from "../../ui/notification/SnackNotifications.js";
|
|
18
|
-
import UiIconButton from "../../ui/button/UiIconButton.js";
|
|
19
|
+
import type UiIconButton from "../../ui/button/UiIconButton.js";
|
|
19
20
|
import '../../define/http/http-request-log.js';
|
|
20
21
|
import '../../define/ui/ui-icon.js';
|
|
21
22
|
import '../../define/ui/ui-button.js';
|
|
@@ -90,11 +91,12 @@ export default class HttpProjectRequestHistory extends ApiElement {
|
|
|
90
91
|
*/
|
|
91
92
|
protected pageCursor?: string;
|
|
92
93
|
|
|
94
|
+
channel = new BroadcastChannel(StoreBroadcast.history);
|
|
95
|
+
|
|
93
96
|
constructor() {
|
|
94
97
|
super();
|
|
95
98
|
|
|
96
|
-
this.
|
|
97
|
-
this.handleHistoryDeleted = this.handleHistoryDeleted.bind(this);
|
|
99
|
+
this.handleBroadcast = this.handleBroadcast.bind(this);
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
protected override willUpdate(cp: PropertyValues<this>): void {
|
|
@@ -110,14 +112,58 @@ export default class HttpProjectRequestHistory extends ApiElement {
|
|
|
110
112
|
|
|
111
113
|
override connectedCallback(): void {
|
|
112
114
|
super.connectedCallback();
|
|
113
|
-
|
|
114
|
-
window.addEventListener(EventTypes.Store.History.State.delete, this.handleHistoryDeleted as EventListenerOrEventListenerObject);
|
|
115
|
+
this.channel.addEventListener('message', this.handleBroadcast);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
override disconnectedCallback(): void {
|
|
118
119
|
super.disconnectedCallback();
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
this.channel.removeEventListener('message', this.handleBroadcast);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
protected handleBroadcast(e: MessageEvent): void {
|
|
124
|
+
const event = e.data as BroadcastEvent;
|
|
125
|
+
switch (event.operation) {
|
|
126
|
+
case 'created': this.handleHistoryCreated(event as HistoryCreatedBroadcastEvent); break;
|
|
127
|
+
case 'deleted': this.handleHistoryDeleted(event as HistoryDeletedBroadcastEvent); break;
|
|
128
|
+
default:
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
protected handleHistoryCreated(event: HistoryCreatedBroadcastEvent): void {
|
|
133
|
+
const { request, data } = event;
|
|
134
|
+
const item = data as IHttpHistory;
|
|
135
|
+
if (this.request !== request) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (item) {
|
|
139
|
+
this.addItem(item, true);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
protected handleHistoryDeleted(event: HistoryDeletedBroadcastEvent): void {
|
|
144
|
+
const { model, history } = this;
|
|
145
|
+
const { key, request } = event;
|
|
146
|
+
if (!model || !history || request !== this.request) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const historyIndex = history.findIndex(i => i.key === key);
|
|
150
|
+
if (historyIndex < 0) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
history.splice(historyIndex, 1);
|
|
154
|
+
for (const group of model) {
|
|
155
|
+
const index = group.findIndex(i => i.key === key);
|
|
156
|
+
if (index >= 0) {
|
|
157
|
+
group.splice(index, 1);
|
|
158
|
+
if (group.length === 0) {
|
|
159
|
+
const groupIndex = model.indexOf(group);
|
|
160
|
+
model.splice(groupIndex, 1);
|
|
161
|
+
}
|
|
162
|
+
this.requestUpdate();
|
|
163
|
+
this.setupVisibility();
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
121
167
|
}
|
|
122
168
|
|
|
123
169
|
protected setupVisibility(): void {
|
|
@@ -253,42 +299,6 @@ export default class HttpProjectRequestHistory extends ApiElement {
|
|
|
253
299
|
return result;
|
|
254
300
|
}
|
|
255
301
|
|
|
256
|
-
protected handleHistoryCreated(e: ContextStateUpdateEvent<IHttpHistory>): void {
|
|
257
|
-
const { item, parent } = e.detail;
|
|
258
|
-
if (this.request !== parent) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (item) {
|
|
262
|
-
this.addItem(item, true);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
protected handleHistoryDeleted(e: ContextStateDeleteEvent): void {
|
|
267
|
-
const { model, history } = this;
|
|
268
|
-
const { key, parent } = e.detail;
|
|
269
|
-
if (!model || !history || parent !== this.request) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const historyIndex = history.findIndex(i => i.key === key);
|
|
273
|
-
if (historyIndex < 0) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
history.splice(historyIndex, 1);
|
|
277
|
-
for (const group of model) {
|
|
278
|
-
const index = group.findIndex(i => i.key === key);
|
|
279
|
-
if (index >= 0) {
|
|
280
|
-
group.splice(index, 1);
|
|
281
|
-
if (group.length === 0) {
|
|
282
|
-
const groupIndex = model.indexOf(group);
|
|
283
|
-
model.splice(groupIndex, 1);
|
|
284
|
-
}
|
|
285
|
-
this.requestUpdate();
|
|
286
|
-
this.setupVisibility();
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
302
|
protected computeSelectedItem(): void {
|
|
293
303
|
const { history, selectedItem } = this;
|
|
294
304
|
this.renderedItem = undefined;
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
ProjectExecutionKind,
|
|
10
10
|
IProjectExecution,
|
|
11
11
|
IProjectExecutionListOptions,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
BroadcastEvent,
|
|
13
|
+
ProjectExecutionDeleteBroadcastEvent,
|
|
14
|
+
ProjectExecutionCreatedBroadcastEvent,
|
|
14
15
|
} from '@api-client/core/build/browser.js';
|
|
15
16
|
import ApiElement from '../ApiElement.js';
|
|
16
17
|
import type CheckboxElement from '../../ui/input/CheckboxElement.js';
|
|
17
18
|
import type Input from '../../ui/input/Input.js';
|
|
18
19
|
import { Events } from '../../events/Events.js';
|
|
19
|
-
import { EventTypes } from '../../events/EventTypes.js';
|
|
20
20
|
import '@github/relative-time-element';
|
|
21
21
|
import '../../define/http-project/project-run-report.js';
|
|
22
22
|
import '../../define/ui/ui-checkbox.js';
|
|
@@ -27,11 +27,18 @@ import '../../define/ui/ui-icon.js';
|
|
|
27
27
|
import '../../define/ui/ui-dropdown-list.js';
|
|
28
28
|
import '../../define/ui/ui-list.js';
|
|
29
29
|
import '../../define/ui/ui-list-item.js';
|
|
30
|
+
import { StoreBroadcast } from '../../http-client/store/StoreBroadcast.js';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @fires change - When the configuration of the runner change.
|
|
33
34
|
*/
|
|
34
35
|
export default class ProjectRunner extends ApiElement {
|
|
36
|
+
/**
|
|
37
|
+
* A reference to the global shared variables.
|
|
38
|
+
* Used with the communication with the execution server.
|
|
39
|
+
*/
|
|
40
|
+
@property({ type: Object }) sharedVariables?: Record<string, string>;
|
|
41
|
+
|
|
35
42
|
/**
|
|
36
43
|
* The instance of the current project.
|
|
37
44
|
*/
|
|
@@ -93,23 +100,22 @@ export default class ProjectRunner extends ApiElement {
|
|
|
93
100
|
*/
|
|
94
101
|
@state() renderedReport?: IProjectExecution;
|
|
95
102
|
|
|
103
|
+
channel = new BroadcastChannel(StoreBroadcast.projectRuns);
|
|
104
|
+
|
|
96
105
|
constructor() {
|
|
97
106
|
super();
|
|
98
107
|
|
|
99
|
-
this.
|
|
100
|
-
this.handleProjectRunDeleted = this.handleProjectRunDeleted.bind(this);
|
|
108
|
+
this.handleBroadcast = this.handleBroadcast.bind(this);
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
override connectedCallback(): void {
|
|
104
112
|
super.connectedCallback();
|
|
105
|
-
|
|
106
|
-
window.addEventListener(EventTypes.Store.ProjectRuns.State.delete, this.handleProjectRunDeleted as EventListenerOrEventListenerObject);
|
|
113
|
+
this.channel.addEventListener('message', this.handleBroadcast);
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
override disconnectedCallback(): void {
|
|
110
117
|
super.disconnectedCallback();
|
|
111
|
-
|
|
112
|
-
window.removeEventListener(EventTypes.Store.ProjectRuns.State.delete, this.handleProjectRunDeleted as EventListenerOrEventListenerObject);
|
|
118
|
+
this.channel.removeEventListener('message', this.handleBroadcast);
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
override willUpdate(cp: PropertyValues<this>): void {
|
|
@@ -119,6 +125,15 @@ export default class ProjectRunner extends ApiElement {
|
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
|
|
128
|
+
protected handleBroadcast(e: MessageEvent): void {
|
|
129
|
+
const event = e.data as BroadcastEvent;
|
|
130
|
+
switch (event.operation) {
|
|
131
|
+
case 'created': this.handleProjectRunCreated(event as ProjectExecutionCreatedBroadcastEvent); break;
|
|
132
|
+
case 'deleted': this.handleProjectRunDeleted(event as ProjectExecutionDeleteBroadcastEvent); break;
|
|
133
|
+
default:
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
122
137
|
protected setupRoot(): void {
|
|
123
138
|
const { project, folder } = this;
|
|
124
139
|
if (!project) {
|
|
@@ -134,16 +149,16 @@ export default class ProjectRunner extends ApiElement {
|
|
|
134
149
|
this.queryPageDebounce();
|
|
135
150
|
}
|
|
136
151
|
|
|
137
|
-
protected handleProjectRunCreated(
|
|
138
|
-
const {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
protected handleProjectRunCreated(event: ProjectExecutionCreatedBroadcastEvent): void {
|
|
153
|
+
const { project, folder } = this;
|
|
154
|
+
if (!project) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (project.key !== event.project) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const item = event.data as IProjectExecution;
|
|
161
|
+
if (folder && item.parent !== folder) {
|
|
147
162
|
return;
|
|
148
163
|
}
|
|
149
164
|
this.history.push(item);
|
|
@@ -151,9 +166,15 @@ export default class ProjectRunner extends ApiElement {
|
|
|
151
166
|
this.selectHistory(item.key);
|
|
152
167
|
}
|
|
153
168
|
|
|
154
|
-
protected handleProjectRunDeleted(
|
|
155
|
-
const { history } = this;
|
|
156
|
-
|
|
169
|
+
protected handleProjectRunDeleted(event: ProjectExecutionDeleteBroadcastEvent): void {
|
|
170
|
+
const { history, project } = this;
|
|
171
|
+
if (!project) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (project.key !== event.project) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const { key } = event;
|
|
157
178
|
const index = history.findIndex(i => i.key === key);
|
|
158
179
|
if (index < 0) {
|
|
159
180
|
return;
|
|
@@ -185,6 +206,13 @@ export default class ProjectRunner extends ApiElement {
|
|
|
185
206
|
if (folder) {
|
|
186
207
|
config.parent = folder;
|
|
187
208
|
}
|
|
209
|
+
// Note, we intentionally don't add shared variables.
|
|
210
|
+
// Project / folder execution should be contained and can only leak
|
|
211
|
+
// out the variables to the rest of the app, not in.
|
|
212
|
+
|
|
213
|
+
// if (sharedVariables && !config.variables) {
|
|
214
|
+
// config.variables = sharedVariables;
|
|
215
|
+
// }
|
|
188
216
|
const init: IHttpProjectProxyInit = {
|
|
189
217
|
kind: HttpProjectKind,
|
|
190
218
|
project: project.toJSON(),
|
|
@@ -197,6 +225,7 @@ export default class ProjectRunner extends ApiElement {
|
|
|
197
225
|
if (!result) {
|
|
198
226
|
this.lastError = 'The project execution event was not handled.';
|
|
199
227
|
} else {
|
|
228
|
+
this.mergeExecutedVariables(result.result);
|
|
200
229
|
this.createHistory(result.result);
|
|
201
230
|
}
|
|
202
231
|
} catch (e) {
|
|
@@ -205,6 +234,24 @@ export default class ProjectRunner extends ApiElement {
|
|
|
205
234
|
this.running = false;
|
|
206
235
|
}
|
|
207
236
|
|
|
237
|
+
mergeExecutedVariables(result: IProjectExecutionLog): void {
|
|
238
|
+
const { sharedVariables } = this;
|
|
239
|
+
if (!sharedVariables) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
result.iterations.forEach((iteration) => {
|
|
244
|
+
const { variables } = iteration;
|
|
245
|
+
if (!variables) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
Object.keys(variables).forEach((key) => {
|
|
249
|
+
sharedVariables[key] = variables[key];
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
208
255
|
protected async createHistory(result: IProjectExecutionLog): Promise<void> {
|
|
209
256
|
const { appInfo, project } = this;
|
|
210
257
|
if (!appInfo) {
|
|
@@ -106,6 +106,12 @@ export default class DataModelVisualizationElement extends ApiElement {
|
|
|
106
106
|
.data-type {
|
|
107
107
|
margin-left: auto;
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
.property-key-icon {
|
|
111
|
+
width: 16px;
|
|
112
|
+
height: 16px;
|
|
113
|
+
margin-right: 8px;
|
|
114
|
+
}
|
|
109
115
|
`,
|
|
110
116
|
];
|
|
111
117
|
}
|
|
@@ -361,8 +367,19 @@ export default class DataModelVisualizationElement extends ApiElement {
|
|
|
361
367
|
primary,
|
|
362
368
|
index,
|
|
363
369
|
};
|
|
370
|
+
|
|
371
|
+
const icons: TemplateResult[] = [];
|
|
372
|
+
if (primary) {
|
|
373
|
+
icons.push(html`<ui-icon icon="key" class="property-key-icon"></ui-icon>`);
|
|
374
|
+
} else if (index) {
|
|
375
|
+
icons.push(html`<ui-icon icon="search" class="property-key-icon"></ui-icon>`);
|
|
376
|
+
} else {
|
|
377
|
+
icons.push(html`<span class="property-key-icon"></span>`);
|
|
378
|
+
}
|
|
379
|
+
|
|
364
380
|
return html`
|
|
365
381
|
<li data-key="${key}" class="${classMap(classes)}">
|
|
382
|
+
${icons}
|
|
366
383
|
<span class="label">${info.renderLabel}</span>
|
|
367
384
|
<span class="data-type">${type}</span>
|
|
368
385
|
</li>
|
|
@@ -377,7 +394,7 @@ export default class DataModelVisualizationElement extends ApiElement {
|
|
|
377
394
|
if (targets.length === 1) {
|
|
378
395
|
return html`<viz-association
|
|
379
396
|
data-key="${key}"
|
|
380
|
-
data-target="${targets[0]}"
|
|
397
|
+
data-target="${targets[0].key}"
|
|
381
398
|
title="${info.renderLabel}"
|
|
382
399
|
data-selectable
|
|
383
400
|
data-marker-start="association"
|
package/src/events/EventTypes.ts
CHANGED
|
@@ -21,10 +21,6 @@ export const EventTypes = Object.freeze({
|
|
|
21
21
|
delete: 'storefilesdelete',
|
|
22
22
|
patchUsers: 'storefilespatchusers',
|
|
23
23
|
listUsers: 'storefileslistusers',
|
|
24
|
-
State: Object.freeze({
|
|
25
|
-
change: 'storefileschange',
|
|
26
|
-
fileChange: 'storefilechange',
|
|
27
|
-
}),
|
|
28
24
|
}),
|
|
29
25
|
User: Object.freeze({
|
|
30
26
|
me: 'storeuserme',
|
|
@@ -41,10 +37,6 @@ export const EventTypes = Object.freeze({
|
|
|
41
37
|
clearSpace: 'storehistoryclearspace',
|
|
42
38
|
clearProject: 'storehistoryclearproject',
|
|
43
39
|
clearRequest: 'storehistoryclearrequest',
|
|
44
|
-
State: Object.freeze({
|
|
45
|
-
create: 'storehistorystatecreate',
|
|
46
|
-
delete: 'storehistorystatedelete',
|
|
47
|
-
}),
|
|
48
40
|
}),
|
|
49
41
|
ProjectRuns: Object.freeze({
|
|
50
42
|
add: 'storeprojectrunsadd',
|
|
@@ -55,10 +47,13 @@ export const EventTypes = Object.freeze({
|
|
|
55
47
|
clearSpace: 'storeprojectrunsclearspace',
|
|
56
48
|
clearProject: 'storeprojectrunsclearproject',
|
|
57
49
|
clearParent: 'storeprojectrunsclearparent',
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
}),
|
|
51
|
+
Certificate: Object.freeze({
|
|
52
|
+
read: 'storeclientcertificateread',
|
|
53
|
+
list: 'storeclientcertificatelist',
|
|
54
|
+
delete: 'storeclientcertificatedelete',
|
|
55
|
+
update: 'storeclientcertificateupdate',
|
|
56
|
+
insert: 'storeclientcertificateinsert',
|
|
62
57
|
}),
|
|
63
58
|
}),
|
|
64
59
|
Config: Object.freeze({
|
|
@@ -151,17 +146,6 @@ export const EventTypes = Object.freeze({
|
|
|
151
146
|
destroyed: 'modeldestroyed',
|
|
152
147
|
restored: 'modelrestored',
|
|
153
148
|
|
|
154
|
-
Certificate: Object.freeze({
|
|
155
|
-
read: 'modelclientcertificateread',
|
|
156
|
-
list: 'modelclientcertificatelist',
|
|
157
|
-
delete: 'modelclientcertificatedelete',
|
|
158
|
-
update: 'modelclientcertificateupdate',
|
|
159
|
-
insert: 'modelclientcertificateinsert',
|
|
160
|
-
State: Object.freeze({
|
|
161
|
-
update: 'modelstateclientcertificateupdate',
|
|
162
|
-
delete: 'modelstateclientcertificatedelete',
|
|
163
|
-
}),
|
|
164
|
-
}),
|
|
165
149
|
UrlHistory: Object.freeze({
|
|
166
150
|
add: 'modelclienturlhistoryadd',
|
|
167
151
|
query: 'modelclienturlhistoryquery',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
IBackendInfo, IFile, IFileCreateOptions,
|
|
4
4
|
ListFileKind, AccessOperation, IUser, IPatchRevision, IApplication, IHttpHistory, IHttpHistoryBulkAdd, HistoryListOptions,
|
|
5
|
-
ContextChangeRecord,
|
|
5
|
+
ContextChangeRecord, ContextDeleteEvent, ContextDeleteBulkEvent, ContextListOptions, ContextListResult, IProjectExecution, IProjectExecutionListOptions, IBulkOperationResult,
|
|
6
6
|
} from '@api-client/core/build/browser.js';
|
|
7
7
|
import { Patch } from '@api-client/json';
|
|
8
8
|
import { IConfigEnvironment, IConfigInit } from '../lib/config/Config.js';
|
|
@@ -542,17 +542,6 @@ export const StoreEvents = Object.freeze({
|
|
|
542
542
|
target.dispatchEvent(e);
|
|
543
543
|
await e.detail.result;
|
|
544
544
|
},
|
|
545
|
-
|
|
546
|
-
State: Object.freeze({
|
|
547
|
-
create(record: ContextChangeRecord<IHttpHistory>, target: EventTarget = window): void {
|
|
548
|
-
const e = new ContextStateUpdateEvent(EventTypes.Store.History.State.create, record);
|
|
549
|
-
target.dispatchEvent(e);
|
|
550
|
-
},
|
|
551
|
-
delete(record: ContextDeleteRecord, target: EventTarget = window): void {
|
|
552
|
-
const e = new ContextStateDeleteEvent(EventTypes.Store.History.State.delete, record);
|
|
553
|
-
target.dispatchEvent(e);
|
|
554
|
-
}
|
|
555
|
-
}),
|
|
556
545
|
}),
|
|
557
546
|
ProjectRuns: Object.freeze({
|
|
558
547
|
/**
|
|
@@ -690,16 +679,5 @@ export const StoreEvents = Object.freeze({
|
|
|
690
679
|
target.dispatchEvent(e);
|
|
691
680
|
await e.detail.result;
|
|
692
681
|
},
|
|
693
|
-
|
|
694
|
-
State: Object.freeze({
|
|
695
|
-
create(record: ContextChangeRecord<IProjectExecution>, target: EventTarget = window): void {
|
|
696
|
-
const e = new ContextStateUpdateEvent(EventTypes.Store.ProjectRuns.State.create, record);
|
|
697
|
-
target.dispatchEvent(e);
|
|
698
|
-
},
|
|
699
|
-
delete(record: ContextDeleteRecord, target: EventTarget = window): void {
|
|
700
|
-
const e = new ContextStateDeleteEvent(EventTypes.Store.ProjectRuns.State.delete, record);
|
|
701
|
-
target.dispatchEvent(e);
|
|
702
|
-
}
|
|
703
|
-
}),
|
|
704
682
|
}),
|
|
705
683
|
});
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
2
|
import {
|
|
3
|
-
ContextChangeRecord,
|
|
4
|
-
ContextDeleteRecord,
|
|
5
3
|
ContextListEvent,
|
|
6
4
|
ContextListResult,
|
|
7
5
|
ContextSpaceListOptions,
|
|
8
|
-
ContextStateDeleteEvent,
|
|
9
|
-
ContextStateUpdateEvent,
|
|
10
6
|
HttpCertificate
|
|
11
7
|
} from '@api-client/core/build/browser.js';
|
|
12
8
|
import { EventTypes } from '../../EventTypes.js';
|
|
@@ -20,32 +16,8 @@ export class CertificatesEvents {
|
|
|
20
16
|
* @returns The list result.
|
|
21
17
|
*/
|
|
22
18
|
static async list(opts: ContextSpaceListOptions, target: EventTarget = window): Promise<ContextListResult<HttpCertificate> | undefined> {
|
|
23
|
-
const e = new ContextListEvent(EventTypes.
|
|
19
|
+
const e = new ContextListEvent(EventTypes.Store.Certificate.list, opts);
|
|
24
20
|
target.dispatchEvent(e);
|
|
25
21
|
return e.detail.result as Promise<ContextListResult<HttpCertificate> | undefined>;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
|
-
static State = class {
|
|
29
|
-
/**
|
|
30
|
-
* Dispatches an event after a client certificate was updated
|
|
31
|
-
*
|
|
32
|
-
* @param record Change record
|
|
33
|
-
* @param target A node on which to dispatch the event.
|
|
34
|
-
*/
|
|
35
|
-
static update(record: ContextChangeRecord<HttpCertificate>, target: EventTarget = window): void {
|
|
36
|
-
const e = new ContextStateUpdateEvent(EventTypes.HttpClient.Model.Certificate.State.update, record);
|
|
37
|
-
target.dispatchEvent(e);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Dispatches an event after a client certificate was deleted
|
|
42
|
-
*
|
|
43
|
-
* @param record Certificate delete record.
|
|
44
|
-
* @param target A node on which to dispatch the event.
|
|
45
|
-
*/
|
|
46
|
-
static delete(record: ContextDeleteRecord, target: EventTarget = window): void {
|
|
47
|
-
const e = new ContextStateDeleteEvent(EventTypes.HttpClient.Model.Certificate.State.delete, record);
|
|
48
|
-
target.dispatchEvent(e);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
23
|
}
|