@solidxai/core-ui 0.1.12-beta.0 → 0.1.12-beta.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 (241) hide show
  1. package/dist/components/auth/AuthLayout.d.ts.map +1 -1
  2. package/dist/components/auth/AuthLayout.js +15 -19
  3. package/dist/components/auth/AuthLayout.js.map +1 -1
  4. package/dist/components/auth/AuthLayout.tsx +26 -20
  5. package/dist/components/auth/SolidLogin.d.ts.map +1 -1
  6. package/dist/components/auth/SolidLogin.js +6 -3
  7. package/dist/components/auth/SolidLogin.js.map +1 -1
  8. package/dist/components/auth/SolidLogin.tsx +16 -2
  9. package/dist/components/auth/SolidRegister.d.ts.map +1 -1
  10. package/dist/components/auth/SolidRegister.js +7 -4
  11. package/dist/components/auth/SolidRegister.js.map +1 -1
  12. package/dist/components/auth/SolidRegister.tsx +16 -2
  13. package/dist/components/common/BackButton.js +1 -1
  14. package/dist/components/common/BackButton.js.map +1 -1
  15. package/dist/components/common/BackButton.tsx +1 -1
  16. package/dist/components/common/CancelButton.js +1 -1
  17. package/dist/components/common/CancelButton.js.map +1 -1
  18. package/dist/components/common/CancelButton.tsx +1 -1
  19. package/dist/components/common/GeneralSettings.d.ts.map +1 -1
  20. package/dist/components/common/GeneralSettings.js +6 -33
  21. package/dist/components/common/GeneralSettings.js.map +1 -1
  22. package/dist/components/common/GeneralSettings.tsx +20 -57
  23. package/dist/components/common/SettingsComponent.d.ts.map +1 -1
  24. package/dist/components/common/SettingsComponent.js +1 -9
  25. package/dist/components/common/SettingsComponent.js.map +1 -1
  26. package/dist/components/common/SettingsComponent.tsx +1 -8
  27. package/dist/components/common/SolidBreadcrumb.js +1 -1
  28. package/dist/components/common/SolidBreadcrumb.js.map +1 -1
  29. package/dist/components/common/SolidBreadcrumb.tsx +2 -2
  30. package/dist/components/common/SolidFaviconProvider.d.ts.map +1 -1
  31. package/dist/components/common/SolidFaviconProvider.js +1 -8
  32. package/dist/components/common/SolidFaviconProvider.js.map +1 -1
  33. package/dist/components/common/SolidFaviconProvider.tsx +1 -7
  34. package/dist/components/common/SolidLoadingState.d.ts +10 -0
  35. package/dist/components/common/SolidLoadingState.d.ts.map +1 -0
  36. package/dist/components/common/SolidLoadingState.js +8 -0
  37. package/dist/components/common/SolidLoadingState.js.map +1 -0
  38. package/dist/components/common/SolidLoadingState.module.css +56 -0
  39. package/dist/components/common/SolidLoadingState.tsx +28 -0
  40. package/dist/components/core/card/CardItem.d.ts.map +1 -1
  41. package/dist/components/core/card/CardItem.js +3 -4
  42. package/dist/components/core/card/CardItem.js.map +1 -1
  43. package/dist/components/core/card/CardItem.tsx +3 -4
  44. package/dist/components/core/card/SolidCardView.d.ts.map +1 -1
  45. package/dist/components/core/card/SolidCardView.js +6 -1
  46. package/dist/components/core/card/SolidCardView.js.map +1 -1
  47. package/dist/components/core/card/SolidCardView.tsx +6 -1
  48. package/dist/components/core/card/SolidCardViewConfigure.d.ts.map +1 -1
  49. package/dist/components/core/card/SolidCardViewConfigure.js +4 -1
  50. package/dist/components/core/card/SolidCardViewConfigure.js.map +1 -1
  51. package/dist/components/core/card/SolidCardViewConfigure.tsx +4 -1
  52. package/dist/components/core/common/SolidCreateButton.d.ts.map +1 -1
  53. package/dist/components/core/common/SolidCreateButton.js +2 -13
  54. package/dist/components/core/common/SolidCreateButton.js.map +1 -1
  55. package/dist/components/core/common/SolidCreateButton.tsx +2 -15
  56. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  57. package/dist/components/core/common/SolidGlobalSearchElement.js +34 -15
  58. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  59. package/dist/components/core/common/SolidGlobalSearchElement.tsx +37 -17
  60. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.js +15 -13
  61. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.js.map +1 -1
  62. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.tsx +4 -4
  63. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.js +6 -5
  64. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.js.map +1 -1
  65. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.tsx +1 -1
  66. package/dist/components/core/form/SolidFormFooter.d.ts +2 -1
  67. package/dist/components/core/form/SolidFormFooter.d.ts.map +1 -1
  68. package/dist/components/core/form/SolidFormFooter.js +48 -14
  69. package/dist/components/core/form/SolidFormFooter.js.map +1 -1
  70. package/dist/components/core/form/SolidFormFooter.tsx +50 -4
  71. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  72. package/dist/components/core/form/SolidFormView.js +52 -50
  73. package/dist/components/core/form/SolidFormView.js.map +1 -1
  74. package/dist/components/core/form/SolidFormView.tsx +16 -9
  75. package/dist/components/core/json/SolidJsonEditor.css +195 -0
  76. package/dist/components/core/json/SolidJsonEditor.d.ts +19 -0
  77. package/dist/components/core/json/SolidJsonEditor.d.ts.map +1 -0
  78. package/dist/components/core/json/SolidJsonEditor.js +109 -0
  79. package/dist/components/core/json/SolidJsonEditor.js.map +1 -0
  80. package/dist/components/core/json/SolidJsonEditor.tsx +150 -0
  81. package/dist/components/core/kanban/KanbanCard.d.ts.map +1 -1
  82. package/dist/components/core/kanban/KanbanCard.js +2 -10
  83. package/dist/components/core/kanban/KanbanCard.js.map +1 -1
  84. package/dist/components/core/kanban/KanbanCard.tsx +2 -10
  85. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  86. package/dist/components/core/kanban/SolidKanbanView.js +11 -4
  87. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  88. package/dist/components/core/kanban/SolidKanbanView.tsx +13 -5
  89. package/dist/components/core/list/SolidListView.d.ts +2 -0
  90. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  91. package/dist/components/core/list/SolidListView.js +195 -111
  92. package/dist/components/core/list/SolidListView.js.map +1 -1
  93. package/dist/components/core/list/SolidListView.tsx +136 -39
  94. package/dist/components/core/list/SolidListViewConfigure.d.ts.map +1 -1
  95. package/dist/components/core/list/SolidListViewConfigure.js +2 -0
  96. package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
  97. package/dist/components/core/list/SolidListViewConfigure.tsx +2 -0
  98. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.d.ts.map +1 -1
  99. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +16 -19
  100. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
  101. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +16 -22
  102. package/dist/components/core/locales/SolidChatterLocaleTabView.d.ts.map +1 -1
  103. package/dist/components/core/locales/SolidChatterLocaleTabView.js +9 -8
  104. package/dist/components/core/locales/SolidChatterLocaleTabView.js.map +1 -1
  105. package/dist/components/core/locales/SolidChatterLocaleTabView.tsx +4 -1
  106. package/dist/components/core/locales/SolidLocale.d.ts.map +1 -1
  107. package/dist/components/core/locales/SolidLocale.js +1 -2
  108. package/dist/components/core/locales/SolidLocale.js.map +1 -1
  109. package/dist/components/core/locales/SolidLocale.tsx +1 -2
  110. package/dist/components/core/model/CreateModel.d.ts.map +1 -1
  111. package/dist/components/core/model/CreateModel.js +1 -1
  112. package/dist/components/core/model/CreateModel.js.map +1 -1
  113. package/dist/components/core/model/CreateModel.tsx +0 -1
  114. package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
  115. package/dist/components/core/model/ModelMetaData.js +1 -2
  116. package/dist/components/core/model/ModelMetaData.js.map +1 -1
  117. package/dist/components/core/model/ModelMetaData.tsx +1 -3
  118. package/dist/components/core/module/CreateModule.css +70 -2
  119. package/dist/components/core/module/CreateModule.d.ts.map +1 -1
  120. package/dist/components/core/module/CreateModule.js +2 -2
  121. package/dist/components/core/module/CreateModule.js.map +1 -1
  122. package/dist/components/core/module/CreateModule.tsx +13 -1
  123. package/dist/components/core/tree/SolidTreeView.d.ts.map +1 -1
  124. package/dist/components/core/tree/SolidTreeView.js +47 -26
  125. package/dist/components/core/tree/SolidTreeView.js.map +1 -1
  126. package/dist/components/core/tree/SolidTreeView.tsx +55 -23
  127. package/dist/components/layout/AdminTopHeader.js +2 -3
  128. package/dist/components/layout/AdminTopHeader.js.map +1 -1
  129. package/dist/components/layout/AdminTopHeader.tsx +2 -2
  130. package/dist/components/layout/AppSidebar.d.ts.map +1 -1
  131. package/dist/components/layout/AppSidebar.js +5 -2
  132. package/dist/components/layout/AppSidebar.js.map +1 -1
  133. package/dist/components/layout/AppSidebar.tsx +7 -4
  134. package/dist/components/layout/navbar-two-menu.d.ts.map +1 -1
  135. package/dist/components/layout/navbar-two-menu.js +6 -4
  136. package/dist/components/layout/navbar-two-menu.js.map +1 -1
  137. package/dist/components/layout/navbar-two-menu.tsx +4 -2
  138. package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -1
  139. package/dist/components/shad-cn-ui/SolidTabs.js +1 -1
  140. package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -1
  141. package/dist/components/shad-cn-ui/SolidTabs.tsx +1 -0
  142. package/dist/constants/error-messages.d.ts +1 -0
  143. package/dist/constants/error-messages.d.ts.map +1 -1
  144. package/dist/constants/error-messages.js +1 -0
  145. package/dist/constants/error-messages.js.map +1 -1
  146. package/dist/constants/error-messages.ts +1 -0
  147. package/dist/helpers/assetUrl.d.ts +3 -0
  148. package/dist/helpers/assetUrl.d.ts.map +1 -0
  149. package/dist/helpers/assetUrl.js +22 -0
  150. package/dist/helpers/assetUrl.js.map +1 -0
  151. package/dist/helpers/assetUrl.ts +26 -0
  152. package/dist/helpers/modelViewPersistence.d.ts +5 -0
  153. package/dist/helpers/modelViewPersistence.d.ts.map +1 -0
  154. package/dist/helpers/modelViewPersistence.js +168 -0
  155. package/dist/helpers/modelViewPersistence.js.map +1 -0
  156. package/dist/helpers/modelViewPersistence.ts +201 -0
  157. package/dist/helpers/routePaths.d.ts +6 -0
  158. package/dist/helpers/routePaths.d.ts.map +1 -1
  159. package/dist/helpers/routePaths.js +13 -0
  160. package/dist/helpers/routePaths.js.map +1 -1
  161. package/dist/helpers/routePaths.ts +25 -0
  162. package/dist/index.d.ts +3 -0
  163. package/dist/index.d.ts.map +1 -1
  164. package/dist/index.js +3 -0
  165. package/dist/index.js.map +1 -1
  166. package/dist/index.ts +14 -0
  167. package/dist/redux/api/datasourceIntrospectionApi.d.ts +203 -0
  168. package/dist/redux/api/datasourceIntrospectionApi.d.ts.map +1 -0
  169. package/dist/redux/api/datasourceIntrospectionApi.js +71 -0
  170. package/dist/redux/api/datasourceIntrospectionApi.js.map +1 -0
  171. package/dist/redux/api/datasourceIntrospectionApi.ts +261 -0
  172. package/dist/redux/api/datasourceManagementApi.d.ts +46 -0
  173. package/dist/redux/api/datasourceManagementApi.d.ts.map +1 -0
  174. package/dist/redux/api/datasourceManagementApi.js +35 -0
  175. package/dist/redux/api/datasourceManagementApi.js.map +1 -0
  176. package/dist/redux/api/datasourceManagementApi.ts +86 -0
  177. package/dist/redux/api/solidServiceApi.d.ts +10 -2
  178. package/dist/redux/api/solidServiceApi.d.ts.map +1 -1
  179. package/dist/redux/api/solidServiceApi.js +2 -4
  180. package/dist/redux/api/solidServiceApi.js.map +1 -1
  181. package/dist/redux/api/solidServiceApi.ts +4 -6
  182. package/dist/redux/store/StoreProvider.d.ts.map +1 -1
  183. package/dist/redux/store/StoreProvider.js +4 -2
  184. package/dist/redux/store/StoreProvider.js.map +1 -1
  185. package/dist/redux/store/StoreProvider.tsx +9 -1
  186. package/dist/redux/store/defaultStoreConfig.d.ts +28 -1
  187. package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
  188. package/dist/redux/store/defaultStoreConfig.js +4 -0
  189. package/dist/redux/store/defaultStoreConfig.js.map +1 -1
  190. package/dist/redux/store/defaultStoreConfig.ts +4 -0
  191. package/dist/resources/solid-custom.css +73 -16
  192. package/dist/routes/guards/AdminGuard.d.ts.map +1 -1
  193. package/dist/routes/guards/AdminGuard.js +2 -1
  194. package/dist/routes/guards/AdminGuard.js.map +1 -1
  195. package/dist/routes/guards/AdminGuard.tsx +7 -1
  196. package/dist/routes/guards/AuthGuard.d.ts.map +1 -1
  197. package/dist/routes/guards/AuthGuard.js +2 -1
  198. package/dist/routes/guards/AuthGuard.js.map +1 -1
  199. package/dist/routes/guards/AuthGuard.tsx +8 -2
  200. package/dist/routes/guards/GuestGuard.d.ts.map +1 -1
  201. package/dist/routes/guards/GuestGuard.js +2 -1
  202. package/dist/routes/guards/GuestGuard.js.map +1 -1
  203. package/dist/routes/guards/GuestGuard.tsx +8 -2
  204. package/dist/routes/pages/admin/core/CardPage.d.ts.map +1 -1
  205. package/dist/routes/pages/admin/core/CardPage.js +11 -0
  206. package/dist/routes/pages/admin/core/CardPage.js.map +1 -1
  207. package/dist/routes/pages/admin/core/CardPage.tsx +13 -0
  208. package/dist/routes/pages/admin/core/DashboardPage.d.ts.map +1 -1
  209. package/dist/routes/pages/admin/core/DashboardPage.js +7 -5
  210. package/dist/routes/pages/admin/core/DashboardPage.js.map +1 -1
  211. package/dist/routes/pages/admin/core/DashboardPage.module.css +18 -0
  212. package/dist/routes/pages/admin/core/DashboardPage.tsx +50 -32
  213. package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.css +828 -0
  214. package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.d.ts +3 -0
  215. package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.d.ts.map +1 -0
  216. package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js +947 -0
  217. package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js.map +1 -0
  218. package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.tsx +1719 -0
  219. package/dist/routes/pages/admin/core/DatasourcesPage.css +337 -0
  220. package/dist/routes/pages/admin/core/DatasourcesPage.d.ts +3 -0
  221. package/dist/routes/pages/admin/core/DatasourcesPage.d.ts.map +1 -0
  222. package/dist/routes/pages/admin/core/DatasourcesPage.js +221 -0
  223. package/dist/routes/pages/admin/core/DatasourcesPage.js.map +1 -0
  224. package/dist/routes/pages/admin/core/DatasourcesPage.tsx +540 -0
  225. package/dist/routes/pages/admin/core/KanbanPage.d.ts.map +1 -1
  226. package/dist/routes/pages/admin/core/KanbanPage.js +11 -0
  227. package/dist/routes/pages/admin/core/KanbanPage.js.map +1 -1
  228. package/dist/routes/pages/admin/core/KanbanPage.tsx +13 -0
  229. package/dist/routes/pages/admin/core/ListPage.d.ts.map +1 -1
  230. package/dist/routes/pages/admin/core/ListPage.js +25 -2
  231. package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
  232. package/dist/routes/pages/admin/core/ListPage.tsx +29 -2
  233. package/dist/routes/pages/admin/core/TreePage.d.ts.map +1 -1
  234. package/dist/routes/pages/admin/core/TreePage.js +10 -2
  235. package/dist/routes/pages/admin/core/TreePage.js.map +1 -1
  236. package/dist/routes/pages/admin/core/TreePage.tsx +11 -2
  237. package/dist/routes/solidRoutes.d.ts.map +1 -1
  238. package/dist/routes/solidRoutes.js +5 -1
  239. package/dist/routes/solidRoutes.js.map +1 -1
  240. package/dist/routes/solidRoutes.tsx +4 -0
  241. package/package.json +1 -1
