quidproquo-web-admin 0.0.252 → 0.0.254

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 (43) hide show
  1. package/lib/commonjs/LogViewer/AdminLogs/AdminLogSearchBar/AdminLogSearchBar.d.ts +1 -4
  2. package/lib/commonjs/LogViewer/AdminLogs/AdminLogSearchBar/AdminLogSearchBar.js +10 -30
  3. package/lib/commonjs/LogViewer/AdminLogs/AdminLogs.js +2 -2
  4. package/lib/commonjs/LogViewer/AdminLogs/hooks/useLogLogSearch/useLogLogSearch.d.ts +1 -5
  5. package/lib/commonjs/LogViewer/AdminLogs/hooks/useLogLogSearch/useLogLogSearch.js +9 -17
  6. package/lib/commonjs/LogViewer/LogSearch.js +2 -2
  7. package/lib/commonjs/LogViewer/LogSummaryDetails.js +3 -1
  8. package/lib/commonjs/LogViewer/LogViewer.js +4 -7
  9. package/lib/commonjs/LogViewer/TopSection.d.ts +1 -4
  10. package/lib/commonjs/LogViewer/TopSection.js +13 -42
  11. package/lib/commonjs/LogViewer/hooks/useLogManagement.d.ts +2 -5
  12. package/lib/commonjs/LogViewer/hooks/useLogManagement.js +20 -39
  13. package/lib/commonjs/LogViewer/hooks/useLogSearch.d.ts +1 -5
  14. package/lib/commonjs/LogViewer/hooks/useLogSearch.js +13 -21
  15. package/lib/commonjs/LogViewer/hooks/useServiceNames.d.ts +1 -2
  16. package/lib/commonjs/queryParams/index.d.ts +2 -0
  17. package/lib/commonjs/queryParams/index.js +18 -0
  18. package/lib/commonjs/queryParams/searchQueryParams.d.ts +14 -0
  19. package/lib/commonjs/queryParams/searchQueryParams.js +26 -0
  20. package/lib/commonjs/queryParams/useUrlFields.d.ts +33 -0
  21. package/lib/commonjs/queryParams/useUrlFields.js +86 -0
  22. package/lib/esm/LogViewer/AdminLogs/AdminLogSearchBar/AdminLogSearchBar.d.ts +1 -4
  23. package/lib/esm/LogViewer/AdminLogs/AdminLogSearchBar/AdminLogSearchBar.js +10 -46
  24. package/lib/esm/LogViewer/AdminLogs/AdminLogs.js +2 -2
  25. package/lib/esm/LogViewer/AdminLogs/hooks/useLogLogSearch/useLogLogSearch.d.ts +1 -5
  26. package/lib/esm/LogViewer/AdminLogs/hooks/useLogLogSearch/useLogLogSearch.js +9 -17
  27. package/lib/esm/LogViewer/LogSearch.js +2 -2
  28. package/lib/esm/LogViewer/LogSummaryDetails.js +3 -1
  29. package/lib/esm/LogViewer/LogViewer.js +4 -7
  30. package/lib/esm/LogViewer/TopSection.d.ts +1 -4
  31. package/lib/esm/LogViewer/TopSection.js +13 -64
  32. package/lib/esm/LogViewer/hooks/useLogManagement.d.ts +2 -5
  33. package/lib/esm/LogViewer/hooks/useLogManagement.js +20 -39
  34. package/lib/esm/LogViewer/hooks/useLogSearch.d.ts +1 -5
  35. package/lib/esm/LogViewer/hooks/useLogSearch.js +13 -21
  36. package/lib/esm/LogViewer/hooks/useServiceNames.d.ts +1 -2
  37. package/lib/esm/queryParams/index.d.ts +2 -0
  38. package/lib/esm/queryParams/index.js +2 -0
  39. package/lib/esm/queryParams/searchQueryParams.d.ts +14 -0
  40. package/lib/esm/queryParams/searchQueryParams.js +21 -0
  41. package/lib/esm/queryParams/useUrlFields.d.ts +33 -0
  42. package/lib/esm/queryParams/useUrlFields.js +82 -0
  43. package/package.json +6 -6
@@ -1,7 +1,4 @@
1
- import { LogLogSearchParams } from '../hooks/types';
2
1
  export interface AdminLogSearchBarProps {
3
- searchParams: LogLogSearchParams;
4
- setLogLogSearchParams: (setter: (searchParams: LogLogSearchParams) => LogLogSearchParams) => void;
5
2
  onSearch: () => Promise<any>;
6
3
  }
