@perses-dev/core 0.0.0-snapshot-panel-extra-content-2-2767e21 → 0.0.0-snapshot-scatter-chart-embed-8efdfab

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 (166) hide show
  1. package/dist/cjs/constants/dashboard-defaults.js +6 -2
  2. package/dist/cjs/constants/dialog.js +3 -1
  3. package/dist/cjs/constants/index.js +11 -9
  4. package/dist/cjs/index.js +12 -10
  5. package/dist/cjs/model/calculations.js +61 -51
  6. package/dist/cjs/model/http-proxy.js +16 -0
  7. package/dist/cjs/model/index.js +34 -26
  8. package/dist/cjs/model/kind.js +38 -0
  9. package/dist/cjs/model/legend.js +39 -19
  10. package/dist/cjs/model/resource.js +9 -0
  11. package/dist/cjs/model/rolebindings.js +16 -0
  12. package/dist/cjs/model/roles.js +59 -0
  13. package/dist/cjs/model/secrets.js +16 -0
  14. package/dist/cjs/model/time-series-queries.js +3 -1
  15. package/dist/cjs/model/time.js +147 -64
  16. package/dist/cjs/model/trace-data.js +16 -0
  17. package/dist/cjs/model/units/bytes.js +37 -25
  18. package/dist/cjs/model/units/constants.js +3 -1
  19. package/dist/cjs/model/units/decimal.js +22 -16
  20. package/dist/cjs/model/units/index.js +13 -11
  21. package/dist/cjs/model/units/percent.js +26 -19
  22. package/dist/cjs/model/units/throughput.js +113 -0
  23. package/dist/cjs/model/units/time.js +99 -38
  24. package/dist/cjs/model/units/types.js +5 -2
  25. package/dist/cjs/model/units/units.js +81 -45
  26. package/dist/cjs/model/units/utils.js +13 -7
  27. package/dist/cjs/model/variables.js +16 -3
  28. package/dist/cjs/utils/event.js +3 -1
  29. package/dist/cjs/utils/fetch.js +32 -7
  30. package/dist/cjs/utils/index.js +17 -14
  31. package/dist/cjs/utils/is-empty-object.js +3 -1
  32. package/dist/cjs/utils/mathjs.js +3 -1
  33. package/dist/cjs/utils/memo.js +10 -6
  34. package/dist/cjs/utils/panel-refs.js +9 -3
  35. package/dist/cjs/utils/text.js +39 -14
  36. package/dist/cjs/utils/time-series-data.js +21 -11
  37. package/dist/cjs/utils/types.js +16 -0
  38. package/dist/constants/dashboard-defaults.js.map +1 -1
  39. package/dist/constants/dialog.js.map +1 -1
  40. package/dist/constants/index.js.map +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/model/calculations.d.ts +9 -9
  43. package/dist/model/calculations.d.ts.map +1 -1
  44. package/dist/model/calculations.js +46 -46
  45. package/dist/model/calculations.js.map +1 -1
  46. package/dist/model/datasource.d.ts +11 -4
  47. package/dist/model/datasource.d.ts.map +1 -1
  48. package/dist/model/datasource.js.map +1 -1
  49. package/dist/model/display.d.ts +1 -1
  50. package/dist/model/display.d.ts.map +1 -1
  51. package/dist/model/display.js.map +1 -1
  52. package/dist/model/http-proxy.d.ts +16 -0
  53. package/dist/model/http-proxy.d.ts.map +1 -0
  54. package/dist/model/http-proxy.js +15 -0
  55. package/dist/model/http-proxy.js.map +1 -0
  56. package/dist/model/index.d.ts +6 -0
  57. package/dist/model/index.d.ts.map +1 -1
  58. package/dist/model/index.js +6 -0
  59. package/dist/model/index.js.map +1 -1
  60. package/dist/model/kind.d.ts +3 -0
  61. package/dist/model/kind.d.ts.map +1 -0
  62. package/dist/model/kind.js +30 -0
  63. package/dist/model/kind.js.map +1 -0
  64. package/dist/model/legend.d.ts +6 -6
  65. package/dist/model/legend.js +9 -9
  66. package/dist/model/legend.js.map +1 -1
  67. package/dist/model/panels.d.ts +5 -2
  68. package/dist/model/panels.d.ts.map +1 -1
  69. package/dist/model/panels.js.map +1 -1
  70. package/dist/model/query.d.ts +15 -2
  71. package/dist/model/query.d.ts.map +1 -1
  72. package/dist/model/query.js.map +1 -1
  73. package/dist/model/resource.d.ts +3 -2
  74. package/dist/model/resource.d.ts.map +1 -1
  75. package/dist/model/resource.js +3 -1
  76. package/dist/model/resource.js.map +1 -1
  77. package/dist/model/rolebindings.d.ts +27 -0
  78. package/dist/model/rolebindings.d.ts.map +1 -0
  79. package/dist/model/rolebindings.js +15 -0
  80. package/dist/model/rolebindings.js.map +1 -0
  81. package/dist/model/roles.d.ts +32 -0
  82. package/dist/model/roles.d.ts.map +1 -0
  83. package/dist/model/roles.js +40 -0
  84. package/dist/model/roles.js.map +1 -0
  85. package/dist/model/secrets.d.ts +44 -0
  86. package/dist/model/secrets.d.ts.map +1 -0
  87. package/dist/model/secrets.js +15 -0
  88. package/dist/model/secrets.js.map +1 -0
  89. package/dist/model/thresholds.d.ts +2 -2
  90. package/dist/model/thresholds.d.ts.map +1 -1
  91. package/dist/model/thresholds.js.map +1 -1
  92. package/dist/model/time-series-queries.js.map +1 -1
  93. package/dist/model/time.d.ts +3 -0
  94. package/dist/model/time.d.ts.map +1 -1
  95. package/dist/model/time.js +115 -55
  96. package/dist/model/time.js.map +1 -1
  97. package/dist/model/trace-data.d.ts +20 -0
  98. package/dist/model/trace-data.d.ts.map +1 -0
  99. package/dist/model/trace-data.js +15 -0
  100. package/dist/model/trace-data.js.map +1 -0
  101. package/dist/model/units/bytes.d.ts +8 -8
  102. package/dist/model/units/bytes.d.ts.map +1 -1
  103. package/dist/model/units/bytes.js +27 -21
  104. package/dist/model/units/bytes.js.map +1 -1
  105. package/dist/model/units/constants.js.map +1 -1
  106. package/dist/model/units/decimal.d.ts +8 -8
  107. package/dist/model/units/decimal.d.ts.map +1 -1
  108. package/dist/model/units/decimal.js +14 -14
  109. package/dist/model/units/decimal.js.map +1 -1
  110. package/dist/model/units/index.js.map +1 -1
  111. package/dist/model/units/percent.d.ts +7 -7
  112. package/dist/model/units/percent.d.ts.map +1 -1
  113. package/dist/model/units/percent.js +17 -16
  114. package/dist/model/units/percent.js.map +1 -1
  115. package/dist/model/units/throughput.d.ts +13 -0
  116. package/dist/model/units/throughput.d.ts.map +1 -0
  117. package/dist/model/units/throughput.js +94 -0
  118. package/dist/model/units/throughput.js.map +1 -0
  119. package/dist/model/units/time.d.ts +15 -15
  120. package/dist/model/units/time.d.ts.map +1 -1
  121. package/dist/model/units/time.js +87 -34
  122. package/dist/model/units/time.js.map +1 -1
  123. package/dist/model/units/types.d.ts +15 -6
  124. package/dist/model/units/types.d.ts.map +1 -1
  125. package/dist/model/units/types.js +2 -1
  126. package/dist/model/units/types.js.map +1 -1
  127. package/dist/model/units/units.d.ts +49 -30
  128. package/dist/model/units/units.d.ts.map +1 -1
  129. package/dist/model/units/units.js +52 -37
  130. package/dist/model/units/units.js.map +1 -1
  131. package/dist/model/units/utils.d.ts +2 -2
  132. package/dist/model/units/utils.d.ts.map +1 -1
  133. package/dist/model/units/utils.js +4 -4
  134. package/dist/model/units/utils.js.map +1 -1
  135. package/dist/model/variables.d.ts +26 -7
  136. package/dist/model/variables.d.ts.map +1 -1
  137. package/dist/model/variables.js +3 -0
  138. package/dist/model/variables.js.map +1 -1
  139. package/dist/test/setup-tests.js.map +1 -1
  140. package/dist/utils/event.js.map +1 -1
  141. package/dist/utils/fetch.d.ts +3 -1
  142. package/dist/utils/fetch.d.ts.map +1 -1
  143. package/dist/utils/fetch.js +21 -4
  144. package/dist/utils/fetch.js.map +1 -1
  145. package/dist/utils/index.d.ts +2 -1
  146. package/dist/utils/index.d.ts.map +1 -1
  147. package/dist/utils/index.js +2 -1
  148. package/dist/utils/index.js.map +1 -1
  149. package/dist/utils/is-empty-object.js.map +1 -1
  150. package/dist/utils/mathjs.js.map +1 -1
  151. package/dist/utils/memo.js +2 -2
  152. package/dist/utils/memo.js.map +1 -1
  153. package/dist/utils/panel-refs.js.map +1 -1
  154. package/dist/utils/text.d.ts +15 -3
  155. package/dist/utils/text.d.ts.map +1 -1
  156. package/dist/utils/text.js +29 -10
  157. package/dist/utils/text.js.map +1 -1
  158. package/dist/utils/time-series-data.d.ts +1 -1
  159. package/dist/utils/time-series-data.d.ts.map +1 -1
  160. package/dist/utils/time-series-data.js +7 -7
  161. package/dist/utils/time-series-data.js.map +1 -1
  162. package/dist/utils/types.d.ts +2 -0
  163. package/dist/utils/types.d.ts.map +1 -0
  164. package/dist/utils/types.js +15 -0
  165. package/dist/utils/types.js.map +1 -0
  166. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/fetch.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\n/**\n * Calls `global.fetch` and determines which type of error to show for non-200 responses.\n */\nexport async function fetch(...args: Parameters<typeof global.fetch>) {\n const response = await global.fetch(...args);\n if (response.ok === false) {\n const json = await response.json();\n if (json.error) {\n throw new UserFriendlyError(json.error);\n }\n if (json.message) {\n throw new UserFriendlyError(json.message);\n }\n throw new FetchError(response);\n }\n return response;\n}\n\n/**\n * Calls `global.fetch` and throws a `FetchError` on non-200 responses, but also\n * decodes the response body as JSON, casting it to type `T`. Returns the\n * decoded body.\n */\nexport async function fetchJson<T>(...args: Parameters<typeof global.fetch>) {\n const response = await fetch(...args);\n const json: T = await response.json();\n return json;\n}\n\n/**\n * Error thrown when fetch returns a non-200 response.\n */\nexport class FetchError extends Error {\n constructor(response: Readonly<Response>) {\n super(`${response.status} ${response.statusText}`);\n Object.setPrototypeOf(this, FetchError.prototype);\n }\n}\n\n/**\n * General error type for an error that has a message that is OK to show to the end user.\n */\nexport class UserFriendlyError extends Error {\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, UserFriendlyError.prototype);\n }\n}\n"],"names":["fetch","args","response","global","ok","json","error","UserFriendlyError","message","FetchError","fetchJson","Error","constructor","status","statusText","Object","setPrototypeOf","prototype"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EA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C,YAAYJ,OAAe,CAAE;QAC3B,KAAK,CAACA,OAAO,CAAC,CAAC;QACfO,MAAM,CAACC,cAAc,CAAC,IAAI,EAAET,iBAAiB,CAACU,SAAS,CAAC,CAAC;IAC3D;CACD"}