@@ -0,0 +1,540 @@
1
+ import { Database, Plus, RefreshCw } from "lucide-react";
2
+ import { useEffect, useState } from "react";
3
+ import { useDispatch } from "react-redux";
4
+ import { showToast } from "../../../../redux/features/toastSlice";
5
+ import {
6
+ type CreateDatasourceManagementPayload,
7
+ type DatasourceManagementRecord,
8
+ useCreateDatasourceMutation,
9
+ useGetDatasourcesQuery,
10
+ } from "../../../../redux/api/datasourceManagementApi";
11
+ import {
12
+ SolidButton,
13
+ SolidDialog,
14
+ SolidDialogBody,
15
+ SolidDialogDescription,
16
+ SolidDialogFooter,
17
+ SolidDialogHeader,
18
+ SolidDialogSeparator,
19
+ SolidDialogTitle,
20
+ SolidInput,
21
+ SolidPanel,
22
+ SolidSelect,
23
+ SolidSpinner,
24
+ SolidSwitch,
25
+ } from "../../../../components/shad-cn-ui";
26
+ import "./DatasourcesPage.css";
27
+
28
+ const providerOptions = [
29
+ { label: "PostgreSQL", value: "postgres" },
30
+ { label: "MySQL", value: "mysql" },
31
+ { label: "MS SQL Server", value: "mssql" },
32
+ ] as const;
33
+
34
+ const defaultFormState: CreateDatasourceManagementPayload = {
35
+ name: "",
36
+ displayName: "",
37
+ type: "postgres",
38
+ host: "",
39
+ port: 5432,
40
+ database: "",
41
+ username: "",
42
+ password: "",
43
+ synchronize: false,
44
+ logging: false,
45
+ ssl: false,
46
+ sslRejectUnauthorized: true,
47
+ poolMax: 20,
48
+ connectionTimeoutMs: 60000,
49
+ idleTimeoutMs: 30000,
50
+ statementTimeoutMs: 60000,
51
+ idleInTxTimeoutMs: 60000,
52
+ retryAttempts: 0,
53
+ retryDelayMs: 0,
54
+ encrypt: false,
55
+ trustServerCertificate: true,
56
+ };
57
+
58
+ function slugifyDatasourceName(value: string) {
59
+ return value
60
+ .toLowerCase()
61
+ .trim()
62
+ .replace(/[^a-z0-9]+/g, "-")
63
+ .replace(/^-+|-+$/g, "")
64
+ .slice(0, 48);
65
+ }
66
+
67
+ function getDefaultPort(type: CreateDatasourceManagementPayload["type"]) {
68
+ if (type === "mysql") return 3306;
69
+ if (type === "mssql") return 1433;
70
+ return 5432;
71
+ }
72
+
73
+ function providerLabel(type: string) {
74
+ return providerOptions.find((option) => option.value === type)?.label || type;
75
+ }
76
+
77
+ function providerTone(type: string) {
78
+ if (type === "postgres") return "sdm-provider-mark--postgres";
79
+ if (type === "mysql") return "sdm-provider-mark--mysql";
80
+ return "sdm-provider-mark--mssql";
81
+ }
82
+
83
+ function providerGlyph(type: string) {
84
+ if (type === "postgres") return "PG";
85
+ if (type === "mysql") return "MY";
86
+ return "MS";
87
+ }
88
+
89
+ function readMutationError(error: any) {
90
+ return (
91
+ error?.data?.message
92
+ || error?.error
93
+ || error?.message
94
+ || "Unable to save the datasource."
95
+ );
96
+ }
97
+
98
+ function sanitizePayload(formState: CreateDatasourceManagementPayload): CreateDatasourceManagementPayload {
99
+ const payload: CreateDatasourceManagementPayload = {
100
+ ...formState,
101
+ name: slugifyDatasourceName(formState.name),
102
+ };
103
+
104
+ if (payload.type === "mssql") {
105
+ delete payload.ssl;
106
+ delete payload.sslRejectUnauthorized;
107
+ delete payload.statementTimeoutMs;
108
+ delete payload.idleInTxTimeoutMs;
109
+ } else {
110
+ delete payload.encrypt;
111
+ delete payload.trustServerCertificate;
112
+ }
113
+
114
+ if (payload.type !== "postgres") {
115
+ delete payload.statementTimeoutMs;
116
+ delete payload.idleInTxTimeoutMs;
117
+ }
118
+
119
+ return payload;
120
+ }
121
+
122
+ function DatasourceProviderMark({ type }: { type: string }) {
123
+ return (
124
+ <div className={`sdm-provider-mark ${providerTone(type)}`}>
125
+ <span>{providerGlyph(type)}</span>
126
+ </div>
127
+ );
128
+ }
129
+
130
+ export function DatasourcesPage() {
131
+ const dispatch = useDispatch();
132
+ const {
133
+ data: datasources = [],
134
+ isLoading,
135
+ isFetching,
136
+ error,
137
+ refetch,
138
+ } = useGetDatasourcesQuery();
139
+ const [createDatasource, { isLoading: isCreating }] = useCreateDatasourceMutation();
140
+ const [dialogOpen, setDialogOpen] = useState(false);
141
+ const [nameTouched, setNameTouched] = useState(false);
142
+ const [formState, setFormState] = useState<CreateDatasourceManagementPayload>(defaultFormState);
143
+
144
+ useEffect(() => {
145
+ if (!dialogOpen) {
146
+ setFormState(defaultFormState);
147
+ setNameTouched(false);
148
+ }
149
+ }, [dialogOpen]);
150
+
151
+ const handleFieldChange = <K extends keyof CreateDatasourceManagementPayload>(
152
+ key: K,
153
+ value: CreateDatasourceManagementPayload[K],
154
+ ) => {
155
+ setFormState((current) => ({
156
+ ...current,
157
+ [key]: value,
158
+ }));
159
+ };
160
+
161
+ const handleDisplayNameChange = (value: string) => {
162
+ setFormState((current) => ({
163
+ ...current,
164
+ displayName: value,
165
+ name: nameTouched ? current.name : slugifyDatasourceName(value),
166
+ }));
167
+ };
168
+
169
+ const handleTypeChange = (value: CreateDatasourceManagementPayload["type"]) => {
170
+ handleFieldChange("type", value);
171
+ handleFieldChange("port", getDefaultPort(value));
172
+ };
173
+
174
+ const handleSubmit = async () => {
175
+ if (!formState.name || !formState.host || !formState.database || !formState.username || !formState.password) {
176
+ dispatch(showToast({
177
+ severity: "warn",
178
+ summary: "Missing details",
179
+ detail: "Fill in the datasource name, host, database, username, and password.",
180
+ }));
181
+ return;
182
+ }
183
+
184
+ try {
185
+ const payload = sanitizePayload(formState);
186
+ await createDatasource(payload).unwrap();
187
+ setDialogOpen(false);
188
+ dispatch(showToast({
189
+ severity: "success",
190
+ summary: "Datasource created",
191
+ detail: `${payload.displayName || payload.name} is now registered in SolidX.`,
192
+ }));
193
+ } catch (mutationError: any) {
194
+ dispatch(showToast({
195
+ severity: "error",
196
+ summary: "Datasource creation failed",
197
+ detail: readMutationError(mutationError),
198
+ }));
199
+ }
200
+ };
201
+
202
+ return (
203
+ <div className="sdm-page">
204
+ <div className="sdm-header">
205
+ <div className="sdm-title-block">
206
+ <h1 className="sdm-title">Datasource Management</h1>
207
+ <p className="sdm-subtitle">Review and manage the datasources configured for this SolidX application.</p>
208
+ </div>
209
+
210
+ <div className="sdm-header-actions">
211
+ {isFetching && !isLoading ? (
212
+ <div className="sdm-inline-status">
213
+ <SolidSpinner size={16} />
214
+ <span>Refreshing</span>
215
+ </div>
216
+ ) : null}
217
+
218
+ <SolidButton
219
+ className="sdm-icon-button"
220
+ leftIcon={<Plus size={16} />}
221
+ onClick={() => setDialogOpen(true)}
222
+ tooltip="Add datasource"
223
+ aria-label="Add datasource"
224
+ />
225
+
226
+ <SolidButton
227
+ className="sdm-icon-button"
228
+ leftIcon={<RefreshCw size={16} />}
229
+ onClick={() => void refetch()}
230
+ tooltip="Refresh"
231
+ aria-label="Refresh"
232
+ />
233
+ </div>
234
+ </div>
235
+
236
+ {isLoading ? (
237
+ <div className="sdm-loading">
238
+ <SolidSpinner size={28} />
239
+ <p>Loading datasource configuration...</p>
240
+ </div>
241
+ ) : error ? (
242
+ <div className="sdm-error">
243
+ <span>Unable to load datasource configuration.</span>
244
+ <SolidButton size="small" variant="outline" onClick={() => void refetch()}>
245
+ Retry
246
+ </SolidButton>
247
+ </div>
248
+ ) : datasources.length ? (
249
+ <div className="sdm-grid">
250
+ {datasources.map((datasource) => (
251
+ <article key={datasource.name} className="sdm-card">
252
+ <div className="sdm-card__top">
253
+ <div className="sdm-card__identity">
254
+ <DatasourceProviderMark type={datasource.type} />
255
+ <div>
256
+ <h3>{datasource.displayName}</h3>
257
+ <p>{datasource.name}</p>
258
+ </div>
259
+ </div>
260
+ <div className="sdm-card__badges">
261
+ <span className="sdm-badge sdm-badge--provider">{providerLabel(datasource.type)}</span>
262
+ {datasource.isDefault ? <span className="sdm-badge sdm-badge--default">Default</span> : null}
263
+ </div>
264
+ </div>
265
+
266
+ <div className="sdm-card__facts">
267
+ <div className="sdm-card__row">
268
+ <span>Host</span>
269
+ <strong>{datasource.host || "Not configured"}</strong>
270
+ </div>
271
+ <div className="sdm-card__row">
272
+ <span>Port</span>
273
+ <strong>{datasource.port ?? "Not configured"}</strong>
274
+ </div>
275
+ <div className="sdm-card__row">
276
+ <span>Database</span>
277
+ <strong>{datasource.database || "Not configured"}</strong>
278
+ </div>
279
+ <div className="sdm-card__row">
280
+ <span>User</span>
281
+ <strong>{datasource.username || "Not configured"}</strong>
282
+ </div>
283
+ <div className="sdm-card__row">
284
+ <span>Env prefix</span>
285
+ <strong>{datasource.envPrefix}</strong>
286
+ </div>
287
+ <div className="sdm-card__row">
288
+ <span>Password</span>
289
+ <strong>{datasource.passwordConfigured ? "Configured" : "Missing"}</strong>
290
+ </div>
291
+ </div>
292
+
293
+ <div className="sdm-card__footer">
294
+ <div className="sdm-meta-pill">sync: {datasource.synchronize === null ? "n/a" : String(datasource.synchronize)}</div>
295
+ <div className="sdm-meta-pill">logging: {datasource.logging === null ? "n/a" : String(datasource.logging)}</div>
296
+ {datasource.advanced?.poolMax ? <div className="sdm-meta-pill">pool: {datasource.advanced.poolMax}</div> : null}
297
+ </div>
298
+ </article>
299
+ ))}
300
+ </div>
301
+ ) : (
302
+ <div className="sdm-empty">
303
+ <Database size={22} />
304
+ <div>
305
+ <h3>No datasources configured</h3>
306
+ <p>Create one here and SolidX will wire the module and environment variables for you.</p>
307
+ </div>
308
+ <SolidButton size="small" onClick={() => setDialogOpen(true)} leftIcon={<Plus size={14} />}>
309
+ Add datasource
310
+ </SolidButton>
311
+ </div>
312
+ )}
313
+
314
+ <SolidDialog open={dialogOpen} onOpenChange={setDialogOpen} style={{ width: "min(860px, calc(100vw - 32px))" }}>
315
+ <SolidDialogHeader>
316
+ <div>
317
+ <SolidDialogTitle>Add datasource</SolidDialogTitle>
318
+ <SolidDialogDescription>
319
+ Create a new datasource module, register it in `app.module.ts`, and persist its env variables to disk.
320
+ </SolidDialogDescription>
321
+ </div>
322
+ </SolidDialogHeader>
323
+ <SolidDialogSeparator />
324
+ <SolidDialogBody>
325
+ <div className="sdm-form-grid">
326
+ <label className="sdm-form-field">
327
+ <span>Display name</span>
328
+ <SolidInput
329
+ value={formState.displayName || ""}
330
+ placeholder="Applications"
331
+ onChange={(event) => handleDisplayNameChange(event.target.value)}
332
+ />
333
+ </label>
334
+
335
+ <label className="sdm-form-field">
336
+ <span>Datasource key</span>
337
+ <SolidInput
338
+ value={formState.name}
339
+ placeholder="applications"
340
+ onChange={(event) => {
341
+ setNameTouched(true);
342
+ handleFieldChange("name", slugifyDatasourceName(event.target.value));
343
+ }}
344
+ />
345
+ </label>
346
+
347
+ <label className="sdm-form-field">
348
+ <span>Provider</span>
349
+ <SolidSelect
350
+ value={formState.type}
351
+ options={providerOptions as any}
352
+ onChange={(event) => handleTypeChange(event.value)}
353
+ />
354
+ </label>
355
+
356
+ <label className="sdm-form-field">
357
+ <span>Port</span>
358
+ <SolidInput
359
+ type="number"
360
+ value={formState.port}
361
+ onChange={(event) => handleFieldChange("port", Number(event.target.value) || getDefaultPort(formState.type))}
362
+ />
363
+ </label>
364
+
365
+ <label className="sdm-form-field">
366
+ <span>Host</span>
367
+ <SolidInput
368
+ value={formState.host}
369
+ placeholder="localhost"
370
+ onChange={(event) => handleFieldChange("host", event.target.value)}
371
+ />
372
+ </label>
373
+
374
+ <label className="sdm-form-field">
375
+ <span>Database</span>
376
+ <SolidInput
377
+ value={formState.database}
378
+ placeholder="solidx_app"
379
+ onChange={(event) => handleFieldChange("database", event.target.value)}
380
+ />
381
+ </label>
382
+
383
+ <label className="sdm-form-field">
384
+ <span>Username</span>
385
+ <SolidInput
386
+ value={formState.username}
387
+ placeholder="postgres"
388
+ onChange={(event) => handleFieldChange("username", event.target.value)}
389
+ />
390
+ </label>
391
+
392
+ <label className="sdm-form-field">
393
+ <span>Password</span>
394
+ <SolidInput
395
+ type="password"
396
+ value={formState.password}
397
+ onChange={(event) => handleFieldChange("password", event.target.value)}
398
+ />
399
+ </label>
400
+ </div>
401
+
402
+ <div className="sdm-switch-row">
403
+ <label className="sdm-switch-field">
404
+ <div>
405
+ <strong>Synchronize</strong>
406
+ <span>Write `*_DATABASE_SYNCHRONIZE` for this datasource.</span>
407
+ </div>
408
+ <SolidSwitch checked={!!formState.synchronize} onChange={(checked) => handleFieldChange("synchronize", checked)} />
409
+ </label>
410
+
411
+ <label className="sdm-switch-field">
412
+ <div>
413
+ <strong>Logging</strong>
414
+ <span>Enable TypeORM logging through the generated datasource module.</span>
415
+ </div>
416
+ <SolidSwitch checked={!!formState.logging} onChange={(checked) => handleFieldChange("logging", checked)} />
417
+ </label>
418
+ </div>
419
+
420
+ <SolidPanel header="Advanced options" toggleable className="solid-column-panel sdm-advanced-panel">
421
+ <div className="sdm-advanced-grid">
422
+ {formState.type === "mssql" ? (
423
+ <>
424
+ <label className="sdm-switch-field sdm-switch-field--inline">
425
+ <div>
426
+ <strong>Encrypt</strong>
427
+ <span>MSSQL connection option.</span>
428
+ </div>
429
+ <SolidSwitch checked={!!formState.encrypt} onChange={(checked) => handleFieldChange("encrypt", checked)} />
430
+ </label>
431
+
432
+ <label className="sdm-switch-field sdm-switch-field--inline">
433
+ <div>
434
+ <strong>Trust certificate</strong>
435
+ <span>Allow self-signed development certificates.</span>
436
+ </div>
437
+ <SolidSwitch checked={!!formState.trustServerCertificate} onChange={(checked) => handleFieldChange("trustServerCertificate", checked)} />
438
+ </label>
439
+ </>
440
+ ) : (
441
+ <>
442
+ <label className="sdm-switch-field sdm-switch-field--inline">
443
+ <div>
444
+ <strong>SSL</strong>
445
+ <span>Enable SSL for PostgreSQL or MySQL.</span>
446
+ </div>
447
+ <SolidSwitch checked={!!formState.ssl} onChange={(checked) => handleFieldChange("ssl", checked)} />
448
+ </label>
449
+
450
+ <label className="sdm-switch-field sdm-switch-field--inline">
451
+ <div>
452
+ <strong>Reject unauthorized</strong>
453
+ <span>Keep certificate validation strict when SSL is enabled.</span>
454
+ </div>
455
+ <SolidSwitch checked={!!formState.sslRejectUnauthorized} onChange={(checked) => handleFieldChange("sslRejectUnauthorized", checked)} />
456
+ </label>
457
+ </>
458
+ )}
459
+
460
+ <label className="sdm-form-field">
461
+ <span>Pool max</span>
462
+ <SolidInput
463
+ type="number"
464
+ value={formState.poolMax ?? ""}
465
+ onChange={(event) => handleFieldChange("poolMax", Number(event.target.value) || 0)}
466
+ />
467
+ </label>
468
+
469
+ <label className="sdm-form-field">
470
+ <span>Connection timeout (ms)</span>
471
+ <SolidInput
472
+ type="number"
473
+ value={formState.connectionTimeoutMs ?? ""}
474
+ onChange={(event) => handleFieldChange("connectionTimeoutMs", Number(event.target.value) || 0)}
475
+ />
476
+ </label>
477
+
478
+ <label className="sdm-form-field">
479
+ <span>Idle timeout (ms)</span>
480
+ <SolidInput
481
+ type="number"
482
+ value={formState.idleTimeoutMs ?? ""}
483
+ onChange={(event) => handleFieldChange("idleTimeoutMs", Number(event.target.value) || 0)}
484
+ />
485
+ </label>
486
+
487
+ {formState.type === "postgres" ? (
488
+ <>
489
+ <label className="sdm-form-field">
490
+ <span>Statement timeout (ms)</span>
491
+ <SolidInput
492
+ type="number"
493
+ value={formState.statementTimeoutMs ?? ""}
494
+ onChange={(event) => handleFieldChange("statementTimeoutMs", Number(event.target.value) || 0)}
495
+ />
496
+ </label>
497
+
498
+ <label className="sdm-form-field">
499
+ <span>Idle in transaction timeout (ms)</span>
500
+ <SolidInput
501
+ type="number"
502
+ value={formState.idleInTxTimeoutMs ?? ""}
503
+ onChange={(event) => handleFieldChange("idleInTxTimeoutMs", Number(event.target.value) || 0)}
504
+ />
505
+ </label>
506
+ </>
507
+ ) : null}
508
+
509
+ <label className="sdm-form-field">
510
+ <span>Retry attempts</span>
511
+ <SolidInput
512
+ type="number"
513
+ value={formState.retryAttempts ?? ""}
514
+ onChange={(event) => handleFieldChange("retryAttempts", Number(event.target.value) || 0)}
515
+ />
516
+ </label>
517
+
518
+ <label className="sdm-form-field">
519
+ <span>Retry delay (ms)</span>
520
+ <SolidInput
521
+ type="number"
522
+ value={formState.retryDelayMs ?? ""}
523
+ onChange={(event) => handleFieldChange("retryDelayMs", Number(event.target.value) || 0)}
524
+ />
525
+ </label>
526
+ </div>
527
+ </SolidPanel>
528
+ </SolidDialogBody>
529
+ <SolidDialogFooter>
530
+ <SolidButton variant="outline" onClick={() => setDialogOpen(false)}>
531
+ Cancel
532
+ </SolidButton>
533
+ <SolidButton onClick={() => void handleSubmit()} loading={isCreating}>
534
+ Create datasource
535
+ </SolidButton>
536
+ </SolidDialogFooter>
537
+ </SolidDialog>
538
+ </div>
539
+ );
540
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"KanbanPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/KanbanPage.tsx"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,4CAKzB"}
1
+ {"version":3,"file":"KanbanPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/KanbanPage.tsx"],"names":[],"mappings":"AAQA,wBAAgB,UAAU,4CAczB"}
@@ -12,11 +12,22 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { SolidKanbanView } from "../../../../components/core/kanban/SolidKanbanView";
14
14
  import { camelCase } from "lodash";
