-
Notifications
You must be signed in to change notification settings - Fork 268
/
TroubleshootingGatherLogs.svelte
55 lines (52 loc) · 1.86 KB
/
TroubleshootingGatherLogs.svelte
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
49
50
51
52
53
54
55
<script lang="ts">
import { faFileLines, faScroll } from '@fortawesome/free-solid-svg-icons';
import Button from '/@/lib/ui/Button.svelte';
import Fa from 'svelte-fa';
let logs: string[] = [];
// Save files as a zip file (we first ask the user for the dialog, and then save the files to the filepath)
async function saveLogsAsZip() {
const filename = await window.troubleshootingGenerateLogFileName('podman-desktop', 'zip');
const result = await window.saveFileDialog('Save Logs as .zip', filename);
if (!result.canceled && result.filePath) {
logs = await window.troubleshootingSaveLogs(result.filePath);
}
}
</script>
<div class="flex flex-col w-full m-4 bg-charcoal-600 p-4 rounded-lg">
<div class="flex flex-row align-middle items-center w-full">
<Fa size="30" class="pr-3 text-gray-700" icon="{faFileLines}" />
<div class="text-xl">Gather Log Files</div>
<div class="flex flex-1 justify-end"></div>
</div>
<div class="mt-4">Bundle all available logs into a .zip</div>
<div class="mt-4">
<Button
on:click="{() => {
saveLogsAsZip();
}}"
title="Collect logs for must gather tool"
icon="{faScroll}">Collect and save logs as .zip</Button>
</div>
{#if logs.length > 0}
<div class="h-full overflow-auto p-2 bg-charcoal-800 mt-3">
<ul aria-label="logs">
{#each logs as log}
<li>
<div class="flex flex-row align-middle items-center">
<div class="font-mono text-[10px] font-thin">
{log} generated
</div>
</div>
</li>
{/each}
<li>
<div class="flex flex-row align-middle items-center mt-2">
<div class="font-mono text-[10px] font-thin">
{logs.length} logs collected and bundled as a .zip
</div>
</div>
</li>
</ul>
</div>
{/if}
</div>