@dataloop-ai/components 0.18.0 → 0.18.2

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 (277) hide show
  1. package/package.json +6 -3
  2. package/src/App.vue +5 -227
  3. package/src/assets/constants.scss +2 -1
  4. package/src/assets/globals.scss +21 -0
  5. package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
  6. package/src/components/basic/DlAccordion/components/AccordionHeader.vue +2 -1
  7. package/src/components/basic/DlAvatar/DlAvatar.vue +1 -1
  8. package/src/components/basic/DlButton/DlButton.vue +115 -25
  9. package/src/components/basic/DlButton/utils.ts +45 -2
  10. package/src/components/basic/DlChip/DlChip.vue +3 -7
  11. package/src/components/basic/DlChip/utils.ts +4 -4
  12. package/src/components/basic/DlContainer/DlContainer.vue +70 -0
  13. package/src/components/basic/DlContainer/index.ts +3 -0
  14. package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
  15. package/src/components/basic/DlEmptyState/index.ts +2 -0
  16. package/src/components/basic/DlEmptyState/types.ts +20 -0
  17. package/src/components/basic/DlGrid/DlGrid.vue +163 -0
  18. package/src/components/basic/DlGrid/index.ts +4 -0
  19. package/src/components/basic/DlGrid/types.ts +5 -0
  20. package/src/components/basic/DlKpi/components/KpiInfo.vue +2 -1
  21. package/src/components/basic/DlListItem/DlListItem.vue +96 -66
  22. package/src/components/basic/DlListItem/utils.ts +0 -3
  23. package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +37 -13
  24. package/src/components/basic/DlPopup/DlPopup.vue +58 -11
  25. package/src/components/basic/DlPopup/components/PopupHeader.vue +11 -6
  26. package/src/components/basic/DlProgressChart/DlProgressChart.vue +2 -1
  27. package/src/components/basic/DlWidget/DlWidget.vue +273 -141
  28. package/src/components/basic/DlWidget/index.ts +1 -3
  29. package/src/components/basic/DlWidget/utils.ts +90 -8
  30. package/src/components/basic/index.ts +4 -2
  31. package/src/components/basic/types.ts +2 -0
  32. package/src/components/compound/DlCard/DlCard.vue +796 -0
  33. package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
  34. package/src/components/compound/DlCard/types.ts +38 -0
  35. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +39 -4
  36. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +128 -36
  37. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +167 -87
  38. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +2 -1
  39. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +44 -3
  40. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChartWidget.vue +1 -2
  41. package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +9 -18
  42. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +48 -9
  43. package/src/components/compound/DlCharts/charts/DlScatterChart/DlScatterChart.vue +667 -0
  44. package/src/components/compound/DlCharts/charts/DlScatterChart/index.ts +2 -0
  45. package/src/components/compound/DlCharts/charts/index.ts +1 -0
  46. package/src/components/compound/DlCharts/components/DlBrush.vue +3 -2
  47. package/src/components/compound/DlCharts/components/DlChartLabels.vue +2 -1
  48. package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +1 -0
  49. package/src/components/compound/DlCharts/types/props.ts +5 -1
  50. package/src/components/compound/DlCharts/utils.ts +1 -1
  51. package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +173 -0
  52. package/src/components/compound/DlCodeEditor/README.md +11 -0
  53. package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
  54. package/src/components/compound/DlCodeEditor/index.ts +3 -0
  55. package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
  56. package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
  57. package/src/components/compound/DlCodeEditor/types.ts +21 -0
  58. package/src/components/compound/DlDateTime/DlDatePicker/DlDatePicker.vue +9 -1
  59. package/src/components/compound/DlDateTime/DlDatePicker/components/DlCalendar.vue +4 -2
  60. package/src/components/compound/DlDateTime/DlDatePicker/components/DlMonthCalendar.vue +2 -1
  61. package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
  62. package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +18 -9
  63. package/src/components/compound/DlDateTime/DlTimePicker/DlTimePicker.vue +2 -2
  64. package/src/components/compound/DlDialogBox/DlDialogBox.vue +74 -15
  65. package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -1
  66. package/src/components/compound/DlDialogBox/components/DlDialogBoxHeader.vue +9 -7
  67. package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +13 -4
  68. package/src/components/compound/DlInput/DlInput.vue +80 -17
  69. package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +42 -219
  70. package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +16 -17
  71. package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
  72. package/src/components/compound/DlPagination/DlPagination.vue +1 -1
  73. package/src/components/compound/DlPagination/components/PaginationLegend.vue +0 -2
  74. package/src/components/compound/DlPagination/components/RowsSelector.vue +0 -2
  75. package/src/components/compound/DlRange/DlRange.vue +3 -2
  76. package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +12 -5
  77. package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +413 -97
  78. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchFilters.vue +4 -1
  79. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +100 -39
  80. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +12 -7
  81. package/src/components/compound/DlSearches/DlSmartSearch/components/FiltersQuery.vue +5 -6
  82. package/src/components/compound/DlSearches/DlSmartSearch/types.ts +14 -0
  83. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
  84. package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +172 -48
  85. package/src/components/compound/DlSelect/DlSelect.vue +264 -130
  86. package/src/components/compound/DlSelect/utils.ts +4 -1
  87. package/src/components/compound/DlSlider/DlSlider.vue +10 -2
  88. package/src/components/compound/DlSlider/components/DlSliderBase.vue +3 -3
  89. package/src/components/compound/DlSlider/components/DlSliderInput.vue +17 -26
  90. package/src/components/compound/DlSlider/sliderStyles.scss +5 -1
  91. package/src/components/compound/DlSlider/useSlider.ts +2 -2
  92. package/src/components/compound/DlSlider/utils.ts +2 -2
  93. package/src/components/compound/DlStepper/DlStepper.vue +46 -4
  94. package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
  95. package/src/components/compound/DlStepper/components/DlStepperFooter.vue +12 -0
  96. package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +24 -11
  97. package/src/components/compound/DlStepper/models/Step.ts +37 -8
  98. package/src/components/compound/DlStepper/models/Stepper.ts +108 -15
  99. package/src/components/compound/DlStepper/models/interfaces.ts +2 -1
  100. package/src/components/compound/DlTable/DlTable.vue +49 -14
  101. package/src/components/compound/DlTable/components/DlTd.vue +9 -9
  102. package/src/components/compound/DlTable/components/DlTh.vue +3 -2
  103. package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
  104. package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
  105. package/src/components/compound/DlTable/hooks/tablePagination.ts +18 -18
  106. package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
  107. package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
  108. package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
  109. package/src/components/compound/DlTable/styles/dl-table-styles.scss +8 -0
  110. package/src/components/compound/DlTabs/DlTabs.vue +83 -31
  111. package/src/components/compound/DlTabs/components/DlTab.vue +14 -4
  112. package/src/components/compound/DlTabs/components/TabsWrapper.vue +32 -27
  113. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
  114. package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
  115. package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
  116. package/src/components/compound/DlToast/api/useToast.ts +42 -1
  117. package/src/components/compound/DlToast/components/ToastComponent.vue +24 -32
  118. package/src/components/compound/DlToast/types.ts +52 -0
  119. package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
  120. package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
  121. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
  122. package/src/components/compound/DlTreeTable/index.ts +3 -0
  123. package/src/components/compound/DlTreeTable/types.ts +1 -0
  124. package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
  125. package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
  126. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
  127. package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
  128. package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
  129. package/src/components/compound/index.ts +14 -1
  130. package/src/components/compound/types.ts +2 -0
  131. package/src/components/essential/DlBadge/DlBadge.vue +3 -3
  132. package/src/components/essential/DlCheckbox/DlCheckbox.vue +10 -7
  133. package/src/components/essential/DlEllipsis/DlEllipsis.vue +141 -0
  134. package/src/components/essential/DlIcon/DlIcon.vue +5 -5
  135. package/src/components/essential/DlLabel/DlLabel.vue +190 -0
  136. package/src/components/essential/DlLabel/index.ts +2 -0
  137. package/src/components/essential/DlList/DlList.vue +3 -3
  138. package/src/components/essential/DlMenu/DlMenu.vue +41 -22
  139. package/src/components/essential/DlMenu/utils.ts +8 -7
  140. package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
  141. package/src/components/essential/DlPageLayout/index.ts +2 -0
  142. package/src/components/essential/DlProgressBar/DlProgressBar.vue +1 -1
  143. package/src/components/essential/DlRadio/DlRadio.vue +10 -5
  144. package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
  145. package/src/components/essential/DlSpinner/index.ts +1 -13
  146. package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +7 -0
  147. package/src/components/essential/DlSwitch/DlSwitch.vue +6 -3
  148. package/src/components/essential/DlTextArea/DlTextArea.vue +212 -7
  149. package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
  150. package/src/components/essential/DlTypography/DlTypography.vue +7 -1
  151. package/src/components/essential/index.ts +3 -2
  152. package/src/components/shared/DlInfoErrorMessage/DlInfoErrorMessage.vue +1 -1
  153. package/src/components/{essential → shared}/DlTooltip/DlTooltip.vue +26 -19
  154. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +106 -43
  155. package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +28 -4
  156. package/src/components/shared/index.ts +1 -0
  157. package/src/components/types.ts +2 -0
  158. package/src/demos/BarChartDemo.vue +59 -2
  159. package/src/demos/ColumnChartDemo.vue +67 -2
  160. package/src/demos/DlAccordionDemo.vue +92 -43
  161. package/src/demos/DlAlertDemo.vue +14 -0
  162. package/src/demos/DlButtonDemo.vue +41 -4
  163. package/src/demos/DlCardDemo.vue +156 -19
  164. package/src/demos/DlChartDoughnutDemo.vue +49 -2
  165. package/src/demos/DlCheckboxDemo.vue +28 -3
  166. package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
  167. package/src/demos/DlCodeEditor/index.ts +2 -0
  168. package/src/demos/DlConfusionMatrixDemo.vue +93 -37
  169. package/src/demos/DlDemoPage.vue +235 -0
  170. package/src/demos/DlDialogBoxDemo.vue +56 -51
  171. package/src/demos/DlDropdownButtonDemo.vue +35 -27
  172. package/src/demos/DlEmptyStateDemo.vue +81 -0
  173. package/src/demos/DlGridDemo.vue +40 -0
  174. package/src/demos/DlInputDemo.vue +21 -1
  175. package/src/demos/DlJsonEditorDemo.vue +59 -0
  176. package/src/demos/DlLabelDemo.vue +208 -0
  177. package/src/demos/DlLineChartDemo.vue +50 -2
  178. package/src/demos/DlListDemo.vue +12 -9
  179. package/src/demos/DlMenuDemo.vue +147 -20
  180. package/src/demos/DlPageLayoutDemo.vue +146 -0
  181. package/src/demos/DlPanelContainerDemo.vue +113 -2
  182. package/src/demos/DlPopupDemo.vue +82 -1
  183. package/src/demos/DlRadioDemo.vue +16 -1
  184. package/src/demos/DlScatterChartDemo.vue +161 -0
  185. package/src/demos/DlSearchDemo.vue +9 -0
  186. package/src/demos/DlSelectDemo.vue +124 -27
  187. package/src/demos/DlSpinnerDemo.vue +0 -2
  188. package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
  189. package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
  190. package/src/demos/DlStepperDemo/SimpleStepper.vue +4 -0
  191. package/src/demos/DlStepperDemo/steps/GeneralStep.vue +1 -0
  192. package/src/demos/DlSwitchDemo.vue +12 -0
  193. package/src/demos/DlTableDemo.vue +84 -5
  194. package/src/demos/DlTabsDemo.vue +92 -3
  195. package/src/demos/DlTextAreaDemo.vue +14 -17
  196. package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
  197. package/src/demos/DlToastDemo.vue +3 -9
  198. package/src/demos/DlTooltipDemo.vue +66 -2
  199. package/src/demos/DlTreeTableDemo.vue +694 -0
  200. package/src/demos/DlVirtualScrollDemo.vue +3 -12
  201. package/src/demos/DlWidgetDemo.vue +252 -61
  202. package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +151 -32
  203. package/src/demos/index.ts +23 -4
  204. package/src/hooks/use-anchor.ts +15 -17
  205. package/src/hooks/use-arrow-navigation.ts +64 -21
  206. package/src/hooks/use-model-toggle.ts +14 -16
  207. package/src/hooks/use-portal.ts +9 -3
  208. package/src/hooks/use-scroll-target.ts +2 -4
  209. package/src/hooks/use-size-observer.ts +3 -2
  210. package/src/hooks/use-suggestions.ts +239 -49
  211. package/src/hooks/use-transition.ts +10 -4
  212. package/src/index.ts +22 -1
  213. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
  214. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
  215. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
  216. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
  217. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
  218. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
  219. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
  220. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
  221. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
  222. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
  223. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
  224. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
  225. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
  226. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
  227. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
  228. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
  229. package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
  230. package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
  231. package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
  232. package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
  233. package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
  234. package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
  235. package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
  236. package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
  237. package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
  238. package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
  239. package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
  240. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
  241. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
  242. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
  243. package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
  244. package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
  245. package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
  246. package/src/layouts/DlStudioLayout/index.ts +2 -0
  247. package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
  248. package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
  249. package/src/simple-code-editor.d.ts +1 -0
  250. package/src/utils/click-outside.ts +1 -1
  251. package/src/utils/dom.ts +5 -5
  252. package/src/utils/events.ts +3 -3
  253. package/src/utils/global-nodes.ts +2 -2
  254. package/src/utils/input-sizes.ts +5 -2
  255. package/src/utils/is-ellipsis-active.ts +4 -1
  256. package/src/utils/parse-smart-query.ts +209 -111
  257. package/src/utils/portal.ts +5 -5
  258. package/src/utils/position-engine.ts +7 -7
  259. package/src/utils/render.ts +1 -1
  260. package/src/utils/scroll.ts +2 -2
  261. package/src/utils/selection.ts +3 -3
  262. package/vite.config.ts +9 -1
  263. package/src/components/basic/DlCard/DlCard.vue +0 -241
  264. package/src/components/basic/DlCard/types.ts +0 -20
  265. package/src/components/basic/DlEllipsis/DlEllipsis.vue +0 -114
  266. package/src/components/basic/DlWidget/DlGrid.vue +0 -33
  267. package/src/components/basic/DlWidget/DlGridRow.vue +0 -32
  268. package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +0 -124
  269. package/src/components/compound/DlToast/utils/config.ts +0 -17
  270. package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -65
  271. package/src/components/essential/DlTextHolder/index.ts +0 -2
  272. package/src/demos/DlTextHolderDemo.vue +0 -42
  273. package/src/utils/swapNodes.ts +0 -30
  274. /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
  275. /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
  276. /package/src/components/{basic → essential}/DlEllipsis/index.ts +0 -0
  277. /package/src/components/{essential → shared}/DlTooltip/index.ts +0 -0
