@argusoft/medplat-core 1.0.15 → 1.0.17

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 (30) hide show
  1. package/dist/{ChangePasswordModalCore-CTGy8Ttf.js → ChangePasswordModalCore-ClND1mel.js} +67 -62
  2. package/dist/ChangePasswordModalCore-ClND1mel.js.map +1 -0
  3. package/dist/EventConfigurations-D8juDb29.js +449 -0
  4. package/dist/EventConfigurations-D8juDb29.js.map +1 -0
  5. package/dist/{ImmunizationConfigurationBase-DZ8EqXlF.js → ImmunizationConfigurationBase-VqVvVR57.js} +2095 -1872
  6. package/dist/ImmunizationConfigurationBase-VqVvVR57.js.map +1 -0
  7. package/dist/{ManageNotification-EQgnOO0U.js → ManageNotification-BUAvg5Ge.js} +1737 -1645
  8. package/dist/{ManageNotification-EQgnOO0U.js.map → ManageNotification-BUAvg5Ge.js.map} +1 -1
  9. package/dist/{ManageUser-C9uMe9av.js → ManageUser-eBS0yC5k.js} +80 -83
  10. package/dist/{ManageUser-C9uMe9av.js.map → ManageUser-eBS0yC5k.js.map} +1 -1
  11. package/dist/{NotificationList-BZwvgsf6.js → NotificationList-CUZSWp2J.js} +2 -2
  12. package/dist/{NotificationList-BZwvgsf6.js.map → NotificationList-CUZSWp2J.js.map} +1 -1
  13. package/dist/OtherTypeEventConfigModal-dXt2qDg_.js.map +1 -1
  14. package/dist/QueryManagement-DGHV_-d5.js +1012 -0
  15. package/dist/QueryManagement-DGHV_-d5.js.map +1 -0
  16. package/dist/{UserList-BH6OpZvq.js → UserList-BAeAFeXZ.js} +2 -2
  17. package/dist/{UserList-BH6OpZvq.js.map → UserList-BAeAFeXZ.js.map} +1 -1
  18. package/dist/{UserListSkeleton-cglK2SaU.js → UserListSkeleton-DhIJ5X3y.js} +10 -7
  19. package/dist/UserListSkeleton-DhIJ5X3y.js.map +1 -0
  20. package/dist/index.css +1 -1
  21. package/dist/index.js +56 -55
  22. package/dist/index.js.map +1 -1
  23. package/package.json +1 -1
  24. package/dist/ChangePasswordModalCore-CTGy8Ttf.js.map +0 -1
  25. package/dist/EventConfigurations-DZvSJ5EZ.js +0 -395
  26. package/dist/EventConfigurations-DZvSJ5EZ.js.map +0 -1
  27. package/dist/ImmunizationConfigurationBase-DZ8EqXlF.js.map +0 -1
  28. package/dist/QueryManagement-BpIRH8hI.js +0 -685
  29. package/dist/QueryManagement-BpIRH8hI.js.map +0 -1
  30. package/dist/UserListSkeleton-cglK2SaU.js.map +0 -1