7
- export declare function AdminLogSearchBar({ searchParams, setLogLogSearchParams, onSearch }: AdminLogSearchBarProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function AdminLogSearchBar({ onSearch }: AdminLogSearchBarProps): import("react/jsx-runtime").JSX.Element;
@@ -19,50 +19,30 @@ const system_1 = require("@mui/system");
19
19
  const x_date_pickers_1 = require("@mui/x-date-pickers");
20
20
  const AdapterDateFns_1 = require("@mui/x-date-pickers/AdapterDateFns");
21
21
  const components_1 = require("../../../components");
22
+ const queryParams_1 = require("../../../queryParams");
22
23
  const hooks_1 = require("../../hooks");
23
- function AdminLogSearchBar({ searchParams, setLogLogSearchParams, onSearch }) {
24
- const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
24
+ function AdminLogSearchBar({ onSearch }) {
25
25
  const serviceOptions = (0, hooks_1.useServiceNames)();
26
- const handleRuntimeTypeChange = (event) => {
27
- setLogLogSearchParams((prevLogLogSearchParams) => (Object.assign(Object.assign({}, prevLogLogSearchParams), { logLevelLookup: event.target.value })));
28
- };
29
- const handleStartDateChange = (value) => {
30
- if (value) {
31
- setLogLogSearchParams((prevLogLogSearchParams) => (Object.assign(Object.assign({}, prevLogLogSearchParams), { startIsoDateTime: value.toISOString() })));
32
- }
33
- };
34
- const handleEndDateChange = (value) => {
35
- if (value) {
36
- setLogLogSearchParams((prevLogLogSearchParams) => (Object.assign(Object.assign({}, prevLogLogSearchParams), { endIsoDateTime: value.toISOString() })));
37
- }
38
- };
39
- const handleReasonFilterChange = (event) => {
40
- setLogLogSearchParams((prev) => (Object.assign(Object.assign({}, prev), { reasonFilter: event.target.value })));
41
- };
42
- const handleQuickTimeSelect = (minutes) => {
43
- const now = new Date();
44
- const startDate = new Date(now.getTime() - minutes * 60000);
45
- const endDate = new Date(now.getTime() + 7 * 24 * 60 * 60000);
46
- setLogLogSearchParams((prevLogLogSearchParams) => (Object.assign(Object.assign({}, prevLogLogSearchParams), { startIsoDateTime: startDate.toISOString(), endIsoDateTime: endDate.toISOString() })));
47
- setAnchorEl(null);
48
- };
26
+ const { service, handleServiceOnChange, startDate, handleStartDateChange, endDate, handleEndDateChange, msg, handleMsgOnChange, updateStartAndEndTimeSpan, logLevel, handleLogLevelOnChange, } = (0, queryParams_1.useUrlFields)();
27
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
49
28
  const handleQuickTimeClick = (event) => {
50
29
  setAnchorEl(event.currentTarget);
51
30
  };
52
31
  const handleQuickTimeClose = () => {
53
32
  setAnchorEl(null);
54
33
  };
55
- const handleServiceChange = (event, value) => {
56
- setLogLogSearchParams((prevLogLogSearchParams) => (Object.assign(Object.assign({}, prevLogLogSearchParams), { serviceFilter: value ? value.value : '' })));
34
+ const handleQuickTimeSelect = (minutes) => {
35
+ updateStartAndEndTimeSpan(minutes);
36
+ handleQuickTimeClose();
57
37
  };
58
- return ((0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns }, { children: [(0, jsx_runtime_1.jsxs)(Grid_1.default, Object.assign({ container: true, columns: 12, spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsxs)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, Object.assign({ id: "runtime-select-label" }, { children: "Runtime Type" })), (0, jsx_runtime_1.jsx)(Select_1.default, Object.assign({ labelId: "runtime-select-label", id: "demo-simple-select", value: searchParams.logLevelLookup, label: "Log Level", onChange: handleRuntimeTypeChange }, { children: quidproquo_core_1.logLevelEnumLookups.map((key) => ((0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ value: key }, { children: key }), key))) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { options: serviceOptions, getOptionLabel: (option) => option.label, onChange: handleServiceChange, renderInput: (params) => ((0, jsx_runtime_1.jsx)(TextField_1.default, Object.assign({}, params, { label: "Service Name", InputLabelProps: {
38
+ return ((0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns }, { children: [(0, jsx_runtime_1.jsxs)(Grid_1.default, Object.assign({ container: true, columns: 12, spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsxs)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, Object.assign({ id: "runtime-select-label" }, { children: "Log Level" })), (0, jsx_runtime_1.jsx)(Select_1.default, Object.assign({ labelId: "runtime-select-label", id: "demo-simple-select", value: logLevel, label: "Log Level", onChange: handleLogLevelOnChange }, { children: quidproquo_core_1.logLevelEnumLookups.map((key) => ((0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ value: key }, { children: key }), key))) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { getOptionLabel: (option) => option.label, options: serviceOptions, value: serviceOptions.find((o) => o.value === service) || null, onChange: handleServiceOnChange, renderInput: (params) => ((0, jsx_runtime_1.jsx)(TextField_1.default, Object.assign({}, params, { label: "Service Name", InputLabelProps: {
59
39
  shrink: true,
60
- } }))) }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsxs)(system_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "Start DateTime", value: new Date(searchParams.startIsoDateTime), onChange: handleStartDateChange }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ "aria-label": "quick time select", "aria-controls": "quick-time-menu", "aria-haspopup": "true", onClick: handleQuickTimeClick, sx: {
40
+ } }))) }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsxs)(system_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "Start DateTime", value: startDate, onChange: handleStartDateChange }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ "aria-label": "quick time select", "aria-controls": "quick-time-menu", "aria-haspopup": "true", onClick: handleQuickTimeClick, sx: {
61
41
  position: 'absolute',
62
42
  right: '-28px',
63
43
  top: '50%',
64
44
  transform: 'translateY(-50%)',
65
- } }, { children: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "End DateTime", value: new Date(searchParams.endIsoDateTime), onChange: handleEndDateChange }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 10 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Message", value: searchParams.reasonFilter, onChange: handleReasonFilterChange, InputLabelProps: {
45
+ } }, { children: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 3 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "End DateTime", value: endDate, onChange: handleEndDateChange }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 10 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Message", value: msg, onChange: handleMsgOnChange, InputLabelProps: {
66
46
  shrink: true,
67
47
  } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(components_1.AsyncButton, Object.assign({ onClick: () => onSearch() }, { children: "Search" })) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Menu, Object.assign({ id: "quick-time-menu", anchorEl: anchorEl, keepMounted: true, open: Boolean(anchorEl), onClose: handleQuickTimeClose }, { children: [(0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(5) }, { children: "Last 5 minutes" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(30) }, { children: "Last 30 minutes" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(1 * 60) }, { children: "Last hour" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(3 * 60) }, { children: "Last 3 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(8 * 60) }, { children: "Last 8 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(16 * 60) }, { children: "Last 16 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(24 * 60) }, { children: "Last 24 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(7 * 24 * 60) }, { children: "Last 7 days" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(30 * 24 * 60) }, { children: "Last month" }))] }))] })));
68
48
  }
