@argusoft/medplat-core 1.0.14 → 1.0.16

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 (119) hide show
  1. package/dist/AccessRights-Bvd5Bm5K.js +1259 -0
  2. package/dist/AccessRights-Bvd5Bm5K.js.map +1 -0
  3. package/dist/{AddEditQueryBuilder-7JRplV5J.js → AddEditQueryBuilder-Bcjl5mXE.js} +2 -2
  4. package/dist/{AddEditQueryBuilder-7JRplV5J.js.map → AddEditQueryBuilder-Bcjl5mXE.js.map} +1 -1
  5. package/dist/{AddFeatures-CkTu7sOI.js → AddFeatures-CE5rBxEG.js} +2 -2
  6. package/dist/{AddFeatures-CkTu7sOI.js.map → AddFeatures-CE5rBxEG.js.map} +1 -1
  7. package/dist/{AddLabelModal-DE3ploGD.js → AddLabelModal-CB8E8cYG.js} +2 -2
  8. package/dist/{AddLabelModal-DE3ploGD.js.map → AddLabelModal-CB8E8cYG.js.map} +1 -1
  9. package/dist/{AddRoleDrawer-ZK1eejxI.js → AddRoleDrawer-SvntLdRu.js} +44 -43
  10. package/dist/AddRoleDrawer-SvntLdRu.js.map +1 -0
  11. package/dist/{AppModal-BgZyfrd-.js → AppModal-BKgIwe1h.js} +2 -2
  12. package/dist/{AppModal-BgZyfrd-.js.map → AppModal-BKgIwe1h.js.map} +1 -1
  13. package/dist/{ChangePasswordModalCore-DIe4rzW-.js → ChangePasswordModalCore-ClND1mel.js} +67 -62
  14. package/dist/ChangePasswordModalCore-ClND1mel.js.map +1 -0
  15. package/dist/{ConditionConfig-GDCXIg3C.js → ConditionConfig-DB0FqwgG.js} +2 -2
  16. package/dist/{ConditionConfig-GDCXIg3C.js.map → ConditionConfig-DB0FqwgG.js.map} +1 -1
  17. package/dist/{EntityManagement-D-x6Qzal.js → EntityManagement-DQKXnEzz.js} +2 -2
  18. package/dist/{EntityManagement-D-x6Qzal.js.map → EntityManagement-DQKXnEzz.js.map} +1 -1
  19. package/dist/EventConfigurations-DZvSJ5EZ.js +395 -0
  20. package/dist/EventConfigurations-DZvSJ5EZ.js.map +1 -0
  21. package/dist/{EventsExceptionModal-BF6E1Np7.js → EventsExceptionModal-DsvngLi8.js} +2 -2
  22. package/dist/{EventsExceptionModal-BF6E1Np7.js.map → EventsExceptionModal-DsvngLi8.js.map} +1 -1
  23. package/dist/EventsSkeleton-DCXwwPbb.js +76 -0
  24. package/dist/EventsSkeleton-DCXwwPbb.js.map +1 -0
  25. package/dist/FeatureMenu-CLX8VNZ-.js +265 -0
  26. package/dist/FeatureMenu-CLX8VNZ-.js.map +1 -0
  27. package/dist/Features-Cpf1PDx0.js +13 -0
  28. package/dist/Features-Cpf1PDx0.js.map +1 -0
  29. package/dist/FileSaver.min-CN9EpL2h.js.map +1 -1
  30. package/dist/{ImmunizationConfigurationBase-DZ8EqXlF.js → ImmunizationConfigurationBase-VqVvVR57.js} +2095 -1872
  31. package/dist/ImmunizationConfigurationBase-VqVvVR57.js.map +1 -0
  32. package/dist/ImmunizationConfigurationsList-K2ddBpPJ.js +345 -0
  33. package/dist/ImmunizationConfigurationsList-K2ddBpPJ.js.map +1 -0
  34. package/dist/ImmunizationSkeleton-D2tdv5k-.js.map +1 -1
  35. package/dist/{LanguagesModal-rk6IGQwY.js → LanguagesModal-CX3oS8rk.js} +2 -2
  36. package/dist/{LanguagesModal-rk6IGQwY.js.map → LanguagesModal-CX3oS8rk.js.map} +1 -1
  37. package/dist/{ManageDynamicFeature-C2I7Ho7i.js → ManageDynamicFeature-CsIett5x.js} +2 -2
  38. package/dist/{ManageDynamicFeature-C2I7Ho7i.js.map → ManageDynamicFeature-CsIett5x.js.map} +1 -1
  39. package/dist/{ManageEventConfiguration-BJxS2Su0.js → ManageEventConfiguration-0YBDaxOI.js} +60 -60
  40. package/dist/ManageEventConfiguration-0YBDaxOI.js.map +1 -0
  41. package/dist/{ManageNotification-DMN2szWy.js → ManageNotification-BUAvg5Ge.js} +1797 -1705
  42. package/dist/ManageNotification-BUAvg5Ge.js.map +1 -0
  43. package/dist/{ManageRole-CuXmWQyp.js → ManageRole-Cbs9dUhc.js} +244 -191
  44. package/dist/ManageRole-Cbs9dUhc.js.map +1 -0
  45. package/dist/ManageTranslation-D9IScGhk.js +625 -0
  46. package/dist/ManageTranslation-D9IScGhk.js.map +1 -0
  47. package/dist/{ManageUser-Dr3ptCYp.js → ManageUser-eBS0yC5k.js} +754 -748
  48. package/dist/ManageUser-eBS0yC5k.js.map +1 -0
  49. package/dist/{MobileTypeEventConfigModal-ChhO_A4f.js → MobileTypeEventConfigModal-Ltm529jG.js} +2 -2
  50. package/dist/{MobileTypeEventConfigModal-ChhO_A4f.js.map → MobileTypeEventConfigModal-Ltm529jG.js.map} +1 -1
  51. package/dist/NotificationList-CUZSWp2J.js +402 -0
  52. package/dist/NotificationList-CUZSWp2J.js.map +1 -0
  53. package/dist/{OtherTypeEventConfigModal-ZnCGWm9v.js → OtherTypeEventConfigModal-dXt2qDg_.js} +2 -2
  54. package/dist/OtherTypeEventConfigModal-dXt2qDg_.js.map +1 -0
  55. package/dist/{QueryBuilder-BPfavHH9.js → QueryBuilder-DXexUIe8.js} +154 -148
  56. package/dist/QueryBuilder-DXexUIe8.js.map +1 -0
  57. package/dist/QueryManagement-B2y23kus.js +935 -0
  58. package/dist/QueryManagement-B2y23kus.js.map +1 -0
  59. package/dist/RoleManagement-BThAL5LO.js +422 -0
  60. package/dist/RoleManagement-BThAL5LO.js.map +1 -0
  61. package/dist/SubMenu-BGznOP2a.js +191 -0
  62. package/dist/SubMenu-BGznOP2a.js.map +1 -0
  63. package/dist/TableDetails-DztbjsIA.js +2069 -0
  64. package/dist/TableDetails-DztbjsIA.js.map +1 -0
  65. package/dist/TableList-DYwotUDO.js +1425 -0
  66. package/dist/TableList-DYwotUDO.js.map +1 -0
  67. package/dist/{TypeConfiguration-C-lk8Szs.js → TypeConfiguration-DYbBG_hZ.js} +2 -2
  68. package/dist/{TypeConfiguration-C-lk8Szs.js.map → TypeConfiguration-DYbBG_hZ.js.map} +1 -1
  69. package/dist/{UserList-S5Q76wO7.js → UserList-BAeAFeXZ.js} +410 -400
  70. package/dist/UserList-BAeAFeXZ.js.map +1 -0
  71. package/dist/{UserListSkeleton-cglK2SaU.js → UserListSkeleton-DhIJ5X3y.js} +10 -7
  72. package/dist/UserListSkeleton-DhIJ5X3y.js.map +1 -0
  73. package/dist/WidgetList-D-fIf3N2.js +200 -0
  74. package/dist/WidgetList-D-fIf3N2.js.map +1 -0
  75. package/dist/i18next-CTOWN_jH.js.map +1 -1
  76. package/dist/index.css +1 -1
  77. package/dist/index.js +64 -63
  78. package/dist/index.js.map +1 -1
  79. package/dist/xlsx.min-D1LFqt_b.js.map +1 -1
  80. package/package.json +1 -1
  81. package/dist/AccessRights-BMRM1u9S.js +0 -1228
  82. package/dist/AccessRights-BMRM1u9S.js.map +0 -1
  83. package/dist/AddRoleDrawer-ZK1eejxI.js.map +0 -1
  84. package/dist/ChangePasswordModalCore-DIe4rzW-.js.map +0 -1
  85. package/dist/EventConfigurations-jGCJ4LqP.js +0 -384
  86. package/dist/EventConfigurations-jGCJ4LqP.js.map +0 -1
  87. package/dist/EventsSkeleton-BN7_0IGs.js +0 -74
  88. package/dist/EventsSkeleton-BN7_0IGs.js.map +0 -1
  89. package/dist/FeatureMenu-Ds6lFg4w.js +0 -249
  90. package/dist/FeatureMenu-Ds6lFg4w.js.map +0 -1
  91. package/dist/Features-Cshdl06N.js +0 -12
  92. package/dist/Features-Cshdl06N.js.map +0 -1
  93. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.js.map +0 -1
  94. package/dist/ImmunizationConfigurationsList-CQnxWa09.js +0 -335
  95. package/dist/ImmunizationConfigurationsList-CQnxWa09.js.map +0 -1
  96. package/dist/ManageEventConfiguration-BJxS2Su0.js.map +0 -1
  97. package/dist/ManageNotification-DMN2szWy.js.map +0 -1
  98. package/dist/ManageRole-CuXmWQyp.js.map +0 -1
  99. package/dist/ManageTranslation-BTxvSYKb.js +0 -616
  100. package/dist/ManageTranslation-BTxvSYKb.js.map +0 -1
  101. package/dist/ManageUser-Dr3ptCYp.js.map +0 -1
  102. package/dist/NotificationList-BqibwMaM.js +0 -400
  103. package/dist/NotificationList-BqibwMaM.js.map +0 -1
  104. package/dist/OtherTypeEventConfigModal-ZnCGWm9v.js.map +0 -1
  105. package/dist/QueryBuilder-BPfavHH9.js.map +0 -1
  106. package/dist/QueryManagement-DXA73N2j.js +0 -671
  107. package/dist/QueryManagement-DXA73N2j.js.map +0 -1
  108. package/dist/RoleManagement-C0feJCuq.js +0 -410
  109. package/dist/RoleManagement-C0feJCuq.js.map +0 -1
  110. package/dist/SubMenu-DAfZC9Xi.js +0 -188
  111. package/dist/SubMenu-DAfZC9Xi.js.map +0 -1
  112. package/dist/TableDetails-DzREeJkm.js +0 -1508
  113. package/dist/TableDetails-DzREeJkm.js.map +0 -1
  114. package/dist/TableList-B9hr05Hs.js +0 -428
  115. package/dist/TableList-B9hr05Hs.js.map +0 -1
  116. package/dist/UserList-S5Q76wO7.js.map +0 -1
  117. package/dist/UserListSkeleton-cglK2SaU.js.map +0 -1
  118. package/dist/WidgetList-BSApErov.js +0 -188
  119. package/dist/WidgetList-BSApErov.js.map +0 -1
