@perses-dev/plugin-system 0.23.1 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/model/calculations.js +6 -1
  2. package/dist/cjs/model/index.js +2 -2
  3. package/dist/cjs/runtime/time-series-queries.js +29 -6
  4. package/dist/model/calculations.d.ts +1 -1
  5. package/dist/model/calculations.d.ts.map +1 -1
  6. package/dist/model/calculations.js +7 -1
  7. package/dist/model/calculations.js.map +1 -1
  8. package/dist/model/datasource.d.ts +7 -0
  9. package/dist/model/datasource.d.ts.map +1 -1
  10. package/dist/model/datasource.js.map +1 -1
  11. package/dist/model/index.d.ts +2 -2
  12. package/dist/model/index.d.ts.map +1 -1
  13. package/dist/model/index.js +2 -2
  14. package/dist/model/index.js.map +1 -1
  15. package/dist/model/time-series-queries.d.ts +10 -4
  16. package/dist/model/time-series-queries.d.ts.map +1 -1
  17. package/dist/model/time-series-queries.js.map +1 -1
  18. package/dist/runtime/time-series-queries.d.ts +13 -2
  19. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  20. package/dist/runtime/time-series-queries.js +30 -6
  21. package/dist/runtime/time-series-queries.js.map +1 -1
  22. package/package.json +5 -4
  23. package/dist/cjs/components/CalculationSelector/CalculationSelector.test.js +0 -65
  24. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -107
  25. package/dist/cjs/components/PluginEditor/PluginEditor.test.js +0 -150
  26. package/dist/cjs/components/PluginKindSelect.test.js +0 -86
  27. package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +0 -144
  28. package/dist/cjs/components/PluginSpecEditor.test.js +0 -92
  29. package/dist/components/CalculationSelector/CalculationSelector.test.d.ts +0 -2
  30. package/dist/components/CalculationSelector/CalculationSelector.test.d.ts.map +0 -1
  31. package/dist/components/CalculationSelector/CalculationSelector.test.js +0 -58
  32. package/dist/components/CalculationSelector/CalculationSelector.test.js.map +0 -1
  33. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts +0 -2
  34. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts.map +0 -1
  35. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -100
  36. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js.map +0 -1
  37. package/dist/components/PluginEditor/PluginEditor.test.d.ts +0 -2
  38. package/dist/components/PluginEditor/PluginEditor.test.d.ts.map +0 -1
  39. package/dist/components/PluginEditor/PluginEditor.test.js +0 -143
  40. package/dist/components/PluginEditor/PluginEditor.test.js.map +0 -1
  41. package/dist/components/PluginKindSelect.test.d.ts +0 -2
  42. package/dist/components/PluginKindSelect.test.d.ts.map +0 -1
  43. package/dist/components/PluginKindSelect.test.js +0 -79
  44. package/dist/components/PluginKindSelect.test.js.map +0 -1
  45. package/dist/components/PluginRegistry/PluginRegistry.test.d.ts +0 -2
  46. package/dist/components/PluginRegistry/PluginRegistry.test.d.ts.map +0 -1
  47. package/dist/components/PluginRegistry/PluginRegistry.test.js +0 -137
  48. package/dist/components/PluginRegistry/PluginRegistry.test.js.map +0 -1
  49. package/dist/components/PluginSpecEditor.test.d.ts +0 -2
  50. package/dist/components/PluginSpecEditor.test.d.ts.map +0 -1
  51. package/dist/components/PluginSpecEditor.test.js +0 -85
  52. package/dist/components/PluginSpecEditor.test.js.map +0 -1