15
+ import { useEffect } from "react";
15
16
  import { useParams } from "react-router-dom";
17
+ import { storeCurrentModelViewContext } from "../../../../helpers/modelViewPersistence";
18
+ import { usePathname } from "../../../../hooks/usePathname";
19
+ import { useSearchParams } from "../../../../hooks/useSearchParams";
16
20
  export function KanbanPage() {
17
21
  var params = useParams();
22
+ var pathname = usePathname();
23
+ var searchParams = useSearchParams();
24
+ var search = searchParams.toString();
18
25
  var moduleName = params.moduleName || "";
19
26
  var modelName = params.modelName ? camelCase(params.modelName) : "";
27
+ useEffect(function () {
28
+ var currentUrl = search ? "".concat(pathname, "?").concat(search) : pathname;
29
+ storeCurrentModelViewContext(currentUrl);
30
+ }, [pathname, search]);
20
31
  return _jsx(SolidKanbanView, __assign({}, params, { embeded: false, moduleName: moduleName, modelName: modelName }));
21
32
  }
22
33
  //# sourceMappingURL=KanbanPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KanbanPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/KanbanPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,UAAU,UAAU;IACxB,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAC3C,IAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,OAAO,KAAC,eAAe,eAAK,MAAM,IAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC;AACvG,CAAC","sourcesContent":["import { SolidKanbanView } from \"../../../../components/core/kanban/SolidKanbanView\";\nimport { camelCase } from \"lodash\";\nimport { useParams } from \"react-router-dom\";\n\nexport function KanbanPage() {\n const params = useParams();\n const moduleName = params.moduleName || \"\";\n const modelName = params.modelName ? camelCase(params.modelName) : \"\";\n return <SolidKanbanView {...params} embeded={false} moduleName={moduleName} modelName={modelName} />;\n}\n"]}