1
+ {"version":3,"sources":["../../src/utils/fetch.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\n/**\n * Calls `global.fetch` and determines which type of error to show for non-200 responses.\n */\nexport async function fetch(...args: Parameters<typeof global.fetch>) {\n const response = await global.fetch(...args);\n if (response.ok === false) {\n const json = await response.json();\n if (json.error) {\n throw new UserFriendlyError(json.error, response.status);\n }\n if (json.message) {\n throw new UserFriendlyError(json.message, response.status);\n }\n throw new FetchError(response);\n }\n return response;\n}\n\n/**\n * Calls `global.fetch` and throws a `FetchError` on non-200 responses, but also\n * decodes the response body as JSON, casting it to type `T`. Returns the\n * decoded body.\n */\nexport async function fetchJson<T>(...args: Parameters<typeof global.fetch>) {\n const response = await fetch(...args);\n const json: T = await response.json();\n return json;\n}\n\n/**\n * Error thrown when fetch returns a non-200 response.\n */\nexport class FetchError extends Error {\n status: number;\n constructor(response: Readonly<Response>) {\n super(`${response.status} ${response.statusText}`);\n this.status = response.status;\n Object.setPrototypeOf(this, FetchError.prototype);\n }\n}\n\n/**\n * General error type for an error that has a message that is OK to show to the end user.\n */\nexport class UserFriendlyError extends Error {\n status: number;\n constructor(message: string, status: number) {\n super(message);\n this.status = status;\n Object.setPrototypeOf(this, UserFriendlyError.prototype);\n }\n}\n"],"names":["fetch","args","response","global","ok","json","error","UserFriendlyError","status","message","FetchError","fetchJson","Error","constructor","statusText","Object","setPrototypeOf","prototype"],"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;;CAEC;;;;;;;;;;;;;AACD,OAAO,eAAeA,MAAM,GAAGC,IAAqC;IAClE,MAAMC,WAAW,MAAMC,OAAOH,SAASC;IACvC,IAAIC,SAASE,OAAO,OAAO;QACzB,MAAMC,OAAO,MAAMH,SAASG;QAC5B,IAAIA,KAAKC,OAAO;YACd,MAAM,IAAIC,kBAAkBF,KAAKC,OAAOJ,SAASM;QACnD;QACA,IAAIH,KAAKI,SAAS;YAChB,MAAM,IAAIF,kBAAkBF,KAAKI,SAASP,SAASM;QACrD;QACA,MAAM,IAAIE,WAAWR;IACvB;IACA,OAAOA;AACT;AAEA;;;;CAIC,GACD,OAAO,eAAeS,UAAa,GAAGV,IAAqC;IACzE,MAAMC,WAAW,MAAMF,SAASC;IAChC,MAAMI,OAAU,MAAMH,SAASG;IAC/B,OAAOA;AACT;AAEA;;CAEC,GACD,OAAO,MAAMK,mBAAmBE;IAE9BC,YAAYX,QAA4B,CAAE;QACxC,KAAK,CAAC,CAAC,EAAEA,SAASM,OAAO,CAAC,EAAEN,SAASY,WAAW,CAAC;QAFnDN,uBAAAA,UAAAA,KAAAA;QAGE,IAAI,CAACA,SAASN,SAASM;QACvBO,OAAOC,eAAe,IAAI,EAAEN,WAAWO;IACzC;AACF;AAEA;;CAEC,GACD,OAAO,MAAMV,0BAA0BK;IAErCC,YAAYJ,OAAe,EAAED,MAAc,CAAE;QAC3C,KAAK,CAACC;QAFRD,uBAAAA,UAAAA,KAAAA;QAGE,IAAI,CAACA,SAASA;QACdO,OAAOC,eAAe,IAAI,EAAET,kBAAkBU;IAChD;AACF"}
@@ -3,6 +3,7 @@ export * from './fetch';
3
3
  export * from './is-empty-object';
4
4
  export * from './memo';
5
5
  export * from './panel-refs';
6
- export * from './time-series-data';
7
6
  export * from './text';
7
+ export * from './time-series-data';
8
+ export * from './types';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
@@ -15,7 +15,8 @@ export * from './fetch';
15
15
  export * from './is-empty-object';
16
16
  export * from './memo';
17
17
  export * from './panel-refs';
18
- export * from './time-series-data';
19
18
  export * from './text';