@@ -1,671 +0,0 @@
1
- import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
- import { useState as s, useEffect as H, useMemo as Me } from "react";
3
- import { Box as C, Accordion as ae, AccordionSummary as ne, Typography as v, AccordionDetails as oe, TextField as Be, Button as g } from "@mui/material";
4
- import { api as K } from "@/common/interceptors/AxiosInterceptor";
5
- import { execute as ze, downloadExcel as Ke } from "@/common/services/GlobalApis";
6
- import { useSelector as z } from "react-redux";
7
- import se from "@/views/custom-components/CustomTextField";
8
- import { useForm as Pe } from "react-hook-form";
9
- import $e from "@/hooks/useTrackEvent";
10
- import je from "@/views/custom-components/CustomConfirmationModal";
11
- import { showToast as r } from "@/common/toaster/toaster";
12
- import { Link as le } from "react-router-dom";
13
- import Ue from "dayjs";
14
- import { useTranslateProvider as We } from "@/common/languageTranslator/TranslationContext";
15
- import re from "prop-types";
16
- import { getUseSkeleton as ue } from "@/store/reducers/SkeletonReducer";
17
- import { Grid as M } from "@mui/system";
18
- import Ye from "@/views/custom-components/CustomTextArea";
19
- import B from "@/views/custom-components/CustomizedTable/CustomizedTableV2";
20
- import { faChevronDown as ie } from "@fortawesome/free-solid-svg-icons";
21
- import { FontAwesomeIcon as ce } from "@fortawesome/react-fontawesome";
22
- import Je from "lodash/debounce";
23
- import './QueryManagement.css';const Ve = (c) => K.post("resource/getdatawithtimeout", c), Ge = (c) => K.post("querymanagement/retrieve", c, {
24
- headers: { "Content-Type": "application/json" },
25
- transformRequest: [(m) => m]
26
- }), Xe = (c) => K.post("querymanagement/execute", c, {
27
- headers: { "Content-Type": "application/json" },
28
- transformRequest: [(m) => m]
29
- }), pe = ({ children: c, loading: m }) => !z(ue) || !m ? c : /* @__PURE__ */ o("div", { className: "flex flex-col space-y-4 h-[100vh] pt-3 relative w-full", children: [
30
- /* @__PURE__ */ o("div", { className: " flex flex-row space-x-2 overflow-auto", children: [
31
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[100%] h-[50px] " }),
32
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[100%] h-[50px] mx-[10px]" })
33
- ] }),
34
- /* @__PURE__ */ o("div", { className: " flex flex-col flex-1 ", children: [
35
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse h-[10rem] w-full rounded-md mb-2" }),
36
- /* @__PURE__ */ o("div", { className: "flex h-40 space-x-6", children: [
37
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-60 h-[40px]" }),
38
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
39
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
40
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
41
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
42
- /* @__PURE__ */ t("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" })
43
- ] })
44
- ] })
45
- ] });
46
- pe.propTypes = {
47
- children: re.any,
48
- loading: re.any
49
- };
50
- const de = { pagination: !1 }, me = { tableStyle: { maxHeight: 180 } }, Ze = {
51
- pagination: !1,
52
- paginationType: "virtual-scroll"
53
- }, et = { tableStyle: { maxHeight: "60vh" } }, Ct = () => {
54
- const c = z(ue), m = async (e, a = null) => {
55
- let n;
56
- return a === "index" ? n = "SELECT * FROM pg_indexes WHERE tablename = '" + e.tablename + "' limit 100" : a === "ddl" ? n = `WITH table_columns AS (
57
- SELECT
58
- c.relname AS table_name,
59
- a.attname AS column_name,
60
- pg_catalog.format_type(a.atttypid, a.atttypmod) AS column_type,
61
- CASE
62
- WHEN a.attnotnull THEN 'not null'
63
- ELSE 'null'
64
- END AS column_constraint
65
- FROM
66
- pg_class c
67
- JOIN pg_attribute a ON a.attrelid = c.oid
68
- JOIN pg_type t ON a.atttypid = t.oid
69
- WHERE
70
- c.relname = '${e.tablename}'
71
- AND a.attnum > 0 -- Exclude system columns
72
- ORDER BY a.attnum
73
- ),
74
- table_indexes AS (
75
- SELECT
76
- t.relname AS table_name,
77
- i.relname AS index_name,
78
- pg_catalog.pg_get_indexdef(ix.indexrelid) AS index_def
79
- FROM
80
- pg_class t
81
- JOIN pg_index ix ON t.oid = ix.indrelid
82
- JOIN pg_class i ON i.oid = ix.indexrelid
83
- WHERE
84
- t.relname = '${e.tablename}'
85
- )
86
- SELECT
87
- 'CREATE TABLE ' || tc.table_name || E'
88
- (
89
- ' ||
90
- array_to_string(
91
- array_agg(
92
- DISTINCT ' ' || tc.column_name || ' ' || tc.column_type || ' ' || tc.column_constraint
93
- ),
94
- E',
95
- '
96
- ) || E'
97
- );
98
- ' ||
99
- COALESCE(
100
- string_agg(
101
- DISTINCT ti.index_def,
102
- E'
103
- '
104
- ),
105
- ''
106
- ) AS ddl
107
- FROM
108
- table_columns tc
109
- LEFT JOIN table_indexes ti ON tc.table_name = ti.table_name
110
- GROUP BY
111
- tc.table_name;
112
- ` : n = `select * from ${e.tablename} limit 100`, x(n), f(n), {};
113
- }, P = async (e) => {
114
- x(e.query), k(0);
115
- }, [$, ye] = s(null), [p, x] = s(""), [b, S] = s(0), fe = [
116
- { field: "Sr. No.", label: "#", align: "left" },
117
- { field: "size_pretty", label: "Size", align: "left" },
118
- {
119
- field: "tablename",
120
- label: "Table Name",
121
- align: "left",
122
- onClick: m
123
- },
124
- {
125
- field: "Action",
126
- label: "Action",
127
- align: "left",
128
- render: (e) => /* @__PURE__ */ t(
129
- g,
130
- {
131
- variant: "contained",
132
- color: "primary",
133
- size: "small",
134
- className: "text-[0.75rem]",
135
- onClick: () => m(e, "index"),
136
- children: l("Index")
137
- }
138
- )
139
- },
140
- {
141
- field: "DDL",
142
- label: "DDL",
143
- align: "left",
144
- render: (e) => /* @__PURE__ */ t(
145
- g,
146
- {
147
- variant: "contained",
148
- color: "primary",
149
- size: "small",
150
- className: "text-[0.75rem]",
151
- onClick: () => m(e, "ddl"),
152
- children: l("DDL")
153
- }
154
- )
155
- }
156
- ], he = [
157
- { field: "Sr. No.", label: "#", align: "left" },
158
- {
159
- field: "query",
160
- label: "Query",
161
- align: "left",
162
- onClick: P
163
- },
164
- { field: "created_on", label: "Executed On", align: "left" }
165
- ], [ge, xe] = s([]), [A, D] = s([]), [be, _e] = s(!1), { user: I } = z((e) => e.Authenticate), [T, Ne] = s([]), [we, j] = s([]), [U, Ce] = s([]), [ve, Se] = s([]), W = A.length || null, _ = "select pid,query,wait_event_type,state_change,cast (now()-state_change as TEXT) as Since from pg_stat_activity where state = 'active' order by state_change", Y = `select pg_terminate_backend( ${$} )`, q = "select cast(pid as text) as pid, cast(usename as text) as usename, cast(pg_blocking_pids(pid) as text) as blocked_by, datname as Database_Name,cast(query as text) as blocked_query from pg_stat_activity where cardinality(pg_blocking_pids(pid)) > 0", { translate: l } = We(), [Te, J] = s(!1), [V, k] = s(0), [Ee, u] = s(!1), [De, Q] = s(!1), [G, L] = s(!0), {
166
- control: R,
167
- setValue: X,
168
- getValues: E,
169
- formState: { errors: ke }
170
- } = Pe({
171
- mode: "onChange",
172
- defaultValues: {
173
- excelFileName: ""
174
- }
175
- });
176
- H(() => {
177
- j(T);
178
- }, [T]), H(() => {
179
- if (p) {
180
- if ((p == null ? void 0 : p.length) > 0) {
181
- L(!1), X("query", p);
182
- return;
183
- }
184
- L(!0);
185
- }
186
- }, [p]);
187
- const Z = $e(), f = async (e, a = []) => {
188
- try {
189
- if (!e) {
190
- r({ message: "Query can not be empty", type: "error" });
191
- return;
192
- }
193
- u(!0);
194
- const { data: n } = await Ge(e).catch((d) => {
195
- D([]), console.error(d), u(!1), r({ message: `${d.response.data.message}`, type: "error" });
196
- });
197
- if (n && !n.length) {
198
- k(0), D([]), r({ message: "No data found", type: "info" }), u(!1);
199
- return;
200
- }
201
- if (n != null && n.length && (k(0), e !== _ && r({
202
- message: "Query Executed Successfully",
203
- type: "success"
204
- })), e === _)
205
- a = [
206
- {
207
- label: "KILL PROCESS",
208
- icon: /* @__PURE__ */ t(
209
- g,
210
- {
211
- variant: "contained",
212
- color: "error",
213
- className: "text-[0.75rem]",
214
- children: l("Kill Process")
215
- }
216
- ),
217
- onClick: Ae
218
- }
219
- ];
220
- else if (e === Y) {
221
- n != null && n.length && r({ message: "Terminated Successfully", type: "success" }), D([]);
222
- return;
223
- }
224
- D(
225
- n.map((d, N) => ({ index: N + 1, ...d }))
226
- );
227
- const i = Object.keys(n[0]);
228
- (a.length || e === _) && i.push("Actions");
229
- const y = i.map((d) => ({
230
- field: d,
231
- label: d,
232
- align: "left"
233
- }));
234
- Se(a), xe([
235
- { field: "index", label: "#", align: "left" },
236
- ...y
237
- ]), O(), u(!1);
238
- } catch (n) {
239
- u(!1), console.error(n);
240
- }
241
- }, ee = async (e) => {
242
- try {
243
- if (!e) {
244
- r({ message: "Query can not be empty", type: "error" });
245
- return;
246
- }
247
- const { data: a } = await Xe(e).catch((n) => {
248
- console.error(n), r({ message: `${n.response.data.message}`, type: "error" });
249
- });
250
- a.length || r({ message: "No data found", type: "info" }), a.length && r({ message: "Query updated successfully", type: "success" });
251
- } catch (a) {
252
- console.error(a);
253
- }
254
- }, Le = async () => {
255
- const e = "d91d249f-c8e1-4397-a84d-6ce6eb33eb48", a = E("query"), n = E("excelFileName");
256
- if (!a) {
257
- r({ message: "Query can not be empty", type: "info" });
258
- return;
259
- }
260
- try {
261
- u(!0);
262
- const y = await Ke(e, {
263
- paramObj: { query: a }
264
- }).catch(
265
- (h) => (console.error(h), r({
266
- message: "Operation Unsuccessful, Something went wrong",
267
- type: "error"
268
- }), null)
269
- );
270
- if (!y) {
271
- u(!1);
272
- return;
273
- }
274
- const d = new Blob([y.data], {
275
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
276
- }), N = `${n || "rename"}_${(/* @__PURE__ */ new Date()).getTime()}.xlsx`;
277
- if (navigator.msSaveBlob) {
278
- const h = new Blob([y.data], { type: "" }), F = (h.size / 1024).toFixed(2);
279
- return Z("file_download", {
280
- file_type: "xlsx",
281
- file_name: N,
282
- file_size: `${F} KB`,
283
- download_status: "success"
284
- }), navigator.msSaveBlob(h, N);
285
- } else {
286
- const h = URL.createObjectURL(d), F = (d.size / 1024).toFixed(2), w = document.createElement("a");
287
- w.href = h, w.download = N, w.style.display = "none", document.body.appendChild(w), w.click(), Z("file_download", {
288
- file_type: "xlsx",
289
- file_name: N,
290
- file_size: `${F} KB`,
291
- download_status: "success"
292
- }), URL.revokeObjectURL(h), w.remove();
293
- }
294
- u(!1);
295
- } catch (i) {
296
- console.error(i), u(!1), r({ type: "error", message: "Something went wrong!" });
297
- }
298
- }, Oe = async () => {
299
- try {
300
- _e(!0), x(q), await f(q);
301
- } catch (e) {
302
- console.error(e);
303
- }
304
- }, Ae = async (e) => {
305
- S(3), ye(e.pid);
306
- }, Ie = async () => {
307
- try {
308
- await f(Y);
309
- let e;
310
- be === !0 ? e = q : e = _, await f(e);
311
- } catch (e) {
312
- console.error(e);
313
- }
314
- }, qe = async () => {
315
- try {
316
- x(_), await f(_);
317
- } catch (e) {
318
- console.error(e);
319
- }
320
- }, O = async () => {
321
- try {
322
- const e = E("queryHistorySearchKey"), { data: a } = await ze({
323
- code: "retrieve_limited_query_history",
324
- parameters: {
325
- userId: I == null ? void 0 : I.id,
326
- limit: 100,
327
- searchKey: e
328
- }
329
- });
330
- Ce(
331
- a.result.map((n, i) => ({
332
- index: i + 1,
333
- ...n,
334
- created_on: Ue(n.created_on).format("DD-MM-YYYY h:mm:ss A")
335
- }))
336
- );
337
- } catch (e) {
338
- console.error(e);
339
- }
340
- }, Qe = async () => {
341
- J((e) => !e), O(), J((e) => !e);
342
- };
343
- H(() => {
344
- Qe();
345
- }, []);
346
- const Re = async () => {
347
- try {
348
- Q(!0);
349
- const { data: e } = await Ve({
350
- code: "retrieve_all_tables"
351
- });
352
- Ne(
353
- e.result.map((a, n) => ({
354
- index: n + 1,
355
- ...a
356
- }))
357
- ), Q(!1);
358
- } catch (e) {
359
- console.error(e), Q(!1);
360
- }
361
- }, Fe = (e) => {
362
- const a = e.target.value;
363
- He(a);
364
- }, He = Me(
365
- () => Je((e) => {
366
- const a = e.toLowerCase(), n = T.filter(
367
- (i) => {
368
- var y;
369
- return (y = i == null ? void 0 : i.tablename) == null ? void 0 : y.toLowerCase().includes(a);
370
- }
371
- );
372
- j(n);
373
- }, 300),
374
- // debounce time in ms
375
- [T]
376
- ), te = (e, a) => {
377
- k(a ? e : !1);
378
- };
379
- return /* @__PURE__ */ o(pe, { loading: Te, children: [
380
- Ee && c && /* @__PURE__ */ t("div", { className: "loader-overlay", children: /* @__PURE__ */ t("div", { className: "loader-spinner" }) }),
381
- /* @__PURE__ */ o(C, { minHeight: "80vh", className: "flex flex-col mt-5", children: [
382
- /* @__PURE__ */ o(
383
- C,
384
- {
385
- className: "flex flex-col md:flex-row md:space-x-2 space-y-2 md:space-y-0",
386
- children: [
387
- /* @__PURE__ */ t(M, { className: "w-full md:w-1/2", children: /* @__PURE__ */ o(
388
- ae,
389
- {
390
- expanded: V === 1,
391
- onChange: (e, a) => {
392
- a && !T.length && Re(), te(1, a);
393
- },
394
- "data-testid": "table-list-accordion",
395
- className: "accordion",
396
- children: [
397
- /* @__PURE__ */ t(
398
- ne,
399
- {
400
- expandIcon: /* @__PURE__ */ t(ce, { icon: ie }),
401
- "data-testid": "table-list-accordion-title",
402
- sx: {
403
- "&.Mui-expanded": {
404
- minHeight: "unset",
405
- paddingBottom: "2px",
406
- "& .MuiAccordionSummary-content": {
407
- marginBottom: "2px"
408
- }
409
- }
410
- },
411
- children: /* @__PURE__ */ t(v, { children: l("All Table List") })
412
- }
413
- ),
414
- /* @__PURE__ */ o(
415
- oe,
416
- {
417
- className: "accordion-details mt-2.5",
418
- sx: {
419
- backgroundColor: "background.paper",
420
- ".Mui-expanded &": {
421
- opacity: 1,
422
- pointerEvents: "auto"
423
- }
424
- },
425
- children: [
426
- /* @__PURE__ */ t(
427
- Be,
428
- {
429
- id: "tableListSearchKey",
430
- onChange: Fe,
431
- size: "small",
432
- placeholder: "Search Table Name",
433
- className: "w-[70%] mb-2"
434
- }
435
- ),
436
- /* @__PURE__ */ t(
437
- B,
438
- {
439
- strip: !0,
440
- isLoading: De,
441
- columns: fe,
442
- tableData: we,
443
- paginationConfig: de,
444
- dataTestId: "table-list-table-customized",
445
- styleConfig: me
446
- }
447
- )
448
- ]
449
- }
450
- )
451
- ]
452
- }
453
- ) }),
454
- /* @__PURE__ */ t(M, { className: "w-full md:w-1/2", children: /* @__PURE__ */ o(
455
- ae,
456
- {
457
- expanded: V === 2,
458
- onChange: (e, a) => {
459
- a && !U.length && O(), te(2, a);
460
- },
461
- "data-testid": "query-history-accordion",
462
- className: "accordion",
463
- children: [
464
- /* @__PURE__ */ t(
465
- ne,
466
- {
467
- expandIcon: /* @__PURE__ */ t(ce, { icon: ie }),
468
- "data-testid": "query-history-accordion-title",
469
- sx: {
470
- "&.Mui-expanded": {
471
- minHeight: "unset",
472
- paddingBottom: "2px",
473
- "& .MuiAccordionSummary-content": {
474
- marginBottom: "2px"
475
- }
476
- }
477
- },
478
- children: /* @__PURE__ */ t(v, { children: l("Query History") })
479
- }
480
- ),
481
- /* @__PURE__ */ o(
482
- oe,
483
- {
484
- className: "accordion-details mt-2.5",
485
- sx: {
486
- backgroundColor: "background.paper",
487
- ".Mui-expanded &": {
488
- opacity: 1,
489
- pointerEvents: "auto"
490
- }
491
- },
492
- test: "work",
493
- children: [
494
- /* @__PURE__ */ o(C, { className: "flex items-center mb-2", children: [
495
- /* @__PURE__ */ t(
496
- se,
497
- {
498
- id: "queryHistorySearchKey",
499
- name: "queryHistorySearchKey",
500
- control: R,
501
- placeholder: "Search in History",
502
- size: "small",
503
- className: "w-auto mr-1"
504
- }
505
- ),
506
- /* @__PURE__ */ t(
507
- g,
508
- {
509
- variant: "contained",
510
- color: "primary",
511
- onClick: O,
512
- "data-testid": "query-history-accordion-submit",
513
- sx: { ml: { xs: "10px", md: "0px" } },
514
- children: l("Search")
515
- }
516
- )
517
- ] }),
518
- /* @__PURE__ */ t(
519
- B,
520
- {
521
- strip: !0,
522
- columns: he,
523
- tableData: U,
524
- paginationConfig: de,
525
- dataTestId: "query-history-table-customized",
526
- styleConfig: me
527
- }
528
- )
529
- ]
530
- }
531
- )
532
- ]
533
- }
534
- ) })
535
- ]
536
- }
537
- ),
538
- /* @__PURE__ */ o(C, { className: "flex flex-col space-y-4", children: [
539
- /* @__PURE__ */ t(
540
- Ye,
541
- {
542
- control: R,
543
- minRows: 5,
544
- variant: "outlined",
545
- placeholder: "Type your query here...",
546
- id: "query",
547
- name: "query",
548
- className: "mt-5",
549
- sx: { backgroundColor: "background.paper" },
550
- errors: ke,
551
- margin: "normal",
552
- dataTestId: "query-text-area",
553
- onChange: (e) => {
554
- var a, n;
555
- if (X("query", e.target.value), ((n = (a = e == null ? void 0 : e.target) == null ? void 0 : a.value) == null ? void 0 : n.length) > 0) {
556
- L(!1);
557
- return;
558
- }
559
- L(!0);
560
- }
561
- }
562
- ),
563
- /* @__PURE__ */ o(C, { className: "flex flex-col md:flex-row md:items-center mb-4 gap-3", children: [
564
- /* @__PURE__ */ t(
565
- se,
566
- {
567
- id: "excelFileName",
568
- name: "excelFileName",
569
- className: "m-0 p-0",
570
- control: R,
571
- placeholder: "Enter File Name",
572
- size: "small",
573
- fullWidth: !1,
574
- dataTestId: "enter-file-field"
575
- }
576
- ),
577
- /* @__PURE__ */ t(
578
- g,
579
- {
580
- variant: "contained",
581
- color: "info",
582
- onClick: Le,
583
- "data-testid": "download-excel-button",
584
- children: l("Download Excel")
585
- }
586
- ),
587
- /* @__PURE__ */ o(C, { className: "m-1 flex", children: [
588
- /* @__PURE__ */ t(le, { onClick: () => Oe(), className: "m-1", children: /* @__PURE__ */ t(v, { variant: "body2", color: "info", children: l("Fetch Locked Queries") }) }),
589
- /* @__PURE__ */ t(v, { variant: "body2", className: "m-1", children: "|" }),
590
- /* @__PURE__ */ t(le, { onClick: qe, className: "m-1", children: /* @__PURE__ */ t(v, { variant: "body2", color: "info", children: l("Populate State Query") }) })
591
- ] }),
592
- /* @__PURE__ */ t(
593
- g,
594
- {
595
- variant: "contained",
596
- color: "success",
597
- onClick: async () => {
598
- const e = E("query");
599
- if (x(e), e != null && e.toLowerCase().includes("where")) {
600
- await f(e);
601
- return;
602
- }
603
- S(1);
604
- },
605
- "data-testid": "retrieve-data-button",
606
- disabled: G,
607
- children: l("Retrieve Data")
608
- }
609
- ),
610
- /* @__PURE__ */ t(
611
- g,
612
- {
613
- variant: "contained",
614
- color: "secondary",
615
- onClick: async () => {
616
- const e = E("query");
617
- if (x(e), e != null && e.toLowerCase().includes("where")) {
618
- await ee(e);
619
- return;
620
- }
621
- S(2);
622
- },
623
- "data-testid": "execute-button",
624
- disabled: G,
625
- children: l("Execute")
626
- }
627
- )
628
- ] }),
629
- !!W && /* @__PURE__ */ o(v, { variant: "body2", children: [
630
- l("Total rows fetched"),
631
- " :",
632
- " ",
633
- /* @__PURE__ */ o("strong", { children: [
634
- " ",
635
- W
636
- ] }),
637
- " "
638
- ] }),
639
- !!A.length && /* @__PURE__ */ t(M, { className: "max-h-[80vh] overflow-x-auto mb-2", children: /* @__PURE__ */ t(
640
- B,
641
- {
642
- className: "min-w-[500px]",
643
- columns: ge,
644
- actions: ve,
645
- tableData: A,
646
- paginationConfig: Ze,
647
- dataTestId: "query-output-table-customized",
648
- styleConfig: et
649
- }
650
- ) }),
651
- !!b && /* @__PURE__ */ t(
652
- je,
653
- {
654
- description: b === 3 ? `Are you sure you want to kill process id ${$}` : "The query does not include where clause. Are you sure you want to proceed ?",
655
- title: "CONFIRM ACTION",
656
- open: b,
657
- handleClick: async () => {
658
- b === 1 && f(p), b === 2 && ee(p), b === 3 && Ie(), S(0);
659
- },
660
- handleClose: () => S(0),
661
- dataTestId: "modal"
662
- }
663
- )
664
- ] })
665
- ] })
666
- ] });
667
- };
668
- export {
669
- Ct as default
670
- };
671
- //# sourceMappingURL=QueryManagement-DXA73N2j.js.map