1
+ {"version":3,"file":"KanbanPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/KanbanPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,UAAU,UAAU;IACxB,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,IAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,IAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IACvC,IAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAC3C,IAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,SAAS,CAAC;QACR,IAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,UAAG,QAAQ,cAAI,MAAM,CAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAC,eAAe,eAAK,MAAM,IAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC;AACvG,CAAC","sourcesContent":["import { SolidKanbanView } from \"../../../../components/core/kanban/SolidKanbanView\";\nimport { camelCase } from \"lodash\";\nimport { useEffect } from \"react\";\nimport { useParams } from \"react-router-dom\";\nimport { storeCurrentModelViewContext } from \"../../../../helpers/modelViewPersistence\";\nimport { usePathname } from \"../../../../hooks/usePathname\";\nimport { useSearchParams } from \"../../../../hooks/useSearchParams\";\n\nexport function KanbanPage() {\n const params = useParams();\n const pathname = usePathname();\n const searchParams = useSearchParams();\n const search = searchParams.toString();\n const moduleName = params.moduleName || \"\";\n const modelName = params.modelName ? camelCase(params.modelName) : \"\";\n\n useEffect(() => {\n const currentUrl = search ? `${pathname}?${search}` : pathname;\n storeCurrentModelViewContext(currentUrl);\n }, [pathname, search]);\n\n return <SolidKanbanView {...params} embeded={false} moduleName={moduleName} modelName={modelName} />;\n}\n"]}
@@ -1,10 +1,23 @@
1
1
  import { SolidKanbanView } from "../../../../components/core/kanban/SolidKanbanView";