@@ -8,8 +8,8 @@ const AdminLogGrid_1 = require("./AdminLogGrid");
8
8
  const AdminLogSearchBar_1 = require("./AdminLogSearchBar");
9
9
  const hooks_1 = require("./hooks");
10
10
  const AdminLogs = () => {
11
- const { logLogs, searchParams, setSearchParams, searchProgress, onSearch } = (0, hooks_1.useLogLogSearch)();
11
+ const { logLogs, searchProgress, onSearch } = (0, hooks_1.useLogLogSearch)();
12
12
  const isLoading = (0, view_1.useIsLoading)();
13
- return ((0, jsx_runtime_1.jsx)(components_1.TabViewBox, { header: () => (0, jsx_runtime_1.jsx)(AdminLogSearchBar_1.AdminLogSearchBar, { onSearch: onSearch, searchParams: searchParams, setLogLogSearchParams: setSearchParams }), body: () => (0, jsx_runtime_1.jsx)(AdminLogGrid_1.AdminLogGrid, { logs: logLogs, isLoading: isLoading, searchProgress: searchProgress }) }));
13
+ return ((0, jsx_runtime_1.jsx)(components_1.TabViewBox, { header: () => (0, jsx_runtime_1.jsx)(AdminLogSearchBar_1.AdminLogSearchBar, { onSearch: onSearch }), body: () => (0, jsx_runtime_1.jsx)(AdminLogGrid_1.AdminLogGrid, { logs: logLogs, isLoading: isLoading, searchProgress: searchProgress }) }));
14
14
  };
15
15
  exports.AdminLogs = AdminLogs;
@@ -1,10 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { LogLog } from 'quidproquo-webserver';
3
- import { LogLogSearchParams } from '../types';
4
2
  export declare const useLogLogSearch: () => {
5
3
  logLogs: LogLog[];
6
- searchParams: LogLogSearchParams;
7
- setSearchParams: import("react").Dispatch<import("react").SetStateAction<LogLogSearchParams>>;
8
4
  searchProgress: number;
9
- onSearch: (newSearchParams?: LogLogSearchParams | undefined) => Promise<any[]>;
5
+ onSearch: (newSearchParams?: import("../types").LogLogSearchParams | undefined) => Promise<any[]>;
10
6
  };
@@ -2,28 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogLogSearch = void 0;
4
4
  const react_1 = require("react");
5
+ const queryParams_1 = require("../../../../queryParams");
5
6
  const useLogLogSearchRequest_1 = require("../useLogLogSearchRequest/useLogLogSearchRequest");
6
7
  const useLogLogSearch = () => {
7
8
  const [logLogs, setLogLogs] = (0, react_1.useState)([]);
8
- const [searchParamsState, setSearchParamsState] = (0, react_1.useState)(() => {
9
- const currentDate = new Date();
10
- const threeHoursAgo = new Date(currentDate.getTime() - 3 * 60 * 60 * 1000);
11
- const isoDateThreeHoursAgo = threeHoursAgo.toISOString();
12
- const tomorrow = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000);
13
- const isoDateTomorrow = tomorrow.toISOString();
14
- return {
15
- logLevelLookup: 'All',
16
- startIsoDateTime: isoDateThreeHoursAgo,
17
- endIsoDateTime: isoDateTomorrow,
18
- reasonFilter: '',
19
- serviceFilter: '',
20
- };
21
- });
22
- const [searchProgress, onSearch] = (0, useLogLogSearchRequest_1.useLogLogSearchRequest)(searchParamsState, setLogLogs);
9
+ const { service, startDate, endDate, msg, logLevel } = (0, queryParams_1.useUrlFields)();
10
+ const [searchProgress, onSearch] = (0, useLogLogSearchRequest_1.useLogLogSearchRequest)({
11
+ logLevelLookup: logLevel,
12
+ startIsoDateTime: startDate.toISOString(),
13
+ endIsoDateTime: endDate.toISOString(),
14
+ reasonFilter: msg,
15
+ serviceFilter: service,
16
+ }, setLogLogs);
23
17
  return {
24
18
  logLogs,
25
- searchParams: searchParamsState,
26
- setSearchParams: setSearchParamsState,
27
19
  searchProgress,
28
20
  onSearch,
29
21
  };
@@ -8,8 +8,8 @@ const hooks_1 = require("./hooks");
8
8
  const LogMetadataGrid_1 = require("./LogMetadataGrid");
9
9
  const TopSection_1 = require("./TopSection");
