@decaf-ts/integrations 0.3.12 → 0.4.1-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 +11 -3
- package/dist/integrations.cjs +445 -7
- package/dist/integrations.js +479 -8
- package/jest.config.cjs +1 -1
- package/lib/cjs/feature-flags/constants.cjs +16 -0
- package/lib/cjs/feature-flags/decorators.cjs +65 -0
- package/lib/cjs/feature-flags/environment.cjs +26 -0
- package/lib/cjs/feature-flags/index.cjs +31 -0
- package/lib/cjs/feature-flags/models/FeatureFlag.model.cjs +81 -0
- package/lib/cjs/feature-flags/models/FeatureFlagAccess.model.cjs +78 -0
- package/lib/cjs/feature-flags/readers/FeatureFlagReader.cjs +25 -0
- package/lib/cjs/feature-flags/readers/index.cjs +19 -0
- package/lib/cjs/feature-flags/services/FeatureFlag.service.cjs +259 -0
- package/lib/cjs/feature-flags/types.cjs +4 -0
- package/lib/cjs/feature-flags/utils.cjs +141 -0
- package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs +9 -9
- package/lib/cjs/graph/shared/nodes/flow-control.cjs +4 -3
- package/lib/cjs/graph/shared/types.cjs +2 -2
- package/lib/cjs/index.cjs +6 -5
- package/lib/cjs/kibana/builders/KibanaIndexBuilder.cjs +329 -0
- package/lib/cjs/kibana/builders/KibanaIndexBuilderCollection.cjs +37 -0
- package/lib/cjs/kibana/builders/index.cjs +20 -0
- package/lib/cjs/kibana/helpers.cjs +20 -16
- package/lib/cjs/kibana/index.cjs +3 -2
- package/lib/cjs/kibana/types.cjs +11 -2
- package/lib/cjs/loader/ObjectLoader.cjs +154 -0
- package/lib/cjs/loader/families.cjs +78 -0
- package/lib/cjs/loader/index.cjs +28 -0
- package/lib/cjs/loader/types.cjs +4 -0
- package/lib/cjs/nest/decorators.cjs +17 -0
- package/lib/cjs/nest/index.cjs +3 -3
- package/lib/cjs/nest/keycloakAuthHandler.cjs +74 -35
- package/lib/cjs/nest/keycloakModule.cjs +7 -10
- package/lib/cjs/nest/types.cjs +2 -2
- package/lib/cjs/nest/utils.cjs +58 -50
- package/lib/cjs/plugins/contract.cjs +76 -0
- package/lib/cjs/plugins/index.cjs +35 -0
- package/lib/cjs/plugins/kibana/host.cjs +24 -0
- package/lib/cjs/plugins/kibana/index.cjs +38 -0
- package/lib/cjs/plugins/kibana/installer.cjs +180 -0
- package/lib/cjs/plugins/kibana/manifest.cjs +33 -0
- package/lib/cjs/plugins/kibana/templates.cjs +503 -0
- package/lib/cjs/plugins/kibana/types.cjs +33 -0
- package/lib/cjs/plugins/superset/host.cjs +26 -0
- package/lib/cjs/plugins/superset/index.cjs +40 -0
- package/lib/cjs/plugins/superset/installer.cjs +232 -0
- package/lib/cjs/plugins/superset/manifest.cjs +35 -0
- package/lib/cjs/plugins/superset/templates.cjs +844 -0
- package/lib/cjs/plugins/superset/types.cjs +39 -0
- package/lib/esm/feature-flags/constants.js +12 -0
- package/lib/esm/feature-flags/decorators.js +49 -0
- package/lib/esm/feature-flags/environment.js +18 -0
- package/lib/esm/feature-flags/index.js +14 -0
- package/lib/esm/feature-flags/models/FeatureFlag.model.js +72 -0
- package/lib/esm/feature-flags/models/FeatureFlagAccess.model.js +69 -0
- package/lib/esm/feature-flags/readers/FeatureFlagReader.js +19 -0
- package/lib/esm/feature-flags/readers/index.js +2 -0
- package/lib/esm/feature-flags/services/FeatureFlag.service.js +250 -0
- package/lib/esm/feature-flags/types.js +2 -0
- package/lib/esm/feature-flags/utils.js +126 -0
- package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js +8 -8
- package/lib/esm/graph/shared/nodes/flow-control.js +3 -2
- package/lib/esm/graph/shared/types.js +1 -1
- package/lib/esm/index.js +5 -4
- package/lib/esm/kibana/builders/KibanaIndexBuilder.js +319 -0
- package/lib/esm/kibana/builders/KibanaIndexBuilderCollection.js +32 -0
- package/lib/esm/kibana/builders/index.js +3 -0
- package/lib/esm/kibana/helpers.js +19 -15
- package/lib/esm/kibana/index.js +2 -1
- package/lib/esm/kibana/types.js +13 -2
- package/lib/esm/loader/ObjectLoader.js +115 -0
- package/lib/esm/loader/families.js +66 -0
- package/lib/esm/loader/index.js +11 -0
- package/lib/esm/loader/types.js +2 -0
- package/lib/esm/nest/decorators.js +12 -0
- package/lib/esm/nest/index.js +2 -2
- package/lib/esm/nest/keycloakAuthHandler.js +67 -35
- package/lib/esm/nest/keycloakModule.js +7 -10
- package/lib/esm/nest/types.js +1 -1
- package/lib/esm/nest/utils.js +55 -46
- package/lib/esm/plugins/contract.js +68 -0
- package/lib/esm/plugins/index.js +18 -0
- package/lib/esm/plugins/kibana/host.js +19 -0
- package/lib/esm/plugins/kibana/index.js +14 -0
- package/lib/esm/plugins/kibana/installer.js +140 -0
- package/lib/esm/plugins/kibana/manifest.js +32 -0
- package/lib/esm/plugins/kibana/templates.js +499 -0
- package/lib/esm/plugins/kibana/types.js +10 -0
- package/lib/esm/plugins/superset/host.js +21 -0
- package/lib/esm/plugins/superset/index.js +16 -0
- package/lib/esm/plugins/superset/installer.js +192 -0
- package/lib/esm/plugins/superset/manifest.js +30 -0
- package/lib/esm/plugins/superset/templates.js +840 -0
- package/lib/esm/plugins/superset/types.js +11 -0
- package/lib/types/feature-flags/constants.d.cts +11 -0
- package/lib/types/feature-flags/constants.d.mts +11 -0
- package/lib/types/feature-flags/decorators.d.cts +11 -0
- package/lib/types/feature-flags/decorators.d.mts +11 -0
- package/lib/types/feature-flags/environment.d.cts +11 -0
- package/lib/types/feature-flags/environment.d.mts +11 -0
- package/lib/types/feature-flags/index.d.cts +13 -0
- package/lib/types/feature-flags/index.d.mts +13 -0
- package/lib/types/feature-flags/models/FeatureFlag.model.d.cts +16 -0
- package/lib/types/feature-flags/models/FeatureFlag.model.d.mts +16 -0
- package/lib/types/feature-flags/models/FeatureFlagAccess.model.d.cts +15 -0
- package/lib/types/feature-flags/models/FeatureFlagAccess.model.d.mts +15 -0
- package/lib/types/feature-flags/readers/FeatureFlagReader.d.cts +10 -0
- package/lib/types/feature-flags/readers/FeatureFlagReader.d.mts +10 -0
- package/lib/types/feature-flags/readers/index.d.cts +1 -0
- package/lib/types/feature-flags/readers/index.d.mts +1 -0
- package/lib/types/feature-flags/services/FeatureFlag.service.d.cts +43 -0
- package/lib/types/feature-flags/services/FeatureFlag.service.d.mts +43 -0
- package/lib/types/feature-flags/types.d.cts +39 -0
- package/lib/types/feature-flags/types.d.mts +39 -0
- package/lib/types/feature-flags/utils.d.cts +13 -0
- package/lib/types/feature-flags/utils.d.mts +13 -0
- package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.cts +2 -2
- package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.mts +2 -2
- package/lib/types/graph/shared/types.d.cts +3 -3
- package/lib/types/graph/shared/types.d.mts +3 -3
- package/lib/types/index.d.cts +3 -2
- package/lib/types/index.d.mts +3 -2
- package/lib/types/kibana/builders/KibanaIndexBuilder.d.cts +67 -0
- package/lib/types/kibana/builders/KibanaIndexBuilder.d.mts +67 -0
- package/lib/types/kibana/builders/KibanaIndexBuilderCollection.d.cts +17 -0
- package/lib/types/kibana/builders/KibanaIndexBuilderCollection.d.mts +17 -0
- package/lib/types/kibana/builders/index.d.cts +2 -0
- package/lib/types/kibana/builders/index.d.mts +2 -0
- package/lib/types/kibana/index.d.cts +1 -0
- package/lib/types/kibana/index.d.mts +1 -0
- package/lib/types/kibana/types.d.cts +11 -0
- package/lib/types/kibana/types.d.mts +11 -0
- package/lib/types/loader/ObjectLoader.d.cts +27 -0
- package/lib/types/loader/ObjectLoader.d.mts +27 -0
- package/lib/types/loader/families.d.cts +34 -0
- package/lib/types/loader/families.d.mts +34 -0
- package/lib/types/loader/index.d.cts +10 -0
- package/lib/types/loader/index.d.mts +10 -0
- package/lib/types/loader/types.d.cts +24 -0
- package/lib/types/loader/types.d.mts +24 -0
- package/lib/types/nest/decorators.d.cts +8 -0
- package/lib/types/nest/decorators.d.mts +8 -0
- package/lib/types/nest/index.d.cts +1 -1
- package/lib/types/nest/index.d.mts +1 -1
- package/lib/types/nest/keycloakAuthHandler.d.cts +19 -42
- package/lib/types/nest/keycloakAuthHandler.d.mts +19 -42
- package/lib/types/nest/keycloakModule.d.cts +3 -5
- package/lib/types/nest/keycloakModule.d.mts +3 -5
- package/lib/types/nest/types.d.cts +2 -0
- package/lib/types/nest/types.d.mts +2 -0
- package/lib/types/nest/utils.d.cts +3 -4
- package/lib/types/nest/utils.d.mts +3 -4
- package/lib/types/plugins/contract.d.cts +180 -0
- package/lib/types/plugins/contract.d.mts +180 -0
- package/lib/types/plugins/index.d.cts +17 -0
- package/lib/types/plugins/index.d.mts +17 -0
- package/lib/types/plugins/kibana/host.d.cts +18 -0
- package/lib/types/plugins/kibana/host.d.mts +18 -0
- package/lib/types/plugins/kibana/index.d.cts +13 -0
- package/lib/types/plugins/kibana/index.d.mts +13 -0
- package/lib/types/plugins/kibana/installer.d.cts +45 -0
- package/lib/types/plugins/kibana/installer.d.mts +45 -0
- package/lib/types/plugins/kibana/manifest.d.cts +31 -0
- package/lib/types/plugins/kibana/manifest.d.mts +31 -0
- package/lib/types/plugins/kibana/templates.d.cts +12 -0
- package/lib/types/plugins/kibana/templates.d.mts +12 -0
- package/lib/types/plugins/kibana/types.d.cts +9 -0
- package/lib/types/plugins/kibana/types.d.mts +9 -0
- package/lib/types/plugins/superset/host.d.cts +20 -0
- package/lib/types/plugins/superset/host.d.mts +20 -0
- package/lib/types/plugins/superset/index.d.cts +15 -0
- package/lib/types/plugins/superset/index.d.mts +15 -0
- package/lib/types/plugins/superset/installer.d.cts +70 -0
- package/lib/types/plugins/superset/installer.d.mts +70 -0
- package/lib/types/plugins/superset/manifest.d.cts +28 -0
- package/lib/types/plugins/superset/manifest.d.mts +28 -0
- package/lib/types/plugins/superset/templates.d.cts +12 -0
- package/lib/types/plugins/superset/templates.d.mts +12 -0
- package/lib/types/plugins/superset/types.d.cts +10 -0
- package/lib/types/plugins/superset/types.d.mts +10 -0
- package/package.json +62 -3
- package/plugins/kibana/.gitignore +16 -0
- package/plugins/kibana/Dockerfile +19 -0
- package/plugins/kibana/docker-compose.yml +50 -0
- package/plugins/kibana/host/index.html +101 -0
- package/plugins/kibana/setup-dashboards.sh +84 -0
- package/plugins/superset/.gitignore +17 -0
- package/plugins/superset/Dockerfile +79 -0
- package/plugins/superset/docker-compose.yml +62 -0
- package/plugins/superset/host/index.html +168 -0
- package/plugins/superset/setup-dashboards.sh +106 -0
- package/plugins/superset/superset_config.py +49 -0
- package/lib/cjs/nest/authService.cjs +0 -91
- package/lib/esm/nest/authService.js +0 -86
- package/lib/types/nest/authService.d.cts +0 -63
- package/lib/types/nest/authService.d.mts +0 -63
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset/host
|
|
3
|
+
* @summary Angular host-side helpers for the Superset embed plugin.
|
|
4
|
+
* @description DOM-free convenience helpers the Angular host uses to build the
|
|
5
|
+
* embedded URL and send switch-dashboard messages to the embedded Superset
|
|
6
|
+
* plugin via the SDK handle.
|
|
7
|
+
*/
|
|
8
|
+
import { type EmbedMessageTarget, type EmbedUrlOptions, type SwitchDashboardPayload } from "../contract.d.cts";
|
|
9
|
+
import { buildSupersetEmbedUrl } from "./installer.d.cts";
|
|
10
|
+
export { buildSupersetEmbedUrl };
|
|
11
|
+
/**
|
|
12
|
+
* Send a switch-dashboard message to the embedded Superset dashboard.
|
|
13
|
+
*
|
|
14
|
+
* The Angular host passes the embedded SDK's `EmbeddedDashboard` handle
|
|
15
|
+
* (wrapped to satisfy `EmbedMessageTarget.switchDashboard`) and the Superset
|
|
16
|
+
* origin as `targetOrigin`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sendSupersetSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
|
|
19
|
+
/** Re-export the URL options type for host convenience. */
|
|
20
|
+
export type { EmbedUrlOptions };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset/host
|
|
3
|
+
* @summary Angular host-side helpers for the Superset embed plugin.
|
|
4
|
+
* @description DOM-free convenience helpers the Angular host uses to build the
|
|
5
|
+
* embedded URL and send switch-dashboard messages to the embedded Superset
|
|
6
|
+
* plugin via the SDK handle.
|
|
7
|
+
*/
|
|
8
|
+
import { type EmbedMessageTarget, type EmbedUrlOptions, type SwitchDashboardPayload } from "../contract.d.mts";
|
|
9
|
+
import { buildSupersetEmbedUrl } from "./installer.d.mts";
|
|
10
|
+
export { buildSupersetEmbedUrl };
|
|
11
|
+
/**
|
|
12
|
+
* Send a switch-dashboard message to the embedded Superset dashboard.
|
|
13
|
+
*
|
|
14
|
+
* The Angular host passes the embedded SDK's `EmbeddedDashboard` handle
|
|
15
|
+
* (wrapped to satisfy `EmbedMessageTarget.switchDashboard`) and the Superset
|
|
16
|
+
* origin as `targetOrigin`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function sendSupersetSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
|
|
19
|
+
/** Re-export the URL options type for host convenience. */
|
|
20
|
+
export type { EmbedUrlOptions };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset
|
|
3
|
+
* @summary Superset dashboard embed plugin surface.
|
|
4
|
+
* @description Org-agnostic multi-tenant Superset dashboard embed plugin
|
|
5
|
+
* (patch-and-build strategy). Same API as the Kibana plugin. Decaf holds
|
|
6
|
+
* patch scripts that modify Superset's internal embedded frontend and SDK
|
|
7
|
+
* source files to add a `switchDashboard` method, keeping the iframe element,
|
|
8
|
+
* document, contentWindow, React runtime, and Switchboard MessageChannel alive.
|
|
9
|
+
*/
|
|
10
|
+
export * from "../contract.d.cts";
|
|
11
|
+
export * from "./types.d.cts";
|
|
12
|
+
export * from "./manifest.d.cts";
|
|
13
|
+
export * from "./templates.d.cts";
|
|
14
|
+
export { SupersetDashboardEmbedPlugin, supersetDashboardEmbedPlugin, createSupersetDashboardEmbedPlugin, buildSupersetEmbedUrl, SUPERSET_DEFAULT_BASE_PATH, type SupersetInstallOptions, } from "./installer.d.cts";
|
|
15
|
+
export { sendSupersetSwitchDashboardMessage, } from "./host.d.cts";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset
|
|
3
|
+
* @summary Superset dashboard embed plugin surface.
|
|
4
|
+
* @description Org-agnostic multi-tenant Superset dashboard embed plugin
|
|
5
|
+
* (patch-and-build strategy). Same API as the Kibana plugin. Decaf holds
|
|
6
|
+
* patch scripts that modify Superset's internal embedded frontend and SDK
|
|
7
|
+
* source files to add a `switchDashboard` method, keeping the iframe element,
|
|
8
|
+
* document, contentWindow, React runtime, and Switchboard MessageChannel alive.
|
|
9
|
+
*/
|
|
10
|
+
export * from "../contract.d.mts";
|
|
11
|
+
export * from "./types.d.mts";
|
|
12
|
+
export * from "./manifest.d.mts";
|
|
13
|
+
export * from "./templates.d.mts";
|
|
14
|
+
export { SupersetDashboardEmbedPlugin, supersetDashboardEmbedPlugin, createSupersetDashboardEmbedPlugin, buildSupersetEmbedUrl, SUPERSET_DEFAULT_BASE_PATH, type SupersetInstallOptions, } from "./installer.d.mts";
|
|
15
|
+
export { sendSupersetSwitchDashboardMessage, } from "./host.d.mts";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type DashboardEmbedPlugin, type DashboardEmbedPluginDescriptor, type EmbedMessageTarget, type EmbedUrlOptions, type PluginInstallOptions, type PluginInstallResult, type SwitchDashboardPayload, type SwitchDashboardMessage } from "../contract.d.cts";
|
|
2
|
+
/** Default Superset base path when none is provided. */
|
|
3
|
+
export declare const SUPERSET_DEFAULT_BASE_PATH = "superset";
|
|
4
|
+
/**
|
|
5
|
+
* Extension of `PluginInstallOptions` for Superset-specific build configuration.
|
|
6
|
+
*/
|
|
7
|
+
export interface SupersetInstallOptions extends PluginInstallOptions {
|
|
8
|
+
/** Path to an existing Superset source checkout. If absent, the installer clones via git. */
|
|
9
|
+
supersetSourcePath?: string;
|
|
10
|
+
/** Git URL to clone Superset from (used when `supersetSourcePath` is absent). */
|
|
11
|
+
supersetGitUrl?: string;
|
|
12
|
+
/** Git ref/branch/tag to checkout after cloning. */
|
|
13
|
+
supersetGitRef?: string;
|
|
14
|
+
/** Docker image tag to build (when provided, builds a Docker image instead of just SDK+frontend). */
|
|
15
|
+
dockerImageTag?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build the Superset embedded URL.
|
|
19
|
+
*
|
|
20
|
+
* For Superset, the `dashboardId` field in `EmbedUrlOptions` is the
|
|
21
|
+
* embedded-configuration UUID used in `/embedded/:uuid`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* buildSupersetEmbedUrl({ host: "superset.example.com", dashboardId: "abc-uuid", parentOrigin: "https://app.example.com" })
|
|
25
|
+
* // => "//superset.example.com/superset/embedded/abc-uuid?parentOrigin=https%3A%2F%2Fapp.example.com"
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildSupersetEmbedUrl(options: EmbedUrlOptions): string;
|
|
28
|
+
/**
|
|
29
|
+
* @class SupersetDashboardEmbedPlugin
|
|
30
|
+
* @summary Superset implementation of the `DashboardEmbedPlugin` contract.
|
|
31
|
+
* @description Org-agnostic multi-tenant dashboard embed plugin for Superset
|
|
32
|
+
* using a patch-and-build strategy. Same API as `KibanaDashboardEmbedPlugin`.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SupersetDashboardEmbedPlugin implements DashboardEmbedPlugin {
|
|
35
|
+
readonly descriptor: DashboardEmbedPluginDescriptor;
|
|
36
|
+
constructor(targetVersion?: string);
|
|
37
|
+
manifest(targetVersion?: string): Record<string, unknown>;
|
|
38
|
+
buildEmbedUrl(options: EmbedUrlOptions): string;
|
|
39
|
+
createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
|
|
40
|
+
sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Materialize the patch and build scripts into `targetPath/`, and when
|
|
43
|
+
* `build` is true, clone/use Superset source, apply patches, and build
|
|
44
|
+
* (SDK + frontend + optionally Docker image).
|
|
45
|
+
*
|
|
46
|
+
* Unlike Kibana (which generates plugin source), Superset's "plugin" is a
|
|
47
|
+
* patch-and-build strategy: Decaf holds scripts that modify Superset's
|
|
48
|
+
* existing internal source files.
|
|
49
|
+
*/
|
|
50
|
+
install(options: SupersetInstallOptions): Promise<PluginInstallResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the Superset source root: use an existing checkout or clone via git.
|
|
53
|
+
*/
|
|
54
|
+
protected resolveSupersetRoot(pluginDir: string, options: SupersetInstallOptions): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Apply patches, verify, and build (SDK + frontend + optionally Docker).
|
|
57
|
+
*/
|
|
58
|
+
protected runPatchAndBuild(pluginDir: string, supersetRoot: string, options: SupersetInstallOptions): Promise<{
|
|
59
|
+
ok: boolean;
|
|
60
|
+
output: string;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Run a command and capture stdout+stderr.
|
|
64
|
+
*/
|
|
65
|
+
protected runCommand(cmd: string, args: string[], cwd: string): Promise<string>;
|
|
66
|
+
}
|
|
67
|
+
/** Default singleton instance. */
|
|
68
|
+
export declare const supersetDashboardEmbedPlugin: SupersetDashboardEmbedPlugin;
|
|
69
|
+
/** Factory accepting a target Superset version. */
|
|
70
|
+
export declare function createSupersetDashboardEmbedPlugin(targetVersion: string): SupersetDashboardEmbedPlugin;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type DashboardEmbedPlugin, type DashboardEmbedPluginDescriptor, type EmbedMessageTarget, type EmbedUrlOptions, type PluginInstallOptions, type PluginInstallResult, type SwitchDashboardPayload, type SwitchDashboardMessage } from "../contract.d.mts";
|
|
2
|
+
/** Default Superset base path when none is provided. */
|
|
3
|
+
export declare const SUPERSET_DEFAULT_BASE_PATH = "superset";
|
|
4
|
+
/**
|
|
5
|
+
* Extension of `PluginInstallOptions` for Superset-specific build configuration.
|
|
6
|
+
*/
|
|
7
|
+
export interface SupersetInstallOptions extends PluginInstallOptions {
|
|
8
|
+
/** Path to an existing Superset source checkout. If absent, the installer clones via git. */
|
|
9
|
+
supersetSourcePath?: string;
|
|
10
|
+
/** Git URL to clone Superset from (used when `supersetSourcePath` is absent). */
|
|
11
|
+
supersetGitUrl?: string;
|
|
12
|
+
/** Git ref/branch/tag to checkout after cloning. */
|
|
13
|
+
supersetGitRef?: string;
|
|
14
|
+
/** Docker image tag to build (when provided, builds a Docker image instead of just SDK+frontend). */
|
|
15
|
+
dockerImageTag?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build the Superset embedded URL.
|
|
19
|
+
*
|
|
20
|
+
* For Superset, the `dashboardId` field in `EmbedUrlOptions` is the
|
|
21
|
+
* embedded-configuration UUID used in `/embedded/:uuid`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* buildSupersetEmbedUrl({ host: "superset.example.com", dashboardId: "abc-uuid", parentOrigin: "https://app.example.com" })
|
|
25
|
+
* // => "//superset.example.com/superset/embedded/abc-uuid?parentOrigin=https%3A%2F%2Fapp.example.com"
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildSupersetEmbedUrl(options: EmbedUrlOptions): string;
|
|
28
|
+
/**
|
|
29
|
+
* @class SupersetDashboardEmbedPlugin
|
|
30
|
+
* @summary Superset implementation of the `DashboardEmbedPlugin` contract.
|
|
31
|
+
* @description Org-agnostic multi-tenant dashboard embed plugin for Superset
|
|
32
|
+
* using a patch-and-build strategy. Same API as `KibanaDashboardEmbedPlugin`.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SupersetDashboardEmbedPlugin implements DashboardEmbedPlugin {
|
|
35
|
+
readonly descriptor: DashboardEmbedPluginDescriptor;
|
|
36
|
+
constructor(targetVersion?: string);
|
|
37
|
+
manifest(targetVersion?: string): Record<string, unknown>;
|
|
38
|
+
buildEmbedUrl(options: EmbedUrlOptions): string;
|
|
39
|
+
createSwitchDashboardMessage(payload: SwitchDashboardPayload): SwitchDashboardMessage;
|
|
40
|
+
sendSwitchDashboardMessage(target: EmbedMessageTarget, payload: SwitchDashboardPayload, targetOrigin: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Materialize the patch and build scripts into `targetPath/`, and when
|
|
43
|
+
* `build` is true, clone/use Superset source, apply patches, and build
|
|
44
|
+
* (SDK + frontend + optionally Docker image).
|
|
45
|
+
*
|
|
46
|
+
* Unlike Kibana (which generates plugin source), Superset's "plugin" is a
|
|
47
|
+
* patch-and-build strategy: Decaf holds scripts that modify Superset's
|
|
48
|
+
* existing internal source files.
|
|
49
|
+
*/
|
|
50
|
+
install(options: SupersetInstallOptions): Promise<PluginInstallResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Resolve the Superset source root: use an existing checkout or clone via git.
|
|
53
|
+
*/
|
|
54
|
+
protected resolveSupersetRoot(pluginDir: string, options: SupersetInstallOptions): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Apply patches, verify, and build (SDK + frontend + optionally Docker).
|
|
57
|
+
*/
|
|
58
|
+
protected runPatchAndBuild(pluginDir: string, supersetRoot: string, options: SupersetInstallOptions): Promise<{
|
|
59
|
+
ok: boolean;
|
|
60
|
+
output: string;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Run a command and capture stdout+stderr.
|
|
64
|
+
*/
|
|
65
|
+
protected runCommand(cmd: string, args: string[], cwd: string): Promise<string>;
|
|
66
|
+
}
|
|
67
|
+
/** Default singleton instance. */
|
|
68
|
+
export declare const supersetDashboardEmbedPlugin: SupersetDashboardEmbedPlugin;
|
|
69
|
+
/** Factory accepting a target Superset version. */
|
|
70
|
+
export declare function createSupersetDashboardEmbedPlugin(targetVersion: string): SupersetDashboardEmbedPlugin;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset/manifest
|
|
3
|
+
* @summary Superset embed plugin manifest builder (stub).
|
|
4
|
+
* @description Superset has no Kibana-style native plugin system. This builder
|
|
5
|
+
* returns a placeholder manifest describing the embed strategy. Detailed
|
|
6
|
+
* Superset support is deferred ("to be ignored for now").
|
|
7
|
+
*/
|
|
8
|
+
import { EMBED_MESSAGE_TYPE } from "../contract.d.cts";
|
|
9
|
+
export declare const SUPERSET_PLUGIN_ID = "orgDashboardEmbedSuperset";
|
|
10
|
+
export declare const SUPERSET_APP_ID = "org_dashboard_embed_superset";
|
|
11
|
+
export declare const SUPERSET_PLUGIN_VERSION = "1.0.0";
|
|
12
|
+
export interface SupersetManifest {
|
|
13
|
+
id: string;
|
|
14
|
+
version: string;
|
|
15
|
+
targetVersion: string;
|
|
16
|
+
tool: "superset";
|
|
17
|
+
server: boolean;
|
|
18
|
+
ui: boolean;
|
|
19
|
+
embedStrategy: "iframe";
|
|
20
|
+
status: "stub";
|
|
21
|
+
requiredPlugins: string[];
|
|
22
|
+
optionalPlugins: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build the placeholder Superset manifest for a target Superset version.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildSupersetManifest(targetVersion?: string): SupersetManifest;
|
|
28
|
+
export { EMBED_MESSAGE_TYPE };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset/manifest
|
|
3
|
+
* @summary Superset embed plugin manifest builder (stub).
|
|
4
|
+
* @description Superset has no Kibana-style native plugin system. This builder
|
|
5
|
+
* returns a placeholder manifest describing the embed strategy. Detailed
|
|
6
|
+
* Superset support is deferred ("to be ignored for now").
|
|
7
|
+
*/
|
|
8
|
+
import { EMBED_MESSAGE_TYPE } from "../contract.d.mts";
|
|
9
|
+
export declare const SUPERSET_PLUGIN_ID = "orgDashboardEmbedSuperset";
|
|
10
|
+
export declare const SUPERSET_APP_ID = "org_dashboard_embed_superset";
|
|
11
|
+
export declare const SUPERSET_PLUGIN_VERSION = "1.0.0";
|
|
12
|
+
export interface SupersetManifest {
|
|
13
|
+
id: string;
|
|
14
|
+
version: string;
|
|
15
|
+
targetVersion: string;
|
|
16
|
+
tool: "superset";
|
|
17
|
+
server: boolean;
|
|
18
|
+
ui: boolean;
|
|
19
|
+
embedStrategy: "iframe";
|
|
20
|
+
status: "stub";
|
|
21
|
+
requiredPlugins: string[];
|
|
22
|
+
optionalPlugins: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build the placeholder Superset manifest for a target Superset version.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildSupersetManifest(targetVersion?: string): SupersetManifest;
|
|
28
|
+
export { EMBED_MESSAGE_TYPE };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SupersetPatchFile {
|
|
2
|
+
/** Relative path within the target directory. */
|
|
3
|
+
path: string;
|
|
4
|
+
/** File contents. */
|
|
5
|
+
content: string;
|
|
6
|
+
/** Whether to mark the file executable on POSIX. */
|
|
7
|
+
executable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns the full set of patch and build script files.
|
|
11
|
+
*/
|
|
12
|
+
export declare function supersetPatchFiles(): SupersetPatchFile[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SupersetPatchFile {
|
|
2
|
+
/** Relative path within the target directory. */
|
|
3
|
+
path: string;
|
|
4
|
+
/** File contents. */
|
|
5
|
+
content: string;
|
|
6
|
+
/** Whether to mark the file executable on POSIX. */
|
|
7
|
+
executable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns the full set of patch and build script files.
|
|
11
|
+
*/
|
|
12
|
+
export declare function supersetPatchFiles(): SupersetPatchFile[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset/types
|
|
3
|
+
* @summary Superset embed plugin types.
|
|
4
|
+
* @description Re-exports the shared contract types and Superset-specific
|
|
5
|
+
* constants/types for the org-agnostic dashboard embed plugin.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../contract.d.cts";
|
|
8
|
+
export { SUPERSET_PLUGIN_ID, SUPERSET_APP_ID, SUPERSET_PLUGIN_VERSION, buildSupersetManifest, type SupersetManifest, } from "./manifest.d.cts";
|
|
9
|
+
export { supersetPatchFiles, type SupersetPatchFile } from "./templates.d.cts";
|
|
10
|
+
export { SupersetDashboardEmbedPlugin, supersetDashboardEmbedPlugin, createSupersetDashboardEmbedPlugin, buildSupersetEmbedUrl, SUPERSET_DEFAULT_BASE_PATH, type SupersetInstallOptions, } from "./installer.d.cts";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/plugins/superset/types
|
|
3
|
+
* @summary Superset embed plugin types.
|
|
4
|
+
* @description Re-exports the shared contract types and Superset-specific
|
|
5
|
+
* constants/types for the org-agnostic dashboard embed plugin.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../contract.d.mts";
|
|
8
|
+
export { SUPERSET_PLUGIN_ID, SUPERSET_APP_ID, SUPERSET_PLUGIN_VERSION, buildSupersetManifest, type SupersetManifest, } from "./manifest.d.mts";
|
|
9
|
+
export { supersetPatchFiles, type SupersetPatchFile } from "./templates.d.mts";
|
|
10
|
+
export { SupersetDashboardEmbedPlugin, supersetDashboardEmbedPlugin, createSupersetDashboardEmbedPlugin, buildSupersetEmbedUrl, SUPERSET_DEFAULT_BASE_PATH, type SupersetInstallOptions, } from "./installer.d.mts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/integrations",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1-0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.mts",
|
|
@@ -71,6 +71,17 @@
|
|
|
71
71
|
},
|
|
72
72
|
"default": "./lib/esm/nest/graph/index.js"
|
|
73
73
|
},
|
|
74
|
+
"./loader": {
|
|
75
|
+
"import": {
|
|
76
|
+
"types": "./lib/types/loader/index.d.mts",
|
|
77
|
+
"default": "./lib/esm/loader/index.js"
|
|
78
|
+
},
|
|
79
|
+
"require": {
|
|
80
|
+
"types": "./lib/types/loader/index.d.cts",
|
|
81
|
+
"default": "./lib/cjs/loader/index.cjs"
|
|
82
|
+
},
|
|
83
|
+
"default": "./lib/esm/loader/index.js"
|
|
84
|
+
},
|
|
74
85
|
"./namespaces": {
|
|
75
86
|
"import": {
|
|
76
87
|
"types": "./lib/types/namespaces/index.d.mts",
|
|
@@ -82,6 +93,17 @@
|
|
|
82
93
|
},
|
|
83
94
|
"default": "./lib/esm/namespaces/index.js"
|
|
84
95
|
},
|
|
96
|
+
"./feature-flags": {
|
|
97
|
+
"import": {
|
|
98
|
+
"types": "./lib/types/feature-flags/index.d.mts",
|
|
99
|
+
"default": "./lib/esm/feature-flags/index.js"
|
|
100
|
+
},
|
|
101
|
+
"require": {
|
|
102
|
+
"types": "./lib/types/feature-flags/index.d.cts",
|
|
103
|
+
"default": "./lib/cjs/feature-flags/index.cjs"
|
|
104
|
+
},
|
|
105
|
+
"default": "./lib/esm/feature-flags/index.js"
|
|
106
|
+
},
|
|
85
107
|
"./secrets": {
|
|
86
108
|
"import": {
|
|
87
109
|
"types": "./lib/types/secrets/index.d.mts",
|
|
@@ -246,6 +268,39 @@
|
|
|
246
268
|
"default": "./lib/cjs/graph/shared/index.cjs"
|
|
247
269
|
},
|
|
248
270
|
"default": "./lib/esm/graph/shared/index.js"
|
|
271
|
+
},
|
|
272
|
+
"./plugins": {
|
|
273
|
+
"import": {
|
|
274
|
+
"types": "./lib/types/plugins/index.d.mts",
|
|
275
|
+
"default": "./lib/esm/plugins/index.js"
|
|
276
|
+
},
|
|
277
|
+
"require": {
|
|
278
|
+
"types": "./lib/types/plugins/index.d.cts",
|
|
279
|
+
"default": "./lib/cjs/plugins/index.cjs"
|
|
280
|
+
},
|
|
281
|
+
"default": "./lib/esm/plugins/index.js"
|
|
282
|
+
},
|
|
283
|
+
"./plugins/kibana": {
|
|
284
|
+
"import": {
|
|
285
|
+
"types": "./lib/types/plugins/kibana/index.d.mts",
|
|
286
|
+
"default": "./lib/esm/plugins/kibana/index.js"
|
|
287
|
+
},
|
|
288
|
+
"require": {
|
|
289
|
+
"types": "./lib/types/plugins/kibana/index.d.cts",
|
|
290
|
+
"default": "./lib/cjs/plugins/kibana/index.cjs"
|
|
291
|
+
},
|
|
292
|
+
"default": "./lib/esm/plugins/kibana/index.js"
|
|
293
|
+
},
|
|
294
|
+
"./plugins/superset": {
|
|
295
|
+
"import": {
|
|
296
|
+
"types": "./lib/types/plugins/superset/index.d.mts",
|
|
297
|
+
"default": "./lib/esm/plugins/superset/index.js"
|
|
298
|
+
},
|
|
299
|
+
"require": {
|
|
300
|
+
"types": "./lib/types/plugins/superset/index.d.cts",
|
|
301
|
+
"default": "./lib/cjs/plugins/superset/index.cjs"
|
|
302
|
+
},
|
|
303
|
+
"default": "./lib/esm/plugins/superset/index.js"
|
|
249
304
|
}
|
|
250
305
|
},
|
|
251
306
|
"scripts": {
|
|
@@ -262,6 +317,9 @@
|
|
|
262
317
|
"test:unit": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watchman=false --testPathPatterns=\"/tests/unit\" --passWithNoTests --detectOpenHandles",
|
|
263
318
|
"test:integration": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watchman=false --testPathPatterns=\"/tests/(integration)\" --passWithNoTests --detectOpenHandles",
|
|
264
319
|
"test:e2e": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watchman=false --testPathPatterns=\"/tests/(e2e)\" --passWithNoTests --detectOpenHandles",
|
|
320
|
+
"test:e2e:plugins": "npx playwright test --config tests/e2e/plugins/playwright.config.ts --project chromium",
|
|
321
|
+
"test:e2e:plugins:kibana": "npx playwright test --config tests/e2e/plugins/playwright.config.ts tests/e2e/plugins/kibana.e2e.test.ts",
|
|
322
|
+
"test:e2e:plugins:superset": "npx playwright test --config tests/e2e/plugins/playwright.config.ts tests/e2e/plugins/superset.e2e.test.ts",
|
|
265
323
|
"test:all": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watchman=false --runInBand --testPathPatterns=\"/tests\" --passWithNoTests",
|
|
266
324
|
"test:circular": "dpdm -T --no-warning --no-tree ./src/index.ts",
|
|
267
325
|
"coverage": "rimraf ./workdocs/reports/data/*.json && npm run test:all -- --coverage --config=./workdocs/reports/jest.coverage.config.cjs",
|
|
@@ -307,13 +365,14 @@
|
|
|
307
365
|
"@decaf-ts/cli": "latest",
|
|
308
366
|
"@decaf-ts/for-http": "latest",
|
|
309
367
|
"@decaf-ts/for-nano": "latest",
|
|
310
|
-
"@decaf-ts/for-nest": "0.
|
|
368
|
+
"@decaf-ts/for-nest": "0.12.2-0",
|
|
311
369
|
"@decaf-ts/utils": "latest",
|
|
312
370
|
"@nestjs/common": "^11.0.0",
|
|
313
371
|
"@nestjs/core": "^11.0.0",
|
|
314
372
|
"@nestjs/platform-express": "^11.0.0",
|
|
315
373
|
"@nestjs/swagger": "^11.4.4",
|
|
316
374
|
"@nestjs/testing": "^11.0.0",
|
|
375
|
+
"@playwright/test": "^1.61.1",
|
|
317
376
|
"@types/jest": "^30.0.0",
|
|
318
377
|
"@types/supertest": "^6.0.0",
|
|
319
378
|
"reflect-metadata": "^0.2.0",
|
|
@@ -323,7 +382,7 @@
|
|
|
323
382
|
"peerDependencies": {
|
|
324
383
|
"@decaf-ts/as-zod": "latest",
|
|
325
384
|
"@decaf-ts/for-http": "latest",
|
|
326
|
-
"@decaf-ts/for-nest": "0.
|
|
385
|
+
"@decaf-ts/for-nest": "0.12.2-0",
|
|
327
386
|
"jose": ">=5.0.0"
|
|
328
387
|
},
|
|
329
388
|
"peerDependenciesMeta": {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Ignore everything by default
|
|
2
|
+
*
|
|
3
|
+
|
|
4
|
+
# Re-include the .gitignore itself
|
|
5
|
+
!.gitignore
|
|
6
|
+
|
|
7
|
+
# Re-include curated configuration (Dockerfiles, compose, host pages, scripts)
|
|
8
|
+
!Dockerfile
|
|
9
|
+
!docker-compose.yml
|
|
10
|
+
!setup-dashboards.sh
|
|
11
|
+
!dashboards.json
|
|
12
|
+
!host/
|
|
13
|
+
!host/**
|
|
14
|
+
|
|
15
|
+
# Everything else (generated plugin source org_dashboard_embed/, build artifacts,
|
|
16
|
+
# zips, node_modules) remains ignored
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Custom Kibana image with the org_dashboard_embed plugin installed.
|
|
2
|
+
#
|
|
3
|
+
# The plugin source is copied into the image and installed via
|
|
4
|
+
# bin/kibana-plugin install, which runs Kibana's optimizer to build the
|
|
5
|
+
# TypeScript/JSX plugin source.
|
|
6
|
+
#
|
|
7
|
+
FROM docker.elastic.co/kibana/kibana:8.14.3
|
|
8
|
+
|
|
9
|
+
# Copy the plugin zip
|
|
10
|
+
COPY org_dashboard_embed.zip /tmp/org_dashboard_embed.zip
|
|
11
|
+
|
|
12
|
+
# Install the plugin
|
|
13
|
+
RUN bin/kibana-plugin install file:///tmp/org_dashboard_embed.zip
|
|
14
|
+
|
|
15
|
+
# Clean up
|
|
16
|
+
RUN rm /tmp/org_dashboard_embed.zip
|
|
17
|
+
|
|
18
|
+
# Kibana runs as uid 1000
|
|
19
|
+
USER 1000
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
services:
|
|
2
|
+
elasticsearch:
|
|
3
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:8.14.3
|
|
4
|
+
environment:
|
|
5
|
+
- discovery.type=single-node
|
|
6
|
+
- xpack.security.enabled=false
|
|
7
|
+
- xpack.ml.enabled=false
|
|
8
|
+
- ES_JAVA_OPTS=-Xms512m -Xmx512m
|
|
9
|
+
ports:
|
|
10
|
+
- "9201:9200"
|
|
11
|
+
healthcheck:
|
|
12
|
+
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"]
|
|
13
|
+
interval: 5s
|
|
14
|
+
timeout: 5s
|
|
15
|
+
retries: 30
|
|
16
|
+
start_period: 15s
|
|
17
|
+
networks:
|
|
18
|
+
- e2e
|
|
19
|
+
|
|
20
|
+
kibana:
|
|
21
|
+
build:
|
|
22
|
+
context: .
|
|
23
|
+
dockerfile: Dockerfile
|
|
24
|
+
environment:
|
|
25
|
+
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
|
|
26
|
+
- XPACK_SECURITY_ENABLED=false
|
|
27
|
+
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=a"something"at"least"32"characters"long
|
|
28
|
+
- SERVER_HOST=0.0.0.0
|
|
29
|
+
- SERVER_PORT=5601
|
|
30
|
+
- ELASTICSEARCH_USERNAME=
|
|
31
|
+
- ELASTICSEARCH_PASSWORD=
|
|
32
|
+
- TELEMETRY_ENABLED=false
|
|
33
|
+
- LOGGING_ROOT_LEVEL=info
|
|
34
|
+
ports:
|
|
35
|
+
- "5602:5601"
|
|
36
|
+
depends_on:
|
|
37
|
+
elasticsearch:
|
|
38
|
+
condition: service_healthy
|
|
39
|
+
healthcheck:
|
|
40
|
+
test: ["CMD-SHELL", "curl -sf http://localhost:5601/api/status || exit 1"]
|
|
41
|
+
interval: 10s
|
|
42
|
+
timeout: 10s
|
|
43
|
+
retries: 30
|
|
44
|
+
start_period: 30s
|
|
45
|
+
networks:
|
|
46
|
+
- e2e
|
|
47
|
+
|
|
48
|
+
networks:
|
|
49
|
+
e2e:
|
|
50
|
+
driver: bridge
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Kibana Embed E2E Test Host</title>
|
|
6
|
+
<style>
|
|
7
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
8
|
+
body { font-family: -apple-system, sans-serif; height: 100vh; display: flex; flex-direction: column; }
|
|
9
|
+
.toolbar { padding: 12px 20px; background: #f0f0f0; border-bottom: 1px solid #ccc; display: flex; gap: 12px; align-items: center; }
|
|
10
|
+
.toolbar h1 { font-size: 16px; font-weight: 600; margin-right: auto; }
|
|
11
|
+
.toolbar button { padding: 8px 16px; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 14px; }
|
|
12
|
+
.toolbar button:hover { background: #e8e8e8; }
|
|
13
|
+
.toolbar button.active { background: #0066cc; color: #fff; border-color: #0066cc; }
|
|
14
|
+
#status { font-size: 12px; color: #666; padding: 4px 20px; background: #fafafa; }
|
|
15
|
+
.iframe-container { flex: 1; position: relative; overflow: hidden; }
|
|
16
|
+
#kibanaFrame { width: 100%; height: 100%; border: 0; }
|
|
17
|
+
</style>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div class="toolbar">
|
|
21
|
+
<h1>Kibana Dashboard Embed E2E</h1>
|
|
22
|
+
<button id="btn-a" class="active">Dashboard A</button>
|
|
23
|
+
<button id="btn-b">Dashboard B</button>
|
|
24
|
+
</div>
|
|
25
|
+
<div id="status">Initializing...</div>
|
|
26
|
+
<div class="iframe-container">
|
|
27
|
+
<iframe id="kibanaFrame" title="Kibana Dashboard"></iframe>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
// These values are injected by the test harness via URL params or window.__E2E_CONFIG
|
|
32
|
+
const config = window.__E2E_CONFIG || {};
|
|
33
|
+
const kibanaHost = config.kibanaHost || 'http://localhost:5602';
|
|
34
|
+
const dashboardA = config.dashboardA || '';
|
|
35
|
+
const dashboardB = config.dashboardB || '';
|
|
36
|
+
const parentOrigin = window.location.origin;
|
|
37
|
+
|
|
38
|
+
// Build the embed URL with the initial dashboard
|
|
39
|
+
const embedUrl = `${kibanaHost}/app/org_dashboard_embed?dashboardId=${encodeURIComponent(dashboardA)}&parentOrigin=${encodeURIComponent(parentOrigin)}`;
|
|
40
|
+
document.getElementById('kibanaFrame').src = embedUrl;
|
|
41
|
+
|
|
42
|
+
const iframe = document.getElementById('kibanaFrame');
|
|
43
|
+
const status = document.getElementById('status');
|
|
44
|
+
|
|
45
|
+
// Track messages from the embedded plugin
|
|
46
|
+
window.addEventListener('message', (event) => {
|
|
47
|
+
// Accept messages from the Kibana origin
|
|
48
|
+
if (event.origin !== new URL(kibanaHost).origin && event.origin !== window.location.origin) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const msg = event.data;
|
|
53
|
+
if (!msg || typeof msg !== 'object') return;
|
|
54
|
+
|
|
55
|
+
switch (msg.type) {
|
|
56
|
+
case 'ORG_DASHBOARD_EMBED_READY':
|
|
57
|
+
status.textContent = `READY — dashboardId: ${msg.dashboardId}`;
|
|
58
|
+
window.__E2E_READY = true;
|
|
59
|
+
break;
|
|
60
|
+
case 'ORG_DASHBOARD_EMBED_RENDERED':
|
|
61
|
+
status.textContent = `RENDERED — dashboardId: ${msg.dashboardId}`;
|
|
62
|
+
window.__E2E_RENDERED = msg.dashboardId;
|
|
63
|
+
break;
|
|
64
|
+
case 'ORG_DASHBOARD_EMBED_ERROR':
|
|
65
|
+
status.textContent = `ERROR — ${msg.message}`;
|
|
66
|
+
window.__E2E_ERROR = msg.message;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Switch dashboard via postMessage
|
|
72
|
+
function switchDashboard(dashboardId) {
|
|
73
|
+
window.__E2E_RENDERED = null;
|
|
74
|
+
iframe.contentWindow.postMessage({
|
|
75
|
+
type: 'ORG_DASHBOARD_EMBED_SWITCH_DASHBOARD',
|
|
76
|
+
dashboardId: dashboardId,
|
|
77
|
+
timeRange: { from: 'now-30d', to: 'now' },
|
|
78
|
+
query: { language: 'kuery', query: '' }
|
|
79
|
+
}, kibanaHost);
|
|
80
|
+
status.textContent = `Switching to ${dashboardId}...`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
document.getElementById('btn-a').addEventListener('click', () => {
|
|
84
|
+
switchDashboard(dashboardA);
|
|
85
|
+
document.querySelectorAll('.toolbar button').forEach(b => b.classList.remove('active'));
|
|
86
|
+
document.getElementById('btn-a').classList.add('active');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
document.getElementById('btn-b').addEventListener('click', () => {
|
|
90
|
+
switchDashboard(dashboardB);
|
|
91
|
+
document.querySelectorAll('.toolbar button').forEach(b => b.classList.remove('active'));
|
|
92
|
+
document.getElementById('btn-b').classList.add('active');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Expose for Playwright
|
|
96
|
+
window.__E2E_SWITCH = switchDashboard;
|
|
97
|
+
window.__E2E_IFRAME = iframe;
|
|
98
|
+
window.__E2E_KIBANA_HOST = kibanaHost;
|
|
99
|
+
</script>
|
|
100
|
+
</body>
|
|
101
|
+
</html>
|