2
2
  import { camelCase } from "lodash";
3
+ import { useEffect } from "react";
3
4
  import { useParams } from "react-router-dom";
5
+ import { storeCurrentModelViewContext } from "../../../../helpers/modelViewPersistence";
6
+ import { usePathname } from "../../../../hooks/usePathname";
7
+ import { useSearchParams } from "../../../../hooks/useSearchParams";
4
8
 
5
9
  export function KanbanPage() {
6
10
  const params = useParams();
11
+ const pathname = usePathname();
12
+ const searchParams = useSearchParams();
13
+ const search = searchParams.toString();
7
14
  const moduleName = params.moduleName || "";
8
15
  const modelName = params.modelName ? camelCase(params.modelName) : "";
16
+
17
+ useEffect(() => {
18
+ const currentUrl = search ? `${pathname}?${search}` : pathname;
19
+ storeCurrentModelViewContext(currentUrl);
20
+ }, [pathname, search]);
21
+
9
22
  return <SolidKanbanView {...params} embeded={false} moduleName={moduleName} modelName={modelName} />;
10
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ListPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/ListPage.tsx"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,4CAuBvB"}
1
+ {"version":3,"file":"ListPage.d.ts","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/ListPage.tsx"],"names":[],"mappings":"AAUA,wBAAgB,QAAQ,4CA+CvB"}
@@ -12,12 +12,18 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { SolidListView } from "../../../../components/core/list/SolidListView";
14
14
  import { camelCase } from "lodash";