19
+ export * from './time-series-data';
20
+ export * from './types';
20
21
 
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/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 './event';\nexport * from './fetch';\nexport * from './is-empty-object';\nexport * from './memo';\nexport * from './panel-refs';\nexport * from './time-series-data';\nexport * from './text';\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,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/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 './event';\nexport * from './fetch';\nexport * from './is-empty-object';\nexport * from './memo';\nexport * from './panel-refs';\nexport * from './text';\nexport * from './time-series-data';\nexport * from './types';\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,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/is-empty-object.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\n/**\n * Determines if an object is an empty object\n */\nexport function isEmptyObject(obj: object) {\n return Object.getOwnPropertyNames(obj).length === 0;\n}\n"],"names":["isEmptyObject","obj","Object","getOwnPropertyNames","length"],"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;;CAEC,GACD,OAAO,SAASA,aAAa,CAACC,GAAW,EAAE;IACzC,OAAOC,MAAM,CAACC,mBAAmB,CAACF,GAAG,CAAC,CAACG,MAAM,KAAK,CAAC,CAAC;AACtD,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/is-empty-object.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\n/**\n * Determines if an object is an empty object\n */\nexport function isEmptyObject(obj: object) {\n return Object.getOwnPropertyNames(obj).length === 0;\n}\n"],"names":["isEmptyObject","obj","Object","getOwnPropertyNames","length"],"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;;CAEC,GACD,OAAO,SAASA,cAAcC,GAAW;IACvC,OAAOC,OAAOC,oBAAoBF,KAAKG,WAAW;AACpD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/mathjs.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 { gcdDependencies, create } from 'mathjs';\n\n// This ensures we get a minimal mathjs bundle for just what we need (see https://mathjs.org/docs/custom_bundling.html)\nconst { gcd } = create({ gcdDependencies });\nexport { gcd };\n"],"names":["gcdDependencies","create","gcd"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,EAAEC,MAAM,QAAQ,QAAQ,CAAC;AAEjD,uHAAuH;AACvH,MAAM,EAAEC,GAAG,CAAA,EAAE,GAAGD,MAAM,CAAC;IAAED,eAAe;CAAE,CAAC,AAAC;AAC5C,SAASE,GAAG,GAAG"}
1
+ {"version":3,"sources":["../../src/utils/mathjs.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 { gcdDependencies, create } from 'mathjs';\n\n// This ensures we get a minimal mathjs bundle for just what we need (see https://mathjs.org/docs/custom_bundling.html)\nconst { gcd } = create({ gcdDependencies });\nexport { gcd };\n"],"names":["gcdDependencies","create","gcd"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,EAAEC,MAAM,QAAQ,SAAS;AAEjD,uHAAuH;AACvH,MAAM,EAAEC,IAAG,EAAE,GAAGD,OAAO;IAAED;AAAgB;AACzC,SAASE,GAAG,GAAG"}
@@ -20,8 +20,8 @@ import isEqual from 'lodash/isEqual';
20
20
  const ref = useRef();
21
21
  let areEqual = true;
22
22
  for(let i = 0; i < deps.length; i++){
23
- var ref1;
24
- if (((ref1 = ref.current) === null || ref1 === void 0 ? void 0 : ref1.deps[i]) !== deps[i]) {
23
+ var _ref_current;
24
+ if (((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.deps[i]) !== deps[i]) {
25
25
  areEqual = false;
26
26
  break;
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/memo.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 { useRef, DependencyList } from 'react';\nimport isEqual from 'lodash/isEqual';\n\ntype MemoRef<T> = {\n value: T;\n deps: DependencyList;\n};\n\n/**\n * Like React's useMemo, but guarantees the value will only be recalulated if\n * a dependency changes. Uses strict equality (===) for comparison. (React's\n * useMemo does not offer this guarantee, it's only a performance optimization).\n */\nexport function useMemoized<T>(factory: () => T, deps: DependencyList) {\n const ref = useRef<MemoRef<T>>();\n\n let areEqual = true;\n for (let i = 0; i < deps.length; i++) {\n if (ref.current?.deps[i] !== deps[i]) {\n areEqual = false;\n break;\n }\n }\n\n if (ref.current === undefined || areEqual === false) {\n ref.current = { value: factory(), deps: deps };\n }\n\n return ref.current.value;\n}\n\n/**\n * Like React's useMemo, except it does a deep equality comparison with lodash's\n * isEqual on the dependency list.\n */\nexport function useDeepMemo<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n if (ref.current === undefined || isEqual(deps, ref.current.deps) === false) {\n ref.current = { value: factory(), deps };\n }\n return ref.current.value;\n}\n"],"names":["useRef","isEqual","useMemoized","factory","deps","ref","areEqual","i","length","current","undefined","value","useDeepMemo"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAwB,OAAO,CAAC;AAC/C,OAAOC,OAAO,MAAM,gBAAgB,CAAC;AAOrC;;;;CAIC,GACD,OAAO,SAASC,WAAW,CAAIC,OAAgB,EAAEC,IAAoB,EAAE;IACrE,MAAMC,GAAG,GAAGL,MAAM,EAAc,AAAC;IAEjC,IAAIM,QAAQ,GAAG,IAAI,AAAC;IACpB,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACI,MAAM,EAAED,CAAC,EAAE,CAAE;YAChCF,IAAW;QAAf,IAAIA,CAAAA,CAAAA,IAAW,GAAXA,GAAG,CAACI,OAAO,cAAXJ,IAAW,WAAM,GAAjBA,KAAAA,CAAiB,GAAjBA,IAAW,CAAED,IAAI,CAACG,CAAC,CAAC,MAAKH,IAAI,CAACG,CAAC,CAAC,EAAE;YACpCD,QAAQ,GAAG,KAAK,CAAC;YACjB,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAID,GAAG,CAACI,OAAO,KAAKC,SAAS,IAAIJ,QAAQ,KAAK,KAAK,EAAE;QACnDD,GAAG,CAACI,OAAO,GAAG;YAAEE,KAAK,EAAER,OAAO,EAAE;YAAEC,IAAI,EAAEA,IAAI;SAAE,CAAC;IACjD,CAAC;IAED,OAAOC,GAAG,CAACI,OAAO,CAACE,KAAK,CAAC;AAC3B,CAAC;AAED;;;CAGC,GACD,OAAO,SAASC,WAAW,CAAIT,OAAgB,EAAEC,IAAoB,EAAK;IACxE,MAAMC,GAAG,GAAGL,MAAM,EAAc,AAAC;IACjC,IAAIK,GAAG,CAACI,OAAO,KAAKC,SAAS,IAAIT,OAAO,CAACG,IAAI,EAAEC,GAAG,CAACI,OAAO,CAACL,IAAI,CAAC,KAAK,KAAK,EAAE;QAC1EC,GAAG,CAACI,OAAO,GAAG;YAAEE,KAAK,EAAER,OAAO,EAAE;YAAEC,IAAI;SAAE,CAAC;IAC3C,CAAC;IACD,OAAOC,GAAG,CAACI,OAAO,CAACE,KAAK,CAAC;AAC3B,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/memo.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 { useRef, DependencyList } from 'react';\nimport isEqual from 'lodash/isEqual';\n\ntype MemoRef<T> = {\n value: T;\n deps: DependencyList;\n};\n\n/**\n * Like React's useMemo, but guarantees the value will only be recalulated if\n * a dependency changes. Uses strict equality (===) for comparison. (React's\n * useMemo does not offer this guarantee, it's only a performance optimization).\n */\nexport function useMemoized<T>(factory: () => T, deps: DependencyList) {\n const ref = useRef<MemoRef<T>>();\n\n let areEqual = true;\n for (let i = 0; i < deps.length; i++) {\n if (ref.current?.deps[i] !== deps[i]) {\n areEqual = false;\n break;\n }\n }\n\n if (ref.current === undefined || areEqual === false) {\n ref.current = { value: factory(), deps: deps };\n }\n\n return ref.current.value;\n}\n\n/**\n * Like React's useMemo, except it does a deep equality comparison with lodash's\n * isEqual on the dependency list.\n */\nexport function useDeepMemo<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n if (ref.current === undefined || isEqual(deps, ref.current.deps) === false) {\n ref.current = { value: factory(), deps };\n }\n return ref.current.value;\n}\n"],"names":["useRef","isEqual","useMemoized","factory","deps","ref","areEqual","i","length","current","undefined","value","useDeepMemo"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAwB,QAAQ;AAC/C,OAAOC,aAAa,iBAAiB;AAOrC;;;;CAIC,GACD,OAAO,SAASC,YAAeC,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAML;IAEZ,IAAIM,WAAW;IACf,IAAK,IAAIC,IAAI,GAAGA,IAAIH,KAAKI,QAAQD,IAAK;YAChCF;QAAJ,IAAIA,CAAAA,CAAAA,eAAAA,IAAII,qBAAJJ,0BAAAA,KAAAA,IAAAA,aAAaD,IAAI,CAACG,EAAE,MAAKH,IAAI,CAACG,EAAE,EAAE;YACpCD,WAAW;YACX;QACF;IACF;IAEA,IAAID,IAAII,YAAYC,aAAaJ,aAAa,OAAO;QACnDD,IAAII,UAAU;YAAEE,OAAOR;YAAWC,MAAMA;QAAK;IAC/C;IAEA,OAAOC,IAAII,QAAQE;AACrB;AAEA;;;CAGC,GACD,OAAO,SAASC,YAAeT,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAML;IACZ,IAAIK,IAAII,YAAYC,aAAaT,QAAQG,MAAMC,IAAII,QAAQL,UAAU,OAAO;QAC1EC,IAAII,UAAU;YAAEE,OAAOR;YAAWC;QAAK;IACzC;IACA,OAAOC,IAAII,QAAQE;AACrB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/panel-refs.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 { DashboardSpec, PanelRef } from '../model';\n\n/**\n * Resolve a PanelRef (JSON reference) against the provided DashboardSpec to\n * a PanelDefinition.\n */\nexport function resolvePanelRef(spec: DashboardSpec, panelRef: PanelRef) {\n const panelsKey = getPanelKeyFromRef(panelRef);\n const panelDefinition = spec.panels[panelsKey];\n if (panelDefinition === undefined) {\n throw new Error(`Could not resolve panels reference ${panelRef.$ref}`);\n }\n return panelDefinition;\n}\n\n// Currently, panel refs are prefixed with `#/spec/panels/`. If that format changes, we'll definitely need to update\n// the code in here relying on it being that format.\nconst REF_PREFIX_LENGTH = 14;\n\n/**\n * Gets the unique key for a panel from a PanelRef.\n */\nexport function getPanelKeyFromRef(panelRef: PanelRef) {\n return panelRef.$ref.substring(REF_PREFIX_LENGTH);\n}\n\n/**\n * Creates a PanelRef for a panel with the given key.\n */\nexport function createPanelRef(panelKey: string): PanelRef {\n return { $ref: `#/spec/panels/${panelKey}` };\n}\n"],"names":["resolvePanelRef","spec","panelRef","panelsKey","getPanelKeyFromRef","panelDefinition","panels","undefined","Error","$ref","REF_PREFIX_LENGTH","substring","createPanelRef","panelKey"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;CAGC,GACD,OAAO,SAASA,eAAe,CAACC,IAAmB,EAAEC,QAAkB,EAAE;IACvE,MAAMC,SAAS,GAAGC,kBAAkB,CAACF,QAAQ,CAAC,AAAC;IAC/C,MAAMG,eAAe,GAAGJ,IAAI,CAACK,MAAM,CAACH,SAAS,CAAC,AAAC;IAC/C,IAAIE,eAAe,KAAKE,SAAS,EAAE;QACjC,MAAM,IAAIC,KAAK,CAAC,CAAC,mCAAmC,EAAEN,QAAQ,CAACO,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAOJ,eAAe,CAAC;AACzB,CAAC;AAED,oHAAoH;AACpH,oDAAoD;AACpD,MAAMK,iBAAiB,GAAG,EAAE,AAAC;AAE7B;;CAEC,GACD,OAAO,SAASN,kBAAkB,CAACF,QAAkB,EAAE;IACrD,OAAOA,QAAQ,CAACO,IAAI,CAACE,SAAS,CAACD,iBAAiB,CAAC,CAAC;AACpD,CAAC;AAED;;CAEC,GACD,OAAO,SAASE,cAAc,CAACC,QAAgB,EAAY;IACzD,OAAO;QAAEJ,IAAI,EAAE,CAAC,cAAc,EAAEI,QAAQ,CAAC,CAAC;KAAE,CAAC;AAC/C,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/panel-refs.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 { DashboardSpec, PanelRef } from '../model';\n\n/**\n * Resolve a PanelRef (JSON reference) against the provided DashboardSpec to\n * a PanelDefinition.\n */\nexport function resolvePanelRef(spec: DashboardSpec, panelRef: PanelRef) {\n const panelsKey = getPanelKeyFromRef(panelRef);\n const panelDefinition = spec.panels[panelsKey];\n if (panelDefinition === undefined) {\n throw new Error(`Could not resolve panels reference ${panelRef.$ref}`);\n }\n return panelDefinition;\n}\n\n// Currently, panel refs are prefixed with `#/spec/panels/`. If that format changes, we'll definitely need to update\n// the code in here relying on it being that format.\nconst REF_PREFIX_LENGTH = 14;\n\n/**\n * Gets the unique key for a panel from a PanelRef.\n */\nexport function getPanelKeyFromRef(panelRef: PanelRef) {\n return panelRef.$ref.substring(REF_PREFIX_LENGTH);\n}\n\n/**\n * Creates a PanelRef for a panel with the given key.\n */\nexport function createPanelRef(panelKey: string): PanelRef {\n return { $ref: `#/spec/panels/${panelKey}` };\n}\n"],"names":["resolvePanelRef","spec","panelRef","panelsKey","getPanelKeyFromRef","panelDefinition","panels","undefined","Error","$ref","REF_PREFIX_LENGTH","substring","createPanelRef","panelKey"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;CAGC,GACD,OAAO,SAASA,gBAAgBC,IAAmB,EAAEC,QAAkB;IACrE,MAAMC,YAAYC,mBAAmBF;IACrC,MAAMG,kBAAkBJ,KAAKK,MAAM,CAACH,UAAU;IAC9C,IAAIE,oBAAoBE,WAAW;QACjC,MAAM,IAAIC,MAAM,CAAC,mCAAmC,EAAEN,SAASO,KAAK,CAAC;IACvE;IACA,OAAOJ;AACT;AAEA,oHAAoH;AACpH,oDAAoD;AACpD,MAAMK,oBAAoB;AAE1B;;CAEC,GACD,OAAO,SAASN,mBAAmBF,QAAkB;IACnD,OAAOA,SAASO,KAAKE,UAAUD;AACjC;AAEA;;CAEC,GACD,OAAO,SAASE,eAAeC,QAAgB;IAC7C,OAAO;QAAEJ,MAAM,CAAC,cAAc,EAAEI,SAAS,CAAC;IAAC;AAC7C"}
@@ -1,4 +1,4 @@
1
- import { DashboardResource, VariableResource } from '../model';
1
+ import { DashboardResource, Variable, Datasource } from '../model';
2
2
  /**
3
3
  * If the dashboard has a display name, return the dashboard display name
4
4
  * Else, only return the dashboard name
@@ -10,7 +10,13 @@ export declare function getDashboardDisplayName(dashboard: DashboardResource): s
10
10
  * Else, only return the variable name
11
11
  * @param variable Project or Global variable
12
12
  */
13
- export declare function getVariableDisplayName(variable: VariableResource): string;
13
+ export declare function getVariableDisplayName(variable: Variable): string;
14
+ /**
15
+ * If the variable has a display name, return the datasource display name
16
+ * Else, only return the datasource name
17
+ * @param datasource Project or Global datasource
18
+ */
19
+ export declare function getDatasourceDisplayName(datasource: Datasource): string;
14
20
  /**
15
21
  * If the dashboard has a display name, return the dashboard display name and the dashboard name
16
22
  * Else, only return the dashboard name
@@ -22,5 +28,11 @@ export declare function getDashboardExtendedDisplayName(dashboard: DashboardReso
22
28
  * Else, only return the variable name
23
29
  * @param variable Project or Global variable
24
30
  */
25
- export declare function getVariableExtendedDisplayName(variable: VariableResource): string;
31
+ export declare function getVariableExtendedDisplayName(variable: Variable): string;
32
+ /**
33
+ * If the datasource has a display name, return the datasource display name and the datasource name
34
+ * Else, only return the datasource name
35
+ * @param datasource Project or Global datasource
36
+ */
37
+ export declare function getDatasourceExtendedDisplayName(datasource: Datasource): string;
26
38
  //# sourceMappingURL=text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,iBAAiB,UAEnE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,UAEhE;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,iBAAiB,UAK3E;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,gBAAgB,UAKxE"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/utils/text.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,iBAAiB,UAEnE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,UAExD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,UAE9D;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,iBAAiB,UAK3E;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,QAAQ,UAKhE;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,UAAU,UAKtE"}
@@ -15,26 +15,34 @@
15
15
  * Else, only return the dashboard name
16
16
  * @param dashboard
17
17
  */ export function getDashboardDisplayName(dashboard) {
18
- var ref;
19
- var ref1;
20
- return (ref1 = (ref = dashboard.spec.display) === null || ref === void 0 ? void 0 : ref.name) !== null && ref1 !== void 0 ? ref1 : dashboard.metadata.name;
18
+ var _dashboard_spec_display;
19
+ var _dashboard_spec_display_name;
20
+ return (_dashboard_spec_display_name = (_dashboard_spec_display = dashboard.spec.display) === null || _dashboard_spec_display === void 0 ? void 0 : _dashboard_spec_display.name) !== null && _dashboard_spec_display_name !== void 0 ? _dashboard_spec_display_name : dashboard.metadata.name;
21
21
  }
22
22
  /**
23
23
  * If the variable has a display name, return the variable display name
24
24
  * Else, only return the variable name
25
25
  * @param variable Project or Global variable
26
26
  */ export function getVariableDisplayName(variable) {
27
- var ref;
28
- var ref1;
29
- return (ref1 = (ref = variable.spec.spec.display) === null || ref === void 0 ? void 0 : ref.name) !== null && ref1 !== void 0 ? ref1 : variable.metadata.name;
27
+ var _variable_spec_spec_display;
28
+ var _variable_spec_spec_display_name;
29
+ return (_variable_spec_spec_display_name = (_variable_spec_spec_display = variable.spec.spec.display) === null || _variable_spec_spec_display === void 0 ? void 0 : _variable_spec_spec_display.name) !== null && _variable_spec_spec_display_name !== void 0 ? _variable_spec_spec_display_name : variable.metadata.name;
30
+ }
31
+ /**
32
+ * If the variable has a display name, return the datasource display name
33
+ * Else, only return the datasource name
34
+ * @param datasource Project or Global datasource
35
+ */ export function getDatasourceDisplayName(datasource) {
36
+ var _datasource_spec_display;
37
+ return ((_datasource_spec_display = datasource.spec.display) === null || _datasource_spec_display === void 0 ? void 0 : _datasource_spec_display.name) || datasource.metadata.name;
30
38
  }
31
39
  /**
32
40
  * If the dashboard has a display name, return the dashboard display name and the dashboard name
33
41
  * Else, only return the dashboard name
34
42
  * @param dashboard
35
43
  */ export function getDashboardExtendedDisplayName(dashboard) {
36
- var ref;
37
- if ((ref = dashboard.spec.display) === null || ref === void 0 ? void 0 : ref.name) {
44
+ var _dashboard_spec_display;
45
+ if ((_dashboard_spec_display = dashboard.spec.display) === null || _dashboard_spec_display === void 0 ? void 0 : _dashboard_spec_display.name) {
38
46
  return `${dashboard.spec.display.name} (Name: ${dashboard.metadata.name})`;
39
47
  }
40
48
  return dashboard.metadata.name;
@@ -44,11 +52,22 @@
44
52
  * Else, only return the variable name
45
53
  * @param variable Project or Global variable
46
54
  */ export function getVariableExtendedDisplayName(variable) {
47
- var ref;
48
- if ((ref = variable.spec.spec.display) === null || ref === void 0 ? void 0 : ref.name) {
55
+ var _variable_spec_spec_display;
56
+ if ((_variable_spec_spec_display = variable.spec.spec.display) === null || _variable_spec_spec_display === void 0 ? void 0 : _variable_spec_spec_display.name) {
49
57
  return `${variable.spec.spec.display.name} (Name: ${variable.metadata.name})`;
50
58
  }
51
59
  return variable.metadata.name;
52
60
  }
61
+ /**
62
+ * If the datasource has a display name, return the datasource display name and the datasource name
63
+ * Else, only return the datasource name
64
+ * @param datasource Project or Global datasource
65
+ */ export function getDatasourceExtendedDisplayName(datasource) {
66
+ var _datasource_spec_display;
67
+ if ((_datasource_spec_display = datasource.spec.display) === null || _datasource_spec_display === void 0 ? void 0 : _datasource_spec_display.name) {
68
+ return `${datasource.spec.display.name} (Name: ${datasource.metadata.name})`;
69
+ }
70
+ return datasource.metadata.name;
71
+ }
53
72
 
54
73
  //# sourceMappingURL=text.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/text.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 { DashboardResource, VariableResource } from '../model';\n\n/**\n * If the dashboard has a display name, return the dashboard display name\n * Else, only return the dashboard name\n * @param dashboard\n */\nexport function getDashboardDisplayName(dashboard: DashboardResource) {\n return dashboard.spec.display?.name ?? dashboard.metadata.name;\n}\n\n/**\n * If the variable has a display name, return the variable display name\n * Else, only return the variable name\n * @param variable Project or Global variable\n */\nexport function getVariableDisplayName(variable: VariableResource) {\n return variable.spec.spec.display?.name ?? variable.metadata.name;\n}\n\n/**\n * If the dashboard has a display name, return the dashboard display name and the dashboard name\n * Else, only return the dashboard name\n * @param dashboard\n */\nexport function getDashboardExtendedDisplayName(dashboard: DashboardResource) {\n if (dashboard.spec.display?.name) {\n return `${dashboard.spec.display.name} (Name: ${dashboard.metadata.name})`;\n }\n return dashboard.metadata.name;\n}\n\n/**\n * If the variable has a display name, return the variable display name and the variable name\n * Else, only return the variable name\n * @param variable Project or Global variable\n */\nexport function getVariableExtendedDisplayName(variable: VariableResource) {\n if (variable.spec.spec.display?.name) {\n return `${variable.spec.spec.display.name} (Name: ${variable.metadata.name})`;\n }\n return variable.metadata.name;\n}\n"],"names":["getDashboardDisplayName","dashboard","spec","display","name","metadata","getVariableDisplayName","variable","getDashboardExtendedDisplayName","getVariableExtendedDisplayName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;;CAIC,GACD,OAAO,SAASA,uBAAuB,CAACC,SAA4B,EAAE;QAC7DA,GAAsB;QAAtBA,IAA4B;IAAnC,OAAOA,CAAAA,IAA4B,GAA5BA,CAAAA,GAAsB,GAAtBA,SAAS,CAACC,IAAI,CAACC,OAAO,cAAtBF,GAAsB,WAAM,GAA5BA,KAAAA,CAA4B,GAA5BA,GAAsB,CAAEG,IAAI,cAA5BH,IAA4B,cAA5BA,IAA4B,GAAIA,SAAS,CAACI,QAAQ,CAACD,IAAI,CAAC;AACjE,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASE,sBAAsB,CAACC,QAA0B,EAAE;QAC1DA,GAA0B;QAA1BA,IAAgC;IAAvC,OAAOA,CAAAA,IAAgC,GAAhCA,CAAAA,GAA0B,GAA1BA,QAAQ,CAACL,IAAI,CAACA,IAAI,CAACC,OAAO,cAA1BI,GAA0B,WAAM,GAAhCA,KAAAA,CAAgC,GAAhCA,GAA0B,CAAEH,IAAI,cAAhCG,IAAgC,cAAhCA,IAAgC,GAAIA,QAAQ,CAACF,QAAQ,CAACD,IAAI,CAAC;AACpE,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASI,+BAA+B,CAACP,SAA4B,EAAE;QACxEA,GAAsB;IAA1B,IAAIA,CAAAA,GAAsB,GAAtBA,SAAS,CAACC,IAAI,CAACC,OAAO,cAAtBF,GAAsB,WAAM,GAA5BA,KAAAA,CAA4B,GAA5BA,GAAsB,CAAEG,IAAI,EAAE;QAChC,OAAO,CAAC,EAAEH,SAAS,CAACC,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,QAAQ,EAAEH,SAAS,CAACI,QAAQ,CAACD,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAOH,SAAS,CAACI,QAAQ,CAACD,IAAI,CAAC;AACjC,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASK,8BAA8B,CAACF,QAA0B,EAAE;QACrEA,GAA0B;IAA9B,IAAIA,CAAAA,GAA0B,GAA1BA,QAAQ,CAACL,IAAI,CAACA,IAAI,CAACC,OAAO,cAA1BI,GAA0B,WAAM,GAAhCA,KAAAA,CAAgC,GAAhCA,GAA0B,CAAEH,IAAI,EAAE;QACpC,OAAO,CAAC,EAAEG,QAAQ,CAACL,IAAI,CAACA,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,QAAQ,EAAEG,QAAQ,CAACF,QAAQ,CAACD,IAAI,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;IACD,OAAOG,QAAQ,CAACF,QAAQ,CAACD,IAAI,CAAC;AAChC,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/text.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 { DashboardResource, Variable, Datasource } from '../model';\n\n/**\n * If the dashboard has a display name, return the dashboard display name\n * Else, only return the dashboard name\n * @param dashboard\n */\nexport function getDashboardDisplayName(dashboard: DashboardResource) {\n return dashboard.spec.display?.name ?? dashboard.metadata.name;\n}\n\n/**\n * If the variable has a display name, return the variable display name\n * Else, only return the variable name\n * @param variable Project or Global variable\n */\nexport function getVariableDisplayName(variable: Variable) {\n return variable.spec.spec.display?.name ?? variable.metadata.name;\n}\n\n/**\n * If the variable has a display name, return the datasource display name\n * Else, only return the datasource name\n * @param datasource Project or Global datasource\n */\nexport function getDatasourceDisplayName(datasource: Datasource) {\n return datasource.spec.display?.name || datasource.metadata.name;\n}\n\n/**\n * If the dashboard has a display name, return the dashboard display name and the dashboard name\n * Else, only return the dashboard name\n * @param dashboard\n */\nexport function getDashboardExtendedDisplayName(dashboard: DashboardResource) {\n if (dashboard.spec.display?.name) {\n return `${dashboard.spec.display.name} (Name: ${dashboard.metadata.name})`;\n }\n return dashboard.metadata.name;\n}\n\n/**\n * If the variable has a display name, return the variable display name and the variable name\n * Else, only return the variable name\n * @param variable Project or Global variable\n */\nexport function getVariableExtendedDisplayName(variable: Variable) {\n if (variable.spec.spec.display?.name) {\n return `${variable.spec.spec.display.name} (Name: ${variable.metadata.name})`;\n }\n return variable.metadata.name;\n}\n\n/**\n * If the datasource has a display name, return the datasource display name and the datasource name\n * Else, only return the datasource name\n * @param datasource Project or Global datasource\n */\nexport function getDatasourceExtendedDisplayName(datasource: Datasource) {\n if (datasource.spec.display?.name) {\n return `${datasource.spec.display.name} (Name: ${datasource.metadata.name})`;\n }\n return datasource.metadata.name;\n}\n"],"names":["getDashboardDisplayName","dashboard","spec","display","name","metadata","getVariableDisplayName","variable","getDatasourceDisplayName","datasource","getDashboardExtendedDisplayName","getVariableExtendedDisplayName","getDatasourceExtendedDisplayName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;;CAIC,GACD,OAAO,SAASA,wBAAwBC,SAA4B;QAC3DA;QAAAA;IAAP,OAAOA,CAAAA,+BAAAA,CAAAA,0BAAAA,UAAUC,KAAKC,qBAAfF,qCAAAA,KAAAA,IAAAA,wBAAwBG,kBAAxBH,0CAAAA,+BAAgCA,UAAUI,SAASD;AAC5D;AAEA;;;;CAIC,GACD,OAAO,SAASE,uBAAuBC,QAAkB;QAChDA;QAAAA;IAAP,OAAOA,CAAAA,mCAAAA,CAAAA,8BAAAA,SAASL,KAAKA,KAAKC,qBAAnBI,yCAAAA,KAAAA,IAAAA,4BAA4BH,kBAA5BG,8CAAAA,mCAAoCA,SAASF,SAASD;AAC/D;AAEA;;;;CAIC,GACD,OAAO,SAASI,yBAAyBC,UAAsB;QACtDA;IAAP,OAAOA,CAAAA,CAAAA,2BAAAA,WAAWP,KAAKC,qBAAhBM,sCAAAA,KAAAA,IAAAA,yBAAyBL,IAAG,KAAKK,WAAWJ,SAASD;AAC9D;AAEA;;;;CAIC,GACD,OAAO,SAASM,gCAAgCT,SAA4B;QACtEA;IAAJ,IAAIA,CAAAA,0BAAAA,UAAUC,KAAKC,qBAAfF,qCAAAA,KAAAA,IAAAA,wBAAwBG,MAAM;QAChC,OAAO,CAAC,EAAEH,UAAUC,KAAKC,QAAQC,KAAK,QAAQ,EAAEH,UAAUI,SAASD,KAAK,CAAC,CAAC;IAC5E;IACA,OAAOH,UAAUI,SAASD;AAC5B;AAEA;;;;CAIC,GACD,OAAO,SAASO,+BAA+BJ,QAAkB;QAC3DA;IAAJ,IAAIA,CAAAA,8BAAAA,SAASL,KAAKA,KAAKC,qBAAnBI,yCAAAA,KAAAA,IAAAA,4BAA4BH,MAAM;QACpC,OAAO,CAAC,EAAEG,SAASL,KAAKA,KAAKC,QAAQC,KAAK,QAAQ,EAAEG,SAASF,SAASD,KAAK,CAAC,CAAC;IAC/E;IACA,OAAOG,SAASF,SAASD;AAC3B;AAEA;;;;CAIC,GACD,OAAO,SAASQ,iCAAiCH,UAAsB;QACjEA;IAAJ,IAAIA,CAAAA,2BAAAA,WAAWP,KAAKC,qBAAhBM,sCAAAA,KAAAA,IAAAA,yBAAyBL,MAAM;QACjC,OAAO,CAAC,EAAEK,WAAWP,KAAKC,QAAQC,KAAK,QAAQ,EAAEK,WAAWJ,SAASD,KAAK,CAAC,CAAC;IAC9E;IACA,OAAOK,WAAWJ,SAASD;AAC7B"}
@@ -6,13 +6,13 @@ export declare const MIN_STEP_INTERVAL_MS = 10;
6
6
  */
7
7
  export declare function getXValues(timeScale: TimeScale): number[];
8
8
  /**
9
- * [DEPRECATED] Used for legacy LineChart 'category' axis approach.
10
9
  * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),
11
10
  * processes the time series values, filling in any timestamps that are missing
12
11
  * from the time series data with `null` values.
13
12
  */
14
13
  export declare function getTimeSeriesValues(series: TimeSeries, timeScale: TimeScale): TimeSeriesValueTuple[];
15
14
  /**
15
+ * [DEPRECATED] Used for legacy LineChart 'category' axis approach.
16
16
  * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),
17
17
  * gets the values for the y axis of a graph, filling in any timestamps that are
18
18
  * missing from the time series data with `null` values.
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-data.d.ts","sourceRoot":"","sources":["../../src/utils/time-series-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAqB,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,oBAAoB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@@ -25,7 +25,6 @@ export const MIN_STEP_INTERVAL_MS = 10;
25
25
  return xValues;
26
26
  }
27
27
  /**
28
- * [DEPRECATED] Used for legacy LineChart 'category' axis approach.
29
28
  * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),
30
29
  * processes the time series values, filling in any timestamps that are missing
31
30
  * from the time series data with `null` values.
@@ -60,6 +59,7 @@ export const MIN_STEP_INTERVAL_MS = 10;
60
59
  return processedValues;
61
60
  }
62
61
  /**
62
+ * [DEPRECATED] Used for legacy LineChart 'category' axis approach.
63
63
  * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),
64
64
  * gets the values for the y axis of a graph, filling in any timestamps that are
65
65
  * missing from the time series data with `null` values.
@@ -153,14 +153,14 @@ export const MIN_STEP_INTERVAL_MS = 10;
153
153
  const calculatedStepMs = gcd(...steps);
154
154
  stepMs = calculatedStepMs < MIN_STEP_INTERVAL_MS ? MIN_STEP_INTERVAL_MS : calculatedStepMs;
155
155
  }
156
- const startMs1 = timeRange.start.valueOf();
157
- const endMs1 = timeRange.end.valueOf();
158
- const rangeMs1 = endMs1 - startMs1;
156
+ const startMs = timeRange.start.valueOf();
157
+ const endMs = timeRange.end.valueOf();
158
+ const rangeMs = endMs - startMs;
159
159
  return {
160
- startMs: startMs1,
161
- endMs: endMs1,
160
+ startMs,
161
+ endMs,
162
162
  stepMs,
163
- rangeMs: rangeMs1
163
+ rangeMs
164
164
  };
165
165
  }
166
166
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/time-series-data.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 { AbsoluteTimeRange, TimeScale, TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '../model';\nimport { gcd } from './mathjs';\n\nexport const MIN_STEP_INTERVAL_MS = 10;\n\n/**\n * Given a common time scale (see `getCommonTimeScale`), generates an array of\n * timestamp values in ms for the x axis of a graph.\n */\nexport function getXValues(timeScale: TimeScale): number[] {\n const xValues: number[] = [];\n let timestamp = timeScale.startMs;\n while (timestamp <= timeScale.endMs) {\n xValues.push(timestamp);\n timestamp += timeScale.stepMs;\n }\n return xValues;\n}\n\n/**\n * [DEPRECATED] Used for legacy LineChart 'category' axis approach.\n * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),\n * processes the time series values, filling in any timestamps that are missing\n * from the time series data with `null` values.\n */\nexport function getTimeSeriesValues(series: TimeSeries, timeScale: TimeScale) {\n let timestamp = timeScale.startMs;\n\n const values = series.values;\n const processedValues: TimeSeriesValueTuple[] = [];\n\n for (const valueTuple of values) {\n // Fill in values up to the current series value timestamp with nulls\n while (timestamp < valueTuple[0]) {\n processedValues.push([timestamp, null]);\n timestamp += timeScale.stepMs;\n }\n\n // Now add the current value since timestamp should match\n processedValues.push([timestamp, valueTuple[1]]);\n timestamp += timeScale.stepMs;\n }\n\n // Add null values at the end of the series if necessary\n while (timestamp <= timeScale.endMs) {\n processedValues.push([timestamp, null]);\n timestamp += timeScale.stepMs;\n }\n\n return processedValues;\n}\n\n/**\n * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),\n * gets the values for the y axis of a graph, filling in any timestamps that are\n * missing from the time series data with `null` values.\n */\nexport function getYValues(series: TimeSeries, timeScale: TimeScale): Array<number | null> {\n let timestamp = timeScale.startMs;\n\n const yValues: Array<number | null> = [];\n for (const valueTuple of series.values) {\n // Fill in values up to the current series value timestamp with nulls\n while (timestamp < valueTuple[0]) {\n yValues.push(null);\n timestamp += timeScale.stepMs;\n }\n\n // Now add the current value since timestamp should match\n yValues.push(valueTuple[1]);\n timestamp += timeScale.stepMs;\n }\n\n // Add null values at the end of the series if necessary\n while (timestamp <= timeScale.endMs) {\n yValues.push(null);\n timestamp += timeScale.stepMs;\n }\n\n return yValues;\n}\n\n/**\n * Given a list of running queries, calculates a common time scale for use on\n * the x axis (i.e. start/end dates and a step that is divisible into all of\n * the queries' steps).\n */\nexport function getCommonTimeScale(\n seriesData: Array<TimeSeriesData | Pick<TimeSeries, 'values'> | undefined>\n): TimeScale | undefined {\n let timeRange: AbsoluteTimeRange | undefined = undefined;\n const steps: number[] = [];\n\n for (const data of seriesData) {\n if (data && 'timeRange' in data) {\n if (data === undefined || data.timeRange === undefined || data.stepMs === undefined) continue;\n\n // Keep track of query steps so we can calculate a common one for the graph\n steps.push(data.stepMs);\n\n // If we don't have an overall time range yet, just start with this one\n if (timeRange === undefined) {\n timeRange = data.timeRange;\n continue;\n }\n\n // Otherwise, see if this query has a start or end outside of the current\n // time range\n if (data.timeRange.start < timeRange.start) {\n timeRange.start = data.timeRange.start;\n }\n if (data.timeRange.end > timeRange.end) {\n timeRange.end = data.timeRange.end;\n }\n } else if (data && 'values' in data) {\n for (let i = 0; i < data.values.length; i++) {\n const values = data.values[i];\n if (values === undefined) {\n continue;\n }\n\n const [timestamp] = values;\n const start = new Date(timestamp);\n const end = new Date(timestamp);\n\n if (timeRange === undefined) {\n timeRange = {\n start,\n end,\n };\n continue;\n }\n\n if (start < timeRange.start) {\n timeRange.start = start;\n }\n\n if (end > timeRange.end) {\n timeRange.end = end;\n }\n }\n\n if (timeRange === undefined) return undefined;\n\n const startMs = timeRange.start.valueOf();\n const endMs = timeRange.end.valueOf();\n const rangeMs = endMs - startMs;\n\n return { startMs, endMs, rangeMs, stepMs: MIN_STEP_INTERVAL_MS };\n }\n }\n\n if (timeRange === undefined) return undefined;\n\n // Use the greatest common divisor of all step values as the overall step\n // for the x axis (or if only one query, just use that query's step value)\n let stepMs: number;\n if (steps.length === 1) {\n stepMs = steps[0] as number;\n } else {\n const calculatedStepMs = gcd(...steps);\n stepMs = calculatedStepMs < MIN_STEP_INTERVAL_MS ? MIN_STEP_INTERVAL_MS : calculatedStepMs;\n }\n\n const startMs = timeRange.start.valueOf();\n const endMs = timeRange.end.valueOf();\n const rangeMs = endMs - startMs;\n\n return { startMs, endMs, stepMs, rangeMs };\n}\n"],"names":["gcd","MIN_STEP_INTERVAL_MS","getXValues","timeScale","xValues","timestamp","startMs","endMs","push","stepMs","getTimeSeriesValues","series","values","processedValues","valueTuple","getYValues","yValues","getCommonTimeScale","seriesData","timeRange","undefined","steps","data","start","end","i","length","Date","valueOf","rangeMs","calculatedStepMs"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,GAAG,QAAQ,UAAU,CAAC;AAE/B,OAAO,MAAMC,oBAAoB,GAAG,EAAE,CAAC;AAEvC;;;CAGC,GACD,OAAO,SAASC,UAAU,CAACC,SAAoB,EAAY;IACzD,MAAMC,OAAO,GAAa,EAAE,AAAC;IAC7B,IAAIC,SAAS,GAAGF,SAAS,CAACG,OAAO,AAAC;IAClC,MAAOD,SAAS,IAAIF,SAAS,CAACI,KAAK,CAAE;QACnCH,OAAO,CAACI,IAAI,CAACH,SAAS,CAAC,CAAC;QACxBA,SAAS,IAAIF,SAAS,CAACM,MAAM,CAAC;IAChC,CAAC;IACD,OAAOL,OAAO,CAAC;AACjB,CAAC;AAED;;;;;CAKC,GACD,OAAO,SAASM,mBAAmB,CAACC,MAAkB,EAAER,SAAoB,EAAE;IAC5E,IAAIE,SAAS,GAAGF,SAAS,CAACG,OAAO,AAAC;IAElC,MAAMM,MAAM,GAAGD,MAAM,CAACC,MAAM,AAAC;IAC7B,MAAMC,eAAe,GAA2B,EAAE,AAAC;IAEnD,KAAK,MAAMC,UAAU,IAAIF,MAAM,CAAE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O;QACL,MAAMS,gBAAgB,GAAG9B,GAAG,IAAIqB,KAAK,CAAC,AAAC;QACvCZ,MAAM,GAAGqB,gBAAgB,GAAG7B,oBAAoB,GAAGA,oBAAoB,GAAG6B,gBAAgB,CAAC;IAC7F,CAAC;IAED,MAAMxB,QAAO,GAAGa,SAAS,CAACI,KAAK,CAACK,OAAO,EAAE,AAAC;IAC1C,MAAMrB,MAAK,GAAGY,SAAS,CAACK,GAAG,CAACI,OAAO,EAAE,AAAC;IACtC,MAAMC,QAAO,GAAGtB,MAAK,GAAGD,QAAO,AAAC;IAEhC,OAAO;QAAEA,OAAO,EAAPA,QAAO;QAAEC,KAAK,EAALA,MAAK;QAAEE,MAAM;QAAEoB,OAAO,EAAPA,QAAO;KAAE,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"sources":["../../src/utils/time-series-data.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 { AbsoluteTimeRange, TimeScale, TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '../model';\nimport { gcd } from './mathjs';\n\nexport const MIN_STEP_INTERVAL_MS = 10;\n\n/**\n * Given a common time scale (see `getCommonTimeScale`), generates an array of\n * timestamp values in ms for the x axis of a graph.\n */\nexport function getXValues(timeScale: TimeScale): number[] {\n const xValues: number[] = [];\n let timestamp = timeScale.startMs;\n while (timestamp <= timeScale.endMs) {\n xValues.push(timestamp);\n timestamp += timeScale.stepMs;\n }\n return xValues;\n}\n\n/**\n * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),\n * processes the time series values, filling in any timestamps that are missing\n * from the time series data with `null` values.\n */\nexport function getTimeSeriesValues(series: TimeSeries, timeScale: TimeScale) {\n let timestamp = timeScale.startMs;\n\n const values = series.values;\n const processedValues: TimeSeriesValueTuple[] = [];\n\n for (const valueTuple of values) {\n // Fill in values up to the current series value timestamp with nulls\n while (timestamp < valueTuple[0]) {\n processedValues.push([timestamp, null]);\n timestamp += timeScale.stepMs;\n }\n\n // Now add the current value since timestamp should match\n processedValues.push([timestamp, valueTuple[1]]);\n timestamp += timeScale.stepMs;\n }\n\n // Add null values at the end of the series if necessary\n while (timestamp <= timeScale.endMs) {\n processedValues.push([timestamp, null]);\n timestamp += timeScale.stepMs;\n }\n\n return processedValues;\n}\n\n/**\n * [DEPRECATED] Used for legacy LineChart 'category' axis approach.\n * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),\n * gets the values for the y axis of a graph, filling in any timestamps that are\n * missing from the time series data with `null` values.\n */\nexport function getYValues(series: TimeSeries, timeScale: TimeScale): Array<number | null> {\n let timestamp = timeScale.startMs;\n\n const yValues: Array<number | null> = [];\n for (const valueTuple of series.values) {\n // Fill in values up to the current series value timestamp with nulls\n while (timestamp < valueTuple[0]) {\n yValues.push(null);\n timestamp += timeScale.stepMs;\n }\n\n // Now add the current value since timestamp should match\n yValues.push(valueTuple[1]);\n timestamp += timeScale.stepMs;\n }\n\n // Add null values at the end of the series if necessary\n while (timestamp <= timeScale.endMs) {\n yValues.push(null);\n timestamp += timeScale.stepMs;\n }\n\n return yValues;\n}\n\n/**\n * Given a list of running queries, calculates a common time scale for use on\n * the x axis (i.e. start/end dates and a step that is divisible into all of\n * the queries' steps).\n */\nexport function getCommonTimeScale(\n seriesData: Array<TimeSeriesData | Pick<TimeSeries, 'values'> | undefined>\n): TimeScale | undefined {\n let timeRange: AbsoluteTimeRange | undefined = undefined;\n const steps: number[] = [];\n\n for (const data of seriesData) {\n if (data && 'timeRange' in data) {\n if (data === undefined || data.timeRange === undefined || data.stepMs === undefined) continue;\n\n // Keep track of query steps so we can calculate a common one for the graph\n steps.push(data.stepMs);\n\n // If we don't have an overall time range yet, just start with this one\n if (timeRange === undefined) {\n timeRange = data.timeRange;\n continue;\n }\n\n // Otherwise, see if this query has a start or end outside of the current\n // time range\n if (data.timeRange.start < timeRange.start) {\n timeRange.start = data.timeRange.start;\n }\n if (data.timeRange.end > timeRange.end) {\n timeRange.end = data.timeRange.end;\n }\n } else if (data && 'values' in data) {\n for (let i = 0; i < data.values.length; i++) {\n const values = data.values[i];\n if (values === undefined) {\n continue;\n }\n\n const [timestamp] = values;\n const start = new Date(timestamp);\n const end = new Date(timestamp);\n\n if (timeRange === undefined) {\n timeRange = {\n start,\n end,\n };\n continue;\n }\n\n if (start < timeRange.start) {\n timeRange.start = start;\n }\n\n if (end > timeRange.end) {\n timeRange.end = end;\n }\n }\n\n if (timeRange === undefined) return undefined;\n\n const startMs = timeRange.start.valueOf();\n const endMs = timeRange.end.valueOf();\n const rangeMs = endMs - startMs;\n\n return { startMs, endMs, rangeMs, stepMs: MIN_STEP_INTERVAL_MS };\n }\n }\n\n if (timeRange === undefined) return undefined;\n\n // Use the greatest common divisor of all step values as the overall step\n // for the x axis (or if only one query, just use that query's step value)\n let stepMs: number;\n if (steps.length === 1) {\n stepMs = steps[0] as number;\n } else {\n const calculatedStepMs = gcd(...steps);\n stepMs = calculatedStepMs < MIN_STEP_INTERVAL_MS ? MIN_STEP_INTERVAL_MS : calculatedStepMs;\n }\n\n const startMs = timeRange.start.valueOf();\n const endMs = timeRange.end.valueOf();\n const rangeMs = endMs - startMs;\n\n return { startMs, endMs, stepMs, rangeMs };\n}\n"],"names":["gcd","MIN_STEP_INTERVAL_MS","getXValues","timeScale","xValues","timestamp","startMs","endMs","push","stepMs","getTimeSeriesValues","series","values","processedValues","valueTuple","getYValues","yValues","getCommonTimeScale","seriesData","timeRange","undefined","steps","data","start","end","i","length","Date","valueOf","rangeMs","calculatedStepMs"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0C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AAMA;gBAClB;YACF;YAEA,IAAIL,cAAcC,WAAW,OAAOA;YAEpC,MAAMd,UAAUa,UAAUI,MAAMK;YAChC,MAAMrB,QAAQY,UAAUK,IAAII;YAC5B,MAAMC,UAAUtB,QAAQD;YAExB,OAAO;gBAAEA;gBAASC;gBAAOsB;gBAASpB,QAAQR;YAAqB;QACjE;IACF;IAEA,IAAIkB,cAAcC,WAAW,OAAOA;IAEpC,yEAAyE;IACzE,0EAA0E;IAC1E,IAAIX;IACJ,IAAIY,MAAMK,WAAW,GAAG;QACtBjB,SAASY,KAAK,CAAC,EAAE;IACnB,OAAO;QACL,MAAMS,mBAAmB9B,OAAOqB;QAChCZ,SAASqB,mBAAmB7B,uBAAuBA,uBAAuB6B;IAC5E;IAEA,MAAMxB,UAAUa,UAAUI,MAAMK;IAChC,MAAMrB,QAAQY,UAAUK,IAAII;IAC5B,MAAMC,UAAUtB,QAAQD;IAExB,OAAO;QAAEA;QAASC;QAAOE;QAAQoB;IAAQ;AAC3C"}
@@ -0,0 +1,2 @@
1
+ export declare type DispatchWithPromise<A> = (value: A) => Promise<void>;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAaA,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,15 @@
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
+ export { };
14
+
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/types.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 type DispatchWithPromise<A> = (value: A) => Promise<void>;\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,WAAiE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/core",
3
- "version": "0.0.0-snapshot-panel-extra-content-2-2767e21",
3
+ "version": "0.0.0-snapshot-scatter-chart-embed-8efdfab",
4
4
  "description": "Core functionality consumed by both the Perses UI and plugins",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -23,8 +23,8 @@
23
23
  "build:types": "tsc --project tsconfig.build.json",
24
24
  "type-check": "tsc --noEmit",
25
25
  "start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
26
- "test": "TZ=UTC jest",
27
- "test:watch": "TZ=UTC jest --watch",
26
+ "test": "cross-env TZ=UTC jest",
27
+ "test:watch": "cross-env TZ=UTC jest --watch",
28
28
  "lint": "eslint src --ext .ts,.tsx",
29
29
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
30
30
  },
@@ -32,7 +32,8 @@
32
32
  "date-fns": "^2.28.0",
33
33
  "lodash": "^4.17.21",
34
34
  "mathjs": "^10.6.4",
35
- "numbro": "^2.3.6"
35
+ "numbro": "^2.3.6",
36
+ "zod": "^3.21.4"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "react": "^17.0.2 || ^18.0.0",