@perses-dev/dashboards 0.46.0 → 0.47.0-rc0
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/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
- package/dist/cjs/components/Datasources/DatasourceEditor.js +15 -13
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +30 -38
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -2
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
- package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
- package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +16 -19
- package/dist/cjs/components/Variables/VariableEditor.js +19 -17
- package/dist/cjs/components/Variables/VariableList.js +17 -17
- package/dist/cjs/components/Variables/index.js +2 -2
- package/dist/cjs/constants/styles.js +7 -7
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +4 -4
- package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +51 -56
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +8 -8
- package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +1 -1
- package/dist/cjs/context/index.js +2 -2
- package/dist/cjs/context/useDashboard.js +4 -4
- package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +8 -8
- package/dist/cjs/stories/decorators/index.js +2 -2
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +16 -14
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +31 -39
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +3 -3
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +5 -5
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +3 -3
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/{TemplateVariable.js → Variable.js} +17 -20
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +20 -18
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +2 -2
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +15 -15
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +2 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/constants/styles.d.ts +2 -2
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +3 -3
- package/dist/constants/styles.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +2 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +1 -2
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +1 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +5 -5
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +126 -0
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +40 -41
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +6 -6
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/context/VariableProvider/index.d.ts +2 -0
- package/dist/context/VariableProvider/index.d.ts.map +1 -0
- package/dist/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/context/VariableProvider/index.js.map +1 -0
- package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -0
- package/dist/context/VariableProvider/utils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +1 -1
- package/dist/context/VariableProvider/utils.js.map +1 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +4 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +8 -8
- package/dist/stories/decorators/WithVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +2 -2
- package/dist/stories/decorators/index.js.map +1 -1
- package/dist/test/datasource-provider.d.ts +2 -2
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +2 -2
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +4 -4
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +7 -7
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- package/dist/cjs/validation/panel.js +0 -39
- package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
- package/dist/components/Variables/TemplateVariable.js.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
- package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
- package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/index.js +0 -15
- package/dist/context/TemplateVariableProvider/index.js.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
- package/dist/validation/index.d.ts +0 -2
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/panel.d.ts +0 -67
- package/dist/validation/panel.d.ts.map +0 -1
- package/dist/validation/panel.js +0 -31
- package/dist/validation/panel.js.map +0 -1
- /package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +0 -0
- /package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/VariableProvider/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './VariableProvider';
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/VariableProvider/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './VariableProvider';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-params.d.ts","sourceRoot":"","sources":["../../../src/context/VariableProvider/query-params.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAkB,MAAM,kBAAkB,CAAC;AAIpE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,UAEhD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,iBAKvD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAShE;AAYD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,EAAE;;;;IAOhE;AAED,wBAAgB,kCAAkC,CAChD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAC9C,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAW/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/VariableProvider/query-params.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableValue, VariableDefinition } from '@perses-dev/core';\nimport { QueryParamConfig, useQueryParams } from 'use-query-params';\n\nconst variableQueryParameterPrefix = 'var-';\n\nexport function getURLQueryParamName(name: string) {\n return `${variableQueryParameterPrefix}${name}`;\n}\n\nexport function encodeVariableValue(value: VariableValue) {\n if (Array.isArray(value)) {\n return value.join(',');\n }\n return value;\n}\n\nexport function decodeVariableValue(value: string): VariableValue {\n if (!value) {\n return null;\n }\n const values = value.split(',');\n if (values.length === 1) {\n return values[0] as string;\n }\n return values;\n}\n\nconst VariableValueParam: QueryParamConfig<VariableValue> = {\n encode: encodeVariableValue,\n decode: (v) => {\n if (typeof v === 'string') {\n return decodeVariableValue(v);\n }\n return '';\n },\n};\n\nexport function useVariableQueryParams(defs: VariableDefinition[]) {\n const config: Record<string, typeof VariableValueParam> = {};\n defs.forEach((def) => {\n const name = getURLQueryParamName(def.spec.name);\n config[name] = VariableValueParam;\n });\n return useQueryParams(config, { updateType: 'replaceIn' });\n}\n\nexport function getInitalValuesFromQueryParameters(\n queryParamValues: Record<string, VariableValue>\n): Record<string, VariableValue> {\n const values: Record<string, VariableValue> = {};\n Object.keys(queryParamValues).forEach((key) => {\n const value = queryParamValues[key];\n if (!value) {\n return;\n }\n const name = key.replace(variableQueryParameterPrefix, '');\n values[name] = value;\n });\n return values;\n}\n"],"names":["useQueryParams","variableQueryParameterPrefix","getURLQueryParamName","name","encodeVariableValue","value","Array","isArray","join","decodeVariableValue","values","split","length","VariableValueParam","encode","decode","v","useVariableQueryParams","defs","config","forEach","def","spec","updateType","getInitalValuesFromQueryParameters","queryParamValues","Object","keys","key","replace"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAA2BA,cAAc,QAAQ,mBAAmB;AAEpE,MAAMC,+BAA+B;AAErC,OAAO,SAASC,qBAAqBC,IAAY;IAC/C,OAAO,CAAC,EAAEF,6BAA6B,EAAEE,KAAK,CAAC;AACjD;AAEA,OAAO,SAASC,oBAAoBC,KAAoB;IACtD,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA,MAAMG,IAAI,CAAC;IACpB;IACA,OAAOH;AACT;AAEA,OAAO,SAASI,oBAAoBJ,KAAa;IAC/C,IAAI,CAACA,OAAO;QACV,OAAO;IACT;IACA,MAAMK,SAASL,MAAMM,KAAK,CAAC;IAC3B,IAAID,OAAOE,MAAM,KAAK,GAAG;QACvB,OAAOF,MAAM,CAAC,EAAE;IAClB;IACA,OAAOA;AACT;AAEA,MAAMG,qBAAsD;IAC1DC,QAAQV;IACRW,QAAQ,CAACC;QACP,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAOP,oBAAoBO;QAC7B;QACA,OAAO;IACT;AACF;AAEA,OAAO,SAASC,uBAAuBC,IAA0B;IAC/D,MAAMC,SAAoD,CAAC;IAC3DD,KAAKE,OAAO,CAAC,CAACC;QACZ,MAAMlB,OAAOD,qBAAqBmB,IAAIC,IAAI,CAACnB,IAAI;QAC/CgB,MAAM,CAAChB,KAAK,GAAGU;IACjB;IACA,OAAOb,eAAemB,QAAQ;QAAEI,YAAY;IAAY;AAC1D;AAEA,OAAO,SAASC,mCACdC,gBAA+C;IAE/C,MAAMf,SAAwC,CAAC;IAC/CgB,OAAOC,IAAI,CAACF,kBAAkBL,OAAO,CAAC,CAACQ;QACrC,MAAMvB,QAAQoB,gBAAgB,CAACG,IAAI;QACnC,IAAI,CAACvB,OAAO;YACV;QACF;QACA,MAAMF,OAAOyB,IAAIC,OAAO,CAAC5B,8BAA8B;QACvDS,MAAM,CAACP,KAAK,GAAGE;IACjB;IACA,OAAOK;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/context/VariableProvider/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAKpE,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,qBAAqB;;;EAqBjH;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,EAAE,EAC5B,SAAS,EAAE,0BAA0B,EAAE,GACtC,kBAAkB,EAAE,CAYtB;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,mBAAmB,EAAE,0BAA0B,EAAE,GAChD,kBAAkB,GAAG,SAAS,CAEhC;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,kBAAkB,EAAE,EAC5B,SAAS,EAAE,0BAA0B,EAAE,EACvC,UAAU,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,QAIhF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/VariableProvider/utils.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableDefinition } from '@perses-dev/core';\nimport { VariableStoreStateMap } from '@perses-dev/plugin-system';\nimport { ExternalVariableDefinition } from '@perses-dev/dashboards';\n\n/*\n * Check whether saved variable definitions are out of date with current default list values in Zustand store\n */\nexport function checkSavedDefaultVariableStatus(definitions: VariableDefinition[], varState: VariableStoreStateMap) {\n let isSavedVariableModified = false;\n const modifiedVariableNames: string[] = [];\n for (const savedVariable of definitions) {\n const name = savedVariable.spec.name;\n if (savedVariable.kind === 'ListVariable') {\n const currentVariable = varState.get({ name });\n if (currentVariable?.value !== null && currentVariable?.value !== savedVariable.spec.defaultValue) {\n modifiedVariableNames.push(name);\n isSavedVariableModified = true;\n }\n } else if (savedVariable.kind === 'TextVariable') {\n const currentVariable = varState.get({ name });\n const currentVariableValue = typeof currentVariable?.value === 'string' ? currentVariable.value : '';\n if (savedVariable.spec.value !== currentVariableValue) {\n modifiedVariableNames.push(name);\n isSavedVariableModified = true;\n }\n }\n }\n return { isSavedVariableModified, modifiedVariableNames };\n}\n\n/**\n * Merge the different kind of variable definition into a list without any duplicates (same name).\n * Respects the order of priority explained in {@link forEachVariableDefinition}\n * @param locals\n * @param externals\n */\nexport function mergeVariableDefinitions(\n locals: VariableDefinition[],\n externals: ExternalVariableDefinition[]\n): VariableDefinition[] {\n const pushed: Record<string, boolean> = {};\n const result: VariableDefinition[] = [];\n\n // Append the value only if it's not already appended\n forEachVariableDefinition(locals, externals, (value: VariableDefinition, name: string) => {\n if (!pushed[name]) {\n result.push(value);\n pushed[name] = true;\n }\n });\n return result;\n}\n\n/**\n * Find a definition by its name.\n * Respects the order of priority explained in {@link forEachVariableDefinition}\n * @param name\n * @param localDefinitions\n * @param externalDefinitions\n */\nexport function findVariableDefinitionByName(\n name: string,\n localDefinitions: VariableDefinition[],\n externalDefinitions: ExternalVariableDefinition[]\n): VariableDefinition | undefined {\n return mergeVariableDefinitions(localDefinitions, externalDefinitions).find((d) => d.spec.name === name);\n}\n\n/**\n * Loop on local and external variable definitions, respecting the order of priority:\n * - local var defs override external var defs of same name\n * - each external var defs override the external var defs coming after.\n * @param locals\n * @param externals\n * @param callbackFn\n */\nexport function forEachVariableDefinition(\n locals: VariableDefinition[],\n externals: ExternalVariableDefinition[],\n callbackFn: (varDef: VariableDefinition, name: string, source?: string) => void\n) {\n locals.forEach((v) => callbackFn(v, v.spec.name));\n externals.forEach((ext) => ext.definitions.forEach((v) => callbackFn(v, v.spec.name, ext.source)));\n}\n"],"names":["checkSavedDefaultVariableStatus","definitions","varState","isSavedVariableModified","modifiedVariableNames","savedVariable","name","spec","kind","currentVariable","get","value","defaultValue","push","currentVariableValue","mergeVariableDefinitions","locals","externals","pushed","result","forEachVariableDefinition","findVariableDefinitionByName","localDefinitions","externalDefinitions","find","d","callbackFn","forEach","v","ext","source"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC;;CAEC,GACD,OAAO,SAASA,gCAAgCC,WAAiC,EAAEC,QAA+B;IAChH,IAAIC,0BAA0B;IAC9B,MAAMC,wBAAkC,EAAE;IAC1C,KAAK,MAAMC,iBAAiBJ,YAAa;QACvC,MAAMK,OAAOD,cAAcE,IAAI,CAACD,IAAI;QACpC,IAAID,cAAcG,IAAI,KAAK,gBAAgB;YACzC,MAAMC,kBAAkBP,SAASQ,GAAG,CAAC;gBAAEJ;YAAK;YAC5C,IAAIG,CAAAA,4BAAAA,sCAAAA,gBAAiBE,KAAK,MAAK,QAAQF,CAAAA,4BAAAA,sCAAAA,gBAAiBE,KAAK,MAAKN,cAAcE,IAAI,CAACK,YAAY,EAAE;gBACjGR,sBAAsBS,IAAI,CAACP;gBAC3BH,0BAA0B;YAC5B;QACF,OAAO,IAAIE,cAAcG,IAAI,KAAK,gBAAgB;YAChD,MAAMC,kBAAkBP,SAASQ,GAAG,CAAC;gBAAEJ;YAAK;YAC5C,MAAMQ,uBAAuB,QAAOL,4BAAAA,sCAAAA,gBAAiBE,KAAK,MAAK,WAAWF,gBAAgBE,KAAK,GAAG;YAClG,IAAIN,cAAcE,IAAI,CAACI,KAAK,KAAKG,sBAAsB;gBACrDV,sBAAsBS,IAAI,CAACP;gBAC3BH,0BAA0B;YAC5B;QACF;IACF;IACA,OAAO;QAAEA;QAAyBC;IAAsB;AAC1D;AAEA;;;;;CAKC,GACD,OAAO,SAASW,yBACdC,MAA4B,EAC5BC,SAAuC;IAEvC,MAAMC,SAAkC,CAAC;IACzC,MAAMC,SAA+B,EAAE;IAEvC,qDAAqD;IACrDC,0BAA0BJ,QAAQC,WAAW,CAACN,OAA2BL;QACvE,IAAI,CAACY,MAAM,CAACZ,KAAK,EAAE;YACjBa,OAAON,IAAI,CAACF;YACZO,MAAM,CAACZ,KAAK,GAAG;QACjB;IACF;IACA,OAAOa;AACT;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,6BACdf,IAAY,EACZgB,gBAAsC,EACtCC,mBAAiD;IAEjD,OAAOR,yBAAyBO,kBAAkBC,qBAAqBC,IAAI,CAAC,CAACC,IAAMA,EAAElB,IAAI,CAACD,IAAI,KAAKA;AACrG;AAEA;;;;;;;CAOC,GACD,OAAO,SAASc,0BACdJ,MAA4B,EAC5BC,SAAuC,EACvCS,UAA+E;IAE/EV,OAAOW,OAAO,CAAC,CAACC,IAAMF,WAAWE,GAAGA,EAAErB,IAAI,CAACD,IAAI;IAC/CW,UAAUU,OAAO,CAAC,CAACE,MAAQA,IAAI5B,WAAW,CAAC0B,OAAO,CAAC,CAACC,IAAMF,WAAWE,GAAGA,EAAErB,IAAI,CAACD,IAAI,EAAEuB,IAAIC,MAAM;AACjG"}
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
package/dist/context/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
export * from './DashboardProvider';
|
|
14
14
|
export * from './DatasourceStoreProvider';
|
|
15
|
-
export * from './
|
|
15
|
+
export * from './VariableProvider';
|
|
16
16
|
export * from './useDashboard';
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardProvider';\nexport * from './DatasourceStoreProvider';\nexport * from './VariableProvider';\nexport * from './useDashboard';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB;AACpC,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDashboard.d.ts","sourceRoot":"","sources":["../../src/context/useDashboard.tsx"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDashboard.d.ts","sourceRoot":"","sources":["../../src/context/useDashboard.tsx"],"names":[],"mappings":"AAaA,OAAO,EAEL,iBAAiB,EACjB,0BAA0B,EAG3B,MAAM,kBAAkB,CAAC;AAI1B,wBAAgB,YAAY;;sCA0Ee,iBAAiB,GAAG,0BAA0B;EASxF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { createPanelRef } from '@perses-dev/core';
|
|
14
14
|
import { useDashboardStore } from './DashboardProvider';
|
|
15
|
-
import {
|
|
15
|
+
import { useVariableDefinitionActions, useVariableDefinitions } from './VariableProvider';
|
|
16
16
|
export function useDashboard() {
|
|
17
17
|
const { panels, panelGroups, panelGroupOrder, setDashboard: setDashboardResource, kind, metadata, display, duration, refreshInterval, datasources, ttl } = useDashboardStore(({ panels, panelGroups, panelGroupOrder, setDashboard, kind, metadata, display, duration, refreshInterval, datasources, ttl })=>({
|
|
18
18
|
panels,
|
|
@@ -27,8 +27,8 @@ export function useDashboard() {
|
|
|
27
27
|
datasources,
|
|
28
28
|
ttl
|
|
29
29
|
}));
|
|
30
|
-
const { setVariableDefinitions } =
|
|
31
|
-
const variables =
|
|
30
|
+
const { setVariableDefinitions } = useVariableDefinitionActions();
|
|
31
|
+
const variables = useVariableDefinitions();
|
|
32
32
|
const layouts = convertPanelGroupsToLayouts(panelGroups, panelGroupOrder);
|
|
33
33
|
const dashboard = kind === 'Dashboard' ? {
|
|
34
34
|
kind,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/useDashboard.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../src/context/useDashboard.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n createPanelRef,\n DashboardResource,\n EphemeralDashboardResource,\n GridDefinition,\n PanelGroupId,\n} from '@perses-dev/core';\nimport { PanelGroupDefinition, useDashboardStore } from './DashboardProvider';\nimport { useVariableDefinitionActions, useVariableDefinitions } from './VariableProvider';\n\nexport function useDashboard() {\n const {\n panels,\n panelGroups,\n panelGroupOrder,\n setDashboard: setDashboardResource,\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n } = useDashboardStore(\n ({\n panels,\n panelGroups,\n panelGroupOrder,\n setDashboard,\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n }) => ({\n panels,\n panelGroups,\n panelGroupOrder,\n setDashboard,\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n })\n );\n const { setVariableDefinitions } = useVariableDefinitionActions();\n const variables = useVariableDefinitions();\n const layouts = convertPanelGroupsToLayouts(panelGroups, panelGroupOrder);\n\n const dashboard =\n kind === 'Dashboard'\n ? ({\n kind,\n metadata,\n spec: {\n display,\n panels,\n layouts,\n variables,\n duration,\n refreshInterval,\n datasources,\n },\n } as DashboardResource)\n : ({\n kind,\n metadata,\n spec: {\n display,\n panels,\n layouts,\n variables,\n duration,\n refreshInterval,\n datasources,\n ttl,\n },\n } as EphemeralDashboardResource);\n\n const setDashboard = (dashboardResource: DashboardResource | EphemeralDashboardResource) => {\n setVariableDefinitions(dashboardResource.spec.variables);\n setDashboardResource(dashboardResource);\n };\n\n return {\n dashboard,\n setDashboard,\n };\n}\n\nfunction convertPanelGroupsToLayouts(\n panelGroups: Record<number, PanelGroupDefinition>,\n panelGroupOrder: PanelGroupId[]\n): GridDefinition[] {\n const layouts: GridDefinition[] = [];\n panelGroupOrder.map((groupOrderId) => {\n const group = panelGroups[groupOrderId];\n if (group === undefined) {\n throw new Error('panel group not found');\n }\n const { title, isCollapsed, itemLayouts, itemPanelKeys } = group;\n let display = undefined;\n if (title) {\n display = {\n title,\n collapse: {\n open: !isCollapsed,\n },\n };\n }\n const layout: GridDefinition = {\n kind: 'Grid',\n spec: {\n display,\n items: itemLayouts.map((layout) => {\n const panelKey = itemPanelKeys[layout.i];\n if (panelKey === undefined) {\n throw new Error(`Missing panel key of layout ${layout.i}`);\n }\n return {\n x: layout.x,\n y: layout.y,\n width: layout.w,\n height: layout.h,\n content: createPanelRef(panelKey),\n };\n }),\n },\n };\n layouts.push(layout);\n });\n\n return layouts;\n}\n"],"names":["createPanelRef","useDashboardStore","useVariableDefinitionActions","useVariableDefinitions","useDashboard","panels","panelGroups","panelGroupOrder","setDashboard","setDashboardResource","kind","metadata","display","duration","refreshInterval","datasources","ttl","setVariableDefinitions","variables","layouts","convertPanelGroupsToLayouts","dashboard","spec","dashboardResource","map","groupOrderId","group","undefined","Error","title","isCollapsed","itemLayouts","itemPanelKeys","collapse","open","layout","items","panelKey","i","x","y","width","w","height","h","content","push"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,cAAc,QAKT,mBAAmB;AAC1B,SAA+BC,iBAAiB,QAAQ,sBAAsB;AAC9E,SAASC,4BAA4B,EAAEC,sBAAsB,QAAQ,qBAAqB;AAE1F,OAAO,SAASC;IACd,MAAM,EACJC,MAAM,EACNC,WAAW,EACXC,eAAe,EACfC,cAAcC,oBAAoB,EAClCC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,eAAe,EACfC,WAAW,EACXC,GAAG,EACJ,GAAG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;wBAC1B,MAAM,IAAIC,MAAM,CAAC,4BAA4B,EAAEO,OAAOG,CAAC,CAAC,CAAC;oBAC3D;oBACA,OAAO;wBACLC,GAAGJ,OAAOI,CAAC;wBACXC,GAAGL,OAAOK,CAAC;wBACXC,OAAON,OAAOO,CAAC;wBACfC,QAAQR,OAAOS,CAAC;wBAChBC,SAAS7C,eAAeqC;oBAC1B;gBACF;YACF;QACF;QACAlB,QAAQ2B,IAAI,CAACX;IACf;IAEA,OAAOhB;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
14
|
+
import { VariableProvider } from '@perses-dev/dashboards';
|
|
15
15
|
// Type guard because storybook types parameters as `any`
|
|
16
|
-
function
|
|
16
|
+
function isWithVariableParameter(parameter) {
|
|
17
17
|
return !!parameter && typeof parameter === 'object' && 'props' in parameter;
|
|
18
18
|
}
|
|
19
|
-
export const
|
|
20
|
-
const initParameter = context.parameters.
|
|
21
|
-
const parameter =
|
|
19
|
+
export const WithVariables = (Story, context)=>{
|
|
20
|
+
const initParameter = context.parameters.withVariables;
|
|
21
|
+
const parameter = isWithVariableParameter(initParameter) ? initParameter : undefined;
|
|
22
22
|
const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
|
|
23
|
-
return /*#__PURE__*/ _jsx(
|
|
23
|
+
return /*#__PURE__*/ _jsx(VariableProvider, {
|
|
24
24
|
...props,
|
|
25
25
|
children: /*#__PURE__*/ _jsx(Story, {})
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=WithVariables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/stories/decorators/WithVariables.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { StoryFn, StoryContext } from '@storybook/react';\nimport { VariableProvider, VariableProviderProps } from '@perses-dev/dashboards';\n\ndeclare module '@storybook/react' {\n interface Parameters {\n withVariables?: WithVariableParameter;\n }\n}\n\nexport type WithVariableParameter = {\n props: Partial<VariableProviderProps>;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithVariableParameter(parameter: unknown | WithVariableParameter): parameter is WithVariableParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithVariables = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withVariables;\n const parameter = isWithVariableParameter(initParameter) ? initParameter : undefined;\n const props = parameter?.props;\n\n return (\n <VariableProvider {...props}>\n <Story />\n </VariableProvider>\n );\n};\n"],"names":["VariableProvider","isWithVariableParameter","parameter","WithVariables","Story","context","initParameter","parameters","withVariables","undefined","props"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,gBAAgB,QAA+B,yBAAyB;AAYjF,yDAAyD;AACzD,SAASC,wBAAwBC,SAA0C;IACzE,OAAO,CAAC,CAACA,aAAa,OAAOA,cAAc,YAAY,WAAWA;AACpE;AAEA,OAAO,MAAMC,gBAAgB,CAACC,OAAgBC;IAC5C,MAAMC,gBAAgBD,QAAQE,UAAU,CAACC,aAAa;IACtD,MAAMN,YAAYD,wBAAwBK,iBAAiBA,gBAAgBG;IAC3E,MAAMC,QAAQR,sBAAAA,gCAAAA,UAAWQ,KAAK;IAE9B,qBACE,KAACV;QAAkB,GAAGU,KAAK;kBACzB,cAAA,KAACN;;AAGP,EAAE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
export * from './constants';
|
|
14
14
|
export * from './WithDashboard';
|
|
15
15
|
export * from './WithDatasourceStore';
|
|
16
|
-
export * from './
|
|
16
|
+
export * from './WithVariables';
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/stories/decorators/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/stories/decorators/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './constants';\nexport * from './WithDashboard';\nexport * from './WithDatasourceStore';\nexport * from './WithVariables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlobalDatasourceResource } from '@perses-dev/core';
|
|
2
2
|
import { DatasourceStoreProviderProps } from '../context';
|
|
3
3
|
export declare const prometheusDemoUrl = "https://prometheus.demo.do.prometheus.io";
|
|
4
|
-
export declare const prometheusDemo:
|
|
4
|
+
export declare const prometheusDemo: GlobalDatasourceResource;
|
|
5
5
|
export declare const defaultDatasourceProps: Pick<DatasourceStoreProviderProps, 'datasourceApi' | 'dashboardResource'>;
|
|
6
6
|
//# sourceMappingURL=datasource-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource-provider.d.ts","sourceRoot":"","sources":["../../src/test/datasource-provider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"datasource-provider.d.ts","sourceRoot":"","sources":["../../src/test/datasource-provider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAG1D,eAAO,MAAM,iBAAiB,6CAA6C,CAAC;AAC5E,eAAO,MAAM,cAAc,EAAE,wBAenB,CAAC;AAKX,eAAO,MAAM,sBAAsB,EAAE,IAAI,CAAC,4BAA4B,EAAE,eAAe,GAAG,mBAAmB,CAqB5G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/datasource-provider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/test/datasource-provider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { GlobalDatasourceResource } from '@perses-dev/core';\nimport { DatasourceStoreProviderProps } from '../context';\nimport { getTestDashboard } from './dashboard-provider';\n\nexport const prometheusDemoUrl = 'https://prometheus.demo.do.prometheus.io';\nexport const prometheusDemo: GlobalDatasourceResource = {\n kind: 'GlobalDatasource',\n metadata: {\n name: 'PrometheusDemo',\n createdAt: '0001-01-01T00:00:00Z',\n updatedAt: '0001-01-01T00:00:00Z',\n version: 0,\n },\n spec: {\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: { directUrl: prometheusDemoUrl },\n },\n },\n} as const;\n\n// This default currently defines the bare minimum to get a story working in\n// the `Dashboard` storybook with the Prometheus demo api. We'll likely want\n// to expand it to do more in the future.\nexport const defaultDatasourceProps: Pick<DatasourceStoreProviderProps, 'datasourceApi' | 'dashboardResource'> = {\n dashboardResource: getTestDashboard(),\n datasourceApi: {\n buildProxyUrl: () => '',\n getDatasource: () => {\n return Promise.resolve(undefined);\n },\n getGlobalDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve(prometheusDemo);\n }\n\n return Promise.resolve(undefined);\n },\n listDatasources: () => {\n return Promise.resolve([]);\n },\n listGlobalDatasources: () => {\n return Promise.resolve([]);\n },\n },\n};\n"],"names":["getTestDashboard","prometheusDemoUrl","prometheusDemo","kind","metadata","name","createdAt","updatedAt","version","spec","default","plugin","directUrl","defaultDatasourceProps","dashboardResource","datasourceApi","buildProxyUrl","getDatasource","Promise","resolve","undefined","getGlobalDatasource","selector","listDatasources","listGlobalDatasources"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,MAAMC,oBAAoB,2CAA2C;AAC5E,OAAO,MAAMC,iBAA2C;IACtDC,MAAM;IACNC,UAAU;QACRC,MAAM;QACNC,WAAW;QACXC,WAAW;QACXC,SAAS;IACX;IACAC,MAAM;QACJC,SAAS;QACTC,QAAQ;YACNR,MAAM;YACNM,MAAM;gBAAEG,WAAWX;YAAkB;QACvC;IACF;AACF,EAAW;AAEX,4EAA4E;AAC5E,4EAA4E;AAC5E,yCAAyC;AACzC,OAAO,MAAMY,yBAAoG;IAC/GC,mBAAmBd;IACnBe,eAAe;QACbC,eAAe,IAAM;QACrBC,eAAe;YACb,OAAOC,QAAQC,OAAO,CAACC;QACzB;QACAC,qBAAqB,CAACC;YACpB,IAAIA,SAASnB,IAAI,KAAK,wBAAwB;gBAC5C,OAAOe,QAAQC,OAAO,CAACjB;YACzB;YAEA,OAAOgB,QAAQC,OAAO,CAACC;QACzB;QACAG,iBAAiB;YACf,OAAOL,QAAQC,OAAO,CAAC,EAAE;QAC3B;QACAK,uBAAuB;YACrB,OAAON,QAAQC,OAAO,CAAC,EAAE;QAC3B;IACF;AACF,EAAE"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
|
-
import { DatasourceStoreProviderProps,
|
|
2
|
+
import { DatasourceStoreProviderProps, VariableProviderProps } from '../../context';
|
|
3
3
|
import { DashboardAppProps } from './DashboardApp';
|
|
4
4
|
export interface ViewDashboardProps extends Omit<BoxProps, 'children'>, DashboardAppProps {
|
|
5
5
|
datasourceApi: DatasourceStoreProviderProps['datasourceApi'];
|
|
6
|
-
externalVariableDefinitions?:
|
|
6
|
+
externalVariableDefinitions?: VariableProviderProps['externalVariableDefinitions'];
|
|
7
7
|
isEditing?: boolean;
|
|
8
8
|
isCreating?: boolean;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewDashboard.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAU9C,OAAO,EACL,4BAA4B,EAE5B,
|
|
1
|
+
{"version":3,"file":"ViewDashboard.d.ts","sourceRoot":"","sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAU9C,OAAO,EACL,4BAA4B,EAE5B,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,iBAAiB;IACvF,aAAa,EAAE,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAC7D,2BAA2B,CAAC,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA0GtD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -16,7 +16,7 @@ import { DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-de
|
|
|
16
16
|
import { ErrorBoundary, ErrorAlert, combineSx } from '@perses-dev/components';
|
|
17
17
|
import { TimeRangeProviderWithQueryParams, useInitialRefreshInterval, useInitialTimeRange, usePluginBuiltinVariableDefinitions } from '@perses-dev/plugin-system';
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
|
-
import { DatasourceStoreProvider,
|
|
19
|
+
import { DatasourceStoreProvider, VariableProviderWithQueryParams } from '../../context';
|
|
20
20
|
import { DashboardProviderWithQueryParams } from '../../context/DashboardProvider/DashboardProviderWithQueryParams';
|
|
21
21
|
import { DashboardApp } from './DashboardApp';
|
|
22
22
|
/**
|
|
@@ -80,10 +80,10 @@ import { DashboardApp } from './DashboardApp';
|
|
|
80
80
|
children: /*#__PURE__*/ _jsx(TimeRangeProviderWithQueryParams, {
|
|
81
81
|
initialTimeRange: initialTimeRange,
|
|
82
82
|
initialRefreshInterval: initialRefreshInterval,
|
|
83
|
-
children: /*#__PURE__*/ _jsx(
|
|
83
|
+
children: /*#__PURE__*/ _jsx(VariableProviderWithQueryParams, {
|
|
84
84
|
initialVariableDefinitions: spec.variables,
|
|
85
85
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
86
|
-
|
|
86
|
+
builtinVariableDefinitions: builtinVariables,
|
|
87
87
|
children: /*#__PURE__*/ _jsx(Box, {
|
|
88
88
|
sx: combineSx({
|
|
89
89
|
display: 'flex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/views/ViewDashboard/ViewDashboard.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { BuiltinVariableDefinition, DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';\nimport { ErrorBoundary, ErrorAlert, combineSx } from '@perses-dev/components';\nimport {\n TimeRangeProviderWithQueryParams,\n useInitialRefreshInterval,\n useInitialTimeRange,\n usePluginBuiltinVariableDefinitions,\n} from '@perses-dev/plugin-system';\nimport { useMemo } from 'react';\nimport {\n DatasourceStoreProviderProps,\n DatasourceStoreProvider,\n VariableProviderProps,\n VariableProviderWithQueryParams,\n} from '../../context';\nimport { DashboardProviderWithQueryParams } from '../../context/DashboardProvider/DashboardProviderWithQueryParams';\nimport { DashboardApp, DashboardAppProps } from './DashboardApp';\n\nexport interface ViewDashboardProps extends Omit<BoxProps, 'children'>, DashboardAppProps {\n datasourceApi: DatasourceStoreProviderProps['datasourceApi'];\n externalVariableDefinitions?: VariableProviderProps['externalVariableDefinitions'];\n isEditing?: boolean;\n isCreating?: boolean;\n}\n\n/**\n * The View for displaying a Dashboard, along with the UI for selecting variable values.\n */\nexport function ViewDashboard(props: ViewDashboardProps) {\n const {\n dashboardResource,\n datasourceApi,\n externalVariableDefinitions,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n isEditing,\n isCreating,\n sx,\n ...others\n } = props;\n const { spec } = dashboardResource;\n const dashboardDuration = spec.duration ?? DEFAULT_DASHBOARD_DURATION;\n const dashboardRefreshInterval = spec.refreshInterval ?? DEFAULT_REFRESH_INTERVAL;\n const initialTimeRange = useInitialTimeRange(dashboardDuration);\n const initialRefreshInterval = useInitialRefreshInterval(dashboardRefreshInterval);\n const { data } = usePluginBuiltinVariableDefinitions();\n\n const builtinVariables = useMemo(() => {\n const result = [\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__dashboard',\n value: () => dashboardResource.metadata.name,\n source: 'Dashboard',\n display: {\n name: '__dashboard',\n description: 'The name of the current dashboard',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__project',\n value: () => dashboardResource.metadata.project,\n source: 'Dashboard',\n display: {\n name: '__project',\n description: 'The name of the current dashboard project',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n ];\n if (data) {\n data.forEach((def: BuiltinVariableDefinition) => result.push(def));\n }\n return result;\n }, [dashboardResource.metadata.name, dashboardResource.metadata.project, data]);\n\n return (\n <DatasourceStoreProvider dashboardResource={dashboardResource} datasourceApi={datasourceApi}>\n <DashboardProviderWithQueryParams\n initialState={{\n dashboardResource,\n isEditMode: !!isEditing,\n }}\n >\n <TimeRangeProviderWithQueryParams\n initialTimeRange={initialTimeRange}\n initialRefreshInterval={initialRefreshInterval}\n >\n <VariableProviderWithQueryParams\n initialVariableDefinitions={spec.variables}\n externalVariableDefinitions={externalVariableDefinitions}\n builtinVariableDefinitions={builtinVariables}\n >\n <Box\n sx={combineSx(\n {\n display: 'flex',\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden',\n },\n sx\n )}\n {...others}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardApp\n dashboardResource={dashboardResource}\n dashboardTitleComponent={dashboardTitleComponent}\n emptyDashboardProps={emptyDashboardProps}\n onSave={onSave}\n onDiscard={onDiscard}\n initialVariableIsSticky={initialVariableIsSticky}\n isReadonly={isReadonly}\n isCreating={isCreating}\n />\n </ErrorBoundary>\n </Box>\n </VariableProviderWithQueryParams>\n </TimeRangeProviderWithQueryParams>\n </DashboardProviderWithQueryParams>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorBoundary","ErrorAlert","combineSx","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","usePluginBuiltinVariableDefinitions","useMemo","DatasourceStoreProvider","VariableProviderWithQueryParams","DashboardProviderWithQueryParams","DashboardApp","ViewDashboard","props","dashboardResource","datasourceApi","externalVariableDefinitions","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","isEditing","isCreating","sx","others","spec","dashboardDuration","duration","dashboardRefreshInterval","refreshInterval","initialTimeRange","initialRefreshInterval","data","builtinVariables","result","kind","name","value","metadata","source","display","description","hidden","project","forEach","def","push","initialState","isEditMode","initialVariableDefinitions","variables","builtinVariableDefinitions","width","height","position","overflow","FallbackComponent"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAkB,gBAAgB;AAC9C,SAAoCC,0BAA0B,EAAEC,wBAAwB,QAAQ,mBAAmB;AACnH,SAASC,aAAa,EAAEC,UAAU,EAAEC,SAAS,QAAQ,yBAAyB;AAC9E,SACEC,gCAAgC,EAChCC,yBAAyB,EACzBC,mBAAmB,EACnBC,mCAAmC,QAC9B,4BAA4B;AACnC,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAEEC,uBAAuB,EAEvBC,+BAA+B,QAC1B,gBAAgB;AACvB,SAASC,gCAAgC,QAAQ,mEAAmE;AACpH,SAASC,YAAY,QAA2B,iBAAiB;AASjE;;CAEC,GACD,OAAO,SAASC,cAAcC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AACL;YACCuC,cAAc;gBACZnC;gBACAoC,YAAY,CAAC,CAAC3B;YAChB;sBAEA,cAAA,KAACpB;gBACC6B,kBAAkBA;gBAClBC,wBAAwBA;0BAExB,cAAA,KAACxB;oBACC0C,4BAA4BxB,KAAKyB,SAAS;oBAC1CpC,6BAA6BA;oBAC7BqC,4BAA4BlB;8BAE5B,cAAA,KAACtC;wBACC4B,IAAIvB,UACF;4BACEwC,SAAS;4BACTY,OAAO;4BACPC,QAAQ;4BACRC,UAAU;4BACVC,UAAU;wBACZ,GACAhC;wBAED,GAAGC,MAAM;kCAEV,cAAA,KAAC1B;4BAAc0D,mBAAmBzD;sCAChC,cAAA,KAACU;gCACCG,mBAAmBA;gCACnBG,yBAAyBA;gCACzBC,qBAAqBA;gCACrBC,QAAQA;gCACRC,WAAWA;gCACXC,yBAAyBA;gCACzBC,YAAYA;gCACZE,YAAYA;;;;;;;;AAS9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/dashboards",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0-rc0",
|
|
4
4
|
"description": "The dashboards feature in Perses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@perses-dev/components": "0.
|
|
33
|
-
"@perses-dev/core": "0.
|
|
34
|
-
"@perses-dev/plugin-system": "0.
|
|
32
|
+
"@perses-dev/components": "0.47.0-rc0",
|
|
33
|
+
"@perses-dev/core": "0.47.0-rc0",
|
|
34
|
+
"@perses-dev/plugin-system": "0.47.0-rc0",
|
|
35
35
|
"@types/react-grid-layout": "^1.3.2",
|
|
36
36
|
"date-fns": "^2.28.0",
|
|
37
37
|
"immer": "^9.0.15",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"zustand": "^4.3.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@perses-dev/internal-utils": "0.
|
|
49
|
-
"@perses-dev/storybook": "0.
|
|
48
|
+
"@perses-dev/internal-utils": "0.47.0-rc0",
|
|
49
|
+
"@perses-dev/storybook": "0.47.0-rc0",
|
|
50
50
|
"history": "^5.3.0",
|
|
51
51
|
"intersection-observer": "^0.12.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@mui/material": "^5.
|
|
54
|
+
"@mui/material": "^5.15.20",
|
|
55
55
|
"@tanstack/react-query": "^4.7.1",
|
|
56
56
|
"react": "^17.0.2 || ^18.0.0",
|
|
57
57
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./TemplateVariableProvider"), exports);
|
|
18
|
-
function _export_star(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
-
Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return from;
|
|
30
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "panelEditorValidationSchema", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return panelEditorValidationSchema;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _zod = require("zod");
|
|
24
|
-
const panelEditorValidationSchema = _zod.z.object({
|
|
25
|
-
name: _zod.z.string().min(1, 'Required'),
|
|
26
|
-
groupId: _zod.z.number(),
|
|
27
|
-
description: _zod.z.string().optional(),
|
|
28
|
-
selection: _zod.z.object({
|
|
29
|
-
type: _zod.z.string(),
|
|
30
|
-
kind: _zod.z.string()
|
|
31
|
-
}),
|
|
32
|
-
links: _zod.z.array(_zod.z.object({
|
|
33
|
-
name: _zod.z.string().optional(),
|
|
34
|
-
url: _zod.z.string().min(1, 'Required'),
|
|
35
|
-
tooltip: _zod.z.string().optional(),
|
|
36
|
-
renderVariables: _zod.z.boolean().optional(),
|
|
37
|
-
targetBlank: _zod.z.boolean().optional()
|
|
38
|
-
})).optional()
|
|
39
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateVariable.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/TemplateVariable.tsx"],"names":[],"mappings":"AAeA,OAAO,EAGL,gBAAgB,EAEhB,WAAW,EACX,YAAY,EACZ,aAAa,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA+B,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAcF,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,qBAAqB,2CAWvE;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,EAC/C,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,qBAAqB,EAAE,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC,GAC/D;IAED,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IAEtC,eAAe,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;IAEnD,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B,CA2FA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Variables/TemplateVariable.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useMemo, useState } from 'react';\nimport { LinearProgress, TextField, Autocomplete, Popper, PopperProps } from '@mui/material';\nimport {\n DEFAULT_ALL_VALUE,\n ListVariableDefinition,\n ListVariableSpec,\n TextVariableDefinition,\n UnknownSpec,\n VariableName,\n VariableValue,\n} from '@perses-dev/core';\nimport { useListVariablePluginValues, VariableOption, VariableState } from '@perses-dev/plugin-system';\nimport { UseQueryResult } from '@tanstack/react-query';\nimport { useTemplateVariable, useTemplateVariableActions } from '../../context';\nimport { MAX_TEMPLATE_VARIABLE_WIDTH, MIN_TEMPLATE_VARIABLE_WIDTH } from '../../constants';\n\ntype TemplateVariableProps = {\n name: VariableName;\n source?: string;\n};\n\nfunction variableOptionToVariableValue(options: VariableOption | VariableOption[] | null): VariableValue {\n if (options === null) {\n return null;\n }\n if (Array.isArray(options)) {\n return options.map((v) => {\n return v.value;\n });\n }\n return options.value;\n}\n\nexport function TemplateVariable({ name, source }: TemplateVariableProps) {\n const ctx = useTemplateVariable(name, source);\n const kind = ctx.definition?.kind;\n switch (kind) {\n case 'TextVariable':\n return <TextVariable name={name} source={source} />;\n case 'ListVariable':\n return <ListVariable name={name} source={source} />;\n }\n\n return <div>Unsupported Variable Kind: ${kind}</div>;\n}\n\nexport function useListVariableState(\n spec: ListVariableSpec<UnknownSpec> | undefined,\n state: VariableState | undefined,\n variablesOptionsQuery: Partial<UseQueryResult<VariableOption[]>>\n): {\n // Value, Loading, Options are modified only when we want to save the changes made\n value: VariableValue | undefined;\n loading: boolean;\n options: VariableOption[] | undefined;\n // selectedOptions is/are the option(s) selected in the view\n selectedOptions: VariableOption | VariableOption[];\n // viewOptions are the options used in the view only (= options + All if allowed)\n viewOptions: VariableOption[];\n} {\n const allowMultiple = spec?.allowMultiple === true;\n const allowAllValue = spec?.allowAllValue === true;\n const sort = spec?.sort;\n const loading = useMemo(() => variablesOptionsQuery.isFetching ?? false, [variablesOptionsQuery.isFetching]);\n const options = useMemo(() => variablesOptionsQuery.data ?? [], [variablesOptionsQuery.data]);\n\n let value = state?.value;\n\n // Make sure value is an array if allowMultiple is true\n if (allowMultiple && !Array.isArray(value)) {\n value = typeof value === 'string' ? [value] : [];\n }\n\n // Sort the provided list of options according to the method defined\n const sortedOptions = useMemo((): VariableOption[] => {\n const opts = options ? [...options] : [];\n\n if (!sort || sort === 'none') return opts;\n\n switch (sort) {\n case 'alphabetical-asc':\n return opts.sort((a, b) => (a.label > b.label ? 1 : -1));\n case 'alphabetical-desc':\n return opts.sort((a, b) => (a.label > b.label ? -1 : 1));\n case 'numerical-asc':\n return opts.sort((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n case 'numerical-desc':\n return opts.sort((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n case 'alphabetical-ci-asc':\n return opts.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n case 'alphabetical-ci-desc':\n return opts.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n default:\n return opts;\n }\n }, [options, sort]);\n\n const viewOptions = useMemo(() => {\n let computedOptions = sortedOptions;\n\n // Add the all value if it's allowed\n if (allowAllValue) {\n computedOptions = [{ value: DEFAULT_ALL_VALUE, label: 'All' }, ...computedOptions];\n }\n return computedOptions;\n }, [allowAllValue, sortedOptions]);\n\n const valueIsInOptions = useMemo(\n () =>\n Boolean(\n viewOptions.find((v) => {\n if (allowMultiple) {\n return (value as string[]).includes(v.value);\n }\n return value === v.value;\n })\n ),\n [viewOptions, value, allowMultiple]\n );\n\n value = useMemo(() => {\n const firstOptionValue = viewOptions?.[allowAllValue ? 1 : 0]?.value;\n\n // If there is no value but there are options, or the value is not in options, we set the value to the first option.\n if (firstOptionValue) {\n if (!valueIsInOptions || !value || value.length === 0) {\n return allowMultiple ? [firstOptionValue] : firstOptionValue;\n }\n }\n\n return value;\n }, [viewOptions, value, valueIsInOptions, allowMultiple, allowAllValue]);\n\n const selectedOptions = useMemo(() => {\n // In the case Autocomplete.multiple equals false, Autocomplete.value expects a single object, not\n // an array, hence this conditional\n if (Array.isArray(value)) {\n return viewOptions.filter((o) => {\n return value?.includes(o.value);\n });\n } else {\n return (\n viewOptions.find((o) => {\n return value === o.value;\n }) ?? { value: '', label: '' }\n );\n }\n }, [value, viewOptions]);\n\n return { value, loading, options, selectedOptions, viewOptions };\n}\n\nconst StyledPopper = (props: PopperProps) => (\n <Popper placeholder={undefined} {...props} sx={{ minWidth: 'fit-content' }} placement=\"bottom-start\" />\n);\n\nconst LETTER_HSIZE = 8; // approximation\nconst ARROW_OFFSET = 40; // right offset for list variables (= take into account the dropdown toggle size)\nconst getWidthPx = (inputValue: string, kind: 'list' | 'text'): number => {\n const width = (inputValue.length + 1) * LETTER_HSIZE + (kind === 'list' ? ARROW_OFFSET : 0);\n if (width < MIN_TEMPLATE_VARIABLE_WIDTH) {\n return MIN_TEMPLATE_VARIABLE_WIDTH;\n } else if (width > MAX_TEMPLATE_VARIABLE_WIDTH) {\n return MAX_TEMPLATE_VARIABLE_WIDTH;\n } else {\n return width;\n }\n};\n\nfunction ListVariable({ name, source }: TemplateVariableProps) {\n const ctx = useTemplateVariable(name, source);\n const definition = ctx.definition as ListVariableDefinition;\n const variablesOptionsQuery = useListVariablePluginValues(definition);\n const { setVariableValue, setVariableLoading, setVariableOptions } = useTemplateVariableActions();\n const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(\n definition?.spec,\n ctx.state,\n variablesOptionsQuery\n );\n const [inputValue, setInputValue] = useState<string>('');\n const [inputWidth, setInputWidth] = useState(MIN_TEMPLATE_VARIABLE_WIDTH);\n\n const title = definition?.spec.display?.name ?? name;\n const allowMultiple = definition?.spec.allowMultiple === true;\n const allowAllValue = definition?.spec.allowAllValue === true;\n\n // Update value when changed\n useEffect(() => {\n if (value) {\n setVariableValue(name, value, source);\n }\n }, [setVariableValue, name, value, source]);\n\n // Update loading when changed\n useEffect(() => {\n setVariableLoading(name, loading, source);\n }, [setVariableLoading, name, loading, source]);\n\n // Update options when changed\n useEffect(() => {\n if (options) {\n setVariableOptions(name, options, source);\n }\n }, [setVariableOptions, name, options, source]);\n\n return (\n <>\n <Autocomplete\n disablePortal\n disableCloseOnSelect={allowMultiple}\n multiple={allowMultiple}\n fullWidth\n limitTags={3}\n size=\"small\"\n disableClearable\n PopperComponent={StyledPopper}\n renderInput={(params) => {\n return allowMultiple ? (\n <TextField {...params} label={title} />\n ) : (\n <TextField {...params} label={title} style={{ width: `${inputWidth}px` }} />\n );\n }}\n sx={{\n '& .MuiInputBase-root': {\n minHeight: '38px',\n },\n '& .MuiInputBase-root.MuiOutlinedInput-root.MuiInputBase-sizeSmall': {\n paddingY: '5px',\n paddingLeft: '5px',\n },\n }}\n value={selectedOptions}\n onChange={(_, value) => {\n if ((value === null || (Array.isArray(value) && value.length === 0)) && allowAllValue) {\n setVariableValue(name, DEFAULT_ALL_VALUE, source);\n } else {\n setVariableValue(name, variableOptionToVariableValue(value), source);\n }\n }}\n inputValue={inputValue}\n onInputChange={(_, newInputValue) => {\n setInputValue(newInputValue);\n if (!allowMultiple) {\n setInputWidth(getWidthPx(newInputValue, 'list'));\n }\n }}\n options={viewOptions}\n />\n {loading && <LinearProgress />}\n </>\n );\n}\n\nfunction TextVariable({ name, source }: TemplateVariableProps) {\n const ctx = useTemplateVariable(name, source);\n const state = ctx.state;\n const definition = ctx.definition as TextVariableDefinition;\n const [tempValue, setTempValue] = useState(state?.value ?? '');\n const [inputWidth, setInputWidth] = useState(getWidthPx(tempValue as string, 'text'));\n const { setVariableValue } = useTemplateVariableActions();\n\n useEffect(() => {\n setTempValue(state?.value ?? '');\n }, [state?.value]);\n\n return (\n <TextField\n title={tempValue as string}\n value={tempValue}\n //onChange={(e) => setTempValue(e.target.value)}\n onChange={(e) => {\n setTempValue(e.target.value);\n setInputWidth(getWidthPx(e.target.value, 'text'));\n }}\n onBlur={() => setVariableValue(name, tempValue, source)}\n placeholder={name}\n label={definition?.spec.display?.name ?? name}\n InputProps={{\n readOnly: definition?.spec.constant ?? false,\n }}\n sx={{\n width: `${inputWidth}px`,\n '& .MuiInputBase-root': {\n minHeight: '38px',\n },\n '& .MuiInputBase-input': {\n textOverflow: 'ellipsis',\n },\n }}\n />\n );\n}\n"],"names":["useEffect","useMemo","useState","LinearProgress","TextField","Autocomplete","Popper","DEFAULT_ALL_VALUE","useListVariablePluginValues","useTemplateVariable","useTemplateVariableActions","MAX_TEMPLATE_VARIABLE_WIDTH","MIN_TEMPLATE_VARIABLE_WIDTH","variableOptionToVariableValue","options","Array","isArray","map","v","value","TemplateVariable","name","source","ctx","kind","definition","TextVariable","ListVariable","div","useListVariableState","spec","state","variablesOptionsQuery","allowMultiple","allowAllValue","sort","loading","isFetching","data","sortedOptions","opts","a","b","label","parseInt","toLowerCase","viewOptions","computedOptions","valueIsInOptions","Boolean","find","includes","firstOptionValue","length","selectedOptions","filter","o","StyledPopper","props","placeholder","undefined","sx","minWidth","placement","LETTER_HSIZE","ARROW_OFFSET","getWidthPx","inputValue","width","setVariableValue","setVariableLoading","setVariableOptions","setInputValue","inputWidth","setInputWidth","title","display","disablePortal","disableCloseOnSelect","multiple","fullWidth","limitTags","size","disableClearable","PopperComponent","renderInput","params","style","minHeight","paddingY","paddingLeft","onChange","_","onInputChange","newInputValue","tempValue","setTempValue","e","target","onBlur","InputProps","readOnly","constant","textOverflow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACrD,SAASC,cAAc,EAAEC,SAAS,EAAEC,YAAY,EAAEC,MAAM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