15
- import { useCallback } from "react";
15
+ import { useCallback, useEffect } from "react";
16
16
  import { useParams, useSearchParams } from "react-router-dom";
17
17
  import { registerListView, unregisterListView } from "../../../../components/core/list/listViewRegistry";
18
+ import { usePathname } from "../../../../hooks/usePathname";
19
+ import { useRouter } from "../../../../hooks/useRouter";
20
+ import { resolveRetainedModelViewRoute, storeCurrentModelViewContext } from "../../../../helpers/modelViewPersistence";
18
21
  export function ListPage() {
19
22
  var params = useParams();
20
- var _a = useSearchParams(), searchParams = _a[0], setSearchParams = _a[1];
23
+ var searchParams = useSearchParams()[0];
24
+ var pathname = usePathname();
25
+ var router = useRouter();
26
+ var search = searchParams.toString();
21
27
  var moduleName = params.moduleName || "";
22
28
  var modelName = params.modelName ? camelCase(params.modelName) : "";
23
29
  var menuItemId = searchParams.get("menuItemId") || "";
@@ -32,6 +38,23 @@ export function ListPage() {
32
38
  }
33
39
  unregisterListView(listId);
34
40
  }, [listId]);
41
+ useEffect(function () {
42
+ var currentUrl = search ? "".concat(pathname, "?").concat(search) : pathname;
43
+ var hasSavedQuery = searchParams.has("savedQuery");
44
+ if (!hasSavedQuery) {
45
+ var retainedUrl = resolveRetainedModelViewRoute(currentUrl);
46
+ if (retainedUrl !== currentUrl) {
47
+ router.replace(retainedUrl);
48
+ return;
49
+ }
50
+ }
51
+ // savedQuery strip karke store karo
52
+ var params = new URLSearchParams(search);
53
+ params.delete("savedQuery");
54
+ var cleanSearch = params.toString();
55
+ var urlToStore = cleanSearch ? "".concat(pathname, "?").concat(cleanSearch) : pathname;
56
+ storeCurrentModelViewContext(urlToStore);
57
+ }, [pathname, search]);
35
58
  return _jsx(SolidListView, __assign({ ref: setListRef }, params, { embeded: false, moduleName: moduleName, modelName: modelName }), listId);
