@jfvilas/plugin-kwirth-log 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/api/KwirthLogClient.esm.js +65 -0
- package/dist/api/KwirthLogClient.esm.js.map +1 -0
- package/dist/api/types.esm.js +8 -0
- package/dist/api/types.esm.js.map +1 -0
- package/dist/assets/kwirth-log-component-not-found.svg +32 -0
- package/dist/assets/kwirthlog-logo.svg +23 -0
- package/dist/components/ClusterList/ClusterList.esm.js +30 -0
- package/dist/components/ClusterList/ClusterList.esm.js.map +1 -0
- package/dist/components/ComponentNotFound/ComponentNotFound.esm.js +60 -0
- package/dist/components/ComponentNotFound/ComponentNotFound.esm.js.map +1 -0
- package/dist/components/EntityKwirthLogContent/EntityKwirthLogContent.esm.js +304 -0
- package/dist/components/EntityKwirthLogContent/EntityKwirthLogContent.esm.js.map +1 -0
- package/dist/components/EntityKwirthLogContent/index.esm.js +2 -0
- package/dist/components/EntityKwirthLogContent/index.esm.js.map +1 -0
- package/dist/components/ObjectSelector/ObjectSelector.esm.js +84 -0
- package/dist/components/ObjectSelector/ObjectSelector.esm.js.map +1 -0
- package/dist/components/Options/Options.esm.js +20 -0
- package/dist/components/Options/Options.esm.js.map +1 -0
- package/dist/components/ShowError/ShowError.esm.js +20 -0
- package/dist/components/ShowError/ShowError.esm.js.map +1 -0
- package/dist/components/StatusLog/StatusLog.esm.js +10 -0
- package/dist/components/StatusLog/StatusLog.esm.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.esm.js +4 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/plugin.esm.js +33 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +8 -0
- package/dist/routes.esm.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
|
+
import useAsync from 'react-use/esm/useAsync';
|
|
3
|
+
import { Progress, WarningPanel } from '@backstage/core-components';
|
|
4
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import { isKwirthAvailable, ANNOTATION_KWIRTH_LOCATION } from '@jfvilas/plugin-kwirth-common';
|
|
6
|
+
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
7
|
+
import { kwirthLogApiRef } from '../../api/types.esm.js';
|
|
8
|
+
import { SignalMessageLevelEnum, InstanceConfigScopeEnum, InstanceMessageTypeEnum, InstanceConfigChannelEnum, InstanceConfigViewEnum, accessKeySerialize, InstanceConfigFlowEnum, InstanceConfigActionEnum, InstanceConfigObjectEnum } from '@jfvilas/kwirth-common';
|
|
9
|
+
import { ComponentNotFound, ErrorType } from '../ComponentNotFound/ComponentNotFound.esm.js';
|
|
10
|
+
import { Options } from '../Options/Options.esm.js';
|
|
11
|
+
import { ClusterList } from '../ClusterList/ClusterList.esm.js';
|
|
12
|
+
import { ShowError } from '../ShowError/ShowError.esm.js';
|
|
13
|
+
import { StatusLog } from '../StatusLog/StatusLog.esm.js';
|
|
14
|
+
import { Grid, Card, CardHeader, CardContent } from '@material-ui/core';
|
|
15
|
+
import Divider from '@material-ui/core/Divider';
|
|
16
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
17
|
+
import Typography from '@material-ui/core/Typography';
|
|
18
|
+
import PlayIcon from '@material-ui/icons/PlayArrow';
|
|
19
|
+
import PauseIcon from '@material-ui/icons/Pause';
|
|
20
|
+
import StopIcon from '@material-ui/icons/Stop';
|
|
21
|
+
import InfoIcon from '@material-ui/icons/Info';
|
|
22
|
+
import WarningIcon from '@material-ui/icons/Warning';
|
|
23
|
+
import ErrorIcon from '@material-ui/icons/Error';
|
|
24
|
+
import DownloadIcon from '@material-ui/icons/CloudDownload';
|
|
25
|
+
import KwirthLogLogo from '../../assets/kwirthlog-logo.svg';
|
|
26
|
+
import { ObjectSelector } from '../ObjectSelector/ObjectSelector.esm.js';
|
|
27
|
+
|
|
28
|
+
const LOG_MAX_MESSAGES = 1e3;
|
|
29
|
+
const EntityKwirthLogContent = () => {
|
|
30
|
+
const { entity } = useEntity();
|
|
31
|
+
const kwirthLogApi = useApi(kwirthLogApiRef);
|
|
32
|
+
const [resources, setResources] = useState([]);
|
|
33
|
+
const [selectedClusterName, setSelectedClusterName] = useState("");
|
|
34
|
+
const [_namespaceList, setNamespaceList] = useState([]);
|
|
35
|
+
const [selectedNamespaces, setSelectedNamespaces] = useState([]);
|
|
36
|
+
const [selectedPodNames, setSelectedPodNames] = useState([]);
|
|
37
|
+
const [selectedContainerNames, setSelectedContainerNames] = useState([]);
|
|
38
|
+
const [showError, setShowError] = useState("");
|
|
39
|
+
const [started, setStarted] = useState(false);
|
|
40
|
+
const [stopped, setStopped] = useState(true);
|
|
41
|
+
const paused = useRef(false);
|
|
42
|
+
const [messages, setMessages] = useState([]);
|
|
43
|
+
const [pendingMessages, setPendingMessages] = useState([]);
|
|
44
|
+
const [statusMessages, setStatusMessages] = useState([]);
|
|
45
|
+
const [websocket, setWebsocket] = useState();
|
|
46
|
+
const kwirthLogOptionsRef = useRef({ timestamp: false, follow: true, fromStart: false });
|
|
47
|
+
const [showStatusDialog, setShowStatusDialog] = useState(false);
|
|
48
|
+
const [statusLevel, setStatusLevel] = useState(SignalMessageLevelEnum.INFO);
|
|
49
|
+
const preRef = useRef(null);
|
|
50
|
+
const lastRef = useRef(null);
|
|
51
|
+
const [backendVersion, setBackendVersion] = useState("");
|
|
52
|
+
const { loading, error } = useAsync(async () => {
|
|
53
|
+
if (backendVersion === "") setBackendVersion(await kwirthLogApi.getVersion());
|
|
54
|
+
var data = await kwirthLogApi.requestAccess(entity, "log", [InstanceConfigScopeEnum.VIEW, InstanceConfigScopeEnum.RESTART]);
|
|
55
|
+
setResources(data);
|
|
56
|
+
});
|
|
57
|
+
const clickStart = (options) => {
|
|
58
|
+
if (!paused.current) {
|
|
59
|
+
setStarted(true);
|
|
60
|
+
paused.current = false;
|
|
61
|
+
setStopped(false);
|
|
62
|
+
startLogViewer(options);
|
|
63
|
+
} else {
|
|
64
|
+
setMessages((prev) => [...prev, ...pendingMessages]);
|
|
65
|
+
setPendingMessages([]);
|
|
66
|
+
paused.current = false;
|
|
67
|
+
setStarted(true);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const clickPause = () => {
|
|
71
|
+
setStarted(false);
|
|
72
|
+
paused.current = true;
|
|
73
|
+
};
|
|
74
|
+
const clickStop = () => {
|
|
75
|
+
setStarted(false);
|
|
76
|
+
setStopped(true);
|
|
77
|
+
paused.current = false;
|
|
78
|
+
stopLogViewer();
|
|
79
|
+
};
|
|
80
|
+
const onSelectCluster = (name) => {
|
|
81
|
+
if (name) {
|
|
82
|
+
setSelectedClusterName(name);
|
|
83
|
+
resources.filter((cluster) => cluster.name === name).map((x) => {
|
|
84
|
+
var namespaces = Array.from(new Set(x.data.map((p) => p.namespace)));
|
|
85
|
+
setNamespaceList(namespaces);
|
|
86
|
+
});
|
|
87
|
+
setMessages([{
|
|
88
|
+
channel: InstanceConfigChannelEnum.LOG,
|
|
89
|
+
type: InstanceMessageTypeEnum.SIGNAL,
|
|
90
|
+
text: "Select namespace in order to decide which pod logs to view.",
|
|
91
|
+
instance: ""
|
|
92
|
+
}]);
|
|
93
|
+
setSelectedNamespaces([]);
|
|
94
|
+
setSelectedPodNames([]);
|
|
95
|
+
setSelectedContainerNames([]);
|
|
96
|
+
setStatusMessages([]);
|
|
97
|
+
clickStop();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const processLogMessage = (wsEvent) => {
|
|
101
|
+
let msg = JSON.parse(wsEvent.data);
|
|
102
|
+
switch (msg.type) {
|
|
103
|
+
case "data":
|
|
104
|
+
var lmsg = msg;
|
|
105
|
+
if (paused.current) {
|
|
106
|
+
setPendingMessages((prev) => [...prev, lmsg]);
|
|
107
|
+
} else {
|
|
108
|
+
setMessages((prev) => {
|
|
109
|
+
while (prev.length > LOG_MAX_MESSAGES - 1) {
|
|
110
|
+
prev.splice(0, 1);
|
|
111
|
+
}
|
|
112
|
+
if (kwirthLogOptionsRef.current.follow && lastRef.current) lastRef.current.scrollIntoView({ behavior: "instant", block: "start" });
|
|
113
|
+
return [...prev, lmsg];
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
case "signal":
|
|
118
|
+
let smsg = msg;
|
|
119
|
+
setStatusMessages((prev) => [...prev, smsg]);
|
|
120
|
+
break;
|
|
121
|
+
default:
|
|
122
|
+
console.log("Invalid message type:");
|
|
123
|
+
console.log(msg);
|
|
124
|
+
setStatusMessages((prev) => [...prev, {
|
|
125
|
+
channel: InstanceConfigChannelEnum.LOG,
|
|
126
|
+
type: InstanceMessageTypeEnum.SIGNAL,
|
|
127
|
+
level: SignalMessageLevelEnum.ERROR,
|
|
128
|
+
text: "Invalid message type received: " + msg.type,
|
|
129
|
+
instance: ""
|
|
130
|
+
}]);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const websocketOnMessage = (wsEvent) => {
|
|
135
|
+
let instanceMessage;
|
|
136
|
+
try {
|
|
137
|
+
instanceMessage = JSON.parse(wsEvent.data);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
console.log(err);
|
|
140
|
+
console.log(wsEvent.data);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
switch (instanceMessage.channel) {
|
|
144
|
+
case "log":
|
|
145
|
+
processLogMessage(wsEvent);
|
|
146
|
+
break;
|
|
147
|
+
default:
|
|
148
|
+
console.log("Invalid channel in message: ", instanceMessage);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const websocketOnOpen = (ws, options) => {
|
|
153
|
+
let cluster = resources.find((cluster2) => cluster2.name === selectedClusterName);
|
|
154
|
+
if (!cluster) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
let pods = cluster.data.filter((p2) => selectedNamespaces.includes(p2.namespace));
|
|
158
|
+
if (!pods) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
console.log(`WS connected`);
|
|
162
|
+
let accessKey = cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW);
|
|
163
|
+
if (accessKey) {
|
|
164
|
+
let containers = [];
|
|
165
|
+
if (selectedContainerNames.length > 0) {
|
|
166
|
+
for (var p of selectedPodNames) {
|
|
167
|
+
for (var c of selectedContainerNames) {
|
|
168
|
+
containers.push(p + "+" + c);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
let iConfig = {
|
|
173
|
+
channel: InstanceConfigChannelEnum.LOG,
|
|
174
|
+
objects: InstanceConfigObjectEnum.PODS,
|
|
175
|
+
action: InstanceConfigActionEnum.START,
|
|
176
|
+
flow: InstanceConfigFlowEnum.REQUEST,
|
|
177
|
+
instance: "",
|
|
178
|
+
accessKey: accessKeySerialize(accessKey),
|
|
179
|
+
scope: InstanceConfigScopeEnum.VIEW,
|
|
180
|
+
view: selectedContainerNames.length > 0 ? InstanceConfigViewEnum.CONTAINER : InstanceConfigViewEnum.POD,
|
|
181
|
+
namespace: selectedNamespaces.join(","),
|
|
182
|
+
group: "",
|
|
183
|
+
pod: selectedPodNames.map((p2) => p2).join(","),
|
|
184
|
+
container: containers.join(","),
|
|
185
|
+
data: {
|
|
186
|
+
timestamp: options.timestamp,
|
|
187
|
+
previous: false,
|
|
188
|
+
maxMessages: LOG_MAX_MESSAGES,
|
|
189
|
+
fromStart: options.fromStart
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
ws.send(JSON.stringify(iConfig));
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const startLogViewer = (options) => {
|
|
196
|
+
let cluster = resources.find((cluster2) => cluster2.name === selectedClusterName);
|
|
197
|
+
if (!cluster) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
setMessages([]);
|
|
201
|
+
try {
|
|
202
|
+
let ws = new WebSocket(cluster.url);
|
|
203
|
+
ws.onopen = () => websocketOnOpen(ws, options);
|
|
204
|
+
ws.onmessage = (event) => websocketOnMessage(event);
|
|
205
|
+
ws.onclose = (event) => websocketOnClose(event);
|
|
206
|
+
setWebsocket(ws);
|
|
207
|
+
} catch (err) {
|
|
208
|
+
setMessages([{
|
|
209
|
+
channel: InstanceConfigChannelEnum.LOG,
|
|
210
|
+
type: InstanceMessageTypeEnum.DATA,
|
|
211
|
+
text: `Error opening log stream: ${err}`,
|
|
212
|
+
instance: ""
|
|
213
|
+
}]);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const websocketOnClose = (_event) => {
|
|
217
|
+
console.log(`WS disconnected`);
|
|
218
|
+
setStarted(false);
|
|
219
|
+
paused.current = false;
|
|
220
|
+
setStopped(true);
|
|
221
|
+
};
|
|
222
|
+
const stopLogViewer = () => {
|
|
223
|
+
messages.push({
|
|
224
|
+
channel: InstanceConfigChannelEnum.LOG,
|
|
225
|
+
type: InstanceMessageTypeEnum.DATA,
|
|
226
|
+
text: "============================================================================================================================",
|
|
227
|
+
instance: ""
|
|
228
|
+
});
|
|
229
|
+
websocket?.close();
|
|
230
|
+
};
|
|
231
|
+
const onChangeLogConfig = (options) => {
|
|
232
|
+
kwirthLogOptionsRef.current = options;
|
|
233
|
+
if (started) {
|
|
234
|
+
clickStart(options);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const handleDownload = () => {
|
|
238
|
+
let content = preRef.current.innerHTML.replaceAll("<pre>", "").replaceAll("</pre>", "\n");
|
|
239
|
+
content = content.replaceAll('<span style="color: green;">', "");
|
|
240
|
+
content = content.replaceAll('<span style="color: blue;">', "");
|
|
241
|
+
content = content.replaceAll("</span>", "");
|
|
242
|
+
let filename = selectedClusterName + "-" + selectedNamespaces + "-" + entity.metadata.name + ".txt";
|
|
243
|
+
let mimeType = "text/plain";
|
|
244
|
+
const blob = new Blob([content], { type: mimeType });
|
|
245
|
+
const url = URL.createObjectURL(blob);
|
|
246
|
+
const link = document.createElement("a");
|
|
247
|
+
link.href = url;
|
|
248
|
+
link.download = filename;
|
|
249
|
+
document.body.appendChild(link);
|
|
250
|
+
link.click();
|
|
251
|
+
document.body.removeChild(link);
|
|
252
|
+
URL.revokeObjectURL(url);
|
|
253
|
+
};
|
|
254
|
+
const actionButtons = () => {
|
|
255
|
+
let hasViewKey = false;
|
|
256
|
+
let cluster = resources.find((cluster2) => cluster2.name === selectedClusterName);
|
|
257
|
+
if (cluster) hasViewKey = Boolean(cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW));
|
|
258
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(IconButton, { title: "Download", onClick: handleDownload, disabled: messages.length <= 1 }, /* @__PURE__ */ React.createElement(DownloadIcon, null)), /* @__PURE__ */ React.createElement(IconButton, { onClick: () => clickStart(kwirthLogOptionsRef.current), title: "Play", disabled: started || !paused || selectedPodNames.length === 0 || !hasViewKey }, /* @__PURE__ */ React.createElement(PlayIcon, null)), /* @__PURE__ */ React.createElement(IconButton, { onClick: clickPause, title: "Pause", disabled: !(started && !paused.current && selectedPodNames.length > 0) }, /* @__PURE__ */ React.createElement(PauseIcon, null)), /* @__PURE__ */ React.createElement(IconButton, { onClick: clickStop, title: "Stop", disabled: stopped || selectedPodNames.length === 0 }, /* @__PURE__ */ React.createElement(StopIcon, null)));
|
|
259
|
+
};
|
|
260
|
+
const statusButtons = (title) => {
|
|
261
|
+
const show = (level) => {
|
|
262
|
+
setShowStatusDialog(true);
|
|
263
|
+
setStatusLevel(level);
|
|
264
|
+
};
|
|
265
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "row" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, title)), /* @__PURE__ */ React.createElement(Grid, { item: true, style: { marginTop: "-8px" } }, /* @__PURE__ */ React.createElement(IconButton, { title: "info", disabled: !statusMessages.some((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === SignalMessageLevelEnum.INFO), onClick: () => show(SignalMessageLevelEnum.INFO) }, /* @__PURE__ */ React.createElement(InfoIcon, { style: { color: statusMessages.some((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === SignalMessageLevelEnum.INFO) ? "blue" : "#BDBDBD" } })), /* @__PURE__ */ React.createElement(IconButton, { title: "warning", disabled: !statusMessages.some((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === SignalMessageLevelEnum.WARNING), onClick: () => show(SignalMessageLevelEnum.WARNING), style: { marginLeft: "-16px" } }, /* @__PURE__ */ React.createElement(WarningIcon, { style: { color: statusMessages.some((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === SignalMessageLevelEnum.WARNING) ? "gold" : "#BDBDBD" } })), /* @__PURE__ */ React.createElement(IconButton, { title: "error", disabled: !statusMessages.some((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === SignalMessageLevelEnum.ERROR), onClick: () => show(SignalMessageLevelEnum.ERROR), style: { marginLeft: "-16px" } }, /* @__PURE__ */ React.createElement(ErrorIcon, { style: { color: statusMessages.some((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === SignalMessageLevelEnum.ERROR) ? "red" : "#BDBDBD" } }))));
|
|
266
|
+
};
|
|
267
|
+
const statusClear = (level) => {
|
|
268
|
+
setStatusMessages(statusMessages.filter((m) => m.level !== level));
|
|
269
|
+
setShowStatusDialog(false);
|
|
270
|
+
};
|
|
271
|
+
const onSelectObject = (namespaces, podNames, containerNames) => {
|
|
272
|
+
console.log(namespaces);
|
|
273
|
+
console.log(podNames);
|
|
274
|
+
console.log(containerNames);
|
|
275
|
+
setSelectedNamespaces(namespaces);
|
|
276
|
+
setSelectedPodNames(podNames);
|
|
277
|
+
setSelectedContainerNames(containerNames);
|
|
278
|
+
};
|
|
279
|
+
const formatMessage = (m) => {
|
|
280
|
+
if (!m.pod) {
|
|
281
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, m.text + "\n");
|
|
282
|
+
}
|
|
283
|
+
let podPrefix = /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
284
|
+
if (selectedPodNames.length !== 1) {
|
|
285
|
+
podPrefix = /* @__PURE__ */ React.createElement("span", { style: { color: "green" } }, m.pod + " ");
|
|
286
|
+
}
|
|
287
|
+
let containerPrefix = /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
288
|
+
if (selectedContainerNames.length !== 1) {
|
|
289
|
+
containerPrefix = /* @__PURE__ */ React.createElement("span", { style: { color: "blue" } }, m.container + " ");
|
|
290
|
+
}
|
|
291
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, podPrefix, containerPrefix, m.text + "\n");
|
|
292
|
+
};
|
|
293
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, showError !== "" && /* @__PURE__ */ React.createElement(ShowError, { message: showError, onClose: () => setShowError("") }), loading && /* @__PURE__ */ React.createElement(Progress, null), !isKwirthAvailable(entity) && !loading && error && /* @__PURE__ */ React.createElement(WarningPanel, { title: "An error has ocurred while obtaining data from kuebernetes clusters.", message: error?.message }), !isKwirthAvailable(entity) && !loading && /* @__PURE__ */ React.createElement(MissingAnnotationEmptyState, { readMoreUrl: "https://github.com/jfvilas/kubelog", annotation: ANNOTATION_KWIRTH_LOCATION }), isKwirthAvailable(entity) && !loading && resources && resources.length === 0 && /* @__PURE__ */ React.createElement(ComponentNotFound, { error: ErrorType.NO_CLUSTERS, entity }), isKwirthAvailable(entity) && !loading && resources && resources.length > 0 && resources.reduce((sum, cluster) => sum + cluster.data.length, 0) === 0 && /* @__PURE__ */ React.createElement(ComponentNotFound, { error: ErrorType.NO_PODS, entity }), isKwirthAvailable(entity) && !loading && resources && resources.length > 0 && resources.reduce((sum, cluster) => sum + cluster.data.length, 0) > 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "row", spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { container: true, item: true, xs: 2, direction: "column", spacing: 3 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(ClusterList, { resources, selectedClusterName, onSelect: onSelectCluster }))), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(Options, { options: kwirthLogOptionsRef.current, onChange: onChangeLogConfig, disabled: selectedContainerNames.length === 0 || started || paused.current })))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 10 }, !selectedClusterName && /* @__PURE__ */ React.createElement("img", { src: KwirthLogLogo, alt: "No cluster selected", style: { left: "40%", marginTop: "10%", width: "20%", position: "relative" } }), selectedClusterName && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Card, { style: { maxHeight: "75vh" } }, /* @__PURE__ */ React.createElement(
|
|
294
|
+
CardHeader,
|
|
295
|
+
{
|
|
296
|
+
title: statusButtons(selectedClusterName),
|
|
297
|
+
style: { marginTop: -4, marginBottom: 4, flexShrink: 0 },
|
|
298
|
+
action: actionButtons()
|
|
299
|
+
}
|
|
300
|
+
), /* @__PURE__ */ React.createElement(Typography, { style: { marginLeft: 16, marginBottom: 4 } }, /* @__PURE__ */ React.createElement(ObjectSelector, { cluster: resources.find((cluster) => cluster.name === selectedClusterName), onSelect: onSelectObject, disabled: selectedClusterName === "" || started || paused.current, selectedNamespaces, selectedPodNames, selectedContainerNames })), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(CardContent, { style: { overflow: "auto" } }, /* @__PURE__ */ React.createElement("pre", { ref: preRef }, messages.map((m) => formatMessage(m))), /* @__PURE__ */ React.createElement("span", { ref: lastRef })))))), showStatusDialog && /* @__PURE__ */ React.createElement(StatusLog, { level: statusLevel, onClose: () => setShowStatusDialog(false), statusMessages, onClear: statusClear }));
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export { EntityKwirthLogContent };
|
|
304
|
+
//# sourceMappingURL=EntityKwirthLogContent.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityKwirthLogContent.esm.js","sources":["../../../src/components/EntityKwirthLogContent/EntityKwirthLogContent.tsx"],"sourcesContent":["/*\r\nCopyright 2024 Julio Fernandez\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\nimport React, { useRef, useState } from 'react'\r\nimport useAsync from 'react-use/esm/useAsync'\r\n\r\nimport { Progress, WarningPanel } from '@backstage/core-components'\r\nimport { useApi } from '@backstage/core-plugin-api'\r\nimport { ANNOTATION_KWIRTH_LOCATION, isKwirthAvailable, ClusterValidPods } from '@jfvilas/plugin-kwirth-common'\r\nimport { MissingAnnotationEmptyState, useEntity } from '@backstage/plugin-catalog-react'\r\n\r\n// kwirthlog\r\nimport { kwirthLogApiRef } from '../../api'\r\nimport { accessKeySerialize, LogMessage, InstanceConfigActionEnum, InstanceConfigChannelEnum, InstanceConfigFlowEnum, InstanceConfigScopeEnum, InstanceConfigViewEnum, InstanceMessage, InstanceMessageTypeEnum, SignalMessage, SignalMessageLevelEnum, InstanceConfigObjectEnum, InstanceConfig } from '@jfvilas/kwirth-common'\r\n\r\n// kwirthlog components\r\nimport { ComponentNotFound, ErrorType } from '../ComponentNotFound'\r\nimport { Options } from '../Options'\r\nimport { ClusterList } from '../ClusterList'\r\nimport { ShowError } from '../ShowError'\r\nimport { StatusLog } from '../StatusLog'\r\n\r\n\r\n// Material-UI\r\nimport { Grid } from '@material-ui/core'\r\nimport { Card, CardHeader, CardContent } from '@material-ui/core'\r\nimport Divider from '@material-ui/core/Divider'\r\nimport IconButton from '@material-ui/core/IconButton'\r\nimport Typography from '@material-ui/core/Typography'\r\n\r\n// Icons\r\nimport PlayIcon from '@material-ui/icons/PlayArrow'\r\nimport PauseIcon from '@material-ui/icons/Pause'\r\nimport StopIcon from '@material-ui/icons/Stop'\r\nimport InfoIcon from '@material-ui/icons/Info'\r\nimport WarningIcon from '@material-ui/icons/Warning'\r\nimport ErrorIcon from '@material-ui/icons/Error'\r\nimport DownloadIcon from '@material-ui/icons/CloudDownload'\r\nimport KwirthLogLogo from '../../assets/kwirthlog-logo.svg'\r\nimport { ObjectSelector } from '../ObjectSelector'\r\n\r\nconst LOG_MAX_MESSAGES=1000;\r\n\r\nexport const EntityKwirthLogContent = () => { \r\n const { entity } = useEntity()\r\n const kwirthLogApi = useApi(kwirthLogApiRef)\r\n const [resources, setResources] = useState<ClusterValidPods[]>([])\r\n const [selectedClusterName, setSelectedClusterName] = useState('')\r\n const [_namespaceList, setNamespaceList] = useState<string[]>([]) //+++\r\n const [selectedNamespaces, setSelectedNamespaces] = useState<string[]>([])\r\n const [selectedPodNames, setSelectedPodNames] = useState<string[]>([])\r\n const [selectedContainerNames, setSelectedContainerNames] = useState<string[]>([])\r\n const [showError, setShowError] = useState('') //+++ review if this is needed once we have errorMessages\r\n const [started, setStarted] = useState(false)\r\n const [stopped, setStopped] = useState(true)\r\n const paused=useRef<boolean>(false)\r\n const [messages, setMessages] = useState<LogMessage[]>([])\r\n const [pendingMessages, setPendingMessages] = useState<LogMessage[]>([])\r\n const [statusMessages, setStatusMessages] = useState<SignalMessage[]>([])\r\n const [websocket, setWebsocket] = useState<WebSocket>()\r\n const kwirthLogOptionsRef = useRef<any>({timestamp:false, follow:true, fromStart:false})\r\n const [showStatusDialog, setShowStatusDialog] = useState(false)\r\n const [statusLevel, setStatusLevel] = useState<SignalMessageLevelEnum>(SignalMessageLevelEnum.INFO)\r\n const preRef = useRef<HTMLPreElement|null>(null)\r\n const lastRef = useRef<HTMLPreElement|null>(null)\r\n const [ backendVersion, setBackendVersion ] = useState<string>('')\r\n const { loading, error } = useAsync ( async () => {\r\n if (backendVersion==='') setBackendVersion(await kwirthLogApi.getVersion())\r\n var data = await kwirthLogApi.requestAccess(entity,'log', [InstanceConfigScopeEnum.VIEW,InstanceConfigScopeEnum.RESTART])\r\n setResources(data)\r\n })\r\n\r\n const clickStart = (options:any) => {\r\n if (!paused.current) {\r\n setStarted(true)\r\n paused.current=false\r\n setStopped(false)\r\n startLogViewer(options)\r\n }\r\n else {\r\n setMessages( (prev) => [ ...prev, ...pendingMessages])\r\n setPendingMessages([])\r\n paused.current=false\r\n setStarted(true)\r\n }\r\n }\r\n\r\n const clickPause = () => {\r\n setStarted(false)\r\n paused.current=true\r\n }\r\n\r\n const clickStop = () => {\r\n setStarted(false)\r\n setStopped(true)\r\n paused.current=false\r\n stopLogViewer()\r\n }\r\n\r\n const onSelectCluster = (name:string|undefined) => {\r\n if (name) {\r\n setSelectedClusterName(name)\r\n resources.filter(cluster => cluster.name===name).map ( x => {\r\n var namespaces=Array.from(new Set(x.data.map ( (p:any) => p.namespace))) as string[]\r\n setNamespaceList(namespaces)\r\n })\r\n setMessages([{\r\n channel: InstanceConfigChannelEnum.LOG,\r\n type: InstanceMessageTypeEnum.SIGNAL,\r\n text: 'Select namespace in order to decide which pod logs to view.',\r\n instance: ''\r\n }])\r\n setSelectedNamespaces([])\r\n setSelectedPodNames([])\r\n setSelectedContainerNames([])\r\n setStatusMessages([])\r\n clickStop()\r\n }\r\n }\r\n\r\n const processLogMessage = (wsEvent:any) => {\r\n let msg = JSON.parse(wsEvent.data) as InstanceMessage\r\n switch (msg.type) {\r\n case 'data':\r\n var lmsg = msg as LogMessage\r\n if (paused.current) {\r\n setPendingMessages((prev) => [ ...prev, lmsg ])\r\n }\r\n else {\r\n setMessages((prev) => {\r\n while (prev.length>LOG_MAX_MESSAGES-1) {\r\n prev.splice(0,1)\r\n }\r\n if (kwirthLogOptionsRef.current.follow && lastRef.current) lastRef.current.scrollIntoView({ behavior: 'instant', block: 'start' })\r\n return [ ...prev, lmsg ]\r\n })\r\n } \r\n break\r\n case 'signal':\r\n let smsg = msg as SignalMessage\r\n setStatusMessages ((prev) => [...prev, smsg])\r\n break\r\n default:\r\n console.log('Invalid message type:')\r\n console.log(msg)\r\n setStatusMessages ((prev) => [...prev, {\r\n channel: InstanceConfigChannelEnum.LOG,\r\n type: InstanceMessageTypeEnum.SIGNAL,\r\n level: SignalMessageLevelEnum.ERROR,\r\n text: 'Invalid message type received: '+msg.type,\r\n instance: ''\r\n }])\r\n break\r\n }\r\n }\r\n \r\n const websocketOnMessage = (wsEvent:any) => {\r\n let instanceMessage:InstanceMessage\r\n try {\r\n instanceMessage = JSON.parse(wsEvent.data) as InstanceMessage\r\n }\r\n catch (err) {\r\n console.log(err)\r\n console.log(wsEvent.data)\r\n return\r\n }\r\n\r\n switch(instanceMessage.channel) {\r\n case 'log':\r\n processLogMessage(wsEvent)\r\n break\r\n default:\r\n console.log('Invalid channel in message: ', instanceMessage)\r\n break\r\n }\r\n\r\n }\r\n\r\n const websocketOnOpen = (ws:WebSocket, options:any) => {\r\n let cluster=resources.find(cluster => cluster.name === selectedClusterName)\r\n if (!cluster) {\r\n //+++ setShowError(msg.text);\r\n return\r\n }\r\n let pods = cluster.data.filter(p => selectedNamespaces.includes(p.namespace))\r\n if (!pods) {\r\n //+++ setShowError(msg.text);\r\n return\r\n }\r\n console.log(`WS connected`)\r\n let accessKey = cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW)\r\n if (accessKey) {\r\n let containers:string[] = []\r\n if (selectedContainerNames.length>0) {\r\n for(var p of selectedPodNames) {\r\n for (var c of selectedContainerNames) {\r\n containers.push(p+'+'+c)\r\n }\r\n }\r\n }\r\n let iConfig:InstanceConfig = {\r\n channel: InstanceConfigChannelEnum.LOG,\r\n objects: InstanceConfigObjectEnum.PODS,\r\n action: InstanceConfigActionEnum.START,\r\n flow: InstanceConfigFlowEnum.REQUEST,\r\n instance: '',\r\n accessKey: accessKeySerialize(accessKey),\r\n scope: InstanceConfigScopeEnum.VIEW,\r\n view: (selectedContainerNames.length>0 ? InstanceConfigViewEnum.CONTAINER : InstanceConfigViewEnum.POD),\r\n namespace: selectedNamespaces.join(','),\r\n group: '',\r\n pod: selectedPodNames.map(p => p).join(','),\r\n container: containers.join(','),\r\n data: {\r\n timestamp: options.timestamp,\r\n previous: false,\r\n maxMessages: LOG_MAX_MESSAGES,\r\n fromStart: options.fromStart\r\n }\r\n }\r\n ws.send(JSON.stringify(iConfig))\r\n }\r\n else {\r\n // +++ error to user\r\n }\r\n }\r\n\r\n const startLogViewer = (options:any) => {\r\n let cluster=resources.find(cluster => cluster.name===selectedClusterName);\r\n if (!cluster) {\r\n //+++ show wargning\r\n return\r\n }\r\n\r\n setMessages([])\r\n try {\r\n let ws = new WebSocket(cluster.url)\r\n ws.onopen = () => websocketOnOpen(ws, options)\r\n ws.onmessage = (event) => websocketOnMessage(event)\r\n ws.onclose = (event) => websocketOnClose(event)\r\n setWebsocket(ws)\r\n }\r\n catch (err) {\r\n setMessages([ {\r\n channel: InstanceConfigChannelEnum.LOG,\r\n type: InstanceMessageTypeEnum.DATA,\r\n text: `Error opening log stream: ${err}`,\r\n instance: ''\r\n } ])\r\n }\r\n\r\n }\r\n\r\n const websocketOnClose = (_event:any) => {\r\n console.log(`WS disconnected`)\r\n setStarted(false)\r\n paused.current=false\r\n setStopped(true)\r\n }\r\n\r\n const stopLogViewer = () => {\r\n messages.push({\r\n channel: InstanceConfigChannelEnum.LOG,\r\n type: InstanceMessageTypeEnum.DATA,\r\n text: '============================================================================================================================',\r\n instance: ''\r\n })\r\n websocket?.close()\r\n }\r\n\r\n const onChangeLogConfig = (options:any) => {\r\n kwirthLogOptionsRef.current=options\r\n if (started) {\r\n clickStart(options)\r\n }\r\n }\r\n\r\n const handleDownload = () => {\r\n let content = preRef.current!.innerHTML.replaceAll('<pre>','').replaceAll('</pre>','\\n')\r\n content = content.replaceAll('<span style=\"color: green;\">','')\r\n content = content.replaceAll('<span style=\"color: blue;\">','')\r\n content = content.replaceAll('</span>','')\r\n let filename = selectedClusterName+'-'+selectedNamespaces+'-'+entity.metadata.name+'.txt'\r\n let mimeType:string = 'text/plain'\r\n \r\n const blob = new Blob([content], { type: mimeType })\r\n const url = URL.createObjectURL(blob)\r\n const link = document.createElement('a')\r\n link.href = url\r\n link.download = filename\r\n document.body.appendChild(link)\r\n link.click()\r\n document.body.removeChild(link)\r\n URL.revokeObjectURL(url)\r\n }\r\n \r\n const actionButtons = () => {\r\n let hasViewKey=false\r\n let cluster=resources.find(cluster => cluster.name===selectedClusterName)\r\n if (cluster) hasViewKey = Boolean(cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW))\r\n\r\n return <>\r\n <IconButton title='Download' onClick={handleDownload} disabled={messages.length<=1}>\r\n <DownloadIcon />\r\n </IconButton>\r\n <IconButton onClick={() => clickStart(kwirthLogOptionsRef.current)} title=\"Play\" disabled={started || !paused || selectedPodNames.length === 0 || !hasViewKey}>\r\n <PlayIcon />\r\n </IconButton>\r\n <IconButton onClick={clickPause} title=\"Pause\" disabled={!((started && !paused.current) && selectedPodNames.length > 0)}>\r\n <PauseIcon />\r\n </IconButton>\r\n <IconButton onClick={clickStop} title=\"Stop\" disabled={stopped || selectedPodNames.length === 0}>\r\n <StopIcon />\r\n </IconButton>\r\n </>\r\n }\r\n\r\n const statusButtons = (title:string) => {\r\n const show = (level:SignalMessageLevelEnum) => {\r\n setShowStatusDialog(true)\r\n setStatusLevel(level)\r\n }\r\n\r\n return (\r\n <Grid container direction='row' >\r\n <Grid item>\r\n <Typography variant='h5'>{title}</Typography>\r\n </Grid>\r\n <Grid item style={{marginTop:'-8px'}}>\r\n <IconButton title=\"info\" disabled={!statusMessages.some(m=>m.type === InstanceMessageTypeEnum.SIGNAL && m.level=== SignalMessageLevelEnum.INFO)} onClick={() => show(SignalMessageLevelEnum.INFO)}>\r\n <InfoIcon style={{ color:statusMessages.some(m=>m.type === InstanceMessageTypeEnum.SIGNAL && m.level=== SignalMessageLevelEnum.INFO)?'blue':'#BDBDBD'}}/>\r\n </IconButton>\r\n <IconButton title=\"warning\" disabled={!statusMessages.some(m=>m.type === InstanceMessageTypeEnum.SIGNAL && m.level=== SignalMessageLevelEnum.WARNING)} onClick={() => show(SignalMessageLevelEnum.WARNING)} style={{marginLeft:'-16px'}}>\r\n <WarningIcon style={{ color:statusMessages.some(m=>m.type === InstanceMessageTypeEnum.SIGNAL && m.level=== SignalMessageLevelEnum.WARNING)?'gold':'#BDBDBD'}}/>\r\n </IconButton>\r\n <IconButton title=\"error\" disabled={!statusMessages.some(m=>m.type === InstanceMessageTypeEnum.SIGNAL && m.level=== SignalMessageLevelEnum.ERROR)} onClick={() => show(SignalMessageLevelEnum.ERROR)} style={{marginLeft:'-16px'}}>\r\n <ErrorIcon style={{ color:statusMessages.some(m=>m.type === InstanceMessageTypeEnum.SIGNAL && m.level=== SignalMessageLevelEnum.ERROR)?'red':'#BDBDBD'}}/>\r\n </IconButton>\r\n </Grid>\r\n </Grid>\r\n )\r\n }\r\n\r\n const statusClear = (level: SignalMessageLevelEnum) => {\r\n setStatusMessages(statusMessages.filter(m=> m.level!==level))\r\n setShowStatusDialog(false)\r\n }\r\n \r\n const onSelectObject = (namespaces:string[], podNames:string[], containerNames:string[]) => {\r\n console.log(namespaces)\r\n console.log(podNames)\r\n console.log(containerNames)\r\n setSelectedNamespaces(namespaces)\r\n setSelectedPodNames(podNames)\r\n setSelectedContainerNames(containerNames)\r\n }\r\n\r\n const formatMessage = (m:LogMessage) => {\r\n if (!m.pod) {\r\n return <>{m.text+'\\n'}</>\r\n }\r\n\r\n let podPrefix = <></>\r\n if (selectedPodNames.length !== 1) {\r\n podPrefix = <span style={{color:\"green\"}}>{m.pod+' '}</span>\r\n }\r\n\r\n let containerPrefix = <></>\r\n if (selectedContainerNames.length !== 1){\r\n containerPrefix = <span style={{color:\"blue\"}}>{m.container+' '}</span>\r\n }\r\n return <>{podPrefix}{containerPrefix}{m.text+'\\n'}</>\r\n }\r\n\r\n return (<>\r\n { showError!=='' && <ShowError message={showError} onClose={() => setShowError('')}/> }\r\n\r\n { loading && <Progress/> }\r\n\r\n {!isKwirthAvailable(entity) && !loading && error && (\r\n <WarningPanel title={'An error has ocurred while obtaining data from kuebernetes clusters.'} message={error?.message} />\r\n )}\r\n\r\n {!isKwirthAvailable(entity) && !loading && (\r\n <MissingAnnotationEmptyState readMoreUrl='https://github.com/jfvilas/kubelog' annotation={ANNOTATION_KWIRTH_LOCATION}/>\r\n )}\r\n\r\n { isKwirthAvailable(entity) && !loading && resources && resources.length===0 &&\r\n <ComponentNotFound error={ErrorType.NO_CLUSTERS} entity={entity}/>\r\n }\r\n\r\n { isKwirthAvailable(entity) && !loading && resources && resources.length>0 && resources.reduce((sum,cluster) => sum+cluster.data.length, 0)===0 &&\r\n <ComponentNotFound error={ErrorType.NO_PODS} entity={entity}/>\r\n }\r\n\r\n { isKwirthAvailable(entity) && !loading && resources && resources.length>0 && resources.reduce((sum,cluster) => sum+cluster.data.length, 0)>0 &&\r\n <Grid container direction='row' spacing={3}>\r\n <Grid container item xs={2} direction='column' spacing={3}>\r\n <Grid item>\r\n <Card>\r\n <ClusterList resources={resources} selectedClusterName={selectedClusterName} onSelect={onSelectCluster}/>\r\n </Card>\r\n </Grid>\r\n <Grid item>\r\n <Card>\r\n <Options options={kwirthLogOptionsRef.current} onChange={onChangeLogConfig} disabled={selectedContainerNames.length === 0 || started || paused.current}/>\r\n </Card>\r\n </Grid>\r\n </Grid>\r\n\r\n <Grid item xs={10}>\r\n\r\n { !selectedClusterName && \r\n <img src={KwirthLogLogo} alt='No cluster selected' style={{ left:'40%', marginTop:'10%', width:'20%', position:'relative' }} />\r\n }\r\n\r\n { selectedClusterName && <>\r\n <Card style={{ maxHeight:'75vh'}}>\r\n <CardHeader\r\n title={statusButtons(selectedClusterName)}\r\n style={{marginTop:-4, marginBottom:4, flexShrink:0}}\r\n action={actionButtons()}\r\n />\r\n \r\n <Typography style={{marginLeft:16, marginBottom:4}}>\r\n <ObjectSelector cluster={resources.find(cluster => cluster.name === selectedClusterName)!} onSelect={onSelectObject} disabled={selectedClusterName === '' || started || paused.current} selectedNamespaces={selectedNamespaces} selectedPodNames={selectedPodNames} selectedContainerNames={selectedContainerNames}/>\r\n </Typography>\r\n <Divider/>\r\n <CardContent style={{ overflow: 'auto' }}>\r\n <pre ref={preRef}>\r\n { messages.map (m => formatMessage(m)) }\r\n </pre>\r\n <span ref={lastRef}></span>\r\n </CardContent>\r\n </Card>\r\n </>}\r\n\r\n </Grid>\r\n </Grid>\r\n }\r\n\r\n { showStatusDialog && <StatusLog level={statusLevel} onClose={() => setShowStatusDialog(false)} statusMessages={statusMessages} onClear={statusClear}/>}\r\n </>)\r\n}\r\n"],"names":["cluster","p"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,gBAAiB,GAAA,GAAA;AAEhB,MAAM,yBAAyB,MAAM;AACxC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,YAAA,GAAe,OAAO,eAAe,CAAA;AAC3C,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,QAAA,CAA6B,EAAE,CAAA;AACjE,EAAA,MAAM,CAAC,mBAAA,EAAqB,sBAAsB,CAAA,GAAI,SAAS,EAAE,CAAA;AACjE,EAAA,MAAM,CAAC,cAAgB,EAAA,gBAAgB,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;AAChE,EAAA,MAAM,CAAC,kBAAoB,EAAA,qBAAqB,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;AACzE,EAAA,MAAM,CAAC,gBAAkB,EAAA,mBAAmB,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;AACrE,EAAA,MAAM,CAAC,sBAAwB,EAAA,yBAAyB,CAAI,GAAA,QAAA,CAAmB,EAAE,CAAA;AACjF,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI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AU,QAC5B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,GAAA,EAAK,UACJ,QAAS,CAAA,GAAA,CAAK,CAAK,CAAA,KAAA,aAAA,CAAc,CAAC,CAAC,CACzC,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAK,GAAK,EAAA,OAAA,EAAS,CACxB,CACJ,CACJ,CAEJ,CACJ,CAGF,EAAA,gBAAA,wCAAqB,SAAU,EAAA,EAAA,KAAA,EAAO,WAAa,EAAA,OAAA,EAAS,MAAM,mBAAoB,CAAA,KAAK,GAAG,cAAgC,EAAA,OAAA,EAAS,aAAY,CACzJ,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import FormControl from '@material-ui/core/FormControl';
|
|
3
|
+
import Select from '@material-ui/core/Select';
|
|
4
|
+
import MenuItem from '@material-ui/core/MenuItem';
|
|
5
|
+
import { Grid, Chip, Input, Checkbox, ListItemText } from '@material-ui/core';
|
|
6
|
+
import { InstanceConfigScopeEnum, parseResources } from '@jfvilas/kwirth-common';
|
|
7
|
+
|
|
8
|
+
const ObjectSelector = (props) => {
|
|
9
|
+
const [render, setRender] = useState(false);
|
|
10
|
+
let pods = props.cluster.data;
|
|
11
|
+
let namespaceList = Array.from(new Set(pods.map((p) => p.namespace)));
|
|
12
|
+
const onNamespaceChange = (namespace) => {
|
|
13
|
+
let i = props.selectedNamespaces.indexOf(namespace);
|
|
14
|
+
if (i >= 0)
|
|
15
|
+
props.selectedNamespaces.splice(i, 1);
|
|
16
|
+
else
|
|
17
|
+
props.selectedNamespaces.push(namespace);
|
|
18
|
+
props.selectedPodNames.splice(0, props.selectedPodNames.length);
|
|
19
|
+
let pods2 = getPodList();
|
|
20
|
+
if (pods2.length === 1) props.selectedPodNames.push(...pods2.map((p) => p.name));
|
|
21
|
+
props.selectedContainerNames.splice(0, props.selectedContainerNames.length);
|
|
22
|
+
let containers = getContainerList();
|
|
23
|
+
if (containers.length === 1) {
|
|
24
|
+
props.selectedContainerNames.push(...containers);
|
|
25
|
+
props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames]);
|
|
26
|
+
}
|
|
27
|
+
setRender(!render);
|
|
28
|
+
};
|
|
29
|
+
const onPodNameChange = (event) => {
|
|
30
|
+
props.selectedPodNames.splice(0, props.selectedPodNames.length);
|
|
31
|
+
props.selectedPodNames.push(...event.target.value);
|
|
32
|
+
props.selectedContainerNames.splice(0, props.selectedContainerNames.length);
|
|
33
|
+
let containers = getContainerList();
|
|
34
|
+
if (containers.length === 1) props.selectedContainerNames.push(...containers);
|
|
35
|
+
props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames]);
|
|
36
|
+
setRender(!render);
|
|
37
|
+
};
|
|
38
|
+
const onContainerNameChange = (event) => {
|
|
39
|
+
props.selectedContainerNames.splice(0, props.selectedContainerNames.length);
|
|
40
|
+
props.selectedContainerNames.push(...event.target.value);
|
|
41
|
+
props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames]);
|
|
42
|
+
};
|
|
43
|
+
const existAccessKey = (namespace) => {
|
|
44
|
+
if (!props.cluster.accessKeys.has(InstanceConfigScopeEnum.VIEW)) return false;
|
|
45
|
+
let accessKey = props.cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW);
|
|
46
|
+
if (accessKey) {
|
|
47
|
+
let resources = parseResources(accessKey?.resource);
|
|
48
|
+
return resources.find((r) => r.namespace === namespace);
|
|
49
|
+
} else return false;
|
|
50
|
+
};
|
|
51
|
+
const getPodList = () => {
|
|
52
|
+
return Array.from(pods.filter((m) => props.selectedNamespaces.includes(m.namespace)));
|
|
53
|
+
};
|
|
54
|
+
const getContainerList = () => {
|
|
55
|
+
if (props.selectedNamespaces.length === 0 || props.selectedPodNames.length === 0) return [];
|
|
56
|
+
let validpods = pods.filter((pod) => props.selectedNamespaces.includes(pod.namespace));
|
|
57
|
+
validpods = validpods.filter((p2) => props.selectedPodNames.includes(p2.name));
|
|
58
|
+
let validcontainers = [];
|
|
59
|
+
for (var p of validpods) {
|
|
60
|
+
validcontainers.push(...p.containers);
|
|
61
|
+
}
|
|
62
|
+
return Array.from(new Set(validcontainers));
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "column", spacing: 0, style: { marginBottom: 6, width: "100%" } }, /* @__PURE__ */ React.createElement(Grid, { item: true }, namespaceList.map((ns, index) => {
|
|
65
|
+
if (props.disabled) {
|
|
66
|
+
if (existAccessKey(ns))
|
|
67
|
+
return /* @__PURE__ */ React.createElement(Chip, { component: "span", key: index, label: ns, variant: props.selectedNamespaces.includes(ns) ? "default" : "outlined", size: "small", color: "default" });
|
|
68
|
+
else
|
|
69
|
+
return /* @__PURE__ */ React.createElement(Chip, { component: "span", key: index, label: ns, size: "small", color: "default", variant: "outlined" });
|
|
70
|
+
} else {
|
|
71
|
+
if (existAccessKey(ns))
|
|
72
|
+
return /* @__PURE__ */ React.createElement(Chip, { component: "span", key: index, label: ns, onClick: () => onNamespaceChange(ns), variant: props.selectedNamespaces.includes(ns) ? "default" : "outlined", size: "small", color: "primary" });
|
|
73
|
+
else
|
|
74
|
+
return /* @__PURE__ */ React.createElement(Chip, { component: "span", key: index, label: ns, size: "small", color: "secondary", variant: "outlined" });
|
|
75
|
+
}
|
|
76
|
+
})), /* @__PURE__ */ React.createElement(Grid, { container: true, item: true, xs: 12, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(FormControl, { size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(Select, { value: props.selectedPodNames, input: /* @__PURE__ */ React.createElement(Input, null), multiple: true, onChange: onPodNameChange, renderValue: (selected) => selected.join(", "), disabled: props.disabled || props.selectedNamespaces.length === 0 || getPodList().length === 1 }, getPodList().map((pod) => {
|
|
77
|
+
return /* @__PURE__ */ React.createElement(MenuItem, { key: pod.name, value: pod.name }, /* @__PURE__ */ React.createElement(Checkbox, { checked: props.selectedPodNames.includes(pod.name) }), /* @__PURE__ */ React.createElement(ListItemText, { primary: pod.name }));
|
|
78
|
+
})))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React.createElement(FormControl, { size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(Select, { value: props.selectedContainerNames, multiple: true, onChange: onContainerNameChange, renderValue: (selected) => selected.join(", "), disabled: props.disabled || props.selectedPodNames.length === 0 || getContainerList().length === 1 }, getContainerList().map((container) => {
|
|
79
|
+
return /* @__PURE__ */ React.createElement(MenuItem, { key: container, value: container }, /* @__PURE__ */ React.createElement(Checkbox, { checked: props.selectedContainerNames.includes(container) }), /* @__PURE__ */ React.createElement(ListItemText, { primary: container }));
|
|
80
|
+
}))))));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { ObjectSelector };
|
|
84
|
+
//# sourceMappingURL=ObjectSelector.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectSelector.esm.js","sources":["../../../src/components/ObjectSelector/ObjectSelector.tsx"],"sourcesContent":["import React, { useState } from 'react'\r\nimport { ClusterValidPods } from '@jfvilas/plugin-kwirth-common'\r\nimport FormControl from '@material-ui/core/FormControl'\r\nimport Select from '@material-ui/core/Select'\r\nimport MenuItem from '@material-ui/core/MenuItem'\r\nimport { Checkbox, Chip, Grid, Input, ListItemText } from '@material-ui/core'\r\nimport { InstanceConfigScopeEnum, parseResources } from '@jfvilas/kwirth-common'\r\n\r\ninterface IProps {\r\n onSelect: (namespaces:string[], podNames:string[], containerNames:string[]) => void,\r\n cluster: ClusterValidPods,\r\n selectedNamespaces: string[],\r\n selectedPodNames: string[],\r\n selectedContainerNames: string[],\r\n disabled: boolean\r\n}\r\n\r\nconst ObjectSelector = (props: IProps) => {\r\n const [render, setRender] = useState(false)\r\n let pods = props.cluster.data\r\n let namespaceList = Array.from(new Set(pods.map(p => p.namespace)))\r\n\r\n const onNamespaceChange = (namespace:string) => {\r\n let i = props.selectedNamespaces.indexOf(namespace)\r\n if (i>=0)\r\n props.selectedNamespaces.splice(i,1)\r\n else\r\n props.selectedNamespaces.push(namespace)\r\n\r\n props.selectedPodNames.splice(0,props.selectedPodNames.length)\r\n let pods = getPodList()\r\n if (pods.length===1) props.selectedPodNames.push( ...pods.map(p => p.name) )\r\n\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n let containers = getContainerList()\r\n if (containers.length===1) {\r\n props.selectedContainerNames.push(...containers)\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n }\r\n\r\n setRender(!render)\r\n };\r\n\r\n const onPodNameChange = (event : any) => {\r\n props.selectedPodNames.splice(0,props.selectedPodNames.length)\r\n props.selectedPodNames.push( ...event.target.value )\r\n\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n let containers = getContainerList()\r\n if (containers.length===1) props.selectedContainerNames.push(...containers)\r\n\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n\r\n setRender(!render)\r\n };\r\n\r\n const onContainerNameChange = (event : any) => {\r\n props.selectedContainerNames.splice(0,props.selectedContainerNames.length)\r\n props.selectedContainerNames.push( ...event.target.value )\r\n props.onSelect([...props.selectedNamespaces], [...props.selectedPodNames], [...props.selectedContainerNames])\r\n };\r\n\r\n const existAccessKey = (namespace:string) => {\r\n if (!props.cluster.accessKeys.has(InstanceConfigScopeEnum.VIEW)) return false\r\n let accessKey = props.cluster.accessKeys.get(InstanceConfigScopeEnum.VIEW)\r\n if (accessKey) {\r\n let resources = parseResources(accessKey?.resource)\r\n return (resources.find(r => r.namespace === namespace))\r\n }\r\n else return false\r\n\r\n }\r\n\r\n const getPodList = () => {\r\n return Array.from(pods.filter(m => props.selectedNamespaces.includes(m.namespace)))\r\n }\r\n\r\n const getContainerList = () => {\r\n if (props.selectedNamespaces.length===0 || props.selectedPodNames.length===0) return []\r\n let validpods = pods.filter(pod => props.selectedNamespaces.includes(pod.namespace))\r\n validpods = validpods.filter(p => props.selectedPodNames.includes(p.name))\r\n let validcontainers:string[] = []\r\n for (var p of validpods) {\r\n validcontainers.push ( ...p.containers )\r\n }\r\n return Array.from(new Set(validcontainers))\r\n }\r\n\r\n return (\r\n <Grid container direction='column' spacing={0} style={{marginBottom:6, width:'100%'}}>\r\n <Grid item>\r\n {\r\n namespaceList.map ((ns,index) => {\r\n if (props.disabled) {\r\n if (existAccessKey(ns))\r\n return <Chip component={'span'} key={index} label={ns as string} variant={props.selectedNamespaces.includes(ns)?'default':'outlined'} size='small' color='default' />\r\n else\r\n return <Chip component={'span'} key={index} label={ns as string} size='small' color='default' variant={'outlined'}/>\r\n }\r\n else {\r\n if (existAccessKey(ns))\r\n return <Chip component={'span'} key={index} label={ns as string} onClick={() => onNamespaceChange(ns)} variant={props.selectedNamespaces.includes(ns)?'default':'outlined'} size='small' color='primary' />\r\n else\r\n return <Chip component={'span'} key={index} label={ns as string} size='small' color='secondary' variant={'outlined'}/>\r\n }\r\n })\r\n }\r\n </Grid>\r\n <Grid container item xs={12} spacing={2}>\r\n <Grid item xs={6}>\r\n <FormControl size='small' fullWidth>\r\n <Select value={props.selectedPodNames} input={<Input />} multiple onChange={onPodNameChange} renderValue={(selected) => (selected as string[]).join(', ')} disabled={props.disabled || props.selectedNamespaces.length===0 || getPodList().length===1}>\r\n {\r\n getPodList().map(pod => {\r\n return (\r\n <MenuItem key={pod.name} value={pod.name}>\r\n <Checkbox checked={props.selectedPodNames.includes(pod.name)} />\r\n <ListItemText primary={pod.name} />\r\n </MenuItem>\r\n )\r\n })\r\n }\r\n </Select>\r\n </FormControl>\r\n </Grid>\r\n <Grid item xs={6}>\r\n <FormControl size='small' fullWidth>\r\n <Select value={props.selectedContainerNames} multiple onChange={onContainerNameChange} renderValue={(selected) => (selected as string[]).join(', ')} disabled={props.disabled || props.selectedPodNames.length===0 || getContainerList().length===1}>\r\n {\r\n getContainerList().map(container => {\r\n return (\r\n <MenuItem key={container} value={container}>\r\n <Checkbox checked={props.selectedContainerNames.includes(container)} />\r\n <ListItemText primary={container} />\r\n </MenuItem>\r\n )\r\n })\r\n }\r\n </Select>\r\n </FormControl>\r\n </Grid>\r\n </Grid>\r\n </Grid>\r\n )\r\n}\r\n\r\nexport { ObjectSelector }"],"names":["pods","p"],"mappings":";;;;;;;AAiBM,MAAA,cAAA,GAAiB,CAAC,KAAkB,KAAA;AACtC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA;AAC1C,EAAI,IAAA,IAAA,GAAO,MAAM,OAAQ,CAAA,IAAA;AACzB,EAAI,IAAA,aAAA,GAAgB,KAAM,CAAA,IAAA,CAAK,IAAI,GAAA,CAAI,IAAK,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,CAAC,CAAC,CAAA;AAElE,EAAM,MAAA,iBAAA,GAAoB,CAAC,SAAqB,KAAA;AAC5C,IAAA,IAAI,CAAI,GAAA,KAAA,CAAM,kBAAmB,CAAA,OAAA,CAAQ,SAAS,CAAA;AAClD,IAAA,IAAI,CAAG,IAAA,CAAA;AACH,MAAM,KAAA,CAAA,kBAAA,CAAmB,MAAO,CAAA,CAAA,EAAE,CAAC,CAAA;AAAA;AAEnC,MAAM,KAAA,CAAA,kBAAA,CAAmB,KAAK,SAAS,CAAA;AAE3C,IAAA,KAAA,CAAM,gBAAiB,CAAA,MAAA,CAAO,CAAE,EAAA,KAAA,CAAM,iBAAiB,MAAM,CAAA;AAC7D,IAAA,IAAIA,QAAO,UAAW,EAAA;AACtB,IAAA,IAAIA,KAAK,CAAA,MAAA,KAAS,CAAG,EAAA,KAAA,CAAM,gBAAiB,CAAA,I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W,KAAO,EAAA,SAAA,EAAA,sCAC5B,QAAS,EAAA,EAAA,OAAA,EAAS,MAAM,sBAAuB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA,CAAA,sCACpE,YAAa,EAAA,EAAA,OAAA,EAAS,WAAW,CACtC,CAAA;AAAA,GAEP,CAET,CACJ,CACJ,CACJ,CACJ,CAAA;AAER;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import CardHeader from '@material-ui/core/CardHeader';
|
|
3
|
+
import Checkbox from '@material-ui/core/Checkbox';
|
|
4
|
+
import Divider from '@material-ui/core/Divider';
|
|
5
|
+
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
6
|
+
import Grid from '@material-ui/core/Grid';
|
|
7
|
+
import { Typography } from '@material-ui/core';
|
|
8
|
+
|
|
9
|
+
const Options = (props) => {
|
|
10
|
+
const [options, setOptions] = useState(props.options);
|
|
11
|
+
const handleChange = (change) => {
|
|
12
|
+
var a = { ...options, ...change };
|
|
13
|
+
setOptions(a);
|
|
14
|
+
props.onChange(a);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CardHeader, { title: "Options" }), /* @__PURE__ */ React.createElement(Divider, { style: { marginTop: 8 } }), /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "column", spacing: 0 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(FormControlLabel, { style: { marginLeft: 8 }, label: "From start", control: /* @__PURE__ */ React.createElement(Checkbox, { checked: options.fromStart, onChange: () => handleChange({ fromStart: !options.fromStart }), disabled: props.disabled }) })), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(FormControlLabel, { style: { marginLeft: 8 }, label: "Add timestamp", control: /* @__PURE__ */ React.createElement(Checkbox, { checked: options.timestamp, onChange: () => handleChange({ timestamp: !options.timestamp }), disabled: props.disabled }) })), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(FormControlLabel, { style: { marginLeft: 8 }, control: /* @__PURE__ */ React.createElement(Checkbox, { checked: options.follow, onChange: () => handleChange({ follow: !options.follow }) }), label: "Follow log", disabled: props.disabled })), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { style: { fontSize: 9, marginLeft: 20, marginTop: 4, marginBottom: 6 } }, "Powered by ", /* @__PURE__ */ React.createElement("a", { href: "https://jfvilas.github.io/kwirth/", target: "_blank", style: { color: "blue" } }, "Kwirth")))));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { Options };
|
|
20
|
+
//# sourceMappingURL=Options.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Options.esm.js","sources":["../../../src/components/Options/Options.tsx"],"sourcesContent":["import React, { useState } from 'react'\r\nimport CardHeader from '@material-ui/core/CardHeader'\r\nimport Checkbox from '@material-ui/core/Checkbox'\r\nimport Divider from '@material-ui/core/Divider'\r\nimport FormControlLabel from '@material-ui/core/FormControlLabel'\r\nimport Grid from '@material-ui/core/Grid'\r\nimport { Typography } from '@material-ui/core'\r\n\r\ninterface IProps {\r\n options: any,\r\n disabled: boolean,\r\n onChange: (options:{}) => void\r\n}\r\n\r\nconst Options = (props: IProps) => {\r\n const [options, setOptions] = useState<any>(props.options);\r\n\r\n const handleChange = (change:any) => {\r\n var a = {...options,...change}\r\n setOptions(a);\r\n props.onChange(a);\r\n }\r\n\r\n return (<>\r\n <CardHeader title={'Options'}/>\r\n <Divider style={{marginTop:8}}/>\r\n <Grid container direction='column' spacing={0}>\r\n <Grid item >\r\n <FormControlLabel style={{marginLeft:8}} label=\"From start\" control={<Checkbox checked={options.fromStart} onChange={() => handleChange({fromStart:!options.fromStart})} disabled={props.disabled}/>} />\r\n </Grid>\r\n <Grid item >\r\n <FormControlLabel style={{marginLeft:8}} label=\"Add timestamp\" control={<Checkbox checked={options.timestamp} onChange={() => handleChange({timestamp:!options.timestamp})} disabled={props.disabled}/>} />\r\n </Grid>\r\n <Grid item >\r\n <FormControlLabel style={{marginLeft:8}} control={<Checkbox checked={options.follow} onChange={() => handleChange({follow:!options.follow})} />} label=\"Follow log\" disabled={props.disabled}/>\r\n </Grid>\r\n <Grid item >\r\n <Typography style={{fontSize:9, marginLeft:20, marginTop:4, marginBottom:6}}>Powered by <a href='https://jfvilas.github.io/kwirth/' target='_blank' style={{color:'blue'}}>Kwirth</a></Typography>\r\n </Grid>\r\n </Grid>\r\n </>)\r\n}\r\n\r\nexport { Options }"],"names":[],"mappings":";;;;;;;;AAcM,MAAA,OAAA,GAAU,CAAC,KAAkB,KAAA;AAC/B,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAAc,MAAM,OAAO,CAAA;AAEzD,EAAM,MAAA,YAAA,GAAe,CAAC,MAAe,KAAA;AACjC,IAAA,IAAI,CAAI,GAAA,EAAC,GAAG,OAAA,EAAQ,GAAG,MAAM,EAAA;AAC7B,IAAA,UAAA,CAAW,CAAC,CAAA;AACZ,IAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAAA,GACpB;AAEA,EAAA,iFACK,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAO,EAAA,SAAA,EAAU,mBAC5B,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,KAAO,EAAA,EAAC,WAAU,CAAC,EAAA,EAAE,CAC9B,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,SAAU,EAAA,QAAA,EAAS,SAAS,CACxC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,wBACL,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,KAAO,EAAA,EAAC,YAAW,CAAC,EAAA,EAAG,OAAM,YAAa,EAAA,OAAA,sCAAU,QAAS,EAAA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,KAAO,EAAA,EAAC,OAAM,MAAM,EAAA,EAAA,EAAG,QAAM,CAAI,CACzL,CACJ,CACJ,CAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
3
|
+
import Snackbar from '@material-ui/core/Snackbar';
|
|
4
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
5
|
+
|
|
6
|
+
const ShowError = (props) => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
Snackbar,
|
|
9
|
+
{
|
|
10
|
+
message: `An error has ocurred: ${props.message}`,
|
|
11
|
+
open: true,
|
|
12
|
+
autoHideDuration: 3e3,
|
|
13
|
+
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
14
|
+
action: /* @__PURE__ */ React.createElement(IconButton, { size: "small", "aria-label": "close", color: "inherit", onClick: props.onClose }, /* @__PURE__ */ React.createElement(CloseIcon, { fontSize: "small" }))
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { ShowError };
|
|
20
|
+
//# sourceMappingURL=ShowError.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowError.esm.js","sources":["../../../src/components/ShowError/ShowError.tsx"],"sourcesContent":["import React from 'react'\r\nimport IconButton from '@material-ui/core/IconButton'\r\nimport Snackbar from '@material-ui/core/Snackbar'\r\nimport CloseIcon from '@material-ui/icons/Close'\r\n\r\nconst ShowError = (props: {\r\n message: string\r\n onClose:() => void\r\n }) => {\r\n\r\n return (\r\n <Snackbar \r\n message={`An error has ocurred: ${props.message}`}\r\n open={true}\r\n autoHideDuration={3000}\r\n anchorOrigin={{ vertical:'top', horizontal:'center' }}\r\n action={ \r\n <IconButton size=\"small\" aria-label=\"close\" color=\"inherit\" onClick={props.onClose}>\r\n <CloseIcon fontSize=\"small\" />\r\n </IconButton>\r\n }>\r\n </Snackbar>\r\n )\r\n}\r\n\r\nexport { ShowError }"],"names":[],"mappings":";;;;;AAKM,MAAA,SAAA,GAAY,CAAC,KAGT,KAAA;AAEN,EACI,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACG,OAAA,EAAS,CAAyB,sBAAA,EAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,MAC/C,IAAM,EAAA,IAAA;AAAA,MACN,gBAAkB,EAAA,GAAA;AAAA,MAClB,YAAc,EAAA,EAAE,QAAS,EAAA,KAAA,EAAO,YAAW,QAAS,EAAA;AAAA,MACpD,wBACK,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,IAAK,EAAA,OAAA,EAAQ,cAAW,OAAQ,EAAA,KAAA,EAAM,SAAU,EAAA,OAAA,EAAS,MAAM,OACvE,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,QAAA,EAAS,SAAQ,CAChC;AAAA;AAAA,GAER;AAER;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dialog, DialogTitle, DialogContent, Typography, DialogActions, Button } from '@material-ui/core';
|
|
3
|
+
import { InstanceMessageTypeEnum } from '@jfvilas/kwirth-common';
|
|
4
|
+
|
|
5
|
+
const StatusLog = (props) => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement(Dialog, { open: true }, /* @__PURE__ */ React.createElement(DialogTitle, null, "Stauts: ", props.level), /* @__PURE__ */ React.createElement(DialogContent, null, props.statusMessages.filter((m) => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === props.level).map((m, index) => /* @__PURE__ */ React.createElement(Typography, { key: index }, m.timestamp?.toISOString(), "\xA0\xA0\xA0\xA0", m.text))), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { onClick: () => props.onClear(props.level), color: "primary", variant: "contained" }, "Clear"), /* @__PURE__ */ React.createElement(Button, { onClick: props.onClose, color: "primary", variant: "contained" }, "Close")));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { StatusLog };
|
|
10
|
+
//# sourceMappingURL=StatusLog.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusLog.esm.js","sources":["../../../src/components/StatusLog/StatusLog.tsx"],"sourcesContent":["import React from 'react';\r\nimport { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography } from '@material-ui/core'\r\nimport { InstanceMessageTypeEnum, SignalMessage, SignalMessageLevelEnum } from '@jfvilas/kwirth-common'\r\n\r\nconst StatusLog = (props:{\r\n level: SignalMessageLevelEnum\r\n statusMessages: SignalMessage[]\r\n onClear: (level:SignalMessageLevelEnum) => void\r\n onClose: () => void\r\n }) => {\r\n\r\n return (\r\n <Dialog open={true}>\r\n <DialogTitle>\r\n Stauts: {props.level} \r\n </DialogTitle>\r\n <DialogContent>\r\n { props.statusMessages.filter(m => m.type === InstanceMessageTypeEnum.SIGNAL && m.level === props.level).map( (m,index) => <Typography key={index}>{m.timestamp?.toISOString()} {m.text}</Typography>) }\r\n </DialogContent>\r\n <DialogActions>\r\n <Button onClick={() => props.onClear(props.level)} color='primary' variant='contained'>Clear</Button>\r\n <Button onClick={props.onClose} color='primary' variant='contained'>Close</Button>\r\n </DialogActions>\r\n </Dialog>\r\n )\r\n\r\n}\r\n\r\nexport { StatusLog }"],"names":[],"mappings":";;;;AAIM,MAAA,SAAA,GAAY,CAAC,KAKT,KAAA;AAEN,EAAA,uBACK,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,IAAM,EAAA,IAAA,EAAA,sCACT,WAAY,EAAA,IAAA,EAAA,UAAA,EACA,KAAM,CAAA,KACnB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,aACK,EAAA,IAAA,EAAA,KAAA,CAAM,eAAe,MAAO,CAAA,CAAA,CAAA,KAAK,CAAE,CAAA,IAAA,KAAS,uBAAwB,CAAA,MAAA,IAAU,CAAE,CAAA,KAAA,KAAU,MAAM,KAAK,CAAA,CAAE,GAAK,CAAA,CAAC,GAAE,KAAU,qBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,GAAA,EAAK,SAAQ,CAAE,CAAA,SAAA,EAAW,WAAY,EAAA,EAAE,kBAAyB,EAAA,CAAA,CAAE,IAAK,CAAa,CAChO,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,aACG,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAO,OAAS,EAAA,MAAM,KAAM,CAAA,OAAA,CAAQ,MAAM,KAAK,CAAA,EAAG,KAAM,EAAA,SAAA,EAAU,OAAQ,EAAA,WAAA,EAAA,EAAY,OAAK,CAAA,sCAC3F,MAAO,EAAA,EAAA,OAAA,EAAS,KAAM,CAAA,OAAA,EAAS,OAAM,SAAU,EAAA,OAAA,EAAQ,WAAY,EAAA,EAAA,OAAK,CAC7E,CACJ,CAAA;AAGR;;;;"}
|