@trilogy-data/trilogy-studio-components 0.1.12 → 0.1.14

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 (294) hide show
  1. package/dist/{ChatCreatorModal-kIXgcJQp.js → ChatCreatorModal-D-CByWEF.js} +12 -12
  2. package/dist/{Dashboard-B-YfrO5u.js → Dashboard-CCWjUVBq.js} +347 -348
  3. package/dist/{DashboardCreatorInline-C6fr4jNo.js → DashboardCreatorInline-DRlxDEBN.js} +1 -1
  4. package/dist/{DashboardMobile-D911XYkl.js → DashboardMobile-GOPaxc9_.js} +104 -103
  5. package/dist/{LLMConnectionList-DZbu1kGq.js → LLMConnectionList-ByLjIXLO.js} +1168 -1213
  6. package/dist/{LLMView-C4RQS1B8.js → LLMView-B7XLbzBx.js} +53 -51
  7. package/dist/Manager-B2wTf-lw.js +4 -0
  8. package/dist/{ResultComponent-fVgARLAb.js → ResultComponent-BKuWOt_p.js} +37 -34
  9. package/dist/Sidebar-CMy9ptnW.js +2188 -0
  10. package/dist/TutorialPage-9YzXa97t.js +509 -0
  11. package/dist/{WelcomePage-LRJvygaE.js → WelcomePage-BMcBpSQ7.js} +4 -4
  12. package/dist/components/AssetAutoImporter.vue.d.ts.map +1 -1
  13. package/dist/components/ChartControlPanel.vue.d.ts.map +1 -1
  14. package/dist/components/CodeBlock.vue.d.ts.map +1 -1
  15. package/dist/components/ConfirmDialog.vue.d.ts +25 -0
  16. package/dist/components/ConfirmDialog.vue.d.ts.map +1 -0
  17. package/dist/components/ContextMenu.vue.d.ts +4 -2
  18. package/dist/components/ContextMenu.vue.d.ts.map +1 -1
  19. package/dist/components/DataTable.vue.d.ts +9 -0
  20. package/dist/components/DataTable.vue.d.ts.map +1 -1
  21. package/dist/components/EditableTitle.vue.d.ts.map +1 -1
  22. package/dist/components/HintComponent.vue.d.ts +1 -1
  23. package/dist/components/HintComponent.vue.d.ts.map +1 -1
  24. package/dist/components/LoadingButton.vue.d.ts.map +1 -1
  25. package/dist/components/MarkdownRenderer.vue.d.ts +1 -0
  26. package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -1
  27. package/dist/components/ModalDialog.vue.d.ts +36 -0
  28. package/dist/components/ModalDialog.vue.d.ts.map +1 -0
  29. package/dist/components/PopupModal.vue.d.ts.map +1 -1
  30. package/dist/components/SimpleEditor.vue.d.ts +117 -0
  31. package/dist/components/SimpleEditor.vue.d.ts.map +1 -1
  32. package/dist/components/StatusIcon.vue.d.ts +3 -3
  33. package/dist/components/StatusIcon.vue.d.ts.map +1 -1
  34. package/dist/components/StoreTokenModal.vue.d.ts +18 -0
  35. package/dist/components/StoreTokenModal.vue.d.ts.map +1 -0
  36. package/dist/components/SymbolsPane.vue.d.ts.map +1 -1
  37. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  38. package/dist/components/chartRenderManager.d.ts +2 -0
  39. package/dist/components/chartRenderManager.d.ts.map +1 -1
  40. package/dist/components/community/AddStoreModal.vue.d.ts +46 -1
  41. package/dist/components/community/AddStoreModal.vue.d.ts.map +1 -1
  42. package/dist/components/community/CommunityModelCard.vue.d.ts +3 -3
  43. package/dist/components/community/CommunityModelCard.vue.d.ts.map +1 -1
  44. package/dist/components/community/CommunityModelHeader.vue.d.ts +7 -4
  45. package/dist/components/community/CommunityModelHeader.vue.d.ts.map +1 -1
  46. package/dist/components/community/CommunityModels.vue.d.ts +4 -4
  47. package/dist/components/community/CommunityModels.vue.d.ts.map +1 -1
  48. package/dist/components/community/CommunityRemote.vue.d.ts.map +1 -1
  49. package/dist/components/connection/ConnectionDatabase.vue.d.ts.map +1 -1
  50. package/dist/components/connection/ConnectionSchema.vue.d.ts.map +1 -1
  51. package/dist/components/connection/ConnectionTable.vue.d.ts +9 -0
  52. package/dist/components/connection/ConnectionTable.vue.d.ts.map +1 -1
  53. package/dist/components/dashboard/Dashboard.vue.d.ts +4 -4
  54. package/dist/components/dashboard/Dashboard.vue.d.ts.map +1 -1
  55. package/dist/components/dashboard/DashboardAddItemModal.vue.d.ts +4 -4
  56. package/dist/components/dashboard/DashboardAddItemModal.vue.d.ts.map +1 -1
  57. package/dist/components/dashboard/DashboardCTA.vue.d.ts +4 -4
  58. package/dist/components/dashboard/DashboardCTA.vue.d.ts.map +1 -1
  59. package/dist/components/dashboard/DashboardChart.vue.d.ts +1 -1
  60. package/dist/components/dashboard/DashboardChart.vue.d.ts.map +1 -1
  61. package/dist/components/dashboard/DashboardChartEditor.vue.d.ts +234 -2
  62. package/dist/components/dashboard/DashboardChartEditor.vue.d.ts.map +1 -1
  63. package/dist/components/dashboard/DashboardDataSelector.vue.d.ts.map +1 -1
  64. package/dist/components/dashboard/DashboardEditorDialog.vue.d.ts +42 -0
  65. package/dist/components/dashboard/DashboardEditorDialog.vue.d.ts.map +1 -0
  66. package/dist/components/dashboard/DashboardFilter.vue.d.ts +0 -1
  67. package/dist/components/dashboard/DashboardFilter.vue.d.ts.map +1 -1
  68. package/dist/components/dashboard/DashboardFilterAutocomplete.vue.d.ts.map +1 -1
  69. package/dist/components/dashboard/DashboardGridItem.vue.d.ts +4 -4
  70. package/dist/components/dashboard/DashboardGridItem.vue.d.ts.map +1 -1
  71. package/dist/components/dashboard/DashboardHeader.vue.d.ts.map +1 -1
  72. package/dist/components/dashboard/DashboardHeaderFilterInput.vue.d.ts +1 -0
  73. package/dist/components/dashboard/DashboardHeaderFilterInput.vue.d.ts.map +1 -1
  74. package/dist/components/dashboard/DashboardImportPopup.vue.d.ts +5 -7
  75. package/dist/components/dashboard/DashboardImportPopup.vue.d.ts.map +1 -1
  76. package/dist/components/dashboard/DashboardImportSelector.vue.d.ts +4 -1
  77. package/dist/components/dashboard/DashboardImportSelector.vue.d.ts.map +1 -1
  78. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts +1 -20
  79. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts.map +1 -1
  80. package/dist/components/dashboard/DashboardMarkdownEditor.vue.d.ts +234 -1
  81. package/dist/components/dashboard/DashboardMarkdownEditor.vue.d.ts.map +1 -1
  82. package/dist/components/dashboard/DashboardMobile.vue.d.ts +3 -3
  83. package/dist/components/dashboard/DashboardMobile.vue.d.ts.map +1 -1
  84. package/dist/components/dashboard/DashboardSharePopup.vue.d.ts +5 -7
  85. package/dist/components/dashboard/DashboardSharePopup.vue.d.ts.map +1 -1
  86. package/dist/components/dashboard/DashboardTable.vue.d.ts +9 -1
  87. package/dist/components/dashboard/DashboardTable.vue.d.ts.map +1 -1
  88. package/dist/components/dashboard/useDashboard.d.ts.map +1 -1
  89. package/dist/components/dashboard/useDashboardItemShell.d.ts +28 -0
  90. package/dist/components/dashboard/useDashboardItemShell.d.ts.map +1 -0
  91. package/dist/components/editor/Editor.vue.d.ts +20 -6
  92. package/dist/components/editor/Editor.vue.d.ts.map +1 -1
  93. package/dist/components/editor/EditorCreatorInline.vue.d.ts.map +1 -1
  94. package/dist/components/editor/EditorHeader.vue.d.ts +10 -3
  95. package/dist/components/editor/EditorHeader.vue.d.ts.map +1 -1
  96. package/dist/components/editor/ResultComponent.vue.d.ts +75 -181
  97. package/dist/components/editor/ResultComponent.vue.d.ts.map +1 -1
  98. package/dist/components/editor/Results.vue.d.ts +9 -0
  99. package/dist/components/editor/Results.vue.d.ts.map +1 -1
  100. package/dist/components/editor/editorHelpers.d.ts +1 -1
  101. package/dist/components/editor/editorHelpers.d.ts.map +1 -1
  102. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts +14 -0
  103. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts.map +1 -0
  104. package/dist/components/jobs/JobsView.vue.d.ts +6 -0
  105. package/dist/components/jobs/JobsView.vue.d.ts.map +1 -0
  106. package/dist/components/layout/MobileSidebarLayout.vue.d.ts.map +1 -1
  107. package/dist/components/layout/SidebarLayout.vue.d.ts.map +1 -1
  108. package/dist/components/layout/TabbedBrowser.vue.d.ts +1 -12
  109. package/dist/components/layout/TabbedBrowser.vue.d.ts.map +1 -1
  110. package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -1
  111. package/dist/components/llm/ArtifactsPane.vue.d.ts +11 -2
  112. package/dist/components/llm/ArtifactsPane.vue.d.ts.map +1 -1
  113. package/dist/components/llm/ChatArtifact.vue.d.ts +10 -0
  114. package/dist/components/llm/ChatArtifact.vue.d.ts.map +1 -1
  115. package/dist/components/llm/ChatCreatorModal.vue.d.ts +1 -9
  116. package/dist/components/llm/ChatCreatorModal.vue.d.ts.map +1 -1
  117. package/dist/components/llm/LLMChat.vue.d.ts +9 -36
  118. package/dist/components/llm/LLMChat.vue.d.ts.map +1 -1
  119. package/dist/components/llm/LLMChatSplitView.vue.d.ts +55 -185
  120. package/dist/components/llm/LLMChatSplitView.vue.d.ts.map +1 -1
  121. package/dist/components/llm/LLMEditorRefinement.vue.d.ts +47 -180
  122. package/dist/components/llm/LLMEditorRefinement.vue.d.ts.map +1 -1
  123. package/dist/components/llm/toolCallDisplay.d.ts +13 -0
  124. package/dist/components/llm/toolCallDisplay.d.ts.map +1 -0
  125. package/dist/components/model/ModelCard.vue.d.ts +22 -5
  126. package/dist/components/model/ModelCard.vue.d.ts.map +1 -1
  127. package/dist/components/model/ModelConcept.vue.d.ts.map +1 -1
  128. package/dist/components/model/ModelCreator.vue.d.ts +3 -0
  129. package/dist/components/model/ModelCreator.vue.d.ts.map +1 -1
  130. package/dist/components/model/ModelSelector.vue.d.ts.map +1 -1
  131. package/dist/components/sidebar/CommunityModelList.vue.d.ts +284 -0
  132. package/dist/components/sidebar/CommunityModelList.vue.d.ts.map +1 -0
  133. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts +7 -7
  134. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts.map +1 -1
  135. package/dist/components/sidebar/ConnectionCreatorInline.vue.d.ts.map +1 -1
  136. package/dist/components/sidebar/ConnectionIcon.vue.d.ts.map +1 -1
  137. package/dist/components/sidebar/ConnectionList.vue.d.ts +21 -71
  138. package/dist/components/sidebar/ConnectionList.vue.d.ts.map +1 -1
  139. package/dist/components/sidebar/ConnectionListItem.vue.d.ts +15 -61
  140. package/dist/components/sidebar/ConnectionListItem.vue.d.ts.map +1 -1
  141. package/dist/components/sidebar/ConnectionRefresh.vue.d.ts.map +1 -1
  142. package/dist/components/sidebar/CreateEditorFromDatasourcePopup.vue.d.ts.map +1 -1
  143. package/dist/components/sidebar/DashboardList.vue.d.ts +33 -75
  144. package/dist/components/sidebar/DashboardList.vue.d.ts.map +1 -1
  145. package/dist/components/sidebar/DashboardListItem.vue.d.ts +13 -59
  146. package/dist/components/sidebar/DashboardListItem.vue.d.ts.map +1 -1
  147. package/dist/components/sidebar/DuckDBImporter.vue.d.ts +1 -0
  148. package/dist/components/sidebar/DuckDBImporter.vue.d.ts.map +1 -1
  149. package/dist/components/sidebar/EditorList.vue.d.ts +190 -67
  150. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
  151. package/dist/components/sidebar/EditorListItem.vue.d.ts +16 -59
  152. package/dist/components/sidebar/EditorListItem.vue.d.ts.map +1 -1
  153. package/dist/components/sidebar/GenericSidebarItem.vue.d.ts.map +1 -1
  154. package/dist/components/sidebar/JobsList.vue.d.ts +12 -0
  155. package/dist/components/sidebar/JobsList.vue.d.ts.map +1 -0
  156. package/dist/components/sidebar/JobsListItem.vue.d.ts +25 -0
  157. package/dist/components/sidebar/JobsListItem.vue.d.ts.map +1 -0
  158. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts.map +1 -1
  159. package/dist/components/sidebar/LLMConnectionList.vue.d.ts +14 -356
  160. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
  161. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts +15 -190
  162. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts.map +1 -1
  163. package/dist/components/sidebar/ModelSidebar.vue.d.ts +15 -0
  164. package/dist/components/sidebar/ModelSidebar.vue.d.ts.map +1 -1
  165. package/dist/components/sidebar/Sidebar.vue.d.ts +3966 -0
  166. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -0
  167. package/dist/components/sidebar/SidebarList.vue.d.ts.map +1 -1
  168. package/dist/components/sidebar/SidebarOverflowMenu.vue.d.ts +19 -0
  169. package/dist/components/sidebar/SidebarOverflowMenu.vue.d.ts.map +1 -0
  170. package/dist/components/sidebar/SidebarTagChip.vue.d.ts +6 -0
  171. package/dist/components/sidebar/SidebarTagChip.vue.d.ts.map +1 -0
  172. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +97 -186
  173. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
  174. package/dist/components/useConfirmationState.d.ts +10 -0
  175. package/dist/components/useConfirmationState.d.ts.map +1 -0
  176. package/dist/composables/useClickOutside.d.ts +12 -0
  177. package/dist/composables/useClickOutside.d.ts.map +1 -0
  178. package/dist/connections/index.d.ts +1 -0
  179. package/dist/connections/index.d.ts.map +1 -1
  180. package/dist/connections/remoteProject.d.ts +23 -0
  181. package/dist/connections/remoteProject.d.ts.map +1 -0
  182. package/dist/{cssMode-DCSjJlZ5.js → cssMode-Cfy3yIk-.js} +1 -1
  183. package/dist/dashboards/base.d.ts +2 -1
  184. package/dist/dashboards/base.d.ts.map +1 -1
  185. package/dist/dashboards/prompts.d.ts +1 -1
  186. package/dist/dashboards/prompts.d.ts.map +1 -1
  187. package/dist/dashboards/spec.d.ts +4 -0
  188. package/dist/dashboards/spec.d.ts.map +1 -1
  189. package/dist/data/index.d.ts +1 -0
  190. package/dist/data/index.d.ts.map +1 -1
  191. package/dist/data/localStorage.d.ts +3 -3
  192. package/dist/data/localStorage.d.ts.map +1 -1
  193. package/dist/data/remoteStoreStorage.d.ts +46 -0
  194. package/dist/data/remoteStoreStorage.d.ts.map +1 -0
  195. package/dist/data/storage.d.ts +6 -6
  196. package/dist/data/storage.d.ts.map +1 -1
  197. package/dist/data/tutorial/reference.d.ts.map +1 -1
  198. package/dist/editors/editor.d.ts +19 -5
  199. package/dist/editors/editor.d.ts.map +1 -1
  200. package/dist/editors/fileTypes.d.ts +12 -0
  201. package/dist/editors/fileTypes.d.ts.map +1 -0
  202. package/dist/editors/helpers.d.ts +2 -0
  203. package/dist/editors/helpers.d.ts.map +1 -1
  204. package/dist/{freemarker2-BKjHRYvq.js → freemarker2-Dy8u-XQv.js} +1 -1
  205. package/dist/{handlebars-D_px6u7k.js → handlebars-BDrD8h_c.js} +1 -1
  206. package/dist/{html-Bm-h8fTq.js → html-CKz7V4Cn.js} +1 -1
  207. package/dist/{htmlMode-YODzRvjv.js → htmlMode-BZE5C9QD.js} +1 -1
  208. package/dist/{javascript-DZrwO1Xq.js → javascript-Cav2mApM.js} +1 -1
  209. package/dist/{jsonMode-_ThxxZQx.js → jsonMode-B6434NZu.js} +1 -1
  210. package/dist/{liquid-I2p3UrJy.js → liquid-Cq-Omf5B.js} +1 -1
  211. package/dist/llm/chatToolExecutor.d.ts.map +1 -1
  212. package/dist/llm/editorRefinementToolExecutor.d.ts.map +1 -1
  213. package/dist/llm/toolLoopCore.d.ts.map +1 -1
  214. package/dist/{main-Bjg9NFbT.js → main-C-6acy1R.js} +54550 -52400
  215. package/dist/main.css +1 -1
  216. package/dist/main.js +16 -16
  217. package/dist/main.umd.cjs +580 -559
  218. package/dist/{mdx-e5VczKhJ.js → mdx-DYvw7-lF.js} +1 -1
  219. package/dist/models/helpers.d.ts +16 -4
  220. package/dist/models/helpers.d.ts.map +1 -1
  221. package/dist/models/model.d.ts +1 -0
  222. package/dist/models/model.d.ts.map +1 -1
  223. package/dist/monaco/editorHelpers.d.ts.map +1 -1
  224. package/dist/prism-clike-SH1s-yiH.js +31 -0
  225. package/dist/prism-javascript-CLux6jF8.js +137 -0
  226. package/dist/prism-json-iVb7He6L.js +25 -0
  227. package/dist/prism-markdown-tjNeCMi3.js +300 -0
  228. package/dist/prism-markup-BNGj0Tvm.js +173 -0
  229. package/dist/prism-python-DBk-6kcY.js +71 -0
  230. package/dist/prism-typescript-Crma_dEX.js +55 -0
  231. package/dist/{python-CUAfebEu.js → python-BTTSwl4o.js} +1 -1
  232. package/dist/{razor-B95YKGrm.js → razor-BVBhJqGl.js} +1 -1
  233. package/dist/remotes/genericStoreMetadata.d.ts +8 -0
  234. package/dist/remotes/genericStoreMetadata.d.ts.map +1 -0
  235. package/dist/remotes/jobs.d.ts +38 -0
  236. package/dist/remotes/jobs.d.ts.map +1 -0
  237. package/dist/remotes/jobsService.d.ts +15 -0
  238. package/dist/remotes/jobsService.d.ts.map +1 -0
  239. package/dist/remotes/models.d.ts +2 -1
  240. package/dist/remotes/models.d.ts.map +1 -1
  241. package/dist/remotes/remoteStoreSync.d.ts +7 -0
  242. package/dist/remotes/remoteStoreSync.d.ts.map +1 -0
  243. package/dist/remotes/storeService.d.ts +2 -1
  244. package/dist/remotes/storeService.d.ts.map +1 -1
  245. package/dist/stores/Manager.vue.d.ts +9 -0
  246. package/dist/stores/Manager.vue.d.ts.map +1 -1
  247. package/dist/stores/communityApiStore.d.ts +6 -0
  248. package/dist/stores/communityApiStore.d.ts.map +1 -1
  249. package/dist/stores/editorStore.d.ts +7 -2
  250. package/dist/stores/editorStore.d.ts.map +1 -1
  251. package/dist/stores/index.d.ts +1 -0
  252. package/dist/stores/index.d.ts.map +1 -1
  253. package/dist/stores/jobsApiStore.d.ts +45 -0
  254. package/dist/stores/jobsApiStore.d.ts.map +1 -0
  255. package/dist/stores/modelStore.d.ts.map +1 -1
  256. package/dist/stores/queryExecutionService.d.ts +6 -4
  257. package/dist/stores/queryExecutionService.d.ts.map +1 -1
  258. package/dist/stores/resolver.d.ts +4 -4
  259. package/dist/stores/resolver.d.ts.map +1 -1
  260. package/dist/stores/useScreenNavigation.d.ts +3 -1
  261. package/dist/stores/useScreenNavigation.d.ts.map +1 -1
  262. package/dist/stores/userSettingsStore.d.ts.map +1 -1
  263. package/dist/{tsMode-BcjYt2WB.js → tsMode-z99lZ8eT.js} +1 -1
  264. package/dist/{typescript-Ck_cSGyE.js → typescript-BXQnMlGm.js} +1 -1
  265. package/dist/useDashboard-3deVRse_.js +3502 -0
  266. package/dist/utility/markdownRenderer.d.ts.map +1 -1
  267. package/dist/utility/prism.d.ts +5 -0
  268. package/dist/utility/prism.d.ts.map +1 -0
  269. package/dist/utils/terminalOutput.d.ts +3 -0
  270. package/dist/utils/terminalOutput.d.ts.map +1 -0
  271. package/dist/views/ConnectionView.vue.d.ts +9 -0
  272. package/dist/views/ConnectionView.vue.d.ts.map +1 -1
  273. package/dist/views/IDE.vue.d.ts +7 -0
  274. package/dist/views/IDE.vue.d.ts.map +1 -0
  275. package/dist/views/LLMView.vue.d.ts +232 -846
  276. package/dist/views/LLMView.vue.d.ts.map +1 -1
  277. package/dist/views/MobileIDE.vue.d.ts +6 -0
  278. package/dist/views/MobileIDE.vue.d.ts.map +1 -0
  279. package/dist/views/ModelView.vue.d.ts +46 -10
  280. package/dist/views/ModelView.vue.d.ts.map +1 -1
  281. package/dist/views/ResponsiveIDE.vue.d.ts.map +1 -1
  282. package/dist/views/TutorialPage.vue.d.ts +465 -907
  283. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  284. package/dist/{xml-Do52fQeS.js → xml-Ci-UOFva.js} +1 -1
  285. package/dist/{yaml-C8U7HH0M.js → yaml-XEOisXAU.js} +1 -1
  286. package/package.json +1 -1
  287. package/dist/Manager-CoKiEZT-.js +0 -4
  288. package/dist/Sidebar-esb9EqnY.js +0 -1862
  289. package/dist/TutorialPage-DfA2845i.js +0 -482
  290. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +0 -52
  291. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +0 -1
  292. package/dist/components/editor/EditorCreatorIcon.vue.d.ts +0 -61
  293. package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +0 -1
  294. package/dist/useDashboard-BnXAbWPO.js +0 -3352
