@perses-dev/plugin-system 0.54.0-beta.0 → 0.54.0-beta.1

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 (60) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +3 -3
  2. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +2 -3
  3. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -5
  4. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +2 -3
  5. package/dist/cjs/model/calculations.js +178 -0
  6. package/dist/cjs/model/index.js +1 -0
  7. package/dist/cjs/model/legend.js +6 -5
  8. package/dist/cjs/model/time-series-queries.js +10 -0
  9. package/dist/cjs/test/utils.js +2 -2
  10. package/dist/cjs/utils/index.js +0 -1
  11. package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -1
  12. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  13. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  14. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  15. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +2 -1
  16. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  17. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -2
  18. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  19. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  20. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -2
  21. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  22. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -1
  23. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  24. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -1
  25. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  26. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -2
  27. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  28. package/dist/model/calculations.d.ts +45 -0
  29. package/dist/model/calculations.d.ts.map +1 -0
  30. package/dist/model/calculations.js +165 -0
  31. package/dist/model/calculations.js.map +1 -0
  32. package/dist/model/datasource.d.ts +8 -1
  33. package/dist/model/datasource.d.ts.map +1 -1
  34. package/dist/model/datasource.js +1 -1
  35. package/dist/model/datasource.js.map +1 -1
  36. package/dist/model/index.d.ts +1 -0
  37. package/dist/model/index.d.ts.map +1 -1
  38. package/dist/model/index.js +1 -0
  39. package/dist/model/index.js.map +1 -1
  40. package/dist/model/legend.d.ts +3 -2
  41. package/dist/model/legend.d.ts.map +1 -1
  42. package/dist/model/legend.js +2 -1
  43. package/dist/model/legend.js.map +1 -1
  44. package/dist/model/time-series-queries.d.ts +11 -1
  45. package/dist/model/time-series-queries.d.ts.map +1 -1
  46. package/dist/model/time-series-queries.js +4 -1
  47. package/dist/model/time-series-queries.js.map +1 -1
  48. package/dist/test/utils.d.ts.map +1 -1
  49. package/dist/test/utils.js +1 -1
  50. package/dist/test/utils.js.map +1 -1
  51. package/dist/utils/index.d.ts +0 -1
  52. package/dist/utils/index.d.ts.map +1 -1
  53. package/dist/utils/index.js +0 -1
  54. package/dist/utils/index.js.map +1 -1
  55. package/package.json +2 -2
  56. package/dist/cjs/utils/action.js +0 -43
  57. package/dist/utils/action.d.ts +0 -4
  58. package/dist/utils/action.d.ts.map +0 -1
  59. package/dist/utils/action.js +0 -27
  60. package/dist/utils/action.js.map +0 -1
@@ -10,7 +10,8 @@
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 { CALCULATIONS_CONFIG, isValidLegendMode, isValidLegendPosition, isValidLegendSize } from '@perses-dev/core'; // TODO, maybe this should come from the future utils package
13
+ import { isValidLegendMode, isValidLegendPosition, isValidLegendSize } from '@perses-dev/components';
14
+ import { CALCULATIONS_CONFIG } from './calculations';
14
15
  // This file contains legend-related model code specific to panel plugin specs.
15
16
  // See the `core` package for common/shared legend model code and the
16
17
  // `components` package for legend model code specific to the Legend component.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 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'; // TODO, maybe this should come from the future utils package\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,+BAA+B;AAC/B,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,CAAC,6DAA6D;AAExF,+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"}
