@xpert-ai/plugin-live-dashboard 0.6.2 → 0.7.1
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 +14 -2
- package/assets/explore/PROVENANCE.md +9 -0
- package/assets/explore/category-contribution.webp +0 -0
- package/assets/explore/ecommerce-operations.webp +0 -0
- package/assets/explore/extensions.svg +1 -0
- package/assets/explore/generation-prompts.json +107 -0
- package/assets/explore/global-assets.webp +0 -0
- package/assets/explore/hotel-cancellation.webp +0 -0
- package/assets/explore/hotel-operations.webp +0 -0
- package/assets/explore/insights.svg +1 -0
- package/assets/explore/knowledge.svg +1 -0
- package/assets/explore/legal-defense.webp +0 -0
- package/assets/explore/order-promotion.webp +0 -0
- package/assets/explore/outbound-travel.webp +0 -0
- package/assets/explore/schedule.svg +1 -0
- package/assets/explore/steam-market.webp +0 -0
- package/assets/explore/weather-alerts.webp +0 -0
- package/assets/library/catalog/README.md +11 -0
- package/assets/library/catalog/analysis-template-conversion-diagnosis.svg +1 -0
- package/assets/library/catalog/analysis-template-customer-lifecycle.svg +1 -0
- package/assets/library/catalog/analysis-template-growth-attribution.svg +1 -0
- package/assets/library/catalog/analysis-template-multi-criteria.svg +1 -0
- package/assets/library/catalog/analysis-template-regional-flow.svg +1 -0
- package/assets/library/catalog/analysis-template-risk-monitoring.svg +1 -0
- package/assets/library/catalog/component-analysis-note.svg +1 -0
- package/assets/library/catalog/component-box-plot.svg +1 -0
- package/assets/library/catalog/component-bullet.svg +1 -0
- package/assets/library/catalog/component-calendar-heatmap.svg +1 -0
- package/assets/library/catalog/component-collapsible-panel.svg +1 -0
- package/assets/library/catalog/component-combo-chart.svg +1 -0
- package/assets/library/catalog/component-content-panel.svg +1 -0
- package/assets/library/catalog/component-date-range.svg +1 -0
- package/assets/library/catalog/component-detail-table.svg +1 -0
- package/assets/library/catalog/component-donut.svg +1 -0
- package/assets/library/catalog/component-dumbbell.svg +1 -0
- package/assets/library/catalog/component-event-timeline.svg +1 -0
- package/assets/library/catalog/component-funnel.svg +1 -0
- package/assets/library/catalog/component-histogram.svg +1 -0
- package/assets/library/catalog/component-keyword-filter.svg +1 -0
- package/assets/library/catalog/component-matrix-heatmap.svg +1 -0
- package/assets/library/catalog/component-metric-card.svg +1 -0
- package/assets/library/catalog/component-metric-group.svg +1 -0
- package/assets/library/catalog/component-multi-series.svg +1 -0
- package/assets/library/catalog/component-number-range.svg +1 -0
- package/assets/library/catalog/component-option-filter.svg +1 -0
- package/assets/library/catalog/component-pareto.svg +1 -0
- package/assets/library/catalog/component-percent-stacked.svg +1 -0
- package/assets/library/catalog/component-pivot-table.svg +1 -0
- package/assets/library/catalog/component-radar.svg +1 -0
- package/assets/library/catalog/component-ranking.svg +1 -0
- package/assets/library/catalog/component-sankey.svg +1 -0
- package/assets/library/catalog/component-scatter-bubble.svg +1 -0
- package/assets/library/catalog/component-segmented-filter.svg +1 -0
- package/assets/library/catalog/component-small-multiples.svg +1 -0
- package/assets/library/catalog/component-sunburst.svg +1 -0
- package/assets/library/catalog/component-tabbed-panel.svg +1 -0
- package/assets/library/catalog/component-target-progress.svg +1 -0
- package/assets/library/catalog/component-toggle-filter.svg +1 -0
- package/assets/library/catalog/component-treemap.svg +1 -0
- package/assets/library/catalog/component-trend-comparison.svg +1 -0
- package/assets/library/catalog/component-waterfall.svg +1 -0
- package/assets/library/catalog/provenance.json +524 -0
- package/assets/library/catalog/visual-theme-amber-sunset.svg +1 -0
- package/assets/library/catalog/visual-theme-art-deco.svg +1 -0
- package/assets/library/catalog/visual-theme-bauhaus.svg +1 -0
- package/assets/library/catalog/visual-theme-burgundy-night.svg +1 -0
- package/assets/library/catalog/visual-theme-cinematic.svg +1 -0
- package/assets/library/catalog/visual-theme-clarity-blue.svg +1 -0
- package/assets/library/catalog/visual-theme-clay.svg +1 -0
- package/assets/library/catalog/visual-theme-cobalt-diagonal.svg +1 -0
- package/assets/library/catalog/visual-theme-coral-cream.svg +1 -0
- package/assets/library/catalog/visual-theme-crimson-black.svg +1 -0
- package/assets/library/catalog/visual-theme-cyberpunk.svg +1 -0
- package/assets/library/catalog/visual-theme-dark-olive.svg +1 -0
- package/assets/library/catalog/visual-theme-dark-tech.svg +1 -0
- package/assets/library/catalog/visual-theme-deep-sea-blue.svg +1 -0
- package/assets/library/catalog/visual-theme-deep-sea-mist.svg +1 -0
- package/assets/library/catalog/visual-theme-financial-trading.svg +1 -0
- package/assets/library/catalog/visual-theme-flat.svg +1 -0
- package/assets/library/catalog/visual-theme-frosted-tech.svg +1 -0
- package/assets/library/catalog/visual-theme-golden-eye.svg +1 -0
- package/assets/library/catalog/visual-theme-hand-drawn.svg +1 -0
- package/assets/library/catalog/visual-theme-industrial.svg +1 -0
- package/assets/library/catalog/visual-theme-layered-paper.svg +1 -0
- package/assets/library/catalog/visual-theme-material.svg +1 -0
- package/assets/library/catalog/visual-theme-maximalism.svg +1 -0
- package/assets/library/catalog/visual-theme-midnight-emerald.svg +1 -0
- package/assets/library/catalog/visual-theme-minimal-modern.svg +1 -0
- package/assets/library/catalog/visual-theme-misty-green.svg +1 -0
- package/assets/library/catalog/visual-theme-misty-rose.svg +1 -0
- package/assets/library/catalog/visual-theme-natural-terrain.svg +1 -0
- package/assets/library/catalog/visual-theme-neo-brutalism.svg +1 -0
- package/assets/library/catalog/visual-theme-newsprint.svg +1 -0
- package/assets/library/catalog/visual-theme-olive-terracotta.svg +1 -0
- package/assets/library/catalog/visual-theme-paper-journal.svg +1 -0
- package/assets/library/catalog/visual-theme-pastel-matrix.svg +1 -0
- package/assets/library/catalog/visual-theme-pixel-dashboard.svg +1 -0
- package/assets/library/catalog/visual-theme-premium-business.svg +1 -0
- package/assets/library/catalog/visual-theme-redline-brief.svg +1 -0
- package/assets/library/catalog/visual-theme-sage.svg +1 -0
- package/assets/library/catalog/visual-theme-soft-porcelain.svg +1 -0
- package/assets/library/catalog/visual-theme-swiss-grid.svg +1 -0
- package/assets/library/catalog/visual-theme-tdesign-enterprise.svg +1 -0
- package/assets/library/catalog/visual-theme-terminal-green.svg +1 -0
- package/assets/library/catalog/visual-theme-warm-sand.svg +1 -0
- package/dist/lib/agent.schema.d.ts +514 -32
- package/dist/lib/analysis-scene-chart.d.ts +8 -0
- package/dist/lib/analysis-scene-chart.js +61 -0
- package/dist/lib/analysis-scene-tool.d.ts +87 -0
- package/dist/lib/analysis-scene-tool.js +33 -0
- package/dist/lib/analysis-scene-widget.d.ts +6 -0
- package/dist/lib/analysis-scene-widget.js +107 -0
- package/dist/lib/analysis-scene.schema.d.ts +66 -0
- package/dist/lib/analysis-scene.schema.js +20 -0
- package/dist/lib/archive.service.d.ts +35 -0
- package/dist/lib/artifact-type.provider.d.ts +1 -0
- package/dist/lib/artifact-type.provider.js +18 -0
- package/dist/lib/bundled-example-source.d.ts +11 -0
- package/dist/lib/bundled-example-source.js +60 -0
- package/dist/lib/certification.schema.d.ts +4 -0
- package/dist/lib/certification.schema.js +14 -0
- package/dist/lib/content-capability.js +1 -0
- package/dist/lib/content-type.d.ts +2 -0
- package/dist/lib/content-type.js +5 -0
- package/dist/lib/content.provider.js +5 -3
- package/dist/lib/dashboard-archive.d.ts +35 -0
- package/dist/lib/dashboard-artifact.d.ts +93 -0
- package/dist/lib/dashboard-artifact.js +24 -0
- package/dist/lib/dashboard-delivery.d.ts +11 -0
- package/dist/lib/dashboard-delivery.js +55 -0
- package/dist/lib/dashboard-discovery.schema.d.ts +446 -0
- package/dist/lib/dashboard-discovery.schema.js +35 -0
- package/dist/lib/dashboard-navigation.d.ts +22 -21
- package/dist/lib/dashboard-navigation.js +5 -4
- package/dist/lib/dashboard-queries.d.ts +2 -2
- package/dist/lib/dashboard-queries.js +2 -2
- package/dist/lib/dashboard-receipt.js +1 -1
- package/dist/lib/dashboard-view.schema.d.ts +964 -64
- package/dist/lib/dashboard.schema.d.ts +738 -23
- package/dist/lib/dashboard.schema.js +8 -2
- package/dist/lib/dashboard.service.d.ts +155 -2
- package/dist/lib/dashboard.service.js +38 -4
- package/dist/lib/dataset-artifact.provider.d.ts +13 -0
- package/dist/lib/dataset-artifact.provider.js +57 -0
- package/dist/lib/dataset.schema.d.ts +195 -0
- package/dist/lib/dataset.schema.js +23 -0
- package/dist/lib/dataset.service.d.ts +54 -0
- package/dist/lib/dataset.service.js +119 -0
- package/dist/lib/definition-tools.d.ts +14 -54
- package/dist/lib/definition-tools.js +29 -9
- package/dist/lib/document-package.d.ts +35 -0
- package/dist/lib/editing.d.ts +552 -2
- package/dist/lib/evidence/evidence-diff.d.ts +17 -0
- package/dist/lib/evidence/evidence-diff.js +30 -0
- package/dist/lib/evidence/evidence-transfers.d.ts +14 -0
- package/dist/lib/evidence/evidence-transfers.js +41 -0
- package/dist/lib/evidence/evidence-view.provider.d.ts +91 -0
- package/dist/lib/evidence/evidence-view.provider.js +92 -0
- package/dist/lib/evidence/evidence.entity.d.ts +14 -0
- package/dist/lib/evidence/evidence.entity.js +62 -0
- package/dist/lib/evidence/evidence.provider.d.ts +43 -0
- package/dist/lib/evidence/evidence.provider.js +91 -0
- package/dist/lib/evidence/evidence.service.d.ts +67 -0
- package/dist/lib/evidence/evidence.service.js +218 -0
- package/dist/lib/explore-catalog.d.ts +15 -0
- package/dist/lib/explore-catalog.js +51 -0
- package/dist/lib/explore-catalog.json +131 -0
- package/dist/lib/explore.schema.d.ts +69 -0
- package/dist/lib/explore.schema.js +9 -0
- package/dist/lib/group-sharing.d.ts +17 -0
- package/dist/lib/group-sharing.js +39 -0
- package/dist/lib/hotel-document.d.ts +3 -0
- package/dist/lib/hotel-document.js +26 -0
- package/dist/lib/hotel-template.d.ts +246 -0
- package/dist/lib/hotel-template.js +77 -0
- package/dist/lib/library/access.d.ts +9 -0
- package/dist/lib/library/access.js +14 -0
- package/dist/lib/library/actions.d.ts +7 -0
- package/dist/lib/library/actions.js +55 -0
- package/dist/lib/library/archive.d.ts +13 -0
- package/dist/lib/library/archive.js +123 -0
- package/dist/lib/library/asset-validation.d.ts +4 -0
- package/dist/lib/library/asset-validation.js +77 -0
- package/dist/lib/library/catalog-blueprints.json +3225 -0
- package/dist/lib/library/catalog.service.d.ts +2427 -0
- package/dist/lib/library/catalog.service.js +270 -0
- package/dist/lib/library/dataset-binding.service.d.ts +65 -0
- package/dist/lib/library/dataset-binding.service.js +152 -0
- package/dist/lib/library/directory-contract.d.ts +161 -0
- package/dist/lib/library/directory-contract.js +19 -0
- package/dist/lib/library/directory.service.d.ts +33 -0
- package/dist/lib/library/directory.service.js +69 -0
- package/dist/lib/library/entities.d.ts +80 -0
- package/dist/lib/library/entities.js +280 -0
- package/dist/lib/library/execution-contract.d.ts +200 -0
- package/dist/lib/library/execution-contract.js +19 -0
- package/dist/lib/library/execution-resolution.d.ts +2490 -0
- package/dist/lib/library/execution-resolution.js +101 -0
- package/dist/lib/library/file-artifact.provider.d.ts +7 -0
- package/dist/lib/library/file-artifact.provider.js +35 -0
- package/dist/lib/library/files.service.d.ts +20 -0
- package/dist/lib/library/files.service.js +112 -0
- package/dist/lib/library/origin.schema.d.ts +171 -0
- package/dist/lib/library/origin.schema.js +14 -0
- package/dist/lib/library/resource-contract.d.ts +2779 -0
- package/dist/lib/library/resource-contract.js +167 -0
- package/dist/lib/library/resource-json.d.ts +11 -0
- package/dist/lib/library/resource-json.js +53 -0
- package/dist/lib/library/task-preparation.service.d.ts +14 -0
- package/dist/lib/library/task-preparation.service.js +85 -0
- package/dist/lib/library/template-compiler.d.ts +19 -0
- package/dist/lib/library/template-compiler.js +73 -0
- package/dist/lib/library/template-execution.service.d.ts +79 -0
- package/dist/lib/library/template-execution.service.js +135 -0
- package/dist/lib/library/transfers.service.d.ts +94 -0
- package/dist/lib/library/transfers.service.js +193 -0
- package/dist/lib/library/zip-container.d.ts +10 -0
- package/dist/lib/library/zip-container.js +79 -0
- package/dist/lib/library-view.provider.d.ts +88 -0
- package/dist/lib/library-view.provider.js +164 -0
- package/dist/lib/library.schema.d.ts +347 -0
- package/dist/lib/library.schema.js +41 -0
- package/dist/lib/middleware.d.ts +8 -2
- package/dist/lib/middleware.js +119 -11
- package/dist/lib/monitor.js +2 -2
- package/dist/lib/plugin.js +21 -1
- package/dist/lib/presentation.provider.d.ts +35 -0
- package/dist/lib/presentation.provider.js +4 -15
- package/dist/lib/projects.schema.d.ts +4 -4
- package/dist/lib/query-session.d.ts +1 -1
- package/dist/lib/query-session.js +13 -8
- package/dist/lib/remote-entry.d.ts +1 -1
- package/dist/lib/remote-entry.js +2 -2
- package/dist/lib/resource.schema.d.ts +1067 -0
- package/dist/lib/resource.schema.js +76 -0
- package/dist/lib/runtime-context.d.ts +2 -0
- package/dist/lib/runtime-context.js +22 -0
- package/dist/lib/sharing.service.d.ts +12 -0
- package/dist/lib/sharing.service.js +4 -0
- package/dist/lib/source-executions.d.ts +69 -51
- package/dist/lib/source-executions.js +2 -1
- package/dist/lib/template.schema.d.ts +36 -0
- package/dist/lib/template.schema.js +17 -0
- package/dist/lib/template.service.d.ts +21 -0
- package/dist/lib/template.service.js +56 -0
- package/dist/lib/templates.js +5 -5
- package/dist/lib/view.provider.d.ts +129 -4
- package/dist/lib/view.provider.js +61 -35
- package/dist/remote/app.css +1 -1
- package/dist/remote/app.js +54 -53
- package/dist/remote/build-manifest.json +238 -46
- package/dist/sandbox-actions/action.json +1 -1
- package/dist/sandbox-actions/bundle/host.js +2 -2
- package/docs/content-packages.mdx +43 -0
- package/docs/dashboard-starter.mdx +22 -0
- package/docs/data-view.mdx +30 -0
- package/docs/dataset-generation.mdx +32 -0
- package/docs/dataset-storage.mdx +29 -0
- package/docs/docs.json +15 -0
- package/docs/editing.mdx +6 -0
- package/docs/html-mode.md +1 -1
- package/docs/index.mdx +8 -0
- package/docs/inline-analysis.mdx +62 -0
- package/docs/library-browser-verification.mdx +46 -0
- package/docs/library-detail-ui.mdx +21 -0
- package/docs/library-directory-ui.mdx +24 -0
- package/docs/library-execution.mdx +49 -0
- package/docs/library-import-ui.mdx +20 -0
- package/docs/library-storage.mdx +63 -0
- package/docs/proposals/resource-sharing-decoupling.mdx +83 -0
- package/docs/standard-theme.mdx +28 -0
- package/docs/template-agent-handoff.mdx +37 -0
- package/docs/verification.mdx +4 -0
- package/package.json +9 -5
- package/skills/live-dashboard/SKILL.md +41 -1
- package/skills/live-dashboard/examples/README.md +2 -2
- package/skills/live-dashboard/examples/production-quality/README.md +2 -2
- package/skills/live-dashboard/examples/regional-sales/README.md +3 -3
- package/skills/live-dashboard/examples/regional-sales/query.json +49 -1
- package/skills/live-dashboard/examples/sales-overview/README.md +2 -2
- package/skills/live-dashboard/references/attribution-analysis.md +8 -0
- package/skills/live-dashboard/references/pareto-analysis.md +8 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DashboardTemplateService = void 0;
|
|
13
|
+
exports.templateManifest = templateManifest;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const dashboard_service_1 = require("./dashboard.service");
|
|
16
|
+
const dataset_service_1 = require("./dataset.service");
|
|
17
|
+
const template_schema_1 = require("./template.schema");
|
|
18
|
+
const dashboard_schema_1 = require("./dashboard.schema");
|
|
19
|
+
/** @beta Dataset-to-dashboard generation APIs and preset semantics may change incompatibly during beta. */
|
|
20
|
+
let DashboardTemplateService = class DashboardTemplateService {
|
|
21
|
+
constructor(dashboards, datasets) {
|
|
22
|
+
this.dashboards = dashboards;
|
|
23
|
+
this.datasets = datasets;
|
|
24
|
+
}
|
|
25
|
+
async create(context, input) {
|
|
26
|
+
input = template_schema_1.templateCreateSchema.parse(input);
|
|
27
|
+
const dataset = await this.datasets.open(context, input.datasetId);
|
|
28
|
+
if (dataset.revision !== input.datasetRevision)
|
|
29
|
+
throw new common_1.ConflictException('DASHBOARD_DATASET_CONFLICT');
|
|
30
|
+
return this.dashboards.save(context, templateManifest(dataset.definition, input), null, 0);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.DashboardTemplateService = DashboardTemplateService;
|
|
34
|
+
exports.DashboardTemplateService = DashboardTemplateService = __decorate([
|
|
35
|
+
(0, common_1.Injectable)(),
|
|
36
|
+
__metadata("design:paramtypes", [dashboard_service_1.DashboardService, dataset_service_1.DashboardDatasetService])
|
|
37
|
+
], DashboardTemplateService);
|
|
38
|
+
function templateManifest(dataset, input) {
|
|
39
|
+
// A reusable dataset may override parameter defaults. Copy them into both the
|
|
40
|
+
// new binding and controls so the dashboard's canonical default contract agrees.
|
|
41
|
+
const binding = { ...dataset.binding, parameters: dataset.binding.parameters.map(parameter => ({ ...parameter,
|
|
42
|
+
defaultValue: Object.prototype.hasOwnProperty.call(dataset.controls, parameter.controlId)
|
|
43
|
+
? dataset.controls[parameter.controlId] : parameter.defaultValue ?? null })) };
|
|
44
|
+
const chart = input.template !== 'details';
|
|
45
|
+
const x = binding.output.fields.find(field => field.id === input.x);
|
|
46
|
+
const y = binding.output.fields.find(field => field.id === input.y);
|
|
47
|
+
if (chart && (!x || !y || !['float64', 'int64', 'decimal'].includes(y.logicalType)))
|
|
48
|
+
throw new common_1.BadRequestException('DASHBOARD_TEMPLATE_FIELDS_REQUIRED');
|
|
49
|
+
const chartType = input.template === 'comparison' ? 'bar' : input.template === 'trend' ? 'line' : input.template;
|
|
50
|
+
return dashboard_schema_1.dashboardSchema.parse({ schema: 'xpert.live-dashboard', id: input.id, title: input.title, visualTheme: input.theme,
|
|
51
|
+
bindings: [binding], controls: binding.parameters.map(parameter => ({ controlId: parameter.controlId, label: parameter.controlId,
|
|
52
|
+
type: parameter.type, defaultValue: parameter.defaultValue,
|
|
53
|
+
...(parameter.allowedValues ? { allowedValues: parameter.allowedValues } : {}) })).filter((item, index, all) => all.findIndex(other => other.controlId === item.controlId) === index),
|
|
54
|
+
charts: chart ? [{ id: 'main', title: input.title, type: chartType, datasetId: binding.output.datasetId, x: input.x, y: input.y }] : [],
|
|
55
|
+
tables: [{ id: 'detail', title: dataset.name, datasetId: binding.output.datasetId, fields: binding.output.fields.slice(0, 30).map(field => field.id) }] });
|
|
56
|
+
}
|
package/dist/lib/templates.js
CHANGED
|
@@ -15,8 +15,8 @@ const startPrompts = [
|
|
|
15
15
|
const startLabels = ['区域销售 · 入门', '销售总览 · 入门', '生产质量 · 入门', 'Superstore 企业分析 · 进阶', '使用我的数据'];
|
|
16
16
|
const dsl = (monitor) => JSON.stringify({
|
|
17
17
|
team: { name: monitor ? 'live-dashboard-monitor' : 'live-dashboard-assistant', type: 'agent',
|
|
18
|
-
title: monitor ? '看板巡检' : '实时看板助理', version: '1', agent: { key: 'Agent_Dashboard' },
|
|
19
|
-
options: { workspaceScope: { mode: 'project-required', projectType: project_1.DASHBOARD_PROJECT_TYPE } },
|
|
18
|
+
title: monitor ? '看板巡检' : '实时看板助理', version: monitor ? '1' : '3', agent: { key: 'Agent_Dashboard' },
|
|
19
|
+
options: { workspaceScope: { mode: 'project-required', ...(monitor ? {} : { onMissing: 'create' }), projectType: project_1.DASHBOARD_PROJECT_TYPE } },
|
|
20
20
|
features: monitor ? {} : { sandbox: { enabled: true }, opener: { enabled: true,
|
|
21
21
|
message: '选择或创建项目,从样例开始,或连接你的业务数据制作实时看板。', questions: startPrompts.map((prompt, index) => ({ label: startLabels[index], prompt })) } },
|
|
22
22
|
// Reading a recipe, registering its file and validating filters spans multiple graph steps per tool call.
|
|
@@ -26,15 +26,15 @@ const dsl = (monitor) => JSON.stringify({
|
|
|
26
26
|
name: monitor ? 'dashboard-monitor' : 'dashboard-author', title: monitor ? '看板巡检' : '看板制作',
|
|
27
27
|
prompt: monitor
|
|
28
28
|
? 'Inspect explicitly selected published dashboards in the current Project. Use dashboard_inspect to check live bindings as the scheduled run actor. Report failed bindings, incomplete results and the observed freshness; never claim business-data freshness from query time alone. Do not change definitions, publish, or expand access. Only schedule work when the human requests it. Use the user language.'
|
|
29
|
-
: 'Create and maintain dashboards in the current Project.
|
|
29
|
+
: 'Create and maintain dashboards in the current Project. Discuss metrics and plans directly. When asked to produce a dashboard, select a Project first if needed, then read the live-dashboard skill before authoring. For example requests use read_skill_file to read examples/catalog.json and the selected recipe directly relative to the catalog SKILL.md path; do not list sandbox directories to locate bundled files. After a successful draft receipt, report the receipt and let the user open its emitted card; do not reopen/update an unchanged dashboard merely to verify the save. Ask whether to use labeled synthetic demo data or authorized real data when unspecified. Small onboarding demo files belong to the current Project and use file.table after registration. The Superstore enterprise recipe instead requires the authorized published Data Xpert ontology; follow its own setup and query plans, never replace it with file.table or other sample rows. Never substitute demo values for missing real data. For enterprise BI pages, read themes/README.md, choose one visual style appropriate to the requested analysis and read its guide and complete recipe. The Superstore suite uses Trend Workspace for overview, Profit Atlas for profitability and Customer Brief for customers and returns. Use echarts plus exactly one matching theme library, adapt chart fields to discovered data, and preserve the selected theme on edits unless a redesign is requested. Discover registered data sources and validate exact bindings. Preserve the selected Artifact, component IDs and current draft revision on edits. Saving is not publication. Publication requires a manager in the Workbench. Never infer another dashboard from titles or recency. Use the user language.',
|
|
30
30
|
collaboratorNames: [], toolsetIds: [], knowledgebaseIds: [] } },
|
|
31
|
-
...(monitor ? ['LiveDashboardMonitor', 'scheduler'] : ['LiveDashboard', 'SandboxFile', 'skillsMiddleware']).map((provider, index) => ({
|
|
31
|
+
...(monitor ? ['LiveDashboardMonitor', 'scheduler'] : ['ProjectMiddleware', 'LiveDashboard', 'SandboxFile', 'skillsMiddleware']).map((provider, index) => ({
|
|
32
32
|
type: 'workflow', key: `Middleware_${provider}`, position: { x: 550, y: 100 + index * 120 },
|
|
33
33
|
entity: { type: 'middleware', key: `Middleware_${provider}`, title: provider, provider, required: true,
|
|
34
34
|
...(provider === 'LiveDashboard' ? { options: { maxModelCalls: 64 } } : {}) }
|
|
35
35
|
}))
|
|
36
36
|
],
|
|
37
|
-
connections: (monitor ? ['LiveDashboardMonitor', 'scheduler'] : ['LiveDashboard', 'SandboxFile', 'skillsMiddleware']).map(provider => ({
|
|
37
|
+
connections: (monitor ? ['LiveDashboardMonitor', 'scheduler'] : ['ProjectMiddleware', 'LiveDashboard', 'SandboxFile', 'skillsMiddleware']).map(provider => ({
|
|
38
38
|
type: 'workflow', key: `Agent_Dashboard/Middleware_${provider}`, from: 'Agent_Dashboard', to: `Middleware_${provider}`, required: true
|
|
39
39
|
}))
|
|
40
40
|
});
|
|
@@ -5,6 +5,7 @@ import { type IXpertViewExtensionProvider, type XpertViewFileActionFile } from '
|
|
|
5
5
|
import { DashboardService } from './dashboard.service';
|
|
6
6
|
import { DashboardSharingService } from './sharing.service';
|
|
7
7
|
import { DashboardArchiveService } from './archive.service';
|
|
8
|
+
export declare const DOCUMENT_VIEW_KEY = "dashboard";
|
|
8
9
|
export declare const VIEW_KEY = "live-dashboard";
|
|
9
10
|
export declare const VIEW_PROVIDER = "live-dashboard";
|
|
10
11
|
export declare const FEATURE = "live_dashboard";
|
|
@@ -17,7 +18,7 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
17
18
|
constructor(service: DashboardService, sharing: DashboardSharingService, projects: DashboardProjectsService, archives: DashboardArchiveService, saves?: DashboardSaveRequests | undefined);
|
|
18
19
|
supports(context: XpertResolvedViewHostContext): boolean;
|
|
19
20
|
getViewManifests(context: XpertResolvedViewHostContext, slot: string): XpertExtensionViewManifest[];
|
|
20
|
-
getRemoteComponentEntry(): Promise<{
|
|
21
|
+
getRemoteComponentEntry(_context: XpertResolvedViewHostContext, entry?: string): Promise<{
|
|
21
22
|
html: string;
|
|
22
23
|
contentType: "text/html; charset=utf-8";
|
|
23
24
|
}>;
|
|
@@ -26,7 +27,7 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
26
27
|
notice: "not_published";
|
|
27
28
|
navigationTarget: {
|
|
28
29
|
target: "workbench.view";
|
|
29
|
-
viewKey: "live-dashboard__live-dashboard";
|
|
30
|
+
viewKey: "live-dashboard__dashboard" | "live-dashboard__live-dashboard";
|
|
30
31
|
};
|
|
31
32
|
access: import("./project").DashboardAccess;
|
|
32
33
|
mode: "draft" | "published";
|
|
@@ -91,11 +92,46 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
91
92
|
datasetId: string;
|
|
92
93
|
fields: string[];
|
|
93
94
|
}[];
|
|
95
|
+
visualTheme?: "system" | "slate" | "contrast" | undefined;
|
|
94
96
|
sourceMetadata?: {
|
|
95
97
|
bindingId: string;
|
|
96
98
|
title: string;
|
|
97
99
|
description?: string | undefined;
|
|
98
100
|
}[] | undefined;
|
|
101
|
+
templateOrigin?: {
|
|
102
|
+
schema: "xpert.library.instance";
|
|
103
|
+
version: 1;
|
|
104
|
+
template: {
|
|
105
|
+
version: string;
|
|
106
|
+
logicalId: string;
|
|
107
|
+
sha256: string;
|
|
108
|
+
};
|
|
109
|
+
inputs: {
|
|
110
|
+
slot: string;
|
|
111
|
+
mapping: Record<string, string>;
|
|
112
|
+
source: {
|
|
113
|
+
type: "library";
|
|
114
|
+
version: string;
|
|
115
|
+
logicalId: string;
|
|
116
|
+
sha256: string;
|
|
117
|
+
} | {
|
|
118
|
+
type: "dataset";
|
|
119
|
+
artifactId: string;
|
|
120
|
+
revision: number;
|
|
121
|
+
};
|
|
122
|
+
}[];
|
|
123
|
+
parameters: Record<string, string | number | boolean | null>;
|
|
124
|
+
task?: {
|
|
125
|
+
version: string;
|
|
126
|
+
logicalId: string;
|
|
127
|
+
sha256: string;
|
|
128
|
+
} | undefined;
|
|
129
|
+
theme?: {
|
|
130
|
+
version: string;
|
|
131
|
+
logicalId: string;
|
|
132
|
+
sha256: string;
|
|
133
|
+
} | undefined;
|
|
134
|
+
} | undefined;
|
|
99
135
|
components?: {
|
|
100
136
|
title: string;
|
|
101
137
|
id: string;
|
|
@@ -134,7 +170,7 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
134
170
|
}[] | undefined;
|
|
135
171
|
navigationTarget: {
|
|
136
172
|
target: "workbench.view";
|
|
137
|
-
viewKey: "live-dashboard__live-dashboard";
|
|
173
|
+
viewKey: "live-dashboard__dashboard" | "live-dashboard__live-dashboard";
|
|
138
174
|
};
|
|
139
175
|
access: import("./project").DashboardAccess;
|
|
140
176
|
mode: "draft" | "published";
|
|
@@ -173,7 +209,7 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
173
209
|
} | {
|
|
174
210
|
navigationTarget: {
|
|
175
211
|
target: "workbench.view";
|
|
176
|
-
viewKey: "live-dashboard__live-dashboard";
|
|
212
|
+
viewKey: "live-dashboard__dashboard" | "live-dashboard__live-dashboard";
|
|
177
213
|
};
|
|
178
214
|
access: import("./project").DashboardAccess;
|
|
179
215
|
mode: "draft" | "published";
|
|
@@ -212,6 +248,20 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
212
248
|
};
|
|
213
249
|
}>;
|
|
214
250
|
executeViewAction(context: XpertResolvedViewHostContext, viewKey: string, action: string, request: XpertViewActionRequest): Promise<{
|
|
251
|
+
success: boolean;
|
|
252
|
+
data: import("@xpert-ai/contracts").ArtifactUseGrantSummary | import("@xpert-ai/contracts").ResourceAnalysisDataset[] | {
|
|
253
|
+
items: Array<{
|
|
254
|
+
id: string;
|
|
255
|
+
title: string;
|
|
256
|
+
projectId: string;
|
|
257
|
+
}>;
|
|
258
|
+
nextOffset: number | null;
|
|
259
|
+
} | {
|
|
260
|
+
items: import("@xpert-ai/plugin-sdk").ArtifactGrantDetails[];
|
|
261
|
+
nextOffset: number | null;
|
|
262
|
+
};
|
|
263
|
+
refresh: boolean;
|
|
264
|
+
} | {
|
|
215
265
|
success: boolean;
|
|
216
266
|
data: {
|
|
217
267
|
artifactId: string;
|
|
@@ -274,6 +324,46 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
274
324
|
hasMore: boolean;
|
|
275
325
|
};
|
|
276
326
|
refresh: boolean;
|
|
327
|
+
} | {
|
|
328
|
+
success: boolean;
|
|
329
|
+
data: {
|
|
330
|
+
canEdit: boolean;
|
|
331
|
+
mode: "draft" | "published";
|
|
332
|
+
items: (import("@xpert-ai/contracts").ConversationResourceItem | {
|
|
333
|
+
dashboard: {
|
|
334
|
+
title: string | null | undefined;
|
|
335
|
+
draftRevision?: number | undefined;
|
|
336
|
+
updatedAt: string | Date | undefined;
|
|
337
|
+
isEmpty: boolean;
|
|
338
|
+
canDelete: boolean;
|
|
339
|
+
isDraft: boolean;
|
|
340
|
+
artifactId: string;
|
|
341
|
+
versionId: string | null | undefined;
|
|
342
|
+
versionNumber: number | undefined;
|
|
343
|
+
} | undefined;
|
|
344
|
+
resource: import("@xpert-ai/contracts").ConversationResourceTarget;
|
|
345
|
+
title: string;
|
|
346
|
+
typeId?: string;
|
|
347
|
+
projectId: string;
|
|
348
|
+
contentSource?: {
|
|
349
|
+
providerKey: string;
|
|
350
|
+
resourceId: string;
|
|
351
|
+
};
|
|
352
|
+
publication?: {
|
|
353
|
+
versionId: string;
|
|
354
|
+
versionNumber: number;
|
|
355
|
+
expiresAt: string;
|
|
356
|
+
};
|
|
357
|
+
access: {
|
|
358
|
+
canOpen: boolean;
|
|
359
|
+
canEdit: boolean;
|
|
360
|
+
analysis: "none" | "bindings" | "explore";
|
|
361
|
+
};
|
|
362
|
+
})[];
|
|
363
|
+
nextCursor: string | null;
|
|
364
|
+
sharedAvailable: boolean;
|
|
365
|
+
};
|
|
366
|
+
refresh: boolean;
|
|
277
367
|
} | {
|
|
278
368
|
success: boolean;
|
|
279
369
|
data: {
|
|
@@ -417,11 +507,46 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
417
507
|
datasetId: string;
|
|
418
508
|
fields: string[];
|
|
419
509
|
}[];
|
|
510
|
+
visualTheme?: "system" | "slate" | "contrast" | undefined;
|
|
420
511
|
sourceMetadata?: {
|
|
421
512
|
bindingId: string;
|
|
422
513
|
title: string;
|
|
423
514
|
description?: string | undefined;
|
|
424
515
|
}[] | undefined;
|
|
516
|
+
templateOrigin?: {
|
|
517
|
+
schema: "xpert.library.instance";
|
|
518
|
+
version: 1;
|
|
519
|
+
template: {
|
|
520
|
+
version: string;
|
|
521
|
+
logicalId: string;
|
|
522
|
+
sha256: string;
|
|
523
|
+
};
|
|
524
|
+
inputs: {
|
|
525
|
+
slot: string;
|
|
526
|
+
mapping: Record<string, string>;
|
|
527
|
+
source: {
|
|
528
|
+
type: "library";
|
|
529
|
+
version: string;
|
|
530
|
+
logicalId: string;
|
|
531
|
+
sha256: string;
|
|
532
|
+
} | {
|
|
533
|
+
type: "dataset";
|
|
534
|
+
artifactId: string;
|
|
535
|
+
revision: number;
|
|
536
|
+
};
|
|
537
|
+
}[];
|
|
538
|
+
parameters: Record<string, string | number | boolean | null>;
|
|
539
|
+
task?: {
|
|
540
|
+
version: string;
|
|
541
|
+
logicalId: string;
|
|
542
|
+
sha256: string;
|
|
543
|
+
} | undefined;
|
|
544
|
+
theme?: {
|
|
545
|
+
version: string;
|
|
546
|
+
logicalId: string;
|
|
547
|
+
sha256: string;
|
|
548
|
+
} | undefined;
|
|
549
|
+
} | undefined;
|
|
425
550
|
components?: {
|
|
426
551
|
title: string;
|
|
427
552
|
id: string;
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.DashboardViewProvider = exports.FEATURE = exports.VIEW_PROVIDER = exports.VIEW_KEY = void 0;
|
|
15
|
+
exports.DashboardViewProvider = exports.FEATURE = exports.VIEW_PROVIDER = exports.VIEW_KEY = exports.DOCUMENT_VIEW_KEY = void 0;
|
|
16
16
|
const node_crypto_1 = require("node:crypto");
|
|
17
17
|
const save_requests_1 = require("./save-requests");
|
|
18
18
|
const projects_service_1 = require("./projects.service");
|
|
@@ -24,6 +24,7 @@ const plugin_sdk_1 = require("@xpert-ai/plugin-sdk");
|
|
|
24
24
|
const dashboard_service_1 = require("./dashboard.service");
|
|
25
25
|
const remote_entry_1 = require("./remote-entry");
|
|
26
26
|
const sharing_service_1 = require("./sharing.service");
|
|
27
|
+
const group_sharing_1 = require("./group-sharing");
|
|
27
28
|
const dashboard_schema_1 = require("./dashboard.schema");
|
|
28
29
|
const dashboard_receipt_1 = require("./dashboard-receipt");
|
|
29
30
|
const dashboard_navigation_1 = require("./dashboard-navigation");
|
|
@@ -31,6 +32,8 @@ const project_1 = require("./project");
|
|
|
31
32
|
const dashboard_icon_1 = require("./dashboard-icon");
|
|
32
33
|
const dashboard_sources_1 = require("./dashboard-sources");
|
|
33
34
|
const archive_service_1 = require("./archive.service");
|
|
35
|
+
const dashboard_discovery_schema_1 = require("./dashboard-discovery.schema");
|
|
36
|
+
exports.DOCUMENT_VIEW_KEY = 'dashboard';
|
|
34
37
|
exports.VIEW_KEY = 'live-dashboard';
|
|
35
38
|
exports.VIEW_PROVIDER = 'live-dashboard';
|
|
36
39
|
exports.FEATURE = 'live_dashboard';
|
|
@@ -47,40 +50,48 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
47
50
|
getViewManifests(context, slot) {
|
|
48
51
|
if (!this.supports(context) || !['agent.workbench', 'agent.workbench.fixed', 'agent.workbench.main'].includes(slot))
|
|
49
52
|
return [];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{ key: '
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
const collection = { key: exports.VIEW_KEY, title: text('Live dashboards', '实时看板'), hostType: context.hostType, slot, order: 35,
|
|
54
|
+
icon: dashboard_icon_1.dashboardIcon, refreshable: true, activation: { projectResource: true, requiredFeatures: [exports.FEATURE] },
|
|
55
|
+
source: { provider: exports.VIEW_PROVIDER, plugin: dashboard_service_1.PLUGIN_NAME },
|
|
56
|
+
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 } },
|
|
57
|
+
view: { type: 'remote_component', runtime: 'react', protocolVersion: 1, component: { isolation: 'iframe', entry: exports.VIEW_KEY }, dataSource: { mode: 'platform' } },
|
|
58
|
+
dataSource: { mode: 'platform', querySchema: { supportsSelection: true, supportsParameters: true, supportsPagination: true, defaultPageSize: 50 }, cache: { enabled: false } },
|
|
59
|
+
fileAccess: { purposes: ['download'] },
|
|
60
|
+
clientCommands: [{ key: 'workbench.resource.open', label: text('Open authorized resource', '打开授权资源') }, { key: 'artifact.use-grants.manage', label: text('Manage group authorization', '管理群聊授权') }, { key: 'workbench.content.close' }, { key: 'workbench.content.status' }, { key: 'workbench.content.resolve' }, { key: contracts_1.ASSISTANT_CONTEXT_SET_COMMAND, label: text('Select dashboard for Assistant', '设置助理当前看板') },
|
|
61
|
+
{ key: contracts_1.ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, label: text('Create with Assistant', '交给助理制作') },
|
|
62
|
+
{ key: contracts_1.ARTIFACT_PRESENTATION_OPEN_COMMAND, label: text('Open shared page', '打开独立页面') },
|
|
63
|
+
{ key: contracts_1.WORKBENCH_NAVIGATION_OPEN_COMMAND, label: text('Open dashboard', '打开看板') }],
|
|
64
|
+
hostEvents: { subscriptions: [{ key: 'dashboard-created', event: 'assistant.tool.completed',
|
|
65
|
+
filter: { toolNames: dashboard_receipt_1.DASHBOARD_MUTATION_TOOLS }, action: { type: 'forward', debounceMs: 0 } }] },
|
|
66
|
+
actions: [
|
|
67
|
+
...group_sharing_1.groupGrantAction.options.map(key => ({ key, label: text('Group authorization', '群聊授权'), actionType: 'invoke' })),
|
|
68
|
+
{ key: 'import-preview', label: text('Import dashboard file', '导入看板文件'), actionType: 'invoke', transport: 'file' },
|
|
69
|
+
...['import-commit', 'import-discard', 'import-browse', 'save-wait', 'save-status'].map(key => ({ key, label: text('Import dashboard', '导入看板'), actionType: 'invoke' })),
|
|
70
|
+
...[
|
|
71
|
+
{ key: 'dashboards', label: text('Select dashboard', '选择看板') },
|
|
72
|
+
{ key: 'available-dashboards', label: text('Find available dashboards', '查找可用看板') },
|
|
73
|
+
{ key: 'projects', label: text('Select project', '选择项目') },
|
|
74
|
+
{ key: 'share-status', label: text('Sharing status', '分享状态') },
|
|
75
|
+
{ key: 'share', label: text('Team sharing', '团队分享') },
|
|
76
|
+
{ key: 'revoke-share', label: text('Revoke sharing', '撤销分享') }
|
|
77
|
+
].map(({ key, label }) => ({ key, label, actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } })),
|
|
78
|
+
{ key: 'delete', label: text('Delete dashboard', '删除看板'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
79
|
+
{ key: 'publish', label: text('Publish draft', '发布草稿'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
80
|
+
{ key: 'save', label: text('Save', '保存'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
81
|
+
{ key: 'restore-version', label: text('Restore as draft', '恢复为草稿'), actionType: 'invoke' },
|
|
82
|
+
{ key: 'query', label: text('Refresh', '刷新'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
83
|
+
{ key: 'query-binding', label: text('Query binding', '查询绑定'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } }
|
|
84
|
+
] };
|
|
85
|
+
return [collection, { ...collection, key: exports.DOCUMENT_VIEW_KEY, title: text('Dashboard', '看板'),
|
|
86
|
+
workbench: { ...collection.workbench, fixed: true, openMode: 'on-demand', menu: { enabled: false } },
|
|
87
|
+
view: { type: 'remote_component', runtime: 'react', protocolVersion: 1, component: { isolation: 'iframe', entry: exports.DOCUMENT_VIEW_KEY }, dataSource: { mode: 'platform' } } }];
|
|
79
88
|
}
|
|
80
|
-
getRemoteComponentEntry() { return (0, remote_entry_1.dashboardRemoteEntry)(); }
|
|
89
|
+
getRemoteComponentEntry(_context, entry = exports.VIEW_KEY) { assertView(entry); return (0, remote_entry_1.dashboardRemoteEntry)(false, undefined, entry === exports.DOCUMENT_VIEW_KEY); }
|
|
81
90
|
async getViewData(context, viewKey, query) {
|
|
82
91
|
assertView(viewKey);
|
|
83
92
|
const params = dashboard_navigation_1.dashboardNavigationSchema.parse(query);
|
|
93
|
+
if (viewKey === exports.DOCUMENT_VIEW_KEY && !params.artifactId)
|
|
94
|
+
throw new common_1.BadRequestException('DASHBOARD_ID_REQUIRED');
|
|
84
95
|
const access = await this.service.access(context);
|
|
85
96
|
const currentProject = await this.projects.current(context);
|
|
86
97
|
// Explicit revision/version selections use the same precedence as openDocument.
|
|
@@ -88,14 +99,14 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
88
99
|
: params.versionId ? 'published' : params.mode ?? (access.canReadDraft ? 'draft' : 'published');
|
|
89
100
|
if (mode === 'draft' && !access.canReadDraft)
|
|
90
101
|
throw new common_1.ForbiddenException('DASHBOARD_DRAFT_ACCESS_DENIED');
|
|
91
|
-
const page = await this.service.listPage(context, params.page, params.pageSize);
|
|
102
|
+
const page = viewKey === exports.DOCUMENT_VIEW_KEY ? { items: [], page: 1, pageSize: 1, hasMore: false } : await this.service.listPage(context, params.page, params.pageSize);
|
|
92
103
|
const selectedDashboard = params.artifactId
|
|
93
104
|
? page.items.find(item => item.artifactId === params.artifactId) ?? await this.service.selectedSummary(context, params.artifactId)
|
|
94
105
|
: undefined;
|
|
95
106
|
const versions = params.artifactId ? await this.service.history(context, params.artifactId) : undefined;
|
|
96
107
|
const unavailable = params.artifactId && mode === 'published' && !params.versionId && !versions?.some(version => version.current);
|
|
97
108
|
const saved = !unavailable && params.artifactId ? await this.service.openDocument(context, params.artifactId, params.versionId, params.draftRevision, mode) : undefined;
|
|
98
|
-
return { meta: { navigationTarget: (0, dashboard_navigation_1.dashboardNavigationTarget)(context), access, mode, currentProject,
|
|
109
|
+
return { meta: { navigationTarget: (0, dashboard_navigation_1.dashboardNavigationTarget)(context, viewKey === exports.DOCUMENT_VIEW_KEY), access, mode, currentProject,
|
|
99
110
|
dashboards: page.items, selectedDashboard, pagination: { page: page.page, pageSize: page.pageSize, hasMore: page.hasMore },
|
|
100
111
|
sources: access.canEdit ? await this.service.sources(context) : [],
|
|
101
112
|
...(unavailable ? { notice: 'not_published' } : params.artifactId ? {
|
|
@@ -104,6 +115,9 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
104
115
|
}
|
|
105
116
|
async executeViewAction(context, viewKey, action, request) {
|
|
106
117
|
assertView(viewKey);
|
|
118
|
+
const grantAction = group_sharing_1.groupGrantAction.safeParse(action);
|
|
119
|
+
if (grantAction.success)
|
|
120
|
+
return { success: true, data: await this.sharing.group(context, grantAction.data, request.input), refresh: false };
|
|
107
121
|
if (action === 'save-wait' && this.saves) {
|
|
108
122
|
const input = save_requests_1.waitSaveRequestSchema.parse(request.input);
|
|
109
123
|
return { success: true, data: await this.saves.wait(context, input.requestId, input.cursor), refresh: false };
|
|
@@ -125,6 +139,13 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
125
139
|
const access = await this.service.access(target);
|
|
126
140
|
return { success: true, data: { ...page, canEdit: access.canEdit, mode: access.canReadDraft ? 'draft' : 'published' }, refresh: false };
|
|
127
141
|
}
|
|
142
|
+
if (action === 'available-dashboards') {
|
|
143
|
+
const { projectId: selectedProject, ...input } = dashboard_discovery_schema_1.dashboardDiscoveryQuerySchema.parse(request.input);
|
|
144
|
+
const currentProject = context.hostType === 'project' ? context.hostId : context.runtimeScope?.projectId;
|
|
145
|
+
const target = selectedProject && selectedProject !== currentProject
|
|
146
|
+
? await this.projects.pickerContext(context, selectedProject) : context;
|
|
147
|
+
return { success: true, data: await this.service.availableResources(target, input), refresh: false };
|
|
148
|
+
}
|
|
128
149
|
if (action === 'projects')
|
|
129
150
|
return { success: true, data: await this.projects.list(context, projects_service_1.projectSearchSchema.parse(request.input)), refresh: false };
|
|
130
151
|
if (action === 'share')
|
|
@@ -149,6 +170,11 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
149
170
|
const input = parsed.data;
|
|
150
171
|
return { success: true, data: await this.service.publish(context, input.artifactId, input.expectedRevision, input.expectedCurrentVersionId), refresh: false };
|
|
151
172
|
}
|
|
173
|
+
if (action === 'restore-version') {
|
|
174
|
+
const input = v3_1.z.object({ artifactId: v3_1.z.string().uuid(), versionId: v3_1.z.string().uuid(),
|
|
175
|
+
expectedRevision: v3_1.z.number().int().nonnegative(), expectedCurrentVersionId: v3_1.z.string().uuid().nullable() }).strict().parse(request.input);
|
|
176
|
+
return { success: true, data: await this.service.restore(context, input.artifactId, input.versionId, input.expectedRevision, input.expectedCurrentVersionId), refresh: false };
|
|
177
|
+
}
|
|
152
178
|
if (action === 'save') {
|
|
153
179
|
const input = dashboard_schema_1.saveSchema.parse(request.input);
|
|
154
180
|
const data = this.saves && input.manifest.bindings.length > 8
|
|
@@ -166,7 +192,7 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
166
192
|
if (!parsed.success)
|
|
167
193
|
throw new common_1.BadRequestException('DASHBOARD_INVALID_QUERY');
|
|
168
194
|
const input = parsed.data;
|
|
169
|
-
return { success: true, data: await this.service.queryBinding(context, input.artifactId, input.versionId, input.bindingId, input.controls, input.draftRevision), refresh: false };
|
|
195
|
+
return { success: true, data: await this.service.queryBinding(context, input.artifactId, input.versionId, input.bindingId, input.controls, input.draftRevision, input.cache), refresh: false };
|
|
170
196
|
}
|
|
171
197
|
throw new common_1.BadRequestException('DASHBOARD_ACTION_UNSUPPORTED');
|
|
172
198
|
}
|
|
@@ -189,5 +215,5 @@ exports.DashboardViewProvider = DashboardViewProvider = __decorate([
|
|
|
189
215
|
__param(4, (0, common_1.Optional)()),
|
|
190
216
|
__metadata("design:paramtypes", [dashboard_service_1.DashboardService, sharing_service_1.DashboardSharingService, projects_service_1.DashboardProjectsService, archive_service_1.DashboardArchiveService, save_requests_1.DashboardSaveRequests])
|
|
191
217
|
], DashboardViewProvider);
|
|
192
|
-
function assertView(key) { if (key !== exports.VIEW_KEY)
|
|
218
|
+
function assertView(key) { if (key !== exports.VIEW_KEY && key !== exports.DOCUMENT_VIEW_KEY)
|
|
193
219
|
throw new common_1.BadRequestException('DASHBOARD_VIEW_UNSUPPORTED'); }
|