10
10
  const LogSearch = () => {
11
- const { searchParams, setSearchParams, onSearch, logs } = (0, hooks_1.useLogSearch)();
11
+ const { onSearch, logs } = (0, hooks_1.useLogSearch)();
12
12
  const isLoading = (0, view_1.useIsLoading)();
13
- return ((0, jsx_runtime_1.jsx)(components_1.TabViewBox, { header: () => (0, jsx_runtime_1.jsx)(TopSection_1.TopSection, { searchParams: searchParams, setSearchParams: setSearchParams, onSearch: onSearch }), body: () => (0, jsx_runtime_1.jsx)(LogMetadataGrid_1.LogMetadataGrid, { logs: logs, isLoading: isLoading }) }));
13
+ return (0, jsx_runtime_1.jsx)(components_1.TabViewBox, { header: () => (0, jsx_runtime_1.jsx)(TopSection_1.TopSection, { onSearch: onSearch }), body: () => (0, jsx_runtime_1.jsx)(LogMetadataGrid_1.LogMetadataGrid, { logs: logs, isLoading: isLoading }) });
14
14
  };
15
15
  exports.LogSearch = LogSearch;
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogSummaryDetails = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const quidproquo_core_1 = require("quidproquo-core");
5
6
  const material_1 = require("@mui/material");
6
7
  const AnyVariableView_1 = require("./actionComponents/genericActionRenderer/AnyVariableView");
7
8
  const LogSummaryDetails = ({ log }) => {
8
9
  const totalRuntime = new Date(log.finishedAt).getTime() - new Date(log.startedAt).getTime();
9
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ variant: "h5", gutterBottom: true }, { children: [log.runtimeType, " - ", log.moduleName] })) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("pre", Object.assign({ style: AnyVariableView_1.genericFunctionRendererStyles.pre }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ style: AnyVariableView_1.genericFunctionRendererStyles.commentBlock }, { children: [(0, jsx_runtime_1.jsx)("div", { children: "// //////////////////////////////////////////////////////" }), (0, jsx_runtime_1.jsxs)("div", { children: ["// src: ", log.tags.join(', ')] }), log.fromCorrelation && (0, jsx_runtime_1.jsxs)("div", { children: ["// Caller: ", log.fromCorrelation] }), (0, jsx_runtime_1.jsxs)("div", { children: ["// Total Runtime: ", (0, jsx_runtime_1.jsxs)("span", Object.assign({ style: AnyVariableView_1.genericFunctionRendererStyles.highlightComment }, { children: [totalRuntime, " ms"] }))] }), (0, jsx_runtime_1.jsx)("div", { children: "// //////////////////////////////////////////////////////" })] })), (0, jsx_runtime_1.jsx)(AnyVariableView_1.GenericFunctionRenderer, { functionName: log.tags.join('::').split('::').pop() || 'unknown', args: log.input, expanded: true })] })) })] }));
10
+ const functionKey = log.qpqFunctionRuntimeInfo ? (0, quidproquo_core_1.getUniqueKeyFromQpqFunctionRuntime)(log.qpqFunctionRuntimeInfo) : 'unknownMahLord';
11
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ variant: "h5", gutterBottom: true }, { children: [log.runtimeType, " - ", log.moduleName] })) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("pre", Object.assign({ style: AnyVariableView_1.genericFunctionRendererStyles.pre }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ style: AnyVariableView_1.genericFunctionRendererStyles.commentBlock }, { children: [(0, jsx_runtime_1.jsx)("div", { children: "// //////////////////////////////////////////////////////" }), (0, jsx_runtime_1.jsxs)("div", { children: ["// src: ", functionKey] }), log.fromCorrelation && (0, jsx_runtime_1.jsxs)("div", { children: ["// Caller: ", log.fromCorrelation] }), (0, jsx_runtime_1.jsxs)("div", { children: ["// Total Runtime: ", (0, jsx_runtime_1.jsxs)("span", Object.assign({ style: AnyVariableView_1.genericFunctionRendererStyles.highlightComment }, { children: [totalRuntime, " ms"] }))] }), (0, jsx_runtime_1.jsx)("div", { children: "// //////////////////////////////////////////////////////" })] })), (0, jsx_runtime_1.jsx)(AnyVariableView_1.GenericFunctionRenderer, { functionName: functionKey.split('::').pop() || 'unknown', args: log.input, expanded: true })] })) })] }));
10
12
  };
11
13
  exports.LogSummaryDetails = LogSummaryDetails;
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.LogViewer = exports.useTabs = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = __importDefault(require("react"));
9
8
  const material_1 = require("@mui/material");
10
9
  const Box_1 = __importDefault(require("@mui/material/Box"));
10
+ const queryParams_1 = require("../queryParams");
11
11
  const useFederatedAddon_1 = require("../useFederatedAddon");
12
12
  const AdminLogs_1 = require("./AdminLogs");
13
13
  const Dashboard_1 = require("./Dashboard");
@@ -40,18 +40,15 @@ function useTabs() {
40
40
  }
41
41
  exports.useTabs = useTabs;