1
+ {"version":3,"sources":["../../src/model/legend.ts"],"sourcesContent":["// Copyright 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 isValidLegendMode,\n isValidLegendPosition,\n isValidLegendSize,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n LegendSize,\n} from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationType } from './calculations';\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":["isValidLegendMode","isValidLegendPosition","isValidLegendSize","CALCULATIONS_CONFIG","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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,iBAAiB,EACjBC,qBAAqB,EACrBC,iBAAiB,QAKZ,yBAAyB;AAChC,SAASC,mBAAmB,QAAyB,iBAAiB;AAEtE,+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,GAAGnB,mBAAmB,CAACmB,MAAM;IAE1C,OAAOD;AACT,GACA,CAAC,GACD;AAEF,OAAO,SAASE,mBAAmBC,MAA0B;IAC3D,IAAIA,WAAWC,WAAW;QACxB,mEAAmE;QACnE,OAAO;IACT;IACA,IAAI,CAACxB,sBAAsBuB,OAAOE,QAAQ,GAAG;QAC3C,OAAO;IACT;IACA,IAAIF,OAAOG,IAAI,IAAI,CAAC3B,kBAAkBwB,OAAOG,IAAI,GAAG;QAClD,OAAO;IACT;IACA,IAAIH,OAAOI,IAAI,IAAI,CAAC1B,kBAAkBsB,OAAOI,IAAI,GAAG;QAClD,OAAO;IACT;IAEA,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { Query, QueryKey } from '@tanstack/react-query';
2
- import { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/spec';
2
+ import { AbsoluteTimeRange, UnknownSpec, TimeSeriesData, UnixTimeMs } from '@perses-dev/spec';
3
3
  import { DatasourceStore, VariableStateMap } from '../runtime';
4
4
  import { Plugin } from './plugin-base';
5
5
  /**
@@ -30,5 +30,15 @@ export interface TimeSeriesQueryContext {
30
30
  datasourceStore: DatasourceStore;
31
31
  }
32
32
  export type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;
33
+ export type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number | null];
34
+ export type BucketTuple = [number, string, string, string];
35
+ export type HistogramValue = {
36
+ count: number;
37
+ sum: string;
38
+ buckets?: BucketTuple[];
39
+ };
40
+ export type TimeSeriesHistogramTuple = [unixTimeSeconds: UnixTimeMs, value: HistogramValue];
41
+ export declare function isTimeSeriesValueTuple(data: TimeSeriesValueTuple): data is TimeSeriesValueTuple;
42
+ export type Labels = Record<string, string>;
33
43
  export {};
34
44
  //# sourceMappingURL=time-series-queries.d.ts.map
@@ -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,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;CAClC;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,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,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9F,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;CAClC;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,wBAAwB,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AAE5F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,IAAI,oBAAoB,CAG/F;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -10,6 +10,9 @@
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 { };
13
+ export function isTimeSeriesValueTuple(data) {
14
+ if (data.length !== 2) return false;
15
+ return true;
16
+ }
14
17
 
15
18
  //# sourceMappingURL=time-series-queries.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright 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/spec';\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}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuCjC,WAA2F"}
1
+ {"version":3,"sources":["../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright 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, UnixTimeMs } from '@perses-dev/spec';\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}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n\nexport type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number | null];\n\nexport type BucketTuple = [number, string, string, string]; // [bucket, upperBound, lowerBound, count]\n\nexport type HistogramValue = { count: number; sum: string; buckets?: BucketTuple[] };\n\nexport type TimeSeriesHistogramTuple = [unixTimeSeconds: UnixTimeMs, value: HistogramValue];\n\nexport function isTimeSeriesValueTuple(data: TimeSeriesValueTuple): data is TimeSeriesValueTuple {\n if (data.length !== 2) return false;\n return true;\n}\n\nexport type Labels = Record<string, string>;\n"],"names":["isTimeSeriesValueTuple","data","length"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAiDjC,OAAO,SAASA,uBAAuBC,IAA0B;IAC/D,IAAIA,KAAKC,MAAM,KAAK,GAAG,OAAO;IAC9B,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,MAAM,MAAM,cAAc,GAAG;IAC3B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,cAAc,CAAC,EAAE,cAAc,kBAO7B;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,KAAG,SAAS,CAkB1E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,MAAM,MAAM,cAAc,GAAG;IAC3B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,cAAc,CAAC,EAAE,cAAc,kBAQ7B;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,KAAG,SAAS,CAkB1E"}
@@ -12,7 +12,6 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
15
- import { DEFAULT_DASHBOARD_DURATION } from '@perses-dev/core'; // TODO what should we do with this value ?
16
15
  import { PluginRegistry } from '../components';
17
16
  import { TimeRangeProviderBasic } from '../runtime';
18
17
  import { testPluginLoader } from './test-plugins';
@@ -26,6 +25,7 @@ export function getTestContextWrapper(contextOptions) {
26
25
  }
27
26
  }
28
27
  });
28
+ const DEFAULT_DASHBOARD_DURATION = '1h';
29
29
  const timeRange = {
30
30
  start: new Date(Date.now() - Number(DEFAULT_DASHBOARD_DURATION)),
31
31
  end: new Date()
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/utils.tsx"],"sourcesContent":["// Copyright 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 { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ReactNode } from 'react';\nimport { DEFAULT_DASHBOARD_DURATION } from '@perses-dev/core'; // TODO what should we do with this value ?\nimport { PluginRegistry } from '../components';\nimport { DefaultPluginKinds } from '../model';\nimport { TimeRangeProviderBasic } from '../runtime';\nimport { testPluginLoader } from './test-plugins';\n\nexport type ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\nexport function getTestContextWrapper(contextOptions?: ContextOptions) {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({\n defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } },\n });\n const timeRange = { start: new Date(Date.now() - Number(DEFAULT_DASHBOARD_DURATION)), end: new Date() };\n\n return function Wrapper({ children }: { children: ReactNode }): ReactNode {\n return (\n <QueryClientProvider client={queryClient}>\n <TimeRangeProviderBasic initialTimeRange={timeRange}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {children}\n </PluginRegistry>\n </TimeRangeProviderBasic>\n </QueryClientProvider>\n );\n };\n}\n"],"names":["QueryClient","QueryClientProvider","DEFAULT_DASHBOARD_DURATION","PluginRegistry","TimeRangeProviderBasic","testPluginLoader","getTestContextWrapper","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","timeRange","start","Date","now","Number","end","Wrapper","children","client","initialTimeRange","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAEzE,SAASC,0BAA0B,QAAQ,mBAAmB,CAAC,2CAA2C;AAC1G,SAASC,cAAc,QAAQ,gBAAgB;AAE/C,SAASC,sBAAsB,QAAQ,aAAa;AACpD,SAASC,gBAAgB,QAAQ,iBAAiB;AAMlD,OAAO,SAASC,sBAAsBC,cAA+B;IACnE,iEAAiE;IACjE,MAAMC,cAAc,IAAIR,YAAY;QAClCS,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAC3E;IACA,MAAMC,YAAY;QAAEC,OAAO,IAAIC,KAAKA,KAAKC,GAAG,KAAKC,OAAOf;QAA8BgB,KAAK,IAAIH;IAAO;IAEtG,OAAO,SAASI,QAAQ,EAAEC,QAAQ,EAA2B;QAC3D,qBACE,KAACnB;YAAoBoB,QAAQb;sBAC3B,cAAA,KAACJ;gBAAuBkB,kBAAkBT;0BACxC,cAAA,KAACV;oBACCoB,cAAclB;oBACdmB,oBACEjB,gBAAgBiB,sBAAsB;wBACpCC,iBAAiB;oBACnB;8BAGDL;;;;IAKX;AACF"}
1
+ {"version":3,"sources":["../../src/test/utils.tsx"],"sourcesContent":["// Copyright 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 { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ReactNode } from 'react';\nimport { DurationString } from '@perses-dev/spec';\nimport { PluginRegistry } from '../components';\nimport { DefaultPluginKinds } from '../model';\nimport { TimeRangeProviderBasic } from '../runtime';\nimport { testPluginLoader } from './test-plugins';\n\nexport type ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\nexport function getTestContextWrapper(contextOptions?: ContextOptions) {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({\n defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } },\n });\n const DEFAULT_DASHBOARD_DURATION: DurationString = '1h';\n const timeRange = { start: new Date(Date.now() - Number(DEFAULT_DASHBOARD_DURATION)), end: new Date() };\n\n return function Wrapper({ children }: { children: ReactNode }): ReactNode {\n return (\n <QueryClientProvider client={queryClient}>\n <TimeRangeProviderBasic initialTimeRange={timeRange}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {children}\n </PluginRegistry>\n </TimeRangeProviderBasic>\n </QueryClientProvider>\n );\n };\n}\n"],"names":["QueryClient","QueryClientProvider","PluginRegistry","TimeRangeProviderBasic","testPluginLoader","getTestContextWrapper","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","DEFAULT_DASHBOARD_DURATION","timeRange","start","Date","now","Number","end","Wrapper","children","client","initialTimeRange","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AAGzE,SAASC,cAAc,QAAQ,gBAAgB;AAE/C,SAASC,sBAAsB,QAAQ,aAAa;AACpD,SAASC,gBAAgB,QAAQ,iBAAiB;AAMlD,OAAO,SAASC,sBAAsBC,cAA+B;IACnE,iEAAiE;IACjE,MAAMC,cAAc,IAAIP,YAAY;QAClCQ,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAC3E;IACA,MAAMC,6BAA6C;IACnD,MAAMC,YAAY;QAAEC,OAAO,IAAIC,KAAKA,KAAKC,GAAG,KAAKC,OAAOL;QAA8BM,KAAK,IAAIH;IAAO;IAEtG,OAAO,SAASI,QAAQ,EAAEC,QAAQ,EAA2B;QAC3D,qBACE,KAACnB;YAAoBoB,QAAQd;sBAC3B,cAAA,KAACJ;gBAAuBmB,kBAAkBT;0BACxC,cAAA,KAACX;oBACCqB,cAAcnB;oBACdoB,oBACElB,gBAAgBkB,sBAAsB;wBACpCC,iBAAiB;oBACnB;8BAGDL;;;;IAKX;AACF"}
@@ -1,4 +1,3 @@
1
- export * from './action';
2
1
  export * from './event';
3
2
  export * from './variables';
4
3
  export * from './csv-export';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -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 './action';
14
13
  export * from './event';
15
14
  export * from './variables';
16
15
  export * from './csv-export';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 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 './action';\nexport * from './event';\nexport * from './variables';\nexport * from './csv-export';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,eAAe"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 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 './event';\nexport * from './variables';\nexport * from './csv-export';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,eAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.54.0-beta.0",
3
+ "version": "0.54.0-beta.1",
4
4
  "description": "The plugin feature in Pereses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@module-federation/enhanced": "^2.3.3",
32
- "@perses-dev/components": "0.54.0-beta.0",
32
+ "@perses-dev/components": "0.54.0-beta.1",
33
33
  "@perses-dev/core": "0.53.0",
34
34
  "@perses-dev/spec": "0.2.0-beta.0",
35
35
  "date-fns": "^4.1.0",
@@ -1,43 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get getSubmitText () {
25
- return getSubmitText;
26
- },
27
- get getTitleAction () {
28
- return getTitleAction;
29
- }
30
- });
31
- function getTitleAction(action, isDraft) {
32
- if (action === 'read') return 'View';
33
- if (isDraft && action === 'create') return 'Add';
34
- if (!isDraft && action === 'create') return 'Create';
35
- if (action === 'update') return 'Edit';
36
- return '';
37
- }
38
- function getSubmitText(action, isDraft) {
39
- if (isDraft && action === 'create') return 'Add';
40
- if (isDraft && action === 'update') return 'Apply';
41
- if (!isDraft) return 'Save';
42
- return '';
43
- }
@@ -1,4 +0,0 @@
1
- import { Action } from '@perses-dev/core';
2
- export declare function getTitleAction(action: Action, isDraft: boolean): string;
3
- export declare function getSubmitText(action: Action, isDraft: boolean): string;
4
- //# sourceMappingURL=action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/utils/action.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAMvE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKtE"}
@@ -1,27 +0,0 @@
1
- // Copyright 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 function getTitleAction(action, isDraft) {
14
- if (action === 'read') return 'View';
15
- if (isDraft && action === 'create') return 'Add';
16
- if (!isDraft && action === 'create') return 'Create';
17
- if (action === 'update') return 'Edit';
18
- return '';
19
- }
20
- export function getSubmitText(action, isDraft) {
21
- if (isDraft && action === 'create') return 'Add';
22
- if (isDraft && action === 'update') return 'Apply';
23
- if (!isDraft) return 'Save';
24
- return '';
25
- }
26
-
27
- //# sourceMappingURL=action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/action.ts"],"sourcesContent":["// Copyright 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 { Action } from '@perses-dev/core'; // TODO this is weird the plugin-system is providing component depending on the RBAC system of Perses.\n\nexport function getTitleAction(action: Action, isDraft: boolean): string {\n if (action === 'read') return 'View';\n if (isDraft && action === 'create') return 'Add';\n if (!isDraft && action === 'create') return 'Create';\n if (action === 'update') return 'Edit';\n return '';\n}\n\nexport function getSubmitText(action: Action, isDraft: boolean): string {\n if (isDraft && action === 'create') return 'Add';\n if (isDraft && action === 'update') return 'Apply';\n if (!isDraft) return 'Save';\n return '';\n}\n"],"names":["getTitleAction","action","isDraft","getSubmitText"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,SAASA,eAAeC,MAAc,EAAEC,OAAgB;IAC7D,IAAID,WAAW,QAAQ,OAAO;IAC9B,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,WAAWD,WAAW,UAAU,OAAO;IAC5C,IAAIA,WAAW,UAAU,OAAO;IAChC,OAAO;AACT;AAEA,OAAO,SAASE,cAAcF,MAAc,EAAEC,OAAgB;IAC5D,IAAIA,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAIC,WAAWD,WAAW,UAAU,OAAO;IAC3C,IAAI,CAACC,SAAS,OAAO;IACrB,OAAO;AACT"}