@@ -0,0 +1,247 @@
1
+ <template>
2
+ <div>
3
+ <dl-switch
4
+ v-model="isDark"
5
+ left-label="Dark Mode"
6
+ />
7
+ <dl-switch
8
+ v-model="lines"
9
+ left-label="code lines"
10
+ />
11
+ <dl-switch
12
+ v-model="readonly"
13
+ left-label="readonly"
14
+ />
15
+ <dl-code-editor
16
+ v-model="codeEditorValue"
17
+ width="45vw"
18
+ height="75vh"
19
+ :language="language"
20
+ :theme="theme"
21
+ :readonly="readonly"
22
+ :options="options"
23
+ />
24
+ </div>
25
+ </template>
26
+
27
+ <script lang="ts">
28
+ import { computed, defineComponent, ref, watch } from 'vue-demi'
29
+ import { DlCodeEditor, DlSwitch } from '../../components'
30
+ import { DlCodeEditorOptions, DlCodeEditorTheme } from '../../components/types'
31
+
32
+ export default defineComponent({
33
+ name: 'DlCodeEditorDemo',
34
+ components: {
35
+ DlSwitch,
36
+ DlCodeEditor
37
+ },
38
+ setup() {
39
+ const readonly = ref(false)
40
+ const isDark = ref(false)
41
+ const lines = ref(false)
42
+
43
+ const codeEditorValue = ref(
44
+ 'import urllib3\n' +
45
+ 'urllib3.disable_warnings()\n' +
46
+ 'from base64 import b64encode\n' +
47
+ 'import os\n' +
48
+ 'import sys\n' +
49
+ 'import json\n' +
50
+ 'import getpass\n' +
51
+ 'from optparse import OptionParser\n' +
52
+ 'from datetime import datetime, timedelta\n' +
53
+ 'import time\n' +
54
+ 'from time import gmtime, strftime, strptime\n' +
55
+ 'from operator import itemgetter, attrgetter\n' +
56
+ 'from purity_fb import PurityFb, FileSystem, FileSystemSnapshot, SnapshotSuffix, rest\n' +
57
+ '\n' +
58
+ '# Global Variables\n' +
59
+ "VERSION = '2.0.0'\n" +
60
+ "HEADER = 'Pure Storage Take FlashBlade Snapshot (' + VERSION + ')'\n" +
61
+ "BANNER = ('=' * 132)\n" +
62
+ 'DEBUG_FLAG = False\n' +
63
+ 'VERBOSE_FLAG = False\n' +
64
+ "COOKIE = ''\n" +
65
+ '\n' +
66
+ 'def parsecl():\n' +
67
+ " usage = 'usage: %prog [options]'\n" +
68
+ " version = '%prog ' + VERSION\n" +
69
+ ' description = "This application has been developed using Pure Storage v1.12 RESTful Web Service interfaces. Developed and tested using Python 3.9.5 Please contact ron@purestorage.com for assistance."\n' +
70
+ '\n' +
71
+ ' parser = OptionParser(usage=usage, version=version, description=description)\n' +
72
+ '\n' +
73
+ '\n' +
74
+ " parser.add_option('-d', '--debug',\n" +
75
+ " action = 'store_true',\n" +
76
+ " dest = 'DEBUG_FLAG',\n" +
77
+ ' default = False,\n' +
78
+ " help = 'Debug [default: %default]')\n" +
79
+ ' \n' +
80
+ " parser.add_option('-f', '--filesystem',\n" +
81
+ " action = 'store',\n" +
82
+ " type = 'string',\n" +
83
+ " dest = 'fs',\n" +
84
+ " help = 'FlashBlade File System')\n" +
85
+ ' \n' +
86
+ " parser.add_option('-r', '--replicant',\n" +
87
+ " action = 'store',\n" +
88
+ " type = 'string',\n" +
89
+ " dest = 'flashBladeRep',\n" +
90
+ " help = 'FlashBlade Replicant array')\n" +
91
+ ' \n' +
92
+ " parser.add_option('-s', '--server',\n" +
93
+ " action = 'store',\n" +
94
+ " type = 'string',\n" +
95
+ " dest = 'flashBlade',\n" +
96
+ " help = 'FlashBlade array')\n" +
97
+ ' \n' +
98
+ " parser.add_option('-t', '--token',\n" +
99
+ " action = 'store',\n" +
100
+ " type = 'string',\n" +
101
+ " dest = 'API_TOKEN',\n" +
102
+ " help = 'Pure API Token')\n" +
103
+ '\n' +
104
+ " parser.add_option('-S', '--suffix',\n" +
105
+ " action = 'store',\n" +
106
+ " type = 'string',\n" +
107
+ " dest = 'suffix',\n" +
108
+ " help = 'File system snapshot suffix')\n" +
109
+ '\n' +
110
+ " parser.add_option('-v', '--verbose',\n" +
111
+ " action = 'store_true',\n" +
112
+ " dest = 'VERBOSE_FLAG',\n" +
113
+ ' default = False,\n' +
114
+ " help = 'Verbose [default: %default]')\n" +
115
+ '\n' +
116
+ ' (options, args) = parser.parse_args()\n' +
117
+ '\n' +
118
+ " '''\n" +
119
+ ' print("Options:", options)\n' +
120
+ ' print("Args:", args)\n' +
121
+ " '''\n" +
122
+ ' \n' +
123
+ ' return(options)\n' +
124
+ '\n' +
125
+ 'def main():\n' +
126
+ ' # Setup variables\n' +
127
+ ' global DEBUG_FLAG\n' +
128
+ ' exit_code = 0\n' +
129
+ '\n' +
130
+ ' # Check for command line parameters\n' +
131
+ ' options = parsecl()\n' +
132
+ ' API_TOKEN = options.API_TOKEN\n' +
133
+ ' flashBlade = options.flashBlade\n' +
134
+ ' flashBladeRep = options.flashBladeRep\n' +
135
+ ' fs = options.fs\n' +
136
+ ' suffix = options.suffix\n' +
137
+ ' DEBUG_FLAG = options.DEBUG_FLAG\n' +
138
+ ' VERBOSE_FLAG = options.VERBOSE_FLAG\n' +
139
+ ' \n' +
140
+ ' if DEBUG_FLAG:\n' +
141
+ " print('API Token:', API_TOKEN)\n" +
142
+ " print('FlashBlade:', flashBlade)\n" +
143
+ " print('Relplicant:', flashBladeRep)\n" +
144
+ " print('File System:', fs)\n" +
145
+ " print('Suffix:', suffix)\n" +
146
+ " print('Debug Flag:', DEBUG_FLAG)\n" +
147
+ " print('Verbose Flag:', VERBOSE_FLAG)\n" +
148
+ '\n' +
149
+ ' if flashBlade == None:\n' +
150
+ " sys.exit('Exiting: You must provide FlashBlade details')\n" +
151
+ ' \n' +
152
+ ' if API_TOKEN == None:\n' +
153
+ " sys.exit('Exiting: You must provide FlashBlade API Token details')\n" +
154
+ '\n' +
155
+ ' if fs == None:\n' +
156
+ " sys.exit('Exiting: You must provide FlashBlade file system')\n" +
157
+ '\n' +
158
+ ' print(BANNER)\n' +
159
+ " print(HEADER + ' - ' + flashBlade)\n" +
160
+ " print(strftime('%d/%m/%Y %H:%M:%S %Z', gmtime()))\n" +
161
+ ' print(BANNER)\n' +
162
+ '\n' +
163
+ ' # create PurityFb object for a certain array\n' +
164
+ ' fb = PurityFb(flashBlade)\n' +
165
+ ' # this is required for versions before Purity//FB 2.1.3 because they only supports self-signed\n' +
166
+ ' # certificates. in later versions, this may be unnecessary if you have imported a certificate.\n' +
167
+ ' fb.disable_verify_ssl()\n' +
168
+ ' \n' +
169
+ ' try:\n' +
170
+ ' res= fb.login(API_TOKEN)\n' +
171
+ ' except rest.ApiException as e:\n' +
172
+ ' print("Exception when logging in to the array: %s\\n" % e)\n' +
173
+ '\n' +
174
+ ' if res:\n' +
175
+ ' try:\n' +
176
+ ' if flashBladeRep:\n' +
177
+ ' if suffix:\n' +
178
+ ' # create a snapshot with suffix and replicate to target array\n' +
179
+ ' res = fb.file_system_snapshots.create_file_system_snapshots(sources=[fs],\n' +
180
+ ' suffix=SnapshotSuffix(suffix),\n' +
181
+ ' send=True,\n' +
182
+ ' targets=[flashBladeRep])\n' +
183
+ ' else:\n' +
184
+ ' # create a snapshot without suffix and replicate to target array\n' +
185
+ ' res = fb.file_system_snapshots.create_file_system_snapshots(sources=[fs],\n' +
186
+ ' send=True,\n' +
187
+ ' targets=[flashBladeRep])\n' +
188
+ ' else:\n' +
189
+ ' if suffix:\n' +
190
+ ' # create a snapshot with suffix for the file system\n' +
191
+ ' res = fb.file_system_snapshots.create_file_system_snapshots(sources=[fs],\n' +
192
+ ' suffix=SnapshotSuffix(suffix))\n' +
193
+ ' else:\n' +
194
+ ' # create a snapshot without suffix for the file system\n' +
195
+ ' res = fb.file_system_snapshots.create_file_system_snapshots(sources=[fs])\n' +
196
+ ' \n' +
197
+ ' if VERBOSE_FLAG:\n' +
198
+ ' print(res)\n' +
199
+ ' \n' +
200
+ " print('Snapshot created for', fs, 'suffix', res.items[0].suffix) \n" +
201
+ '\n' +
202
+ ' except rest.ApiException as e:\n' +
203
+ ' print("Exception when creating file system snapshots: %s\\n" % e) \n' +
204
+ '\n' +
205
+ ' fb.logout()\n' +
206
+ ' print(BANNER)\n' +
207
+ " print(strftime('%d/%m/%Y %H:%M:%S %Z', gmtime()))\n" +
208
+ ' print(BANNER)\n' +
209
+ ' sys.exit(exit_code)\n' +
210
+ '\n' +
211
+ 'main()'
212
+ )
213
+ const language = ref('python')
214
+
215
+ const theme = computed(() => {
216
+ return isDark.value
217
+ ? DlCodeEditorTheme.Dark
218
+ : DlCodeEditorTheme.Light
219
+ })
220
+
221
+ const options = computed<DlCodeEditorOptions>(() => ({
222
+ lineNumbers: lines.value
223
+ }))
224
+
225
+ watch(codeEditorValue, (val) => {
226
+ console.log('@@@', val)
227
+ })
228
+
229
+ return {
230
+ lines,
231
+ codeEditorValue,
232
+ language,
233
+ isDark,
234
+ theme,
235
+ readonly,
236
+ options
237
+ }
238
+ }
239
+ })
240
+ </script>
241
+
242
+ <style scoped lang="scss">
243
+ .layout-empty-state {
244
+ display: grid;
245
+ width: 100%;
246
+ }
247
+ </style>
@@ -0,0 +1,2 @@
1
+ import DlCodeEditorDemo from './DlCodeEditorDemo.vue'
2
+ export { DlCodeEditorDemo }
@@ -1,51 +1,107 @@
1
1
  <template>
