nmrium 0.38.2 → 0.40.1
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.
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +90 -67
- package/lib/component/NMRium.d.ts +1 -0
- package/lib/component/NMRium.js +4 -2
- package/lib/component/context/LoggerContext.js +12 -2
- package/lib/component/context/PreferencesContext.d.ts +4 -2
- package/lib/component/elements/formik/FormikError.d.ts +8 -0
- package/lib/component/elements/formik/FormikError.js +22 -0
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +7 -0
- package/lib/component/elements/popup/Alert/AlertBlock.js +24 -0
- package/lib/component/elements/popup/Alert/Provider.js +2 -20
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -1
- package/lib/component/header/Header.js +2 -2
- package/lib/component/hooks/useSaveSettings.js +18 -16
- package/lib/component/modal/AboutUsModal.js +4 -2
- package/lib/component/modal/LoadJCAMPModal.js +41 -28
- package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
- package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
- package/lib/component/modal/PredictSpectraModal.js +12 -2
- package/lib/component/modal/editRange/EditRangeModal.d.ts +7 -6
- package/lib/component/modal/editRange/EditRangeModal.js +33 -13
- package/lib/component/modal/setting/GeneralSettings.js +29 -28
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -16
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
- package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +1 -1
- package/lib/component/panels/Panels.js +2 -2
- package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +9 -12
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +7 -10
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -1
- package/lib/component/reducer/actions/DatabaseActions.js +6 -4
- package/lib/component/reducer/actions/DomainActions.js +3 -0
- package/lib/component/reducer/actions/IntegralsActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +6 -6
- package/lib/component/reducer/actions/ToolsActions.js +3 -32
- package/lib/component/reducer/actions/ZonesActions.js +2 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +8 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +35 -0
- package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/utility/export.d.ts +5 -4
- package/lib/component/utility/export.js +24 -52
- package/lib/data/PredictionManager.d.ts +3 -1
- package/lib/data/PredictionManager.js +27 -1
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +13 -6
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +23 -18
- package/lib/utils/clipboard/clipboard.d.ts +12 -0
- package/lib/utils/clipboard/clipboard.js +15 -0
- package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
- package/lib/utils/clipboard/clipboardComponents.js +150 -0
- package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
- package/lib/utils/clipboard/clipboardHooks.js +142 -0
- package/lib/utils/clipboard/types.d.ts +1 -0
- package/lib/utils/clipboard/types.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +90 -67
- package/lib-cjs/component/NMRium.js +4 -2
- package/lib-cjs/component/context/LoggerContext.js +11 -1
- package/lib-cjs/component/elements/formik/FormikError.js +27 -0
- package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +30 -0
- package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -20
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
- package/lib-cjs/component/header/Header.js +2 -2
- package/lib-cjs/component/hooks/useSaveSettings.js +17 -15
- package/lib-cjs/component/modal/AboutUsModal.js +4 -2
- package/lib-cjs/component/modal/LoadJCAMPModal.js +41 -28
- package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
- package/lib-cjs/component/modal/PredictSpectraModal.js +12 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +32 -12
- package/lib-cjs/component/modal/setting/GeneralSettings.js +29 -28
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +17 -15
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +1 -1
- package/lib-cjs/component/panels/Panels.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +9 -12
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +7 -10
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -1
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +6 -4
- package/lib-cjs/component/reducer/actions/DomainActions.js +3 -0
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +3 -1
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +6 -6
- package/lib-cjs/component/reducer/actions/ToolsActions.js +26 -32
- package/lib-cjs/component/reducer/actions/ZonesActions.js +2 -4
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +37 -0
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib-cjs/component/utility/export.js +24 -54
- package/lib-cjs/data/PredictionManager.js +27 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +13 -6
- package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +23 -18
- package/lib-cjs/utils/clipboard/clipboard.js +23 -0
- package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
- package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
- package/lib-cjs/utils/clipboard/types.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +17 -17
- package/lib/component/header/LogsHistory.d.ts +0 -1
|
@@ -34,81 +34,98 @@ function KeysListenerTracker() {
|
|
|
34
34
|
return displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
35
35
|
}, [data, displayerMode]);
|
|
36
36
|
const deleteHandler = (0, react_1.useCallback)(async (sourceData) => {
|
|
37
|
-
const { type, extra
|
|
37
|
+
const { type, extra } = sourceData;
|
|
38
38
|
switch (type) {
|
|
39
39
|
case index_1.HighlightEventSource.INTEGRAL: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const { id } = extra || {};
|
|
41
|
+
if (id) {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: 'DELETE_INTEGRAL',
|
|
44
|
+
payload: {
|
|
45
|
+
id,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
// remove keys from the highlighted list after delete
|
|
49
|
+
remove();
|
|
50
|
+
}
|
|
48
51
|
break;
|
|
49
52
|
}
|
|
50
53
|
case index_1.HighlightEventSource.PEAK: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const { id } = extra || {};
|
|
55
|
+
if (id) {
|
|
56
|
+
dispatch({
|
|
57
|
+
type: 'DELETE_PEAK',
|
|
58
|
+
payload: {
|
|
59
|
+
id,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
// remove keys from the highlighted list after delete
|
|
63
|
+
remove();
|
|
64
|
+
}
|
|
59
65
|
break;
|
|
60
66
|
}
|
|
61
67
|
case index_1.HighlightEventSource.RANGE: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const { id } = extra || {};
|
|
69
|
+
if (id) {
|
|
70
|
+
dispatch({
|
|
71
|
+
type: 'DELETE_RANGE',
|
|
72
|
+
payload: {
|
|
73
|
+
id,
|
|
74
|
+
assignmentData,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
// remove keys from the highlighted list after delete
|
|
78
|
+
remove();
|
|
79
|
+
}
|
|
71
80
|
break;
|
|
72
81
|
}
|
|
73
82
|
case index_1.HighlightEventSource.ZONE: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
const { id } = extra || {};
|
|
84
|
+
if (id) {
|
|
85
|
+
dispatch({
|
|
86
|
+
type: 'DELETE_2D_ZONE',
|
|
87
|
+
payload: {
|
|
88
|
+
id,
|
|
89
|
+
assignmentData,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
// remove keys from the highlighted list after delete
|
|
93
|
+
remove();
|
|
94
|
+
}
|
|
83
95
|
break;
|
|
84
96
|
}
|
|
85
97
|
case index_1.HighlightEventSource.EXCLUSION_ZONE: {
|
|
98
|
+
const { zone, spectrumID } = extra || {};
|
|
86
99
|
const buttons = [
|
|
87
100
|
{
|
|
88
101
|
text: 'Yes, for all spectra',
|
|
89
102
|
handler: async () => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
if (zone) {
|
|
104
|
+
const hideLoading = await alert.showLoading('Delete all spectra exclusion zones in progress');
|
|
105
|
+
dispatch({
|
|
106
|
+
type: 'DELETE_EXCLUSION_ZONE',
|
|
107
|
+
payload: {
|
|
108
|
+
zone,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
hideLoading();
|
|
112
|
+
}
|
|
98
113
|
},
|
|
99
114
|
},
|
|
100
115
|
{
|
|
101
116
|
text: 'Yes',
|
|
102
117
|
handler: async () => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
if (spectrumID) {
|
|
119
|
+
const hideLoading = await alert.showLoading('Delete exclusion zones in progress');
|
|
120
|
+
dispatch({
|
|
121
|
+
type: 'DELETE_EXCLUSION_ZONE',
|
|
122
|
+
payload: {
|
|
123
|
+
zone,
|
|
124
|
+
spectrumId: spectrumID,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
hideLoading();
|
|
128
|
+
}
|
|
112
129
|
},
|
|
113
130
|
},
|
|
114
131
|
{ text: 'No' },
|
|
@@ -120,19 +137,22 @@ function KeysListenerTracker() {
|
|
|
120
137
|
break;
|
|
121
138
|
}
|
|
122
139
|
case index_1.HighlightEventSource.MATRIX_GENERATION_EXCLUSION_ZONE: {
|
|
140
|
+
const { zone } = extra || {};
|
|
123
141
|
const buttons = [
|
|
124
142
|
{
|
|
125
143
|
text: 'Yes',
|
|
126
144
|
handler: async () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
145
|
+
if (zone) {
|
|
146
|
+
const hideLoading = await alert.showLoading('Delete all spectra exclusion zones in progress');
|
|
147
|
+
dispatchPreferences({
|
|
148
|
+
type: 'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
149
|
+
payload: {
|
|
150
|
+
zone,
|
|
151
|
+
nucleus: activeTab,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
hideLoading();
|
|
155
|
+
}
|
|
136
156
|
},
|
|
137
157
|
},
|
|
138
158
|
{ text: 'No' },
|
|
@@ -144,12 +164,15 @@ function KeysListenerTracker() {
|
|
|
144
164
|
break;
|
|
145
165
|
}
|
|
146
166
|
case index_1.HighlightEventSource.MULTIPLE_ANALYSIS_ZONE: {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
167
|
+
const { colKey } = extra || {};
|
|
168
|
+
if (colKey) {
|
|
169
|
+
dispatchPreferences({
|
|
170
|
+
type: 'DELETE_ANALYSIS_COLUMN',
|
|
171
|
+
payload: { columnKey: colKey, nucleus: activeTab },
|
|
172
|
+
});
|
|
173
|
+
// remove keys from the highlighted list after delete
|
|
174
|
+
remove();
|
|
175
|
+
}
|
|
153
176
|
break;
|
|
154
177
|
}
|
|
155
178
|
default:
|
|
@@ -109,8 +109,10 @@ const defaultData = {
|
|
|
109
109
|
spectra: [],
|
|
110
110
|
};
|
|
111
111
|
const NMRium = (0, react_2.forwardRef)(function NMRium(props, ref) {
|
|
112
|
-
const { onError, ...otherProps } = props;
|
|
113
|
-
|
|
112
|
+
const { noErrorBoundary = false, onError, ...otherProps } = props;
|
|
113
|
+
const innerNmrium = (0, jsx_runtime_1.jsx)(InnerNMRium, { ...otherProps, innerRef: ref });
|
|
114
|
+
const children = noErrorBoundary ? (innerNmrium) : ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, onError: onError, children: innerNmrium }));
|
|
115
|
+
return (0, jsx_runtime_1.jsx)(ui_1.RootLayout, { style: { width: '100%' }, children: children });
|
|
114
116
|
});
|
|
115
117
|
function InnerNMRium({ data: dataProp = defaultData, workspace, customWorkspaces, preferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onChange, emptyText, innerRef, }) {
|
|
116
118
|
const rootRef = (0, react_2.useRef)(null);
|
|
@@ -4,6 +4,7 @@ exports.LoggerProvider = exports.useLogger = exports.LoggerContext = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const fifo_logger_1 = require("fifo-logger");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
+
const LogsHistoryModal_1 = require("../modal/LogsHistoryModal");
|
|
7
8
|
const PreferencesContext_1 = require("./PreferencesContext");
|
|
8
9
|
exports.LoggerContext = (0, react_1.createContext)(null);
|
|
9
10
|
function useLogger() {
|
|
@@ -18,8 +19,17 @@ function LoggerProvider({ children }) {
|
|
|
18
19
|
const { current: { general: { loggingLevel }, }, } = (0, PreferencesContext_1.usePreferences)();
|
|
19
20
|
const [lastReadLogId, setLastLogId] = (0, react_1.useState)(0);
|
|
20
21
|
const [logsHistory, setLogsHistory] = (0, react_1.useState)([]);
|
|
22
|
+
const [isLogHistoryOpened, openLogHistory] = (0, react_1.useState)(false);
|
|
21
23
|
const loggerRef = (0, react_1.useRef)(new fifo_logger_1.FifoLogger({
|
|
22
24
|
onChange: (log, logs) => {
|
|
25
|
+
if (log && ['warn', 'error', 'fatal'].includes(log.levelLabel)) {
|
|
26
|
+
//open the log history automatically if we have warn,error, or fatal
|
|
27
|
+
openLogHistory(true);
|
|
28
|
+
if (log?.error) {
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.error(log.error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
23
33
|
setLogsHistory(logs.slice());
|
|
24
34
|
},
|
|
25
35
|
}));
|
|
@@ -42,6 +52,6 @@ function LoggerProvider({ children }) {
|
|
|
42
52
|
lastReadLogId,
|
|
43
53
|
};
|
|
44
54
|
}, [lastReadLogId, logsHistory, markAsRead]);
|
|
45
|
-
return ((0, jsx_runtime_1.
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(exports.LoggerContext.Provider, { value: loggerState, children: [isLogHistoryOpened && ((0, jsx_runtime_1.jsx)(LogsHistoryModal_1.LogsHistoryModal, { autoOpen: true, onClose: () => openLogHistory(false) })), children] }));
|
|
46
56
|
}
|
|
47
57
|
exports.LoggerProvider = LoggerProvider;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const formik_1 = require("formik");
|
|
8
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
const styles = {
|
|
10
|
+
container: {
|
|
11
|
+
padding: '0.4rem',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
},
|
|
15
|
+
text: {
|
|
16
|
+
color: '#fd000c',
|
|
17
|
+
margin: '0.5px',
|
|
18
|
+
fontSize: '0.9em',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
function FormikError({ style, name, children }) {
|
|
22
|
+
const { errors, isValid, dirty, touched } = (0, formik_1.useFormikContext)();
|
|
23
|
+
const errorText = (0, get_1.default)(errors, name);
|
|
24
|
+
const isTouched = (0, get_1.default)(touched, name);
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { ...styles.container, ...style?.container }, children: [children, !isValid && dirty && isTouched && ((0, jsx_runtime_1.jsx)("span", { style: { ...styles.text, ...style?.text }, children: errorText }))] }));
|
|
26
|
+
}
|
|
27
|
+
exports.default = FormikError;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const fa_1 = require("react-icons/fa");
|
|
8
|
+
const options_1 = require("../options");
|
|
9
|
+
const ProgressIndicator_1 = __importDefault(require("./ProgressIndicator"));
|
|
10
|
+
function AlertBlock(props) {
|
|
11
|
+
const { offset, alert, onClose } = props;
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
13
|
+
margin: offset,
|
|
14
|
+
padding: '25px',
|
|
15
|
+
borderRadius: '10px',
|
|
16
|
+
pointerEvents: 'all',
|
|
17
|
+
backgroundColor: alert.options.backgroundColor,
|
|
18
|
+
color: alert.options.color,
|
|
19
|
+
minHeight: '60px',
|
|
20
|
+
position: 'relative',
|
|
21
|
+
}, children: [(0, jsx_runtime_1.jsx)("button", { style: {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
right: '5px',
|
|
24
|
+
top: '5px',
|
|
25
|
+
border: 'none',
|
|
26
|
+
backgroundColor: 'transparent',
|
|
27
|
+
color: 'white',
|
|
28
|
+
}, type: "button", onClick: onClose, children: (0, jsx_runtime_1.jsx)(fa_1.FaTimes, {}) }), (0, jsx_runtime_1.jsx)("span", { children: alert.message }), alert.options.type === options_1.types.PROGRESS_INDICATOR && (0, jsx_runtime_1.jsx)(ProgressIndicator_1.default, {})] }, alert.id));
|
|
29
|
+
}
|
|
30
|
+
exports.default = AlertBlock;
|
|
@@ -7,13 +7,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const groupBy_1 = __importDefault(require("lodash/groupBy"));
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const react_dom_1 = require("react-dom");
|
|
10
|
-
const fa_1 = require("react-icons/fa");
|
|
11
10
|
const react_transition_group_1 = require("react-transition-group");
|
|
12
11
|
const Transition_1 = __importDefault(require("../Transition"));
|
|
13
12
|
const Wrapper_1 = __importDefault(require("../Wrapper"));
|
|
14
13
|
const options_1 = require("../options");
|
|
14
|
+
const AlertBlock_1 = __importDefault(require("./AlertBlock"));
|
|
15
15
|
const Context_1 = require("./Context");
|
|
16
|
-
const ProgressIndicator_1 = __importDefault(require("./ProgressIndicator"));
|
|
17
16
|
function Provider({ children, wrapperRef = null, offset = '5px', position = options_1.positions.BOTTOM_CENTER, timeout = 3000, type, transition = options_1.transitions.FADE, ...props }) {
|
|
18
17
|
const root = (0, react_1.useRef)(null);
|
|
19
18
|
const timersId = (0, react_1.useRef)([]);
|
|
@@ -126,24 +125,7 @@ function Provider({ children, wrapperRef = null, offset = '5px', position = opti
|
|
|
126
125
|
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: Object.keys(options_1.positions).map((key) => {
|
|
127
126
|
const position = options_1.positions[key];
|
|
128
127
|
return ((0, jsx_runtime_1.jsx)(react_transition_group_1.TransitionGroup, { appear: true, options: { position, zIndex: 999999 }, component: Wrapper_1.default, containerStyle: parentStyle, ...props, children: alertsByPosition[position]
|
|
129
|
-
? alertsByPosition[position].map((alert) => ((0, jsx_runtime_1.jsx)(Transition_1.default, { type: transition, children: (0, jsx_runtime_1.
|
|
130
|
-
margin: offset,
|
|
131
|
-
padding: '25px',
|
|
132
|
-
borderRadius: '10px',
|
|
133
|
-
pointerEvents: 'all',
|
|
134
|
-
backgroundColor: alert.options.backgroundColor,
|
|
135
|
-
color: alert.options.color,
|
|
136
|
-
minHeight: '60px',
|
|
137
|
-
position: 'relative',
|
|
138
|
-
}, children: [(0, jsx_runtime_1.jsx)("button", { style: {
|
|
139
|
-
position: 'absolute',
|
|
140
|
-
right: '5px',
|
|
141
|
-
top: '5px',
|
|
142
|
-
border: 'none',
|
|
143
|
-
backgroundColor: 'transparent',
|
|
144
|
-
color: 'white',
|
|
145
|
-
}, type: "button", onClick: () => closeHandler(alert), children: (0, jsx_runtime_1.jsx)(fa_1.FaTimes, {}) }), (0, jsx_runtime_1.jsx)("span", { children: alert.message }), alert.options.type ===
|
|
146
|
-
options_1.types.PROGRESS_INDICATOR && (0, jsx_runtime_1.jsx)(ProgressIndicator_1.default, {})] }, alert.id) }, alert.id)))
|
|
128
|
+
? alertsByPosition[position].map((alert) => ((0, jsx_runtime_1.jsx)(Transition_1.default, { type: transition, children: (0, jsx_runtime_1.jsx)(AlertBlock_1.default, { offset: offset, alert: alert, onClose: () => closeHandler(alert) }) }, alert.id)))
|
|
147
129
|
: null }, position));
|
|
148
130
|
}) }), root.current)] }));
|
|
149
131
|
}
|
|
@@ -18,6 +18,7 @@ const Header_1 = require("../elements/Header");
|
|
|
18
18
|
const DropDownButton_1 = __importDefault(require("../elements/dropDownButton/DropDownButton"));
|
|
19
19
|
const useSaveSettings_1 = require("../hooks/useSaveSettings");
|
|
20
20
|
const AboutUsModal_1 = __importDefault(require("../modal/AboutUsModal"));
|
|
21
|
+
const LogsHistoryModal_1 = require("../modal/LogsHistoryModal");
|
|
21
22
|
const GeneralSettings_1 = __importDefault(require("../modal/setting/GeneralSettings"));
|
|
22
23
|
const WorkspaceItem_1 = __importDefault(require("../modal/setting/WorkspaceItem"));
|
|
23
24
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
@@ -25,7 +26,6 @@ const ApodizationOptionsPanel_1 = __importDefault(require("./ApodizationOptionsP
|
|
|
25
26
|
const AutoPeakPickingOptionPanel_1 = __importDefault(require("./AutoPeakPickingOptionPanel"));
|
|
26
27
|
const BaseLineCorrectionPanel_1 = __importDefault(require("./BaseLineCorrectionPanel"));
|
|
27
28
|
const HeaderContainer_1 = require("./HeaderContainer");
|
|
28
|
-
const LogsHistory_1 = require("./LogsHistory");
|
|
29
29
|
const PhaseCorrectionPanel_1 = __importDefault(require("./PhaseCorrectionPanel"));
|
|
30
30
|
const RangesPickingOptionPanel_1 = __importDefault(require("./RangesPickingOptionPanel"));
|
|
31
31
|
const ZeroFillingOptionsPanel_1 = __importDefault(require("./ZeroFillingOptionsPanel"));
|
|
@@ -106,7 +106,7 @@ function HeaderInner(props) {
|
|
|
106
106
|
alignItems: 'center',
|
|
107
107
|
}, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ui_1.Toolbar, { orientation: "horizontal", children: (0, jsx_runtime_1.jsx)(AboutUsModal_1.default, {}) }) }), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), (0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { style: {
|
|
108
108
|
alignItems: 'center',
|
|
109
|
-
}, children: [!hideGeneralSettings && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), (0, jsx_runtime_1.jsx)(SaveButton, {})] })), !general?.hideLogs && (0, jsx_runtime_1.jsx)(
|
|
109
|
+
}, children: [!hideGeneralSettings && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), (0, jsx_runtime_1.jsx)(SaveButton, {})] })), !general?.hideLogs && (0, jsx_runtime_1.jsx)(LogsHistoryModal_1.LogsHistoryModal, {}), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(ui_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}) }), !hideGeneralSettings && ((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, { height: height / 2 })), !isFullscreen && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}) }))] }) })] })] }) }));
|
|
110
110
|
}
|
|
111
111
|
function SaveButton() {
|
|
112
112
|
const { workspace, workspaces, originalWorkspaces } = (0, PreferencesContext_1.usePreferences)();
|
|
@@ -52,30 +52,32 @@ const WorkspaceAddForm = (0, react_1.forwardRef)(({ className, message, onSave }
|
|
|
52
52
|
function useSaveSettings() {
|
|
53
53
|
const alert = (0, Context_1.useAlert)();
|
|
54
54
|
const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
|
|
55
|
-
const
|
|
55
|
+
const settingsRef = (0, react_1.useRef)();
|
|
56
56
|
const { dispatch, current } = (0, PreferencesContext_1.usePreferences)();
|
|
57
57
|
const formRef = (0, react_1.useRef)(null);
|
|
58
|
-
function addNewWorkspace(workspaceName
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
function addNewWorkspace({ workspaceName }) {
|
|
59
|
+
if (settingsRef.current) {
|
|
60
|
+
dispatch({
|
|
61
|
+
type: 'ADD_WORKSPACE',
|
|
62
|
+
payload: {
|
|
63
|
+
workspaceKey: workspaceName,
|
|
64
|
+
data: settingsRef.current,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
closeDialog();
|
|
68
|
+
alert.success('Preferences saved successfully');
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
71
|
return {
|
|
70
|
-
saveSettings: (values
|
|
71
|
-
|
|
72
|
+
saveSettings: (values) => {
|
|
73
|
+
settingsRef.current = values;
|
|
72
74
|
if (current.source !== 'user') {
|
|
73
75
|
openDialog();
|
|
74
76
|
}
|
|
75
77
|
else {
|
|
76
78
|
dispatch({
|
|
77
79
|
type: 'SET_PREFERENCES',
|
|
78
|
-
payload: values,
|
|
80
|
+
...(values && { payload: values }),
|
|
79
81
|
});
|
|
80
82
|
closeDialog();
|
|
81
83
|
}
|
|
@@ -83,7 +85,7 @@ function useSaveSettings() {
|
|
|
83
85
|
SaveSettingsModal: () => {
|
|
84
86
|
const alertConfig = {
|
|
85
87
|
message: 'Please enter a new user workspace name in order to save your changes locally',
|
|
86
|
-
render: (props) => ((0, jsx_runtime_1.jsx)(WorkspaceAddForm, { ...props, onSave:
|
|
88
|
+
render: (props) => ((0, jsx_runtime_1.jsx)(WorkspaceAddForm, { ...props, onSave: addNewWorkspace, ref: formRef })),
|
|
87
89
|
buttons: [
|
|
88
90
|
{
|
|
89
91
|
text: 'Save',
|
|
@@ -11,6 +11,9 @@ const ui_1 = require("react-science/ui");
|
|
|
11
11
|
const versionInfo_1 = __importDefault(require("../../versionInfo"));
|
|
12
12
|
const Logo_1 = __importDefault(require("../elements/Logo"));
|
|
13
13
|
const styles = (0, react_1.css) `
|
|
14
|
+
width: 40vw;
|
|
15
|
+
min-width: 500px;
|
|
16
|
+
|
|
14
17
|
button:focus {
|
|
15
18
|
outline: none;
|
|
16
19
|
}
|
|
@@ -87,7 +90,6 @@ const styles = (0, react_1.css) `
|
|
|
87
90
|
display: flex;
|
|
88
91
|
flex-direction: column;
|
|
89
92
|
user-select: none;
|
|
90
|
-
width: 500px;
|
|
91
93
|
`;
|
|
92
94
|
function AboutUsModal() {
|
|
93
95
|
const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
|
|
@@ -95,7 +97,7 @@ function AboutUsModal() {
|
|
|
95
97
|
display: 'flex',
|
|
96
98
|
alignItems: 'center',
|
|
97
99
|
justifyContent: 'center',
|
|
98
|
-
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.jsx)("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
|
|
100
|
+
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.jsx)("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
|
|
99
101
|
}
|
|
100
102
|
exports.default = AboutUsModal;
|
|
101
103
|
function VersionInfo() {
|
|
@@ -37,12 +37,27 @@ const Yup = __importStar(require("yup"));
|
|
|
37
37
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
38
38
|
const Button_1 = __importDefault(require("../elements/Button"));
|
|
39
39
|
const Label_1 = __importDefault(require("../elements/Label"));
|
|
40
|
+
const FormikError_1 = __importDefault(require("../elements/formik/FormikError"));
|
|
40
41
|
const FormikInput_1 = __importDefault(require("../elements/formik/FormikInput"));
|
|
41
42
|
const Context_1 = require("../elements/popup/Alert/Context");
|
|
42
|
-
const FileUtility_1 = require("../utility/FileUtility");
|
|
43
43
|
const allowedExtensions = new Set(['dx', 'jdx', 'jcamp']);
|
|
44
44
|
const loadFormValidation = Yup.object({
|
|
45
|
-
url: Yup.string()
|
|
45
|
+
url: Yup.string()
|
|
46
|
+
.url()
|
|
47
|
+
.required()
|
|
48
|
+
.test('file type', 'Imported file must be one of those extensions [ .jdx, .dx, .jcamp ]', (url) => {
|
|
49
|
+
try {
|
|
50
|
+
const fileURL = new URL(url);
|
|
51
|
+
const extension = fileURL.pathname.split('.')?.[1] || '';
|
|
52
|
+
if (allowedExtensions.has(extension)) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}),
|
|
46
61
|
});
|
|
47
62
|
const labelStyle = {
|
|
48
63
|
wrapper: { display: 'flex', height: '100%', flex: 1 },
|
|
@@ -54,34 +69,32 @@ function LoadJCAMPModal({ onCloseDialog, isOpen }) {
|
|
|
54
69
|
if (!isOpen)
|
|
55
70
|
return;
|
|
56
71
|
async function loadJCAMPHandler({ url }) {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
alert.error(`Failed to load ${url}`);
|
|
72
|
-
}
|
|
73
|
-
finally {
|
|
74
|
-
hidLoading();
|
|
75
|
-
onCloseDialog?.();
|
|
76
|
-
}
|
|
72
|
+
const hidLoading = await alert.showLoading('Load JCAMP from external URL in progress ...');
|
|
73
|
+
const { pathname, origin } = new URL(url);
|
|
74
|
+
try {
|
|
75
|
+
const nmriumState = await (0, nmr_load_save_1.readFromWebSource)({
|
|
76
|
+
entries: [{ relativePath: pathname, baseURL: origin }],
|
|
77
|
+
});
|
|
78
|
+
dispatch({
|
|
79
|
+
type: 'LOAD_DROP_FILES',
|
|
80
|
+
payload: { nmriumState, resetSourceObject: false },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
alert.error(`Failed to load ${url}`);
|
|
77
85
|
}
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
finally {
|
|
87
|
+
hidLoading();
|
|
88
|
+
onCloseDialog?.();
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
|
-
return ((0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: true, onRequestClose: onCloseDialog, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: "Load JCAMP Dialog" }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)("div", { style: { minWidth: '400px', padding: '1.5em' }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: { url: '' }, validationSchema: loadFormValidation, onSubmit: loadJCAMPHandler, innerRef: ref, children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "URL", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "url", type: "string", style: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: true, onRequestClose: onCloseDialog, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: "Load JCAMP Dialog" }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)("div", { style: { minWidth: '400px', padding: '1.5em' }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: { url: '' }, validationSchema: loadFormValidation, onSubmit: loadJCAMPHandler, innerRef: ref, children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "URL", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikError_1.default, { name: "url", style: { container: { flex: 1 } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "url", type: "string", style: {
|
|
92
|
+
input: {
|
|
93
|
+
padding: '0.8em',
|
|
94
|
+
textAlign: 'left',
|
|
95
|
+
width: '100%',
|
|
96
|
+
},
|
|
97
|
+
inputWrapper: { width: '100%' },
|
|
98
|
+
}, placeholder: "Enter URL to JCAMP-DX file" }) }) }) }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Footer, { children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'row-reverse' }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => ref.current?.submitForm(), children: "Load" }) }) })] }));
|
|
86
99
|
}
|
|
87
100
|
exports.LoadJCAMPModal = LoadJCAMPModal;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.LogsHistoryModal = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const fa_1 = require("react-icons/fa");
|
|
@@ -53,9 +53,10 @@ function getMaxLevelLogs(logs, lastReadLogId) {
|
|
|
53
53
|
}
|
|
54
54
|
return { backgroundColor, count: logsCounts[maxLevel] };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function LogsHistoryModal(props) {
|
|
57
|
+
const { autoOpen = false, onClose } = props;
|
|
57
58
|
const { logsHistory, logger, markAsRead, lastReadLogId } = (0, LoggerContext_1.useLogger)();
|
|
58
|
-
const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(
|
|
59
|
+
const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(autoOpen);
|
|
59
60
|
const { count, backgroundColor } = getMaxLevelLogs(logsHistory, lastReadLogId);
|
|
60
61
|
const COLUMNS = (0, react_1.useMemo)(() => [
|
|
61
62
|
{
|
|
@@ -94,7 +95,7 @@ function LogsHistory() {
|
|
|
94
95
|
},
|
|
95
96
|
], [lastReadLogId]);
|
|
96
97
|
const sortedLogs = logsHistory.slice().sort((a, b) => b.time - a.time);
|
|
97
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: () => {
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!autoOpen && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: () => {
|
|
98
99
|
openDialog();
|
|
99
100
|
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative' }, children: [(0, jsx_runtime_1.jsx)(io5_1.IoBugOutline, { fontSize: "1.4em" }), count && ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
100
101
|
position: 'absolute',
|
|
@@ -105,9 +106,10 @@ function LogsHistory() {
|
|
|
105
106
|
minWidth: '14px',
|
|
106
107
|
fontSize: '0.75em',
|
|
107
108
|
color: 'white',
|
|
108
|
-
}, children: count }))] }) }), (0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
|
|
109
|
+
}, children: count }))] }) })), (0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
|
|
109
110
|
markAsRead();
|
|
110
111
|
closeDialog();
|
|
112
|
+
onClose?.();
|
|
111
113
|
}, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: "Logs History " }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)("div", { style: { width: '50vw', height: '50vh', padding: '0.5em' }, children: (0, jsx_runtime_1.jsx)(ReactTable_1.default, { columns: COLUMNS, data: sortedLogs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Footer, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Danger, { onClick: () => logger.clear(), fill: "outline", children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '5px' }, children: "Clear Logs" })] }) }) })] })] }));
|
|
112
114
|
}
|
|
113
|
-
exports.
|
|
115
|
+
exports.LogsHistoryModal = LogsHistoryModal;
|