@xpert-ai/plugin-live-dashboard 0.4.1 → 0.6.0
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/.xpertai-plugin/plugin.json +1 -1
- package/README.md +8 -2
- package/dist/index.js +3 -1
- package/dist/lib/agent.schema.d.ts +177 -23
- package/dist/lib/agent.schema.js +11 -9
- package/dist/lib/archive.service.d.ts +169 -0
- package/dist/lib/archive.service.js +147 -0
- package/dist/lib/bounded-map.d.ts +2 -0
- package/dist/lib/bounded-map.js +25 -0
- package/dist/lib/capacity.d.ts +14 -0
- package/dist/lib/capacity.js +16 -0
- package/dist/lib/content.provider.d.ts +1 -1
- package/dist/lib/dashboard-archive.d.ts +70 -0
- package/dist/lib/dashboard-archive.js +118 -0
- package/dist/lib/dashboard-queries.d.ts +1 -1
- package/dist/lib/dashboard-queries.js +11 -6
- package/dist/lib/dashboard-receipt.js +1 -1
- package/dist/lib/dashboard-sources.d.ts +69 -0
- package/dist/lib/dashboard-sources.js +38 -0
- package/dist/lib/dashboard-view.schema.d.ts +422 -88
- package/dist/lib/dashboard.schema.d.ts +379 -58
- package/dist/lib/dashboard.schema.js +20 -2
- package/dist/lib/dashboard.service.d.ts +80 -15
- package/dist/lib/dashboard.service.js +65 -9
- package/dist/lib/definition-tools.d.ts +4 -4
- package/dist/lib/document-host.js +1 -1
- package/dist/lib/document-package.d.ts +19 -4
- package/dist/lib/editing-patch.d.ts +3 -0
- package/dist/lib/editing-patch.js +4 -2
- package/dist/lib/editing-session.d.ts +4 -4
- package/dist/lib/editing.d.ts +204 -20
- package/dist/lib/editing.js +10 -3
- package/dist/lib/filter-evidence.d.ts +28 -0
- package/dist/lib/filter-evidence.js +3 -2
- package/dist/lib/html-guidance.d.ts +1 -0
- package/dist/lib/html-guidance.js +2 -1
- package/dist/lib/html-validation-feedback.d.ts +7 -0
- package/dist/lib/html-validation-feedback.js +19 -0
- package/dist/lib/html-validation.js +3 -2
- package/dist/lib/inspection-host.d.ts +7 -0
- package/dist/lib/inspection-host.js +48 -0
- package/dist/lib/inspection-runtime.d.ts +2 -0
- package/dist/lib/inspection-runtime.js +77 -0
- package/dist/lib/json-input.d.ts +4 -0
- package/dist/lib/json-input.js +21 -0
- package/dist/lib/middleware.d.ts +3 -1
- package/dist/lib/middleware.js +92 -13
- package/dist/lib/plugin.js +3 -1
- package/dist/lib/presentation.provider.d.ts +24 -9
- package/dist/lib/presentation.provider.js +2 -1
- package/dist/lib/preview-retry.d.ts +4 -3
- package/dist/lib/preview-retry.js +13 -7
- package/dist/lib/prompt-workflows.js +1 -1
- package/dist/lib/query-session.d.ts +9 -0
- package/dist/lib/query-session.js +64 -0
- package/dist/lib/save-requests.d.ts +118 -0
- package/dist/lib/save-requests.js +199 -0
- package/dist/lib/source-executions.d.ts +437 -0
- package/dist/lib/source-executions.js +49 -0
- package/dist/lib/source-validation.d.ts +2 -0
- package/dist/lib/source-validation.js +21 -0
- package/dist/lib/view.provider.d.ts +213 -8
- package/dist/lib/view.provider.js +47 -5
- package/dist/remote/app.css +1 -1
- package/dist/remote/app.js +185 -63
- package/dist/remote/build-manifest.json +52 -33
- package/dist/sandbox-actions/action.json +1 -1
- package/dist/sandbox-actions/bundle/host.js +63 -14
- package/dist/sandbox-actions/bundle/validate.mjs +2 -2
- package/dist/validation/host-entry.d.ts +5 -1
- package/dist/validation/host-entry.js +21 -4
- package/docs/docs.json +5 -1
- package/docs/large-dashboards-acceptance.mdx +74 -0
- package/docs/large-dashboards.mdx +80 -0
- package/docs/sources-inspect-portability-acceptance.mdx +67 -0
- package/docs/sources-inspect-portability.mdx +115 -0
- package/package.json +8 -7
- package/skills/live-dashboard/SKILL.md +5 -4
- package/skills/live-dashboard/references/source-inspection.md +17 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { DashboardSaveRequests } from './save-requests';
|
|
1
2
|
import { DashboardProjectsService } from './projects.service';
|
|
2
|
-
import type { XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewQuery } from '@xpert-ai/contracts';
|
|
3
|
-
import { type IXpertViewExtensionProvider } from '@xpert-ai/plugin-sdk';
|
|
3
|
+
import type { XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewQuery, XpertViewFileAccessRequest } from '@xpert-ai/contracts';
|
|
4
|
+
import { type IXpertViewExtensionProvider, type XpertViewFileActionFile } from '@xpert-ai/plugin-sdk';
|
|
4
5
|
import { DashboardService } from './dashboard.service';
|
|
5
6
|
import { DashboardSharingService } from './sharing.service';
|
|
7
|
+
import { DashboardArchiveService } from './archive.service';
|
|
6
8
|
export declare const VIEW_KEY = "live-dashboard";
|
|
7
9
|
export declare const VIEW_PROVIDER = "live-dashboard";
|
|
8
10
|
export declare const FEATURE = "live_dashboard";
|
|
@@ -10,7 +12,9 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
10
12
|
private readonly service;
|
|
11
13
|
private readonly sharing;
|
|
12
14
|
private readonly projects;
|
|
13
|
-
|
|
15
|
+
private readonly archives;
|
|
16
|
+
private readonly saves?;
|
|
17
|
+
constructor(service: DashboardService, sharing: DashboardSharingService, projects: DashboardProjectsService, archives: DashboardArchiveService, saves?: DashboardSaveRequests | undefined);
|
|
14
18
|
supports(context: XpertResolvedViewHostContext): boolean;
|
|
15
19
|
getViewManifests(context: XpertResolvedViewHostContext, slot: string): XpertExtensionViewManifest[];
|
|
16
20
|
getRemoteComponentEntry(): Promise<{
|
|
@@ -57,9 +61,9 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
57
61
|
} | {
|
|
58
62
|
saved: {
|
|
59
63
|
manifest: {
|
|
60
|
-
schema: "xpert.live-dashboard";
|
|
61
|
-
id: string;
|
|
62
64
|
title: string;
|
|
65
|
+
id: string;
|
|
66
|
+
schema: "xpert.live-dashboard";
|
|
63
67
|
bindings: import("@xpert-ai/contracts").AnalyticsBinding[];
|
|
64
68
|
controls: {
|
|
65
69
|
type: "string" | "number" | "boolean" | "date";
|
|
@@ -70,19 +74,34 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
70
74
|
}[];
|
|
71
75
|
charts: {
|
|
72
76
|
type: "bar" | "line" | "area" | "pie" | "scatter";
|
|
73
|
-
id: string;
|
|
74
77
|
title: string;
|
|
78
|
+
id: string;
|
|
75
79
|
datasetId: string;
|
|
76
80
|
x: string;
|
|
77
81
|
y: string;
|
|
78
82
|
color?: string | undefined;
|
|
79
83
|
}[];
|
|
80
84
|
tables: {
|
|
81
|
-
id: string;
|
|
82
85
|
title: string;
|
|
86
|
+
id: string;
|
|
83
87
|
datasetId: string;
|
|
84
88
|
fields: string[];
|
|
85
89
|
}[];
|
|
90
|
+
sourceMetadata?: {
|
|
91
|
+
bindingId: string;
|
|
92
|
+
title: string;
|
|
93
|
+
description?: string | undefined;
|
|
94
|
+
}[] | undefined;
|
|
95
|
+
components?: {
|
|
96
|
+
title: string;
|
|
97
|
+
id: string;
|
|
98
|
+
elementId: string;
|
|
99
|
+
kind: "filter" | "metric" | "chart" | "table" | "text";
|
|
100
|
+
sources: {
|
|
101
|
+
bindingId: string;
|
|
102
|
+
fieldIds?: string[] | undefined;
|
|
103
|
+
}[];
|
|
104
|
+
}[] | undefined;
|
|
86
105
|
presentation?: {
|
|
87
106
|
type: "html";
|
|
88
107
|
html: string;
|
|
@@ -100,7 +119,7 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
100
119
|
artifactId: string;
|
|
101
120
|
versionId: string | null | undefined;
|
|
102
121
|
versionNumber: number | undefined;
|
|
103
|
-
};
|
|
122
|
+
} | undefined;
|
|
104
123
|
versions: {
|
|
105
124
|
current: boolean;
|
|
106
125
|
artifactId: string;
|
|
@@ -181,6 +200,49 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
181
200
|
};
|
|
182
201
|
}>;
|
|
183
202
|
executeViewAction(context: XpertResolvedViewHostContext, viewKey: string, action: string, request: XpertViewActionRequest): Promise<{
|
|
203
|
+
success: boolean;
|
|
204
|
+
data: {
|
|
205
|
+
artifactId: string;
|
|
206
|
+
draftId: string;
|
|
207
|
+
draftRevision: number;
|
|
208
|
+
baseVersionId: string | null;
|
|
209
|
+
status: "draft";
|
|
210
|
+
title: string;
|
|
211
|
+
} | {
|
|
212
|
+
cursor: string;
|
|
213
|
+
nextAction: string;
|
|
214
|
+
error?: string | undefined;
|
|
215
|
+
sourceFile?: {
|
|
216
|
+
path: string;
|
|
217
|
+
sha256: string;
|
|
218
|
+
} | undefined;
|
|
219
|
+
dashboard?: {
|
|
220
|
+
status: "draft";
|
|
221
|
+
title: string;
|
|
222
|
+
artifactId: string;
|
|
223
|
+
draftRevision: number;
|
|
224
|
+
draftId: string;
|
|
225
|
+
baseVersionId: string | null;
|
|
226
|
+
} | undefined;
|
|
227
|
+
requestId: string;
|
|
228
|
+
state: "failed" | "running" | "succeeded" | "queued";
|
|
229
|
+
stage: string;
|
|
230
|
+
completed: number;
|
|
231
|
+
total: number;
|
|
232
|
+
terminal: boolean;
|
|
233
|
+
};
|
|
234
|
+
refresh: boolean;
|
|
235
|
+
} | {
|
|
236
|
+
success: boolean;
|
|
237
|
+
data: import("@xpert-ai/contracts").AnalyticsDiscoveryResult;
|
|
238
|
+
refresh: boolean;
|
|
239
|
+
} | {
|
|
240
|
+
success: boolean;
|
|
241
|
+
data: {
|
|
242
|
+
discarded: boolean;
|
|
243
|
+
};
|
|
244
|
+
refresh: boolean;
|
|
245
|
+
} | {
|
|
184
246
|
success: boolean;
|
|
185
247
|
data: {
|
|
186
248
|
canEdit: boolean;
|
|
@@ -239,9 +301,152 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
239
301
|
artifactId: string;
|
|
240
302
|
};
|
|
241
303
|
refresh: boolean;
|
|
304
|
+
} | {
|
|
305
|
+
success: boolean;
|
|
306
|
+
data: {
|
|
307
|
+
payload?: {
|
|
308
|
+
ok: boolean;
|
|
309
|
+
widget_type: string;
|
|
310
|
+
surface: string;
|
|
311
|
+
sources: never[];
|
|
312
|
+
manifest: {
|
|
313
|
+
version: number;
|
|
314
|
+
surface: string;
|
|
315
|
+
title: string;
|
|
316
|
+
cards: never[];
|
|
317
|
+
filters: never[];
|
|
318
|
+
sources: never[];
|
|
319
|
+
charts: {
|
|
320
|
+
id: string;
|
|
321
|
+
title: string;
|
|
322
|
+
type: "bar" | "line" | "area" | "pie" | "scatter";
|
|
323
|
+
dataset: string;
|
|
324
|
+
encodings: {
|
|
325
|
+
color?: {
|
|
326
|
+
field: string;
|
|
327
|
+
} | undefined;
|
|
328
|
+
x: {
|
|
329
|
+
field: string;
|
|
330
|
+
};
|
|
331
|
+
y: {
|
|
332
|
+
field: string;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
}[];
|
|
336
|
+
tables: {
|
|
337
|
+
id: string;
|
|
338
|
+
title: string;
|
|
339
|
+
dataset: string;
|
|
340
|
+
columns: {
|
|
341
|
+
field: string;
|
|
342
|
+
label: string;
|
|
343
|
+
}[];
|
|
344
|
+
}[];
|
|
345
|
+
blocks: ({
|
|
346
|
+
id: string;
|
|
347
|
+
type: string;
|
|
348
|
+
chartId: string;
|
|
349
|
+
} | {
|
|
350
|
+
id: string;
|
|
351
|
+
type: string;
|
|
352
|
+
tableId: string;
|
|
353
|
+
})[];
|
|
354
|
+
};
|
|
355
|
+
snapshot: {
|
|
356
|
+
version: number;
|
|
357
|
+
generatedAt: string;
|
|
358
|
+
status: string;
|
|
359
|
+
datasets: any;
|
|
360
|
+
};
|
|
361
|
+
} | undefined;
|
|
362
|
+
datasets: import("@xpert-ai/contracts").AnalyticalDataset[];
|
|
363
|
+
failures: {
|
|
364
|
+
bindingId: string;
|
|
365
|
+
datasetId: string;
|
|
366
|
+
reason: "unavailable";
|
|
367
|
+
}[];
|
|
368
|
+
};
|
|
369
|
+
refresh: boolean;
|
|
242
370
|
} | {
|
|
243
371
|
success: boolean;
|
|
244
372
|
data: import("@xpert-ai/contracts").AnalyticalDataset;
|
|
245
373
|
refresh: boolean;
|
|
246
374
|
}>;
|
|
375
|
+
executeViewFileAction(context: XpertResolvedViewHostContext, viewKey: string, action: string, _request: XpertViewActionRequest, file: XpertViewFileActionFile): Promise<{
|
|
376
|
+
success: boolean;
|
|
377
|
+
data: {
|
|
378
|
+
importId: `${string}-${string}-${string}-${string}-${string}`;
|
|
379
|
+
manifest: {
|
|
380
|
+
title: string;
|
|
381
|
+
id: string;
|
|
382
|
+
schema: "xpert.live-dashboard";
|
|
383
|
+
bindings: import("@xpert-ai/contracts").AnalyticsBinding[];
|
|
384
|
+
controls: {
|
|
385
|
+
type: "string" | "number" | "boolean" | "date";
|
|
386
|
+
controlId: string;
|
|
387
|
+
label: string;
|
|
388
|
+
defaultValue?: string | number | boolean | null | undefined;
|
|
389
|
+
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
390
|
+
}[];
|
|
391
|
+
charts: {
|
|
392
|
+
type: "bar" | "line" | "area" | "pie" | "scatter";
|
|
393
|
+
title: string;
|
|
394
|
+
id: string;
|
|
395
|
+
datasetId: string;
|
|
396
|
+
x: string;
|
|
397
|
+
y: string;
|
|
398
|
+
color?: string | undefined;
|
|
399
|
+
}[];
|
|
400
|
+
tables: {
|
|
401
|
+
title: string;
|
|
402
|
+
id: string;
|
|
403
|
+
datasetId: string;
|
|
404
|
+
fields: string[];
|
|
405
|
+
}[];
|
|
406
|
+
sourceMetadata?: {
|
|
407
|
+
bindingId: string;
|
|
408
|
+
title: string;
|
|
409
|
+
description?: string | undefined;
|
|
410
|
+
}[] | undefined;
|
|
411
|
+
components?: {
|
|
412
|
+
title: string;
|
|
413
|
+
id: string;
|
|
414
|
+
elementId: string;
|
|
415
|
+
kind: "filter" | "metric" | "chart" | "table" | "text";
|
|
416
|
+
sources: {
|
|
417
|
+
bindingId: string;
|
|
418
|
+
fieldIds?: string[] | undefined;
|
|
419
|
+
}[];
|
|
420
|
+
}[] | undefined;
|
|
421
|
+
presentation?: {
|
|
422
|
+
type: "html";
|
|
423
|
+
html: string;
|
|
424
|
+
dependencies?: import("@xpert-ai/plugin-sdk/artifact-document").ArtifactDocumentDependencyLock[] | undefined;
|
|
425
|
+
} | undefined;
|
|
426
|
+
};
|
|
427
|
+
requirements: {
|
|
428
|
+
schema: string;
|
|
429
|
+
version: number;
|
|
430
|
+
bindings: {
|
|
431
|
+
id: string;
|
|
432
|
+
providerId: string;
|
|
433
|
+
operation: string;
|
|
434
|
+
contractVersion: number;
|
|
435
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
436
|
+
}[];
|
|
437
|
+
externalResources: string[];
|
|
438
|
+
dynamicResourcesMayExist: boolean;
|
|
439
|
+
includesQueryResults: boolean;
|
|
440
|
+
requiresAuthorizedHost: boolean;
|
|
441
|
+
};
|
|
442
|
+
sources: import("@xpert-ai/contracts").AnalyticsSourceSummary[];
|
|
443
|
+
};
|
|
444
|
+
refresh: boolean;
|
|
445
|
+
}>;
|
|
446
|
+
resolveViewFile(context: XpertResolvedViewHostContext, viewKey: string, request: XpertViewFileAccessRequest): Promise<{
|
|
447
|
+
reference: import("@xpert-ai/plugin-sdk").WorkspacePortableFileReference;
|
|
448
|
+
fileName: string;
|
|
449
|
+
mimeType: string;
|
|
450
|
+
size: number;
|
|
451
|
+
}>;
|
|
247
452
|
}
|
|
@@ -8,8 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.DashboardViewProvider = exports.FEATURE = exports.VIEW_PROVIDER = exports.VIEW_KEY = void 0;
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const save_requests_1 = require("./save-requests");
|
|
13
18
|
const projects_service_1 = require("./projects.service");
|
|
14
19
|
const projects_schema_1 = require("./projects.schema");
|
|
15
20
|
const common_1 = require("@nestjs/common");
|
|
@@ -24,15 +29,19 @@ const dashboard_receipt_1 = require("./dashboard-receipt");
|
|
|
24
29
|
const dashboard_navigation_1 = require("./dashboard-navigation");
|
|
25
30
|
const project_1 = require("./project");
|
|
26
31
|
const dashboard_icon_1 = require("./dashboard-icon");
|
|
32
|
+
const dashboard_sources_1 = require("./dashboard-sources");
|
|
33
|
+
const archive_service_1 = require("./archive.service");
|
|
27
34
|
exports.VIEW_KEY = 'live-dashboard';
|
|
28
35
|
exports.VIEW_PROVIDER = 'live-dashboard';
|
|
29
36
|
exports.FEATURE = 'live_dashboard';
|
|
30
37
|
const text = (en_US, zh_Hans) => ({ en_US, zh_Hans });
|
|
31
38
|
let DashboardViewProvider = class DashboardViewProvider {
|
|
32
|
-
constructor(service, sharing, projects) {
|
|
39
|
+
constructor(service, sharing, projects, archives, saves) {
|
|
33
40
|
this.service = service;
|
|
34
41
|
this.sharing = sharing;
|
|
35
42
|
this.projects = projects;
|
|
43
|
+
this.archives = archives;
|
|
44
|
+
this.saves = saves;
|
|
36
45
|
}
|
|
37
46
|
supports(context) { return context.hostType === 'agent'; }
|
|
38
47
|
getViewManifests(context, slot) {
|
|
@@ -44,6 +53,7 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
44
53
|
workbench: { projectType: project_1.DASHBOARD_PROJECT_TYPE, fixed: true, openMode: 'on-demand', menu: { enabled: true, label: text('Live dashboards', '实时看板'), icon: dashboard_icon_1.dashboardIcon, order: 35 } },
|
|
45
54
|
view: { type: 'remote_component', runtime: 'react', protocolVersion: 1, component: { isolation: 'iframe', entry: exports.VIEW_KEY }, dataSource: { mode: 'platform' } },
|
|
46
55
|
dataSource: { mode: 'platform', querySchema: { supportsSelection: true, supportsParameters: true, supportsPagination: true, defaultPageSize: 50 }, cache: { enabled: false } },
|
|
56
|
+
fileAccess: { purposes: ['download'] },
|
|
47
57
|
clientCommands: [{ key: 'workbench.content.status' }, { key: 'workbench.content.resolve' }, { key: contracts_1.ASSISTANT_CONTEXT_SET_COMMAND, label: text('Select dashboard for Assistant', '设置助理当前看板') },
|
|
48
58
|
{ key: contracts_1.ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, label: text('Create with Assistant', '交给助理制作') },
|
|
49
59
|
{ key: contracts_1.ARTIFACT_PRESENTATION_OPEN_COMMAND, label: text('Open shared page', '打开独立页面') },
|
|
@@ -51,6 +61,8 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
51
61
|
hostEvents: { subscriptions: [{ key: 'dashboard-created', event: 'assistant.tool.completed',
|
|
52
62
|
filter: { toolNames: dashboard_receipt_1.DASHBOARD_MUTATION_TOOLS }, action: { type: 'forward', debounceMs: 0 } }] },
|
|
53
63
|
actions: [
|
|
64
|
+
{ key: 'import-preview', label: text('Import dashboard file', '导入看板文件'), actionType: 'invoke', transport: 'file' },
|
|
65
|
+
...['import-commit', 'import-discard', 'import-browse', 'save-wait', 'save-status'].map(key => ({ key, label: text('Import dashboard', '导入看板'), actionType: 'invoke' })),
|
|
54
66
|
...[
|
|
55
67
|
{ key: 'dashboards', label: text('Select dashboard', '选择看板') },
|
|
56
68
|
{ key: 'projects', label: text('Select project', '选择项目') },
|
|
@@ -80,15 +92,28 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
80
92
|
: undefined;
|
|
81
93
|
const versions = params.artifactId ? await this.service.history(context, params.artifactId) : undefined;
|
|
82
94
|
const unavailable = params.artifactId && mode === 'published' && !params.versionId && !versions?.some(version => version.current);
|
|
95
|
+
const saved = !unavailable && params.artifactId ? await this.service.openDocument(context, params.artifactId, params.versionId, params.draftRevision, mode) : undefined;
|
|
83
96
|
return { meta: { navigationTarget: (0, dashboard_navigation_1.dashboardNavigationTarget)(context), access, mode, currentProject,
|
|
84
97
|
dashboards: page.items, selectedDashboard, pagination: { page: page.page, pageSize: page.pageSize, hasMore: page.hasMore },
|
|
85
98
|
sources: access.canEdit ? await this.service.sources(context) : [],
|
|
86
99
|
...(unavailable ? { notice: 'not_published' } : params.artifactId ? {
|
|
87
|
-
saved:
|
|
100
|
+
saved: saved && { ...saved, manifest: access.canEdit ? saved.manifest : (0, dashboard_sources_1.publicDashboardManifest)(saved.manifest) }, versions
|
|
88
101
|
} : {}) } };
|
|
89
102
|
}
|
|
90
103
|
async executeViewAction(context, viewKey, action, request) {
|
|
91
104
|
assertView(viewKey);
|
|
105
|
+
if (action === 'save-wait' && this.saves) {
|
|
106
|
+
const input = save_requests_1.waitSaveRequestSchema.parse(request.input);
|
|
107
|
+
return { success: true, data: await this.saves.wait(context, input.requestId, input.cursor), refresh: false };
|
|
108
|
+
}
|
|
109
|
+
if (action === 'save-status' && this.saves)
|
|
110
|
+
return { success: true, data: await this.saves.get(context, save_requests_1.saveRequestSchema.parse(request.input).requestId), refresh: false };
|
|
111
|
+
if (action === 'import-commit')
|
|
112
|
+
return { success: true, data: await this.archives.commit(context, archive_service_1.importInputSchema.parse(request.input)), refresh: false };
|
|
113
|
+
if (action === 'import-browse')
|
|
114
|
+
return { success: true, data: await this.archives.browse(context, archive_service_1.importBrowseSchema.parse(request.input)), refresh: false };
|
|
115
|
+
if (action === 'import-discard')
|
|
116
|
+
return { success: true, data: await this.archives.discard(context, v3_1.z.object({ importId: v3_1.z.string().uuid() }).strict().parse(request.input).importId), refresh: false };
|
|
92
117
|
if (action === 'dashboards') {
|
|
93
118
|
const parsed = projects_schema_1.dashboardSearchSchema.safeParse(request.input);
|
|
94
119
|
if (!parsed.success)
|
|
@@ -124,11 +149,15 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
124
149
|
}
|
|
125
150
|
if (action === 'save') {
|
|
126
151
|
const input = dashboard_schema_1.saveSchema.parse(request.input);
|
|
127
|
-
|
|
152
|
+
const data = this.saves && input.manifest.bindings.length > 8
|
|
153
|
+
? await this.saves.submit(context, input.manifest, input.expectedVersionId, input.expectedRevision, (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(input)).digest('hex'))
|
|
154
|
+
: await this.service.save(context, input.manifest, input.expectedVersionId, input.expectedRevision);
|
|
155
|
+
return { success: true, data, refresh: false };
|
|
128
156
|
}
|
|
129
157
|
if (action === 'query') {
|
|
130
158
|
const input = dashboard_schema_1.querySchema.parse(request.input);
|
|
131
|
-
|
|
159
|
+
const result = await this.service.query(context, input.artifactId, input.versionId, input.controls, input.draftRevision);
|
|
160
|
+
return { success: true, data: { datasets: result.datasets, failures: result.failures, ...('payload' in result ? { payload: result.payload } : {}) }, refresh: false };
|
|
132
161
|
}
|
|
133
162
|
if (action === 'query-binding') {
|
|
134
163
|
const parsed = dashboard_schema_1.queryBindingSchema.safeParse(request.input);
|
|
@@ -139,11 +168,24 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
139
168
|
}
|
|
140
169
|
throw new common_1.BadRequestException('DASHBOARD_ACTION_UNSUPPORTED');
|
|
141
170
|
}
|
|
171
|
+
async executeViewFileAction(context, viewKey, action, _request, file) {
|
|
172
|
+
assertView(viewKey);
|
|
173
|
+
if (action !== 'import-preview')
|
|
174
|
+
throw new common_1.BadRequestException('DASHBOARD_ACTION_UNSUPPORTED');
|
|
175
|
+
return { success: true, data: await this.archives.prepare(context, file.buffer), refresh: false };
|
|
176
|
+
}
|
|
177
|
+
async resolveViewFile(context, viewKey, request) {
|
|
178
|
+
assertView(viewKey);
|
|
179
|
+
if (request.purpose !== 'download')
|
|
180
|
+
throw new common_1.ForbiddenException('DASHBOARD_ACTION_UNSUPPORTED');
|
|
181
|
+
return this.archives.exportFile(context, request.fileKey);
|
|
182
|
+
}
|
|
142
183
|
};
|
|
143
184
|
exports.DashboardViewProvider = DashboardViewProvider;
|
|
144
185
|
exports.DashboardViewProvider = DashboardViewProvider = __decorate([
|
|
145
186
|
(0, plugin_sdk_1.ViewExtensionProvider)(exports.VIEW_PROVIDER),
|
|
146
|
-
|
|
187
|
+
__param(4, (0, common_1.Optional)()),
|
|
188
|
+
__metadata("design:paramtypes", [dashboard_service_1.DashboardService, sharing_service_1.DashboardSharingService, projects_service_1.DashboardProjectsService, archive_service_1.DashboardArchiveService, save_requests_1.DashboardSaveRequests])
|
|
147
189
|
], DashboardViewProvider);
|
|
148
190
|
function assertView(key) { if (key !== exports.VIEW_KEY)
|
|
149
191
|
throw new common_1.BadRequestException('DASHBOARD_VIEW_UNSUPPORTED'); }
|