2
- <dl-confusion-matrix
3
- :matrix="matrix"
4
- :labels="labels"
5
- />
2
+ <div>
3
+ <dl-confusion-matrix
4
+ :matrix="matrix"
5
+ :labels="labels"
6
+ />
7
+
8
+ <dl-confusion-matrix
9
+ :matrix="matrix"
10
+ :labels="labels"
11
+ is-empty
12
+ :empty-state-props="{
13
+ responsive: true,
14
+ style: 'min-height: 350px;',
15
+ bgSize: '130px',
16
+ bgImage: `url(https://raw.githubusercontent.com/dataloop-ai/icons/main/assets/usage.svg)`,
17
+ title: 'Lorem ipsum',
18
+ subtitle:
19
+ 'Lorem ipsum dolor sit amet consectetur. Senectus condimentum dolor sit',
20
+ info: 'To learn more about this analytics, read our documentation.'
21
+ }"
22
+ >
23
+ <template #links="">
24
+ <div style="display: flex; gap: 5px; padding: 0 20px">
25
+ <dl-button
26
+ padding="0px"
27
+ icon="icon-dl-sdk-documentation"
28
+ flat
29
+ uppercase
30
+ label="SDK"
31
+ />
32
+ <div class="break" />
33
+ <dl-button
34
+ padding="0px"
35
+ icon="icon-dl-file"
36
+ flat
37
+ label="Documentation"
38
+ />
39
+ <div class="break" />
40
+ <dl-button
41
+ padding="0px"
42
+ icon="icon-dl-youtube"
43
+ flat
44
+ label="Video"
45
+ />
46
+ </div>
47
+ </template>
48
+ </dl-confusion-matrix>
49
+ </div>
6
50
  </template>
