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

@ -49,29 +49,24 @@ const NonInjectedLogControls = observer(({ openSaveFileDialog, model, callForAll
const downloadAllLogs = async () => { const downloadAllLogs = async () => {
const pod = model.pod.get(); const pod = model.pod.get();
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;
// openSaveFileDialog("logs.txt", logs, "text/plain");
} }
const downloadLogs = (): Promise<boolean> => { const downloadLogs = () => {
const fileName = pod.getName(); return new Promise((resolve) => {
const logsToDownload: string[] = showTimestamps const fileName = pod.getName();
? model.logs.get() const logsToDownload: string[] = showTimestamps
: model.logsWithoutTimestamps.get(); ? model.logs.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 (