36
59
  }
37
60
  //# sourceMappingURL=ListPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/ListPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEzG,MAAM,UAAU,QAAQ;IACtB,IAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IACrB,IAAA,KAAkC,eAAe,EAAE,EAAlD,YAAY,QAAA,EAAE,eAAe,QAAqB,CAAC;IAE1D,IAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAC3C,IAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,IAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IACxD,IAAM,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAC5D,IAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACpD,IAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAExD,IAAM,MAAM,GAAG,eAAQ,UAAU,cAAI,SAAS,cAAI,UAAU,cAAI,YAAY,cAAI,QAAQ,cAAI,UAAU,CAAE,CAAC;IAEzG,IAAM,UAAU,GAAG,WAAW,CAAC,UAAC,MAAkC;QAChE,IAAI,MAAM,EAAE;YACV,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjC,OAAO;SACR;QACD,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,KAAC,aAAa,aAAC,GAAG,EAAE,UAAU,IAAmB,MAAM,IAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,KAAhF,MAAM,CAA8E,CAAC;AACnI,CAAC","sourcesContent":["import { SolidListView } from \"../../../../components/core/list/SolidListView\";\nimport { camelCase } from \"lodash\";\nimport { useCallback } from \"react\";\nimport { useParams, useSearchParams } from \"react-router-dom\";\nimport type { SolidListViewHandle } from \"../../../../components/core/list/SolidListView\";\nimport { registerListView, unregisterListView } from \"../../../../components/core/list/listViewRegistry\";\n\nexport function ListPage() {\n const params = useParams();\n const [searchParams, setSearchParams] = useSearchParams();\n\n const moduleName = params.moduleName || \"\";\n const modelName = params.modelName ? camelCase(params.modelName) : \"\";\n\n const menuItemId = searchParams.get(\"menuItemId\") || \"\";\n const menuItemName = searchParams.get(\"menuItemName\") || \"\";\n const actionId = searchParams.get(\"actionId\") || \"\";\n const actionName = searchParams.get(\"actionName\") || \"\";\n\n const listId = `page:${moduleName}:${modelName}:${menuItemId}:${menuItemName}:${actionId}:${actionName}`;\n\n const setListRef = useCallback((handle: SolidListViewHandle | null) => {\n if (handle) {\n registerListView(listId, handle);\n return;\n }\n unregisterListView(listId);\n }, [listId]);\n\n return <SolidListView ref={setListRef} key={listId} {...params} embeded={false} moduleName={moduleName} modelName={modelName} />;\n}\n"]}
