Files
govoplan-dataflow/webui/src/module.ts
T

171 lines
4.0 KiB
TypeScript

import { createElement, lazy } from "react";
import type {
DashboardWidgetsUiCapability,
PlatformWebModule
} from "@govoplan/core-webui";
import DataflowPipelinesWidget from "./features/dataflow/DataflowPipelinesWidget";
import { generatedTranslations } from "./i18n/generatedTranslations";
import "@xyflow/react/dist/style.css";
import "./styles/dataflow.css";
const DataflowPage = lazy(() => import("./features/dataflow/DataflowPage"));
const readScopes = ["dataflow:pipeline:read", "dataflow:pipeline:admin"];
const dataflowDashboardWidgets: DashboardWidgetsUiCapability = {
widgets: [
{
id: "dataflow.pipelines",
surfaceId: "dataflow.widget.pipelines",
title: "Dataflows",
description: "Active and recently edited dataflow definitions.",
moduleId: "dataflow",
category: "Automation",
order: 70,
defaultVisible: false,
defaultSize: "medium",
supportedSizes: ["medium", "wide"],
anyOf: readScopes,
refreshIntervalMs: 60_000,
defaultConfiguration: {
maxItems: 5,
includeDrafts: true
},
configurationFields: [
{
id: "maxItems",
label: "Maximum dataflows",
kind: "number",
min: 1,
max: 12,
step: 1,
required: true
},
{
id: "includeDrafts",
label: "Include drafts",
kind: "boolean"
}
],
render: ({ settings, refreshKey, configuration }) =>
createElement(DataflowPipelinesWidget, {
settings,
refreshKey,
configuration
})
}
]
};
export const dataflowModule: PlatformWebModule = {
id: "dataflow",
label: "i18n:govoplan-dataflow.dataflow",
version: "0.1.14",
optionalDependencies: [
"access",
"audit",
"datasources",
"files",
"notifications",
"policy",
"reporting",
"risk_compliance",
"workflow"
],
translations: generatedTranslations,
viewSurfaces: [
{
id: "dataflow.page",
moduleId: "dataflow",
kind: "route",
label: "i18n:govoplan-dataflow.dataflow",
order: 72
},
{
id: "dataflow.library",
moduleId: "dataflow",
kind: "section",
label: "i18n:govoplan-dataflow.library",
parentId: "dataflow.page",
order: 10
},
{
id: "dataflow.graph",
moduleId: "dataflow",
kind: "section",
label: "i18n:govoplan-dataflow.graph",
parentId: "dataflow.page",
order: 20
},
{
id: "dataflow.sql",
moduleId: "dataflow",
kind: "section",
label: "i18n:govoplan-dataflow.sql",
parentId: "dataflow.page",
order: 30
},
{
id: "dataflow.inspector",
moduleId: "dataflow",
kind: "section",
label: "i18n:govoplan-dataflow.inspector",
parentId: "dataflow.page",
order: 40
},
{
id: "dataflow.results",
moduleId: "dataflow",
kind: "section",
label: "i18n:govoplan-dataflow.results",
parentId: "dataflow.page",
order: 50
},
{
id: "dataflow.triggers",
moduleId: "dataflow",
kind: "action",
label: "i18n:govoplan-dataflow.triggers",
parentId: "dataflow.page",
order: 60
},
{
id: "dataflow.runs",
moduleId: "dataflow",
kind: "action",
label: "i18n:govoplan-dataflow.runs",
parentId: "dataflow.page",
order: 70
},
{
id: "dataflow.widget.pipelines",
moduleId: "dataflow",
kind: "section",
label: "i18n:govoplan-dataflow.widget",
order: 70
}
],
navItems: [
{
to: "/dataflow",
label: "i18n:govoplan-dataflow.dataflow",
iconName: "waypoints",
anyOf: readScopes,
order: 72
}
],
routes: [
{
path: "/dataflow",
anyOf: readScopes,
order: 72,
surfaceId: "dataflow.page",
render: ({ settings, auth }) => createElement(DataflowPage, { settings, auth })
}
],
uiCapabilities: {
"dashboard.widgets": dataflowDashboardWidgets
}
};
export default dataflowModule;