@@ -0,0 +1,1012 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { useState as c, useEffect as ie, useMemo as ke } from "react";
3
+ import { Box as r, Card as F, Typography as x, Tabs as ba, Tab as ce, Chip as W, Button as p, Divider as _a, TextField as Ae, InputAdornment as de, IconButton as G, Modal as X } from "@mui/material";
4
+ import me from "@/common/services/util/GeneralUtil";
5
+ import { api as ye } from "@/common/interceptors/AxiosInterceptor";
6
+ import { downloadExcel as Na, execute as wa } from "@/common/services/GlobalApis";
7
+ import { getAssignedFeatures as Sa } from "@/utils/feature.js";
8
+ import { useSelector as he } from "react-redux";
9
+ import pe from "@/views/custom-components/CustomTextField";
10
+ import { useForm as va } from "react-hook-form";
11
+ import Ca from "@/hooks/useTrackEvent";
12
+ import Ea from "@/views/custom-components/CustomConfirmationModal";
13
+ import { showToast as u } from "@/common/toaster/toaster";
14
+ import Ta from "dayjs";
15
+ import { useTranslateProvider as Ra } from "@/common/languageTranslator/TranslationContext";
16
+ import De from "prop-types";
17
+ import { getUseSkeleton as We } from "@/store/reducers/SkeletonReducer";
18
+ import ka from "@monaco-editor/react";
19
+ import ue from "@/views/custom-components/CustomizedTable/CustomizedTableV2";
20
+ import { faTerminal as Aa, faTableList as Oe, faSitemap as xe, faDatabase as ge, faSlidersH as ze, faHistory as Le, faLock as Da, faTimes as Q, faDownload as Ie, faPlay as Oa, faSearch as qe, faClock as za, faSyncAlt as La } from "@fortawesome/free-solid-svg-icons";
21
+ import { FontAwesomeIcon as l } from "@fortawesome/react-fontawesome";
22
+ import Ia from "lodash/debounce";
23
+ import qa from "@/assets/gifs/baburao.gif";
24
+ import './QueryManagement.css';const Ma = (m) => ye.post("resource/getdatawithtimeout", m), Me = (m) => ye.post("querymanagement/retrieve", m, {
25
+ headers: { "Content-Type": "application/json" },
26
+ transformRequest: [(d) => d]
27
+ }), Fa = (m) => ye.post("querymanagement/execute", m, {
28
+ headers: { "Content-Type": "application/json" },
29
+ transformRequest: [(d) => d]
30
+ }), He = ({ children: m, loading: d }) => !he(We) || !d ? m : /* @__PURE__ */ t("div", { className: "flex flex-col space-y-4 h-[100vh] pt-3 relative w-full", children: [
31
+ /* @__PURE__ */ t("div", { className: " flex flex-row space-x-2 overflow-auto", children: [
32
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[100%] h-[50px] " }),
33
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[100%] h-[50px] mx-[10px]" })
34
+ ] }),
35
+ /* @__PURE__ */ t("div", { className: " flex flex-col flex-1 ", children: [
36
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse h-[10rem] w-full rounded-md mb-2" }),
37
+ /* @__PURE__ */ t("div", { className: "flex h-40 space-x-6", children: [
38
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-60 h-[40px]" }),
39
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
40
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
41
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
42
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" }),
43
+ /* @__PURE__ */ e("div", { className: "bg-gray-300 animate-pulse rounded-sm w-[130px] h-[40px]" })
44
+ ] })
45
+ ] })
46
+ ] });
47
+ He.propTypes = {
48
+ children: De.any,
49
+ loading: De.any
50
+ };
51
+ const Qa = [
52
+ {
53
+ category: "Performance & Space",
54
+ name: "Table Disk Usage Breakdown",
55
+ description: "Displays all tables in the public schema ordered by total disk footprint.",
56
+ code: `SELECT
57
+ relname AS table_name,
58
+ pg_size_pretty(pg_total_relation_size(c.oid)) AS total_size,
59
+ pg_size_pretty(pg_relation_size(c.oid)) AS data_size,
60
+ pg_size_pretty(pg_total_relation_size(c.oid) - pg_relation_size(c.oid)) AS index_size
61
+ FROM pg_class c
62
+ LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace)
63
+ WHERE n.nspname = 'public' AND c.relkind = 'r'
64
+ ORDER BY pg_total_relation_size(c.oid) DESC;`
65
+ },
66
+ {
67
+ category: "Performance & Space",
68
+ name: "Unused Indexes Audit",
69
+ description: "Finds indexes that have never been scanned by queries (candidates to drop).",
70
+ code: `SELECT
71
+ schemaname, relname AS table_name, indexrelname AS index_name,
72
+ idx_scan AS times_used, pg_size_pretty(pg_relation_size(indexrelid)) AS index_size
73
+ FROM pg_stat_user_indexes WHERE idx_scan = 0
74
+ ORDER BY pg_relation_size(indexrelid) DESC;`
75
+ },
76
+ {
77
+ category: "Performance & Space",
78
+ name: "Buffer Cache Hit Ratio",
79
+ description: "Calculates percentage of data reads served from shared memory RAM vs hitting cold disk storage. Aim for > 99%.",
80
+ code: `SELECT
81
+ relname AS table_name,
82
+ heap_blks_hit AS ram_hits,
83
+ heap_blks_read AS disk_reads,
84
+ ROUND(100.0 * heap_blks_hit / NULLIF(heap_blks_hit + heap_blks_read, 0), 2) AS cache_hit_ratio_pct
85
+ FROM pg_statio_user_tables
86
+ WHERE (heap_blks_hit + heap_blks_read) > 0
87
+ ORDER BY disk_reads DESC;`
88
+ },
89
+ {
90
+ category: "Performance & Space",
91
+ name: "Table Scan Analysis (Seq vs Index)",
92
+ description: "Identifies heavy tables that frequently perform sequential scans instead of utilizing indexes.",
93
+ code: `SELECT
94
+ relname AS table_name,
95
+ seq_scan AS sequential_scans,
96
+ idx_scan AS indexed_scans,
97
+ ROUND(100.0 * idx_scan / NULLIF(seq_scan + idx_scan, 0), 2) AS optimal_index_usage_pct
98
+ FROM pg_stat_user_tables
99
+ WHERE (seq_scan + idx_scan) > 100
100
+ ORDER BY seq_scan DESC;`
101
+ },
102
+ {
103
+ category: "Index Health",
104
+ name: "Duplicate & Redundant Indexes",
105
+ description: "Finds index keys pointing to the same table column combination—wasting memory buffers and slowing down mutations.",
106
+ code: `SELECT
107
+ indrelid::regclass AS table_name,
108
+ amname AS access_method,
109
+ indkey::text AS stringified_keys,
110
+ array_agg(indexrelid::regclass) AS duplicate_indexes
111
+ FROM pg_index i
112
+ JOIN pg_opclass o ON o.oid = ANY(i.indclass)
113
+ JOIN pg_am a ON a.oid = o.opcmethod
114
+ GROUP BY indrelid, amname, indkey
115
+ HAVING count(*) > 1;`
116
+ },
117
+ {
118
+ category: "Index Health",
119
+ name: "Index Size vs Usage Breakdown",
120
+ description: "Compares raw storage footprint vs actual read utilization across your entire index ecosystem.",
121
+ code: `SELECT
122
+ schemaname,
123
+ relname AS table_name,
124
+ indexrelname AS index_name,
125
+ pg_size_pretty(pg_relation_size(indexrelid)) AS index_size,
126
+ idx_scan AS scan_count
127
+ FROM pg_stat_user_indexes
128
+ ORDER BY pg_relation_size(indexrelid) DESC;`
129
+ },
130
+ {
131
+ category: "Maintenance",
132
+ name: "Dead Rows & Bloat Tracking",
133
+ description: "Shows dead row accumulation counts that require manual VACUUMing.",
134
+ code: `SELECT
135
+ schemaname, relname AS table_name, n_dead_tup AS dead_rows,
136
+ n_live_tup AS live_rows, last_vacuum, last_autovacuum
137
+ FROM pg_stat_user_tables WHERE n_dead_tup > 0
138
+ ORDER BY n_dead_tup DESC;`
139
+ },
140
+ {
141
+ category: "Maintenance",
142
+ name: "Autovacuum Live Execution Progress",
143
+ description: "Monitors actively running background cleanups, physical page heap scans, and current phase progressions.",
144
+ code: `SELECT
145
+ p.pid,
146
+ now() - a.xact_start AS active_duration,
147
+ p.phase,
148
+ p.heap_blks_total,
149
+ p.heap_blks_scanned,
150
+ p.heap_blks_vacuumed
151
+ FROM pg_stat_progress_vacuum p
152
+ JOIN pg_stat_activity a ON p.pid = a.pid;`
153
+ },
154
+ {
155
+ category: "Maintenance",
156
+ name: "Transaction ID Wraparound Risk Age",
157
+ description: "Tracks how close databases are climbing toward freezing points to prevent catastrophic read-only emergencies.",
158
+ code: `SELECT
159
+ datname AS database_name,
160
+ age(datfrozenxid) AS current_tx_age,
161
+ ROUND(100.0 * age(datfrozenxid) / 2000000000.0, 4) AS wraparound_emergency_consumed_pct
162
+ FROM pg_database
163
+ WHERE datallowconn = true
164
+ ORDER BY current_tx_age DESC;`
165
+ }
166
+ ], Fe = { pagination: !1 }, Qe = { tableStyle: { maxHeight: "55vh", borderRadius: "8px" } }, Wa = {
167
+ pagination: !1,
168
+ paginationType: "virtual-scroll"
169
+ }, Ha = { tableStyle: { maxHeight: "62vh", borderRadius: "8px" } }, fe = {
170
+ position: "absolute",
171
+ top: "50%",
172
+ left: "50%",
173
+ transform: "translate(-50%, -50%)",
174
+ width: "90%",
175
+ maxWidth: "1200px",
176
+ bgcolor: "background.paper",
177
+ boxShadow: "0px 20px 50px rgba(0, 0, 0, 0.15)",
178
+ p: 4,
179
+ borderRadius: "16px",
180
+ outline: "none",
181
+ border: "1px solid rgba(0, 0, 0, 0.05)"
182
+ }, Be = (m) => {
183
+ if (!m) return 0;
184
+ const d = m.match(/actual\s+time=[\d.]+\.\.([\d.]+)/);
185
+ if (d && d[1]) return parseFloat(d[1]);
186
+ const w = m.match(/cost=[\d.]+\.\.([\d.]+)/);
187
+ return w && w[1] ? parseFloat(w[1]) : 0;
188
+ }, Ba = ({ rawTextLine: m, totalPlanMetric: d }) => {
189
+ if (!m || !m.trim()) return null;
190
+ const w = m.search(/\S/), L = w > 0 ? Math.floor(w / 2) : 0, D = m.trim(), g = D.includes("Seq Scan"), y = D.includes("Index Scan"), C = D.startsWith("->") || L > 0, E = Be(D), I = d > 0 ? Math.round(E / d * 100) : 0, O = I >= 35;
191
+ return /* @__PURE__ */ t(
192
+ r,
193
+ {
194
+ className: "flex items-center justify-between gap-4 py-2 px-3 my-1 rounded-lg border transition-all hover:bg-slate-100/80",
195
+ sx: {
196
+ marginLeft: `${L * 24}px`,
197
+ backgroundColor: O ? "#fff5f5" : g ? "#fef2f2" : y ? "#f0fdf4" : "#ffffff",
198
+ borderColor: O ? "#fecaca" : g ? "#fca5a5" : y ? "#bbf7d0" : "#e2e8f0",
199
+ borderLeft: O ? "5px solid #dc2626" : g ? "5px solid #ef4444" : y ? "5px solid #22c55e" : "1px solid #e2e8f0"
200
+ },
201
+ children: [
202
+ /* @__PURE__ */ t(r, { className: "flex items-center gap-2 overflow-hidden flex-grow", children: [
203
+ C && /* @__PURE__ */ e("span", { className: "text-gray-400 font-bold select-none", children: "↳" }),
204
+ /* @__PURE__ */ e(
205
+ x,
206
+ {
207
+ variant: "body2",
208
+ className: "font-mono text-slate-700 font-medium break-all whitespace-pre-wrap",
209
+ sx: { color: O || g ? "#991b1b" : y ? "#166534" : "#334155" },
210
+ children: D
211
+ }
212
+ )
213
+ ] }),
214
+ E > 0 && /* @__PURE__ */ e(r, { className: "flex items-center gap-1.5 shrink-0", children: /* @__PURE__ */ e(
215
+ W,
216
+ {
217
+ label: `${I}% cost`,
218
+ size: "small",
219
+ color: O ? "error" : I > 15 ? "warning" : "default",
220
+ sx: {
221
+ fontSize: "11px",
222
+ fontWeight: "700",
223
+ height: "22px",
224
+ borderRadius: "6px"
225
+ }
226
+ }
227
+ ) })
228
+ ]
229
+ }
230
+ );
231
+ }, ut = () => {
232
+ const m = he(We), [d, w] = c({}), [L, D] = c(null), [g, y] = c(""), [C, E] = c(0), [I, O] = c([]), [S, H] = c([]), [Pe, je] = c(!1), { user: B } = he((a) => a.Authenticate), [P, T] = c(0), [R, j] = c(""), [$e, $] = c(!1), [Ue, U] = c(!1), [q, Ye] = c([]), [Ke, be] = c([]), [Je, Ve] = c([]), [_e, Ge] = c([]), Y = S.length || null, [K, Xe] = c([]), [Ne, we] = c(null), z = "select pid,datname,state,wait_event_type,cast(now() - query_start as text) as query_age,cast(now() - state_change as text) as state_age,query from pg_stat_activity where state in ('active','idle in transaction') order by query_age desc;", Se = `select pg_terminate_backend( ${L} )`, Z = "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", ve = "select * from caught_exception where username = (select user_name from um_user where id = " + B.id + ") order by id desc limit 100", { translate: i } = Ra(), [Ce, ee] = c(!1), [Ze, f] = c(!1), [ea, ae] = c(!1), [te, M] = c(!0), [aa, J] = c(!1), [ta, re] = c(!1), ne = async (a, s = null) => {
233
+ let n;
234
+ s === "index" ? n = "SELECT * FROM pg_indexes WHERE tablename = '" + a.tablename + "' limit 100" : s === "ddl" ? n = `WITH table_columns AS (
235
+ SELECT c.relname AS table_name, a.attname AS column_name, pg_catalog.format_type(a.atttypid, a.atttypmod) AS column_type,
236
+ CASE WHEN a.attnotnull THEN 'not null' ELSE 'null' END AS column_constraint
237
+ FROM pg_class c JOIN pg_attribute a ON a.attrelid = c.oid JOIN pg_type t ON a.atttypid = t.oid
238
+ WHERE c.relname = '${a.tablename}' AND a.attnum > 0 ORDER BY a.attnum
239
+ ), table_indexes AS (
240
+ SELECT t.relname AS table_name, i.relname AS index_name, pg_catalog.pg_get_indexdef(ix.indexrelid) AS index_def
241
+ FROM pg_class t JOIN pg_index ix ON t.oid = ix.indrelid JOIN pg_class i ON i.oid = ix.indexrelid
242
+ WHERE t.relname = '${a.tablename}'
243
+ )
244
+ SELECT 'CREATE TABLE ' || tc.table_name || E'\\n(\\n' || array_to_string(array_agg(DISTINCT ' ' || tc.column_name || ' ' || tc.column_type || ' ' || tc.column_constraint), E',\\n') || E'\\n);\\n' || COALESCE(string_agg(DISTINCT ti.index_def, E'\\n'), '') AS ddl
245
+ FROM table_columns tc LEFT JOIN table_indexes ti ON tc.table_name = ti.table_name GROUP BY tc.table_name;` : n = `select * from ${a.tablename} limit 100`, y(n), $(!1), T(0), v(n);
246
+ }, ra = async (a) => {
247
+ y(a.query), V("query", a.query), M(!(a.query && a.query.trim().length > 0)), U(!1), T(0);
248
+ }, na = [
249
+ { field: "Sr. No.", label: "#", align: "left" },
250
+ { field: "size_pretty", label: "Size", align: "left" },
251
+ { field: "tablename", label: "Table Name", align: "left", onClick: ne },
252
+ {
253
+ field: "Action",
254
+ label: "Action",
255
+ align: "center",
256
+ render: (a) => /* @__PURE__ */ e(p, { variant: "outlined", color: "primary", size: "small", sx: { borderRadius: "6px", textTransform: "none" }, onClick: () => ne(a, "index"), children: i("Index") })
257
+ },
258
+ {
259
+ field: "DDL",
260
+ label: "DDL",
261
+ align: "center",
262
+ render: (a) => /* @__PURE__ */ e(p, { variant: "outlined", color: "secondary", size: "small", sx: { borderRadius: "6px", textTransform: "none" }, onClick: () => ne(a, "ddl"), children: i("DDL") })
263
+ }
264
+ ], sa = [
265
+ { field: "Sr. No.", label: "#", align: "left" },
266
+ { field: "query", label: "Query", align: "left", onClick: ra },
267
+ { field: "created_on", label: "Executed On", align: "left" }
268
+ ], { control: se, setValue: V, getValues: k, formState: { errors: Pa } } = va({
269
+ mode: "onChange",
270
+ defaultValues: { excelFileName: "" }
271
+ });
272
+ ie(() => {
273
+ be(q);
274
+ }, [q]), ie(() => {
275
+ (g == null ? void 0 : g.length) > 0 ? (M(!1), V("query", g)) : M(!0);
276
+ }, [g]);
277
+ const Ee = Ca(), v = async (a, s = []) => {
278
+ try {
279
+ if (!a) {
280
+ u({ message: "Query can not be empty", type: "error" });
281
+ return;
282
+ }
283
+ f(!0), j("");
284
+ const n = performance.now(), { data: o } = await Me(a).catch((h) => {
285
+ H([]), f(!1), we(null), u({ message: `${h.response.data.message}`, type: "error" });
286
+ }), b = performance.now();
287
+ if (we((b - n).toFixed(0)), o && !o.length) {
288
+ H([]), u({ message: "No data found", type: "info" }), f(!1);
289
+ return;
290
+ }
291
+ if (o != null && o.length && a !== z && u({ message: "Query Executed Successfully", type: "success" }), a === z)
292
+ s = [
293
+ {
294
+ label: "KILL PROCESS",
295
+ icon: /* @__PURE__ */ e(
296
+ p,
297
+ {
298
+ variant: "outlined",
299
+ color: "error",
300
+ size: "small",
301
+ sx: {
302
+ borderRadius: "6px",
303
+ textTransform: "none",
304
+ fontSize: "11px",
305
+ minWidth: "auto"
306
+ },
307
+ children: i("Kill Query")
308
+ }
309
+ ),
310
+ onClick: ia
311
+ }
312
+ ];
313
+ else if (a === Se) {
314
+ o != null && o.length && u({ message: "Terminated Successfully", type: "success" }), H([]);
315
+ return;
316
+ }
317
+ H(o.map((h, A) => ({ index: A + 1, ...h })));
318
+ const N = Object.keys(o[0]);
319
+ (s.length || a === z) && N.push("Actions");
320
+ const _ = N.map((h) => ({ field: h, label: h, align: "left" }));
321
+ Ge(s), O([{ field: "index", label: "#", align: "left" }, ..._]), oe(), f(!1), T(1);
322
+ } catch {
323
+ f(!1);
324
+ }
325
+ }, oa = async () => {
326
+ const a = k("query");
327
+ if (!a) {
328
+ u({ message: "Query can not be empty", type: "error" });
329
+ return;
330
+ }
331
+ const n = `EXPLAIN ${a.trim().replace(/;+$/, "")};`;
332
+ try {
333
+ f(!0);
334
+ const { data: o } = await Me(n).catch((b) => {
335
+ var N, _;
336
+ f(!1), u({ message: `${((_ = (N = b.response) == null ? void 0 : N.data) == null ? void 0 : _.message) || "Explain failed"}`, type: "error" });
337
+ });
338
+ if (o && o.length > 0) {
339
+ const b = Object.keys(o[0])[0], N = o.map((_) => _[b]);
340
+ Xe(N), u({ message: "Explain Plan Calculated", type: "success" }), T(2);
341
+ } else
342
+ u({ message: "No data returned from execution plan", type: "info" });
343
+ f(!1);
344
+ } catch (o) {
345
+ f(!1), console.error(o);
346
+ }
347
+ }, Te = async (a) => {
348
+ try {
349
+ if (!a) {
350
+ u({ message: "Query can not be empty", type: "error" });
351
+ return;
352
+ }
353
+ const { data: s } = await Fa(a).catch((n) => {
354
+ u({ message: `${n.response.data.message}`, type: "error" });
355
+ });
356
+ s.length || u({ message: "No data found", type: "info" }), s.length && u({ message: "Query updated successfully", type: "success" });
357
+ } catch (s) {
358
+ console.error(s);
359
+ }
360
+ }, Re = async () => {
361
+ const a = "d91d249f-c8e1-4397-a84d-6ce6eb33eb48", s = k("query"), n = k("excelFileName");
362
+ if (!s) {
363
+ u({ message: "Query can not be empty", type: "info" });
364
+ return;
365
+ }
366
+ try {
367
+ f(!0);
368
+ const b = await Na(a, { paramObj: { query: s } }).catch((h) => (u({ message: "Operation Unsuccessful, Something went wrong", type: "error" }), null));
369
+ if (!b) {
370
+ f(!1);
371
+ return;
372
+ }
373
+ const N = new Blob([b.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }), _ = `${n || "rename"}_${(/* @__PURE__ */ new Date()).getTime()}.xlsx`;
374
+ if (navigator.msSaveBlob) {
375
+ const h = new Blob([b.data], { type: "" });
376
+ return Ee("file_download", { file_type: "xlsx", file_name: _, file_size: `${(h.size / 1024).toFixed(2)} KB`, download_status: "success" }), navigator.msSaveBlob(h, _);
377
+ } else {
378
+ const h = URL.createObjectURL(N), A = document.createElement("a");
379
+ A.href = h, A.download = _, A.style.display = "none", document.body.appendChild(A), A.click(), Ee("file_download", { file_type: "xlsx", file_name: _, file_size: `${(N.size / 1024).toFixed(2)} KB`, download_status: "success" }), URL.revokeObjectURL(h), A.remove();
380
+ }
381
+ f(!1);
382
+ } catch {
383
+ f(!1), u({ type: "error", message: "Something went wrong!" });
384
+ }
385
+ }, la = async () => {
386
+ try {
387
+ je(!0), y(Z), await v(Z);
388
+ } catch (a) {
389
+ console.error(a);
390
+ }
391
+ }, ia = async (a) => {
392
+ E(3), D(a.pid);
393
+ }, ca = async () => {
394
+ try {
395
+ await v(Se), await v(Pe ? Z : z);
396
+ } catch (a) {
397
+ console.error(a);
398
+ }
399
+ }, da = async () => {
400
+ try {
401
+ y(z), await v(z);
402
+ } catch (a) {
403
+ console.error(a);
404
+ }
405
+ }, oe = async () => {
406
+ try {
407
+ const a = k("queryHistorySearchKey"), { data: s } = await wa({
408
+ code: "retrieve_limited_query_history",
409
+ parameters: { userId: B == null ? void 0 : B.id, limit: 100, searchKey: a }
410
+ });
411
+ Ve(
412
+ s.result.map((n, o) => ({
413
+ index: o + 1,
414
+ ...n,
415
+ created_on: Ta(n.created_on).format("DD-MM-YYYY h:mm:ss A")
416
+ }))
417
+ );
418
+ } catch (a) {
419
+ console.error(a);
420
+ }
421
+ }, ma = async () => {
422
+ try {
423
+ ee(!0);
424
+ const { data: a } = await Sa("techo.querymanagement");
425
+ a && w(JSON.parse(a)), await oe(), ee(!1);
426
+ } catch {
427
+ ee(!1);
428
+ }
429
+ };
430
+ ie(() => {
431
+ ma();
432
+ }, []);
433
+ const pa = async () => {
434
+ $(!0), q.length || await xa();
435
+ }, ua = () => {
436
+ J(!0);
437
+ }, xa = async () => {
438
+ try {
439
+ ae(!0);
440
+ const { data: a } = await Ma({ code: "retrieve_all_tables" });
441
+ Ye(a.result.map((s, n) => ({ index: n + 1, ...s }))), ae(!1);
442
+ } catch {
443
+ ae(!1);
444
+ }
445
+ }, ga = (a) => {
446
+ fa(a.target.value);
447
+ }, fa = ke(
448
+ () => Ia((a) => {
449
+ const s = a.toLowerCase();
450
+ be(q.filter((n) => {
451
+ var o;
452
+ return (o = n == null ? void 0 : n.tablename) == null ? void 0 : o.toLowerCase().includes(s);
453
+ }));
454
+ }, 300),
455
+ [q]
456
+ ), le = ke(() => {
457
+ if (!R) return S;
458
+ const a = R.toLowerCase().trim();
459
+ return S.filter((s) => Object.entries(s).some(([n, o]) => n === "index" || n === "Actions" ? !1 : String(o ?? "").toLowerCase().includes(a)));
460
+ }, [S, R]), ha = async () => {
461
+ const a = k("query") || g;
462
+ a ? await v(a, _e) : u({ message: "No context query found to refresh", type: "warning" });
463
+ }, ya = async () => {
464
+ try {
465
+ y(ve), await v(ve);
466
+ } catch (a) {
467
+ console.error(a);
468
+ }
469
+ };
470
+ return me.isTecho && !Ce && !(d != null && d["view.manage.querymanagement.retrieve"]) ? /* @__PURE__ */ e(r, { className: "flex justify-center items-center w-full h-[80vh]", children: /* @__PURE__ */ t(F, { className: "p-8 max-w-md text-center shadow-2xl border border-gray-100 rounded-2xl bg-white", children: [
471
+ /* @__PURE__ */ e(x, { variant: "h5", color: "error", fontWeight: "700", letterSpacing: "-0.5px", children: "Access Denied" }),
472
+ /* @__PURE__ */ e(x, { variant: "body2", className: "text-gray-400 mt-2", children: "You don't have permission to view Query Management Tool" })
473
+ ] }) }) : /* @__PURE__ */ t(He, { loading: Ce, children: [
474
+ Ze && m && /* @__PURE__ */ e("div", { className: "loader-overlay", children: /* @__PURE__ */ e("div", { className: "loader-spinner" }) }),
475
+ /* @__PURE__ */ t(r, { className: "w-full flex flex-col gap-4 mt-2 p-3 min-h-[85vh] bg-[#fdfeff]", children: [
476
+ /* @__PURE__ */ t(F, { className: "px-4 py-2.5 shadow-sm border border-gray-200/70 rounded-xl bg-white flex flex-wrap items-center justify-between gap-4", children: [
477
+ /* @__PURE__ */ t(
478
+ ba,
479
+ {
480
+ value: P,
481
+ onChange: (a, s) => T(s),
482
+ indicatorColor: "primary",
483
+ textColor: "primary",
484
+ sx: {
485
+ "& .MuiTabs-indicator": { height: "3px", borderRadius: "3px" },
486
+ "& .MuiTab-root": { textTransform: "none", fontWeight: 600, fontSize: "14px", minHeight: "44px" }
487
+ },
488
+ children: [
489
+ /* @__PURE__ */ e(
490
+ ce,
491
+ {
492
+ label: /* @__PURE__ */ t(r, { className: "flex items-center gap-2", children: [
493
+ /* @__PURE__ */ e(l, { icon: Aa, className: "text-xs opacity-80" }),
494
+ /* @__PURE__ */ e("span", { children: i("Query Console") })
495
+ ] })
496
+ }
497
+ ),
498
+ /* @__PURE__ */ e(
499
+ ce,
500
+ {
501
+ label: /* @__PURE__ */ t(r, { className: "flex items-center gap-2", children: [
502
+ /* @__PURE__ */ e(l, { icon: Oe, className: "text-xs opacity-80" }),
503
+ /* @__PURE__ */ e("span", { children: i("Results Layer") }),
504
+ !!Y && /* @__PURE__ */ e(W, { label: Y, size: "small", color: "primary", sx: { height: 18, fontSize: "10px", fontWeight: "bold" } })
505
+ ] })
506
+ }
507
+ ),
508
+ /* @__PURE__ */ e(
509
+ ce,
510
+ {
511
+ label: /* @__PURE__ */ t(r, { className: "flex items-center gap-2", children: [
512
+ /* @__PURE__ */ e(l, { icon: xe, className: "text-xs text-indigo-500 opacity-90" }),
513
+ /* @__PURE__ */ e("span", { children: i("Query Plan") }),
514
+ K.length > 0 && /* @__PURE__ */ e(W, { label: "Ready", size: "small", color: "info", sx: { height: 18, fontSize: "9px", fontWeight: "bold" } })
515
+ ] })
516
+ }
517
+ )
518
+ ]
519
+ }
520
+ ),
521
+ /* @__PURE__ */ t(r, { className: "flex flex-wrap items-center gap-2.5", children: [
522
+ /* @__PURE__ */ t(p, { variant: "outlined", color: "inherit", size: "small", onClick: pa, className: "h-[36px] border-gray-300 hover:bg-gray-50 text-gray-700", sx: { textTransform: "none", borderRadius: "8px", fontWeight: 500 }, children: [
523
+ /* @__PURE__ */ e(l, { icon: ge, className: "mr-2 text-blue-500" }),
524
+ i("Tables Explorer")
525
+ ] }),
526
+ /* @__PURE__ */ t(p, { variant: "outlined", color: "inherit", size: "small", onClick: ua, className: "h-[36px] border-gray-300 hover:bg-gray-50 text-gray-700", sx: { textTransform: "none", borderRadius: "8px", fontWeight: 500 }, children: [
527
+ /* @__PURE__ */ e(l, { icon: ze, className: "mr-2 text-blue-500" }),
528
+ i("DBA Toolkit")
529
+ ] }),
530
+ /* @__PURE__ */ t(p, { variant: "outlined", color: "inherit", size: "small", onClick: () => U(!0), className: "h-[36px] border-gray-300 hover:bg-gray-50 text-gray-700", sx: { textTransform: "none", borderRadius: "8px", fontWeight: 500 }, children: [
531
+ /* @__PURE__ */ e(l, { icon: Le, className: "mr-2 text-purple-500" }),
532
+ i("Query History")
533
+ ] }),
534
+ /* @__PURE__ */ e(_a, { orientation: "vertical", flexItem: !0, className: "hidden md:block my-1" }),
535
+ /* @__PURE__ */ t(p, { size: "small", color: "secondary", onClick: la, className: "h-[34px] font-semibold text-xs text-gray-500", sx: { textTransform: "none" }, children: [
536
+ /* @__PURE__ */ e(l, { icon: Da, className: "mr-1 text-amber-500 text-[10px]" }),
537
+ " ",
538
+ i("Locked Queries")
539
+ ] }),
540
+ /* @__PURE__ */ t(p, { size: "small", color: "secondary", onClick: da, className: "h-[34px] font-semibold text-xs text-gray-500", sx: { textTransform: "none" }, children: [
541
+ /* @__PURE__ */ e(l, { icon: ze, className: "mr-1 text-teal-500 text-[10px]" }),
542
+ " ",
543
+ i("Active Queries")
544
+ ] }),
545
+ /* @__PURE__ */ t(p, { size: "small", color: "secondary", onClick: ya, className: "h-[34px] font-semibold text-xs text-gray-500", sx: { textTransform: "none" }, children: [
546
+ /* @__PURE__ */ e(l, { icon: Q, className: "mr-1 text-teal-500 text-[10px]" }),
547
+ " ",
548
+ i("Recent Exceptions")
549
+ ] })
550
+ ] })
551
+ ] }),
552
+ /* @__PURE__ */ t(r, { className: "flex-grow flex flex-col", children: [
553
+ P === 0 && /* @__PURE__ */ t(F, { className: "p-4 shadow-sm border border-gray-200 rounded-2xl bg-white flex flex-col gap-4 flex-grow min-h-[520px]", children: [
554
+ /* @__PURE__ */ e(r, { className: "flex-grow relative rounded-xl overflow-hidden border border-gray-200 shadow-inner bg-[#fffffe] h-[400px]", children: /* @__PURE__ */ e(
555
+ ka,
556
+ {
557
+ height: "100%",
558
+ defaultLanguage: "sql",
559
+ theme: "vs-light",
560
+ value: k("query") || "",
561
+ onChange: (a) => {
562
+ V("query", a || ""), M(!(a && a.trim().length > 0));
563
+ },
564
+ options: {
565
+ minimap: { enabled: !1 },
566
+ fontSize: 14,
567
+ fontFamily: "'Fira Code', 'Courier New', monospace",
568
+ lineNumbers: "on",
569
+ roundedSelection: !0,
570
+ scrollBeyondLastLine: !1,
571
+ readOnly: !1,
572
+ automaticLayout: !0,
573
+ tabSize: 2,
574
+ suggestOnTriggerCharacters: !0,
575
+ wordWrap: "on"
576
+ },
577
+ loading: /* @__PURE__ */ e("div", { className: "p-4 text-gray-400 font-mono text-xs", children: "Loading IDE Engine..." })
578
+ }
579
+ ) }),
580
+ /* @__PURE__ */ t(r, { className: "flex flex-wrap items-center justify-between gap-3 pt-3 border-t border-gray-100", children: [
581
+ /* @__PURE__ */ t(r, { className: "flex items-center gap-2 bg-gray-50/80 p-1.5 rounded-xl border border-gray-200/60", children: [
582
+ /* @__PURE__ */ e(
583
+ pe,
584
+ {
585
+ id: "excelFileName",
586
+ name: "excelFileName",
587
+ control: se,
588
+ placeholder: "Export sheet filename...",
589
+ size: "small",
590
+ className: "max-w-[220px] bg-white",
591
+ sx: { "& .MuiOutlinedInput-root": { borderRadius: "8px", height: "36px" } }
592
+ }
593
+ ),
594
+ /* @__PURE__ */ t(
595
+ p,
596
+ {
597
+ variant: "outlined",
598
+ color: "inherit",
599
+ onClick: Re,
600
+ className: "border-gray-300 text-gray-700 hover:bg-white",
601
+ sx: {
602
+ textTransform: "none",
603
+ borderRadius: "8px",
604
+ height: "36px",
605
+ minWidth: "max-content",
606
+ display: "inline-flex",
607
+ alignItems: "center",
608
+ justifyContent: "center",
609
+ px: 2,
610
+ py: 0,
611
+ fontSize: "0.875rem",
612
+ lineHeight: 1
613
+ },
614
+ children: [
615
+ /* @__PURE__ */ e(l, { icon: Ie, className: "mr-2 text-gray-400" }),
616
+ "Spreadsheet"
617
+ ]
618
+ }
619
+ )
620
+ ] }),
621
+ /* @__PURE__ */ t(r, { className: "flex gap-2.5", children: [
622
+ (!me.isTecho || (d == null ? void 0 : d["view.manage.querymanagement.execute"])) && /* @__PURE__ */ e(
623
+ p,
624
+ {
625
+ variant: "outlined",
626
+ color: "secondary",
627
+ disabled: te,
628
+ className: "h-[38px]",
629
+ sx: { textTransform: "none", borderRadius: "8px", fontWeight: 600 },
630
+ onClick: async () => {
631
+ const a = k("query");
632
+ y(a), a != null && a.toLowerCase().includes("where") ? await Te(a) : E(2);
633
+ },
634
+ children: i("Execute Command")
635
+ }
636
+ ),
637
+ /* @__PURE__ */ t(
638
+ p,
639
+ {
640
+ variant: "outlined",
641
+ disabled: te,
642
+ className: "h-[38px] border-indigo-200 text-indigo-600 hover:bg-indigo-50 disabled:border-gray-200 disabled:text-gray-400",
643
+ sx: { textTransform: "none", borderRadius: "8px", fontWeight: 600 },
644
+ onClick: oa,
645
+ children: [
646
+ /* @__PURE__ */ e(l, { icon: xe, className: "mr-2 text-xs" }),
647
+ i("Explain Plan")
648
+ ]
649
+ }
650
+ ),
651
+ (!me.isTecho || (d == null ? void 0 : d["view.manage.querymanagement.retrieve"])) && /* @__PURE__ */ t(
652
+ p,
653
+ {
654
+ variant: "contained",
655
+ color: "success",
656
+ disabled: te,
657
+ className: "h-[38px] shadow-sm shadow-green-200",
658
+ sx: { textTransform: "none", borderRadius: "8px", fontWeight: 600, px: 3 },
659
+ onClick: async () => {
660
+ const a = k("query");
661
+ y(a);
662
+ const s = (a == null ? void 0 : a.toLowerCase().trim()) || "";
663
+ if (/\b(drop|truncate|delete|update)\b/.test(s)) {
664
+ re(!0);
665
+ return;
666
+ }
667
+ const o = s.startsWith("select"), b = s.includes("where");
668
+ o && !b ? E(1) : await v(a);
669
+ },
670
+ children: [
671
+ /* @__PURE__ */ e(l, { icon: Oa, className: "mr-2 text-xs" }),
672
+ i("Retrieve Data")
673
+ ]
674
+ }
675
+ )
676
+ ] })
677
+ ] })
678
+ ] }),
679
+ P === 1 && /* @__PURE__ */ t(F, { className: "p-4 shadow-sm border border-gray-200 rounded-2xl bg-white flex flex-col flex-grow min-h-[520px]", children: [
680
+ /* @__PURE__ */ e(r, { className: "flex flex-wrap items-center justify-between border-b border-gray-100 pb-3 mb-3 gap-3", children: S.length > 0 && /* @__PURE__ */ t(r, { className: "flex flex-wrap items-center justify-between w-full gap-3", children: [
681
+ /* @__PURE__ */ t(r, { className: "flex items-center gap-3 w-full sm:w-auto", children: [
682
+ /* @__PURE__ */ e(
683
+ Ae,
684
+ {
685
+ size: "small",
686
+ variant: "outlined",
687
+ placeholder: "Filter layout results...",
688
+ value: R,
689
+ onChange: (a) => j(a.target.value),
690
+ sx: {
691
+ width: { xs: "100%", sm: "280px" },
692
+ "& .MuiOutlinedInput-root": { borderRadius: "10px", height: "36px", backgroundColor: "#fafbfe" }
693
+ },
694
+ InputProps: {
695
+ startAdornment: /* @__PURE__ */ e(de, { position: "start", children: /* @__PURE__ */ e(l, { icon: qe, className: "text-gray-400 text-xs" }) }),
696
+ endAdornment: R && /* @__PURE__ */ e(de, { position: "end", children: /* @__PURE__ */ e(G, { size: "small", onClick: () => j(""), edge: "end", children: /* @__PURE__ */ e(l, { icon: Q, className: "text-[10px]" }) }) })
697
+ }
698
+ }
699
+ ),
700
+ /* @__PURE__ */ e(
701
+ W,
702
+ {
703
+ label: R ? `${i("Matches")}: ${le.length} / ${Y}` : `${i("Records Loaded")}: ${Y}`,
704
+ size: "medium",
705
+ color: R ? "primary" : "success",
706
+ variant: R ? "outlined" : "filled",
707
+ sx: { borderRadius: "8px", fontWeight: "600", fontSize: "12px", height: "34px" }
708
+ }
709
+ ),
710
+ Ne && /* @__PURE__ */ e(
711
+ W,
712
+ {
713
+ icon: /* @__PURE__ */ e(l, { icon: za, style: { fontSize: "11px", color: "#475569" } }),
714
+ label: `${Ne} ms`,
715
+ variant: "outlined",
716
+ sx: {
717
+ borderRadius: "8px",
718
+ fontWeight: "500",
719
+ fontSize: "12px",
720
+ height: "34px",
721
+ backgroundColor: "#f1f5f9",
722
+ borderColor: "#e2e8f0"
723
+ }
724
+ }
725
+ )
726
+ ] }),
727
+ /* @__PURE__ */ t(r, { className: "flex flex-wrap items-center gap-2.5 ml-auto", children: [
728
+ /* @__PURE__ */ t(
729
+ p,
730
+ {
731
+ variant: "outlined",
732
+ color: "inherit",
733
+ size: "small",
734
+ onClick: ha,
735
+ className: "h-[36px] border-gray-300 hover:bg-gray-50 text-gray-700",
736
+ sx: { textTransform: "none", borderRadius: "8px", fontWeight: 500 },
737
+ children: [
738
+ /* @__PURE__ */ e(l, { icon: La, className: "mr-2 text-teal-600" }),
739
+ i("Refresh")
740
+ ]
741
+ }
742
+ ),
743
+ /* @__PURE__ */ t(r, { className: "flex items-center gap-2 bg-gray-50/80 p-1.5 rounded-xl border border-gray-200/60", children: [
744
+ /* @__PURE__ */ e(
745
+ pe,
746
+ {
747
+ id: "excelFileName",
748
+ name: "excelFileName",
749
+ control: se,
750
+ placeholder: "Export sheet filename...",
751
+ size: "small",
752
+ className: "max-w-[220px] bg-white",
753
+ sx: { "& .MuiOutlinedInput-root": { borderRadius: "8px", height: "36px" } }
754
+ }
755
+ ),
756
+ /* @__PURE__ */ t(
757
+ p,
758
+ {
759
+ variant: "outlined",
760
+ color: "inherit",
761
+ onClick: Re,
762
+ className: "border-gray-300 text-gray-700 hover:bg-white",
763
+ sx: {
764
+ textTransform: "none",
765
+ borderRadius: "8px",
766
+ height: "36px",
767
+ minWidth: "max-content",
768
+ display: "inline-flex",
769
+ alignItems: "center",
770
+ justifyContent: "center",
771
+ px: 2,
772
+ py: 0,
773
+ fontSize: "0.875rem",
774
+ lineHeight: 1
775
+ },
776
+ children: [
777
+ /* @__PURE__ */ e(l, { icon: Ie, className: "mr-2 text-blue-600" }),
778
+ i("Spreadsheet")
779
+ ]
780
+ }
781
+ )
782
+ ] })
783
+ ] })
784
+ ] }) }),
785
+ le.length ? /* @__PURE__ */ e(r, { className: "w-full overflow-x-auto flex-grow border border-gray-150 rounded-xl", children: /* @__PURE__ */ e(
786
+ ue,
787
+ {
788
+ className: "min-w-[600px]",
789
+ columns: I,
790
+ actions: _e,
791
+ tableData: le,
792
+ paginationConfig: Wa,
793
+ styleConfig: Ha
794
+ }
795
+ ) }) : /* @__PURE__ */ t(r, { className: "flex flex-col items-center justify-center flex-grow py-24 text-gray-400 bg-gray-50/50 rounded-xl border border-dashed border-gray-200", children: [
796
+ /* @__PURE__ */ e(l, { icon: Oe, size: "2x", className: "mb-3 text-gray-300" }),
797
+ /* @__PURE__ */ e(x, { variant: "body2", fontWeight: "600", className: "text-gray-600", children: S.length > 0 ? "No Matching Metadata Fields" : "No Active Dataset Displayed" }),
798
+ /* @__PURE__ */ e(x, { variant: "caption", className: "mt-1 text-gray-400 max-w-xs text-center", children: S.length > 0 ? "The criteria keywords queried didn't flag hits inside the running table frame matrix." : "Head backwards into the query console and fire data queries to populate results layer." }),
799
+ /* @__PURE__ */ e(
800
+ p,
801
+ {
802
+ variant: "outlined",
803
+ size: "small",
804
+ color: "inherit",
805
+ onClick: () => {
806
+ S.length > 0 ? j("") : T(0);
807
+ },
808
+ className: "mt-4 border-gray-300 text-gray-600 bg-white",
809
+ sx: { textTransform: "none", borderRadius: "8px", fontSize: "12px" },
810
+ children: S.length > 0 ? "Reset Matrix Filter" : "Go to Query Workspace"
811
+ }
812
+ )
813
+ ] })
814
+ ] }),
815
+ P === 2 && /* @__PURE__ */ e(F, { className: "p-5 shadow-sm border border-gray-200 rounded-2xl bg-white flex flex-col flex-grow min-h-[520px]", children: K.length > 0 ? /* @__PURE__ */ t(r, { className: "flex flex-col flex-grow w-full", children: [
816
+ /* @__PURE__ */ e(x, { variant: "subtitle2", className: "text-gray-500 font-bold mb-3 uppercase tracking-wider text-xs", children: "Plan Graph Node Sequence: (Root Bottleneck Impact Assessment):" }),
817
+ /* @__PURE__ */ e(r, { className: "flex-grow w-full overflow-y-auto bg-slate-50/50 border border-gray-200/80 rounded-xl p-4 max-h-[60vh]", children: (() => {
818
+ const a = Be(K[0]);
819
+ return K.map((s, n) => /* @__PURE__ */ e(
820
+ Ba,
821
+ {
822
+ rawTextLine: s,
823
+ totalPlanMetric: a
824
+ },
825
+ n
826
+ ));
827
+ })() })
828
+ ] }) : /* @__PURE__ */ t(r, { className: "flex flex-col items-center justify-center flex-grow py-24 text-gray-400 bg-gray-50/30 rounded-xl border border-dashed border-gray-200", children: [
829
+ /* @__PURE__ */ e(l, { icon: xe, size: "2x", className: "mb-3 text-indigo-300" }),
830
+ /* @__PURE__ */ e(x, { variant: "body2", fontWeight: "600", className: "text-gray-600", children: "No Query Plan Loaded" }),
831
+ /* @__PURE__ */ e(x, { variant: "caption", className: "mt-1 text-gray-400 max-w-xs text-center", children: "Type a query inside the editor and select 'Explain Plan' to compile the database execution steps." }),
832
+ /* @__PURE__ */ e(
833
+ p,
834
+ {
835
+ variant: "outlined",
836
+ size: "small",
837
+ color: "primary",
838
+ onClick: () => T(0),
839
+ className: "mt-4",
840
+ sx: { textTransform: "none", borderRadius: "8px" },
841
+ children: "Go to Query Console"
842
+ }
843
+ )
844
+ ] }) })
845
+ ] })
846
+ ] }),
847
+ /* @__PURE__ */ e(X, { open: $e, onClose: () => $(!1), children: /* @__PURE__ */ t(r, { sx: fe, className: "flex flex-col gap-4 max-h-[85vh]", children: [
848
+ /* @__PURE__ */ t(r, { className: "flex items-center justify-between border-b border-gray-100 pb-3", children: [
849
+ /* @__PURE__ */ t(x, { variant: "h6", fontWeight: "700", className: "flex items-center gap-2.5 text-gray-800", letterSpacing: "-0.4px", children: [
850
+ /* @__PURE__ */ e(l, { icon: ge, className: "text-blue-500 text-lg" }),
851
+ " ",
852
+ i("Tables Explorer")
853
+ ] }),
854
+ /* @__PURE__ */ e(G, { onClick: () => $(!1), size: "small", className: "hover:bg-gray-100", children: /* @__PURE__ */ e(l, { icon: Q, className: "text-sm text-gray-400" }) })
855
+ ] }),
856
+ /* @__PURE__ */ e(
857
+ Ae,
858
+ {
859
+ fullWidth: !0,
860
+ onChange: ga,
861
+ size: "small",
862
+ placeholder: "Type matching schema name indexes...",
863
+ sx: { "& .MuiOutlinedInput-root": { borderRadius: "10px", backgroundColor: "#fdfeff" } },
864
+ InputProps: {
865
+ startAdornment: /* @__PURE__ */ e(de, { position: "start", children: /* @__PURE__ */ e(l, { icon: qe, className: "text-gray-400 text-xs" }) })
866
+ }
867
+ }
868
+ ),
869
+ /* @__PURE__ */ e(r, { className: "overflow-y-auto flex-grow border border-gray-100 rounded-xl", children: /* @__PURE__ */ e(
870
+ ue,
871
+ {
872
+ strip: !0,
873
+ isLoading: ea,
874
+ columns: na,
875
+ tableData: Ke,
876
+ paginationConfig: Fe,
877
+ styleConfig: Qe
878
+ }
879
+ ) })
880
+ ] }) }),
881
+ /* @__PURE__ */ e(X, { open: Ue, onClose: () => U(!1), children: /* @__PURE__ */ t(r, { sx: fe, className: "flex flex-col gap-4 max-h-[85vh]", children: [
882
+ /* @__PURE__ */ t(r, { className: "flex items-center justify-between border-b border-gray-100 pb-3", children: [
883
+ /* @__PURE__ */ t(x, { variant: "h6", fontWeight: "700", className: "flex items-center gap-2.5 text-gray-800", letterSpacing: "-0.4px", children: [
884
+ /* @__PURE__ */ e(l, { icon: Le, className: "text-purple-500 text-lg" }),
885
+ " ",
886
+ i("Query History")
887
+ ] }),
888
+ /* @__PURE__ */ e(G, { onClick: () => U(!1), size: "small", className: "hover:bg-gray-100", children: /* @__PURE__ */ e(l, { icon: Q, className: "text-sm text-gray-400" }) })
889
+ ] }),
890
+ /* @__PURE__ */ t(r, { className: "flex gap-2.5", children: [
891
+ /* @__PURE__ */ e(
892
+ pe,
893
+ {
894
+ id: "queryHistorySearchKey",
895
+ name: "queryHistorySearchKey",
896
+ control: se,
897
+ placeholder: "Search previous queries...",
898
+ size: "small",
899
+ className: "flex-grow",
900
+ sx: { "& .MuiOutlinedInput-root": { borderRadius: "10px" } }
901
+ }
902
+ ),
903
+ /* @__PURE__ */ e(p, { variant: "contained", color: "primary", onClick: oe, sx: { borderRadius: "10px", px: 3, textTransform: "none" }, children: i("Search") })
904
+ ] }),
905
+ /* @__PURE__ */ e(r, { className: "overflow-y-auto flex-grow border border-gray-150 rounded-xl", children: /* @__PURE__ */ e(
906
+ ue,
907
+ {
908
+ strip: !0,
909
+ columns: sa,
910
+ tableData: Je,
911
+ paginationConfig: Fe,
912
+ styleConfig: Qe
913
+ }
914
+ ) })
915
+ ] }) }),
916
+ /* @__PURE__ */ e(X, { open: aa, onClose: () => J(!1), children: /* @__PURE__ */ t(r, { sx: fe, className: "flex flex-col gap-4 max-h-[85vh]", children: [
917
+ /* @__PURE__ */ t(r, { className: "flex items-center justify-between border-b border-gray-100 pb-3", children: [
918
+ /* @__PURE__ */ t(x, { variant: "h6", fontWeight: "700", className: "flex items-center gap-2.5 text-gray-800", letterSpacing: "-0.4px", children: [
919
+ /* @__PURE__ */ e(l, { icon: ge, className: "text-purple-500 text-lg" }),
920
+ i("DBA Toolkit")
921
+ ] }),
922
+ /* @__PURE__ */ e(G, { onClick: () => J(!1), size: "small", className: "hover:bg-gray-100", children: /* @__PURE__ */ e(l, { icon: Q, className: "text-sm text-gray-400" }) })
923
+ ] }),
924
+ /* @__PURE__ */ e(r, { className: "overflow-y-auto flex-grow bg-slate-50/50 p-3 rounded-xl border border-gray-100 flex flex-col gap-5", children: ["Performance & Space", "Index Health", "Maintenance"].map((a) => {
925
+ const s = Qa.filter((n) => n.category === a);
926
+ return s.length === 0 ? null : /* @__PURE__ */ t(r, { className: "flex flex-col gap-2", children: [
927
+ /* @__PURE__ */ e(x, { variant: "caption", className: "text-slate-400 font-bold uppercase tracking-wider pl-1 text-[11px]", children: a }),
928
+ /* @__PURE__ */ e(r, { className: "grid grid-cols-1 md:grid-cols-2 gap-3", children: s.map((n, o) => /* @__PURE__ */ t(
929
+ r,
930
+ {
931
+ onClick: () => {
932
+ V("query", n.code), M(!1), J(!1), T(0), u({ message: `Injected script: ${n.name}`, type: "success" });
933
+ },
934
+ className: "p-4 bg-white hover:bg-purple-50/30 border border-slate-200 hover:border-purple-300 rounded-xl cursor-pointer transition-all shadow-sm group flex flex-col justify-between",
935
+ children: [
936
+ /* @__PURE__ */ t(r, { children: [
937
+ /* @__PURE__ */ e(x, { variant: "body2", className: "font-bold text-slate-800 group-hover:text-purple-700 transition-colors", children: n.name }),
938
+ /* @__PURE__ */ e(x, { variant: "caption", className: "text-slate-500 block mt-1 leading-normal", children: n.description })
939
+ ] }),
940
+ /* @__PURE__ */ t(r, { className: "mt-3 pt-2 border-t border-slate-100 flex items-center justify-between text-xs text-purple-600 font-medium opacity-80 group-hover:opacity-100", children: [
941
+ /* @__PURE__ */ e("span", { children: "Load Into Editor" }),
942
+ /* @__PURE__ */ e("span", { className: "font-mono text-[10px] bg-purple-100 px-1.5 py-0.5 rounded text-purple-700", children: "SQL" })
943
+ ] })
944
+ ]
945
+ },
946
+ o
947
+ )) })
948
+ ] }, a);
949
+ }) })
950
+ ] }) }),
951
+ /* @__PURE__ */ e(
952
+ X,
953
+ {
954
+ open: ta,
955
+ onClose: () => re(!1),
956
+ sx: { display: "flex", alignItems: "center", justifyContent: "center" },
957
+ children: /* @__PURE__ */ t(
958
+ r,
959
+ {
960
+ sx: {
961
+ bgcolor: "background.paper",
962
+ boxShadow: 24,
963
+ p: 4,
964
+ borderRadius: "16px",
965
+ textAlign: "center",
966
+ maxWidth: "500px",
967
+ outline: "none"
968
+ },
969
+ children: [
970
+ /* @__PURE__ */ e(x, { variant: "h5", color: "error", fontWeight: "700", sx: { mb: 2 }, children: "🛑 ACCESS DENIED!" }),
971
+ /* @__PURE__ */ e(
972
+ "img",
973
+ {
974
+ src: qa,
975
+ alt: "baburao",
976
+ style: { width: "100%", borderRadius: "8px", marginBottom: "16px" }
977
+ }
978
+ ),
979
+ /* @__PURE__ */ e(x, { variant: "body2", className: "text-gray-600 mb-4", children: "Nice try! Attempting to commit such acts from a data retrieval screen is strictly forbidden by the DBA overlords." }),
980
+ /* @__PURE__ */ e(
981
+ p,
982
+ {
983
+ variant: "contained",
984
+ color: "error",
985
+ onClick: () => re(!1),
986
+ sx: { borderRadius: "8px", textTransform: "none" },
987
+ children: "I promise to behave"
988
+ }
989
+ )
990
+ ]
991
+ }
992
+ )
993
+ }
994
+ ),
995
+ !!C && /* @__PURE__ */ e(
996
+ Ea,
997
+ {
998
+ description: C === 3 ? `Are you sure you want to kill process id ${L}?` : "The query does not include a WHERE clause. Are you sure you want to proceed?",
999
+ title: "CONFIRM ACTION",
1000
+ open: C,
1001
+ handleClick: async () => {
1002
+ C === 1 && v(g), C === 2 && Te(g), C === 3 && ca(), E(0);
1003
+ },
1004
+ handleClose: () => E(0)
1005
+ }
1006
+ )
1007
+ ] });
1008
+ };
1009
+ export {
1010
+ ut as default
1011
+ };
1012
+ //# sourceMappingURL=QueryManagement-DGHV_-d5.js.map