blob: 01aae45f46c1b835915fa9b61bc096124a9e4fcd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import {
DialogButton,
Focusable,
showModal,
} from "decky-frontend-lib";
import { FC, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import LogViewModal from "./LogViewModal";
const LogList: FC<{ plugin: string }> = ({ plugin }) => {
const [logList, setLogList] = useState([]);
const { t } = useTranslation();
useEffect(() => {
window.DeckyPluginLoader.callServerMethod("get_plugin_logs", {
plugin_name: plugin,
}).then((log_list) => {
setLogList(log_list.result || []);
});
}, []);
return (
<Focusable>
{logList.map((log_file) => (
<DialogButton
style={{ marginBottom: "0.5rem" }}
onOKActionDescription={t("LogViewer.viewLog")}
onOKButton={() =>
showModal(
<LogViewModal name={log_file} plugin={plugin}></LogViewModal>,
)
}
onClick={() =>
showModal(
<LogViewModal name={log_file} plugin={plugin}></LogViewModal>,
)
}
>
<div style={{ display: "flex", flexDirection: "column", gap: "6px" }}>
<div>{log_file}</div>
</div>
</DialogButton>
))}
</Focusable>
);
};
export default LogList;
|