@@ -1,3352 +0,0 @@
1
- import { defineComponent as X, ref as b, watch as ne, createElementBlock as p, createCommentVNode as R, openBlock as m, createElementVNode as t, toDisplayString as N, computed as C, onMounted as pe, onBeforeUnmount as We, normalizeStyle as Ie, Fragment as ce, renderList as we, normalizeClass as H, createTextVNode as G, createBlock as Z, unref as Y, createVNode as z, withCtx as ie, withDirectives as te, withKeys as Ce, vModelText as ye, onUnmounted as $e, inject as j, resolveComponent as J, Teleport as Ue, withModifiers as Pe, createStaticVNode as rt, resolveDynamicComponent as lt, nextTick as Ae, vModelRadio as Te, vShow as at } from "vue";
2
- import { a as ee, N as st, T as ke, P as je, Q as ze, u as Ge, F as ut, L as dt, U as ct, x as De, V as Le, W as mt, X as ht, M as ft, Y as vt, Z as de, B as $, $ as Ee, a0 as ae, a1 as ve, a2 as yt, a3 as pt, a4 as Ne, a5 as gt, a6 as Ye, a7 as Je, v as bt, a8 as Ke } from "./main-Bjg9NFbT.js";
3
- const Ct = { class: "popup-header" }, wt = { class: "popup-body" }, kt = { class: "json-container" }, It = { "data-testid": "dashboard-json" }, Dt = { class: "popup-footer" }, St = /* @__PURE__ */ X({
4
- __name: "DashboardSharePopup",
5
- props: {
6
- dashboard: {},
7
- isOpen: { type: Boolean }
8
- },
9
- emits: ["close"],
10
- setup(e, { emit: o }) {
11
- const n = e, a = o, i = b(""), l = (y) => {
12
- if (!y) return null;
13
- const g = JSON.parse(JSON.stringify(y));
14
- if (delete g.id, delete g.connection, delete g.storage, delete g.changed, delete g.deleted, g.layout && Array.isArray(g.layout) && (g.layout = g.layout.map((k) => {
15
- const T = { ...k };
16
- return delete T.static, delete T.moved, delete T.state, T;
17
- })), g.gridItems && typeof g.gridItems == "object")
18
- for (const [k, T] of Object.entries(g.gridItems)) {
19
- const F = { ...T };
20
- delete F.results, delete F.loading, delete F.loadStartTime, delete F.error, F.filters || delete F.filters, F.crossFilters || delete F.crossFilters, F.chartFilters || delete F.chartFilters, F.conceptFilters || delete F.conceptFilters, F.chartConfig && delete F.chartConfig.showDebug, g.gridItems[k] = F;
21
- }
22
- return g.imports && Array.isArray(g.imports) && (g.imports = g.imports.map((k) => {
23
- const T = { ...k };
24
- return delete T.id, T;
25
- })), g;
26
- };
27
- ne(
28
- [() => n.dashboard, () => n.isOpen],
29
- ([y, g]) => {
30
- if (g && y) {
31
- const k = l(y);
32
- i.value = JSON.stringify(k, null, 2);
33
- } else g || (i.value = "");
34
- },
35
- { immediate: !0 }
36
- );
37
- const r = b(!1), f = () => {
38
- navigator.clipboard.writeText(i.value).then(() => {
39
- r.value = !0, setTimeout(() => {
40
- r.value = !1;
41
- }, 2e3);
42
- }).catch((y) => {
43
- console.error("Could not copy text: ", y);
44
- });
45
- }, h = b(null), v = (y) => {
46
- h.value && !h.value.contains(y.target) && a("close");
47
- };
48
- return (y, g) => e.isOpen ? (m(), p("div", {
49
- key: 0,
50
- class: "popup-overlay",
51
- onClick: v
52
- }, [
53
- t("div", {
54
- class: "popup-content",
55
- ref_key: "popupContent",
56
- ref: h,
57
- "data-testid": "dashboard-share-popup"
58
- }, [
59
- t("div", Ct, [
60
- g[1] || (g[1] = t("h3", null, "Definition", -1)),
61
- t("button", {
62
- onClick: g[0] || (g[0] = (k) => a("close")),
63
- class: "close-button",
64
- "data-testid": "close-popup-button"
65
- }, " ✕ ")
66
- ]),
67
- t("div", wt, [
68
- t("div", kt, [
69
- t("pre", It, N(i.value), 1)
70
- ])
71
- ]),
72
- t("div", Dt, [
73
- t("button", {
74
- onClick: f,
75
- class: "dashboard-copy-button",
76
- "data-testid": "copy-json-button"
77
- }, N(r.value ? "Copied!" : "Copy"), 1)
78
- ])
79
- ], 512)
80
- ])) : R("", !0);
81
- }
82
- }), Tt = /* @__PURE__ */ ee(St, [["__scopeId", "data-v-e0f711ae"]]), Et = ["onClick"], $t = { class: "completion-details" }, Lt = { class: "completion-label" }, Mt = { class: "completion-description" }, qt = /* @__PURE__ */ X({
83
- __name: "DashboardFilterAutocomplete",
84
- props: {
85
- inputValue: {
86
- type: String,
87
- required: !0
88
- },
89
- completionItems: {
90
- type: Array,
91
- required: !0
92
- },
93
- inputElement: {
94
- type: Object,
95
- default: null
96
- }
97
- },
98
- emits: ["select-completion"],
99
- setup(e, { emit: o }) {
100
- const n = e, a = o, i = b(!1), l = b(0), r = b(0), f = b(""), h = b(0), v = b(null), y = C(() => {
101
- if (!n.inputElement) return {};
102
- const E = n.inputElement.getBoundingClientRect();
103
- return {
104
- top: `${E.bottom + 50}px`,
105
- left: `${E.left}px`,
106
- width: `${E.width}px`,
107
- maxHeight: "200px"
108
- };
109
- }), g = () => {
110
- if (!n.inputElement) return;
111
- r.value = n.inputElement.selectionStart || 0;
112
- const E = n.inputValue;
113
- let M = r.value;
114
- for (; M > 0 && !/\s/.test(E.charAt(M - 1)); )
115
- M--;
116
- let I = r.value;
117
- for (; I < E.length && !/\s/.test(E.charAt(I)); )
118
- I++;
119
- h.value = M, f.value = E.substring(M, I);
120
- }, k = C(() => {
121
- if (!f.value.trim()) return [];
122
- const E = f.value.toLowerCase();
123
- return n.completionItems.filter((M) => M.label.toLowerCase().includes(E)).sort((M, I) => {
124
- const B = M.label.toLowerCase().startsWith(E), x = I.label.toLowerCase().startsWith(E);
125
- return B && !x ? -1 : !B && x ? 1 : M.label.localeCompare(I.label);
126
- }).slice(0, 10);
127
- });
128
- ne(k, (E) => {
129
- i.value = E.length > 0, l.value = 0;
130
- });
131
- const T = (E) => {
132
- const M = n.inputValue.substring(0, h.value), I = n.inputValue.substring(r.value);
133
- a("select-completion", {
134
- text: M + E.label + I,
135
- cursorPosition: h.value + E.label.length
136
- }), i.value = !1;
137
- }, F = (E) => {
138
- v.value && !v.value.contains(E.target) && n.inputElement !== E.target && (i.value = !1);
139
- }, _ = (E) => E.trilogySubType ? E.trilogySubType.toLowerCase() : E.type.toLowerCase();
140
- return ne(
141
- () => n.inputValue,
142
- () => {
143
- g();
144
- }
145
- ), pe(() => {
146
- document.addEventListener("mousedown", F), n.inputElement;
147
- }), We(() => {
148
- document.removeEventListener("mousedown", F), n.inputElement;
149
- }), g(), (E, M) => i.value ? (m(), p("div", {
150
- key: 0,
151
- ref_key: "dropdown",
152
- ref: v,
153
- class: "autocomplete-dropdown",
154
- style: Ie(y.value)
155
- }, [
156
- (m(!0), p(ce, null, we(k.value, (I, B) => (m(), p("div", {
157
- key: B,
158
- class: H(["completion-item", { selected: B === l.value }]),
159
- onClick: (x) => T(I)
160
- }, [
161
- t("div", {
162
- class: H(["symbol-icon", _(I)])
163
- }, [
164
- I.trilogySubType ? (m(), p("i", {
165
- key: 0,
166
- class: H(`mdi ${I.trilogySubType === "key" ? "mdi-key-outline" : I.trilogySubType === "property" ? "mdi-tag-outline" : "mdi-cube-outline"}`)
167
- }, null, 2)) : (m(), p(ce, { key: 1 }, [
168
- G(N(I.type === "function" ? "ƒ" : I.type === "variable" ? "V" : I.type === "class" ? "C" : I.type === "interface" ? "I" : I.type === "method" ? "M" : I.type === "property" ? "P" : I.type === "field" ? "F" : I.type === "constant" ? "K" : I.type === "enum" ? "E" : I.type === "keyword" ? "K" : "S"), 1)
169
- ], 64))
170
- ], 2),
171
- t("div", $t, [
172
- t("div", Lt, N(I.label), 1),
173
- t("div", Mt, N(I.description), 1)
174
- ])
175
- ], 10, Et))), 128))
176
- ], 4)) : R("", !0);
177
- }
178
- }), At = /* @__PURE__ */ ee(qt, [["__scopeId", "data-v-71bf654b"]]), Rt = { class: "filter-container" }, Ft = { class: "filter-input-wrapper" }, xt = ["value", "disabled"], Qt = {
179
- key: 0,
180
- class: "filter-dropdown"
181
- }, Vt = ["value", "placeholder", "disabled"], Bt = {
182
- key: 0,
183
- class: "dropdown-error-message",
184
- "data-testid": "dropdown-error-message"
185
- }, Ot = { class: "dropdown-actions" }, Ht = ["disabled"], Pt = ["disabled"], Nt = {
186
- key: 0,
187
- class: "loader-container"
188
- }, Kt = ["disabled"], _t = ["disabled"], Wt = { class: "button-content" }, Ut = ["disabled"], jt = { class: "button-content" }, zt = {
189
- key: 0,
190
- class: "loader-container"
191
- }, Gt = ["disabled"], Yt = { class: "button-content" }, Jt = {
192
- key: 4,
193
- class: "filter-validation-icon"
194
- }, Zt = {
195
- key: 0,
196
- class: "filter-icon error",
197
- "data-testid": "filter-error-icon"
198
- }, Xt = {
199
- key: 1,
200
- class: "filter-icon valid",
201
- "data-testid": "filter-valid-icon"
202
- }, en = /* @__PURE__ */ X({
203
- __name: "DashboardHeaderFilterInput",
204
- props: {
205
- filterValue: {
206
- type: String,
207
- default: ""
208
- },
209
- filterError: String,
210
- isLoading: Boolean,
211
- globalCompletion: {
212
- type: Array,
213
- default: () => []
214
- },
215
- validateFilter: {
216
- type: Function,
217
- default: () => !0
218
- }
219
- },
220
- emits: ["filter-change", "filter-apply", "clear-filter"],
221
- setup(e, { emit: o }) {
222
- const n = e, a = o, i = st(), l = b(n.isLoading), r = b(null), f = b(null), h = b(n.filterValue || ""), v = b(!1), y = b(!1), g = C(() => h.value.replace(/\n/g, " ")), k = C(() => !0);
223
- function T() {
224
- a("filter-apply", h.value), v.value = !1, M();
225
- }
226
- function F() {
227
- h.value = "", v.value = !0, a("filter-change", ""), a("filter-apply", ""), a("clear-filter", ""), setTimeout(() => {
228
- f.value && f.value.focus();
229
- }, 0);
230
- }
231
- function _(w) {
232
- const u = w.target;
233
- h.value = u.value, v.value = !0, a("filter-change", h.value);
234
- }
235
- function E() {
236
- y.value = !0, setTimeout(() => {
237
- if (f.value) {
238
- f.value.focus();
239
- const w = h.value.length;
240
- f.value.setSelectionRange(w, w);
241
- }
242
- }, 0);
243
- }
244
- function M() {
245
- y.value = !1;
246
- }
247
- function I(w) {
248
- const u = w.target, d = document.querySelector(".filter-dropdown"), S = r.value;
249
- d && !d.contains(u) && u !== S && M();
250
- }
251
- const B = () => {
252
- l.value = !0;
253
- let w = n.globalCompletion.map((u) => ({
254
- name: u.label,
255
- type: u.datatype,
256
- description: u.description
257
- }));
258
- i.generateFilterQuery(h.value, w, n.validateFilter).then((u) => {
259
- u && u.length > 0 && (h.value = u.replace(/^\s*where\s+/i, ""), v.value = !0, a("filter-apply", h.value)), l.value = !1;
260
- }).catch(() => {
261
- l.value = !1;
262
- });
263
- };
264
- function x(w) {
265
- w.key === "Enter" && !w.shiftKey && !w.ctrlKey && !w.altKey ? y.value || (w.preventDefault(), T()) : (w.ctrlKey || w.metaKey) && w.shiftKey && w.key === "Enter" ? (w.preventDefault(), B()) : w.key === "Escape" && y.value && (w.preventDefault(), M());
266
- }
267
- function A(w) {
268
- (w.ctrlKey || w.metaKey) && w.key === "Enter" && !w.shiftKey ? (w.preventDefault(), T()) : (w.ctrlKey || w.metaKey) && w.shiftKey && w.key === "Enter" ? (w.preventDefault(), B()) : w.key === "Escape" && (w.preventDefault(), M());
269
- }
270
- const D = C(() => (n.filterError || "").length > 0 ? "error" : h.value ? "valid" : "neutral");
271
- function U(w) {
272
- h.value = w.text, v.value = !0, a("filter-change", h.value);
273
- const u = y.value ? f.value : r.value;
274
- u && (u.focus(), u.setSelectionRange(w.cursorPosition, w.cursorPosition));
275
- }
276
- return ne(
277
- () => n.filterValue,
278
- (w) => {
279
- w !== h.value && (h.value = w || "", v.value = !1);
280
- }
281
- ), ne(
282
- () => n.isLoading,
283
- (w) => {
284
- l.value = w;
285
- }
286
- ), ne(y, (w) => {
287
- w ? document.addEventListener("click", I) : document.removeEventListener("click", I);
288
- }), (w, u) => (m(), p("div", Rt, [
289
- t("div", Ft, [
290
- t("input", {
291
- id: "filter",
292
- "data-testid": "filter-input",
293
- type: "text",
294
- value: g.value,
295
- onInput: _,
296
- onKeydown: x,
297
- onFocus: E,
298
- placeholder: "Add a global filter...",
299
- class: H({ "filter-error": D.value === "error" }),
300
- disabled: l.value,
301
- ref_key: "filterInputRef",
302
- ref: r
303
- }, null, 42, xt),
304
- y.value ? (m(), p("div", Qt, [
305
- t("div", { class: "dropdown-header" }, [
306
- u[1] || (u[1] = t("span", null, "Global Filters", -1)),
307
- t("button", {
308
- onClick: M,
309
- class: "close-button",
310
- title: "Close (Esc)"
311
- }, [...u[0] || (u[0] = [
312
- t("i", { class: "mdi mdi-close" }, null, -1)
313
- ])])
314
- ]),
315
- t("textarea", {
316
- ref_key: "filterTextareaRef",
317
- ref: f,
318
- class: H(["filter-textarea", { "filter-error": D.value === "error" }]),
319
- value: h.value,
320
- onInput: _,
321
- onKeydown: A,
322
- placeholder: Y(i).hasActiveDefaultConnection ? `Use a SQL condition (ex color='blue' or color='red') or text to filter.
323
- Use Ctrl+Enter to apply, Ctrl+Shift+Enter for text to SQL` : `Use a SQL condition (ex color='blue') to filter.
324
- Use Ctrl+Enter to apply`,
325
- disabled: l.value,
326
- rows: "4"
327
- }, null, 42, Vt),
328
- e.filterError ? (m(), p("div", Bt, [
329
- u[2] || (u[2] = t("i", { class: "mdi mdi-alert-circle" }, null, -1)),
330
- t("span", null, N(e.filterError), 1)
331
- ])) : R("", !0),
332
- t("div", Ot, [
333
- t("button", {
334
- onClick: T,
335
- class: H(["apply-button", { "has-changes": v.value }]),
336
- disabled: l.value,
337
- title: "Apply filter (Ctrl+Enter)"
338
- }, [...u[3] || (u[3] = [
339
- t("i", { class: "mdi mdi-check" }, null, -1),
340
- G(" Apply ", -1)
341
- ])], 10, Ht),
342
- Y(i).hasActiveDefaultConnection ? (m(), p("button", {
343
- key: 0,
344
- onClick: B,
345
- class: "llm-button",
346
- disabled: l.value,
347
- title: "Text to filter (Ctrl+Shift+Enter)"
348
- }, [
349
- t("i", {
350
- class: H(["mdi mdi-creation", { hidden: l.value }])
351
- }, null, 2),
352
- l.value ? (m(), p("div", Nt, [...u[4] || (u[4] = [
353
- t("div", { class: "loader" }, null, -1)
354
- ])])) : R("", !0),
355
- u[5] || (u[5] = G(" Text to Filter ", -1))
356
- ], 8, Pt)) : R("", !0),
357
- t("button", {
358
- onClick: F,
359
- class: "clear-button",
360
- disabled: l.value,
361
- title: "Clear filter"
362
- }, [...u[6] || (u[6] = [
363
- t("i", { class: "mdi mdi-close-circle-outline" }, null, -1),
364
- G(" Clear ", -1)
365
- ])], 8, Kt)
366
- ])
367
- ])) : R("", !0),
368
- (y.value ? f.value : r.value) ? (m(), Z(At, {
369
- key: 1,
370
- "input-value": h.value,
371
- "completion-items": e.globalCompletion,
372
- "input-element": y.value ? f.value : r.value,
373
- onSelectCompletion: U
374
- }, null, 8, ["input-value", "completion-items", "input-element"])) : R("", !0),
375
- t("button", {
376
- onClick: T,
377
- class: H(["search-button", { "has-changes": v.value }]),
378
- "data-testid": "filter-search-button",
379
- disabled: l.value,
380
- title: "Apply filter (Enter)"
381
- }, [
382
- t("div", Wt, [
383
- u[8] || (u[8] = t("i", { class: "mdi mdi-magnify" }, null, -1)),
384
- z(ke, {
385
- content: v.value ? "Apply changes (Enter)" : "Search (Enter)",
386
- position: "top"
387
- }, {
388
- default: ie(() => [...u[7] || (u[7] = [
389
- t("span", { class: "tooltip-trigger" }, null, -1)
390
- ])]),
391
- _: 1
392
- }, 8, ["content"])
393
- ])
394
- ], 10, _t),
395
- Y(i).hasActiveDefaultConnection ? (m(), p("button", {
396
- key: 2,
397
- onClick: B,
398
- class: "sparkle-button",
399
- "data-testid": "filter-llm-button",
400
- disabled: l.value,
401
- title: "Transform text to filter if you have a configured LLM connection"
402
- }, [
403
- t("div", jt, [
404
- t("i", {
405
- class: H(["mdi mdi-creation", { hidden: l.value }])
406
- }, null, 2),
407
- l.value ? (m(), p("div", zt, [...u[9] || (u[9] = [
408
- t("div", { class: "loader" }, null, -1)
409
- ])])) : R("", !0),
410
- z(ke, {
411
- content: l.value ? "Processing..." : "Text to filter (Ctrl+Shift+Enter)",
412
- position: "top"
413
- }, {
414
- default: ie(() => [...u[10] || (u[10] = [
415
- t("span", { class: "tooltip-trigger" }, null, -1)
416
- ])]),
417
- _: 1
418
- }, 8, ["content"])
419
- ])
420
- ], 8, Ut)) : R("", !0),
421
- k.value ? (m(), p("button", {
422
- key: 3,
423
- onClick: F,
424
- class: "clear-filters-button",
425
- "data-testid": "clear-filters-button",
426
- disabled: l.value,
427
- title: "Clear all filters"
428
- }, [
429
- t("div", Yt, [
430
- u[12] || (u[12] = t("i", { class: "mdi mdi-close" }, null, -1)),
431
- z(ke, {
432
- content: "Clear all filters",
433
- position: "top"
434
- }, {
435
- default: ie(() => [...u[11] || (u[11] = [
436
- t("span", { class: "tooltip-trigger" }, null, -1)
437
- ])]),
438
- _: 1
439
- })
440
- ])
441
- ], 8, Gt)) : R("", !0),
442
- D.value !== "neutral" ? (m(), p("div", Jt, [
443
- D.value === "error" ? (m(), p("div", Zt, [
444
- u[14] || (u[14] = t("span", { class: "icon-x" }, "✕", -1)),
445
- z(ke, {
446
- content: e.filterError || "Unknown Error",
447
- position: "bottom"
448
- }, {
449
- default: ie(() => [...u[13] || (u[13] = [
450
- t("span", {
451
- class: "tooltip-trigger",
452
- "data-testid": "filter-error-tooltip-trigger"
453
- }, null, -1)
454
- ])]),
455
- _: 1
456
- }, 8, ["content"])
457
- ])) : D.value === "valid" ? (m(), p("div", Xt, [
458
- z(ke, {
459
- content: "This is a syntactically correct filter.",
460
- position: "top"
461
- }, {
462
- default: ie(() => [...u[15] || (u[15] = [
463
- t("span", {
464
- class: "icon-check",
465
- "data-testid": "filter-valid-tooltip-trigger"
466
- }, "✓", -1)
467
- ])]),
468
- _: 1
469
- })
470
- ])) : R("", !0)
471
- ])) : R("", !0)
472
- ])
473
- ]));
474
- }
475
- }), tn = /* @__PURE__ */ ee(en, [["__scopeId", "data-v-b8827229"]]), nn = {
476
- class: "dashboard-controls",
477
- "data-testid": "dashboard-controls"
478
- }, on = {
479
- key: 0,
480
- class: "controls-row title-row"
481
- }, rn = {
482
- key: 0,
483
- class: "editable-text"
484
- }, ln = {
485
- key: 0,
486
- class: "edit-indicator",
487
- "data-testid": "edit-dashboard-title"
488
- }, an = { class: "dashboard-right-controls" }, sn = {
489
- class: "connection-selector",
490
- "data-testid": "connection-selector-wrapper"
491
- }, un = { class: "select-wrapper" }, dn = ["value"], cn = ["value"], mn = { class: "grid-actions" }, hn = {
492
- key: 1,
493
- class: "controls-row title-only-row"
494
- }, fn = {
495
- key: 0,
496
- class: "editable-text"
497
- }, vn = { class: "controls-row filter-row" }, yn = { class: "grid-actions" }, pn = {
498
- class: "mode-selector",
499
- "data-testid": "mode-selector-wrapper"
500
- }, gn = { class: "select-wrapper" }, bn = ["value", "disabled"], Cn = /* @__PURE__ */ X({
501
- __name: "DashboardHeader",
502
- props: {
503
- dashboard: {
504
- type: Object,
505
- required: !0
506
- },
507
- editsLocked: Boolean,
508
- selectedConnection: {
509
- type: String,
510
- required: !0
511
- },
512
- filterError: String,
513
- globalCompletion: {
514
- type: Array,
515
- default: () => []
516
- },
517
- validateFilter: {
518
- type: Function,
519
- default: () => !0
520
- }
521
- },
522
- emits: [
523
- "connection-change",
524
- "filter-change",
525
- "import-change",
526
- "add-item",
527
- "clear-items",
528
- "clear-filter",
529
- "mode-change",
530
- "refresh",
531
- "title-update",
532
- "export-image"
533
- ],
534
- setup(e, { emit: o }) {
535
- const n = e, a = o, i = je(), l = ze(), r = Ge(), f = b(!1), h = b(!1), v = b(!1), y = b(""), g = b(null);
536
- function k() {
537
- h.value = !h.value;
538
- }
539
- function T() {
540
- h.value = !1;
541
- }
542
- function F(u) {
543
- a("filter-change", u);
544
- }
545
- async function _() {
546
- return a("export-image"), await new Promise((u) => setTimeout(u, 5e3)), Promise.resolve();
547
- }
548
- function E(u) {
549
- const d = u.target;
550
- a("mode-change", d.value);
551
- }
552
- function M() {
553
- var u;
554
- n.editsLocked || (v.value = !0, y.value = ((u = n.dashboard) == null ? void 0 : u.name) || "Untitled Dashboard", setTimeout(() => {
555
- var d;
556
- (d = g.value) == null || d.focus();
557
- }, 0));
558
- }
559
- function I() {
560
- v.value = !1, a("title-update", y.value);
561
- }
562
- function B() {
563
- var u;
564
- v.value = !1, y.value = ((u = n.dashboard) == null ? void 0 : u.name) || "Untitled Dashboard";
565
- }
566
- const x = C(() => Object.values(l.editors).filter((d) => d.connection === n.selectedConnection).sort((d, S) => d.name.localeCompare(S.name)).map((d) => ({
567
- id: d.id,
568
- // Convert folder path separators (/) to Python import syntax (.)
569
- name: d.name.replace(/\//g, "."),
570
- alias: ""
571
- }))), A = C(() => {
572
- var u;
573
- return ((u = n.dashboard) == null ? void 0 : u.imports) || [];
574
- });
575
- function D(u) {
576
- a("import-change", u);
577
- }
578
- function U() {
579
- a("refresh");
580
- }
581
- const w = C(() => {
582
- var u;
583
- switch ((u = n.dashboard) == null ? void 0 : u.state) {
584
- case "editing":
585
- return "mdi mdi-pencil-outline";
586
- case "published":
587
- return "mdi mdi-eye-outline";
588
- case "fullscreen":
589
- return "mdi mdi-fullscreen";
590
- default:
591
- return "mdi mdi-eye-outline";
592
- }
593
- });
594
- return (u, d) => {
595
- var S, L, Q;
596
- return m(), p("div", nn, [
597
- e.dashboard.state === "editing" ? (m(), p("div", on, [
598
- t("div", {
599
- class: "dashboard-title",
600
- onClick: M
601
- }, [
602
- v.value ? te((m(), p("input", {
603
- key: 1,
604
- ref_key: "titleInput",
605
- ref: g,
606
- "data-testid": "dashboard-title-input",
607
- "onUpdate:modelValue": d[0] || (d[0] = (K) => y.value = K),
608
- onBlur: I,
609
- onKeyup: [
610
- Ce(I, ["enter"]),
611
- Ce(B, ["esc"])
612
- ],
613
- class: "title-input",
614
- type: "text"
615
- }, null, 544)), [
616
- [ye, y.value]
617
- ]) : (m(), p("span", rn, [
618
- G(N(((S = e.dashboard) == null ? void 0 : S.name) || "Untitled Dashboard") + " ", 1),
619
- e.editsLocked ? R("", !0) : (m(), p("span", ln, " ✎ "))
620
- ]))
621
- ]),
622
- t("div", an, [
623
- t("div", sn, [
624
- t("div", un, [
625
- d[7] || (d[7] = t("i", { class: "mdi mdi-database-outline select-icon" }, null, -1)),
626
- t("select", {
627
- id: "connection",
628
- "data-testid": "connection-selector",
629
- onChange: d[1] || (d[1] = (K) => u.$emit("connection-change", K)),
630
- value: e.selectedConnection
631
- }, [
632
- (m(!0), p(ce, null, we(Object.values(Y(i).connections).filter(
633
- (K) => K.model
634
- ), (K) => (m(), p("option", {
635
- key: K.name,
636
- value: K.name
637
- }, N(K.name), 9, cn))), 128))
638
- ], 40, dn)
639
- ])
640
- ]),
641
- z(ut, {
642
- "available-imports": x.value,
643
- "active-imports": A.value,
644
- "onUpdate:imports": D,
645
- onExplore: d[2] || (d[2] = (K) => Y(r).openTab("editors", null, K.id))
646
- }, null, 8, ["available-imports", "active-imports"]),
647
- t("div", mn, [
648
- t("button", {
649
- onClick: d[3] || (d[3] = (K) => u.$emit("add-item")),
650
- class: "btn btn-success",
651
- "data-testid": "add-item-button"
652
- }, " Add Item "),
653
- t("button", {
654
- onClick: d[4] || (d[4] = (K) => u.$emit("clear-items")),
655
- class: "btn btn-danger",
656
- "data-testid": "clear-items-button"
657
- }, " Clear All ")
658
- ])
659
- ])
660
- ])) : (m(), p("div", hn, [
661
- t("div", {
662
- class: "dashboard-title",
663
- onClick: M
664
- }, [
665
- v.value ? te((m(), p("input", {
666
- key: 1,
667
- ref_key: "titleInput",
668
- ref: g,
669
- "data-testid": "dashboard-title-input",
670
- "onUpdate:modelValue": d[5] || (d[5] = (K) => y.value = K),
671
- onBlur: I,
672
- onKeyup: [
673
- Ce(I, ["enter"]),
674
- Ce(B, ["esc"])
675
- ],
676
- class: "title-input",
677
- type: "text"
678
- }, null, 544)), [
679
- [ye, y.value]
680
- ]) : (m(), p("span", fn, N(((L = e.dashboard) == null ? void 0 : L.name) || "Untitled Dashboard"), 1))
681
- ])
682
- ])),
683
- t("div", vn, [
684
- z(tn, {
685
- "filter-value": ((Q = e.dashboard) == null ? void 0 : Q.filter) || "",
686
- "filter-error": e.filterError,
687
- "is-loading": f.value,
688
- "global-completion": e.globalCompletion,
689
- "validate-filter": e.validateFilter,
690
- onFilterApply: F,
691
- onClearFilter: d[6] || (d[6] = (K) => u.$emit("clear-filter", ""))
692
- }, null, 8, ["filter-value", "filter-error", "is-loading", "global-completion", "validate-filter"]),
693
- t("div", yn, [
694
- z(dt, {
695
- action: _,
696
- "use-default-style": !1,
697
- class: "btn btn-secondary",
698
- "data-testid": "download-button",
699
- "test-id": "download-button"
700
- }, {
701
- default: ie(() => [...d[8] || (d[8] = [
702
- G(" Download ", -1)
703
- ])]),
704
- _: 1
705
- }),
706
- t("button", {
707
- onClick: k,
708
- class: "btn btn-secondary",
709
- "data-testid": "share-dashboard-button"
710
- }, " Export "),
711
- t("button", {
712
- onClick: U,
713
- class: "btn btn-primary",
714
- "data-testid": "refresh-button"
715
- }, " ⟳ Refresh "),
716
- t("div", pn, [
717
- t("div", gn, [
718
- t("i", {
719
- class: H(w.value + " select-icon")
720
- }, null, 2),
721
- t("select", {
722
- id: "viewMode",
723
- "data-testid": "mode-selector",
724
- onChange: E,
725
- value: e.dashboard.state,
726
- disabled: e.editsLocked,
727
- class: "mode-select"
728
- }, [...d[9] || (d[9] = [
729
- t("option", {
730
- value: "editing",
731
- "data-testid": "edit-mode-option"
732
- }, "Edit", -1),
733
- t("option", {
734
- value: "published",
735
- "data-testid": "view-mode-option"
736
- }, "View", -1),
737
- t("option", {
738
- value: "fullscreen",
739
- "data-testid": "fullscreen-mode-option"
740
- }, "Fullscreen", -1)
741
- ])], 40, bn)
742
- ])
743
- ])
744
- ])
745
- ]),
746
- z(Tt, {
747
- dashboard: e.dashboard,
748
- "is-open": h.value,
749
- onClose: T
750
- }, null, 8, ["dashboard", "is-open"])
751
- ]);
752
- };
753
- }
754
- }), pi = /* @__PURE__ */ ee(Cn, [["__scopeId", "data-v-689e74b2"]]), wn = X({
755
- name: "DashboardChart",
756
- components: {
757
- VegaLiteChart: mt,
758
- ErrorMessage: Le,
759
- LoadingView: De,
760
- DrilldownPane: ct
761
- },
762
- props: {
763
- dashboardId: {
764
- type: String,
765
- required: !0
766
- },
767
- itemId: {
768
- type: String,
769
- required: !0
770
- },
771
- getItemData: {
772
- type: Function,
773
- required: !0,
774
- default: () => ({ type: "CHART", content: "" })
775
- },
776
- setItemData: {
777
- type: Function,
778
- required: !0,
779
- default: () => ({ type: "CHART", content: "" })
780
- },
781
- editMode: {
782
- type: Boolean,
783
- required: !0
784
- },
785
- symbols: {
786
- type: Array,
787
- required: !0
788
- },
789
- getDashboardQueryExecutor: {
790
- type: Function,
791
- required: !0
792
- }
793
- },
794
- setup(e, { emit: o }) {
795
- const n = b(!1), a = b(null), i = b(null), l = b(!1), r = b(null), f = b(null), h = C(() => e.getItemData(e.itemId, e.dashboardId)), v = () => {
796
- if (!a.value) return 0;
797
- const W = a.value.getBoundingClientRect(), oe = window.scrollY || document.documentElement.scrollTop, se = W.top + oe, fe = Math.floor(se / 200) * 10;
798
- return Math.min(fe, 100);
799
- };
800
- pe(() => {
801
- setTimeout(() => {
802
- const W = v();
803
- g.value ? setTimeout(() => {
804
- n.value = !0;
805
- }, W) : n.value = !0;
806
- }, 0);
807
- }), $e(() => {
808
- r.value && (clearTimeout(r.value), r.value = null);
809
- });
810
- const y = C(() => h.value.structured_content.query), g = C(() => h.value.results || null), k = C(() => h.value.name || ""), T = C(() => (h.value.height || 300) - 75), F = C(() => h.value.width || 300), _ = C(() => h.value.chartConfig || null), E = C(() => h.value.loading || !1), M = C(() => h.value.error || null), I = C(() => h.value.loadStartTime || null), B = C(() => (h.value.chartFilters || []).map((W) => W.value)), x = C(() => h.value.hasDrilldown), A = C(() => h.value.onRefresh || null);
811
- ne(
812
- E,
813
- (W, oe) => {
814
- r.value && (clearTimeout(r.value), r.value = null), W ? r.value = setTimeout(() => {
815
- l.value = !0, r.value = null;
816
- }, 250) : l.value = !1;
817
- },
818
- { immediate: !0 }
819
- );
820
- const D = j("connectionStore"), U = j(
821
- "analyticsStore",
822
- null
823
- ), w = (W) => {
824
- if (x.value) {
825
- e.setItemData(e.itemId, e.dashboardId, { drilldownChartConfig: W });
826
- return;
827
- }
828
- e.setItemData(e.itemId, e.dashboardId, { chartConfig: W });
829
- };
830
- if (!D)
831
- throw new Error("Connection store not found!");
832
- const u = async () => {
833
- if (!y.value) return;
834
- const W = e.getDashboardQueryExecutor(e.dashboardId);
835
- if (!W)
836
- throw new Error("Dashboard query executor not found!");
837
- try {
838
- U && U.log("dashboard-chart-execution", "CHART", !0), i.value && W.cancelQuery(i.value);
839
- let oe = await W.runSingle(e.itemId);
840
- await W.waitForQuery(oe);
841
- } catch (oe) {
842
- console.error("Error setting up query:", oe), i.value = null;
843
- }
844
- }, d = () => {
845
- A.value ? A.value(e.itemId) : u();
846
- }, S = (W) => {
847
- o("dimension-click", {
848
- source: e.itemId,
849
- filters: W.filters,
850
- chart: W.chart,
851
- append: W.append
852
- });
853
- }, L = () => {
854
- o("background-click");
855
- }, Q = (W) => {
856
- let oe = W.filters, se = Object.keys(oe)[0], fe = ht(W.filters);
857
- se && (f.value = { remove: se, filter: fe });
858
- }, K = async () => {
859
- e.setItemData(e.itemId, e.dashboardId, {
860
- drilldown: null,
861
- drilldownChartConfig: null,
862
- loading: !0
863
- }), await u();
864
- }, me = async (W) => {
865
- let se = await e.getDashboardQueryExecutor(e.dashboardId).createDrilldownQuery(
866
- y.value,
867
- W,
868
- f.value.remove,
869
- f.value.filter
870
- );
871
- e.setItemData(e.itemId, e.dashboardId, {
872
- drilldown: se,
873
- drilldownChartConfig: null,
874
- loading: !0
875
- }), n.value = !1, l.value = !0, f.value = null, await u().then(() => {
876
- n.value = !0;
877
- }).catch((fe) => {
878
- console.error("Error executing drilldown query:", fe), n.value = !0;
879
- }).finally(() => {
880
- l.value = !1;
881
- });
882
- }, he = b(!1);
883
- return {
884
- chartContainer: a,
885
- results: g,
886
- ready: n,
887
- loading: E,
888
- showLoading: l,
889
- error: M,
890
- query: y,
891
- chartHeight: T,
892
- chartWidth: F,
893
- chartConfig: _,
894
- chartTitle: k,
895
- onChartConfigChange: w,
896
- onRefresh: A,
897
- handleLocalRefresh: d,
898
- chartSelection: B,
899
- startTime: I,
900
- handleDimensionClick: S,
901
- handleBackgroundClick: L,
902
- activeDrilldown: f,
903
- activateDrilldown: Q,
904
- submitDrilldown: me,
905
- controlsVisible: he,
906
- onChartMouseEnter: () => {
907
- he.value = !0;
908
- },
909
- onChartMouseLeave: () => {
910
- he.value = !1;
911
- },
912
- revertDrilldown: K,
913
- hasDrilldown: x
914
- };
915
- }
916
- }), kn = {
917
- key: 3,
918
- class: "loading-overlay"
919
- };
920
- function In(e, o, n, a, i, l) {
921
- const r = J("drilldown-pane"), f = J("ErrorMessage"), h = J("VegaLiteChart"), v = J("LoadingView");
922
- return m(), p("div", {
923
- ref: "chartContainer",
924
- class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
925
- onMouseenter: o[3] || (o[3] = (...y) => e.onChartMouseEnter && e.onChartMouseEnter(...y)),
926
- onMouseleave: o[4] || (o[4] = (...y) => e.onChartMouseLeave && e.onChartMouseLeave(...y))
927
- }, [
928
- e.activeDrilldown ? (m(), Z(r, {
929
- key: 0,
930
- "drilldown-remove": e.activeDrilldown.remove,
931
- "drilldown-filter": e.activeDrilldown.filter,
932
- onClose: o[0] || (o[0] = (y) => e.activeDrilldown = null),
933
- symbols: e.symbols,
934
- onSubmit: e.submitDrilldown
935
- }, null, 8, ["drilldown-remove", "drilldown-filter", "symbols", "onSubmit"])) : e.error && !e.loading ? (m(), Z(f, {
936
- key: 1,
937
- class: "chart-placeholder"
938
- }, {
939
- default: ie(() => [
940
- G(N(e.error), 1)
941
- ]),
942
- _: 1
943
- })) : e.results && e.ready && !e.loading ? (m(), Z(h, {
944
- key: 2,
945
- id: `${e.itemId}-${e.dashboardId}`,
946
- columns: e.results.headers,
947
- data: e.results.data,
948
- showControls: e.editMode,
949
- initialConfig: e.chartConfig || void 0,
950
- containerHeight: e.chartHeight,
951
- "container-width": e.chartWidth,
952
- onChartConfigChange: e.onChartConfigChange,
953
- chartSelection: e.chartSelection,
954
- chartTitle: e.chartTitle,
955
- "drilldown-active": e.hasDrilldown,
956
- onDimensionClick: e.handleDimensionClick,
957
- onBackgroundClick: e.handleBackgroundClick,
958
- onRefreshClick: e.handleLocalRefresh,
959
- onDrilldownClick: e.activateDrilldown,
960
- onRevertDrilldown: e.revertDrilldown
961
- }, null, 8, ["id", "columns", "data", "showControls", "initialConfig", "containerHeight", "container-width", "onChartConfigChange", "chartSelection", "chartTitle", "drilldown-active", "onDimensionClick", "onBackgroundClick", "onRefreshClick", "onDrilldownClick", "onRevertDrilldown"])) : R("", !0),
962
- e.loading && e.showLoading ? (m(), p("div", kn, [
963
- z(v, {
964
- startTime: e.startTime,
965
- text: "Loading"
966
- }, null, 8, ["startTime"])
967
- ])) : R("", !0),
968
- !e.editMode || !(e.results && e.ready) ? (m(), p("div", {
969
- key: 4,
970
- class: H(["controls-toggle", { "controls-visible": e.controlsVisible }])
971
- }, [
972
- t("button", {
973
- onClick: o[1] || (o[1] = (...y) => e.handleLocalRefresh && e.handleLocalRefresh(...y)),
974
- class: "control-btn",
975
- "data-testid": "refresh-chart-btn",
976
- title: "Refresh table"
977
- }, [...o[5] || (o[5] = [
978
- t("i", { class: "mdi mdi-refresh icon" }, null, -1)
979
- ])]),
980
- t("button", {
981
- onClick: o[2] || (o[2] = (...y) => e.revertDrilldown && e.revertDrilldown(...y)),
982
- class: "control-btn",
983
- "data-testid": "refresh-chart-btn",
984
- title: "Clear Drilldown"
985
- }, [...o[6] || (o[6] = [
986
- t("i", { class: "mdi mdi-undo icon" }, null, -1)
987
- ])])
988
- ], 2)) : R("", !0)
989
- ], 34);
990
- }
991
- const Dn = /* @__PURE__ */ ee(wn, [["render", In], ["__scopeId", "data-v-973d4802"]]), Sn = X({
992
- name: "DynamicMarkdownChart",
993
- components: {
994
- ErrorMessage: Le,
995
- LoadingView: De,
996
- MarkdownRenderer: ft
997
- },
998
- props: {
999
- dashboardId: {
1000
- type: String,
1001
- required: !0
1002
- },
1003
- itemId: {
1004
- type: String,
1005
- required: !0
1006
- },
1007
- getItemData: {
1008
- type: Function,
1009
- required: !0,
1010
- default: () => ({ type: "MARKDOWN", content: { markdown: "", query: "" } })
1011
- },
1012
- setItemData: {
1013
- type: Function,
1014
- required: !0,
1015
- default: () => ({ type: "MARKDOWN", content: { markdown: "", query: "" } })
1016
- },
1017
- editMode: {
1018
- type: Boolean,
1019
- required: !0
1020
- },
1021
- getDashboardQueryExecutor: {
1022
- type: Function,
1023
- required: !0
1024
- }
1025
- },
1026
- setup(e) {
1027
- const o = b(!1), n = b(null), a = b(null), i = b(!1), l = () => {
1028
- i.value = !0;
1029
- }, r = () => {
1030
- i.value = !1;
1031
- }, f = () => {
1032
- if (!n.value) return 0;
1033
- const x = n.value.getBoundingClientRect(), A = window.scrollY || document.documentElement.scrollTop, D = x.top + A, U = Math.floor(D / 200) * 10;
1034
- return Math.min(U, 100);
1035
- };
1036
- pe(() => {
1037
- setTimeout(() => {
1038
- const x = f();
1039
- g.value ? setTimeout(() => {
1040
- o.value = !0;
1041
- }, x) : o.value = !0;
1042
- }, 0);
1043
- });
1044
- const h = C(() => e.getItemData(e.itemId, e.dashboardId).structured_content || { markdown: "", query: "" }), v = C(() => h.value.markdown || ""), y = C(() => h.value.query || ""), g = C(() => e.getItemData(e.itemId, e.dashboardId).results || null), k = C(() => e.getItemData(e.itemId, e.dashboardId).loading || !1), T = C(() => e.getItemData(e.itemId, e.dashboardId).error || null), F = C(() => e.getItemData(e.itemId, e.dashboardId).loadStartTime || null), _ = C(() => e.getItemData(e.itemId, e.dashboardId).onRefresh || null), E = j("connectionStore"), M = j("analyticsStore");
1045
- if (!E)
1046
- throw new Error("Connection store not found!");
1047
- const I = async () => {
1048
- if (!y.value)
1049
- return;
1050
- const x = e.getDashboardQueryExecutor(e.dashboardId);
1051
- if (!x)
1052
- throw new Error("Dashboard query executor not found!");
1053
- try {
1054
- M && M.log("dashboard-markdown-execution", "MARKDOWN", !0), a.value && x.cancelQuery(a.value);
1055
- let A = await x.runSingle(e.itemId);
1056
- await x.waitForQuery(A);
1057
- } catch (A) {
1058
- console.error("Error setting up query:", A), a.value = null;
1059
- }
1060
- };
1061
- return {
1062
- chartContainer: n,
1063
- results: g,
1064
- ready: o,
1065
- loading: k,
1066
- error: T,
1067
- query: y,
1068
- markdown: v,
1069
- onRefresh: _,
1070
- handleLocalRefresh: () => {
1071
- _.value ? _.value(e.itemId) : I();
1072
- },
1073
- startTime: F,
1074
- controlsVisible: i,
1075
- onChartMouseEnter: l,
1076
- onChartMouseLeave: r
1077
- };
1078
- }
1079
- });
1080
- function Tn(e, o, n, a, i, l) {
1081
- const r = J("ErrorMessage"), f = J("MarkdownRenderer");
1082
- return m(), p("div", {
1083
- ref: "chartContainer",
1084
- class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1085
- onMouseenter: o[1] || (o[1] = (...h) => e.onChartMouseEnter && e.onChartMouseEnter(...h)),
1086
- onMouseleave: o[2] || (o[2] = (...h) => e.onChartMouseLeave && e.onChartMouseLeave(...h))
1087
- }, [
1088
- e.error && !e.loading ? (m(), Z(r, {
1089
- key: 0,
1090
- class: "chart-placeholder"
1091
- }, {
1092
- default: ie(() => [
1093
- G(N(e.error), 1)
1094
- ]),
1095
- _: 1
1096
- })) : e.ready ? (m(), Z(f, {
1097
- key: 1,
1098
- markdown: e.markdown,
1099
- results: e.results,
1100
- loading: e.loading
1101
- }, null, 8, ["markdown", "results", "loading"])) : R("", !0),
1102
- !e.loading && e.editMode ? (m(), p("div", {
1103
- key: 2,
1104
- class: H(["controls-toggle", { "controls-visible": e.controlsVisible }])
1105
- }, [
1106
- t("button", {
1107
- onClick: o[0] || (o[0] = (...h) => e.handleLocalRefresh && e.handleLocalRefresh(...h)),
1108
- class: "control-btn",
1109
- "data-testid": "refresh-chart-btn",
1110
- title: "Refresh text"
1111
- }, [...o[3] || (o[3] = [
1112
- t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1113
- ])])
1114
- ], 2)) : R("", !0)
1115
- ], 34);
1116
- }
1117
- const En = /* @__PURE__ */ ee(Sn, [["render", Tn], ["__scopeId", "data-v-b4abaf19"]]), $n = X({
1118
- name: "DashboardChart",
1119
- components: {
1120
- DataTable: vt,
1121
- ErrorMessage: Le,
1122
- LoadingView: De
1123
- },
1124
- props: {
1125
- dashboardId: {
1126
- type: String,
1127
- required: !0
1128
- },
1129
- itemId: {
1130
- type: String,
1131
- required: !0
1132
- },
1133
- getItemData: {
1134
- type: Function,
1135
- required: !0,
1136
- default: () => ({ type: "CHART", content: "" })
1137
- },
1138
- setItemData: {
1139
- type: Function,
1140
- required: !0,
1141
- default: () => ({ type: "CHART", content: "" })
1142
- },
1143
- editMode: {
1144
- type: Boolean,
1145
- required: !0
1146
- },
1147
- getDashboardQueryExecutor: {
1148
- type: Function,
1149
- required: !0
1150
- }
1151
- },
1152
- setup(e, { emit: o }) {
1153
- const n = b(!1), a = b(null), i = b(null), l = b(!1), r = b(null), f = b(!1), h = () => {
1154
- f.value = !0;
1155
- }, v = () => {
1156
- f.value = !1;
1157
- }, y = () => {
1158
- if (!a.value) return 0;
1159
- const d = a.value.getBoundingClientRect(), S = window.scrollY || document.documentElement.scrollTop, L = d.top + S, Q = Math.floor(L / 200) * 10;
1160
- return Math.min(Q, 100);
1161
- };
1162
- pe(() => {
1163
- setTimeout(() => {
1164
- const d = y();
1165
- k.value ? setTimeout(() => {
1166
- n.value = !0;
1167
- }, d) : n.value = !0;
1168
- }, 0);
1169
- }), $e(() => {
1170
- r.value && (clearTimeout(r.value), r.value = null);
1171
- });
1172
- const g = C(() => e.getItemData(e.itemId, e.dashboardId).content), k = C(() => e.getItemData(e.itemId, e.dashboardId).results || null), T = C(() => e.getItemData(e.itemId, e.dashboardId).loading || !1), F = C(() => e.getItemData(e.itemId, e.dashboardId).error || null), _ = C(() => e.getItemData(e.itemId, e.dashboardId).loadStartTime || null), E = C(() => (e.getItemData(e.itemId, e.dashboardId).height || 300) - 75), M = C(() => (e.getItemData(e.itemId, e.dashboardId).width || 300) - 100), I = C(() => e.getItemData(e.itemId, e.dashboardId).chartConfig || null), B = C(() => e.getItemData(e.itemId, e.dashboardId).onRefresh || null);
1173
- ne(
1174
- T,
1175
- (d, S) => {
1176
- r.value && (clearTimeout(r.value), r.value = null), d ? r.value = setTimeout(() => {
1177
- l.value = !0, r.value = null;
1178
- }, 150) : l.value = !1;
1179
- },
1180
- { immediate: !0 }
1181
- );
1182
- const x = j("connectionStore"), A = j("analyticsStore");
1183
- if (!x)
1184
- throw new Error("Connection store not found!");
1185
- const D = async () => {
1186
- if (!g.value) return;
1187
- const d = e.getDashboardQueryExecutor(e.dashboardId);
1188
- if (!d)
1189
- throw new Error("Dashboard query executor not found!");
1190
- try {
1191
- A && A.log("dashboard-table-execution", "TABLE", !0), i.value && d.cancelQuery(i.value);
1192
- let S = await d.runSingle(e.itemId);
1193
- await d.waitForQuery(S);
1194
- } catch (S) {
1195
- console.error("Error setting up query:", S), i.value = null;
1196
- }
1197
- };
1198
- return {
1199
- chartContainer: a,
1200
- results: k,
1201
- ready: n,
1202
- loading: T,
1203
- showLoading: l,
1204
- error: F,
1205
- query: g,
1206
- chartHeight: E,
1207
- chartWidth: M,
1208
- chartConfig: I,
1209
- onRefresh: B,
1210
- handleLocalRefresh: () => {
1211
- B.value ? B.value(e.itemId) : D();
1212
- },
1213
- startTime: _,
1214
- handleDimensionClick: (d) => {
1215
- o("dimension-click", {
1216
- source: e.itemId,
1217
- filters: d.filters,
1218
- chart: d.chart,
1219
- append: d.append
1220
- });
1221
- },
1222
- handleBackgroundClick: () => {
1223
- o("background-click");
1224
- },
1225
- controlsVisible: f,
1226
- onChartMouseEnter: h,
1227
- onChartMouseLeave: v
1228
- };
1229
- }
1230
- }), Ln = {
1231
- key: 2,
1232
- class: "loading-overlay"
1233
- };
1234
- function Mn(e, o, n, a, i, l) {
1235
- const r = J("ErrorMessage"), f = J("data-table"), h = J("LoadingView");
1236
- return m(), p("div", {
1237
- ref: "chartContainer",
1238
- class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1239
- onMouseenter: o[1] || (o[1] = (...v) => e.onChartMouseEnter && e.onChartMouseEnter(...v)),
1240
- onMouseleave: o[2] || (o[2] = (...v) => e.onChartMouseLeave && e.onChartMouseLeave(...v))
1241
- }, [
1242
- e.error && !e.loading ? (m(), Z(r, {
1243
- key: 0,
1244
- class: "chart-placeholder"
1245
- }, {
1246
- default: ie(() => [
1247
- G(N(e.error), 1)
1248
- ]),
1249
- _: 1
1250
- })) : e.ready && e.results ? (m(), Z(f, {
1251
- key: 1,
1252
- id: `${e.itemId}-${e.dashboardId}`,
1253
- headers: e.results.headers,
1254
- results: e.results.data,
1255
- containerHeight: e.chartHeight,
1256
- prettyPrint: !0,
1257
- fitParent: !0,
1258
- onCellClick: e.handleDimensionClick,
1259
- onBackgroundClick: e.handleBackgroundClick
1260
- }, null, 8, ["id", "headers", "results", "containerHeight", "onCellClick", "onBackgroundClick"])) : R("", !0),
1261
- e.loading && e.showLoading ? (m(), p("div", Ln, [
1262
- z(h, {
1263
- startTime: e.startTime,
1264
- text: "Loading"
1265
- }, null, 8, ["startTime"])
1266
- ])) : R("", !0),
1267
- !e.loading && e.editMode ? (m(), p("div", {
1268
- key: 3,
1269
- class: H(["controls-toggle", { "controls-visible": e.controlsVisible }])
1270
- }, [
1271
- t("button", {
1272
- onClick: o[0] || (o[0] = (...v) => e.handleLocalRefresh && e.handleLocalRefresh(...v)),
1273
- class: "control-btn",
1274
- "data-testid": "refresh-chart-btn",
1275
- title: "Refresh table"
1276
- }, [...o[3] || (o[3] = [
1277
- t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1278
- ])])
1279
- ], 2)) : R("", !0)
1280
- ], 34);
1281
- }
1282
- const qn = /* @__PURE__ */ ee($n, [["render", Mn], ["__scopeId", "data-v-fcabd793"]]), An = {
1283
- data() {
1284
- return {
1285
- selectedValue: "",
1286
- selectedLabel: "",
1287
- searchText: "",
1288
- showDropdown: !1,
1289
- inputElement: null
1290
- };
1291
- },
1292
- props: {
1293
- headers: {
1294
- type: Map,
1295
- required: !0
1296
- },
1297
- results: {
1298
- type: Array,
1299
- required: !0
1300
- },
1301
- containerHeight: Number,
1302
- cellClick: {
1303
- type: Function,
1304
- default: () => {
1305
- }
1306
- },
1307
- backgroundClick: {
1308
- type: Function,
1309
- default: () => {
1310
- }
1311
- },
1312
- prettyPrint: {
1313
- type: Boolean,
1314
- default: !1
1315
- },
1316
- fitParent: {
1317
- type: Boolean,
1318
- default: !1
1319
- }
1320
- },
1321
- setup() {
1322
- const e = j("userSettingsStore");
1323
- if (!e)
1324
- throw new Error("userSettingsStore not provided");
1325
- const o = C(() => e.settings.theme);
1326
- return {
1327
- settingsStore: e,
1328
- currentTheme: o
1329
- };
1330
- },
1331
- computed: {
1332
- headersArray() {
1333
- return Array.from(this.headers.values());
1334
- },
1335
- firstColumn() {
1336
- return this.headersArray[0] || null;
1337
- },
1338
- secondColumn() {
1339
- return this.headersArray[1] || null;
1340
- },
1341
- displayColumn() {
1342
- return this.firstColumn;
1343
- },
1344
- valueColumn() {
1345
- return this.secondColumn || this.firstColumn;
1346
- },
1347
- selectOptions() {
1348
- if (!this.displayColumn || !this.valueColumn || !this.results || this.results.length === 0)
1349
- return [];
1350
- const e = this.displayColumn.name, o = this.valueColumn.name, n = [];
1351
- return this.results.forEach((a) => {
1352
- const i = a[e], l = a[o];
1353
- if (i != null && l !== null && l !== void 0) {
1354
- const r = this.formatValue(i, this.displayColumn);
1355
- n.push({
1356
- label: r,
1357
- value: l
1358
- });
1359
- }
1360
- }), n;
1361
- },
1362
- filteredOptions() {
1363
- if (!this.searchText)
1364
- return this.selectOptions;
1365
- const e = this.searchText.toLowerCase();
1366
- return this.selectOptions.filter((o) => o.label.toLowerCase().includes(e));
1367
- },
1368
- placeholderText() {
1369
- var e;
1370
- return this.hasSelection ? this.selectedLabel || "Type to search..." : !this.selectOptions || this.selectOptions.length === 0 ? "No data available" : this.firstColumn ? `Select ${(e = this.firstColumn) == null ? void 0 : e.name}` : "Select an option";
1371
- },
1372
- hasSelection() {
1373
- return !!(this.selectedLabel && this.selectedValue);
1374
- },
1375
- fieldLabel() {
1376
- var e;
1377
- return ((e = this.firstColumn) == null ? void 0 : e.name) || "Field";
1378
- },
1379
- dropdownStyle() {
1380
- if (!this.inputElement)
1381
- return {};
1382
- const e = this.inputElement.getBoundingClientRect();
1383
- return {
1384
- position: "fixed",
1385
- top: `${e.bottom}px`,
1386
- left: `${e.left}px`,
1387
- width: `${e.width}px`
1388
- };
1389
- }
1390
- },
1391
- mounted() {
1392
- this.selectedLabel && !this.searchText && (this.searchText = this.selectedLabel);
1393
- },
1394
- watch: {
1395
- // Watch for external changes to selectedLabel and update searchText accordingly
1396
- selectedLabel(e) {
1397
- e && !this.showDropdown && (this.searchText = e);
1398
- }
1399
- },
1400
- methods: {
1401
- formatValue(e, o) {
1402
- var n, a;
1403
- switch (o.type) {
1404
- case de.FLOAT:
1405
- return (n = o.traits) != null && n.includes("usd") ? `$${Number(e).toFixed(o.scale || 2)}` : (a = o.traits) != null && a.includes("percent") ? `${(Number(e) * 100).toFixed(2)}%` : Number(e).toFixed(o.scale || 2);
1406
- case de.DATETIME:
1407
- case de.TIMESTAMP:
1408
- case de.DATE:
1409
- case de.TIME:
1410
- return e instanceof Date ? e.toLocaleString() : String(e);
1411
- case de.BOOLEAN:
1412
- return e ? "✓" : "✗";
1413
- case de.ARRAY:
1414
- case de.STRUCT:
1415
- return JSON.stringify(e);
1416
- default:
1417
- return String(e);
1418
- }
1419
- },
1420
- highlightMatch(e) {
1421
- if (!this.searchText)
1422
- return e;
1423
- const o = this.searchText.toLowerCase(), a = e.toLowerCase().indexOf(o);
1424
- if (a === -1)
1425
- return e;
1426
- const i = e.slice(0, a), l = e.slice(a, a + this.searchText.length), r = e.slice(a + this.searchText.length);
1427
- return `${i}<mark>${l}</mark>${r}`;
1428
- },
1429
- selectOption(e) {
1430
- this.selectedValue = e.value, this.selectedLabel = e.label, this.searchText = e.label, this.showDropdown = !1, this.handleSelection();
1431
- },
1432
- selectAll() {
1433
- this.selectedValue = "", this.selectedLabel = "", this.searchText = "", this.showDropdown = !1, this.$emit("background-click"), this.backgroundClick();
1434
- },
1435
- onSearchInput() {
1436
- this.searchText !== this.selectedLabel && this.selectedLabel && (this.selectedValue = "", this.selectedLabel = ""), this.showDropdown = !0, this.updateInputElement();
1437
- },
1438
- handleFocus() {
1439
- this.searchText = "", this.showDropdown = !0, this.updateInputElement();
1440
- },
1441
- updateInputElement() {
1442
- this.inputElement = this.$refs.searchInput;
1443
- },
1444
- handleBlur() {
1445
- setTimeout(() => {
1446
- this.showDropdown = !1, this.selectedLabel && !this.searchText && (this.searchText = this.selectedLabel);
1447
- }, 200);
1448
- },
1449
- handleSelection() {
1450
- if (!this.valueColumn || !this.selectedValue)
1451
- return;
1452
- const e = this.valueColumn.address || this.valueColumn.name;
1453
- this.$emit("cell-click", {
1454
- filters: { [e]: this.selectedValue },
1455
- append: !1
1456
- });
1457
- }
1458
- }
1459
- }, Rn = { class: "result-select row pa-0 ba-0" }, Fn = { class: "select-container" }, xn = { class: "search-input-wrapper" }, Qn = {
1460
- key: 0,
1461
- class: "inline-label"
1462
- }, Vn = ["placeholder", "disabled"], Bn = ["onMousedown", "innerHTML"];
1463
- function On(e, o, n, a, i, l) {
1464
- return m(), p("div", Rn, [
1465
- t("div", Fn, [
1466
- t("div", xn, [
1467
- l.hasSelection ? (m(), p("span", Qn, N(l.fieldLabel) + ": ", 1)) : R("", !0),
1468
- te(t("input", {
1469
- ref: "searchInput",
1470
- "onUpdate:modelValue": o[0] || (o[0] = (r) => i.searchText = r),
1471
- type: "text",
1472
- class: H(["search-input", { "has-inline-label": l.hasSelection }]),
1473
- placeholder: l.placeholderText,
1474
- disabled: !l.selectOptions || l.selectOptions.length === 0,
1475
- onFocus: o[1] || (o[1] = (...r) => l.handleFocus && l.handleFocus(...r)),
1476
- onInput: o[2] || (o[2] = (...r) => l.onSearchInput && l.onSearchInput(...r)),
1477
- onBlur: o[3] || (o[3] = (...r) => l.handleBlur && l.handleBlur(...r))
1478
- }, null, 42, Vn), [
1479
- [ye, i.searchText]
1480
- ]),
1481
- o[5] || (o[5] = t("span", { class: "search-icon" }, [
1482
- t("svg", {
1483
- xmlns: "http://www.w3.org/2000/svg",
1484
- viewBox: "0 0 24 24",
1485
- fill: "none",
1486
- stroke: "currentColor",
1487
- "stroke-width": "2",
1488
- "stroke-linecap": "round",
1489
- "stroke-linejoin": "round"
1490
- }, [
1491
- t("circle", {
1492
- cx: "11",
1493
- cy: "11",
1494
- r: "8"
1495
- }),
1496
- t("path", { d: "m21 21-4.35-4.35" })
1497
- ])
1498
- ], -1))
1499
- ]),
1500
- (m(), Z(Ue, { to: "body" }, [
1501
- i.showDropdown && l.filteredOptions.length > 0 ? (m(), p("div", {
1502
- key: 0,
1503
- class: "dropdown-list",
1504
- style: Ie(l.dropdownStyle)
1505
- }, [
1506
- t("div", {
1507
- class: H(["dropdown-item select-all", { selected: !i.selectedValue }]),
1508
- onMousedown: o[4] || (o[4] = Pe((...r) => l.selectAll && l.selectAll(...r), ["prevent"]))
1509
- }, " Select All ", 34),
1510
- (m(!0), p(ce, null, we(l.filteredOptions, (r, f) => (m(), p("div", {
1511
- key: f,
1512
- class: H(["dropdown-item", { selected: i.selectedValue === r.value }]),
1513
- onMousedown: Pe((h) => l.selectOption(r), ["prevent"]),
1514
- innerHTML: l.highlightMatch(r.label)
1515
- }, null, 42, Bn))), 128))
1516
- ], 4)) : R("", !0),
1517
- i.showDropdown && i.searchText && l.filteredOptions.length === 0 ? (m(), p("div", {
1518
- key: 1,
1519
- class: "dropdown-list",
1520
- style: Ie(l.dropdownStyle)
1521
- }, [...o[6] || (o[6] = [
1522
- t("div", { class: "dropdown-item no-results" }, "No matches found", -1)
1523
- ])], 4)) : R("", !0)
1524
- ]))
1525
- ])
1526
- ]);
1527
- }
1528
- const Hn = /* @__PURE__ */ ee(An, [["render", On], ["__scopeId", "data-v-db5bbc35"]]), Pn = X({
1529
- name: "DashboardChart",
1530
- components: {
1531
- DashboardDataSelector: Hn,
1532
- ErrorMessage: Le,
1533
- LoadingView: De
1534
- },
1535
- props: {
1536
- dashboardId: {
1537
- type: String,
1538
- required: !0
1539
- },
1540
- itemId: {
1541
- type: String,
1542
- required: !0
1543
- },
1544
- getItemData: {
1545
- type: Function,
1546
- required: !0,
1547
- default: () => ({ type: "CHART", content: "" })
1548
- },
1549
- setItemData: {
1550
- type: Function,
1551
- required: !0,
1552
- default: () => ({ type: "CHART", content: "" })
1553
- },
1554
- editMode: {
1555
- type: Boolean,
1556
- required: !0
1557
- },
1558
- getDashboardQueryExecutor: {
1559
- type: Function,
1560
- required: !0
1561
- }
1562
- },
1563
- setup(e, { emit: o }) {
1564
- const n = b(!1), a = b(null), i = b(null), l = b(!1), r = b(null), f = b(!1), h = () => {
1565
- f.value = !0;
1566
- }, v = () => {
1567
- f.value = !1;
1568
- }, y = () => {
1569
- if (!a.value) return 0;
1570
- const d = a.value.getBoundingClientRect(), S = window.scrollY || document.documentElement.scrollTop, L = d.top + S, Q = Math.floor(L / 200) * 10;
1571
- return Math.min(Q, 100);
1572
- };
1573
- pe(() => {
1574
- setTimeout(() => {
1575
- const d = y();
1576
- k.value ? setTimeout(() => {
1577
- n.value = !0;
1578
- }, d) : n.value = !0;
1579
- }, 0);
1580
- }), $e(() => {
1581
- r.value && (clearTimeout(r.value), r.value = null);
1582
- });
1583
- const g = C(() => e.getItemData(e.itemId, e.dashboardId).content), k = C(() => e.getItemData(e.itemId, e.dashboardId).results || null), T = C(() => e.getItemData(e.itemId, e.dashboardId).loading || !1), F = C(() => e.getItemData(e.itemId, e.dashboardId).error || null), _ = C(() => e.getItemData(e.itemId, e.dashboardId).loadStartTime || null), E = C(() => (e.getItemData(e.itemId, e.dashboardId).height || 300) - 75), M = C(() => (e.getItemData(e.itemId, e.dashboardId).width || 300) - 100), I = C(() => e.getItemData(e.itemId, e.dashboardId).chartConfig || null), B = C(() => e.getItemData(e.itemId, e.dashboardId).onRefresh || null);
1584
- ne(
1585
- T,
1586
- (d, S) => {
1587
- r.value && (clearTimeout(r.value), r.value = null), d ? r.value = setTimeout(() => {
1588
- l.value = !0, r.value = null;
1589
- }, 150) : l.value = !1;
1590
- },
1591
- { immediate: !0 }
1592
- );
1593
- const x = j("connectionStore"), A = j("analyticsStore");
1594
- if (!x)
1595
- throw new Error("Connection store not found!");
1596
- const D = async () => {
1597
- if (!g.value) return;
1598
- const d = e.getDashboardQueryExecutor(e.dashboardId);
1599
- if (!d)
1600
- throw new Error("Dashboard query executor not found!");
1601
- try {
1602
- A && A.log("dashboard-table-execution", "TABLE", !0), i.value && d.cancelQuery(i.value);
1603
- let S = await d.runSingle(e.itemId);
1604
- await d.waitForQuery(S);
1605
- } catch (S) {
1606
- console.error("Error setting up query:", S), i.value = null;
1607
- }
1608
- };
1609
- return {
1610
- chartContainer: a,
1611
- results: k,
1612
- ready: n,
1613
- loading: T,
1614
- showLoading: l,
1615
- error: F,
1616
- query: g,
1617
- chartHeight: E,
1618
- chartWidth: M,
1619
- chartConfig: I,
1620
- onRefresh: B,
1621
- handleLocalRefresh: () => {
1622
- B.value ? B.value(e.itemId) : D();
1623
- },
1624
- startTime: _,
1625
- handleDimensionClick: (d) => {
1626
- o("dimension-click", {
1627
- source: e.itemId,
1628
- filters: d.filters,
1629
- chart: d.chart,
1630
- append: d.append
1631
- });
1632
- },
1633
- handleBackgroundClick: () => {
1634
- o("background-click");
1635
- },
1636
- controlsVisible: f,
1637
- onChartMouseEnter: h,
1638
- onChartMouseLeave: v
1639
- };
1640
- }
1641
- }), Nn = {
1642
- key: 2,
1643
- class: "loading-overlay"
1644
- };
1645
- function Kn(e, o, n, a, i, l) {
1646
- const r = J("ErrorMessage"), f = J("dashboard-data-selector"), h = J("LoadingView");
1647
- return m(), p("div", {
1648
- ref: "chartContainer",
1649
- class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1650
- onMouseenter: o[0] || (o[0] = (...v) => e.onChartMouseEnter && e.onChartMouseEnter(...v)),
1651
- onMouseleave: o[1] || (o[1] = (...v) => e.onChartMouseLeave && e.onChartMouseLeave(...v))
1652
- }, [
1653
- e.error && !e.loading ? (m(), Z(r, {
1654
- key: 0,
1655
- class: "chart-placeholder"
1656
- }, {
1657
- default: ie(() => [
1658
- G(N(e.error), 1)
1659
- ]),
1660
- _: 1
1661
- })) : e.ready && e.results ? (m(), Z(f, {
1662
- key: 1,
1663
- id: `${e.itemId}-${e.dashboardId}`,
1664
- headers: e.results.headers,
1665
- results: e.results.data,
1666
- containerHeight: e.chartHeight,
1667
- prettyPrint: !0,
1668
- fitParent: !0,
1669
- onCellClick: e.handleDimensionClick,
1670
- onBackgroundClick: e.handleBackgroundClick
1671
- }, null, 8, ["id", "headers", "results", "containerHeight", "onCellClick", "onBackgroundClick"])) : R("", !0),
1672
- e.loading && e.showLoading ? (m(), p("div", Nn, [
1673
- z(h, {
1674
- startTime: e.startTime,
1675
- text: "Loading"
1676
- }, null, 8, ["startTime"])
1677
- ])) : R("", !0)
1678
- ], 34);
1679
- }
1680
- const _n = /* @__PURE__ */ ee(Pn, [["render", Kn], ["__scopeId", "data-v-2e938e5d"]]), Wn = ["data-testid"], Un = ["data-testid"], jn = ["data-testid"], zn = ["data-testid"], Gn = ["data-testid", "title"], Yn = {
1681
- key: 0,
1682
- class: "mdi mdi-filter-remove-outline icon"
1683
- }, Jn = {
1684
- key: 1,
1685
- class: "mdi mdi-filter-outline icon"
1686
- }, Zn = ["data-testid"], Xn = ["data-testid"], eo = { class: "item-title-container no-drag" }, to = ["id", "placeholder"], no = { class: "content-area" }, oo = {
1687
- key: 2,
1688
- class: "filters-overlay"
1689
- }, io = {
1690
- key: 0,
1691
- class: "filters-container edit-mode"
1692
- }, ro = ["title"], lo = { class: "filter-content" }, ao = { class: "filter-source" }, so = { class: "filter-value" }, uo = ["onClick"], co = {
1693
- key: 0,
1694
- class: "filters-container view-mode"
1695
- }, mo = {
1696
- key: 0,
1697
- class: "filter-summary"
1698
- }, ho = {
1699
- key: 1,
1700
- class: "filter-details"
1701
- }, fo = ["title"], vo = { class: "filter-content" }, yo = { class: "filter-source" }, po = { class: "filter-value" }, go = ["onClick", "title"], bo = /* @__PURE__ */ X({
1702
- __name: "DashboardGridItem",
1703
- props: {
1704
- dashboardId: {},
1705
- item: {},
1706
- editMode: { type: Boolean },
1707
- symbols: {},
1708
- getItemData: { type: Function },
1709
- getDashboardQueryExecutor: { type: Function },
1710
- setItemData: { type: Function }
1711
- },
1712
- emits: ["edit-content", "update-dimensions", "dimension-click", "background-click", "remove-filter", "remove-item", "copy-item"],
1713
- setup(e, { emit: o }) {
1714
- const n = e, a = o, i = b(!1), l = b(""), r = b(!1), f = b(!1);
1715
- function h(S) {
1716
- return S.replace(/'''/g, "'").replace("local.", "");
1717
- }
1718
- function v(S, L = 1e3) {
1719
- const Q = h(S);
1720
- return Q.length <= L ? Q : Q.substring(0, L) + "...";
1721
- }
1722
- function y() {
1723
- if (!n.editMode) return;
1724
- const S = n.getItemData(n.item.i, n.dashboardId);
1725
- i.value = !0, l.value = S.name, setTimeout(() => {
1726
- const L = document.getElementById(`title-input-${n.item.i}`);
1727
- L && L.focus();
1728
- }, 0);
1729
- }
1730
- function g() {
1731
- if (i.value) {
1732
- const S = n.getItemData(n.item.i, n.dashboardId), L = l.value.trim() || S.name;
1733
- n.setItemData(n.item.i, n.dashboardId, { name: L }), i.value = !1;
1734
- }
1735
- }
1736
- function k() {
1737
- const L = !n.getItemData(n.item.i, n.dashboardId).allowCrossFilter;
1738
- n.setItemData(n.item.i, n.dashboardId, {
1739
- allowCrossFilter: L
1740
- });
1741
- }
1742
- function T() {
1743
- const S = n.item.h + 1;
1744
- n.setItemData(n.item.i, n.dashboardId, {
1745
- dimensions: {
1746
- width: n.item.w,
1747
- height: S
1748
- }
1749
- });
1750
- }
1751
- function F() {
1752
- const S = Math.max(1, n.item.h - 1);
1753
- n.setItemData(n.item.i, n.dashboardId, {
1754
- dimensions: {
1755
- width: n.item.w,
1756
- height: S
1757
- }
1758
- });
1759
- }
1760
- function _() {
1761
- i.value = !1;
1762
- }
1763
- function E() {
1764
- a("edit-content", n.item);
1765
- }
1766
- function M() {
1767
- confirm(`Are you sure you want to remove "${D.value.name}"?`) && a("remove-item", n.item.i);
1768
- }
1769
- function I() {
1770
- a("copy-item", n.item.i);
1771
- }
1772
- function B(S) {
1773
- a("dimension-click", S);
1774
- }
1775
- function x() {
1776
- a("background-click", n.item.i);
1777
- }
1778
- function A(S) {
1779
- a("remove-filter", n.item.i, S);
1780
- }
1781
- const D = C(() => n.getItemData(n.item.i, n.dashboardId)), U = C(() => {
1782
- switch (D.value.type) {
1783
- case $.CHART:
1784
- return Dn;
1785
- case $.TABLE:
1786
- return qn;
1787
- case $.FILTER:
1788
- return _n;
1789
- case $.MARKDOWN:
1790
- default:
1791
- return En;
1792
- }
1793
- }), w = C(() => {
1794
- switch (D.value.type) {
1795
- case $.CHART:
1796
- return "Chart Name";
1797
- case $.TABLE:
1798
- return "Table Name";
1799
- case $.FILTER:
1800
- return "Filter Name";
1801
- case $.MARKDOWN:
1802
- default:
1803
- return "Note Name";
1804
- }
1805
- }), u = C(() => [$.CHART, $.TABLE, $.MARKDOWN].includes(D.value.type)), d = C(() => D.value.filters ? D.value.filters.length : 0);
1806
- return (S, L) => (m(), p("div", {
1807
- class: H(["grid-item-content", {
1808
- "grid-item-chart-style": [Y($).CHART, Y($).TABLE, Y($).FILTER].includes(
1809
- //@ts-ignore
1810
- D.value.type
1811
- ),
1812
- "grid-item-edit-style": e.editMode
1813
- }]),
1814
- "data-testid": `dashboard-component-${e.item.i}`,
1815
- onMouseenter: L[1] || (L[1] = () => {
1816
- r.value = !0, f.value = !0;
1817
- }),
1818
- onMouseleave: L[2] || (L[2] = () => {
1819
- r.value = !1, f.value = !1;
1820
- })
1821
- }, [
1822
- e.editMode ? (m(), p("div", {
1823
- key: 0,
1824
- class: H(["header-controls", { "header-visible": r.value || i.value }]),
1825
- "data-testid": "dashboard-item-header-controls"
1826
- }, [
1827
- t("button", {
1828
- onClick: T,
1829
- class: "control-btn",
1830
- "data-testid": `increase-height-item-${e.item.i}`,
1831
- title: "Increase height"
1832
- }, [...L[3] || (L[3] = [
1833
- t("i", { class: "mdi mdi-plus icon" }, null, -1)
1834
- ])], 8, Un),
1835
- t("button", {
1836
- onClick: F,
1837
- class: "control-btn",
1838
- "data-testid": `decrease-height-item-${e.item.i}`,
1839
- title: "Decrease height"
1840
- }, [...L[4] || (L[4] = [
1841
- t("i", { class: "mdi mdi-minus icon" }, null, -1)
1842
- ])], 8, jn),
1843
- t("button", {
1844
- onClick: E,
1845
- class: "control-btn",
1846
- "data-testid": `edit-dashboard-item-content-${e.item.i}`,
1847
- title: "Edit data"
1848
- }, [...L[5] || (L[5] = [
1849
- t("i", { class: "mdi mdi-database-edit-outline icon" }, null, -1)
1850
- ])], 8, zn),
1851
- t("button", {
1852
- onClick: k,
1853
- class: "control-btn",
1854
- "data-testid": `toggle-crossfilter-item-content-${e.item.i}`,
1855
- title: D.value.allowCrossFilter ? "Toggle cross-filtering OFF" : "Toggle cross-filtering ON"
1856
- }, [
1857
- D.value.allowCrossFilter ? (m(), p("i", Yn)) : (m(), p("i", Jn))
1858
- ], 8, Gn),
1859
- t("button", {
1860
- onClick: I,
1861
- class: "control-btn",
1862
- "data-testid": `copy-dashboard-item-${e.item.i}`,
1863
- title: "Copy item"
1864
- }, [...L[6] || (L[6] = [
1865
- t("i", { class: "mdi mdi-content-copy icon" }, null, -1)
1866
- ])], 8, Zn),
1867
- t("button", {
1868
- onClick: M,
1869
- class: "control-btn remove-btn",
1870
- "data-testid": `remove-dashboard-item-${e.item.i}`,
1871
- title: "Remove item"
1872
- }, [...L[7] || (L[7] = [
1873
- t("i", { class: "mdi mdi-delete-outline icon" }, null, -1)
1874
- ])], 8, Xn)
1875
- ], 2)) : R("", !0),
1876
- e.editMode ? (m(), p("div", {
1877
- key: 1,
1878
- class: H(["grid-item-header overlay-header", { "header-visible": r.value || i.value }])
1879
- }, [
1880
- L[9] || (L[9] = rt('<div class="drag-handle-icon grid-item-drag-handle" data-v-b6ccdc8d><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="drag-handle-svg" data-v-b6ccdc8d><line x1="3" y1="12" x2="21" y2="12" data-v-b6ccdc8d></line><line x1="3" y1="6" x2="21" y2="6" data-v-b6ccdc8d></line><line x1="3" y1="18" x2="21" y2="18" data-v-b6ccdc8d></line></svg></div>', 1)),
1881
- t("div", eo, [
1882
- i.value ? te((m(), p("input", {
1883
- key: 1,
1884
- id: `title-input-${e.item.i}`,
1885
- "onUpdate:modelValue": L[0] || (L[0] = (Q) => l.value = Q),
1886
- onBlur: g,
1887
- onKeyup: [
1888
- Ce(g, ["enter"]),
1889
- Ce(_, ["esc"])
1890
- ],
1891
- class: "title-input",
1892
- type: "text",
1893
- placeholder: w.value
1894
- }, null, 40, to)), [
1895
- [ye, l.value]
1896
- ]) : (m(), p("div", {
1897
- key: 0,
1898
- class: "item-title editable-title",
1899
- onClick: y
1900
- }, [
1901
- G(N(D.value.name) + " ", 1),
1902
- L[8] || (L[8] = t("span", { class: "edit-indicator" }, "✎", -1))
1903
- ]))
1904
- ])
1905
- ], 2)) : R("", !0),
1906
- t("div", no, [
1907
- (m(), Z(lt(U.value), {
1908
- dashboardId: n.dashboardId,
1909
- itemId: e.item.i,
1910
- setItemData: e.setItemData,
1911
- getItemData: e.getItemData,
1912
- getDashboardQueryExecutor: e.getDashboardQueryExecutor,
1913
- editMode: e.editMode,
1914
- symbols: n.symbols || [],
1915
- onDimensionClick: B,
1916
- onBackgroundClick: x
1917
- }, null, 40, ["dashboardId", "itemId", "setItemData", "getItemData", "getDashboardQueryExecutor", "editMode", "symbols"]))
1918
- ]),
1919
- u.value ? (m(), p("div", oo, [
1920
- e.editMode ? (m(), p("div", io, [
1921
- (m(!0), p(ce, null, we(D.value.filters, (Q, K) => (m(), p("div", {
1922
- class: "filter-tag",
1923
- key: `${Q.source}-${Q.value}-${K}`,
1924
- title: h(Q.value)
1925
- }, [
1926
- t("span", lo, [
1927
- t("span", ao, N(Q.source === "global" ? Q.source : "cross") + ": ", 1),
1928
- t("span", so, N(v(Q.value)), 1)
1929
- ]),
1930
- Q.source !== "global" ? (m(), p("button", {
1931
- key: 0,
1932
- class: "filter-remove-btn",
1933
- onClick: (me) => A(Q.source),
1934
- title: "Remove filter"
1935
- }, " × ", 8, uo)) : R("", !0)
1936
- ], 8, ro))), 128))
1937
- ])) : (m(), p(ce, { key: 1 }, [
1938
- d.value > 0 ? (m(), p("div", co, [
1939
- f.value ? R("", !0) : (m(), p("div", mo, [...L[10] || (L[10] = [
1940
- t("i", { class: "mdi mdi-filter-outline filter-icon" }, null, -1)
1941
- ])])),
1942
- f.value ? (m(), p("div", ho, [
1943
- (m(!0), p(ce, null, we(D.value.filters, (Q, K) => (m(), p("div", {
1944
- class: "filter-tag",
1945
- key: `${Q.source}-${Q.value}-${K}`,
1946
- title: h(Q.value)
1947
- }, [
1948
- t("span", vo, [
1949
- t("span", yo, N(Q.source === "global" ? Q.source : "cross") + ": ", 1),
1950
- t("span", po, N(v(Q.value)), 1)
1951
- ]),
1952
- Q.source !== "global" ? (m(), p("button", {
1953
- key: 0,
1954
- class: "filter-remove-btn",
1955
- onClick: (me) => A(Q.source),
1956
- title: `Remove ${Q.source} filter`
1957
- }, " × ", 8, go)) : R("", !0)
1958
- ], 8, fo))), 128))
1959
- ])) : R("", !0)
1960
- ])) : R("", !0)
1961
- ], 64))
1962
- ])) : R("", !0)
1963
- ], 42, Wn));
1964
- }
1965
- }), gi = /* @__PURE__ */ ee(bo, [["__scopeId", "data-v-b6ccdc8d"]]), Co = { class: "editor-overlay" }, wo = { class: "add-item-modal" }, ko = { class: "item-type-selector" }, Io = ["value"], Do = ["value"], So = ["value"], To = ["value"], Eo = /* @__PURE__ */ X({
1966
- __name: "DashboardAddItemModal",
1967
- props: {
1968
- show: { type: Boolean }
1969
- },
1970
- emits: ["add", "close"],
1971
- setup(e, { emit: o }) {
1972
- const n = e, a = o, i = b($.CHART);
1973
- function l() {
1974
- a("add", i.value);
1975
- }
1976
- function r() {
1977
- a("close");
1978
- }
1979
- function f(h) {
1980
- const v = document.querySelector(".content-editor");
1981
- v && !v.contains(h.target) && n.show && a("close");
1982
- }
1983
- return pe(() => {
1984
- Ae(() => {
1985
- document.addEventListener("click", f);
1986
- });
1987
- }), $e(() => {
1988
- document.removeEventListener("click", f);
1989
- }), (h, v) => e.show ? (m(), Z(Ue, {
1990
- key: 0,
1991
- to: "body"
1992
- }, [
1993
- t("div", Co, [
1994
- t("div", wo, [
1995
- v[8] || (v[8] = t("h3", null, "Add New Item", -1)),
1996
- t("div", ko, [
1997
- t("label", null, [
1998
- te(t("input", {
1999
- type: "radio",
2000
- "onUpdate:modelValue": v[0] || (v[0] = (y) => i.value = y),
2001
- value: Y($).CHART,
2002
- "data-testid": "dashboard-add-item-type-chart"
2003
- }, null, 8, Io), [
2004
- [Te, i.value]
2005
- ]),
2006
- v[4] || (v[4] = G(" Chart ", -1))
2007
- ]),
2008
- t("label", null, [
2009
- te(t("input", {
2010
- type: "radio",
2011
- "onUpdate:modelValue": v[1] || (v[1] = (y) => i.value = y),
2012
- value: Y($).TABLE,
2013
- "data-testid": "dashboard-add-item-type-table"
2014
- }, null, 8, Do), [
2015
- [Te, i.value]
2016
- ]),
2017
- v[5] || (v[5] = G(" Table ", -1))
2018
- ]),
2019
- t("label", null, [
2020
- te(t("input", {
2021
- type: "radio",
2022
- "onUpdate:modelValue": v[2] || (v[2] = (y) => i.value = y),
2023
- value: Y($).MARKDOWN,
2024
- "data-testid": "dashboard-add-item-type-markdown"
2025
- }, null, 8, So), [
2026
- [Te, i.value]
2027
- ]),
2028
- v[6] || (v[6] = G(" Markdown ", -1))
2029
- ]),
2030
- t("label", null, [
2031
- te(t("input", {
2032
- type: "radio",
2033
- "onUpdate:modelValue": v[3] || (v[3] = (y) => i.value = y),
2034
- value: Y($).FILTER,
2035
- "data-testid": "dashboard-add-item-type-filter"
2036
- }, null, 8, To), [
2037
- [Te, i.value]
2038
- ]),
2039
- v[7] || (v[7] = G(" Filter ", -1))
2040
- ])
2041
- ]),
2042
- t("div", { class: "editor-actions" }, [
2043
- t("button", {
2044
- onClick: l,
2045
- class: "add-button",
2046
- "data-testid": "dashboard-add-item-confirm"
2047
- }, " Add "),
2048
- t("button", {
2049
- onClick: r,
2050
- class: "cancel-button"
2051
- }, "Cancel")
2052
- ])
2053
- ])
2054
- ])
2055
- ])) : R("", !0);
2056
- }
2057
- }), bi = /* @__PURE__ */ ee(Eo, [["__scopeId", "data-v-440a3716"]]);
2058
- function $o(e = "dark") {
2059
- Ee.defineTheme("trilogyStudio", {
2060
- base: e === "light" ? "vs" : "vs-dark",
2061
- inherit: !0,
2062
- rules: [
2063
- { token: "comment", foreground: "#6A9955", fontStyle: "italic" },
2064
- { token: "keyword", foreground: "#569CD6", fontStyle: "bold" },
2065
- { token: "definition", foreground: "#E5C07B", fontStyle: "bold" },
2066
- { token: "type", foreground: "#4EC9B0", fontStyle: "bold" },
2067
- { token: "string", foreground: "#CE9178" },
2068
- { token: "number", foreground: "#B5CEA8" },
2069
- { token: "operator", foreground: "#D4D4D4" },
2070
- { token: "delimiter", foreground: "#D4D4D4" },
2071
- { token: "function", foreground: "#C586C0", fontStyle: "bold" },
2072
- { token: "hidden", foreground: "#D6D6C8", fontStyle: "italic" },
2073
- { token: "property", foreground: "#BFBFBF" }
2074
- ],
2075
- colors: {
2076
- "editorCursor.foreground": e === "light" ? "#333333" : "#ffffff",
2077
- "editorCursor.background": e === "light" ? "#ffffff" : "#000000"
2078
- }
2079
- }), Ee.setTheme("trilogyStudio");
2080
- }
2081
- function Lo(e, o = {}) {
2082
- const a = { ...{
2083
- automaticLayout: !0,
2084
- autoClosingBrackets: "always",
2085
- autoClosingOvertype: "always",
2086
- autoClosingQuotes: "always",
2087
- acceptSuggestionOnEnter: "off",
2088
- tabCompletion: "on",
2089
- theme: "trilogyStudio"
2090
- }, ...o };
2091
- return Ee.create(e, a);
2092
- }
2093
- function _e(e, o = "") {
2094
- var i;
2095
- if (!e) return o;
2096
- const n = e.getSelection();
2097
- let a = n && !(n.startColumn === n.endColumn && n.startLineNumber === n.endLineNumber) ? ((i = e.getModel()) == null ? void 0 : i.getValueInRange(n)) || "" : e.getValue();
2098
- return a || (a = o), a;
2099
- }
2100
- function Mo(e, o = {}) {
2101
- const { onValidate: n, onRun: a, onSave: i } = o;
2102
- if (n && e.addCommand(ae.CtrlCmd | ae.Shift | ve.KeyV, n), a && e.addCommand(ae.CtrlCmd | ve.Enter, a), i && e.addCommand(ae.CtrlCmd | ve.KeyS, i), e.addCommand(ae.CtrlCmd | ve.KeyZ, () => {
2103
- e.trigger("ide", "undo", {});
2104
- }), o.onContentChange) {
2105
- let l = null;
2106
- e.onDidChangeModelContent(() => {
2107
- var r;
2108
- (r = o.onContentChange) == null || r.call(o, e.getValue()), l && clearTimeout(l), l = setTimeout(() => {
2109
- var f;
2110
- e.hasTextFocus() && !((f = e.getSelection()) != null && f.isEmpty()) && e.trigger("completion", "editor.action.triggerSuggest", { auto: !0 });
2111
- }, 200);
2112
- });
2113
- }
2114
- }
2115
- let V = null;
2116
- const qo = X({
2117
- name: "EnhancedEditor",
2118
- components: {
2119
- SymbolsPane: yt,
2120
- LoadingView: De
2121
- },
2122
- props: {
2123
- onSave: {
2124
- type: null,
2125
- required: !1,
2126
- default: null
2127
- },
2128
- theme: {
2129
- type: String,
2130
- default: "vs-dark"
2131
- },
2132
- initContent: {
2133
- type: String,
2134
- required: !1,
2135
- default: ""
2136
- },
2137
- connectionName: {
2138
- type: String,
2139
- required: !0
2140
- },
2141
- imports: {
2142
- type: Array,
2143
- required: !1,
2144
- default: () => []
2145
- },
2146
- rootContent: {
2147
- type: Array,
2148
- required: !1,
2149
- default: () => []
2150
- }
2151
- },
2152
- emits: ["query-started", "format-query"],
2153
- data() {
2154
- return {
2155
- lastOperation: null,
2156
- editor: new pt({
2157
- id: "simple-editor",
2158
- name: "My Query",
2159
- type: "trilogy",
2160
- connection: this.connectionName,
2161
- storage: "local",
2162
- contents: this.initContent
2163
- }),
2164
- // New properties for collapsible sidebar
2165
- activePanel: "symbols",
2166
- isPanelVisible: !1
2167
- };
2168
- },
2169
- setup() {
2170
- const e = j("queryExecutionService"), o = j("connectionStore"), n = j("isMobile"), a = j("llmConnectionStore"), i = j("analyticsStore");
2171
- return {
2172
- queryExecutionService: e,
2173
- connectionStore: o,
2174
- isMobile: n,
2175
- llmConnectionStore: a,
2176
- analyticsStore: i
2177
- };
2178
- },
2179
- created() {
2180
- this.isPanelVisible = !this.isMobile;
2181
- },
2182
- mounted() {
2183
- this.$nextTick(() => {
2184
- this.createEditor(), document.addEventListener("keydown", this.handleKeyboardShortcuts), this.validateQuery();
2185
- });
2186
- },
2187
- beforeUnmount() {
2188
- V && V.dispose(), document.removeEventListener("keydown", this.handleKeyboardShortcuts);
2189
- },
2190
- methods: {
2191
- // New methods for panel management
2192
- togglePanel(e) {
2193
- this.activePanel === e && this.isPanelVisible ? this.isPanelVisible = !1 : (this.activePanel = e, this.isPanelVisible = !0, e === "symbols" && this.$refs.symbolsPane && this.$nextTick(() => {
2194
- this.focusSymbolSearch();
2195
- })), V && this.$nextTick(() => {
2196
- V == null || V.layout();
2197
- });
2198
- },
2199
- closePanel() {
2200
- this.isPanelVisible = !1, V && this.$nextTick(() => {
2201
- V == null || V.layout();
2202
- });
2203
- },
2204
- getPanelTitle() {
2205
- switch (this.activePanel) {
2206
- case "symbols":
2207
- return "Symbols";
2208
- default:
2209
- return "";
2210
- }
2211
- },
2212
- createEditor() {
2213
- $o(this.theme === "vs-dark" ? "dark" : "light"), V = Lo(this.$refs.editorElement, {
2214
- value: this.editor.contents || "",
2215
- language: this.editor.type === "sql" ? "sql" : "trilogy"
2216
- }), Mo(V, {
2217
- onValidate: () => this.validateQuery(),
2218
- onRun: () => this.runQuery(),
2219
- onGenerateLLM: () => this.generateLLMQuery()
2220
- // Add LLM generation shortcut
2221
- }), V.addCommand(ae.CtrlCmd | ve.Space, () => {
2222
- this.togglePanel("symbols");
2223
- }), V.addCommand(ae.CtrlCmd | ae.Shift | ve.Enter, () => {
2224
- this.generateLLMQuery();
2225
- }), this.editor.type !== "sql" && V.addCommand(ae.CtrlCmd | ve.KeyK, () => {
2226
- this.formatQuery();
2227
- });
2228
- },
2229
- handleKeyboardShortcuts(e) {
2230
- e.ctrlKey && e.shiftKey && e.key === "O" && (this.togglePanel("symbols"), e.preventDefault()), e.ctrlKey && e.shiftKey && e.key === "Enter" && (this.generateLLMQuery(), e.preventDefault()), e.ctrlKey && e.key === "k" && this.editor.type !== "sql" && (this.formatQuery(), e.preventDefault());
2231
- },
2232
- focusSymbolSearch() {
2233
- const e = this.$refs.symbolsPane;
2234
- e && "focusSearch" in e && e.focusSearch();
2235
- },
2236
- insertSymbol(e) {
2237
- if (!V) return;
2238
- const o = V.getPosition();
2239
- o && e.insertText && (V.executeEdits("", [
2240
- {
2241
- range: new gt(
2242
- o.lineNumber,
2243
- o.column,
2244
- o.lineNumber,
2245
- o.column
2246
- ),
2247
- text: e.insertText
2248
- }
2249
- ]), V.focus(), this.isMobile && this.closePanel());
2250
- },
2251
- async validateQuery(e = !0) {
2252
- if (!V) return [];
2253
- const o = this.connectionStore, n = this.queryExecutionService;
2254
- try {
2255
- this.editor.setError(null);
2256
- const a = V.getValue(), i = o.connections[this.editor.connection], l = {
2257
- text: a,
2258
- queryType: i ? i.query_type : "trilogy",
2259
- editorType: this.editor.type,
2260
- sources: [],
2261
- imports: this.imports,
2262
- extraContent: this.rootContent
2263
- }, r = await n.validateQuery(
2264
- this.editor.connection,
2265
- l
2266
- );
2267
- if (r && e) {
2268
- const f = V.getModel();
2269
- f && Ee.setModelMarkers(f, "owner", r.data.items || []), r.data.completion_items && (this.editor.completionSymbols = r.data.completion_items);
2270
- }
2271
- return r ? r.data.imports : [];
2272
- } catch (a) {
2273
- return a instanceof Error ? this.editor.setError(a.message || "Validation failed") : this.editor.setError("Validation failed"), [];
2274
- }
2275
- },
2276
- async formatQuery() {
2277
- var i;
2278
- const e = V, o = _e(e, this.editor.contents);
2279
- if (!o || !e) return;
2280
- let n = (i = this.connectionStore) == null ? void 0 : i.connections[this.editor.connection], a = this.queryExecutionService;
2281
- if (a)
2282
- try {
2283
- const l = await a.formatQuery(
2284
- o,
2285
- n ? n.query_type : "",
2286
- this.editor.type,
2287
- this.imports,
2288
- this.rootContent
2289
- );
2290
- l && e.setValue(l);
2291
- } catch (l) {
2292
- console.error("Error formatting query:", l);
2293
- }
2294
- },
2295
- async cancelQuery() {
2296
- this.editor.cancelCallback && await this.editor.cancelCallback(), this.editor.loading = !1;
2297
- },
2298
- async runQuery() {
2299
- var i, l, r;
2300
- this.$emit("query-started"), this.editor.setError(null);
2301
- let e = !1;
2302
- const o = this.connectionStore, n = this.queryExecutionService, a = V;
2303
- if (!(this.editor.loading || !a))
2304
- try {
2305
- this.analyticsStore && this.analyticsStore.log("studio-query-execution", this.editor.type, !0), this.editor.loading = !0, this.lastOperation = null, this.editor.startTime = Date.now();
2306
- const f = o.connections[this.editor.connection], h = _e(a, this.editor.contents);
2307
- if (!h) {
2308
- this.editor.results = new Ne(/* @__PURE__ */ new Map(), []), this.editor.loading = !1;
2309
- return;
2310
- }
2311
- const v = {
2312
- text: h,
2313
- queryType: f ? f.query_type : "",
2314
- editorType: this.editor.type,
2315
- imports: this.imports,
2316
- extraContent: this.rootContent
2317
- }, { resultPromise: y, cancellation: g } = await n.executeQuery(
2318
- this.editor.connection,
2319
- v,
2320
- // Progress callback for connection issues
2321
- () => {
2322
- },
2323
- (T) => {
2324
- !e && T.error && (this.editor.loading = !1, T.message && this.editor.setError(T.message)), !e && T.running && (this.editor.error = null, this.editor.loading = !0);
2325
- }
2326
- );
2327
- this.editor.cancelCallback = () => {
2328
- g.isActive() && g.cancel(), this.editor.loading = !1, this.editor.cancelCallback = null;
2329
- };
2330
- const k = await y;
2331
- e = !0, this.lastOperation = {
2332
- success: k.success,
2333
- duration: k.executionTime,
2334
- rows: (i = k.results) != null && i.data ? (r = (l = k.results) == null ? void 0 : l.data) == null ? void 0 : r.length : void 0,
2335
- type: this.editor.type
2336
- }, k.success ? (this.editor.executed_contents = h, k.generatedSql && (this.editor.generated_sql = k.generatedSql), k.results && (this.editor.results = k.results, this.editor.duration = k.executionTime)) : k.error && (this.editor.executed_contents = h, this.editor.setError(k.error));
2337
- } catch (f) {
2338
- f instanceof Error && this.editor.setError(f.message || "Query execution failed"), this.lastOperation = {
2339
- success: !1,
2340
- duration: 0,
2341
- type: this.editor.type
2342
- };
2343
- } finally {
2344
- this.editor.loading = !1, this.editor.cancelCallback = null, V && V.layout();
2345
- }
2346
- },
2347
- // Add the LLM query generation method
2348
- async generateLLMQuery() {
2349
- if (this.editor.loading || !V) return;
2350
- const e = this.llmConnectionStore, o = this.queryExecutionService, n = this.connectionStore;
2351
- if (!e) {
2352
- this.editor.setError("LLM connection store not available");
2353
- return;
2354
- }
2355
- try {
2356
- this.analyticsStore && this.analyticsStore.log("studio-llm-generation", this.editor.type, !0), this.editor.loading = !0, this.editor.startTime = Date.now(), this.editor.results = new Ne(/* @__PURE__ */ new Map(), []), this.editor.setError(null);
2357
- const a = V.getValue();
2358
- if (await this.validateQuery(!1), !this.editor.completionSymbols || this.editor.completionSymbols.length === 0)
2359
- throw new Error("There are no imported concepts for LLM generation");
2360
- const i = this.editor.completionSymbols.map((f) => ({
2361
- name: f.label,
2362
- type: f.datatype,
2363
- description: f.description,
2364
- calculation: f.calculation
2365
- })), l = async (f) => {
2366
- const h = n.connections[this.editor.connection], v = {
2367
- text: f,
2368
- queryType: h ? h.query_type : "",
2369
- editorType: this.editor.type,
2370
- imports: this.imports,
2371
- extraContent: this.rootContent
2372
- };
2373
- try {
2374
- const { resultPromise: y } = await o.executeQuery(
2375
- this.editor.connection,
2376
- v,
2377
- () => {
2378
- },
2379
- () => {
2380
- },
2381
- (g) => {
2382
- throw g;
2383
- },
2384
- () => !0,
2385
- !0
2386
- // Explain mode
2387
- );
2388
- return await y, !0;
2389
- } catch (y) {
2390
- throw y;
2391
- }
2392
- }, r = await e.generateQueryCompletion(a, i, l);
2393
- if (r)
2394
- V.setValue(r.content), this.editor.contents = V.getValue(), this.lastOperation = {
2395
- success: !0,
2396
- duration: Date.now() - (this.editor.startTime || 0),
2397
- type: "LLM Generation"
2398
- };
2399
- else
2400
- throw new Error("LLM could not successfully generate query");
2401
- } catch (a) {
2402
- if (a instanceof Error)
2403
- throw this.editor.setError(a.message), a;
2404
- this.editor.setError("Unknown error occurred during LLM generation"), this.lastOperation = {
2405
- success: !1,
2406
- duration: 0,
2407
- type: "LLM Generation"
2408
- };
2409
- } finally {
2410
- this.editor.loading = !1, V && V.layout();
2411
- }
2412
- },
2413
- getContent() {
2414
- return V ? V.getValue() : this.editor.contents || "";
2415
- }
2416
- }
2417
- }), Ao = { class: "editor-container" }, Ro = { class: "menu-bar" }, Fo = { class: "menu-actions" }, xo = { class: "editor-content" }, Qo = { class: "sidebar-panel" }, Vo = { class: "be-sidebar-container" }, Bo = { class: "be-sidebar-icons" }, Oo = { class: "result-wrapper" }, Ho = {
2418
- key: 1,
2419
- class: "error-message"
2420
- }, Po = {
2421
- key: 2,
2422
- class: "results-summary",
2423
- "data-testid": "simple-editor-results"
2424
- }, No = { class: "results-details" }, Ko = {
2425
- key: 0,
2426
- class: "timing"
2427
- }, _o = {
2428
- key: 1,
2429
- class: "row-count"
2430
- }, Wo = {
2431
- key: 2,
2432
- class: "operation-type"
2433
- };
2434
- function Uo(e, o, n, a, i, l) {
2435
- const r = J("SymbolsPane"), f = J("loading-view");
2436
- return m(), p("div", Ao, [
2437
- t("div", Ro, [
2438
- t("div", Fo, [
2439
- t("button", {
2440
- class: "action-item",
2441
- onClick: o[0] || (o[0] = (...h) => e.generateLLMQuery && e.generateLLMQuery(...h)),
2442
- title: "Generate query using AI",
2443
- "data-testid": "editor-generate-button"
2444
- }, " Generate "),
2445
- e.editor.type !== "sql" ? (m(), p("button", {
2446
- key: 0,
2447
- class: "action-item",
2448
- onClick: o[1] || (o[1] = () => e.validateQuery())
2449
- }, " Parse ")) : R("", !0),
2450
- e.editor.type !== "sql" ? (m(), p("button", {
2451
- key: 1,
2452
- class: "action-item",
2453
- onClick: o[2] || (o[2] = (...h) => e.formatQuery && e.formatQuery(...h)),
2454
- title: "Format query"
2455
- }, " Format ")) : R("", !0),
2456
- t("button", {
2457
- onClick: o[3] || (o[3] = (h) => e.editor.loading ? e.cancelQuery() : e.runQuery()),
2458
- class: H(["action-item", { "button-cancel": e.editor.loading }]),
2459
- "data-testid": "editor-run-button"
2460
- }, N(e.editor.loading ? "Cancel" : "Test"), 3)
2461
- ])
2462
- ]),
2463
- t("div", xo, [
2464
- t("div", {
2465
- ref: "editorElement",
2466
- class: H(["editor-obj", {
2467
- "monaco-width-with-panel": e.isPanelVisible,
2468
- "monaco-width-no-panel": !e.isPanelVisible
2469
- }]),
2470
- "data-testid": "simple-editor-content"
2471
- }, null, 2),
2472
- te(t("div", Qo, [
2473
- z(r, {
2474
- symbols: e.editor.completionSymbols || [],
2475
- onSelectSymbol: e.insertSymbol,
2476
- ref: "symbolsPane"
2477
- }, null, 8, ["symbols", "onSelectSymbol"])
2478
- ], 512), [
2479
- [at, e.isPanelVisible]
2480
- ]),
2481
- t("div", Vo, [
2482
- t("div", Bo, [
2483
- t("button", {
2484
- class: H(["sidebar-icon-button", { active: e.isPanelVisible }]),
2485
- onClick: o[4] || (o[4] = (h) => e.togglePanel("symbols")),
2486
- title: "Symbols"
2487
- }, [...o[5] || (o[5] = [
2488
- t("i", { class: "mdi mdi-tag-search-outline" }, null, -1)
2489
- ])], 2)
2490
- ])
2491
- ])
2492
- ]),
2493
- t("div", Oo, [
2494
- e.editor.loading ? (m(), Z(f, {
2495
- key: 0,
2496
- class: "loading-view",
2497
- text: "Loading...",
2498
- startTime: e.editor.startTime
2499
- }, null, 8, ["startTime"])) : e.editor.error ? (m(), p("div", Ho, N(e.editor.error), 1)) : e.lastOperation ? (m(), p("div", Po, [
2500
- t("div", {
2501
- class: H(["status-badge", e.lastOperation.success ? "success" : "error"])
2502
- }, N(e.lastOperation.success ? "SUCCESS" : "FAILED"), 3),
2503
- t("div", No, [
2504
- e.lastOperation.duration ? (m(), p("div", Ko, N(e.lastOperation.duration) + "ms", 1)) : R("", !0),
2505
- e.lastOperation.rows !== void 0 ? (m(), p("div", _o, N(e.lastOperation.rows) + " " + N(e.lastOperation.rows === 1 ? "row" : "rows"), 1)) : R("", !0),
2506
- e.lastOperation.type ? (m(), p("div", Wo, N(e.lastOperation.type), 1)) : R("", !0)
2507
- ])
2508
- ])) : R("", !0)
2509
- ])
2510
- ]);
2511
- }
2512
- const Ze = /* @__PURE__ */ ee(qo, [["render", Uo], ["__scopeId", "data-v-b071d1f7"]]), jo = { class: "editor-overlay" }, zo = { class: "editor-body" }, Go = /* @__PURE__ */ X({
2513
- __name: "DashboardChartEditor",
2514
- props: {
2515
- content: {},
2516
- connectionName: {},
2517
- imports: {},
2518
- rootContent: {},
2519
- showing: { type: Boolean },
2520
- initialWidth: {},
2521
- initialHeight: {}
2522
- },
2523
- emits: ["save", "cancel"],
2524
- setup(e, { emit: o }) {
2525
- const n = e, a = o, i = b(n.content), l = b(n.imports), r = b(null), { editorElement: f, dialogStyle: h, startResize: v } = Ye(() => a("cancel"), {
2526
- initialWidth: n.initialWidth,
2527
- initialHeight: n.initialHeight
2528
- });
2529
- function y() {
2530
- if (r.value) {
2531
- const k = r.value.getContent();
2532
- a("save", k);
2533
- }
2534
- }
2535
- function g() {
2536
- a("cancel");
2537
- }
2538
- return (k, T) => (m(), p("div", jo, [
2539
- t("div", {
2540
- class: "content-editor",
2541
- ref_key: "editorElement",
2542
- ref: f,
2543
- style: Ie(Y(h))
2544
- }, [
2545
- t("div", zo, [
2546
- z(Ze, {
2547
- class: "editor-content",
2548
- initContent: i.value,
2549
- connectionName: e.connectionName,
2550
- imports: l.value,
2551
- rootContent: e.rootContent,
2552
- ref_key: "editor",
2553
- ref: r
2554
- }, null, 8, ["initContent", "connectionName", "imports", "rootContent"])
2555
- ]),
2556
- t("div", { class: "editor-actions" }, [
2557
- t("button", {
2558
- onClick: y,
2559
- class: "save-button",
2560
- "data-testid": "save-dashboard-chart"
2561
- }, " Save Query "),
2562
- t("button", {
2563
- onClick: g,
2564
- class: "cancel-button"
2565
- }, "Cancel")
2566
- ]),
2567
- z(Je, { onStartResize: Y(v) }, null, 8, ["onStartResize"])
2568
- ], 4)
2569
- ]));
2570
- }
2571
- }), Ci = /* @__PURE__ */ ee(Go, [["__scopeId", "data-v-6ce06012"]]), Yo = { class: "editor-overlay" }, Jo = { class: "tab-header" }, Zo = { class: "editor-body" }, Xo = {
2572
- key: 0,
2573
- class: "tab-content"
2574
- }, ei = {
2575
- key: 1,
2576
- class: "tab-content"
2577
- }, ti = /* @__PURE__ */ X({
2578
- __name: "DashboardMarkdownEditor",
2579
- props: {
2580
- content: {},
2581
- connectionName: {},
2582
- imports: {},
2583
- rootContent: {},
2584
- initialWidth: {},
2585
- initialHeight: {}
2586
- },
2587
- emits: ["save", "cancel"],
2588
- setup(e, { emit: o }) {
2589
- const n = e, a = o, i = C(() => typeof n.content == "string" ? { markdown: n.content, query: "" } : { markdown: n.content.markdown || "", query: n.content.query || "" }), l = b(i.value.markdown), r = b(i.value.query), f = b(i.value.query), h = b(n.imports), v = b(null), y = b("markdown"), { editorElement: g, dialogStyle: k, startResize: T } = Ye(() => a("cancel"), {
2590
- initialWidth: n.initialWidth,
2591
- initialHeight: n.initialHeight
2592
- });
2593
- ne(
2594
- () => n.content,
2595
- (u) => {
2596
- const d = typeof u == "string" ? { markdown: u, query: "" } : { markdown: u.markdown || "", query: u.query || "" };
2597
- l.value = d.markdown, r.value = d.query, f.value = d.query;
2598
- }
2599
- ), ne(y, (u, d) => {
2600
- d === "query" && v.value && (f.value = v.value.getContent());
2601
- });
2602
- function F() {
2603
- y.value === "query" && v.value && (f.value = v.value.getContent());
2604
- const u = {
2605
- markdown: l.value,
2606
- query: f.value
2607
- };
2608
- a("save", u);
2609
- }
2610
- function _() {
2611
- a("cancel");
2612
- }
2613
- function E(u) {
2614
- y.value === "query" && v.value && (f.value = v.value.getContent()), y.value = u;
2615
- }
2616
- function M(u, d = "") {
2617
- const S = document.querySelector(".markdown-editor");
2618
- if (!S) return;
2619
- const L = S.selectionStart, Q = S.selectionEnd, K = l.value.substring(L, Q), me = l.value.substring(0, L), he = l.value.substring(Q);
2620
- l.value = me + u + K + d + he, setTimeout(() => {
2621
- S.focus(), S.setSelectionRange(L + u.length, L + u.length + K.length);
2622
- }, 0);
2623
- }
2624
- function I() {
2625
- M("**", "**");
2626
- }
2627
- function B() {
2628
- M("*", "*");
2629
- }
2630
- function x() {
2631
- M("## ");
2632
- }
2633
- function A() {
2634
- M("- ");
2635
- }
2636
- function D() {
2637
- M("[", "](url)");
2638
- }
2639
- function U() {
2640
- M("{data[0].field_name}");
2641
- }
2642
- function w() {
2643
- M(`{{#each data}}
2644
- - {{field_name}}
2645
- {{/each}}`);
2646
- }
2647
- return (u, d) => (m(), p("div", Yo, [
2648
- t("div", {
2649
- class: "content-editor",
2650
- ref_key: "editorElement",
2651
- ref: g,
2652
- style: Ie(Y(k))
2653
- }, [
2654
- t("div", Jo, [
2655
- t("button", {
2656
- onClick: d[0] || (d[0] = (S) => E("markdown")),
2657
- class: H([{ active: y.value === "markdown" }, "tab-button"])
2658
- }, " 📝 Markdown Template ", 2),
2659
- t("button", {
2660
- onClick: d[1] || (d[1] = (S) => E("query")),
2661
- class: H([{ active: y.value === "query" }, "tab-button"])
2662
- }, " 🔍 Data Query ", 2)
2663
- ]),
2664
- t("div", Zo, [
2665
- y.value === "markdown" ? (m(), p("div", Xo, [
2666
- t("div", { class: "markdown-toolbar" }, [
2667
- t("button", {
2668
- onClick: I,
2669
- title: "Bold"
2670
- }, [...d[3] || (d[3] = [
2671
- t("strong", null, "B", -1)
2672
- ])]),
2673
- t("button", {
2674
- onClick: B,
2675
- title: "Italic"
2676
- }, [...d[4] || (d[4] = [
2677
- t("em", null, "I", -1)
2678
- ])]),
2679
- t("button", {
2680
- onClick: x,
2681
- title: "Heading"
2682
- }, "H"),
2683
- t("button", {
2684
- onClick: A,
2685
- title: "List"
2686
- }, "•"),
2687
- t("button", {
2688
- onClick: D,
2689
- title: "Link"
2690
- }, "🔗"),
2691
- d[5] || (d[5] = t("div", { class: "toolbar-separator" }, null, -1)),
2692
- t("button", {
2693
- onClick: U,
2694
- title: "Insert data reference",
2695
- class: "data-button"
2696
- }, " {} "),
2697
- t("button", {
2698
- onClick: w,
2699
- title: "Insert loop",
2700
- class: "data-button"
2701
- }, "↻")
2702
- ]),
2703
- te(t("textarea", {
2704
- "onUpdate:modelValue": d[2] || (d[2] = (S) => l.value = S),
2705
- placeholder: `Enter markdown content here...
2706
-
2707
- Template examples:
2708
- - {field_name} - First row value
2709
- - {data[0].field_name} - Specific row
2710
- - {data.length} - Total rows
2711
- - {{#each data}} {{field_name}} {{/each}} - Loop all
2712
- - {{#each data limit=5}} {{field_name}} {{/each}} - Loop first 5`,
2713
- class: "markdown-editor"
2714
- }, null, 512), [
2715
- [ye, l.value]
2716
- ])
2717
- ])) : R("", !0),
2718
- y.value === "query" ? (m(), p("div", ei, [
2719
- d[6] || (d[6] = t("div", { class: "query-help" }, [
2720
- t("p", null, " Write a query to fetch data for your markdown template. Leave empty if no data is needed. ")
2721
- ], -1)),
2722
- z(Ze, {
2723
- class: "editor-content",
2724
- initContent: f.value,
2725
- connectionName: e.connectionName,
2726
- imports: h.value,
2727
- rootContent: e.rootContent,
2728
- ref_key: "editor",
2729
- ref: v
2730
- }, null, 8, ["initContent", "connectionName", "imports", "rootContent"])
2731
- ])) : R("", !0)
2732
- ]),
2733
- t("div", { class: "editor-actions" }, [
2734
- t("button", {
2735
- onClick: F,
2736
- class: "save-button",
2737
- "data-testid": "save-dashboard-markdown"
2738
- }, " Save Content "),
2739
- t("button", {
2740
- onClick: _,
2741
- class: "cancel-button"
2742
- }, "Cancel")
2743
- ]),
2744
- z(Je, { onStartResize: Y(T) }, null, 8, ["onStartResize"])
2745
- ], 4)
2746
- ]));
2747
- }
2748
- }), wi = /* @__PURE__ */ ee(ti, [["__scopeId", "data-v-1517b46c"]]), ni = { class: "dashboard-setup" }, oi = { class: "setup-section" }, ii = {
2749
- key: 0,
2750
- class: "setup-section"
2751
- }, ri = { class: "action-row" }, li = ["disabled"], ai = {
2752
- key: 0,
2753
- class: "error-message"
2754
- }, si = { class: "setup-section" }, ui = { class: "templates-grid" }, di = ["onClick", "data-testid"], ci = { class: "template-icon" }, mi = { class: "template-info" }, hi = { class: "template-title" }, fi = { class: "template-desc" }, P = 20, ki = /* @__PURE__ */ X({
2755
- __name: "DashboardCTA",
2756
- props: {
2757
- dashboardId: {}
2758
- },
2759
- emits: ["template-selected", "description-updated"],
2760
- setup(e, { emit: o }) {
2761
- const n = j("dashboardStore"), a = j("editorStore"), i = j("llmConnectionStore"), l = j(
2762
- "queryExecutionService"
2763
- ), r = j("saveDashboards");
2764
- if (!n || !i || !l || !r)
2765
- throw new Error("DashboardStore, LLMConnectionStore, or QueryExecutionService not provided");
2766
- const f = e, h = C(() => i.activeConnection), v = o, y = b(""), g = b(""), k = b(!1), T = b(""), F = b(null), _ = P / 4, E = [
2767
- {
2768
- id: "summary",
2769
- name: "Summary Dashboard",
2770
- description: "High-level metrics and KPIs with key visualizations",
2771
- icon: "mdi-view-dashboard",
2772
- layout: [
2773
- { i: "title", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2774
- { i: "kpi1", x: 0, y: 3, w: P / 4, h: 4, type: $.CHART },
2775
- { i: "kpi2", x: _, y: 3, w: P / 4, h: 4, type: $.CHART },
2776
- { i: "kpi3", x: _ * 2, y: 3, w: P / 4, h: 4, type: $.CHART },
2777
- { i: "kpi4", x: _ * 3, y: 3, w: P / 4, h: 4, type: $.CHART },
2778
- { i: "trend", x: 0, y: 7, w: P / 2, h: 8, type: $.CHART },
2779
- { i: "breakdown", x: P / 2, y: 7, w: P / 2, h: 8, type: $.CHART }
2780
- ]
2781
- },
2782
- {
2783
- id: "drilldown",
2784
- name: "Drill-Down Analysis",
2785
- description: "Hierarchical data exploration with filtering capabilities",
2786
- icon: "mdi-magnify-expand",
2787
- layout: [
2788
- { i: "filters", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2789
- { i: "overview", x: 0, y: 3, w: P, h: 5, type: $.CHART },
2790
- { i: "detail1", x: 0, y: 8, w: P / 2, h: 8, type: $.CHART },
2791
- { i: "detail2", x: P / 2, y: 10, w: P / 2, h: 8, type: $.CHART },
2792
- { i: "datatable", x: 0, y: 20, w: P, h: 8, type: $.TABLE }
2793
- ]
2794
- },
2795
- {
2796
- id: "comparison",
2797
- name: "Comparison Dashboard",
2798
- description: "Side-by-side comparisons of metrics across dimensions",
2799
- icon: "mdi-compare",
2800
- layout: [
2801
- { i: "title", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2802
- { i: "compare1", x: 0, y: 3, w: P / 2, h: 6, type: $.CHART },
2803
- { i: "compare2", x: P / 2, y: 3, w: P / 2, h: 6, type: $.CHART },
2804
- { i: "compare3", x: 0, y: 9, w: P / 2, h: 6, type: $.CHART },
2805
- { i: "compare4", x: P / 2, y: 9, w: P / 2, h: 6, type: $.CHART },
2806
- { i: "summary", x: 0, y: 15, w: P, h: 5, type: $.MARKDOWN }
2807
- ]
2808
- },
2809
- {
2810
- id: "trends",
2811
- name: "Time Series Analysis",
2812
- description: "Visualization of trends and patterns over time",
2813
- icon: "mdi-chart-timeline-variant",
2814
- layout: [
2815
- { i: "headline", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2816
- { i: "maintrend", x: 0, y: 3, w: P, h: 8, type: $.CHART },
2817
- { i: "breakdown1", x: 0, y: 11, w: P / 3, h: 6, type: $.CHART },
2818
- { i: "breakdown2", x: P / 3, y: 11, w: P / 3, h: 6, type: $.CHART },
2819
- { i: "breakdown3", x: P / 3 * 2, y: 11, w: P / 3, h: 6, type: $.CHART },
2820
- { i: "forecast", x: 0, y: 17, w: P, h: 6, type: $.CHART }
2821
- ]
2822
- }
2823
- // {
2824
- // id: 'custom',
2825
- // name: 'Start from Scratch',
2826
- // description: 'Build your dashboard completely from scratch',
2827
- // icon: 'mdi-pencil-outline',
2828
- // layout: []
2829
- // }
2830
- ];
2831
- function M(x) {
2832
- F.value = x;
2833
- const A = E.find((D) => D.id === x);
2834
- if (A && f.dashboardId) {
2835
- for (const D of A.layout)
2836
- n.addItemToDashboard(
2837
- f.dashboardId,
2838
- D.type,
2839
- D.x,
2840
- D.y,
2841
- D.w,
2842
- D.h
2843
- );
2844
- v("template-selected", x);
2845
- }
2846
- }
2847
- function I() {
2848
- f.dashboardId && y.value && (n.updateDashboardDescription(f.dashboardId, y.value), v("description-updated", y.value));
2849
- }
2850
- async function B() {
2851
- if (!g.value.trim()) {
2852
- T.value = "Please provide a prompt for the dashboard generation.";
2853
- return;
2854
- }
2855
- try {
2856
- k.value = !0, T.value = "";
2857
- const x = await n.generatePromptSpec(
2858
- g.value,
2859
- i,
2860
- l,
2861
- a
2862
- );
2863
- console.log("Prompt spec generated:", x), x ? (await n.populateFromPromptSpec(
2864
- f.dashboardId,
2865
- x,
2866
- i,
2867
- l,
2868
- a
2869
- ), !y.value && x.description && (y.value = x.description, I()), r()) : T.value = "Failed to generate dashboard specification.";
2870
- } catch (x) {
2871
- console.error("Error generating dashboard with LLM:", x), T.value = "An error occurred while generating the dashboard.";
2872
- } finally {
2873
- k.value = !1;
2874
- }
2875
- }
2876
- return (x, A) => (m(), p("div", ni, [
2877
- A[7] || (A[7] = t("div", { class: "setup-header" }, [
2878
- t("h2", { class: "setup-title" }, "An Empty Dashboard"),
2879
- t("p", { class: "setup-subtitle" }, " Choose a template or start from scratch by using the 'add item' button to add charts, tables, and more. ")
2880
- ], -1)),
2881
- t("div", oi, [
2882
- A[3] || (A[3] = t("h3", { class: "section-title" }, "Description", -1)),
2883
- te(t("textarea", {
2884
- "onUpdate:modelValue": A[0] || (A[0] = (D) => y.value = D),
2885
- placeholder: "What is this dashboard for? Add context to help viewers understand the data...",
2886
- rows: "3",
2887
- class: "description-input"
2888
- }, null, 512), [
2889
- [ye, y.value]
2890
- ]),
2891
- t("button", {
2892
- onClick: I,
2893
- class: "action-button save-button",
2894
- "data-testid": "dashboard-description-save"
2895
- }, [...A[2] || (A[2] = [
2896
- t("i", { class: "mdi mdi-content-save" }, null, -1),
2897
- G(" Save ", -1)
2898
- ])])
2899
- ]),
2900
- h.value ? (m(), p("div", ii, [
2901
- A[4] || (A[4] = t("h3", { class: "section-title" }, "AI Copilot", -1)),
2902
- A[5] || (A[5] = t("p", { class: "section-desc" }, " Let AI help build your dashboard based on your data and description ", -1)),
2903
- te(t("textarea", {
2904
- "onUpdate:modelValue": A[1] || (A[1] = (D) => g.value = D),
2905
- placeholder: "Describe the dashboard you want to create. For example: 'Create a sales performance dashboard with monthly trends, regional breakdown, and top product metrics.'",
2906
- rows: "4",
2907
- class: "description-input",
2908
- "data-testid": "dashboard-prompt-input"
2909
- }, null, 512), [
2910
- [ye, g.value]
2911
- ]),
2912
- t("div", ri, [
2913
- t("button", {
2914
- onClick: B,
2915
- class: "action-button llm-button",
2916
- disabled: k.value || !g.value.trim(),
2917
- "data-testid": "generate-with-llm-button"
2918
- }, [
2919
- t("i", {
2920
- class: H(["mdi", k.value ? "mdi-loading mdi-spin" : "mdi-creation"])
2921
- }, null, 2),
2922
- G(" " + N(k.value ? "Generating..." : "Generate with AI"), 1)
2923
- ], 8, li),
2924
- T.value ? (m(), p("div", ai, N(T.value), 1)) : R("", !0)
2925
- ])
2926
- ])) : R("", !0),
2927
- t("div", si, [
2928
- A[6] || (A[6] = t("h3", { class: "section-title" }, "Templates", -1)),
2929
- t("div", ui, [
2930
- (m(), p(ce, null, we(E, (D) => t("div", {
2931
- key: D.id,
2932
- class: H(["template-card", { selected: F.value === D.id }]),
2933
- onClick: (U) => M(D.id),
2934
- "data-testid": `template-card-${D.id}`
2935
- }, [
2936
- t("div", ci, [
2937
- t("i", {
2938
- class: H(["mdi", D.icon])
2939
- }, null, 2)
2940
- ]),
2941
- t("div", mi, [
2942
- t("h4", hi, N(D.name), 1),
2943
- t("p", fi, N(D.description), 1)
2944
- ])
2945
- ], 10, di)), 64))
2946
- ])
2947
- ])
2948
- ]));
2949
- }
2950
- });
2951
- function Ii(e, o, n, a) {
2952
- if (!e.value)
2953
- throw new Error("Dashboard computed reference is required");
2954
- const i = bt(), l = ze();
2955
- let r = j("queryExecutionService");
2956
- const f = je(), { setActiveDashboard: h } = Ge();
2957
- if (!r)
2958
- throw new Error("QueryExecutionService not provided");
2959
- const v = b(""), y = b(""), g = b(""), k = b(null), T = b(null), F = b(!1), _ = b(!1), E = b(!1), M = b([]), I = C(() => o.maxWidth || "100vw"), B = C(() => e.value ? e.value.layout : []), x = C(() => e.value ? [...e.value.layout].sort((c, q) => (c.y + c.y + c.h) / 2 - (q.y + q.y + q.h) / 2) : []), A = C(() => e.value ? e.value.connection : ""), D = C(() => o.viewMode ? !1 : e.value ? e.value.state === "editing" : !1), U = C(() => e.value ? e.value.imports.map((c) => {
2960
- var q, s;
2961
- return {
2962
- alias: c.name,
2963
- // legacy handling
2964
- contents: ((q = l.editors[c.id]) == null ? void 0 : q.contents) || ((s = l.editors[c.name]) == null ? void 0 : s.contents) || ""
2965
- };
2966
- }) : []);
2967
- function w(c) {
2968
- if (!(c != null && c.id)) return;
2969
- c.state === "fullscreen" && n.fullScreen(!0), i.setActiveDashboard(c.id), g.value = "", v.value = "", y.value = "", M.value = [], c.filter && (v.value = c.filter, y.value = c.filter);
2970
- const q = qe(c.id), s = Object.keys(c.gridItems).filter(
2971
- (O) => !c.gridItems[O].results
2972
- );
2973
- q == null || q.runBatch(s), L();
2974
- }
2975
- ne(
2976
- () => {
2977
- var c;
2978
- return (c = e.value) == null ? void 0 : c.id;
2979
- },
2980
- (c, q) => {
2981
- c && c !== q && e.value && w(e.value);
2982
- }
2983
- ), pe(() => {
2984
- e.value && w(e.value);
2985
- const c = new ResizeObserver(() => {
2986
- n.triggerResize();
2987
- }), q = o.isMobile ? ".mobile-container" : ".grid-container", s = document.querySelector(q);
2988
- s && c.observe(s);
2989
- }), We(() => {
2990
- k.value !== null && clearTimeout(k.value);
2991
- });
2992
- async function u() {
2993
- var c;
2994
- if (e.value && e.value.id) {
2995
- v.value = "", y.value = "", g.value = "";
2996
- let q = i.removeAllFilters(e.value.id);
2997
- await ((c = i.getQueryExecutor(e.value.id)) == null ? void 0 : c.runBatch(q));
2998
- }
2999
- }
3000
- async function d(c) {
3001
- var q;
3002
- if (!c || Ke(c) === "") {
3003
- if (g.value = "", e.value && e.value.id) {
3004
- let s = i.updateDashboardFilter(
3005
- e.value.id,
3006
- Ke(c)
3007
- );
3008
- await ((q = i.getQueryExecutor(e.value.id)) == null ? void 0 : q.runBatch(s));
3009
- }
3010
- return;
3011
- }
3012
- e.value && e.value.id && (v.value = c, await (r == null ? void 0 : r.generateQuery(e.value.connection, {
3013
- text: "select 1 as test;",
3014
- editorType: "trilogy",
3015
- extraFilters: [c],
3016
- imports: e.value.imports,
3017
- extraContent: U.value
3018
- }).then(() => {
3019
- var s;
3020
- if (g.value = "", e.value && e.value.id) {
3021
- let O = i.updateDashboardFilter(e.value.id, c);
3022
- (s = i.getQueryExecutor(e.value.id)) == null || s.runBatch(O);
3023
- }
3024
- }).catch((s) => (g.value = s.message, !1))));
3025
- }
3026
- const S = async (c) => {
3027
- let q = c.replace(/^\s*where\s+/i, "");
3028
- if (e.value && e.value.id) {
3029
- let s = await (r == null ? void 0 : r.executeQuery(
3030
- e.value.connection,
3031
- {
3032
- text: "select 1 as test;",
3033
- editorType: "trilogy",
3034
- imports: e.value.imports,
3035
- extraFilters: [q],
3036
- extraContent: U.value
3037
- },
3038
- () => {
3039
- },
3040
- () => {
3041
- },
3042
- () => {
3043
- },
3044
- () => {
3045
- },
3046
- !0
3047
- ));
3048
- if (!s)
3049
- throw new Error("No promises returned from query execution service");
3050
- let O = await s.resultPromise;
3051
- if (!O.success)
3052
- throw new Error(
3053
- `Validation of "select 1 as test ${q}" resulted in ${O.error}`
3054
- );
3055
- } else
3056
- throw new Error("Dashboard not found");
3057
- };
3058
- async function L() {
3059
- if (e.value && e.value.id && r) {
3060
- let c = await i.populateCompletion(
3061
- e.value.id,
3062
- r,
3063
- l
3064
- );
3065
- c && (M.value = c), g.value = "";
3066
- }
3067
- }
3068
- async function Q(c) {
3069
- e.value && e.value.id && (i.updateDashboardImports(e.value.id, c), await L());
3070
- }
3071
- const K = (c) => {
3072
- e.value && (i.setState(e.value.id, c), Ae(() => {
3073
- n.triggerResize();
3074
- }));
3075
- }, me = (c) => {
3076
- e.value && e.value.id && i.updateDashboardLayout(e.value.id, c);
3077
- };
3078
- function he() {
3079
- E.value = !0;
3080
- }
3081
- function Re(c = $.CHART) {
3082
- if (!e.value || !e.value.id) return;
3083
- const q = i.addItemToDashboard(e.value.id, c);
3084
- E.value = !1, Ae(() => {
3085
- n.dimensionsUpdate(q);
3086
- });
3087
- }
3088
- function Fe(c) {
3089
- !e.value || !e.value.id || i.updateDashboardTitle(e.value.id, c);
3090
- }
3091
- function W() {
3092
- !e.value || !e.value.id || i.clearDashboardItems(e.value.id);
3093
- }
3094
- function oe(c) {
3095
- !e.value || !e.value.id || i.removeItemFromDashboard(e.value.id, c);
3096
- }
3097
- function se(c) {
3098
- !e.value || !e.value.id || i.copyItemInDashboard(e.value.id, c);
3099
- }
3100
- function fe() {
3101
- E.value = !1;
3102
- }
3103
- function xe(c) {
3104
- if (T.value = c, !e.value || !e.value.id) return;
3105
- const s = e.value.gridItems[c.i];
3106
- s && (s.type === $.CHART ? F.value = !0 : s.type === $.MARKDOWN ? _.value = !0 : (s.type === $.TABLE || s.type === $.FILTER) && (F.value = !0));
3107
- }
3108
- function Xe(c) {
3109
- if (!e.value || !e.value.id || !T.value) return;
3110
- const q = T.value.i;
3111
- Me(q, e.value.id, { content: c }), Qe();
3112
- }
3113
- function Qe() {
3114
- F.value = !1, _.value = !1, T.value = null;
3115
- }
3116
- function Ve(c, q) {
3117
- if (q && e.value && e.value.id !== q)
3118
- return {
3119
- type: $.CHART,
3120
- content: "",
3121
- structured_content: { markdown: "", query: "" },
3122
- name: `Item ${c}`,
3123
- allowCrossFilter: !0,
3124
- width: 0,
3125
- height: 0,
3126
- imports: [],
3127
- filters: [],
3128
- rootContent: [],
3129
- hasDrilldown: !1
3130
- };
3131
- if (!e.value)
3132
- return {
3133
- type: $.CHART,
3134
- content: "",
3135
- structured_content: { markdown: "", query: "" },
3136
- name: `Item ${c}`,
3137
- allowCrossFilter: !0,
3138
- width: 0,
3139
- height: 0,
3140
- imports: [],
3141
- filters: [],
3142
- rootContent: [],
3143
- hasDrilldown: !1
3144
- };
3145
- const s = e.value.gridItems[c];
3146
- if (!s)
3147
- return {
3148
- type: $.CHART,
3149
- content: "",
3150
- structured_content: { markdown: "", query: "" },
3151
- name: `Item ${c}`,
3152
- allowCrossFilter: !0,
3153
- width: 0,
3154
- height: 0,
3155
- imports: e.value.imports,
3156
- filters: [],
3157
- rootContent: [],
3158
- connectionName: e.value.connection || "",
3159
- hasDrilldown: !1
3160
- };
3161
- const O = s.filters || [];
3162
- let re = O;
3163
- e.value.filter && (O.some(
3164
- (Oe) => {
3165
- var He;
3166
- return Oe.source === "global" && Oe.value === ((He = e.value) == null ? void 0 : He.filter);
3167
- }
3168
- ) || (re = [{ value: e.value.filter, source: "global" }, ...O]));
3169
- function ue(le) {
3170
- return le && typeof le == "object" && typeof le.markdown == "string" && typeof le.query == "string";
3171
- }
3172
- let ge = !1, Se = ue(s.content) ? s.content : {
3173
- markdown: s.type === "markdown" ? s.content : "",
3174
- query: s.type !== "markdown" ? s.content : ""
3175
- };
3176
- s.drilldown && (ge = !0, Se = ue(s.drilldown) ? s.drilldown : {
3177
- markdown: s.type === "markdown" ? s.drilldown : "",
3178
- query: s.type !== "markdown" ? s.drilldown : ""
3179
- });
3180
- let be = s.chartConfig;
3181
- return ge && (be = s.drilldownChartConfig || void 0), {
3182
- type: s.type,
3183
- // check if it's MarkdownData, and if so, extract markdown
3184
- //
3185
- content: ue(s.content) ? s.content.markdown : s.content || "",
3186
- // display the drilldown of set
3187
- structured_content: Se,
3188
- name: s.name,
3189
- allowCrossFilter: s.allowCrossFilter !== !1,
3190
- // Default to true if not explicitly false
3191
- width: s.width || 0,
3192
- height: s.height || 0,
3193
- chartConfig: be,
3194
- filters: re,
3195
- chartFilters: s.chartFilters || [],
3196
- conceptFilters: s.conceptFilters || [],
3197
- parameters: s.parameters || {},
3198
- onRefresh: Be,
3199
- rootContent: U.value,
3200
- results: s.results || null,
3201
- connectionName: e.value.connection || "",
3202
- imports: e.value.imports,
3203
- error: s.error || "",
3204
- loading: s.loading || !1,
3205
- loadStartTime: s.loadStartTime || null,
3206
- // Include load start time if available
3207
- hasDrilldown: ge
3208
- };
3209
- }
3210
- function Me(c, q, s) {
3211
- if (!e.value || !e.value.id) return;
3212
- if (!q || e.value.id !== q) {
3213
- console.warn(
3214
- "Dashboard ID mismatch. Cannot set item data. Given:",
3215
- q,
3216
- "Expected:",
3217
- e.value.id
3218
- );
3219
- return;
3220
- }
3221
- const O = {};
3222
- if (s.name && (O.name = s.name), s.chartConfig && (O.chartConfig = s.chartConfig), s.content && (O.content = s.content), s.dimensions && (O.layoutDimensions = {
3223
- w: s.dimensions.width,
3224
- h: s.dimensions.height
3225
- }), s.width && s.height && (O.width = s.width, O.height = s.height), s.loading !== void 0 && (O.loading = s.loading), s.results !== void 0 && (O.results = s.results), s.error !== void 0 && (O.error = s.error), s.drilldown !== void 0 && (O.drilldown = s.drilldown), s.drilldownChartConfig !== void 0 && (O.drilldownChartConfig = s.drilldownChartConfig), s.allowCrossFilter !== void 0 && (O.allowCrossFilter = s.allowCrossFilter), Object.keys(O).length > 0 && i.updateMultipleItemProperties(e.value.id, c, O), s.content) {
3226
- let re = qe(e.value.id);
3227
- re == null || re.runSingle(c);
3228
- }
3229
- }
3230
- function qe(c) {
3231
- if (!e.value || !e.value.id)
3232
- throw new Error("Dashboard not found or not initialized");
3233
- if (!r) throw new Error("Query execution service not found");
3234
- if (!f) throw new Error("Connection store not found");
3235
- let q = i.dashboards[c];
3236
- const s = i.getOrCreateQueryExecutor(c, {
3237
- queryExecutionService: r,
3238
- connectionStore: f,
3239
- editorStore: l,
3240
- connectionName: q.connection,
3241
- dashboardId: c,
3242
- getDashboardData: (O) => i.dashboards[O],
3243
- getItemData: Ve,
3244
- setItemData: Me
3245
- });
3246
- return s || console.warn("No query executor found for dashboard:", e.value.id), s;
3247
- }
3248
- function et(c) {
3249
- var O;
3250
- const s = c.target.value;
3251
- e.value && e.value.id && (i.updateDashboardConnection(e.value.id, s), (O = i.getQueryExecutor(e.value.id)) == null || O.setConnection(s));
3252
- }
3253
- function Be(c) {
3254
- var q, s;
3255
- if (e.value) {
3256
- if (c) {
3257
- (q = i.getQueryExecutor(e.value.id)) == null || q.runSingle(c), n.dimensionsUpdate(c);
3258
- return;
3259
- }
3260
- (s = i.getQueryExecutor(e.value.id)) == null || s.runBatch(Object.keys(e.value.gridItems));
3261
- }
3262
- }
3263
- function tt(c) {
3264
- var re;
3265
- if (!e.value || !e.value.id) return;
3266
- let q = M.value.map((ue) => ue.label);
3267
- const s = Object.entries(c.filters).reduce(
3268
- (ue, [ge, Se]) => {
3269
- let be = ge, le = null;
3270
- return be.startsWith("local.") && (le = be.replace("local.", "")), (q.includes(be) || le && q.includes(le)) && (ue[ge] = Se), ue;
3271
- },
3272
- {}
3273
- );
3274
- if (!s || Object.keys(s).length === 0) {
3275
- console.log("No valid filters to apply from cross-filter event, given ", c.filters);
3276
- return;
3277
- }
3278
- let O = i.updateItemCrossFilters(
3279
- e.value.id,
3280
- c.source,
3281
- s,
3282
- c.chart,
3283
- c.append ? "append" : "add"
3284
- );
3285
- (re = i.getQueryExecutor(e.value.id)) == null || re.runBatch(O);
3286
- }
3287
- function nt(c, q) {
3288
- var s;
3289
- !e.value || !e.value.id || (i.removeItemCrossFilter(e.value.id, c, q), (s = i.getQueryExecutor(e.value.id)) == null || s.runSingle(c));
3290
- }
3291
- function ot(c) {
3292
- var s;
3293
- if (!e.value || !e.value.id) return;
3294
- let q = i.removeItemCrossFilterSource(e.value.id, c);
3295
- (s = i.getQueryExecutor(e.value.id)) == null || s.runBatch(q);
3296
- }
3297
- function it(c) {
3298
- h(c);
3299
- }
3300
- return {
3301
- // State
3302
- dashboard: e,
3303
- layout: B,
3304
- sortedLayout: x,
3305
- editMode: D,
3306
- selectedConnection: A,
3307
- filter: v,
3308
- filterError: g,
3309
- globalCompletion: M,
3310
- showAddItemModal: E,
3311
- showQueryEditor: F,
3312
- showMarkdownEditor: _,
3313
- editingItem: T,
3314
- dashboardMaxWidth: I,
3315
- rootContent: U,
3316
- // Methods
3317
- handleFilterChange: d,
3318
- handleFilterClear: u,
3319
- handleImportChange: Q,
3320
- validateFilter: S,
3321
- onConnectionChange: et,
3322
- toggleMode: K,
3323
- onLayoutUpdated: me,
3324
- openAddItemModal: he,
3325
- addItem: Re,
3326
- clearItems: W,
3327
- removeItem: oe,
3328
- copyItem: se,
3329
- closeAddModal: fe,
3330
- openEditor: xe,
3331
- saveContent: Xe,
3332
- closeEditors: Qe,
3333
- getDashboardQueryExecutor: qe,
3334
- getItemData: Ve,
3335
- setItemData: Me,
3336
- handleRefresh: Be,
3337
- setCrossFilter: tt,
3338
- removeFilter: nt,
3339
- unSelect: ot,
3340
- dashboardCreated: it,
3341
- updateTitle: Fe
3342
- };
3343
- }
3344
- export {
3345
- Ci as C,
3346
- pi as D,
3347
- wi as M,
3348
- ki as _,
3349
- gi as a,
3350
- bi as b,
3351
- Ii as u
3352
- };