1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Cleaning up Controls component

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-08-02 10:44:45 +03:00
parent f12e2e1345
commit e8915336dc

View File

@ -53,25 +53,20 @@ const NonInjectedLogControls = observer(({ openSaveFileDialog, model, callForAll
if (pod) { if (pod) {
const logs = await callForAllLogs(pod.getName(), pod.getNs()); const logs = await callForAllLogs(pod.getName(), pod.getNs());
console.log(logs); openSaveFileDialog(`${pod.getName()}.log`, logs, "text/plain");
}
return !!logs;
} }
return false; const downloadLogs = () => {
return new Promise((resolve) => {
// openSaveFileDialog("logs.txt", logs, "text/plain");
}
const downloadLogs = (): Promise<boolean> => {
const fileName = pod.getName(); const fileName = pod.getName();
const logsToDownload: string[] = showTimestamps const logsToDownload: string[] = showTimestamps
? model.logs.get() ? model.logs.get()
: model.logsWithoutTimestamps.get(); : model.logsWithoutTimestamps.get();
openSaveFileDialog(`${fileName}.log`, logsToDownload.join("\n"), "text/plain"); openSaveFileDialog(`${fileName}.log`, logsToDownload.join("\n"), "text/plain");
resolve(true);
return new Promise(resolve => resolve(true)); });
}; };
return ( return (