@vertesia/ui 0.64.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/lib/esm/core/components/EmptyCollection.js +2 -2
  2. package/lib/esm/core/components/EmptyCollection.js.map +1 -1
  3. package/lib/esm/core/components/InputList.js +2 -2
  4. package/lib/esm/core/components/InputList.js.map +1 -1
  5. package/lib/esm/core/components/SidePanel.js +1 -1
  6. package/lib/esm/core/components/SidePanel.js.map +1 -1
  7. package/lib/esm/core/components/Switch.js +2 -2
  8. package/lib/esm/core/components/Switch.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/calendar.js +0 -1
  10. package/lib/esm/core/components/shadcn/calendar.js.map +1 -1
  11. package/lib/esm/core/components/shadcn/checkbox.js +0 -1
  12. package/lib/esm/core/components/shadcn/checkbox.js.map +1 -1
  13. package/lib/esm/core/components/shadcn/command.js +0 -1
  14. package/lib/esm/core/components/shadcn/command.js.map +1 -1
  15. package/lib/esm/core/components/shadcn/dialog.js +0 -1
  16. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  17. package/lib/esm/core/components/shadcn/filters/comboBox.js +18 -0
  18. package/lib/esm/core/components/shadcn/filters/comboBox.js.map +1 -1
  19. package/lib/esm/core/components/shadcn/filters/filterBar.js +38 -17
  20. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  21. package/lib/esm/core/components/shadcn/filters/filters.js +11 -5
  22. package/lib/esm/core/components/shadcn/filters/filters.js.map +1 -1
  23. package/lib/esm/core/components/shadcn/filters/selectFilter.js +1 -1
  24. package/lib/esm/core/components/shadcn/filters/selectFilter.js.map +1 -1
  25. package/lib/esm/core/components/shadcn/filters/stringListFilter.js +24 -0
  26. package/lib/esm/core/components/shadcn/filters/stringListFilter.js.map +1 -0
  27. package/lib/esm/core/components/shadcn/filters/textFilter.js +2 -1
  28. package/lib/esm/core/components/shadcn/filters/textFilter.js.map +1 -1
  29. package/lib/esm/core/components/shadcn/label.js +0 -1
  30. package/lib/esm/core/components/shadcn/label.js.map +1 -1
  31. package/lib/esm/core/components/shadcn/selectBox.js +1 -1
  32. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  33. package/lib/esm/env/index.js +4 -1
  34. package/lib/esm/env/index.js.map +1 -1
  35. package/lib/esm/features/agent/PayloadBuilder.js +56 -16
  36. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  37. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +2 -6
  38. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  39. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +2 -2
  40. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  41. package/lib/esm/features/facets/VEnvironmentFacet.js +24 -0
  42. package/lib/esm/features/facets/VEnvironmentFacet.js.map +1 -0
  43. package/lib/esm/features/facets/VFacetsNav.js +69 -26
  44. package/lib/esm/features/facets/VFacetsNav.js.map +1 -1
  45. package/lib/esm/features/facets/VInteractionFacet.js +45 -0
  46. package/lib/esm/features/facets/VInteractionFacet.js.map +1 -0
  47. package/lib/esm/features/facets/VStringFacet.js +6 -5
  48. package/lib/esm/features/facets/VStringFacet.js.map +1 -1
  49. package/lib/esm/features/facets/VUserFacet.js +6 -6
  50. package/lib/esm/features/facets/VUserFacet.js.map +1 -1
  51. package/lib/esm/features/layout/GenericPageNavHeader.js +1 -1
  52. package/lib/esm/features/magic-pdf/PdfPageProvider.js +3 -3
  53. package/lib/esm/features/magic-pdf/PdfPageProvider.js.map +1 -1
  54. package/lib/esm/features/magic-pdf/TextPageView.js +1 -2
  55. package/lib/esm/features/magic-pdf/TextPageView.js.map +1 -1
  56. package/lib/esm/features/store/collections/CollectionsTable.js +9 -5
  57. package/lib/esm/features/store/collections/CollectionsTable.js.map +1 -1
  58. package/lib/esm/features/store/collections/{CollectionsView.js → CreateCollection.js} +6 -14
  59. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -0
  60. package/lib/esm/features/store/collections/EditCollectionView.js +1 -1
  61. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  62. package/lib/esm/features/store/collections/SelectCollection.js +24 -0
  63. package/lib/esm/features/store/collections/SelectCollection.js.map +1 -0
  64. package/lib/esm/features/store/collections/index.js +2 -2
  65. package/lib/esm/features/store/collections/index.js.map +1 -1
  66. package/lib/esm/features/store/objects/DocumentSearchResults.js +6 -3
  67. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  68. package/lib/esm/features/store/objects/components/ContentOverview.js +14 -14
  69. package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
  70. package/lib/esm/features/store/objects/components/DocumentIcon.js +7 -10
  71. package/lib/esm/features/store/objects/components/DocumentIcon.js.map +1 -1
  72. package/lib/esm/features/store/objects/components/DocumentInput.js +1 -2
  73. package/lib/esm/features/store/objects/components/DocumentInput.js.map +1 -1
  74. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +4 -2
  75. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -1
  76. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js +1 -2
  77. package/lib/esm/features/store/objects/components/SaveVersionConfirmModal.js.map +1 -1
  78. package/lib/esm/features/store/objects/components/SelectDocument.js +9 -3
  79. package/lib/esm/features/store/objects/components/SelectDocument.js.map +1 -1
  80. package/lib/esm/features/store/objects/components/SelectDocumentModal.js +2 -2
  81. package/lib/esm/features/store/objects/components/SelectDocumentModal.js.map +1 -1
  82. package/lib/esm/features/store/objects/layout/documentLayout.js +2 -2
  83. package/lib/esm/features/store/objects/layout/documentLayout.js.map +1 -1
  84. package/lib/esm/features/store/objects/search/DocumentSearchContext.js +4 -2
  85. package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
  86. package/lib/esm/features/store/objects/selection/SelectionActions.js +1 -1
  87. package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
  88. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +7 -10
  89. package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
  90. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +1 -1
  91. package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +1 -1
  92. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js +2 -2
  93. package/lib/esm/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
  94. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +1 -1
  95. package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +1 -1
  96. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js +1 -1
  97. package/lib/esm/features/store/objects/selection/actions/RemoveFromCollectionAction.js.map +1 -1
  98. package/lib/esm/features/store/types/ContentObjectTypesSearch.js +2 -3
  99. package/lib/esm/features/store/types/ContentObjectTypesSearch.js.map +1 -1
  100. package/lib/esm/features/store/types/ContentObjectTypesTable.js +1 -1
  101. package/lib/esm/features/store/types/ContentObjectTypesTable.js.map +1 -1
  102. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js +2 -2
  103. package/lib/esm/features/store/types/CreateOrUpdateTypeModal.js.map +1 -1
  104. package/lib/esm/features/store/types/ObjectSchemaEditor.js +2 -3
  105. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
  106. package/lib/esm/features/store/types/TableLayoutEditor.js +1 -1
  107. package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -1
  108. package/lib/esm/features/store/types/index.js +0 -2
  109. package/lib/esm/features/store/types/index.js.map +1 -1
  110. package/lib/esm/features/user/UserInfo.js +1 -2
  111. package/lib/esm/features/user/UserInfo.js.map +1 -1
  112. package/lib/esm/features/utils/rendition.js +22 -2
  113. package/lib/esm/features/utils/rendition.js.map +1 -1
  114. package/lib/esm/session/UserSession.js +2 -2
  115. package/lib/esm/session/UserSession.js.map +1 -1
  116. package/lib/esm/session/auth/composable.js +1 -1
  117. package/lib/esm/session/auth/composable.js.map +1 -1
  118. package/lib/esm/session/constants.js +3 -0
  119. package/lib/esm/session/constants.js.map +1 -0
  120. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +2 -2
  121. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +1 -1
  122. package/lib/esm/widgets/properties/PropertiesView.js +4 -2
  123. package/lib/esm/widgets/properties/PropertiesView.js.map +1 -1
  124. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js +1 -1
  125. package/lib/esm/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
  126. package/lib/tsconfig.tsbuildinfo +1 -1
  127. package/lib/types/core/components/InputList.d.ts +2 -1
  128. package/lib/types/core/components/Switch.d.ts +2 -1
  129. package/lib/types/core/components/shadcn/filters/comboBox.d.ts +5 -0
  130. package/lib/types/core/components/shadcn/filters/stringListFilter.d.ts +10 -0
  131. package/lib/types/core/components/shadcn/filters/types.d.ts +3 -3
  132. package/lib/types/env/index.d.ts +1 -0
  133. package/lib/types/features/agent/PayloadBuilder.d.ts +12 -2
  134. package/lib/types/features/facets/VEnvironmentFacet.d.ts +11 -0
  135. package/lib/types/features/facets/VFacetsNav.d.ts +9 -1
  136. package/lib/types/features/facets/VInteractionFacet.d.ts +14 -0
  137. package/lib/types/features/facets/VStringFacet.d.ts +3 -2
  138. package/lib/types/features/facets/VUserFacet.d.ts +3 -2
  139. package/lib/types/features/store/collections/{CollectionsView.d.ts → CreateCollection.d.ts} +5 -3
  140. package/lib/types/features/store/collections/SelectCollection.d.ts +14 -0
  141. package/lib/types/features/store/collections/index.d.ts +2 -2
  142. package/lib/types/features/store/objects/components/ContentOverview.d.ts +2 -1
  143. package/lib/types/features/store/objects/components/DocumentIcon.d.ts +2 -1
  144. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts +2 -1
  145. package/lib/types/features/store/objects/layout/documentLayout.d.ts +1 -1
  146. package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts +3 -2
  147. package/lib/types/features/store/objects/selection/actions/DeleteObjectsAction.d.ts +2 -1
  148. package/lib/types/features/store/objects/selection/actions/RemoveFromCollectionAction.d.ts +2 -1
  149. package/lib/types/features/store/types/index.d.ts +0 -2
  150. package/lib/types/features/utils/rendition.d.ts +1 -1
  151. package/lib/types/session/UserSession.d.ts +2 -2
  152. package/lib/types/session/constants.d.ts +2 -0
  153. package/lib/vertesia-ui-core.js +1 -1
  154. package/lib/vertesia-ui-core.js.map +1 -1
  155. package/lib/vertesia-ui-env.js +1 -1
  156. package/lib/vertesia-ui-env.js.map +1 -1
  157. package/lib/vertesia-ui-features.js +1 -1
  158. package/lib/vertesia-ui-features.js.map +1 -1
  159. package/lib/vertesia-ui-session.js +1 -1
  160. package/lib/vertesia-ui-session.js.map +1 -1
  161. package/lib/vertesia-ui-widgets.js +1 -1
  162. package/lib/vertesia-ui-widgets.js.map +1 -1
  163. package/package.json +6 -4
  164. package/src/core/components/EmptyCollection.tsx +26 -24
  165. package/src/core/components/InputList.tsx +3 -1
  166. package/src/core/components/SidePanel.tsx +2 -2
  167. package/src/core/components/Switch.tsx +4 -3
  168. package/src/core/components/shadcn/calendar.tsx +0 -2
  169. package/src/core/components/shadcn/checkbox.tsx +0 -2
  170. package/src/core/components/shadcn/command.tsx +0 -2
  171. package/src/core/components/shadcn/dialog.tsx +0 -2
  172. package/src/core/components/shadcn/filters/comboBox.tsx +73 -0
  173. package/src/core/components/shadcn/filters/filterBar.tsx +41 -17
  174. package/src/core/components/shadcn/filters/filters.tsx +30 -14
  175. package/src/core/components/shadcn/filters/selectFilter.tsx +3 -3
  176. package/src/core/components/shadcn/filters/stringListFilter.tsx +58 -0
  177. package/src/core/components/shadcn/filters/textFilter.tsx +2 -1
  178. package/src/core/components/shadcn/filters/types.ts +3 -3
  179. package/src/core/components/shadcn/label.tsx +0 -2
  180. package/src/core/components/shadcn/selectBox.tsx +1 -1
  181. package/src/env/index.ts +5 -1
  182. package/src/features/agent/PayloadBuilder.tsx +66 -16
  183. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +0 -11
  184. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +11 -12
  185. package/src/features/facets/VEnvironmentFacet.tsx +42 -0
  186. package/src/features/facets/VFacetsNav.tsx +87 -29
  187. package/src/features/facets/VInteractionFacet.tsx +73 -0
  188. package/src/features/facets/VStringFacet.tsx +7 -6
  189. package/src/features/facets/VUserFacet.tsx +7 -6
  190. package/src/features/layout/GenericPageNavHeader.tsx +1 -1
  191. package/src/features/magic-pdf/PdfPageProvider.tsx +3 -3
  192. package/src/features/magic-pdf/TextPageView.tsx +1 -2
  193. package/src/features/store/collections/CollectionsTable.tsx +49 -40
  194. package/src/features/store/collections/{CollectionsView.tsx → CreateCollection.tsx} +15 -42
  195. package/src/features/store/collections/EditCollectionView.tsx +1 -1
  196. package/src/features/store/collections/SelectCollection.tsx +46 -0
  197. package/src/features/store/collections/index.ts +2 -2
  198. package/src/features/store/objects/DocumentSearchResults.tsx +6 -3
  199. package/src/features/store/objects/components/ContentOverview.tsx +33 -95
  200. package/src/features/store/objects/components/DocumentIcon.tsx +27 -14
  201. package/src/features/store/objects/components/DocumentInput.tsx +1 -2
  202. package/src/features/store/objects/components/PropertiesEditorModal.tsx +7 -3
  203. package/src/features/store/objects/components/SaveVersionConfirmModal.tsx +2 -2
  204. package/src/features/store/objects/components/SelectDocument.tsx +18 -3
  205. package/src/features/store/objects/components/SelectDocumentModal.tsx +6 -6
  206. package/src/features/store/objects/layout/documentLayout.tsx +2 -2
  207. package/src/features/store/objects/search/DocumentSearchContext.ts +6 -3
  208. package/src/features/store/objects/selection/ObjectsActionContext.tsx +1 -1
  209. package/src/features/store/objects/selection/SelectionActions.tsx +0 -1
  210. package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +10 -21
  211. package/src/features/store/objects/selection/actions/ChangeTypeAction.tsx +1 -1
  212. package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +2 -2
  213. package/src/features/store/objects/selection/actions/ExportPropertiesAction.tsx +1 -1
  214. package/src/features/store/objects/selection/actions/RemoveFromCollectionAction.tsx +1 -1
  215. package/src/features/store/types/ContentObjectTypesSearch.tsx +3 -4
  216. package/src/features/store/types/ContentObjectTypesTable.tsx +3 -1
  217. package/src/features/store/types/CreateOrUpdateTypeModal.tsx +2 -9
  218. package/src/features/store/types/ObjectSchemaEditor.tsx +4 -5
  219. package/src/features/store/types/TableLayoutEditor.tsx +4 -4
  220. package/src/features/store/types/index.ts +0 -2
  221. package/src/features/user/UserInfo.tsx +1 -2
  222. package/src/features/utils/rendition.ts +23 -1
  223. package/src/session/UserSession.ts +2 -2
  224. package/src/session/auth/composable.ts +1 -1
  225. package/src/session/constants.ts +2 -0
  226. package/src/widgets/codemirror/CodeMirrorEditor.tsx +2 -2
  227. package/src/widgets/properties/PropertiesView.tsx +10 -2
  228. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +1 -1
  229. package/lib/esm/features/store/collections/CollectionView.js +0 -53
  230. package/lib/esm/features/store/collections/CollectionView.js.map +0 -1
  231. package/lib/esm/features/store/collections/CollectionsView.js.map +0 -1
  232. package/lib/esm/features/store/types/ContentObjectTypeView.js +0 -158
  233. package/lib/esm/features/store/types/ContentObjectTypeView.js.map +0 -1
  234. package/lib/esm/features/store/types/ContentObjectTypesView.js +0 -55
  235. package/lib/esm/features/store/types/ContentObjectTypesView.js.map +0 -1
  236. package/lib/types/features/store/collections/CollectionView.d.ts +0 -5
  237. package/lib/types/features/store/types/ContentObjectTypeView.d.ts +0 -5
  238. package/lib/types/features/store/types/ContentObjectTypesView.d.ts +0 -8
  239. package/src/features/store/collections/CollectionView.tsx +0 -94
  240. package/src/features/store/types/ContentObjectTypeView.tsx +0 -244
  241. package/src/features/store/types/ContentObjectTypesView.tsx +0 -71