42
42
  function LogViewer() {
43
- const [selectedTab, setSelectedTab] = react_1.default.useState(0);
44
43
  const { tabs, loading } = useTabs();
45
- const handleTabChange = (event, newValue) => {
46
- setSelectedTab(newValue);
47
- };
44
+ const { tab, handleTabOnChange } = (0, queryParams_1.useUrlFields)();
48
45
  return ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ sx: {
49
46
  display: 'flex',
50
47
  flexDirection: 'column',
51
48
  height: '100vh',
52
49
  width: '100%',
53
50
  } }, { children: [(0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ sx: { flexGrow: 1, overflow: 'auto' } }, { children: tabs
54
- .filter((tab, index) => index === selectedTab)
51
+ .filter((t, index) => index === tab)
55
52
  .map((tab) => ((0, jsx_runtime_1.jsx)(tab.View, {}, tab.name))) })), (0, jsx_runtime_1.jsx)(Box_1.default, Object.assign({ sx: {
56
53
  borderTop: 1,
57
54
  borderColor: 'divider',
@@ -59,6 +56,6 @@ function LogViewer() {
59
56
  bottom: 0,
60
57
  bgcolor: 'background.paper',
61
58
  zIndex: 1,
62
- } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: selectedTab, onChange: handleTabChange, centered: true }, { children: [tabs.map((tab, index) => ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: tab.name }, tab.name))), loading && (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 16 }) })] })) }))] })));
59
+ } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabOnChange, centered: true }, { children: [tabs.map((tab, index) => ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: tab.name }, tab.name))), loading && (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 16 }) })] })) }))] })));
63
60
  }
64
61
  exports.LogViewer = LogViewer;
@@ -1,7 +1,4 @@
1
- import { SearchParams } from './types';
2
1
  export interface TopSectionProps {
3
- searchParams: SearchParams;
4
- setSearchParams: (setter: (searchParams: SearchParams) => SearchParams) => void;
5
2
  onSearch: () => Promise<any>;
6
3
  }
7
- export declare function TopSection({ searchParams, setSearchParams, onSearch }: TopSectionProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function TopSection({ onSearch }: TopSectionProps): import("react/jsx-runtime").JSX.Element;
@@ -18,66 +18,37 @@ const system_1 = require("@mui/system");
18
18
  const x_date_pickers_1 = require("@mui/x-date-pickers");
19
19
  const AdapterDateFns_1 = require("@mui/x-date-pickers/AdapterDateFns");
20
20
  const components_1 = require("../components");
21
+ const queryParams_1 = require("../queryParams");
21
22
  const constants_1 = require("./constants");
22
23
  const hooks_1 = require("./hooks");
23
- function TopSection({ searchParams, setSearchParams, onSearch }) {
24
- const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
24
+ function TopSection({ onSearch }) {
25
25
  const serviceOptions = (0, hooks_1.useServiceNames)();
26
- const handleRuntimeTypeChange = (event) => {
27
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { runtimeType: event.target.value })));
28
- };
29
- const handleStartDateChange = (value) => {
30
- if (value) {
31
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { startIsoDateTime: value.toISOString() })));
32
- }
33
- };
34
- const handleEndDateChange = (value) => {
35
- if (value) {
36
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { endIsoDateTime: value.toISOString() })));
37
- }
38
- };
39
- const handleErrorFilterChange = (event) => {
40
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { errorFilter: event.target.value })));
41
- };
42
- const handleUserFilterChange = (event) => {
43
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { userFilter: event.target.value })));
44
- };
45
- const handleInfoFilterChange = (event) => {
46
- setSearchParams((prev) => (Object.assign(Object.assign({}, prev), { infoFilter: event.target.value })));
47
- };
48
- const handleDeepSearchChange = (event) => {
49
- setSearchParams((prev) => (Object.assign(Object.assign({}, prev), { deep: event.target.value })));
50
- };
51
- const handleQuickTimeSelect = (minutes) => {
52
- const now = new Date();
53
- const startDate = new Date(now.getTime() - minutes * 60000);
54
- const endDate = new Date(now.getTime() + 7 * 24 * 60 * 60000);
55
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { startIsoDateTime: startDate.toISOString(), endIsoDateTime: endDate.toISOString() })));
56
- setAnchorEl(null);
57
- };
26
+ const { runtimeType, handleRuntimeTypeOnChange, service, handleServiceOnChange, startDate, handleStartDateChange, endDate, handleEndDateChange, user, handleUserOnChange, info, handleInfoOnChange, deep, handleDeepOnChange, error, handleErrorOnChange, updateStartAndEndTimeSpan, } = (0, queryParams_1.useUrlFields)();
27
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
58
28
  const handleQuickTimeClick = (event) => {
59
29
  setAnchorEl(event.currentTarget);
60
30
  };
61
31
  const handleQuickTimeClose = () => {
62
32
  setAnchorEl(null);
63
33
  };
