@api-client/ui 0.0.7 → 0.0.9
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 +11 -102
- 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/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 +11 -105
- 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/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,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) {
|
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
|
}
|
|
@@ -114,6 +114,14 @@ export default class HttpProjectScreen extends ApplicationScreen {
|
|
|
114
114
|
|
|
115
115
|
protected uiMap = new Map<string, IRequestUiMeta>();
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
* A list of shared execution variables.
|
|
119
|
+
* These are set by the core execution logic and distributed to the UI elements
|
|
120
|
+
* that make HTTP request. These elements can freely change the sate and send it
|
|
121
|
+
* to the execution.
|
|
122
|
+
*/
|
|
123
|
+
sharedVariables: Record<string, string> = {};
|
|
124
|
+
|
|
117
125
|
constructor(bindings: HttpClientProjectBindings) {
|
|
118
126
|
super(bindings);
|
|
119
127
|
|
|
@@ -153,6 +161,7 @@ export default class HttpProjectScreen extends ApplicationScreen {
|
|
|
153
161
|
|
|
154
162
|
await this.bindings.store.observeFile(this.key, 'media');
|
|
155
163
|
await this.bindings.store.observeHistory();
|
|
164
|
+
await this.bindings.store.observeProjectExecutions();
|
|
156
165
|
|
|
157
166
|
this.layoutStoreKey = `http-client.http-project.state.layout.${this.key}`;
|
|
158
167
|
const state = await this.restoreLayout();
|
|
@@ -778,6 +787,7 @@ export default class HttpProjectScreen extends ApplicationScreen {
|
|
|
778
787
|
<div class="request-container surface1" ?hidden="${!visible}" data-key="${key}">
|
|
779
788
|
<div class="scrollable">
|
|
780
789
|
<http-project-request
|
|
790
|
+
.sharedVariables="${this.sharedVariables}"
|
|
781
791
|
data-key="${key}"
|
|
782
792
|
key="${key}"
|
|
783
793
|
.project="${project}"
|
|
@@ -831,9 +841,10 @@ export default class HttpProjectScreen extends ApplicationScreen {
|
|
|
831
841
|
const config = item.value as IProjectRunnerOptions | undefined;
|
|
832
842
|
|
|
833
843
|
return html`
|
|
834
|
-
<div class="
|
|
844
|
+
<div class="project-runner-content surface1" ?hidden="${!visible}" data-key="${key}">
|
|
835
845
|
<div class="scrollable">
|
|
836
846
|
<project-runner
|
|
847
|
+
.sharedVariables="${this.sharedVariables}"
|
|
837
848
|
.project="${this.project}"
|
|
838
849
|
.appInfo="${AppInfo}"
|
|
839
850
|
.folder="${parent}"
|
|
@@ -42,47 +42,6 @@ describe('events', () => {
|
|
|
42
42
|
ensureUnique('EventTypes.HttpClient.Workspace.State', EventTypes.HttpClient.Workspace.State);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
describe('Model', () => {
|
|
47
|
-
describe('Certificate', () => {
|
|
48
|
-
it('has Certificate namespace', () => {
|
|
49
|
-
assert.typeOf(EventTypes.HttpClient.Model.Certificate, 'object');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
[
|
|
53
|
-
['read', 'modelclientcertificateread'],
|
|
54
|
-
['list', 'modelclientcertificatelist'],
|
|
55
|
-
['delete', 'modelclientcertificatedelete'],
|
|
56
|
-
['update', 'modelclientcertificateupdate'],
|
|
57
|
-
['insert', 'modelclientcertificateinsert'],
|
|
58
|
-
].forEach(([prop, value]) => {
|
|
59
|
-
it(`has ${prop} property`, () => {
|
|
60
|
-
assert.equal(EventTypes.HttpClient.Model.Certificate[prop], value);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('has the State namespace', () => {
|
|
65
|
-
assert.typeOf(EventTypes.HttpClient.Model.Certificate.State, 'object');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
[
|
|
69
|
-
['update', 'modelstateclientcertificateupdate'],
|
|
70
|
-
['delete', 'modelstateclientcertificatedelete'],
|
|
71
|
-
].forEach(([prop, value]) => {
|
|
72
|
-
it(`has ${prop} property`, () => {
|
|
73
|
-
assert.equal(EventTypes.HttpClient.Model.Certificate.State[prop], value);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('has unique events', () => {
|
|
78
|
-
ensureUnique('EventTypes.HttpClient.Model.Certificate', EventTypes.HttpClient.Model.Certificate);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('has unique events on the State namespace', () => {
|
|
82
|
-
ensureUnique('EventTypes.HttpClient.Model.Certificate.State', EventTypes.HttpClient.Model.Certificate.State);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
45
|
});
|
|
87
46
|
|
|
88
47
|
describe('SchemaDesign', () => {
|
|
@@ -314,25 +273,6 @@ describe('events', () => {
|
|
|
314
273
|
});
|
|
315
274
|
});
|
|
316
275
|
|
|
317
|
-
describe('File.State namespace', () => {
|
|
318
|
-
it('has the namespace', () => {
|
|
319
|
-
assert.typeOf(EventTypes.Store, 'object');
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
[
|
|
323
|
-
['change', 'storefileschange'],
|
|
324
|
-
['fileChange', 'storefilechange'],
|
|
325
|
-
].forEach(([prop, value]) => {
|
|
326
|
-
it(`has ${prop} property`, () => {
|
|
327
|
-
assert.equal(EventTypes.Store.File.State[prop], value);
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('has unique events', () => {
|
|
332
|
-
ensureUnique('EventTypes.Store.File.State', EventTypes.Store.File.State);
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
276
|
describe('User namespace', () => {
|
|
337
277
|
it('has the namespace', () => {
|
|
338
278
|
assert.typeOf(EventTypes.Store, 'object');
|
|
@@ -374,6 +314,28 @@ describe('events', () => {
|
|
|
374
314
|
ensureUnique('EventTypes.Store.History', EventTypes.Store.History);
|
|
375
315
|
});
|
|
376
316
|
});
|
|
317
|
+
|
|
318
|
+
describe('Certificate namespace', () => {
|
|
319
|
+
it('has Certificate namespace', () => {
|
|
320
|
+
assert.typeOf(EventTypes.Store.Certificate, 'object');
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
[
|
|
324
|
+
['read', 'storeclientcertificateread'],
|
|
325
|
+
['list', 'storeclientcertificatelist'],
|
|
326
|
+
['delete', 'storeclientcertificatedelete'],
|
|
327
|
+
['update', 'storeclientcertificateupdate'],
|
|
328
|
+
['insert', 'storeclientcertificateinsert'],
|
|
329
|
+
].forEach(([prop, value]) => {
|
|
330
|
+
it(`has ${prop} property`, () => {
|
|
331
|
+
assert.equal(EventTypes.Store.Certificate[prop], value);
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('has unique events', () => {
|
|
336
|
+
ensureUnique('EventTypes.HttpClient.Model.Certificate', EventTypes.Store.Certificate);
|
|
337
|
+
});
|
|
338
|
+
});
|
|
377
339
|
});
|
|
378
340
|
|
|
379
341
|
describe('Config', () => {
|