@memberjunction/ng-dashboards 5.22.0 → 5.24.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/README.md +51 -0
- package/dist/AI/components/agents/agent-configuration.component.d.ts.map +1 -1
- package/dist/AI/components/agents/agent-configuration.component.js +364 -362
- package/dist/AI/components/agents/agent-configuration.component.js.map +1 -1
- package/dist/AI/components/agents/agent-editor.component.js +2 -2
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.d.ts +947 -64
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.d.ts.map +1 -1
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.js +7645 -430
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.js.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts +285 -6
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.js +2454 -277
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.js.map +1 -1
- package/dist/AI/components/execution-monitoring.component.d.ts.map +1 -1
- package/dist/AI/components/execution-monitoring.component.js +191 -197
- package/dist/AI/components/execution-monitoring.component.js.map +1 -1
- package/dist/AI/components/models/model-management.component.js +9 -8
- package/dist/AI/components/models/model-management.component.js.map +1 -1
- package/dist/AI/components/prompts/prompt-management.component.js +305 -299
- package/dist/AI/components/prompts/prompt-management.component.js.map +1 -1
- package/dist/AI/components/system/system-configuration.component.js +319 -313
- package/dist/AI/components/system/system-configuration.component.js.map +1 -1
- package/dist/AI/components/vectors/vector-management-resource.component.d.ts +20 -2
- package/dist/AI/components/vectors/vector-management-resource.component.d.ts.map +1 -1
- package/dist/AI/components/vectors/vector-management-resource.component.js +419 -232
- package/dist/AI/components/vectors/vector-management-resource.component.js.map +1 -1
- package/dist/APIKeys/api-applications-panel.component.js +10 -12
- package/dist/APIKeys/api-applications-panel.component.js.map +1 -1
- package/dist/APIKeys/api-key-create-dialog.component.js +13 -19
- package/dist/APIKeys/api-key-create-dialog.component.js.map +1 -1
- package/dist/APIKeys/api-key-edit-panel.component.js +12 -14
- package/dist/APIKeys/api-key-edit-panel.component.js.map +1 -1
- package/dist/APIKeys/api-scopes-panel.component.js +61 -68
- package/dist/APIKeys/api-scopes-panel.component.js.map +1 -1
- package/dist/APIKeys/api-usage-panel.component.js +10 -11
- package/dist/APIKeys/api-usage-panel.component.js.map +1 -1
- package/dist/Actions/components/actions-list-view.component.js +82 -96
- package/dist/Actions/components/actions-list-view.component.js.map +1 -1
- package/dist/Actions/components/actions-overview.component.js +130 -134
- package/dist/Actions/components/actions-overview.component.js.map +1 -1
- package/dist/Actions/components/categories-list-view.component.d.ts.map +1 -1
- package/dist/Actions/components/categories-list-view.component.js +40 -46
- package/dist/Actions/components/categories-list-view.component.js.map +1 -1
- package/dist/Actions/components/code-management.component.js +2 -2
- package/dist/Actions/components/code-management.component.js.map +1 -1
- package/dist/Actions/components/entity-integration.component.js +2 -2
- package/dist/Actions/components/entity-integration.component.js.map +1 -1
- package/dist/Actions/components/execution-monitoring.component.js +127 -132
- package/dist/Actions/components/execution-monitoring.component.js.map +1 -1
- package/dist/Actions/components/executions-list-view.component.js +2 -2
- package/dist/Actions/components/executions-list-view.component.js.map +1 -1
- package/dist/Actions/components/explorer/action-card.component.js +11 -17
- package/dist/Actions/components/explorer/action-card.component.js.map +1 -1
- package/dist/Actions/components/explorer/action-explorer.component.js +5 -11
- package/dist/Actions/components/explorer/action-explorer.component.js.map +1 -1
- package/dist/Actions/components/explorer/action-list-item.component.js +8 -10
- package/dist/Actions/components/explorer/action-list-item.component.js.map +1 -1
- package/dist/Actions/components/explorer/action-toolbar.component.js +112 -133
- package/dist/Actions/components/explorer/action-toolbar.component.js.map +1 -1
- package/dist/Actions/components/explorer/action-tree-panel.component.js +63 -83
- package/dist/Actions/components/explorer/action-tree-panel.component.js.map +1 -1
- package/dist/Actions/components/explorer/new-action-panel.component.js +17 -21
- package/dist/Actions/components/explorer/new-action-panel.component.js.map +1 -1
- package/dist/Actions/components/explorer/new-category-panel.component.js +17 -21
- package/dist/Actions/components/explorer/new-category-panel.component.js.map +1 -1
- package/dist/Actions/components/scheduled-actions.component.js +2 -2
- package/dist/Actions/components/scheduled-actions.component.js.map +1 -1
- package/dist/Actions/components/security-permissions.component.js +2 -2
- package/dist/Actions/components/security-permissions.component.js.map +1 -1
- package/dist/ComponentStudio/component-studio-dashboard.component.d.ts +13 -5
- package/dist/ComponentStudio/component-studio-dashboard.component.d.ts.map +1 -1
- package/dist/ComponentStudio/component-studio-dashboard.component.js +168 -145
- package/dist/ComponentStudio/component-studio-dashboard.component.js.map +1 -1
- package/dist/ComponentStudio/components/artifact-load-dialog.component.d.ts +4 -5
- package/dist/ComponentStudio/components/artifact-load-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/artifact-load-dialog.component.js +197 -200
- package/dist/ComponentStudio/components/artifact-load-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.d.ts +5 -7
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.js +142 -148
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/components/browser/component-browser.component.js +153 -166
- package/dist/ComponentStudio/components/browser/component-browser.component.js.map +1 -1
- package/dist/ComponentStudio/components/editors/code-editor-panel.component.js +15 -20
- package/dist/ComponentStudio/components/editors/code-editor-panel.component.js.map +1 -1
- package/dist/ComponentStudio/components/editors/data-requirements-editor.component.js +16 -21
- package/dist/ComponentStudio/components/editors/data-requirements-editor.component.js.map +1 -1
- package/dist/ComponentStudio/components/editors/requirements-editor.component.js +18 -23
- package/dist/ComponentStudio/components/editors/requirements-editor.component.js.map +1 -1
- package/dist/ComponentStudio/components/editors/spec-editor.component.js +25 -30
- package/dist/ComponentStudio/components/editors/spec-editor.component.js.map +1 -1
- package/dist/ComponentStudio/components/new-component-dialog/new-component-dialog.component.js +10 -11
- package/dist/ComponentStudio/components/new-component-dialog/new-component-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/components/save-version-dialog/save-version-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/save-version-dialog/save-version-dialog.component.js +24 -35
- package/dist/ComponentStudio/components/save-version-dialog/save-version-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/components/text-import-dialog.component.js +15 -17
- package/dist/ComponentStudio/components/text-import-dialog.component.js.map +1 -1
- package/dist/Credentials/components/credentials-categories-resource.component.js +7 -6
- package/dist/Credentials/components/credentials-categories-resource.component.js.map +1 -1
- package/dist/Credentials/components/credentials-list-resource.component.js +6 -5
- package/dist/Credentials/components/credentials-list-resource.component.js.map +1 -1
- package/dist/Credentials/components/credentials-types-resource.component.js +7 -6
- package/dist/Credentials/components/credentials-types-resource.component.js.map +1 -1
- package/dist/DashboardBrowser/dashboard-share-dialog.component.js +9 -9
- package/dist/DashboardBrowser/dashboard-share-dialog.component.js.map +1 -1
- package/dist/DataExplorer/data-explorer-dashboard.component.d.ts.map +1 -1
- package/dist/DataExplorer/data-explorer-dashboard.component.js +17 -17
- package/dist/DataExplorer/data-explorer-dashboard.component.js.map +1 -1
- package/dist/Home/home-dashboard.component.js +4 -4
- package/dist/Home/home-dashboard.component.js.map +1 -1
- package/dist/Integration/components/activity/activity.component.d.ts.map +1 -1
- package/dist/Integration/components/activity/activity.component.js +1 -0
- package/dist/Integration/components/activity/activity.component.js.map +1 -1
- package/dist/Integration/components/connections/connections.component.d.ts.map +1 -1
- package/dist/Integration/components/connections/connections.component.js +5 -4
- package/dist/Integration/components/connections/connections.component.js.map +1 -1
- package/dist/Integration/components/mapping-workspace/mapping-workspace.component.d.ts.map +1 -1
- package/dist/Integration/components/mapping-workspace/mapping-workspace.component.js +247 -259
- package/dist/Integration/components/mapping-workspace/mapping-workspace.component.js.map +1 -1
- package/dist/Integration/components/overview/overview.component.d.ts.map +1 -1
- package/dist/Integration/components/overview/overview.component.js +1 -0
- package/dist/Integration/components/overview/overview.component.js.map +1 -1
- package/dist/Integration/components/pipelines/pipelines.component.d.ts.map +1 -1
- package/dist/Integration/components/pipelines/pipelines.component.js +1 -0
- package/dist/Integration/components/pipelines/pipelines.component.js.map +1 -1
- package/dist/Integration/components/schedules/schedules.component.d.ts.map +1 -1
- package/dist/Integration/components/schedules/schedules.component.js +1 -0
- package/dist/Integration/components/schedules/schedules.component.js.map +1 -1
- package/dist/Integration/components/widgets/integration-card.component.js +7 -9
- package/dist/Integration/components/widgets/integration-card.component.js.map +1 -1
- package/dist/Integration/integration.module.d.ts +6 -10
- package/dist/Integration/integration.module.d.ts.map +1 -1
- package/dist/Integration/integration.module.js +12 -20
- package/dist/Integration/integration.module.js.map +1 -1
- package/dist/KnowledgeHub/components/analytics/analytics-resource.component.d.ts +411 -0
- package/dist/KnowledgeHub/components/analytics/analytics-resource.component.d.ts.map +1 -0
- package/dist/KnowledgeHub/components/analytics/analytics-resource.component.js +4266 -0
- package/dist/KnowledgeHub/components/analytics/analytics-resource.component.js.map +1 -0
- package/dist/KnowledgeHub/components/clusters/cluster-visualization-resource.component.d.ts +140 -0
- package/dist/KnowledgeHub/components/clusters/cluster-visualization-resource.component.d.ts.map +1 -0
- package/dist/KnowledgeHub/components/clusters/cluster-visualization-resource.component.js +780 -0
- package/dist/KnowledgeHub/components/clusters/cluster-visualization-resource.component.js.map +1 -0
- package/dist/KnowledgeHub/components/config/knowledge-config-resource.component.d.ts +8 -2
- package/dist/KnowledgeHub/components/config/knowledge-config-resource.component.d.ts.map +1 -1
- package/dist/KnowledgeHub/components/config/knowledge-config-resource.component.js +246 -195
- package/dist/KnowledgeHub/components/config/knowledge-config-resource.component.js.map +1 -1
- package/dist/KnowledgeHub/components/scheduling/scheduling-resource.component.d.ts +75 -0
- package/dist/KnowledgeHub/components/scheduling/scheduling-resource.component.d.ts.map +1 -0
- package/dist/KnowledgeHub/components/scheduling/scheduling-resource.component.js +601 -0
- package/dist/KnowledgeHub/components/scheduling/scheduling-resource.component.js.map +1 -0
- package/dist/KnowledgeHub/components/search/knowledge-search-resource.component.d.ts +93 -12
- package/dist/KnowledgeHub/components/search/knowledge-search-resource.component.d.ts.map +1 -1
- package/dist/KnowledgeHub/components/search/knowledge-search-resource.component.js +637 -107
- package/dist/KnowledgeHub/components/search/knowledge-search-resource.component.js.map +1 -1
- package/dist/KnowledgeHub/index.d.ts +3 -0
- package/dist/KnowledgeHub/index.d.ts.map +1 -1
- package/dist/KnowledgeHub/index.js +3 -0
- package/dist/KnowledgeHub/index.js.map +1 -1
- package/dist/Lists/components/lists-browse-resource.component.d.ts.map +1 -1
- package/dist/Lists/components/lists-browse-resource.component.js +9 -7
- package/dist/Lists/components/lists-browse-resource.component.js.map +1 -1
- package/dist/Lists/components/lists-my-lists-resource.component.js +5 -4
- package/dist/Lists/components/lists-my-lists-resource.component.js.map +1 -1
- package/dist/Lists/components/lists-operations-resource.component.js +10 -9
- package/dist/Lists/components/lists-operations-resource.component.js.map +1 -1
- package/dist/MCP/components/mcp-connection-dialog.component.js +141 -132
- package/dist/MCP/components/mcp-connection-dialog.component.js.map +1 -1
- package/dist/MCP/components/mcp-log-detail-panel.component.js +4 -4
- package/dist/MCP/components/mcp-log-detail-panel.component.js.map +1 -1
- package/dist/MCP/components/mcp-server-dialog.component.js +141 -128
- package/dist/MCP/components/mcp-server-dialog.component.js.map +1 -1
- package/dist/MCP/components/mcp-test-tool-dialog.component.js +210 -218
- package/dist/MCP/components/mcp-test-tool-dialog.component.js.map +1 -1
- package/dist/MCP/mcp-dashboard.component.js +2 -2
- package/dist/MCP/mcp-dashboard.component.js.map +1 -1
- package/dist/MCP/mcp.module.d.ts +6 -9
- package/dist/MCP/mcp.module.d.ts.map +1 -1
- package/dist/MCP/mcp.module.js +20 -22
- package/dist/MCP/mcp.module.js.map +1 -1
- package/dist/Scheduling/components/scheduling-activity.component.js +5 -4
- package/dist/Scheduling/components/scheduling-activity.component.js.map +1 -1
- package/dist/Scheduling/components/scheduling-jobs.component.js +6 -5
- package/dist/Scheduling/components/scheduling-jobs.component.js.map +1 -1
- package/dist/Scheduling/components/scheduling-overview.component.js +93 -92
- package/dist/Scheduling/components/scheduling-overview.component.js.map +1 -1
- package/dist/Testing/testing-dashboard.component.js +9 -10
- package/dist/Testing/testing-dashboard.component.js.map +1 -1
- package/dist/__tests__/analytics-resource.test.d.ts +2 -0
- package/dist/__tests__/analytics-resource.test.d.ts.map +1 -0
- package/dist/__tests__/analytics-resource.test.js +181 -0
- package/dist/__tests__/analytics-resource.test.js.map +1 -0
- package/dist/__tests__/scheduling.test.d.ts +2 -0
- package/dist/__tests__/scheduling.test.d.ts.map +1 -0
- package/dist/__tests__/scheduling.test.js +205 -0
- package/dist/__tests__/scheduling.test.js.map +1 -0
- package/dist/actions-dashboards.module.d.ts +8 -13
- package/dist/actions-dashboards.module.d.ts.map +1 -1
- package/dist/actions-dashboards.module.js +6 -27
- package/dist/actions-dashboards.module.js.map +1 -1
- package/dist/ai-dashboards.module.d.ts +20 -20
- package/dist/ai-dashboards.module.d.ts.map +1 -1
- package/dist/ai-dashboards.module.js +43 -44
- package/dist/ai-dashboards.module.js.map +1 -1
- package/dist/communication-dashboards.module.d.ts +4 -8
- package/dist/communication-dashboards.module.d.ts.map +1 -1
- package/dist/communication-dashboards.module.js +0 -19
- package/dist/communication-dashboards.module.js.map +1 -1
- package/dist/component-studio-dashboards.module.d.ts +7 -11
- package/dist/component-studio-dashboards.module.d.ts.map +1 -1
- package/dist/component-studio-dashboards.module.js +22 -34
- package/dist/component-studio-dashboards.module.js.map +1 -1
- package/dist/core-dashboards.module.d.ts +12 -18
- package/dist/core-dashboards.module.d.ts.map +1 -1
- package/dist/core-dashboards.module.js +15 -31
- package/dist/core-dashboards.module.js.map +1 -1
- package/dist/credentials-dashboards.module.d.ts +5 -8
- package/dist/credentials-dashboards.module.d.ts.map +1 -1
- package/dist/credentials-dashboards.module.js +3 -19
- package/dist/credentials-dashboards.module.js.map +1 -1
- package/dist/data-explorer-dashboards.module.d.ts +7 -13
- package/dist/data-explorer-dashboards.module.d.ts.map +1 -1
- package/dist/data-explorer-dashboards.module.js +0 -27
- package/dist/data-explorer-dashboards.module.js.map +1 -1
- package/dist/lists-dashboards.module.d.ts +5 -8
- package/dist/lists-dashboards.module.d.ts.map +1 -1
- package/dist/lists-dashboards.module.js +3 -19
- package/dist/lists-dashboards.module.js.map +1 -1
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +2 -0
- package/dist/public-api.js.map +1 -1
- package/dist/scheduling-dashboards.module.d.ts +6 -10
- package/dist/scheduling-dashboards.module.d.ts.map +1 -1
- package/dist/scheduling-dashboards.module.js +3 -23
- package/dist/scheduling-dashboards.module.js.map +1 -1
- package/dist/shared/entity-field-display.d.ts +44 -0
- package/dist/shared/entity-field-display.d.ts.map +1 -0
- package/dist/shared/entity-field-display.js +118 -0
- package/dist/shared/entity-field-display.js.map +1 -0
- package/dist/testing-dashboards.module.d.ts +7 -13
- package/dist/testing-dashboards.module.d.ts.map +1 -1
- package/dist/testing-dashboards.module.js +0 -27
- package/dist/testing-dashboards.module.js.map +1 -1
- package/package.json +48 -55
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Knowledge Hub Clusters Dashboard Tab
|
|
9
|
+
*
|
|
10
|
+
* Full-page cluster visualization with:
|
|
11
|
+
* - Left sidebar: saved cluster visualizations (persisted via UserInfoEngine)
|
|
12
|
+
* - Main area: SVG scatter plot (mj-cluster-scatter)
|
|
13
|
+
* - Floating config panel (mj-cluster-config-panel)
|
|
14
|
+
* - Top metrics bar
|
|
15
|
+
*
|
|
16
|
+
* Registered as BaseResourceComponent for the Knowledge Hub application.
|
|
17
|
+
*/
|
|
18
|
+
import { Component, ChangeDetectorRef, inject, ViewChild } from '@angular/core';
|
|
19
|
+
import { Subject } from 'rxjs';
|
|
20
|
+
import { CompositeKey, Metadata } from '@memberjunction/core';
|
|
21
|
+
import { UserInfoEngine, KnowledgeHubMetadataEngine } from '@memberjunction/core-entities';
|
|
22
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
23
|
+
import { BaseResourceComponent, NavigationService } from '@memberjunction/ng-shared';
|
|
24
|
+
import { GraphQLAIClient } from '@memberjunction/graphql-dataprovider';
|
|
25
|
+
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
26
|
+
import { DefaultClusterConfig, } from '@memberjunction/ng-clustering';
|
|
27
|
+
import { ClusteringService } from '@memberjunction/ng-clustering';
|
|
28
|
+
import * as i0 from "@angular/core";
|
|
29
|
+
import * as i1 from "@memberjunction/ng-clustering";
|
|
30
|
+
const _c0 = ["scatterPlot"];
|
|
31
|
+
const _c1 = () => [];
|
|
32
|
+
function ClusterVisualizationResourceComponent_For_8_Template(rf, ctx) { if (rf & 1) {
|
|
33
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
34
|
+
i0.ɵɵelementStart(0, "div", 16);
|
|
35
|
+
i0.ɵɵlistener("click", function ClusterVisualizationResourceComponent_For_8_Template_div_click_0_listener() { const saved_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.OnSelectSaved(saved_r3)); });
|
|
36
|
+
i0.ɵɵelementStart(1, "div", 17);
|
|
37
|
+
i0.ɵɵtext(2);
|
|
38
|
+
i0.ɵɵelementEnd();
|
|
39
|
+
i0.ɵɵelementStart(3, "div", 18)(4, "span");
|
|
40
|
+
i0.ɵɵtext(5);
|
|
41
|
+
i0.ɵɵelementEnd();
|
|
42
|
+
i0.ɵɵelementStart(6, "span");
|
|
43
|
+
i0.ɵɵtext(7);
|
|
44
|
+
i0.ɵɵelementEnd()();
|
|
45
|
+
i0.ɵɵelementStart(8, "button", 19);
|
|
46
|
+
i0.ɵɵlistener("click", function ClusterVisualizationResourceComponent_For_8_Template_button_click_8_listener($event) { const saved_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.OnDeleteSaved(saved_r3, $event)); });
|
|
47
|
+
i0.ɵɵelement(9, "i", 20);
|
|
48
|
+
i0.ɵɵelementEnd()();
|
|
49
|
+
} if (rf & 2) {
|
|
50
|
+
const saved_r3 = ctx.$implicit;
|
|
51
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
52
|
+
i0.ɵɵclassProp("active", ctx_r3.IsActiveSaved(saved_r3));
|
|
53
|
+
i0.ɵɵadvance(2);
|
|
54
|
+
i0.ɵɵtextInterpolate(saved_r3.Name);
|
|
55
|
+
i0.ɵɵadvance(3);
|
|
56
|
+
i0.ɵɵtextInterpolate(saved_r3.EntityName);
|
|
57
|
+
i0.ɵɵadvance(2);
|
|
58
|
+
i0.ɵɵtextInterpolate(ctx_r3.FormatDate(saved_r3.CreatedAt));
|
|
59
|
+
} }
|
|
60
|
+
function ClusterVisualizationResourceComponent_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
61
|
+
i0.ɵɵelementStart(0, "div", 7);
|
|
62
|
+
i0.ɵɵelement(1, "i", 21);
|
|
63
|
+
i0.ɵɵelementStart(2, "p");
|
|
64
|
+
i0.ɵɵtext(3, "No saved visualizations yet");
|
|
65
|
+
i0.ɵɵelementEnd()();
|
|
66
|
+
} }
|
|
67
|
+
function ClusterVisualizationResourceComponent_Conditional_17_Template(rf, ctx) { if (rf & 1) {
|
|
68
|
+
i0.ɵɵelementStart(0, "div", 22);
|
|
69
|
+
i0.ɵɵelement(1, "i", 23);
|
|
70
|
+
i0.ɵɵtext(2, " Records: ");
|
|
71
|
+
i0.ɵɵelementStart(3, "span", 24);
|
|
72
|
+
i0.ɵɵtext(4);
|
|
73
|
+
i0.ɵɵelementEnd()();
|
|
74
|
+
i0.ɵɵelementStart(5, "div", 22);
|
|
75
|
+
i0.ɵɵelement(6, "i", 25);
|
|
76
|
+
i0.ɵɵtext(7, " Clusters: ");
|
|
77
|
+
i0.ɵɵelementStart(8, "span", 24);
|
|
78
|
+
i0.ɵɵtext(9);
|
|
79
|
+
i0.ɵɵelementEnd()();
|
|
80
|
+
i0.ɵɵelementStart(10, "div", 22);
|
|
81
|
+
i0.ɵɵelement(11, "i", 26);
|
|
82
|
+
i0.ɵɵtext(12, " Silhouette: ");
|
|
83
|
+
i0.ɵɵelementStart(13, "span", 24);
|
|
84
|
+
i0.ɵɵtext(14);
|
|
85
|
+
i0.ɵɵelementEnd()();
|
|
86
|
+
i0.ɵɵelementStart(15, "div", 22);
|
|
87
|
+
i0.ɵɵelement(16, "i", 27);
|
|
88
|
+
i0.ɵɵtext(17, " Computed: ");
|
|
89
|
+
i0.ɵɵelementStart(18, "span", 24);
|
|
90
|
+
i0.ɵɵtext(19);
|
|
91
|
+
i0.ɵɵelementEnd()();
|
|
92
|
+
} if (rf & 2) {
|
|
93
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
94
|
+
i0.ɵɵadvance(4);
|
|
95
|
+
i0.ɵɵtextInterpolate(ctx_r3.Result.Metrics.RecordCount);
|
|
96
|
+
i0.ɵɵadvance(5);
|
|
97
|
+
i0.ɵɵtextInterpolate(ctx_r3.Result.Metrics.ClusterCount);
|
|
98
|
+
i0.ɵɵadvance(4);
|
|
99
|
+
i0.ɵɵclassProp("good", ctx_r3.IsSilhouetteGood);
|
|
100
|
+
i0.ɵɵadvance();
|
|
101
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r3.SilhouetteScoreFormatted, " ");
|
|
102
|
+
i0.ɵɵadvance(5);
|
|
103
|
+
i0.ɵɵtextInterpolate(ctx_r3.ComputationTimeFormatted);
|
|
104
|
+
} }
|
|
105
|
+
/**
|
|
106
|
+
* Build an environment-scoped storage key so cluster data does not bleed
|
|
107
|
+
* across different database environments that share the same browser.
|
|
108
|
+
* Uses the GraphQL endpoint origin as the environment fingerprint.
|
|
109
|
+
*/
|
|
110
|
+
function buildEnvScopedKey(base) {
|
|
111
|
+
try {
|
|
112
|
+
const origin = Metadata.Provider.ConfigData?.URL;
|
|
113
|
+
if (origin) {
|
|
114
|
+
// Use just the origin portion (protocol + host) so path differences don't fragment keys
|
|
115
|
+
const url = new URL(origin);
|
|
116
|
+
return `${base}_${url.origin}`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch { /* fall through */ }
|
|
120
|
+
return base;
|
|
121
|
+
}
|
|
122
|
+
const SAVED_CLUSTERS_BASE_KEY = 'KnowledgeHub_SavedClusters';
|
|
123
|
+
const LAST_SESSION_BASE_KEY = 'KnowledgeHub_LastClusterSession';
|
|
124
|
+
let ClusterVisualizationResourceComponent = class ClusterVisualizationResourceComponent extends BaseResourceComponent {
|
|
125
|
+
scatterPlot;
|
|
126
|
+
cdr = inject(ChangeDetectorRef);
|
|
127
|
+
clusteringService = inject(ClusteringService);
|
|
128
|
+
navigationService = inject(NavigationService);
|
|
129
|
+
destroy$ = new Subject();
|
|
130
|
+
/** LLM-generated cluster labels for the current result */
|
|
131
|
+
ClusterLabels = [];
|
|
132
|
+
// ================================================================
|
|
133
|
+
// Resource overrides
|
|
134
|
+
// ================================================================
|
|
135
|
+
async GetResourceDisplayName(_data) {
|
|
136
|
+
return 'Clusters';
|
|
137
|
+
}
|
|
138
|
+
async GetResourceIconClass(_data) {
|
|
139
|
+
return 'fa-solid fa-circle-nodes';
|
|
140
|
+
}
|
|
141
|
+
// ================================================================
|
|
142
|
+
// State
|
|
143
|
+
// ================================================================
|
|
144
|
+
/** Current visualization result */
|
|
145
|
+
Result = null;
|
|
146
|
+
/** Whether a clustering run is in progress */
|
|
147
|
+
IsRunning = false;
|
|
148
|
+
/** The active cluster config */
|
|
149
|
+
ActiveConfig = DefaultClusterConfig();
|
|
150
|
+
/** Title for the top bar */
|
|
151
|
+
VisualizationTitle = 'New Cluster Analysis';
|
|
152
|
+
/** Entity options for the config panel dropdown */
|
|
153
|
+
EntityOptions = [];
|
|
154
|
+
/** Entity document options for the selected entity (shown when 2+) */
|
|
155
|
+
EntityDocOptions = [];
|
|
156
|
+
/** Ordered field keys for prioritized display in scatter tooltip/detail */
|
|
157
|
+
FieldPriority = [];
|
|
158
|
+
/** Map of field names to human-readable display names */
|
|
159
|
+
FieldDisplayNames = {};
|
|
160
|
+
// Saved visualizations
|
|
161
|
+
SavedVisualizations = [];
|
|
162
|
+
ActiveSavedId = null;
|
|
163
|
+
// User setting entity for persistence
|
|
164
|
+
userSettingEntity = null;
|
|
165
|
+
// ================================================================
|
|
166
|
+
// Lifecycle
|
|
167
|
+
// ================================================================
|
|
168
|
+
async ngAfterViewInit() {
|
|
169
|
+
await this.loadEntityOptions();
|
|
170
|
+
this.loadSavedVisualizations();
|
|
171
|
+
this.restoreLastSession();
|
|
172
|
+
this.navigationService.SetAgentContext(this, {
|
|
173
|
+
IsVisualizationLoaded: !!this.Result,
|
|
174
|
+
VisualizationTitle: this.VisualizationTitle || null,
|
|
175
|
+
ClusterCount: this.Result?.Clusters?.length ?? 0,
|
|
176
|
+
TotalPoints: this.Result?.Points?.length ?? 0,
|
|
177
|
+
});
|
|
178
|
+
this.NotifyLoadComplete();
|
|
179
|
+
}
|
|
180
|
+
ngOnDestroy() {
|
|
181
|
+
this.destroy$.next();
|
|
182
|
+
this.destroy$.complete();
|
|
183
|
+
}
|
|
184
|
+
// ================================================================
|
|
185
|
+
// Getters
|
|
186
|
+
// ================================================================
|
|
187
|
+
get Metrics() {
|
|
188
|
+
return this.Result?.Metrics ?? null;
|
|
189
|
+
}
|
|
190
|
+
get HasResult() {
|
|
191
|
+
return this.Result != null && this.Result.Points.length > 0;
|
|
192
|
+
}
|
|
193
|
+
get SilhouetteScoreFormatted() {
|
|
194
|
+
return this.Result?.Metrics?.SilhouetteScore?.toFixed(2) ?? '--';
|
|
195
|
+
}
|
|
196
|
+
get IsSilhouetteGood() {
|
|
197
|
+
return (this.Result?.Metrics?.SilhouetteScore ?? 0) >= 0.5;
|
|
198
|
+
}
|
|
199
|
+
get ComputationTimeFormatted() {
|
|
200
|
+
const ms = this.Result?.Metrics?.ComputationTimeMs ?? 0;
|
|
201
|
+
return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${ms}ms`;
|
|
202
|
+
}
|
|
203
|
+
// ================================================================
|
|
204
|
+
// Public Methods
|
|
205
|
+
// ================================================================
|
|
206
|
+
/** Handle "Run Clustering" from the config panel */
|
|
207
|
+
async OnRunClustering(config) {
|
|
208
|
+
this.IsRunning = true;
|
|
209
|
+
this.ActiveConfig = config;
|
|
210
|
+
this.ClusterLabels = [];
|
|
211
|
+
// Auto-hide detail panel from previous visualization
|
|
212
|
+
this.scatterPlot?.CloseDetailPanel();
|
|
213
|
+
// Update entity doc options if entity changed
|
|
214
|
+
this.updateEntityDocOptions(config.EntityName);
|
|
215
|
+
this.cdr.detectChanges();
|
|
216
|
+
try {
|
|
217
|
+
// Fetch vectors from the vector database
|
|
218
|
+
const vectors = await this.fetchVectorsForEntity(config);
|
|
219
|
+
// Run clustering (client-side UMAP + K-Means/DBSCAN)
|
|
220
|
+
this.Result = await this.clusteringService.RunClustering(vectors, config);
|
|
221
|
+
this.VisualizationTitle = `${config.EntityName} — ${config.Algorithm === 'kmeans' ? 'K-Means' : 'DBSCAN'}`;
|
|
222
|
+
this.FieldPriority = this.ComputeFieldPriority(config.EntityName);
|
|
223
|
+
// Fire LLM cluster naming in the background (non-blocking).
|
|
224
|
+
// Clusters render immediately; labels appear when LLM responds.
|
|
225
|
+
this.requestClusterLabelsFromLLM().catch(err => console.warn('[ClusterVisualization] Background naming failed:', err));
|
|
226
|
+
// Auto-save session state so it can be restored after navigation
|
|
227
|
+
this.saveLastSession();
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
console.error('[ClusterVisualization] Pipeline error:', error);
|
|
231
|
+
this.Result = null;
|
|
232
|
+
}
|
|
233
|
+
finally {
|
|
234
|
+
this.IsRunning = false;
|
|
235
|
+
this.cdr.detectChanges();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/** Handle point click — log for now */
|
|
239
|
+
OnPointClicked(_point) {
|
|
240
|
+
// Detail panel is handled by the scatter component internally
|
|
241
|
+
}
|
|
242
|
+
/** Handle point hover */
|
|
243
|
+
OnPointHovered(_point) {
|
|
244
|
+
// Tooltip display handled by scatter component
|
|
245
|
+
}
|
|
246
|
+
/** Navigate to the entity record when "Open Record" is clicked in the detail panel */
|
|
247
|
+
OnOpenRecord(point) {
|
|
248
|
+
const entityName = point.Metadata?.['Entity'];
|
|
249
|
+
const recordID = point.Metadata?.['RecordID'];
|
|
250
|
+
if (!entityName || !recordID)
|
|
251
|
+
return;
|
|
252
|
+
const compositeKey = new CompositeKey();
|
|
253
|
+
compositeKey.SimpleLoadFromURLSegment(recordID);
|
|
254
|
+
this.navigationService.OpenEntityRecord(entityName, compositeKey);
|
|
255
|
+
}
|
|
256
|
+
/** Save the current visualization */
|
|
257
|
+
async OnSaveVisualization() {
|
|
258
|
+
if (!this.Result)
|
|
259
|
+
return;
|
|
260
|
+
const id = crypto.randomUUID();
|
|
261
|
+
const saved = {
|
|
262
|
+
Id: id,
|
|
263
|
+
Name: this.VisualizationTitle,
|
|
264
|
+
EntityName: this.ActiveConfig.EntityName,
|
|
265
|
+
Algorithm: this.ActiveConfig.Algorithm,
|
|
266
|
+
Params: { ...this.ActiveConfig },
|
|
267
|
+
CreatedAt: new Date().toISOString(),
|
|
268
|
+
Result: this.stripVectorsFromResult(this.Result),
|
|
269
|
+
Viewport: this.scatterPlot?.GetViewportTransform(),
|
|
270
|
+
ClusterLabels: this.ClusterLabels.length > 0 ? [...this.ClusterLabels] : undefined,
|
|
271
|
+
};
|
|
272
|
+
this.SavedVisualizations = [saved, ...this.SavedVisualizations];
|
|
273
|
+
this.ActiveSavedId = id;
|
|
274
|
+
await this.persistSavedVisualizations();
|
|
275
|
+
this.cdr.detectChanges();
|
|
276
|
+
}
|
|
277
|
+
/** Select a saved visualization — restore from cache if available, otherwise re-run */
|
|
278
|
+
async OnSelectSaved(saved) {
|
|
279
|
+
this.scatterPlot?.CloseDetailPanel();
|
|
280
|
+
this.ActiveSavedId = saved.Id;
|
|
281
|
+
this.VisualizationTitle = saved.Name;
|
|
282
|
+
// Reconstruct config
|
|
283
|
+
const config = {
|
|
284
|
+
...DefaultClusterConfig(),
|
|
285
|
+
...saved.Params,
|
|
286
|
+
EntityName: saved.EntityName,
|
|
287
|
+
Algorithm: saved.Algorithm,
|
|
288
|
+
};
|
|
289
|
+
this.ActiveConfig = config;
|
|
290
|
+
// If we have cached results, restore instantly without re-running
|
|
291
|
+
if (saved.Result) {
|
|
292
|
+
this.Result = saved.Result;
|
|
293
|
+
this.ClusterLabels = saved.ClusterLabels ?? [];
|
|
294
|
+
this.applyLabelsToResult();
|
|
295
|
+
this.cdr.detectChanges();
|
|
296
|
+
// Restore viewport after a tick (scatter needs to render first)
|
|
297
|
+
if (saved.Viewport) {
|
|
298
|
+
setTimeout(() => {
|
|
299
|
+
this.scatterPlot?.SetViewportTransform(saved.Viewport);
|
|
300
|
+
this.cdr.detectChanges();
|
|
301
|
+
}, 50);
|
|
302
|
+
}
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
// No cached results — re-run from scratch
|
|
306
|
+
await this.OnRunClustering(config);
|
|
307
|
+
}
|
|
308
|
+
/** Delete a saved visualization */
|
|
309
|
+
async OnDeleteSaved(saved, event) {
|
|
310
|
+
event.stopPropagation();
|
|
311
|
+
this.SavedVisualizations = this.SavedVisualizations.filter(s => s.Id !== saved.Id);
|
|
312
|
+
if (this.ActiveSavedId === saved.Id) {
|
|
313
|
+
this.ActiveSavedId = null;
|
|
314
|
+
}
|
|
315
|
+
await this.persistSavedVisualizations();
|
|
316
|
+
this.cdr.detectChanges();
|
|
317
|
+
}
|
|
318
|
+
/** Start a new analysis (clear current) */
|
|
319
|
+
OnNewAnalysis() {
|
|
320
|
+
this.scatterPlot?.CloseDetailPanel();
|
|
321
|
+
this.ActiveSavedId = null;
|
|
322
|
+
this.Result = null;
|
|
323
|
+
this.ClusterLabels = [];
|
|
324
|
+
this.VisualizationTitle = 'New Cluster Analysis';
|
|
325
|
+
this.ActiveConfig = DefaultClusterConfig();
|
|
326
|
+
this.cdr.detectChanges();
|
|
327
|
+
}
|
|
328
|
+
IsActiveSaved(saved) {
|
|
329
|
+
return this.ActiveSavedId === saved.Id;
|
|
330
|
+
}
|
|
331
|
+
TrackSavedBy(_index, saved) {
|
|
332
|
+
return saved.Id;
|
|
333
|
+
}
|
|
334
|
+
FormatDate(iso) {
|
|
335
|
+
try {
|
|
336
|
+
return new Date(iso).toLocaleDateString();
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
return iso;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// ================================================================
|
|
343
|
+
// Private Methods
|
|
344
|
+
// ================================================================
|
|
345
|
+
/** Populate the entity options for the config panel dropdown */
|
|
346
|
+
async loadEntityOptions() {
|
|
347
|
+
try {
|
|
348
|
+
// Use KnowledgeHubMetadataEngine for cached entity document data
|
|
349
|
+
const engine = KnowledgeHubMetadataEngine.Instance;
|
|
350
|
+
await engine.Config(false);
|
|
351
|
+
const entityNames = engine.GetEntitiesWithDocuments();
|
|
352
|
+
if (entityNames.length > 0) {
|
|
353
|
+
this.EntityOptions = entityNames.map(name => ({ Name: name }));
|
|
354
|
+
}
|
|
355
|
+
// Set default entity if config is blank
|
|
356
|
+
if (this.EntityOptions.length > 0 && !this.ActiveConfig.EntityName) {
|
|
357
|
+
this.ActiveConfig.EntityName = this.EntityOptions[0].Name;
|
|
358
|
+
}
|
|
359
|
+
// Populate entity doc options for the default entity
|
|
360
|
+
this.updateEntityDocOptions(this.ActiveConfig.EntityName);
|
|
361
|
+
}
|
|
362
|
+
catch (error) {
|
|
363
|
+
console.warn('[ClusterVisualization] Error loading entity options:', error);
|
|
364
|
+
}
|
|
365
|
+
this.cdr.detectChanges();
|
|
366
|
+
}
|
|
367
|
+
/** Update entity document options when the selected entity changes */
|
|
368
|
+
updateEntityDocOptions(entityName) {
|
|
369
|
+
if (!entityName) {
|
|
370
|
+
this.EntityDocOptions = [];
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const engine = KnowledgeHubMetadataEngine.Instance;
|
|
374
|
+
const docs = engine.GetEntityDocumentsForEntity(entityName)
|
|
375
|
+
.filter(d => d.Status === 'Active');
|
|
376
|
+
this.EntityDocOptions = docs.map(d => ({ ID: d.ID, Name: d.Name }));
|
|
377
|
+
// Auto-select the first doc (or clear if none)
|
|
378
|
+
if (docs.length > 0 && !this.ActiveConfig.EntityDocumentID) {
|
|
379
|
+
this.ActiveConfig.EntityDocumentID = docs[0].ID;
|
|
380
|
+
}
|
|
381
|
+
else if (docs.length === 0) {
|
|
382
|
+
this.ActiveConfig.EntityDocumentID = '';
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Fetch vectors from Entity Document Runs via RunView.
|
|
387
|
+
* Entity Documents store vectorized entity data; we query for runs
|
|
388
|
+
* that match the requested entity.
|
|
389
|
+
*/
|
|
390
|
+
async fetchVectorsForEntity(config) {
|
|
391
|
+
// Use the selected entity document, or fall back to first active one
|
|
392
|
+
let entityDocID = config.EntityDocumentID;
|
|
393
|
+
if (!entityDocID) {
|
|
394
|
+
const engine = KnowledgeHubMetadataEngine.Instance;
|
|
395
|
+
const entityDocs = engine.GetEntityDocumentsForEntity(config.EntityName)
|
|
396
|
+
.filter(d => d.Status === 'Active');
|
|
397
|
+
if (entityDocs.length === 0) {
|
|
398
|
+
return [];
|
|
399
|
+
}
|
|
400
|
+
entityDocID = entityDocs[0].ID;
|
|
401
|
+
}
|
|
402
|
+
// Fetch vectors + metadata directly from the vector database (Pinecone)
|
|
403
|
+
const provider = Metadata.Provider;
|
|
404
|
+
const aiClient = new GraphQLAIClient(provider);
|
|
405
|
+
const result = await aiClient.FetchEntityVectors({
|
|
406
|
+
entityDocumentID: entityDocID,
|
|
407
|
+
maxRecords: config.MaxRecords,
|
|
408
|
+
filter: config.Filter || undefined,
|
|
409
|
+
});
|
|
410
|
+
if (!result.Success || result.Results.length === 0) {
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
// Convert vector DB results to ClusterInputVector format
|
|
414
|
+
const vectors = [];
|
|
415
|
+
for (const item of result.Results) {
|
|
416
|
+
if (!item.Values || item.Values.length === 0)
|
|
417
|
+
continue;
|
|
418
|
+
const metadata = this.parseVectorMetadata(item.Metadata);
|
|
419
|
+
const label = this.buildLabel(metadata);
|
|
420
|
+
vectors.push({
|
|
421
|
+
Key: item.ID,
|
|
422
|
+
Label: label,
|
|
423
|
+
Vector: item.Values,
|
|
424
|
+
Metadata: metadata,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
return vectors;
|
|
428
|
+
}
|
|
429
|
+
/** Parse the JSON metadata string from the vector DB into a record */
|
|
430
|
+
parseVectorMetadata(metadataJson) {
|
|
431
|
+
try {
|
|
432
|
+
return JSON.parse(metadataJson);
|
|
433
|
+
}
|
|
434
|
+
catch {
|
|
435
|
+
return {};
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Build a human-readable label from vector metadata using entity field metadata.
|
|
440
|
+
* Combines all IsNameField fields in Sequence order (e.g., "Sarah Chen" from FirstName + LastName).
|
|
441
|
+
* Falls back to heuristic field detection when entity metadata isn't available.
|
|
442
|
+
*/
|
|
443
|
+
buildLabel(metadata) {
|
|
444
|
+
const entityName = metadata['Entity'];
|
|
445
|
+
if (entityName) {
|
|
446
|
+
try {
|
|
447
|
+
const md = new Metadata();
|
|
448
|
+
const entityInfo = md.Entities.find(e => e.Name === entityName);
|
|
449
|
+
if (entityInfo) {
|
|
450
|
+
// Combine all IsNameField fields in Sequence order
|
|
451
|
+
const nameFields = entityInfo.Fields
|
|
452
|
+
.filter(f => f.IsNameField)
|
|
453
|
+
.sort((a, b) => (a.Sequence ?? 9999) - (b.Sequence ?? 9999));
|
|
454
|
+
if (nameFields.length > 0) {
|
|
455
|
+
const parts = nameFields
|
|
456
|
+
.map(f => metadata[f.Name])
|
|
457
|
+
.filter(v => v != null && v.trim() !== '');
|
|
458
|
+
if (parts.length > 0)
|
|
459
|
+
return parts.join(' ');
|
|
460
|
+
}
|
|
461
|
+
// Single NameField fallback
|
|
462
|
+
if (entityInfo.NameField && metadata[entityInfo.NameField.Name]) {
|
|
463
|
+
return metadata[entityInfo.NameField.Name];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
catch { /* metadata not available, fall through */ }
|
|
468
|
+
}
|
|
469
|
+
// Heuristic fallbacks
|
|
470
|
+
return metadata['Name']
|
|
471
|
+
|| metadata['Title']
|
|
472
|
+
|| metadata['Description']?.substring(0, 60)
|
|
473
|
+
|| metadata['RecordID']
|
|
474
|
+
|| 'Unknown';
|
|
475
|
+
}
|
|
476
|
+
// ================================================================
|
|
477
|
+
// LLM Cluster Naming
|
|
478
|
+
// ================================================================
|
|
479
|
+
/**
|
|
480
|
+
* After clustering completes, send sample records per cluster to an LLM for naming.
|
|
481
|
+
* Updates ClusterLabels and refreshes the view.
|
|
482
|
+
*/
|
|
483
|
+
async requestClusterLabelsFromLLM() {
|
|
484
|
+
if (!this.Result || this.Result.Clusters.length === 0)
|
|
485
|
+
return;
|
|
486
|
+
try {
|
|
487
|
+
const clusterData = this.buildClusterDataForPrompt(this.Result);
|
|
488
|
+
if (!clusterData)
|
|
489
|
+
return;
|
|
490
|
+
// Look up the "Cluster Naming" prompt from AIEngineBase cached metadata
|
|
491
|
+
const promptEntity = AIEngineBase.Instance.Prompts.find(p => p.Name === 'Cluster Naming');
|
|
492
|
+
if (!promptEntity) {
|
|
493
|
+
console.warn('[ClusterVisualization] "Cluster Naming" prompt not found — run metadata sync');
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
const provider = Metadata.Provider;
|
|
497
|
+
const aiClient = new GraphQLAIClient(provider);
|
|
498
|
+
const result = await aiClient.RunAIPrompt({
|
|
499
|
+
promptId: promptEntity.ID,
|
|
500
|
+
data: { clusterData },
|
|
501
|
+
});
|
|
502
|
+
if (result.success && result.parsedResult) {
|
|
503
|
+
const labels = result.parsedResult;
|
|
504
|
+
this.ClusterLabels = labels.map(l => ({
|
|
505
|
+
ClusterId: l.clusterId,
|
|
506
|
+
Label: l.label,
|
|
507
|
+
IsUserEdited: false,
|
|
508
|
+
}));
|
|
509
|
+
this.applyLabelsToResult();
|
|
510
|
+
this.cdr.detectChanges();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
catch (error) {
|
|
514
|
+
console.warn('[ClusterVisualization] LLM cluster naming failed:', error);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/** Build a text block describing sample records per cluster for the LLM prompt */
|
|
518
|
+
buildClusterDataForPrompt(result) {
|
|
519
|
+
if (!result.Clusters || result.Clusters.length === 0)
|
|
520
|
+
return null;
|
|
521
|
+
const lines = [];
|
|
522
|
+
for (const cluster of result.Clusters) {
|
|
523
|
+
// Get points in this cluster, take up to 5 samples
|
|
524
|
+
const clusterPoints = result.Points.filter(p => p.ClusterId === cluster.Id);
|
|
525
|
+
const samples = clusterPoints.slice(0, 5);
|
|
526
|
+
if (samples.length === 0)
|
|
527
|
+
continue;
|
|
528
|
+
lines.push(`### Cluster ${cluster.Id} (${clusterPoints.length} records)`);
|
|
529
|
+
for (const point of samples) {
|
|
530
|
+
const meta = point.Metadata || {};
|
|
531
|
+
// Include the most informative metadata fields
|
|
532
|
+
const fields = ['Name', 'Title', 'Description', 'Entity', 'Status', 'Type']
|
|
533
|
+
.filter(f => meta[f])
|
|
534
|
+
.map(f => `${f}: ${meta[f]}`)
|
|
535
|
+
.join(', ');
|
|
536
|
+
lines.push(`- ${fields || point.Label}`);
|
|
537
|
+
}
|
|
538
|
+
lines.push('');
|
|
539
|
+
}
|
|
540
|
+
return lines.join('\n');
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Handle inline label edits from the scatter component legend.
|
|
544
|
+
* Updates the ClusterLabels cache and marks the label as user-edited.
|
|
545
|
+
*/
|
|
546
|
+
OnLabelEdited(event) {
|
|
547
|
+
const existing = this.ClusterLabels.find(l => l.ClusterId === event.ClusterId);
|
|
548
|
+
if (existing) {
|
|
549
|
+
existing.Label = event.NewLabel;
|
|
550
|
+
existing.IsUserEdited = true;
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
this.ClusterLabels.push({
|
|
554
|
+
ClusterId: event.ClusterId,
|
|
555
|
+
Label: event.NewLabel,
|
|
556
|
+
IsUserEdited: true,
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
this.cdr.detectChanges();
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Compute the prioritized field order and display names from entity metadata.
|
|
563
|
+
* Sets both FieldPriority and FieldDisplayNames.
|
|
564
|
+
* Returns field names sorted: IsNameField first, then DefaultInView by Sequence,
|
|
565
|
+
* then remaining fields by Sequence.
|
|
566
|
+
*/
|
|
567
|
+
ComputeFieldPriority(entityName) {
|
|
568
|
+
try {
|
|
569
|
+
const md = new Metadata();
|
|
570
|
+
const entityInfo = md.Entities.find(e => e.Name === entityName);
|
|
571
|
+
if (!entityInfo)
|
|
572
|
+
return [];
|
|
573
|
+
const internalKeys = new Set([
|
|
574
|
+
'ID', 'Entity', 'EntityIcon', 'RecordID', 'TemplateID',
|
|
575
|
+
'__mj_UpdatedAt', '__mj_CreatedAt',
|
|
576
|
+
]);
|
|
577
|
+
// Build display names map
|
|
578
|
+
const displayNames = {};
|
|
579
|
+
for (const f of entityInfo.Fields) {
|
|
580
|
+
displayNames[f.Name] = f.DisplayNameOrName;
|
|
581
|
+
}
|
|
582
|
+
this.FieldDisplayNames = displayNames;
|
|
583
|
+
return entityInfo.Fields
|
|
584
|
+
.filter(f => !internalKeys.has(f.Name) && !f.IsVirtual && !f.IsPrimaryKey)
|
|
585
|
+
.sort((a, b) => {
|
|
586
|
+
if (a.IsNameField !== b.IsNameField)
|
|
587
|
+
return a.IsNameField ? -1 : 1;
|
|
588
|
+
if (a.DefaultInView !== b.DefaultInView)
|
|
589
|
+
return a.DefaultInView ? -1 : 1;
|
|
590
|
+
return (a.Sequence ?? 9999) - (b.Sequence ?? 9999);
|
|
591
|
+
})
|
|
592
|
+
.map(f => f.Name);
|
|
593
|
+
}
|
|
594
|
+
catch {
|
|
595
|
+
return [];
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
/** Apply cluster labels to the result's Clusters array (sets the Label property) */
|
|
599
|
+
applyLabelsToResult() {
|
|
600
|
+
if (!this.Result || this.ClusterLabels.length === 0)
|
|
601
|
+
return;
|
|
602
|
+
for (const label of this.ClusterLabels) {
|
|
603
|
+
const cluster = this.Result.Clusters.find(c => c.Id === label.ClusterId);
|
|
604
|
+
if (cluster) {
|
|
605
|
+
cluster.Label = label.Label;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Strip full vector arrays from the result before saving (they're large and not needed for display).
|
|
611
|
+
* Keeps points with 2D coordinates and metadata but removes the original high-dimensional vectors.
|
|
612
|
+
*/
|
|
613
|
+
stripVectorsFromResult(result) {
|
|
614
|
+
return {
|
|
615
|
+
...result,
|
|
616
|
+
Points: result.Points.map(p => ({
|
|
617
|
+
...p,
|
|
618
|
+
Vector: [], // Strip the high-dimensional vector — only 2D coords (X, Y) matter for display
|
|
619
|
+
})),
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
/** Load saved visualizations from UserInfoEngine settings */
|
|
623
|
+
loadSavedVisualizations() {
|
|
624
|
+
try {
|
|
625
|
+
const key = buildEnvScopedKey(SAVED_CLUSTERS_BASE_KEY);
|
|
626
|
+
const engine = UserInfoEngine.Instance;
|
|
627
|
+
const setting = engine.UserSettings.find(s => s.Setting === key);
|
|
628
|
+
if (setting?.Value) {
|
|
629
|
+
this.userSettingEntity = setting;
|
|
630
|
+
this.SavedVisualizations = JSON.parse(setting.Value);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
catch (error) {
|
|
634
|
+
console.warn('[ClusterVisualization] Error loading saved visualizations:', error);
|
|
635
|
+
this.SavedVisualizations = [];
|
|
636
|
+
}
|
|
637
|
+
this.cdr.detectChanges();
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Auto-save the current session to localStorage so it can be restored
|
|
641
|
+
* when the user navigates away and comes back.
|
|
642
|
+
*/
|
|
643
|
+
saveLastSession() {
|
|
644
|
+
if (!this.Result)
|
|
645
|
+
return;
|
|
646
|
+
try {
|
|
647
|
+
const session = {
|
|
648
|
+
Result: this.stripVectorsFromResult(this.Result),
|
|
649
|
+
ClusterLabels: this.ClusterLabels,
|
|
650
|
+
Config: this.ActiveConfig,
|
|
651
|
+
Title: this.VisualizationTitle,
|
|
652
|
+
Viewport: this.scatterPlot?.GetViewportTransform() ?? null,
|
|
653
|
+
};
|
|
654
|
+
localStorage.setItem(buildEnvScopedKey(LAST_SESSION_BASE_KEY), JSON.stringify(session));
|
|
655
|
+
}
|
|
656
|
+
catch {
|
|
657
|
+
// localStorage quota exceeded or not available — non-critical
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Restore the last session from localStorage if no saved visualization is active.
|
|
662
|
+
* This handles the "navigate away and come back" case.
|
|
663
|
+
*/
|
|
664
|
+
restoreLastSession() {
|
|
665
|
+
if (this.Result || this.ActiveSavedId)
|
|
666
|
+
return; // Already showing something
|
|
667
|
+
try {
|
|
668
|
+
const raw = localStorage.getItem(buildEnvScopedKey(LAST_SESSION_BASE_KEY));
|
|
669
|
+
if (!raw)
|
|
670
|
+
return;
|
|
671
|
+
const session = JSON.parse(raw);
|
|
672
|
+
this.Result = session.Result;
|
|
673
|
+
this.ClusterLabels = session.ClusterLabels ?? [];
|
|
674
|
+
this.ActiveConfig = session.Config;
|
|
675
|
+
this.VisualizationTitle = session.Title ?? 'Restored Session';
|
|
676
|
+
this.FieldPriority = this.ComputeFieldPriority(session.Config.EntityName);
|
|
677
|
+
this.applyLabelsToResult();
|
|
678
|
+
this.cdr.detectChanges();
|
|
679
|
+
// Restore viewport after a tick to let the scatter component render
|
|
680
|
+
if (session.Viewport) {
|
|
681
|
+
setTimeout(() => {
|
|
682
|
+
this.scatterPlot?.SetViewportTransform(session.Viewport);
|
|
683
|
+
}, 50);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
catch {
|
|
687
|
+
localStorage.removeItem(buildEnvScopedKey(LAST_SESSION_BASE_KEY));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/** Persist saved visualizations to UserInfoEngine settings */
|
|
691
|
+
async persistSavedVisualizations() {
|
|
692
|
+
try {
|
|
693
|
+
const md = new Metadata();
|
|
694
|
+
const userId = md.CurrentUser?.ID;
|
|
695
|
+
if (!userId)
|
|
696
|
+
return;
|
|
697
|
+
if (!this.userSettingEntity) {
|
|
698
|
+
const key = buildEnvScopedKey(SAVED_CLUSTERS_BASE_KEY);
|
|
699
|
+
const engine = UserInfoEngine.Instance;
|
|
700
|
+
const existing = engine.UserSettings.find(s => s.Setting === key);
|
|
701
|
+
if (existing) {
|
|
702
|
+
this.userSettingEntity = existing;
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
this.userSettingEntity = await md.GetEntityObject('MJ: User Settings');
|
|
706
|
+
this.userSettingEntity.UserID = userId;
|
|
707
|
+
this.userSettingEntity.Setting = buildEnvScopedKey(SAVED_CLUSTERS_BASE_KEY);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
this.userSettingEntity.Value = JSON.stringify(this.SavedVisualizations);
|
|
711
|
+
await this.userSettingEntity.Save();
|
|
712
|
+
}
|
|
713
|
+
catch (error) {
|
|
714
|
+
console.warn('[ClusterVisualization] Error saving visualizations:', error);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
static ɵfac = /*@__PURE__*/ (() => { let ɵClusterVisualizationResourceComponent_BaseFactory; return function ClusterVisualizationResourceComponent_Factory(__ngFactoryType__) { return (ɵClusterVisualizationResourceComponent_BaseFactory || (ɵClusterVisualizationResourceComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ClusterVisualizationResourceComponent)))(__ngFactoryType__ || ClusterVisualizationResourceComponent); }; })();
|
|
718
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ClusterVisualizationResourceComponent, selectors: [["app-cluster-visualization-resource"]], viewQuery: function ClusterVisualizationResourceComponent_Query(rf, ctx) { if (rf & 1) {
|
|
719
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
720
|
+
} if (rf & 2) {
|
|
721
|
+
let _t;
|
|
722
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.scatterPlot = _t.first);
|
|
723
|
+
} }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 22, vars: 13, consts: [["scatterPlot", ""], [1, "cluster-viz-container"], [1, "sidebar"], [1, "sidebar-header"], [1, "fa-solid", "fa-circle-nodes"], [1, "saved-list"], [1, "saved-item", 3, "active"], [1, "no-saved"], [1, "new-btn", 3, "click"], [1, "fa-solid", "fa-plus"], [1, "main-area"], [1, "topbar"], [1, "topbar-title"], [1, "scatter-area"], [3, "PointClicked", "PointHovered", "OpenRecordRequested", "LabelEdited", "Points", "Clusters", "IsLoading", "EntityName"], [3, "RunClustering", "SaveVisualization", "IsRunning", "Metrics", "EntityOptions", "EntityDocOptions"], [1, "saved-item", 3, "click"], [1, "saved-name"], [1, "saved-meta"], ["title", "Delete", 1, "delete-btn", 3, "click"], [1, "fa-solid", "fa-times"], [1, "fa-solid", "fa-bookmark"], [1, "metric"], [1, "fa-solid", "fa-circle-dot"], [1, "metric-value"], [1, "fa-solid", "fa-layer-group"], [1, "fa-solid", "fa-chart-line"], [1, "fa-solid", "fa-clock"]], template: function ClusterVisualizationResourceComponent_Template(rf, ctx) { if (rf & 1) {
|
|
724
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
725
|
+
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "div", 3)(3, "h2");
|
|
726
|
+
i0.ɵɵelement(4, "i", 4);
|
|
727
|
+
i0.ɵɵtext(5, " Saved Clusters");
|
|
728
|
+
i0.ɵɵelementEnd()();
|
|
729
|
+
i0.ɵɵelementStart(6, "div", 5);
|
|
730
|
+
i0.ɵɵrepeaterCreate(7, ClusterVisualizationResourceComponent_For_8_Template, 10, 5, "div", 6, ctx.TrackSavedBy, true);
|
|
731
|
+
i0.ɵɵconditionalCreate(9, ClusterVisualizationResourceComponent_Conditional_9_Template, 4, 0, "div", 7);
|
|
732
|
+
i0.ɵɵelementEnd();
|
|
733
|
+
i0.ɵɵelementStart(10, "button", 8);
|
|
734
|
+
i0.ɵɵlistener("click", function ClusterVisualizationResourceComponent_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnNewAnalysis()); });
|
|
735
|
+
i0.ɵɵelement(11, "i", 9);
|
|
736
|
+
i0.ɵɵtext(12, " New Cluster Analysis ");
|
|
737
|
+
i0.ɵɵelementEnd()();
|
|
738
|
+
i0.ɵɵelementStart(13, "div", 10)(14, "div", 11)(15, "div", 12);
|
|
739
|
+
i0.ɵɵtext(16);
|
|
740
|
+
i0.ɵɵelementEnd();
|
|
741
|
+
i0.ɵɵconditionalCreate(17, ClusterVisualizationResourceComponent_Conditional_17_Template, 20, 6);
|
|
742
|
+
i0.ɵɵelementEnd();
|
|
743
|
+
i0.ɵɵelementStart(18, "div", 13)(19, "mj-cluster-scatter", 14, 0);
|
|
744
|
+
i0.ɵɵlistener("PointClicked", function ClusterVisualizationResourceComponent_Template_mj_cluster_scatter_PointClicked_19_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnPointClicked($event)); })("PointHovered", function ClusterVisualizationResourceComponent_Template_mj_cluster_scatter_PointHovered_19_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnPointHovered($event)); })("OpenRecordRequested", function ClusterVisualizationResourceComponent_Template_mj_cluster_scatter_OpenRecordRequested_19_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnOpenRecord($event)); })("LabelEdited", function ClusterVisualizationResourceComponent_Template_mj_cluster_scatter_LabelEdited_19_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnLabelEdited($event)); });
|
|
745
|
+
i0.ɵɵelementEnd();
|
|
746
|
+
i0.ɵɵelementStart(21, "mj-cluster-config-panel", 15);
|
|
747
|
+
i0.ɵɵlistener("RunClustering", function ClusterVisualizationResourceComponent_Template_mj_cluster_config_panel_RunClustering_21_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnRunClustering($event)); })("SaveVisualization", function ClusterVisualizationResourceComponent_Template_mj_cluster_config_panel_SaveVisualization_21_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnSaveVisualization()); });
|
|
748
|
+
i0.ɵɵelementEnd()()()();
|
|
749
|
+
} if (rf & 2) {
|
|
750
|
+
i0.ɵɵadvance(7);
|
|
751
|
+
i0.ɵɵrepeater(ctx.SavedVisualizations);
|
|
752
|
+
i0.ɵɵadvance(2);
|
|
753
|
+
i0.ɵɵconditional(ctx.SavedVisualizations.length === 0 ? 9 : -1);
|
|
754
|
+
i0.ɵɵadvance(7);
|
|
755
|
+
i0.ɵɵtextInterpolate(ctx.VisualizationTitle);
|
|
756
|
+
i0.ɵɵadvance();
|
|
757
|
+
i0.ɵɵconditional(ctx.HasResult ? 17 : -1);
|
|
758
|
+
i0.ɵɵadvance(2);
|
|
759
|
+
i0.ɵɵproperty("Points", (ctx.Result == null ? null : ctx.Result.Points) ?? i0.ɵɵpureFunction0(11, _c1))("Clusters", (ctx.Result == null ? null : ctx.Result.Clusters) ?? i0.ɵɵpureFunction0(12, _c1))("IsLoading", ctx.IsRunning)("EntityName", ctx.ActiveConfig.EntityName);
|
|
760
|
+
i0.ɵɵadvance(2);
|
|
761
|
+
i0.ɵɵproperty("IsRunning", ctx.IsRunning)("Metrics", ctx.Metrics)("EntityOptions", ctx.EntityOptions)("EntityDocOptions", ctx.EntityDocOptions);
|
|
762
|
+
} }, dependencies: [i1.ClusterScatterComponent, i1.ClusterConfigPanelComponent], styles: ["[_nghost-%COMP%] {\n display: flex;\n width: 100%;\n height: 100%;\n}\n\n.cluster-viz-container[_ngcontent-%COMP%] {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n\n\n\n\n\n.sidebar[_ngcontent-%COMP%] {\n width: 260px;\n background: var(--mj-bg-surface);\n border-right: 1px solid var(--mj-border-default);\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n}\n\n.sidebar-header[_ngcontent-%COMP%] {\n padding: 20px;\n border-bottom: 1px solid var(--mj-border-default);\n}\n\n.sidebar-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%] {\n font-size: 0.95rem;\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0;\n color: var(--mj-text-primary);\n}\n\n.sidebar-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n}\n\n.saved-list[_ngcontent-%COMP%] {\n flex: 1;\n overflow-y: auto;\n padding: 12px;\n}\n\n.saved-item[_ngcontent-%COMP%] {\n padding: 12px 14px;\n border-radius: 8px;\n cursor: pointer;\n margin-bottom: 4px;\n transition: background 0.15s;\n position: relative;\n}\n\n.saved-item[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.saved-item.active[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n border: 1px solid color-mix(in srgb, var(--mj-brand-primary) 30%, transparent);\n}\n\n.saved-name[_ngcontent-%COMP%] {\n font-size: 0.85rem;\n font-weight: 500;\n margin-bottom: 3px;\n color: var(--mj-text-primary);\n padding-right: 20px;\n}\n\n.saved-meta[_ngcontent-%COMP%] {\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n display: flex;\n gap: 10px;\n}\n\n.delete-btn[_ngcontent-%COMP%] {\n position: absolute;\n top: 10px;\n right: 10px;\n background: none;\n border: none;\n color: var(--mj-text-muted);\n cursor: pointer;\n font-size: 0.7rem;\n padding: 2px 4px;\n opacity: 0;\n transition: opacity 0.15s, color 0.15s;\n}\n\n.saved-item[_ngcontent-%COMP%]:hover .delete-btn[_ngcontent-%COMP%] {\n opacity: 1;\n}\n\n.delete-btn[_ngcontent-%COMP%]:hover {\n color: var(--mj-status-error);\n}\n\n.no-saved[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px 20px;\n color: var(--mj-text-muted);\n text-align: center;\n}\n\n.no-saved[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 1.5rem;\n margin-bottom: 8px;\n opacity: 0.4;\n}\n\n.no-saved[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\n font-size: 0.8rem;\n margin: 0;\n}\n\n.new-btn[_ngcontent-%COMP%] {\n margin: 12px;\n padding: 10px;\n border: 1px dashed var(--mj-border-strong);\n border-radius: 8px;\n background: transparent;\n color: var(--mj-text-secondary);\n font-size: 0.8rem;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n transition: all 0.15s;\n}\n\n.new-btn[_ngcontent-%COMP%]:hover {\n border-color: var(--mj-brand-primary);\n color: var(--mj-brand-primary);\n}\n\n\n\n\n\n\n.main-area[_ngcontent-%COMP%] {\n flex: 1;\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n\n\n.topbar[_ngcontent-%COMP%] {\n height: 48px;\n background: var(--mj-bg-surface);\n border-bottom: 1px solid var(--mj-border-default);\n display: flex;\n align-items: center;\n padding: 0 20px;\n gap: 24px;\n flex-shrink: 0;\n}\n\n.topbar-title[_ngcontent-%COMP%] {\n font-size: 0.9rem;\n font-weight: 600;\n margin-right: auto;\n color: var(--mj-text-primary);\n}\n\n.metric[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 0.75rem;\n color: var(--mj-text-secondary);\n}\n\n.metric[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 0.7rem;\n}\n\n.metric-value[_ngcontent-%COMP%] {\n color: var(--mj-text-primary);\n font-weight: 600;\n}\n\n.metric-value.good[_ngcontent-%COMP%] {\n color: var(--mj-status-success);\n}\n\n\n\n.scatter-area[_ngcontent-%COMP%] {\n flex: 1;\n position: relative;\n overflow: hidden;\n}"] });
|
|
763
|
+
};
|
|
764
|
+
ClusterVisualizationResourceComponent = __decorate([
|
|
765
|
+
RegisterClass(BaseResourceComponent, 'ClusterVisualizationResource')
|
|
766
|
+
], ClusterVisualizationResourceComponent);
|
|
767
|
+
export { ClusterVisualizationResourceComponent };
|
|
768
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ClusterVisualizationResourceComponent, [{
|
|
769
|
+
type: Component,
|
|
770
|
+
args: [{ standalone: false, selector: 'app-cluster-visualization-resource', template: "<div class=\"cluster-viz-container\">\n <!-- Left Sidebar: Saved Visualizations -->\n <div class=\"sidebar\">\n <div class=\"sidebar-header\">\n <h2><i class=\"fa-solid fa-circle-nodes\"></i> Saved Clusters</h2>\n </div>\n <div class=\"saved-list\">\n @for (saved of SavedVisualizations; track TrackSavedBy($index, saved)) {\n <div class=\"saved-item\"\n [class.active]=\"IsActiveSaved(saved)\"\n (click)=\"OnSelectSaved(saved)\">\n <div class=\"saved-name\">{{ saved.Name }}</div>\n <div class=\"saved-meta\">\n <span>{{ saved.EntityName }}</span>\n <span>{{ FormatDate(saved.CreatedAt) }}</span>\n </div>\n <button class=\"delete-btn\"\n title=\"Delete\"\n (click)=\"OnDeleteSaved(saved, $event)\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n }\n\n @if (SavedVisualizations.length === 0) {\n <div class=\"no-saved\">\n <i class=\"fa-solid fa-bookmark\"></i>\n <p>No saved visualizations yet</p>\n </div>\n }\n </div>\n <button class=\"new-btn\" (click)=\"OnNewAnalysis()\">\n <i class=\"fa-solid fa-plus\"></i> New Cluster Analysis\n </button>\n </div>\n\n <!-- Main Area -->\n <div class=\"main-area\">\n <!-- Top metrics bar -->\n <div class=\"topbar\">\n <div class=\"topbar-title\">{{ VisualizationTitle }}</div>\n @if (HasResult) {\n <div class=\"metric\">\n <i class=\"fa-solid fa-circle-dot\"></i>\n Records: <span class=\"metric-value\">{{ Result!.Metrics.RecordCount }}</span>\n </div>\n <div class=\"metric\">\n <i class=\"fa-solid fa-layer-group\"></i>\n Clusters: <span class=\"metric-value\">{{ Result!.Metrics.ClusterCount }}</span>\n </div>\n <div class=\"metric\">\n <i class=\"fa-solid fa-chart-line\"></i>\n Silhouette:\n <span class=\"metric-value\" [class.good]=\"IsSilhouetteGood\">\n {{ SilhouetteScoreFormatted }}\n </span>\n </div>\n <div class=\"metric\">\n <i class=\"fa-solid fa-clock\"></i>\n Computed: <span class=\"metric-value\">{{ ComputationTimeFormatted }}</span>\n </div>\n }\n </div>\n\n <!-- Scatter plot area -->\n <div class=\"scatter-area\">\n <mj-cluster-scatter\n #scatterPlot\n [Points]=\"Result?.Points ?? []\"\n [Clusters]=\"Result?.Clusters ?? []\"\n [IsLoading]=\"IsRunning\"\n [EntityName]=\"ActiveConfig.EntityName\"\n (PointClicked)=\"OnPointClicked($event)\"\n (PointHovered)=\"OnPointHovered($event)\"\n (OpenRecordRequested)=\"OnOpenRecord($event)\"\n (LabelEdited)=\"OnLabelEdited($event)\">\n </mj-cluster-scatter>\n\n <!-- Floating config panel -->\n <mj-cluster-config-panel\n [IsRunning]=\"IsRunning\"\n [Metrics]=\"Metrics\"\n [EntityOptions]=\"EntityOptions\"\n [EntityDocOptions]=\"EntityDocOptions\"\n (RunClustering)=\"OnRunClustering($event)\"\n (SaveVisualization)=\"OnSaveVisualization()\">\n </mj-cluster-config-panel>\n </div>\n </div>\n</div>\n", styles: [":host {\n display: flex;\n width: 100%;\n height: 100%;\n}\n\n.cluster-viz-container {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n/* ============================================================\n Left Sidebar\n ============================================================ */\n\n.sidebar {\n width: 260px;\n background: var(--mj-bg-surface);\n border-right: 1px solid var(--mj-border-default);\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n}\n\n.sidebar-header {\n padding: 20px;\n border-bottom: 1px solid var(--mj-border-default);\n}\n\n.sidebar-header h2 {\n font-size: 0.95rem;\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0;\n color: var(--mj-text-primary);\n}\n\n.sidebar-header h2 i {\n color: var(--mj-brand-primary);\n}\n\n.saved-list {\n flex: 1;\n overflow-y: auto;\n padding: 12px;\n}\n\n.saved-item {\n padding: 12px 14px;\n border-radius: 8px;\n cursor: pointer;\n margin-bottom: 4px;\n transition: background 0.15s;\n position: relative;\n}\n\n.saved-item:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.saved-item.active {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n border: 1px solid color-mix(in srgb, var(--mj-brand-primary) 30%, transparent);\n}\n\n.saved-name {\n font-size: 0.85rem;\n font-weight: 500;\n margin-bottom: 3px;\n color: var(--mj-text-primary);\n padding-right: 20px;\n}\n\n.saved-meta {\n font-size: 0.7rem;\n color: var(--mj-text-muted);\n display: flex;\n gap: 10px;\n}\n\n.delete-btn {\n position: absolute;\n top: 10px;\n right: 10px;\n background: none;\n border: none;\n color: var(--mj-text-muted);\n cursor: pointer;\n font-size: 0.7rem;\n padding: 2px 4px;\n opacity: 0;\n transition: opacity 0.15s, color 0.15s;\n}\n\n.saved-item:hover .delete-btn {\n opacity: 1;\n}\n\n.delete-btn:hover {\n color: var(--mj-status-error);\n}\n\n.no-saved {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 40px 20px;\n color: var(--mj-text-muted);\n text-align: center;\n}\n\n.no-saved i {\n font-size: 1.5rem;\n margin-bottom: 8px;\n opacity: 0.4;\n}\n\n.no-saved p {\n font-size: 0.8rem;\n margin: 0;\n}\n\n.new-btn {\n margin: 12px;\n padding: 10px;\n border: 1px dashed var(--mj-border-strong);\n border-radius: 8px;\n background: transparent;\n color: var(--mj-text-secondary);\n font-size: 0.8rem;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n transition: all 0.15s;\n}\n\n.new-btn:hover {\n border-color: var(--mj-brand-primary);\n color: var(--mj-brand-primary);\n}\n\n/* ============================================================\n Main Area\n ============================================================ */\n\n.main-area {\n flex: 1;\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n/* Top bar */\n.topbar {\n height: 48px;\n background: var(--mj-bg-surface);\n border-bottom: 1px solid var(--mj-border-default);\n display: flex;\n align-items: center;\n padding: 0 20px;\n gap: 24px;\n flex-shrink: 0;\n}\n\n.topbar-title {\n font-size: 0.9rem;\n font-weight: 600;\n margin-right: auto;\n color: var(--mj-text-primary);\n}\n\n.metric {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 0.75rem;\n color: var(--mj-text-secondary);\n}\n\n.metric i {\n font-size: 0.7rem;\n}\n\n.metric-value {\n color: var(--mj-text-primary);\n font-weight: 600;\n}\n\n.metric-value.good {\n color: var(--mj-status-success);\n}\n\n/* Scatter area */\n.scatter-area {\n flex: 1;\n position: relative;\n overflow: hidden;\n}\n"] }]
|
|
771
|
+
}], null, { scatterPlot: [{
|
|
772
|
+
type: ViewChild,
|
|
773
|
+
args: ['scatterPlot']
|
|
774
|
+
}] }); })();
|
|
775
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ClusterVisualizationResourceComponent, { className: "ClusterVisualizationResourceComponent", filePath: "src/KnowledgeHub/components/clusters/cluster-visualization-resource.component.ts", lineNumber: 63 }); })();
|
|
776
|
+
/** Tree-shaking prevention */
|
|
777
|
+
export function LoadClusterVisualizationResource() {
|
|
778
|
+
// Prevents tree-shaking of the component
|
|
779
|
+
}
|
|
780
|
+
//# sourceMappingURL=cluster-visualization-resource.component.js.map
|