1
+ {"version":3,"file":"ListPage.js","sourceRoot":"","sources":["../../../../../src/routes/pages/admin/core/ListPage.tsx"],"names":[],"mappings":"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","sourcesContent":["import { SolidListView } from \"../../../../components/core/list/SolidListView\";\nimport { camelCase } from \"lodash\";\nimport { useCallback, useEffect } from \"react\";\nimport { useParams, useSearchParams } from \"react-router-dom\";\nimport type { SolidListViewHandle } from \"../../../../components/core/list/SolidListView\";\nimport { registerListView, unregisterListView } from \"../../../../components/core/list/listViewRegistry\";\nimport { usePathname } from \"../../../../hooks/usePathname\";\nimport { useRouter } from \"../../../../hooks/useRouter\";\nimport { resolveRetainedModelViewRoute, storeCurrentModelViewContext } from \"../../../../helpers/modelViewPersistence\";\n\nexport function ListPage() {\n const params = useParams();\n const [searchParams] = useSearchParams();\n const pathname = usePathname();\n const router = useRouter();\n const search = searchParams.toString();\n\n const moduleName = params.moduleName || \"\";\n const modelName = params.modelName ? camelCase(params.modelName) : \"\";\n\n const menuItemId = searchParams.get(\"menuItemId\") || \"\";\n const menuItemName = searchParams.get(\"menuItemName\") || \"\";\n const actionId = searchParams.get(\"actionId\") || \"\";\n const actionName = searchParams.get(\"actionName\") || \"\";\n\n const listId = `page:${moduleName}:${modelName}:${menuItemId}:${menuItemName}:${actionId}:${actionName}`;\n\n const setListRef = useCallback((handle: SolidListViewHandle | null) => {\n if (handle) {\n registerListView(listId, handle);\n return;\n }\n unregisterListView(listId);\n }, [listId]);\n\n useEffect(() => {\n const currentUrl = search ? `${pathname}?${search}` : pathname;\n const hasSavedQuery = searchParams.has(\"savedQuery\");\n\n if (!hasSavedQuery) {\n const retainedUrl = resolveRetainedModelViewRoute(currentUrl);\n if (retainedUrl !== currentUrl) {\n router.replace(retainedUrl);\n return;\n }\n }\n\n // savedQuery strip karke store karo\n const params = new URLSearchParams(search);\n params.delete(\"savedQuery\");\n const cleanSearch = params.toString();\n const urlToStore = cleanSearch ? `${pathname}?${cleanSearch}` : pathname;\n\n storeCurrentModelViewContext(urlToStore);\n }, [pathname, search]);\n\n return <SolidListView ref={setListRef} key={listId} {...params} embeded={false} moduleName={moduleName} modelName={modelName} />;\n}\n"]}