64
- const handleServiceChange = (event, value) => {
65
- setSearchParams((prevSearchParams) => (Object.assign(Object.assign({}, prevSearchParams), { serviceFilter: value ? value.value : '' })));
34
+ const handleQuickTimeSelect = (minutes) => {
35
+ updateStartAndEndTimeSpan(minutes);
36
+ handleQuickTimeClose();
66
37
  };
67
- return ((0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns }, { children: [(0, jsx_runtime_1.jsxs)(Grid_1.default, Object.assign({ container: true, columns: 12, spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsxs)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, Object.assign({ id: "runtime-select-label" }, { children: "Runtime Type" })), (0, jsx_runtime_1.jsx)(Select_1.default, Object.assign({ labelId: "runtime-select-label", id: "demo-simple-select", value: searchParams.runtimeType, label: "Runtime Type", onChange: handleRuntimeTypeChange }, { children: constants_1.RuntimeTypes.map((key) => ((0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ value: key }, { children: key }), key))) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { options: serviceOptions, getOptionLabel: (option) => option.label, onChange: handleServiceChange, renderInput: (params) => ((0, jsx_runtime_1.jsx)(TextField_1.default, Object.assign({}, params, { label: "Service Name", InputLabelProps: {
38
+ return ((0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns }, { children: [(0, jsx_runtime_1.jsxs)(Grid_1.default, Object.assign({ container: true, columns: 12, spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsxs)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(InputLabel_1.default, Object.assign({ id: "runtime-select-label" }, { children: "Runtime Type" })), (0, jsx_runtime_1.jsx)(Select_1.default, Object.assign({ labelId: "runtime-select-label", id: "demo-simple-select", value: runtimeType, label: "Runtime Type", onChange: handleRuntimeTypeOnChange }, { children: constants_1.RuntimeTypes.map((key) => ((0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ value: key }, { children: key }), key))) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { getOptionLabel: (option) => option.label, options: serviceOptions, value: serviceOptions.find((o) => o.value === service) || null, onChange: handleServiceOnChange, renderInput: (params) => ((0, jsx_runtime_1.jsx)(TextField_1.default, Object.assign({}, params, { label: "Service Name", InputLabelProps: {
68
39
  shrink: true,
69
- } }))) }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsxs)(system_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "Start DateTime", value: new Date(searchParams.startIsoDateTime), onChange: handleStartDateChange }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ "aria-label": "quick time select", "aria-controls": "quick-time-menu", "aria-haspopup": "true", onClick: handleQuickTimeClick, sx: {
40
+ } }))) }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsxs)(system_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "Start DateTime", value: startDate, onChange: handleStartDateChange }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ "aria-label": "quick time select", "aria-controls": "quick-time-menu", "aria-haspopup": "true", onClick: handleQuickTimeClick, sx: {
70
41
  position: 'absolute',
71
42
  right: '-28px',
72
43
  top: '50%',
73
44
  transform: 'translateY(-50%)',
74
- } }, { children: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "End DateTime", value: new Date(searchParams.endIsoDateTime), onChange: handleEndDateChange }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 4 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "User", value: searchParams.userFilter, onChange: handleUserFilterChange, InputLabelProps: {
45
+ } }, { children: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}) }))] })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DateTimePicker, { label: "End DateTime", value: endDate, onChange: handleEndDateChange }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 4 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "User", value: user, onChange: handleUserOnChange, InputLabelProps: {
75
46
  shrink: true,
76
- } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Info", value: searchParams.infoFilter, onChange: handleInfoFilterChange, InputLabelProps: {
47
+ } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Info", value: info, onChange: handleInfoOnChange, InputLabelProps: {
77
48
  shrink: true,
78
- } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Error Filter", value: searchParams.errorFilter, onChange: handleErrorFilterChange, InputLabelProps: {
49
+ } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Error Filter", value: error, onChange: handleErrorOnChange, InputLabelProps: {
79
50
  shrink: true,