7
51
 
8
52
  <script lang="ts">
9
53
  import { defineComponent } from 'vue-demi'
10
- import { DlConfusionMatrix } from '../components'
11
- export default defineComponent({
12
- components: {
13
- DlConfusionMatrix
14
- },
15
- setup() {
16
- const matrix = []
17
- const labels = []
18
- const size = 10
54
+ import { DlConfusionMatrix, DlButton } from '../components'
19
55
 
20
- const getLink = (number: number) => {
21
- return `www.confusion-matrix.com/cell-${number}`
22
- }
56
+ const getLink = (number: number) => {
57
+ return `www.confusion-matrix.com/cell-${number}`
58
+ }
23
59
 
24
- for (let i = 0; i < size; i++) {
25
- const row = []
26
- for (let j = 0; j < size; j++) {
27
- const value = Math.floor(Math.random() * 10)
28
- row.push({
29
- value,
30
- link: getLink(value)
31
- })
32
- }
33
- matrix.push(row)
60
+ const getMatrix = (size: number) => {
61
+ const newMatrix = []
62
+
63
+ for (let i = 0; i < size; i++) {
64
+ const row = []
65
+ for (let j = 0; j < size; j++) {
66
+ const value = Math.floor(Math.random() * 10)
67
+ row.push({
68
+ value,
69
+ link: getLink(value)
70
+ })
34
71
  }
72
+ newMatrix.push(row)
73
+ }
74
+ return newMatrix
75
+ }
35
76
 
36
- // const items = [
37
- // { title: 'Van', image: 'https://picsum.photos/200/200' },
38
- // { title: 'Truck', image: 'https://picsum.photos/200/200' },
39
- // { title: 'Motorcycle', image: 'https://picsum.photos/200/200'},
40
- // { title: 'Car', image: 'https://picsum.photos/200/200'},
41
- // { title: 'Bus', image: 'https://picsum.photos/200/200'}
42
- // ]
77
+ const getLabels = (size: number) => {
78
+ const items = ['Van', 'Truck', 'Motorcycle', 'Car', 'Bus']
43
79
 
44
- const items = ['Van', 'Truck', 'Motorcycle', 'Car', 'Bus']
80
+ // const items = [
81
+ // { title: 'Van', image: 'https://picsum.photos/200/200' },
82
+ // { title: 'Truck', image: 'https://picsum.photos/200/200' },
83
+ // { title: 'Motorcycle', image: 'https://picsum.photos/200/200'},
84
+ // { title: 'Car', image: 'https://picsum.photos/200/200'},
85
+ // { title: 'Bus', image: 'https://picsum.photos/200/200'}
86
+ // ]
87
+ const newLabels = []
45
88
 
46
- for (let i = 0; i < size; i++) {
47
- labels.push(items[Math.floor(Math.random() * items.length)])
48
- }
89
+ for (let i = 0; i < size; i++) {
90
+ newLabels.push(items[Math.floor(Math.random() * items.length)])
91
+ }
92
+
93
+ return newLabels
94
+ }
95
+
96
+ export default defineComponent({
97
+ components: {
98
+ DlConfusionMatrix,
99
+ DlButton
100
+ },
101
+ setup() {
102
+ const SIZE = 10
103
+ const matrix = getMatrix(SIZE)
104
+ const labels = getLabels(SIZE)
49
105
 
50
106
  return { matrix, labels, getLink }
51
107
  }
@@ -0,0 +1,235 @@
1
+ <template>
2
+ <DlThemeProvider :is-dark="darkMode">
3
+ <div
4
+ style="display: flex; width: 100%; align-items: center; align-content; center;"
5
+ >
6
+ <dl-typography
7
+ color="dl-color-medium"
8
+ variant="p"
9
+ style="margin: 10px 0px 20px 0px; width: 90%"
10
+ >
11
+ <div
12
+ style="
13
+ background-image: url(https://dataloop.ai/wp-content/uploads/2020/03/logo.svg);
14
+ width: 160px;
15
+ height: 28px;
16
+ display: inline-block;
17
+ "
18
+ />
19
+ Components library
20
+ </dl-typography>
21
+ <div style="display: flex; align-items: center">
22
+ <dl-icon
23
+ icon="icon-dl-light-theme"
24
+ size="24px"
25
+ :color="
26
+ !darkMode ? 'dl-color-secondary' : 'dl-color-darker'
27
+ "
28
+ />
29
+ <dl-switch
30
+ v-model="darkMode"
31
+ style="margin: 0 20px"
32
+ />
33
+ <dl-icon
34
+ icon="icon-dl-dark-theme"
35
+ size="20px"
36
+ :color="darkMode ? 'dl-color-secondary' : 'dl-color-darker'"
37
+ />
38
+ </div>
39
+ </div>
40
+ <div class="layout-wrapper">
41
+ <div class="sidebar">
42
+ <dl-search
43
+ v-model="filterTerm"
44
+ style="margin-bottom: 5px"
45
+ />
46
+
47
+ <dl-button
48
+ v-if="activeDemo"
49
+ outlined
50
+ >
51
+ <span style="text-transform: capitalize">
52
+ Selected: {{ computeDemoName(activeDemo.name) }}
53
+ </span>
54
+ </dl-button>
55
+ <dl-list
56
+ bordered
57
+ clickable
58
+ style="
59
+ margin-top: 15px;
60
+ min-width: 200px;
61
+ height: 100%;
62
+ height: calc(100vh - 18vh);
63
+ overflow: auto;
64
+ "
65
+ >
66
+ <template #default="{ clickable }">
67
+ <dl-list-item
68
+ v-for="(demo, index) in filteredDemos"
69
+ :key="demo.name"
70
+ :separator="index !== filteredDemos.length - 1"
71
+ :clickable="clickable"
72
+ :class="isSelectedDemo(demo) ? 'selected' : ''"
73
+ style="text-transform: capitalize"
74
+ @click="setActiveDemo(demo)"
75
+ >
76
+ {{ computeDemoName(demo.name) }}
77
+ </dl-list-item>
78
+ </template>
79
+ </dl-list>
80
+ </div>
81
+ <div class="content">
82
+ <div style="display: flex; justify-content: center">
83
+ <dl-typography
84
+ size="h2"
85
+ variant="h2"
86
+ style="text-transform: capitalize"
87
+ >
88
+ {{
89
+ activeDemo
90
+ ? computeDemoName(activeDemo.name)
91
+ : 'No selected'
92
+ }}
93
+ component
94
+ </dl-typography>
95
+ </div>
96
+ <component
97
+ :is="activeDemo.component"
98
+ v-if="activeDemo"
99
+ class="data-container"
100
+ />
101
+ </div>
102
+ </div>
103
+ </DlThemeProvider>
104
+ </template>
105
+
106
+ <script lang="ts">
107
+ import { defineComponent, ref, computed, shallowRef } from 'vue-demi'
108
+ import {
109
+ DlThemeProvider,
110
+ DlButton,
111
+ DlListItem,
112
+ DlList,
113
+ DlTypography,
114
+ DlSearch,
115
+ DlSwitch,
116
+ DlIcon
117
+ } from '../components'
118
+ import Demos from '.'
119
+
120
+ export default defineComponent({
121
+ name: 'DlComponentsDemo',
122
+ components: {
123
+ DlThemeProvider,
124
+ DlButton,
125
+ DlListItem,
126
+ DlList,
127
+ DlTypography,
128
+ DlSearch,
129
+ DlSwitch,
130
+ DlIcon
131
+ },
132
+ props: {
133
+ isDark: { required: false, default: false, type: Boolean }
134
+ },
135
+ setup(props) {
136
+ const darkMode = ref(props.isDark)
137
+ const filterTerm = ref('')
138
+ const names = Object.keys(Demos)
139
+ const demos: {
140
+ name: string
141
+ component: any
142
+ }[] = names.map((n: string) => ({
143
+ name: n,
144
+ // @ts-ignore
145
+ component: Demos[n]
146
+ }))
147
+
148
+ const filteredDemos = computed(() => {
149
+ if (!filterTerm.value || !filterTerm.value.length) {
150
+ return demos
151
+ }
152
+
153
+ return demos.filter((demo: { name: string; component: any }) => {
154
+ return demo.name
155
+ .toLowerCase()
156
+ .includes(filterTerm.value.toLowerCase())
157
+ })
158
+ })
159
+
160
+ const activeDemo = shallowRef(
161
+ window.localStorage.getItem('dl-active-demo')
162
+ ? demos.find(
163
+ (d) =>
164
+ d.name ===
165
+ window.localStorage.getItem('dl-active-demo')
166
+ ) ?? null
167
+ : null
168
+ )
169
+
170
+ const setActiveDemo = (demo: { name: string; component: any }) => {
171
+ activeDemo.value = demo
172
+ filterTerm.value = ''
173
+ window.localStorage.setItem('dl-active-demo', demo.name)
174
+ }
175
+
176
+ const computeDemoName = (name: string) => {
177
+ return name.includes('Dl')
178
+ ? name.split('Demo')[0]
179
+ : 'Dl' + name.split('Demo')[0]
180
+ }
181
+
182
+ const isSelectedDemo = (demo: { name: string; component: any }) => {
183
+ return activeDemo.value?.name === demo.name
184
+ }
185
+
186
+ return {
187
+ darkMode,
188
+ activeDemo,
189
+ setActiveDemo,
190
+ filterTerm,
191
+ filteredDemos,
192
+ computeDemoName,
193
+ isSelectedDemo
194
+ }
195
+ }
196
+ })
197
+ </script>
198
+
199
+ <style scoped lang="scss">
200
+ .layout-wrapper {
201
+ display: flex;
202
+ }
203
+
204
+ .sidebar {
205
+ display: flex;
206
+ flex-direction: column;
207
+ }
208
+
209
+ .content {
210
+ padding: 20px 30px;
211
+ flex-grow: 1;
212
+ }
213
+
214
+ .data-container {
215
+ display: flex;
216
+ gap: 1rem;
217
+ align-items: center;
218
+ max-width: 100%;
219
+ overflow: auto;
220
+ padding: 20px;
221
+ margin: 0 auto;
222
+ flex-direction: column;
223
+ justify-content: center;
224
+ min-width: 950px;
225
+ resize: both;
226
+ box-shadow: var(--dl-menu-shadow);
227
+ }
228
+
229
+ .selected {
230
+ ::v-deep .row {
231
+ color: var(--dl-color-secondary) !important;
232
+ background-color: var(--dl-color-fill);
233
+ }
234
+ }
235
+ </style>