@@ -1,158 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import dayjs from 'dayjs';
3
- import LocalizedFormat from 'dayjs/plugin/localizedFormat';
4
- import { useState } from 'react';
5
- import { Button, Center, ErrorBox, Popover, PopoverContent, PopoverTrigger, Spinner, Switch, Tabs, TabsBar, TabsPanel, useFetch, useToast } from '@vertesia/ui/core';
6
- import { FullHeightLayout } from '@vertesia/ui/layout';
7
- import { useLocation, useNavigate } from "@vertesia/ui/router";
8
- import { useUserSession } from '@vertesia/ui/session';
9
- import { PropertiesView } from '@vertesia/ui/widgets';
10
- import { EllipsisVertical, SquarePen, Trash2 } from 'lucide-react';
11
- import { GenericPageNavHeader } from "../../layout";
12
- import { UserInfo } from '../../user/UserInfo';
13
- import { CreateOrUpdateTypeModal } from './CreateOrUpdateTypeModal';
14
- import { ObjectSchemaEditor } from './ObjectSchemaEditor';
15
- import { TableLayoutEditor } from './TableLayoutEditor';
16
- dayjs.extend(LocalizedFormat);
17
- export function ContentObjectTypeView({ typeId }) {
18
- const { store, user } = useUserSession();
19
- const { hash } = useLocation();
20
- const currentTab = hash ? hash.substring(1) : undefined;
21
- let { data: objectType, isLoading, error, refetch } = useFetch(() => {
22
- if (user) {
23
- return store.types.retrieve(typeId);
24
- }
25
- else {
26
- return Promise.resolve(undefined);
27
- }
28
- }, [user]);
29
- if (error) {
30
- return _jsx(ErrorBox, { title: "Error", children: error.message });
31
- }
32
- if (isLoading) {
33
- return _jsx(Center, { className: "py-10", children: _jsx(Spinner, { size: 'lg' }) });
34
- }
35
- if (!objectType) {
36
- return null;
37
- }
38
- const actions = [
39
- _jsx(DeleteTypeButton, { objectType: objectType }, "delete")
40
- ];
41
- const onSchemaUpdate = (value) => {
42
- objectType.object_schema = value.schema;
43
- };
44
- const onLayoutUpdate = (value) => {
45
- objectType.table_layout = value;
46
- };
47
- const tabs = [
48
- { name: 'metadata', label: "Metadata", href: "#metadata", content: _jsx(MetadataView, { objectType: objectType }) },
49
- { name: 'schema', label: "Object Schema", href: "#schema", content: _jsx(ObjectSchemaEditor, { objectType: objectType, onSchemaUpdate: onSchemaUpdate }) },
50
- { name: 'layout', label: "Table Layout", href: "#layout", content: _jsx(TableLayoutEditor, { objectType: objectType, onLayoutUpdate: onLayoutUpdate }) },
51
- ];
52
- const breadcrumbs = [breadcrumb()];
53
- const title = pageTitle(objectType, refetch);
54
- const description = objectType.description;
55
- return (_jsxs(FullHeightLayout, { children: [_jsx(GenericPageNavHeader, { title: title, description: description, actions: [actions], breadcrumbs: breadcrumbs }), _jsxs(Tabs, { tabs: tabs, current: currentTab, children: [_jsx(TabsBar, {}), _jsx(FullHeightLayout.Body, { children: _jsx("div", { className: "h-[calc(100vh-187px)] overflow-auto", children: _jsx(TabsPanel, {}) }) })] })] }));
56
- }
57
- function breadcrumb() {
58
- return _jsx("span", { children: "Content Type" });
59
- }
60
- function pageTitle(objectType, refetch) {
61
- return _jsx(PageTitle, { objectType: objectType, refetch: refetch });
62
- }
63
- function PageTitle({ objectType, refetch }) {
64
- const toast = useToast();
65
- const session = useUserSession();
66
- const { store } = session;
67
- const [showEditModal, setShowEditModal] = useState(false);
68
- const onCloseEditModal = (payload) => {
69
- if (!payload) {
70
- setShowEditModal(false);
71
- return Promise.resolve();
72
- }
73
- return store.types.update(objectType.id, payload).then(() => {
74
- toast({
75
- status: 'success',
76
- title: 'Type updated',
77
- duration: 2000
78
- });
79
- return refetch().finally(() => session.reloadTypes());
80
- }).catch(err => {
81
- toast({
82
- status: 'error',
83
- title: 'Error updating type',
84
- description: err.message,
85
- duration: 5000
86
- });
87
- });
88
- };
89
- return _jsxs(_Fragment, { children: [_jsxs("div", { className: 'flex items-center gap-x-2', children: [objectType.name, " ", _jsx(Button, { variant: "ghost", size: "sm", title: "Edit", onClick: () => setShowEditModal(true), children: _jsx(SquarePen, { className: "size-4" }) })] }), _jsx(CreateOrUpdateTypeModal, { okLabel: "Save Changes", title: "Edit Type", isOpen: showEditModal, onClose: onCloseEditModal, initialPayload: objectType })] });
90
- }
91
- function MetadataView({ objectType }) {
92
- return (_jsx(PropertiesView, { className: 'w-full', properties: [
93
- { name: "Id", value: objectType.id },
94
- { name: "Name", value: objectType.name },
95
- { name: "Is Chunkable", value: _jsx(ChunkableSwitch, { objectType: objectType }) },
96
- { name: "Strict Mode", value: _jsx(StrictModeSwitch, { objectType: objectType }) },
97
- { name: 'Created By', value: _jsx(UserInfo, { userRef: objectType.created_by }) },
98
- { name: 'Created At', value: dayjs(objectType.created_at).format('LLL') },
99
- { name: 'Updated By', value: _jsx(UserInfo, { userRef: objectType.updated_by }) },
100
- { name: 'Updated At', value: dayjs(objectType.updated_at).format('LLL') },
101
- ] }));
102
- }
103
- function TypeSwitch({ objectType, field, initialValue }) {
104
- const [value, setValue] = useState(initialValue ?? false);
105
- const toast = useToast();
106
- const { store } = useUserSession();
107
- const onChange = (value) => {
108
- store.types.update(objectType.id, {
109
- [field]: value
110
- }).then(() => {
111
- setValue(value);
112
- toast({
113
- status: 'success',
114
- title: 'Successfully Updated.',
115
- duration: 2000
116
- });
117
- }).catch((err) => {
118
- toast({
119
- status: 'error',
120
- title: 'Failed to update.',
121
- description: err.message,
122
- duration: 5000
123
- });
124
- });
125
- };
126
- return (_jsx(Switch, { value: value, onChange: onChange }));
127
- }
128
- function ChunkableSwitch({ objectType }) {
129
- return (_jsx(TypeSwitch, { objectType: objectType, field: "is_chunkable", initialValue: objectType.is_chunkable ?? false }));
130
- }
131
- function StrictModeSwitch({ objectType }) {
132
- return (_jsx(TypeSwitch, { objectType: objectType, field: "strict_mode", initialValue: objectType.strict_mode ?? false }));
133
- }
134
- function DeleteTypeButton({ objectType }) {
135
- const toast = useToast();
136
- const navigate = useNavigate();
137
- const { store } = useUserSession();
138
- const onDelete = () => {
139
- confirm('Are you sure you want to delete this rule?') &&
140
- store.types.delete(objectType.id).then(() => {
141
- toast({
142
- status: 'success',
143
- title: `Object type ${objectType.name} deleted`,
144
- duration: 2000
145
- });
146
- navigate('/types');
147
- }).catch(err => {
148
- toast({
149
- status: 'error',
150
- title: 'Failed to delete rule',
151
- description: err.message,
152
- duration: 5000
153
- });
154
- });
155
- };
156
- return (_jsxs(Popover, { hover: true, children: [_jsx(PopoverTrigger, { children: _jsx("div", { className: 'cursor-pointer hover:bg-muted p-2 rounded-md', children: _jsx(Button, { variant: "ghost", size: 'sm', title: 'More actions', children: _jsx(EllipsisVertical, {}) }) }) }), _jsx(PopoverContent, { className: 'p-0 w-35', align: 'end', children: _jsx("div", { className: "py-2 px-1.5 flex justify-center w-full", children: _jsxs(Button, { variant: "ghost", onClick: onDelete, className: 'w-full', children: [_jsx(Trash2, { className: 'size-4' }), " Delete"] }) }) })] }));
157
- }
158
- //# sourceMappingURL=ContentObjectTypeView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContentObjectTypeView.js","sourceRoot":"","sources":["../../../../../src/features/store/types/ContentObjectTypeView.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAO,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1K,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,O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O,IAAC,KAAK,mBACV,KAAC,cAAc,cACX,cAAK,SAAS,EAAC,8CAA8C,YACzD,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,cAAc,YAAC,KAAC,gBAAgB,KAAG,GAAS,GAClF,GACQ,EAClB,KAAC,cAAc,IAAC,SAAS,EAAC,UAAU,EAAC,KAAK,EAAC,KAAK,YAC5C,cAAK,SAAS,EAAC,wCAAwC,YACnD,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAC,QAAQ,aACzD,KAAC,MAAM,IAAC,SAAS,EAAC,QAAQ,GAAG,eACxB,GACP,GACO,IACV,CACd,CAAA;AACL,CAAC"}
@@ -1,55 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { Button, useToast } from '@vertesia/ui/core';
4
- import { FullHeightLayout } from '@vertesia/ui/layout';
5
- import { useUserSession } from '@vertesia/ui/session';
6
- import { GenericPageNavHeader } from "../../layout";
7
- import { ContentObjectTypesSearch } from './ContentObjectTypesSearch';
8
- import { ObjectTypeSearchProvider } from './search/ObjectTypeSearchProvider';
9
- import { CreateOrUpdateTypeModal } from './CreateOrUpdateTypeModal';
10
- export var ChunkableOptions;
11
- (function (ChunkableOptions) {
12
- ChunkableOptions["true"] = "Yes";
13
- ChunkableOptions["false"] = "No";
14
- })(ChunkableOptions || (ChunkableOptions = {}));
15
- ;
16
- export function ContentObjectTypesView({}) {
17
- const toast = useToast();
18
- const [showCreateModal, setShowCreateModal] = useState(false);
19
- const session = useUserSession();
20
- const { store } = session;
21
- const actions = _jsx(Button, { variant: "primary", onClick: () => setShowCreateModal(true), children: "Create Type" }, "create");
22
- const [isDirty, setIsDirty] = useState(false);
23
- useEffect(() => {
24
- if (isDirty) {
25
- setIsDirty(false);
26
- }
27
- }, [isDirty]);
28
- const onCloseCreateModal = async (payload) => {
29
- if (!payload) {
30
- setShowCreateModal(false);
31
- return Promise.resolve();
32
- }
33
- return store.types.create(payload).then(async () => {
34
- toast({
35
- status: 'success',
36
- title: 'Type created',
37
- duration: 2000
38
- });
39
- session.reloadTypes();
40
- setIsDirty(true);
41
- }).catch(err => {
42
- toast({
43
- status: 'error',
44
- title: 'Error creating type',
45
- description: err.message,
46
- duration: 5000
47
- });
48
- });
49
- };
50
- const breadcrumbs = [
51
- _jsx("span", { children: "Content Type" }, '0')
52
- ];
53
- return (_jsxs(FullHeightLayout, { children: [_jsx(GenericPageNavHeader, { actions: actions, breadcrumbs: breadcrumbs, title: "Content Types" }), _jsx(CreateOrUpdateTypeModal, { okLabel: "Create", title: "Create Type", isOpen: showCreateModal, onClose: onCloseCreateModal }), _jsx(ObjectTypeSearchProvider, { children: _jsx(FullHeightLayout.Body, { children: _jsx(ContentObjectTypesSearch, { isDirty: isDirty }) }) })] }));
54
- }
55
- //# sourceMappingURL=ContentObjectTypesView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContentObjectTypesView.js","sourceRoot":"","sources":["../../../../../src/features/store/types/ContentObjectTypesView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAA6B,MAAM,2BAA2B,CAAC;AAE/F,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB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C,KAAK,CAAC,GAAG,CAAC,EAAE;YACX,KAAK,CAAC;gBACF,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,qBAAqB;gBAC5B,WAAW,EAAE,GAAG,CAAC,OAAO;gBACxB,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG;QAChB,2CAAU,GAAG,CAAoB;KACpC,CAAC;IAEF,OAAO,CACH,MAAC,gBAAgB,eACb,KAAC,oBAAoB,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAC,eAAe,GAAG,EAC1F,KAAC,uBAAuB,IAAC,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,aAAa,EAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,GAAI,EACtH,KAAC,wBAAwB,cACrB,KAAC,gBAAgB,CAAC,IAAI,cAClB,KAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,GAA6B,GACnD,GACD,IACZ,CACtB,CAAC;AACN,CAAC"}
@@ -1,5 +0,0 @@
1
- interface CollectionViewProps {
2
- collectionId: string;
3
- }
4
- export declare function CollectionView({ collectionId }: CollectionViewProps): import("react/jsx-runtime").JSX.Element;
5
- export {};
@@ -1,5 +0,0 @@
1
- interface ContentObjectTypeViewProps {
2
- typeId: string;
3
- }
4
- export declare function ContentObjectTypeView({ typeId }: ContentObjectTypeViewProps): import("react/jsx-runtime").JSX.Element | null;
5
- export {};
@@ -1,8 +0,0 @@
1
- export declare enum ChunkableOptions {
2
- true = "Yes",
3
- false = "No"
4
- }
5
- interface ContentObjectTypesViewProps {
6
- }
7
- export declare function ContentObjectTypesView({}: ContentObjectTypesViewProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,94 +0,0 @@
1
- import { Collection, FacetSpec } from "@vertesia/common";
2
- import { ErrorBox, Spinner, useFetch, VTabs, VTabsBar, VTabsPanel } from "@vertesia/ui/core";
3
- import { FullHeightLayout } from "@vertesia/ui/layout";
4
- import { NavLink } from "@vertesia/ui/router";
5
- import { useUserSession } from "@vertesia/ui/session";
6
- import { PanelErrorBoundary } from "../../errors";
7
- import { GenericPageNavHeader } from "../../layout";
8
- import { DocumentSearchProvider, DocumentSelectionProvider } from "../../store";
9
- import { SelectionActions, UploadObjectsButton } from "../objects/selection/SelectionActions";
10
- import { BrowseCollectionView } from "./BrowseCollectionView";
11
- import { EditCollectionView } from "./EditCollectionView";
12
-
13
- const facets: FacetSpec[] = [
14
- {
15
- name: 'status',
16
- field: 'status'
17
- },
18
- {
19
- name: 'type',
20
- field: 'type'
21
- }
22
- ];
23
-
24
-
25
- interface CollectionViewProps {
26
- collectionId: string;
27
- }
28
- export function CollectionView({ collectionId }: CollectionViewProps) {
29
- const { client } = useUserSession();
30
-
31
- const { data: collection, error, refetch, isLoading } = useFetch(() => client.store.collections.retrieve(collectionId), [collectionId]);
32
-
33
- if (error) {
34
- return <ErrorBox title='Collection fetch failed'>{error.message}</ErrorBox>
35
- }
36
-
37
- const actions = [
38
- <SelectionActions key='selection' />,
39
- <UploadObjectsButton key="upload" collectionId={collectionId ?? ''} />
40
- ];
41
-
42
- const title = (
43
- <div className='flex gap-x-1 items-center'>
44
- <div>{collection?.name || ''}</div>
45
- </div>
46
- )
47
-
48
- const breadcrumbs = [
49
- <NavLink href='/collections' key='collections'>Collections</NavLink>,
50
- <span key='collection-detail'>Collection Detail</span>
51
- ];
52
-
53
- const tabs = [
54
- {
55
- name: 'browse',
56
- label: 'Browse',
57
- content: <BrowseCollectionView collection={collection as Collection} />
58
- },
59
- {
60
- name: 'metadata',
61
- label: 'Metadata',
62
- content: <EditCollectionView collection={collection as Collection} refetch={refetch} />
63
- }
64
- ];
65
-
66
- return (
67
- <FullHeightLayout>
68
- <DocumentSearchProvider facets={facets} collectionId={collectionId}>
69
- <DocumentSelectionProvider collectionId={collectionId}>
70
- <GenericPageNavHeader title={title}
71
- description={collection?.description || ''}
72
- actions={actions}
73
- breadcrumbs={breadcrumbs}
74
- />
75
- <VTabs defaultValue="browse" tabs={tabs}>
76
- <VTabsBar className="px-4" />
77
- {
78
- isLoading ?
79
- <div className="w-full flex justify-center">
80
- <Spinner />
81
- </div> :
82
- <div className="h-[calc(100vh-165px)] overflow-auto px-4 py-2">
83
- <PanelErrorBoundary>
84
- <VTabsPanel />
85
- </PanelErrorBoundary>
86
- </div>
87
- }
88
- </VTabs>
89
-
90
- </DocumentSelectionProvider>
91
- </DocumentSearchProvider>
92
- </FullHeightLayout>
93
- )
94
- }
@@ -1,244 +0,0 @@
1
- import dayjs from 'dayjs';
2
- import LocalizedFormat from 'dayjs/plugin/localizedFormat';
3
- import { useState } from 'react';
4
-
5
- import { ColumnLayout, ContentObjectType } from '@vertesia/common';
6
- import { Button, Center, ErrorBox, Popover, PopoverContent, PopoverTrigger, Spinner, Switch, Tab, Tabs, TabsBar, TabsPanel, useFetch, useToast } from '@vertesia/ui/core';
7
- import { FullHeightLayout } from '@vertesia/ui/layout';
8
- import { useLocation, useNavigate } from "@vertesia/ui/router";
9
- import { useUserSession } from '@vertesia/ui/session';
10
- import { PropertiesView } from '@vertesia/ui/widgets';
11
- import { EllipsisVertical, SquarePen, Trash2 } from 'lucide-react';
12
- import { GenericPageNavHeader } from "../../layout";
13
- import { UserInfo } from '../../user/UserInfo';
14
-
15
- import { CreateOrUpdateTypeModal, CreateOrUpdateTypePayload } from './CreateOrUpdateTypeModal';
16
- import { ObjectSchemaEditor } from './ObjectSchemaEditor';
17
- import { TableLayoutEditor } from './TableLayoutEditor';
18
-
19
- dayjs.extend(LocalizedFormat)
20
-
21
- interface ContentObjectTypeViewProps {
22
- typeId: string;
23
- }
24
- export function ContentObjectTypeView({ typeId }: ContentObjectTypeViewProps) {
25
- const { store, user } = useUserSession();
26
- const { hash } = useLocation();
27
- const currentTab = hash ? hash.substring(1) : undefined;
28
-
29
- let { data: objectType, isLoading, error, refetch } = useFetch(() => {
30
- if (user) {
31
- return store.types.retrieve(typeId);
32
- } else {
33
- return Promise.resolve(undefined);
34
- }
35
- }, [user]);
36
-
37
- if (error) {
38
- return <ErrorBox title="Error">{error.message}</ErrorBox>;
39
- }
40
-
41
- if (isLoading) {
42
- return <Center className="py-10"><Spinner size='lg' /></Center>
43
- }
44
-
45
- if (!objectType) {
46
- return null;
47
- }
48
-
49
- const actions = [
50
- <DeleteTypeButton key="delete" objectType={objectType} />
51
- ];
52
-
53
- const onSchemaUpdate = (value: any) => {
54
- objectType.object_schema = value.schema;
55
- };
56
-
57
- const onLayoutUpdate = (value: ColumnLayout[] | undefined) => {
58
- objectType.table_layout = value;
59
- };
60
-
61
- const tabs: Tab[] = [
62
- { name: 'metadata', label: "Metadata", href: "#metadata", content: <MetadataView objectType={objectType} /> },
63
- { name: 'schema', label: "Object Schema", href: "#schema", content: <ObjectSchemaEditor objectType={objectType} onSchemaUpdate={onSchemaUpdate} /> },
64
- { name: 'layout', label: "Table Layout", href: "#layout", content: <TableLayoutEditor objectType={objectType} onLayoutUpdate={onLayoutUpdate} /> },
65
- ];
66
-
67
- const breadcrumbs = [breadcrumb()];
68
- const title = pageTitle(objectType, refetch);
69
- const description = objectType.description;
70
-
71
- return (
72
- <FullHeightLayout>
73
- <GenericPageNavHeader title={title} description={description} actions={[actions]} breadcrumbs={breadcrumbs} />
74
- <Tabs tabs={tabs} current={currentTab}>
75
- <TabsBar />
76
- <FullHeightLayout.Body>
77
- <div className="h-[calc(100vh-187px)] overflow-auto">
78
- <TabsPanel />
79
- </div>
80
- </FullHeightLayout.Body>
81
- </Tabs>
82
- </FullHeightLayout>
83
- );
84
- }
85
-
86
- function breadcrumb() {
87
- return <span>Content Type</span>
88
- }
89
-
90
- function pageTitle(objectType: ContentObjectType, refetch: () => Promise<unknown>) {
91
- return <PageTitle objectType={objectType} refetch={refetch} />
92
- }
93
-
94
- function PageTitle({ objectType, refetch }: { objectType: ContentObjectType, refetch: () => Promise<unknown> }) {
95
- const toast = useToast();
96
- const session = useUserSession();
97
- const { store } = session;
98
- const [showEditModal, setShowEditModal] = useState(false);
99
- const onCloseEditModal = (payload?: CreateOrUpdateTypePayload) => {
100
- if (!payload) {
101
- setShowEditModal(false);
102
- return Promise.resolve();
103
- }
104
- return store.types.update(objectType.id, payload).then(() => {
105
- toast({
106
- status: 'success',
107
- title: 'Type updated',
108
- duration: 2000
109
- });
110
- return refetch().finally(() => session.reloadTypes());
111
- }).catch(err => {
112
- toast({
113
- status: 'error',
114
- title: 'Error updating type',
115
- description: err.message,
116
- duration: 5000
117
- })
118
- });
119
- }
120
- return <>
121
- <div className='flex items-center gap-x-2'>{objectType.name} <Button variant="ghost" size="sm" title="Edit" onClick={() => setShowEditModal(true)}><SquarePen className="size-4" /></Button></div>
122
- <CreateOrUpdateTypeModal okLabel="Save Changes" title="Edit Type" isOpen={showEditModal} onClose={onCloseEditModal} initialPayload={objectType} />
123
- </>
124
- }
125
-
126
- interface MetadataViewProps {
127
- objectType: ContentObjectType;
128
- }
129
- function MetadataView({ objectType }: MetadataViewProps) {
130
- return (
131
- <PropertiesView className='w-full' properties={[
132
- { name: "Id", value: objectType.id },
133
- { name: "Name", value: objectType.name },
134
- { name: "Is Chunkable", value: <ChunkableSwitch objectType={objectType} /> },
135
- { name: "Strict Mode", value: <StrictModeSwitch objectType={objectType} /> },
136
- { name: 'Created By', value: <UserInfo userRef={objectType.created_by} /> },
137
- { name: 'Created At', value: dayjs(objectType.created_at).format('LLL') },
138
- { name: 'Updated By', value: <UserInfo userRef={objectType.updated_by} /> },
139
- { name: 'Updated At', value: dayjs(objectType.updated_at).format('LLL') },
140
- ]}
141
- />
142
- );
143
- }
144
-
145
-
146
- interface TypeSwitchProps {
147
- objectType: ContentObjectType;
148
- field: 'is_chunkable' | 'strict_mode';
149
- initialValue?: boolean;
150
- }
151
-
152
- function TypeSwitch({ objectType, field, initialValue }: TypeSwitchProps) {
153
- const [value, setValue] = useState(initialValue ?? false);
154
- const toast = useToast();
155
- const { store } = useUserSession();
156
-
157
- const onChange = (value: boolean) => {
158
- store.types.update(objectType.id, {
159
- [field]: value
160
- }).then(() => {
161
- setValue(value);
162
- toast({
163
- status: 'success',
164
- title: 'Successfully Updated.',
165
- duration: 2000
166
- })
167
- }).catch((err) => {
168
- toast({
169
- status: 'error',
170
- title: 'Failed to update.',
171
- description: err.message,
172
- duration: 5000
173
- })
174
- });
175
- }
176
-
177
- return (
178
- <Switch value={value} onChange={onChange} />
179
- )
180
- }
181
-
182
- interface ChunkableSwitchProps {
183
- objectType: ContentObjectType;
184
- }
185
-
186
- function ChunkableSwitch({ objectType }: ChunkableSwitchProps) {
187
- return (
188
- <TypeSwitch objectType={objectType} field="is_chunkable" initialValue={objectType.is_chunkable ?? false} />
189
- )
190
- }
191
-
192
- interface StrictModeSwitchProps {
193
- objectType: ContentObjectType;
194
- }
195
-
196
- function StrictModeSwitch({ objectType }: StrictModeSwitchProps) {
197
- return (
198
- <TypeSwitch objectType={objectType} field="strict_mode" initialValue={objectType.strict_mode ?? false} />
199
- )
200
- }
201
- interface DeleteTypeButtonProps {
202
- objectType: ContentObjectType;
203
- }
204
- function DeleteTypeButton({ objectType }: DeleteTypeButtonProps) {
205
- const toast = useToast();
206
- const navigate = useNavigate();
207
- const { store } = useUserSession();
208
- const onDelete = () => {
209
- confirm('Are you sure you want to delete this rule?') &&
210
- store.types.delete(objectType.id).then(() => {
211
- toast({
212
- status: 'success',
213
- title: `Object type ${objectType.name} deleted`,
214
- duration: 2000
215
- });
216
- navigate('/types');
217
- }).catch(err => {
218
- toast(
219
- {
220
- status: 'error',
221
- title: 'Failed to delete rule',
222
- description: err.message,
223
- duration: 5000
224
- }
225
- )
226
- })
227
- }
228
- return (
229
- <Popover hover>
230
- <PopoverTrigger>
231
- <div className='cursor-pointer hover:bg-muted p-2 rounded-md'>
232
- <Button variant="ghost" size='sm' title='More actions'><EllipsisVertical /></Button>
233
- </div>
234
- </PopoverTrigger >
235
- <PopoverContent className='p-0 w-35' align='end'>
236
- <div className="py-2 px-1.5 flex justify-center w-full">
237
- <Button variant="ghost" onClick={onDelete} className='w-full'>
238
- <Trash2 className='size-4' /> Delete
239
- </Button>
240
- </div>
241
- </PopoverContent>
242
- </Popover >
243
- )
244
- }
@@ -1,71 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- import { Button, useToast } from '@vertesia/ui/core';
4
- import { FullHeightLayout } from '@vertesia/ui/layout';
5
- import { useUserSession } from '@vertesia/ui/session';
6
- import { GenericPageNavHeader } from "../../layout";
7
- import { ContentObjectTypesSearch } from './ContentObjectTypesSearch';
8
- import { ObjectTypeSearchProvider } from './search/ObjectTypeSearchProvider';
9
-
10
- import { CreateOrUpdateTypeModal, CreateOrUpdateTypePayload } from './CreateOrUpdateTypeModal';
11
-
12
- export enum ChunkableOptions {
13
- true = "Yes",
14
- false = "No"
15
- };
16
-
17
- interface ContentObjectTypesViewProps { }
18
- export function ContentObjectTypesView({ }: ContentObjectTypesViewProps) {
19
- const toast = useToast();
20
- const [showCreateModal, setShowCreateModal] = useState(false);
21
- const session = useUserSession();
22
- const { store } = session;
23
-
24
- const actions = <Button key="create" variant="primary" onClick={() => setShowCreateModal(true)}>Create Type</Button>;
25
-
26
- const [isDirty, setIsDirty] = useState(false);
27
- useEffect(() => {
28
- if (isDirty) {
29
- setIsDirty(false);
30
- }
31
- }, [isDirty]);
32
-
33
- const onCloseCreateModal = async (payload?: CreateOrUpdateTypePayload) => {
34
- if (!payload) {
35
- setShowCreateModal(false);
36
- return Promise.resolve();
37
- }
38
- return store.types.create(payload).then(async () => {
39
- toast({
40
- status: 'success',
41
- title: 'Type created',
42
- duration: 2000
43
- });
44
- session.reloadTypes();
45
- setIsDirty(true);
46
- }).catch(err => {
47
- toast({
48
- status: 'error',
49
- title: 'Error creating type',
50
- description: err.message,
51
- duration: 5000
52
- });
53
- });
54
- };
55
-
56
- const breadcrumbs = [
57
- <span key='0'>Content Type</span>
58
- ];
59
-
60
- return (
61
- <FullHeightLayout>
62
- <GenericPageNavHeader actions={actions} breadcrumbs={breadcrumbs} title="Content Types" />
63
- <CreateOrUpdateTypeModal okLabel="Create" title="Create Type" isOpen={showCreateModal} onClose={onCloseCreateModal} />
64
- <ObjectTypeSearchProvider>
65
- <FullHeightLayout.Body>
66
- <ContentObjectTypesSearch isDirty={isDirty}></ContentObjectTypesSearch>
67
- </FullHeightLayout.Body>
68
- </ObjectTypeSearchProvider>
69
- </FullHeightLayout>
70
- );
71
- }