80
- } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 10 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Deep Search", value: searchParams.deep, onChange: handleDeepSearchChange, placeholder: "Use with caution, reduce results with above fields first, this is a contains search on the log JSON, so it will be slow.", InputLabelProps: {
51
+ } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 10 }, { children: (0, jsx_runtime_1.jsx)(FormControl_1.default, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(TextField_1.default, { label: "Deep Search", value: deep, onChange: handleDeepOnChange, placeholder: "Use with caution, reduce results with above fields first, this is a contains search on the log JSON, so it will be slow.", InputLabelProps: {
81
52
  shrink: true,
82
53
  } }) })) })), (0, jsx_runtime_1.jsx)(Grid_1.default, Object.assign({ item: true, xs: 2 }, { children: (0, jsx_runtime_1.jsx)(components_1.AsyncButton, Object.assign({ onClick: () => onSearch() }, { children: "Search" })) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Menu, Object.assign({ id: "quick-time-menu", anchorEl: anchorEl, keepMounted: true, open: Boolean(anchorEl), onClose: handleQuickTimeClose }, { children: [(0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(5) }, { children: "Last 5 minutes" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(30) }, { children: "Last 30 minutes" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(1 * 60) }, { children: "Last hour" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(3 * 60) }, { children: "Last 3 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(8 * 60) }, { children: "Last 8 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(16 * 60) }, { children: "Last 16 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(24 * 60) }, { children: "Last 24 hours" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(7 * 24 * 60) }, { children: "Last 7 days" })), (0, jsx_runtime_1.jsx)(MenuItem_1.default, Object.assign({ onClick: () => handleQuickTimeSelect(30 * 24 * 60) }, { children: "Last month" }))] }))] })));
83
54
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SearchParams } from '../types';
3
2
  declare global {
4
3
  interface Window {
@@ -9,12 +8,10 @@ declare global {
9
8
  export declare const useLogManagement: () => {
10
9
  selectedLogCorrelation: string;
11
10
  logs: any;
12
- searchParams: SearchParams;
13
- setSearchParams: import("react").Dispatch<import("react").SetStateAction<SearchParams>>;
14
11
  onSearch: (newSearchParams?: SearchParams | undefined) => Promise<any[]>;
15
12
  filteredLogs: any[];
16
13
  onRowClick: ({ row: logStory }: any) => void;
17
- clearSelectedLogCorrelation: () => void;
18
- setSelectedLogCorrelation: (correlation: string) => void;
14
+ clearSelectedLogCorrelation: () => Promise<void>;
15
+ setSelectedLogCorrelation: (correlation: string) => Promise<void>;
19
16
  searchProgress: number;
20
17
  };
@@ -2,62 +2,43 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogManagement = void 0;
4
4
  const react_1 = require("react");
5
- const react_router_dom_1 = require("react-router-dom");
5
+ const queryParams_1 = require("../../queryParams");
6
6
  const logic_1 = require("../logic");
7
7
  const useOnSearch_1 = require("./useOnSearch");
8
8
  const useLogManagement = () => {
9
- const [searchParams, setSearchParams] = (0, react_router_dom_1.useSearchParams)();
10
- const selectedLogCorrelation = searchParams.get('correlation') || '';
11
- const setSelectedLogCorrelation = (correlation) => {
12
- if (correlation) {
13
- setSearchParams({ correlation });
14
- }
15
- else {
16
- setSearchParams({});
17
- }
18
- };
9
+ const { runtimeType, service, startDate, endDate, user, info, deep, error, correlation, setCorrelation, clearCorrelation } = (0, queryParams_1.useUrlFields)();
19
10
  const [logs, setLogs] = (0, react_1.useState)([]);
20
11
  (0, react_1.useEffect)(() => {
21
12
  window.logs = logs;
22
13
  window.viewLog = (log) => {
23
- setSelectedLogCorrelation(log.correlation);
14
+ setCorrelation(log.correlation);
24
15
  };
25
16
  }, [logs]);
26
17
  (0, react_1.useEffect)(() => {
27
18
  console.log('logs attached to window, try: viewLog(logs[0])');
28
19
  }, []);
29
- const [searchParamsState, setSearchParamsState] = (0, react_1.useState)(() => {
30
- const currentDate = new Date();
31
- const threeHoursAgo = new Date(currentDate.getTime() - 3 * 60 * 60 * 1000);
32
- const isoDateThreeHoursAgo = threeHoursAgo.toISOString();
33
- const tomorrow = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000);
34
- const isoDateTomorrow = tomorrow.toISOString();
35
- return {
36
- runtimeType: 'EXECUTE_STORY',
37
- startIsoDateTime: isoDateThreeHoursAgo,
38
- endIsoDateTime: isoDateTomorrow,
39
- errorFilter: '',
40
- infoFilter: '',
41
- serviceFilter: '',
42
- userFilter: '',
43
- deep: '',
44
- onlyErrors: false,
45
- };
46
- });
47
- const [searchProgress, onSearch] = (0, useOnSearch_1.useOnSearch)(searchParamsState, setLogs);
48
- const filteredLogs = (0, react_1.useMemo)(() => (0, logic_1.filterLogs)(searchParamsState.errorFilter, logs), [searchParamsState.errorFilter, logs]);
49
- const onRowClick = (0, logic_1.getOnRowClick)(setSelectedLogCorrelation);
50
- const clearSelectedLogCorrelation = () => setSelectedLogCorrelation('');
20
+ const searchParams = (0, react_1.useMemo)(() => ({
21
+ runtimeType,
22
+ startIsoDateTime: startDate.toISOString(),
23
+ endIsoDateTime: endDate.toISOString(),
24
+ errorFilter: error,
25
+ infoFilter: info,
26
+ serviceFilter: service,
27
+ userFilter: user,
28
+ deep: deep,
29
+ onlyErrors: false,
30
+ }), [runtimeType, startDate, endDate, error, info, service, user, deep]);
31
+ const [searchProgress, onSearch] = (0, useOnSearch_1.useOnSearch)(searchParams, setLogs);
32
+ const filteredLogs = (0, react_1.useMemo)(() => (0, logic_1.filterLogs)(error, logs), [error, logs]);
33
+ const onRowClick = (0, logic_1.getOnRowClick)(setCorrelation);
51
34
  return {
52
- selectedLogCorrelation,
35
+ selectedLogCorrelation: correlation,
53
36
  logs,
54
- searchParams: searchParamsState,
55
- setSearchParams: setSearchParamsState,
56
37
  onSearch,
57
38
  filteredLogs,
58
39
  onRowClick,
59
- clearSelectedLogCorrelation,
60
- setSelectedLogCorrelation,
40
+ clearSelectedLogCorrelation: clearCorrelation,
41
+ setSelectedLogCorrelation: setCorrelation,
61
42
  searchProgress,
62
43
  };
63
44
  };
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
- import { SearchParams } from '../types';
3
1
  declare global {
4
2
  interface Window {
5
3
  logs: any;
@@ -7,8 +5,6 @@ declare global {
7
5
  }
8
6
  export declare const useLogSearch: () => {
9
7
  logs: any;
10
- searchParams: SearchParams;
11
- setSearchParams: import("react").Dispatch<import("react").SetStateAction<SearchParams>>;
12
8
  searchProgress: number;
13
- onSearch: (newSearchParams?: SearchParams | undefined) => Promise<any[]>;
9
+ onSearch: (newSearchParams?: import("../types").SearchParams | undefined) => Promise<any[]>;
14
10
  };
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogSearch = void 0;
4
4
  const react_1 = require("react");
5
+ const queryParams_1 = require("../../queryParams");
5
6
  const useOnSearch_1 = require("./useOnSearch");
6
7
  const useLogSearch = () => {
8
+ const { runtimeType, service, startDate, endDate, user, info, deep, error } = (0, queryParams_1.useUrlFields)();
7
9
  const [logs, setLogs] = (0, react_1.useState)([]);
8
10
  (0, react_1.useEffect)(() => {
9
11
  window.logs = logs;
@@ -11,29 +13,19 @@ const useLogSearch = () => {
11
13
  (0, react_1.useEffect)(() => {
12
14
  console.log('logs attached to window, try: viewLog(logs[0])');
13
15
  }, []);
14
- const [searchParamsState, setSearchParamsState] = (0, react_1.useState)(() => {
15
- const currentDate = new Date();
16
- const threeHoursAgo = new Date(currentDate.getTime() - 3 * 60 * 60 * 1000);
17
- const isoDateThreeHoursAgo = threeHoursAgo.toISOString();
18
- const tomorrow = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000);
19
- const isoDateTomorrow = tomorrow.toISOString();
20
- return {
21
- runtimeType: 'EXECUTE_STORY',
22
- startIsoDateTime: isoDateThreeHoursAgo,
23
- endIsoDateTime: isoDateTomorrow,
24
- errorFilter: '',
25
- infoFilter: '',
26
- serviceFilter: '',
27
- userFilter: '',
28
- deep: '',
29
- onlyErrors: false,
30
- };
31
- });
32
- const [searchProgress, onSearch] = (0, useOnSearch_1.useOnSearch)(searchParamsState, setLogs);
16
+ const [searchProgress, onSearch] = (0, useOnSearch_1.useOnSearch)({
17
+ runtimeType,
18
+ startIsoDateTime: startDate.toISOString(),
19
+ endIsoDateTime: endDate.toISOString(),
20
+ errorFilter: error,
21
+ infoFilter: info,
22
+ serviceFilter: service,
23
+ userFilter: user,
24
+ deep: deep,
25
+ onlyErrors: false,
26
+ }, setLogs);
33
27
  return {
34
28
  logs,
35
- searchParams: searchParamsState,
36
- setSearchParams: setSearchParamsState,
37
29
  searchProgress,
38
30
  onSearch,
39
31
  };
@@ -1,6 +1,5 @@
1
- type AutoCompleteOption = {
1
+ export type AutoCompleteOption = {
2
2
  label: string;
3
3
  value: string;
4
4
  };
5
5
  export declare const useServiceNames: () => AutoCompleteOption[];
6
- export {};
@@ -0,0 +1,2 @@
1
+ export * from './searchQueryParams';
2
+ export * from './useUrlFields';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./searchQueryParams"), exports);
18
+ __exportStar(require("./useUrlFields"), exports);
@@ -0,0 +1,14 @@
1
+ import { LogLevelEnumLookup } from 'quidproquo-core';
2
+ export declare const infoFilterQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string[] | "">;
3
+ export declare const runtimeTypeQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
4
+ export declare const userQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
5
+ export declare const infoQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
6
+ export declare const msgQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
7
+ export declare const errorQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
8
+ export declare const deepQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
9
+ export declare const correlationQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
10
+ export declare const tabQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, number>;
11
+ export declare const logLevelQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, LogLevelEnumLookup>;
12
+ export declare const serviceQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, string>;
13
+ export declare const startDateQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, Date>;
14
+ export declare const endDateQueryParamComputed: import("quidproquo-web-react").QpqRuntimeComputed<import("quidproquo-web-react").SharedQueryParamsState, Date>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.endDateQueryParamComputed = exports.startDateQueryParamComputed = exports.serviceQueryParamComputed = exports.logLevelQueryParamComputed = exports.tabQueryParamComputed = exports.correlationQueryParamComputed = exports.deepQueryParamComputed = exports.errorQueryParamComputed = exports.msgQueryParamComputed = exports.infoQueryParamComputed = exports.userQueryParamComputed = exports.runtimeTypeQueryParamComputed = exports.infoFilterQueryParamComputed = void 0;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const quidproquo_web_react_1 = require("quidproquo-web-react");
6
+ exports.infoFilterQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => state.infoFilter || '');
7
+ exports.runtimeTypeQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.runtimeType) === null || _a === void 0 ? void 0 : _a[0]) || quidproquo_core_1.QpqRuntimeType.EXECUTE_STORY; });
8
+ exports.userQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.user) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
9
+ exports.infoQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.info) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
10
+ exports.msgQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.msg) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
11
+ exports.errorQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.error) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
12
+ exports.deepQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.deep) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
13
+ exports.correlationQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.correlation) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
14
+ exports.tabQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return parseInt(((_a = state.tab) === null || _a === void 0 ? void 0 : _a[0]) || '0'); });
15
+ exports.logLevelQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return (((_a = state.logLevel) === null || _a === void 0 ? void 0 : _a[0]) || 'All'); });
16
+ exports.serviceQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => { var _a; return ((_a = state.service) === null || _a === void 0 ? void 0 : _a[0]) || ''; });
17
+ exports.startDateQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => {
18
+ var _a;
19
+ const dateStr = (_a = state.startIsoDateTime) === null || _a === void 0 ? void 0 : _a[0];
20
+ return dateStr ? new Date(dateStr) : new Date();
21
+ });
22
+ exports.endDateQueryParamComputed = (0, quidproquo_web_react_1.createQpqRuntimeComputed)(quidproquo_web_react_1.sharedQueryParamsRuntime, (state) => {
23
+ var _a;
24
+ const dateStr = (_a = state.endIsoDateTime) === null || _a === void 0 ? void 0 : _a[0];
25
+ return dateStr ? new Date(dateStr) : new Date();
26
+ });