@perses-dev/plugin-system 0.0.0-snapshot-ts-panel-actions-76080ec → 0.0.0-snapshot-reverse-proxy-75afbd7
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/DatasourceEditorForm/DatasourceEditorForm.js +1 -0
- package/dist/cjs/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +4 -3
- package/dist/cjs/components/DatasourceSelect/index.js +30 -0
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +117 -90
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +5 -2
- package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +14 -4
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +7 -5
- package/dist/cjs/components/PluginEditor/PluginEditor.js +57 -17
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +6 -3
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +13 -9
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +62 -120
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +42 -33
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +47 -0
- package/dist/cjs/components/Variables/variable-model.js +3 -3
- package/dist/cjs/components/index.js +0 -1
- package/dist/cjs/context/index.js +0 -1
- package/dist/cjs/model/legend.js +13 -0
- package/dist/cjs/model/log-queries.js +16 -0
- package/dist/cjs/remote/PluginRuntime.js +3 -2
- package/dist/cjs/remote/remotePluginLoader.js +19 -4
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
- package/dist/cjs/runtime/DataQueriesProvider/model.js +17 -4
- package/dist/cjs/runtime/RouterProvider.js +114 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +6 -1
- package/dist/cjs/runtime/UsageMetricsProvider.js +4 -3
- package/dist/cjs/runtime/index.js +1 -0
- package/dist/cjs/runtime/log-queries.js +68 -0
- package/dist/cjs/runtime/time-series-queries.js +4 -4
- package/dist/cjs/runtime/variables.js +15 -0
- package/dist/cjs/test/mock-data.js +182 -0
- package/dist/cjs/test/utils.js +17 -8
- package/dist/cjs/utils/variables.js +109 -14
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/{DatasourceSelect.d.ts → DatasourceSelect/DatasourceSelect.d.ts} +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -0
- package/dist/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +4 -3
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -0
- package/dist/components/DatasourceSelect/index.d.ts +2 -0
- package/dist/components/DatasourceSelect/index.d.ts.map +1 -0
- package/dist/components/DatasourceSelect/index.js +15 -0
- package/dist/components/DatasourceSelect/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +120 -93
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +3 -2
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +6 -3
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +3 -2
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js +14 -4
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +3 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +7 -5
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +3 -3
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +57 -17
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +5 -0
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +7 -4
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +13 -9
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +63 -80
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -2
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +43 -34
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.d.ts +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +6 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +44 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.js +3 -3
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/components/index.js.map +1 -1
- package/dist/context/index.d.ts +0 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +0 -1
- package/dist/context/index.js.map +1 -1
- package/dist/model/legend.d.ts +3 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +10 -0
- package/dist/model/legend.js.map +1 -1
- package/dist/model/log-queries.d.ts +24 -0
- package/dist/model/log-queries.d.ts.map +1 -0
- package/dist/model/log-queries.js +15 -0
- package/dist/model/log-queries.js.map +1 -0
- package/dist/model/plugin-base.d.ts +6 -1
- package/dist/model/plugin-base.d.ts.map +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugins.d.ts +2 -0
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +1 -1
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/variables.d.ts +1 -1
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts +2 -2
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +4 -3
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/remote/remotePluginLoader.d.ts +18 -1
- package/dist/remote/remotePluginLoader.d.ts.map +1 -1
- package/dist/remote/remotePluginLoader.js +22 -4
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +17 -4
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/RouterProvider.d.ts +32 -0
- package/dist/runtime/RouterProvider.d.ts.map +1 -0
- package/dist/runtime/RouterProvider.js +59 -0
- package/dist/runtime/RouterProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +6 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +3 -1
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +4 -3
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/log-queries.d.ts +7 -0
- package/dist/runtime/log-queries.d.ts.map +1 -0
- package/dist/runtime/log-queries.js +52 -0
- package/dist/runtime/log-queries.js.map +1 -0
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +4 -4
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/variables.d.ts +1 -0
- package/dist/runtime/variables.d.ts.map +1 -1
- package/dist/runtime/variables.js +13 -0
- package/dist/runtime/variables.js.map +1 -1
- package/dist/test/mock-data.d.ts +136 -1
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +156 -0
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +17 -8
- package/dist/test/utils.js.map +1 -1
- package/dist/utils/variables.d.ts +24 -2
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +102 -14
- package/dist/utils/variables.js.map +1 -1
- package/package.json +7 -7
- package/dist/cjs/components/ProjectSelect.js +0 -96
- package/dist/cjs/context/ProjectStoreProvider.js +0 -81
- package/dist/cjs/context/query-params.js +0 -49
- package/dist/components/DatasourceSelect.d.ts.map +0 -1
- package/dist/components/DatasourceSelect.js.map +0 -1
- package/dist/components/ProjectSelect.d.ts +0 -15
- package/dist/components/ProjectSelect.d.ts.map +0 -1
- package/dist/components/ProjectSelect.js +0 -91
- package/dist/components/ProjectSelect.js.map +0 -1
- package/dist/context/ProjectStoreProvider.d.ts +0 -16
- package/dist/context/ProjectStoreProvider.d.ts.map +0 -1
- package/dist/context/ProjectStoreProvider.js +0 -59
- package/dist/context/ProjectStoreProvider.js.map +0 -1
- package/dist/context/query-params.d.ts +0 -5
- package/dist/context/query-params.d.ts.map +0 -1
- package/dist/context/query-params.js +0 -41
- package/dist/context/query-params.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-editor-form-model.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAA0B,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"variable-editor-form-model.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAA0B,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,cAAc,EACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAA;CAAE,CA4CvE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,GAAG,iBAAiB,CAAC;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/D,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAChE,CAAC;AAEF,wBAAgB,eAAe,CAAC,yBAAyB,EAAE,kBAAkB,GAAG,mBAAmB,CAkClG;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,mBAAmB,GAAG,kBAAkB,CAgC7F"}
|
|
@@ -10,6 +10,50 @@
|
|
|
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 const SORT_METHODS = {
|
|
14
|
+
none: {
|
|
15
|
+
label: 'None',
|
|
16
|
+
sort: (input)=>{
|
|
17
|
+
return input.slice();
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
'alphabetical-asc': {
|
|
21
|
+
label: 'Alphabetical, asc',
|
|
22
|
+
sort: (input)=>{
|
|
23
|
+
return input.slice().sort((a, b)=>a.label > b.label ? 1 : -1);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
'alphabetical-desc': {
|
|
27
|
+
label: 'Alphabetical, desc',
|
|
28
|
+
sort: (input)=>{
|
|
29
|
+
return input.slice().sort((a, b)=>a.label > b.label ? -1 : 1);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
'numerical-asc': {
|
|
33
|
+
label: 'Numerical, asc',
|
|
34
|
+
sort: (input)=>{
|
|
35
|
+
return input.slice().sort((a, b)=>parseInt(a.label) > parseInt(b.label) ? 1 : -1);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
'numerical-desc': {
|
|
39
|
+
label: 'Numerical, desc',
|
|
40
|
+
sort: (input)=>{
|
|
41
|
+
return input.slice().sort((a, b)=>parseInt(a.label) < parseInt(b.label) ? 1 : -1);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
'alphabetical-ci-asc': {
|
|
45
|
+
label: 'Alphabetical, case-insensitive, asc',
|
|
46
|
+
sort: (input)=>{
|
|
47
|
+
return input.slice().sort((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
'alphabetical-ci-desc': {
|
|
51
|
+
label: 'Alphabetical, case-insensitive, desc',
|
|
52
|
+
sort: (input)=>{
|
|
53
|
+
return input.slice().sort((a, b)=>a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
13
57
|
export function getInitialState(initialVariableDefinition) {
|
|
14
58
|
const textVariableFields = {
|
|
15
59
|
value: initialVariableDefinition.spec.value ?? '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"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 { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/core';\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"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 { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/core';\nimport { VariableOption } from '../../../model';\n\nexport type SortMethodName =\n | 'none'\n | 'alphabetical-asc'\n | 'alphabetical-desc'\n | 'numerical-asc'\n | 'numerical-desc'\n | 'alphabetical-ci-asc'\n | 'alphabetical-ci-desc';\n\nexport const SORT_METHODS: Record<\n SortMethodName,\n { label: string; sort: (input: VariableOption[]) => VariableOption[] }\n> = {\n none: {\n label: 'None',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice();\n },\n },\n 'alphabetical-asc': {\n label: 'Alphabetical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? 1 : -1));\n },\n },\n 'alphabetical-desc': {\n label: 'Alphabetical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label > b.label ? -1 : 1));\n },\n },\n 'numerical-asc': {\n label: 'Numerical, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n },\n },\n 'numerical-desc': {\n label: 'Numerical, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n },\n },\n 'alphabetical-ci-asc': {\n label: 'Alphabetical, case-insensitive, asc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n },\n },\n 'alphabetical-ci-desc': {\n label: 'Alphabetical, case-insensitive, desc',\n sort: (input: VariableOption[]): VariableOption[] => {\n return input.slice().sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n },\n },\n};\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["SORT_METHODS","none","label","sort","input","slice","a","b","parseInt","toLowerCase","getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","plugin","kind","name","title","display","description","getVariableDefinitionFromState","state","Error"],"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;AAcjC,OAAO,MAAMA,eAGT;IACFC,MAAM;QACJC,OAAO;QACPC,MAAM,CAACC;YACL,OAAOA,MAAMC,KA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eAAeY,MAAMb,kBAAkB,CAACC,aAAa;gBACrDC,eAAeW,MAAMb,kBAAkB,CAACE,aAAa;gBACrDC,gBAAgBU,MAAMb,kBAAkB,CAACG,cAAc;gBACvDE,iBAAiBQ,MAAMb,kBAAkB,CAACK,eAAe;gBACzDlB,MAAM0B,MAAMb,kBAAkB,CAACb,IAAI;gBACnCmB,QAAQO,MAAMb,kBAAkB,CAACM,MAAM;YACzC;QACF;IACF;IACA,MAAM,IAAIQ,MAAM,CAAC,uBAAuB,EAAEP,MAAM;AAClD"}
|
|
@@ -69,13 +69,13 @@ export function useListVariablePluginValues(definition) {
|
|
|
69
69
|
timeRange,
|
|
70
70
|
refreshKey
|
|
71
71
|
],
|
|
72
|
-
queryFn: async ()=>{
|
|
72
|
+
queryFn: async ({ signal })=>{
|
|
73
73
|
const resp = await variablePlugin?.getVariableOptions(spec, {
|
|
74
74
|
datasourceStore,
|
|
75
75
|
variables,
|
|
76
76
|
timeRange
|
|
77
|
-
});
|
|
78
|
-
if (resp
|
|
77
|
+
}, signal);
|
|
78
|
+
if (!resp?.data?.length) {
|
|
79
79
|
return [];
|
|
80
80
|
}
|
|
81
81
|
if (!capturingRegexp) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Variables/variable-model.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 { ListVariableDefinition } from '@perses-dev/core';\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { VariableOption } from '../../model';\nimport { useDatasourceStore, usePlugin, useTimeRange, useAllVariableValues, VariableStateMap } from '../../runtime';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition): UseQueryResult<VariableOption[]> {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n const datasourceStore = useDatasourceStore();\n const allVariables = useAllVariableValues();\n const { absoluteTimeRange: timeRange, refreshKey } = useTimeRange();\n\n const variablePluginCtx = { timeRange, datasourceStore, variables: allVariables };\n\n const spec = definition.spec.plugin.spec;\n const capturingRegexp =\n definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;\n\n let dependsOnVariables: string[] = Object.keys(allVariables); // Default to all variables\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);\n dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;\n }\n // Exclude self variable to avoid circular dependency\n dependsOnVariables = dependsOnVariables.filter((v) => v !== definition.spec.name);\n\n const variables = useAllVariableValues(dependsOnVariables);\n\n let waitToLoad = false;\n if (dependsOnVariables) {\n waitToLoad = dependsOnVariables.some((v) => variables[v]?.loading);\n }\n\n const variablesValueKey = getVariableValuesKey(variables);\n\n return useQuery({\n queryKey: [definition, variablesValueKey, timeRange, refreshKey],\n queryFn: async () => {\n const resp = await variablePlugin?.getVariableOptions(spec, { datasourceStore, variables, timeRange });\n if (resp
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Variables/variable-model.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 { ListVariableDefinition } from '@perses-dev/core';\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { VariableOption } from '../../model';\nimport { useDatasourceStore, usePlugin, useTimeRange, useAllVariableValues, VariableStateMap } from '../../runtime';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition): UseQueryResult<VariableOption[]> {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n const datasourceStore = useDatasourceStore();\n const allVariables = useAllVariableValues();\n const { absoluteTimeRange: timeRange, refreshKey } = useTimeRange();\n\n const variablePluginCtx = { timeRange, datasourceStore, variables: allVariables };\n\n const spec = definition.spec.plugin.spec;\n const capturingRegexp =\n definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;\n\n let dependsOnVariables: string[] = Object.keys(allVariables); // Default to all variables\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);\n dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;\n }\n // Exclude self variable to avoid circular dependency\n dependsOnVariables = dependsOnVariables.filter((v) => v !== definition.spec.name);\n\n const variables = useAllVariableValues(dependsOnVariables);\n\n let waitToLoad = false;\n if (dependsOnVariables) {\n waitToLoad = dependsOnVariables.some((v) => variables[v]?.loading);\n }\n\n const variablesValueKey = getVariableValuesKey(variables);\n\n return useQuery({\n queryKey: [definition, variablesValueKey, timeRange, refreshKey],\n queryFn: async ({ signal }) => {\n const resp = await variablePlugin?.getVariableOptions(spec, { datasourceStore, variables, timeRange }, signal);\n if (!resp?.data?.length) {\n return [];\n }\n if (!capturingRegexp) {\n return resp.data;\n }\n return filterVariableList(resp.data, capturingRegexp);\n },\n enabled: !!variablePlugin || waitToLoad,\n });\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nexport const VARIABLE_TYPES = [\n { label: 'List', kind: 'ListVariable' },\n { label: 'Text', kind: 'TextVariable' },\n] as const;\n"],"names":["useQuery","useDatasourceStore","usePlugin","useTimeRange","useAllVariableValues","filterVariableList","data","capturedRegexp","result","filteredSet","Set","variableValue","matches","value","matchAll","concat","match","i","length","m","undefined","has","add","push","label","useListVariablePluginValues","definition","variablePlugin","spec","plugin","kind","datasourceStore","allVariables","absoluteTimeRange","timeRange","refreshKey","variablePluginCtx","variables","capturingRegexp","RegExp","dependsOnVariables","Object","keys","dependsOn","dependencies","filter","v","name","waitToLoad","some","loading","variablesValueKey","getVariableValuesKey","queryKey","queryFn","signal","resp","getVariableOptions","enabled","values","map","JSON","stringify","join","VARIABLE_TYPES"],"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;AA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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/index.ts"],"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\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './HTTPSettingsEditor';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"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\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './HTTPSettingsEditor';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './MetricLabelInput';\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,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,qBAAqB"}
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC"}
|
package/dist/context/index.js
CHANGED
|
@@ -10,7 +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 './ProjectStoreProvider';
|
|
14
13
|
export * from './ValidationProvider';
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/index.ts"],"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\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/context/index.ts"],"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\nexport * from './ValidationProvider';\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,uBAAuB"}
|
package/dist/model/legend.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CalculationType, LegendMode, LegendOptionsBase, LegendPositions, LegendSize } from '@perses-dev/core';
|
|
2
2
|
export declare const legendValues: CalculationType[];
|
|
3
3
|
export type LegendValue = (typeof legendValues)[number];
|
|
4
|
+
export type ComparisonValues = 'abs' | 'relative';
|
|
5
|
+
export declare const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig>;
|
|
4
6
|
export interface LegendSpecOptions extends LegendOptionsBase {
|
|
5
|
-
values?: LegendValue
|
|
7
|
+
values?: Array<LegendValue | ComparisonValues>;
|
|
6
8
|
}
|
|
7
9
|
export type LegendSingleSelectConfig = {
|
|
8
10
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,EAGf,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAU1B,eAAO,MAAM,YAAY,EAAE,eAAe,EASzC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,EAGf,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAU1B,eAAO,MAAM,YAAY,EAAE,eAAe,EASzC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAGhF,CAAC;AAKF,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAG/F,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,mBAAmB,+HAO/B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAgBtE"}
|
package/dist/model/legend.js
CHANGED
|
@@ -28,6 +28,16 @@ export const legendValues = [
|
|
|
28
28
|
'max',
|
|
29
29
|
'sum'
|
|
30
30
|
];
|
|
31
|
+
export const comparisonLegends = {
|
|
32
|
+
abs: {
|
|
33
|
+
label: 'Absolute',
|
|
34
|
+
description: 'Absolute value'
|
|
35
|
+
},
|
|
36
|
+
relative: {
|
|
37
|
+
label: 'Relative',
|
|
38
|
+
description: 'Relative value'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
31
41
|
export const LEGEND_POSITIONS_CONFIG = {
|
|
32
42
|
bottom: {
|
|
33
43
|
label: 'Bottom'
|
package/dist/model/legend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/legend.ts"],"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 {\n CALCULATIONS_CONFIG,\n CalculationType,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n isValidLegendMode,\n isValidLegendPosition,\n LegendSize,\n isValidLegendSize,\n} from '@perses-dev/core';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: LegendValue
|
|
1
|
+
{"version":3,"sources":["../../src/model/legend.ts"],"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 {\n CALCULATIONS_CONFIG,\n CalculationType,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n isValidLegendMode,\n isValidLegendPosition,\n LegendSize,\n isValidLegendSize,\n} from '@perses-dev/core';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\nexport type ComparisonValues = 'abs' | 'relative';\n\nexport const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig> = {\n abs: { label: 'Absolute', description: 'Absolute value' },\n relative: { label: 'Relative', description: 'Relative value' },\n};\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: Array<LegendValue | ComparisonValues>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n description?: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n bottom: { label: 'Bottom' },\n right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n list: { label: 'List' },\n table: { label: 'Table' },\n};\n\nexport const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>> = {\n small: { label: 'Small' },\n medium: { label: 'Medium' },\n};\n\nexport const LEGEND_VALUE_CONFIG = legendValues.reduce(\n (config, value) => {\n config[value] = CALCULATIONS_CONFIG[value];\n\n return config;\n },\n {} as Partial<Record<LegendValue, LegendSingleSelectConfig>>\n);\n\nexport function validateLegendSpec(legend?: LegendOptionsBase): boolean {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n if (legend.size && !isValidLegendSize(legend.size)) {\n return false;\n }\n\n return true;\n}\n"],"names":["CALCULATIONS_CONFIG","isValidLegendMode","isValidLegendPosition","isValidLegendSize","legendValues","comparisonLegends","abs","label","description","relative","LEGEND_POSITIONS_CONFIG","bottom","right","LEGEND_MODE_CONFIG","list","table","LEGEND_SIZE_CONFIG","small","medium","LEGEND_VALUE_CONFIG","reduce","config","value","validateLegendSpec","legend","undefined","position","mode","size"],"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,mBAAmB,EAKnBC,iBAAiB,EACjBC,qBAAqB,EAErBC,iBAAiB,QACZ,mBAAmB;AAE1B,+EAA+E;AAC/E,qEAAqE;AACrE,+EAA+E;AAE/E,gFAAgF;AAChF,+EAA+E;AAC/E,oFAAoF;AACpF,mCAAmC;AACnC,OAAO,MAAMC,eAAkC;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC;AAKF,OAAO,MAAMC,oBAAwE;IACnFC,KAAK;QAAEC,OAAO;QAAYC,aAAa;IAAiB;IACxDC,UAAU;QAAEF,OAAO;QAAYC,aAAa;IAAiB;AAC/D,EAAE;AAcF,OAAO,MAAME,0BAAuF;IAClGC,QAAQ;QAAEJ,OAAO;IAAS;IAC1BK,OAAO;QAAEL,OAAO;IAAQ;AAC1B,EAAE;AAEF,OAAO,MAAMM,qBAA6E;IACxFC,MAAM;QAAEP,OAAO;IAAO;IACtBQ,OAAO;QAAER,OAAO;IAAQ;AAC1B,EAAE;AAEF,OAAO,MAAMS,qBAA6E;IACxFC,OAAO;QAAEV,OAAO;IAAQ;IACxBW,QAAQ;QAAEX,OAAO;IAAS;AAC5B,EAAE;AAEF,OAAO,MAAMY,sBAAsBf,aAAagB,MAAM,CACpD,CAACC,QAAQC;IACPD,MAAM,CAACC,MAAM,GAAGtB,mBAAmB,CAACsB,MAAM;IAE1C,OAAOD;AACT,GACA,CAAC,GACD;AAEF,OAAO,SAASE,mBAAmBC,MAA0B;IAC3D,IAAIA,WAAWC,WAAW;QACxB,mEAAmE;QACnE,OAAO;IACT;IACA,IAAI,CAACvB,sBAAsBsB,OAAOE,QAAQ,GAAG;QAC3C,OAAO;IACT;IACA,IAAIF,OAAOG,IAAI,IAAI,CAAC1B,kBAAkBuB,OAAOG,IAAI,GAAG;QAClD,OAAO;IACT;IACA,IAAIH,OAAOI,IAAI,IAAI,CAACzB,kBAAkBqB,OAAOI,IAAI,GAAG;QAClD,OAAO;IACT;IAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AbsoluteTimeRange, UnknownSpec, LogData } from '@perses-dev/core';
|
|
2
|
+
import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
|
|
3
|
+
export interface LogQueryResult {
|
|
4
|
+
logs: LogData;
|
|
5
|
+
timeRange: AbsoluteTimeRange;
|
|
6
|
+
metadata?: {
|
|
7
|
+
executedQueryString: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface LogQueryContext {
|
|
11
|
+
timeRange: AbsoluteTimeRange;
|
|
12
|
+
variableState: VariableStateMap;
|
|
13
|
+
datasourceStore: DatasourceStore;
|
|
14
|
+
refreshKey: string;
|
|
15
|
+
}
|
|
16
|
+
type LogQueryPluginDependencies = {
|
|
17
|
+
variables?: string[];
|
|
18
|
+
};
|
|
19
|
+
export interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
|
|
20
|
+
getLogData: (spec: Spec, ctx: LogQueryContext) => Promise<LogQueryResult>;
|
|
21
|
+
dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=log-queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-queries.d.ts","sourceRoot":"","sources":["../../src/model/log-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;CAC9E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=log-queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/log-queries.ts"],"sourcesContent":["// Copyright 2025 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 { AbsoluteTimeRange, UnknownSpec, LogData } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n}\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;AAwBjC,WAGC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryDefinition } from '@perses-dev/core';
|
|
1
|
+
import { QueryDefinition, UnknownSpec } from '@perses-dev/core';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Base type of all plugin implementations.
|
|
@@ -20,6 +20,11 @@ export interface OptionsEditorProps<Spec> {
|
|
|
20
20
|
value: Spec;
|
|
21
21
|
onChange: (next: Spec) => void;
|
|
22
22
|
isReadonly?: boolean;
|
|
23
|
+
queryHandlerSettings?: {
|
|
24
|
+
runWithOnBlur: boolean;
|
|
25
|
+
watchQueryChanges: (query: string) => void;
|
|
26
|
+
setWatchOtherSpecs: (otherSpecs: UnknownSpec) => void;
|
|
27
|
+
};
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
30
|
* Common props passed to query editor component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-base.d.ts","sourceRoot":"","sources":["../../src/model/plugin-base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-base.d.ts","sourceRoot":"","sources":["../../src/model/plugin-base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,IAAI;IAC1B;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvE;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,IAAI;IAGtC,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE;QACrB,aAAa,EAAE,OAAO,CAAC;QACvB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAC3C,kBAAkB,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,IAAI,CAAC;KACvD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,CAAE,SAAQ,kBAAkB,CAAC,IAAI,CAAC;IACtE,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/plugin-base.ts"],"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 { QueryDefinition } from '@perses-dev/core';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":["React"],"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,OAAOA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["../../src/model/plugin-base.ts"],"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 { QueryDefinition, UnknownSpec } from '@perses-dev/core';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n queryHandlerSettings?: {\n runWithOnBlur: boolean;\n watchQueryChanges: (query: string) => void;\n setWatchOtherSpecs: (otherSpecs: UnknownSpec) => void;\n };\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":["React"],"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,OAAOA,WAAW,QAAQ"}
|
package/dist/model/plugins.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { TraceQueryPlugin } from './trace-queries';
|
|
|
7
7
|
import { ProfileQueryPlugin } from './profile-queries';
|
|
8
8
|
import { VariablePlugin } from './variables';
|
|
9
9
|
import { ExplorePlugin } from './explore';
|
|
10
|
+
import { LogQueryPlugin } from './log-queries';
|
|
10
11
|
export interface PluginModuleSpec {
|
|
11
12
|
plugins: PluginMetadata[];
|
|
12
13
|
}
|
|
@@ -58,6 +59,7 @@ export interface SupportedPlugins {
|
|
|
58
59
|
TimeSeriesQuery: TimeSeriesQueryPlugin;
|
|
59
60
|
TraceQuery: TraceQueryPlugin;
|
|
60
61
|
ProfileQuery: ProfileQueryPlugin;
|
|
62
|
+
LogQuery: LogQueryPlugin;
|
|
61
63
|
Datasource: DatasourcePlugin;
|
|
62
64
|
Explore: ExplorePlugin;
|
|
63
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW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AiB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/plugins.ts"],"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 { UnknownSpec } from '@perses-dev/core';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\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;
|
|
1
|
+
{"version":3,"sources":["../../src/model/plugins.ts"],"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 { UnknownSpec } from '@perses-dev/core';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\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;AAqFjC,WAAuH"}
|
|
@@ -15,7 +15,7 @@ type TimeSeriesQueryPluginDependencies = {
|
|
|
15
15
|
* A plugin for running time series queries.
|
|
16
16
|
*/
|
|
17
17
|
export interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
|
|
18
|
-
getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;
|
|
18
|
+
getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext, abortSignal?: AbortSignal) => Promise<TimeSeriesData>;
|
|
19
19
|
dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;
|
|
20
20
|
}
|
|
21
21
|
export type TimeSeriesQueryMode = 'instant' | 'range';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/model/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,KAAK,iCAAiC,GAAG;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/model/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,KAAK,iCAAiC,GAAG;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAEnH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,iCAAiC,CAAC;CAC5F;AAED,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/time-series-queries.ts"],"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 { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\nexport type TimeSeriesQueryMode = 'instant' | 'range';\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\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;AAwCjC,WAA2F"}
|
|
1
|
+
{"version":3,"sources":["../../src/model/time-series-queries.ts"],"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 { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext, abortSignal?: AbortSignal) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\nexport type TimeSeriesQueryMode = 'instant' | 'range';\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\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;AAwCjC,WAA2F"}
|
|
@@ -23,7 +23,7 @@ type VariablePluginDependencies = {
|
|
|
23
23
|
* Plugin for handling custom VariableDefinitions.
|
|
24
24
|
*/
|
|
25
25
|
export interface VariablePlugin<Spec = UnknownSpec> extends Plugin<Spec> {
|
|
26
|
-
getVariableOptions: (definition: Spec, ctx: GetVariableOptionsContext) => Promise<{
|
|
26
|
+
getVariableOptions: (definition: Spec, ctx: GetVariableOptionsContext, abortSignal?: AbortSignal) => Promise<{
|
|
27
27
|
data: VariableOption[];
|
|
28
28
|
}>;
|
|
29
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED;;GAEG;AACH,KAAK,0BAA0B,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED;;GAEG;AACH,KAAK,0BAA0B,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,kBAAkB,EAAE,CAClB,UAAU,EAAE,IAAI,EAChB,GAAG,EAAE,yBAAyB,EAC9B,WAAW,CAAC,EAAE,WAAW,KACtB,OAAO,CAAC;QAAE,IAAI,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC,CAAC;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,yBAAyB,KAAK,0BAA0B,CAAC;CAC9F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/variables.ts"],"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 { UnknownSpec, AbsoluteTimeRange } from '@perses-dev/core';\nimport { VariableStateMap, DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\nexport type VariableOption = { label: string; value: string };\n\nexport interface GetVariableOptionsContext {\n variables: VariableStateMap;\n datasourceStore: DatasourceStore;\n timeRange: AbsoluteTimeRange;\n}\n\n/**\n * An object containing all the dependencies of a VariablePlugin.\n */\ntype VariablePluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * Plugin for handling custom VariableDefinitions.\n */\nexport interface VariablePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getVariableOptions: (definition: Spec
|
|
1
|
+
{"version":3,"sources":["../../src/model/variables.ts"],"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 { UnknownSpec, AbsoluteTimeRange } from '@perses-dev/core';\nimport { VariableStateMap, DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\nexport type VariableOption = { label: string; value: string };\n\nexport interface GetVariableOptionsContext {\n variables: VariableStateMap;\n datasourceStore: DatasourceStore;\n timeRange: AbsoluteTimeRange;\n}\n\n/**\n * An object containing all the dependencies of a VariablePlugin.\n */\ntype VariablePluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * Plugin for handling custom VariableDefinitions.\n */\nexport interface VariablePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getVariableOptions: (\n definition: Spec,\n ctx: GetVariableOptionsContext,\n abortSignal?: AbortSignal\n ) => Promise<{ data: VariableOption[] }>;\n\n /**\n * Returns a list of variables name this variable depends on. Used to optimize fetching\n */\n dependsOn?: (definition: Spec, ctx: GetVariableOptionsContext) => VariablePluginDependencies;\n}\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;AAwBjC;;CAEC,GACD,WAWC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleFederation } from '@module-federation/enhanced/runtime';
|
|
2
2
|
import { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';
|
|
3
3
|
export declare const loadPlugin: (moduleName: string, pluginName: string, baseURL?: string) => Promise<RemotePluginModule | null>;
|
|
4
4
|
export declare function usePluginRuntime({ plugin }: {
|
|
5
5
|
plugin: PersesPlugin;
|
|
6
6
|
}): {
|
|
7
|
-
pluginRuntime:
|
|
7
|
+
pluginRuntime: ModuleFederation;
|
|
8
8
|
loadPlugin: () => Promise<RemotePluginModule | null>;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=PluginRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAOvF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAoMxE,eAAO,MAAM,UAAU,eACT,MAAM,cACN,MAAM,YACR,MAAM,KACf,QAAQ,kBAAkB,GAAG,IAAI,CAMnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IACtE,aAAa,EAAE,gBAAgB,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACtD,CAKA"}
|
|
@@ -10,7 +10,7 @@
|
|
|
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
|
-
import {
|
|
13
|
+
import { createInstance } from '@module-federation/enhanced/runtime';
|
|
14
14
|
import * as ReactQuery from '@tanstack/react-query';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import ReactDOM from 'react-dom';
|
|
@@ -19,7 +19,7 @@ import * as ReactRouterDOM from 'react-router-dom';
|
|
|
19
19
|
let instance = null;
|
|
20
20
|
const getPluginRuntime = ()=>{
|
|
21
21
|
if (instance === null) {
|
|
22
|
-
const pluginRuntime =
|
|
22
|
+
const pluginRuntime = createInstance({
|
|
23
23
|
name: '@perses/perses-ui-host',
|
|
24
24
|
remotes: [],
|
|
25
25
|
shared: {
|
|
@@ -207,7 +207,8 @@ const registerRemote = (name, baseURL)=>{
|
|
|
207
207
|
};
|
|
208
208
|
export const loadPlugin = async (moduleName, pluginName, baseURL)=>{
|
|
209
209
|
registerRemote(moduleName, baseURL);
|
|
210
|
-
|
|
210
|
+
const pluginRuntime = getPluginRuntime();
|
|
211
|
+
return pluginRuntime.loadRemote(`${moduleName}/${pluginName}`);
|
|
211
212
|
};
|
|
212
213
|
export function usePluginRuntime({ plugin }) {
|
|
213
214
|
return {
|