@@ -1,85 +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
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import userEvent from '@testing-library/user-event';
15
- import { screen } from '@testing-library/react';
16
- import { renderWithContext } from '../test';
17
- import { PluginSpecEditor } from './PluginSpecEditor';
18
- describe('PluginSpecEditor', ()=>{
19
- const renderComponent = (props)=>{
20
- renderWithContext(/*#__PURE__*/ _jsx(PluginSpecEditor, {
21
- ...props
22
- }));
23
- };
24
- describe('Panel plugin', ()=>{
25
- it('should show query and json editors', async ()=>{
26
- renderComponent({
27
- pluginType: 'Panel',
28
- pluginKind: 'BertPanel1',
29
- value: {},
30
- onChange: jest.fn()
31
- });
32
- const queryTab = await screen.findByLabelText('Query');
33
- expect(queryTab).toBeInTheDocument();
34
- const editor = await screen.findByLabelText('BertPanel1 editor');
35
- expect(editor).toBeInTheDocument();
36
- const jsonEditor = await screen.findByLabelText('JSON');
37
- expect(jsonEditor).toBeInTheDocument();
38
- });
39
- it('should display other options editor components', async ()=>{
40
- renderComponent({
41
- pluginType: 'Panel',
42
- pluginKind: 'BertPanel2',
43
- value: {},
44
- onChange: jest.fn()
45
- });
46
- const settingsTab = await screen.findByLabelText('Settings');
47
- expect(settingsTab).toBeInTheDocument();
48
- const editor = await screen.findByLabelText('BertPanel2 editor');
49
- expect(editor).toBeInTheDocument();
50
- const customTab = await screen.findByLabelText('Custom Tab');
51
- expect(customTab).toBeInTheDocument();
52
- const jsonEditor = await screen.findByLabelText('JSON');
53
- expect(jsonEditor).toBeInTheDocument();
54
- });
55
- });
56
- it('propagates value changes', async ()=>{
57
- const onChange = jest.fn();
58
- renderComponent({
59
- pluginType: 'Panel',
60
- pluginKind: 'BertPanel1',
61
- value: {
62
- option1: 'Option1Value'
63
- },
64
- onChange
65
- });
66
- const editor = await screen.findByLabelText('BertPanel1 editor');
67
- expect(editor).toHaveValue('Option1Value');
68
- userEvent.clear(editor);
69
- expect(onChange).toHaveBeenCalledWith({
70
- option1: ''
71
- });
72
- });
73
- it('shows an error if plugin fails to load', async ()=>{
74
- renderComponent({
75
- pluginType: 'Variable',
76
- pluginKind: 'DoesNotExist',
77
- value: {},
78
- onChange: jest.fn()
79
- });
80
- const errorAlert = await screen.findByRole('alert');
81
- expect(errorAlert).toHaveTextContent(/doesnotexist/i);
82
- });
83
- });
84
-
85
- //# sourceMappingURL=PluginSpecEditor.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/PluginSpecEditor.test.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 userEvent from '@testing-library/user-event';\nimport { screen } from '@testing-library/react';\nimport { renderWithContext } from '../test';\nimport { PluginSpecEditor, PluginSpecEditorProps } from './PluginSpecEditor';\n\ndescribe('PluginSpecEditor', () => {\n const renderComponent = (props: PluginSpecEditorProps) => {\n renderWithContext(<PluginSpecEditor {...props} />);\n };\n\n describe('Panel plugin', () => {\n it('should show query and json editors', async () => {\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel1', value: {}, onChange: jest.fn() });\n const queryTab = await screen.findByLabelText('Query');\n expect(queryTab).toBeInTheDocument();\n const editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toBeInTheDocument();\n const jsonEditor = await screen.findByLabelText('JSON');\n expect(jsonEditor).toBeInTheDocument();\n });\n\n it('should display other options editor components', async () => {\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel2', value: {}, onChange: jest.fn() });\n const settingsTab = await screen.findByLabelText('Settings');\n expect(settingsTab).toBeInTheDocument();\n const editor = await screen.findByLabelText('BertPanel2 editor');\n expect(editor).toBeInTheDocument();\n const customTab = await screen.findByLabelText('Custom Tab');\n expect(customTab).toBeInTheDocument();\n const jsonEditor = await screen.findByLabelText('JSON');\n expect(jsonEditor).toBeInTheDocument();\n });\n });\n\n it('propagates value changes', async () => {\n const onChange = jest.fn();\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel1', value: { option1: 'Option1Value' }, onChange });\n\n const editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toHaveValue('Option1Value');\n userEvent.clear(editor);\n expect(onChange).toHaveBeenCalledWith({ option1: '' });\n });\n\n it('shows an error if plugin fails to load', async () => {\n renderComponent({ pluginType: 'Variable', pluginKind: 'DoesNotExist', value: {}, onChange: jest.fn() });\n const errorAlert = await screen.findByRole('alert');\n expect(errorAlert).toHaveTextContent(/doesnotexist/i);\n });\n});\n"],"names":["userEvent","screen","renderWithContext","PluginSpecEditor","describe","renderComponent","props","it","pluginType","pluginKind","value","onChange","jest","fn","queryTab","findByLabelText","expect","toBeInTheDocument","editor","jsonEditor","settingsTab","customTab","option1","toHaveValue","clear","toHaveBeenCalledWith","errorAlert","findByRole","toHaveTextContent"],"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;AAAA,OAAOA,SAAS,MAAM,6BAA6B,CAAC;AACpD,SAASC,MAAM,QAAQ,wBAAwB,CAAC;AAChD,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAC5C,SAASC,gBAAgB,QAA+B,oBAAoB,CAAC;AAE7EC,QAAQ,CAAC,kBAAkB,EAAE,IAAM;IACjC,MAAMC,eAAe,GAAG,CAACC,KAA4B,GAAK;QACxDJ,iBAAiB,eAAC,KAACC,gBAAgB;YAAE,GAAGG,KAAK;UAAI,CAAC,CAAC;IACrD,CAAC,AAAC;IAEFF,QAAQ,CAAC,cAAc,EAAE,IAAM;QAC7BG,EAAE,CAAC,oCAAoC,EAAE,UAAY;YACnDF,eAAe,CAAC;gBAA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