feat: live update log in UI and suppress lifecycle Telegram during SAC update
Poll remote update_script.log while SSH update runs; skip lifecycle notify when host agent_update_state is running (SAC v0.5.1).
This commit is contained in:
@@ -19,8 +19,18 @@
|
||||
</p>
|
||||
<p v-if="message && !loading" class="host-action-log-message" :class="messageClass">{{ message }}</p>
|
||||
<p v-else-if="message && loading" class="muted host-action-log-sub host-action-log-message">{{ message }}</p>
|
||||
<pre v-if="output" class="host-action-log-output">{{ output }}</pre>
|
||||
<pre v-if="output || (loading && logVisible)" class="host-action-log-output">{{
|
||||
output || "Ожидание лога с хоста…\n(обновление /var/log/update_script.log)"
|
||||
}}</pre>
|
||||
<div class="host-action-log-actions">
|
||||
<button
|
||||
v-if="loading"
|
||||
type="button"
|
||||
class="secondary"
|
||||
@click="emit('toggle-log')"
|
||||
>
|
||||
{{ logVisible ? "Скрыть лог" : "Показать лог" }}
|
||||
</button>
|
||||
<button v-if="loading" type="button" class="secondary" @click="emit('close')">
|
||||
Свернуть
|
||||
</button>
|
||||
@@ -42,10 +52,12 @@ const props = defineProps<{
|
||||
ok: boolean | null;
|
||||
message: string;
|
||||
output: string;
|
||||
logVisible: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
"toggle-log": [];
|
||||
}>();
|
||||
|
||||
const messageClass = computed(() => {
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
:ok="entry.ok"
|
||||
:message="entry.message"
|
||||
:output="entry.output"
|
||||
:log-visible="entry.logVisible"
|
||||
@close="closeHostRemoteActionLog(entry.id)"
|
||||
@toggle-log="toggleHostRemoteActionLog(entry.id)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -20,6 +22,7 @@ import HostActionLogModal from "./HostActionLogModal.vue";
|
||||
import {
|
||||
closeHostRemoteActionLog,
|
||||
hostRemoteActionLogs,
|
||||
toggleHostRemoteActionLog,
|
||||
} from "../composables/useHostRemoteAction";
|
||||
|
||||
const openLogs = computed(() => hostRemoteActionLogs.filter((e) => e.open));
|
||||
|
||||
@@ -16,6 +16,7 @@ export type HostRemoteActionLogEntry = {
|
||||
id: string;
|
||||
hostId: number;
|
||||
open: boolean;
|
||||
logVisible: boolean;
|
||||
loading: boolean;
|
||||
ok: boolean | null;
|
||||
title: string;
|
||||
@@ -180,6 +181,7 @@ export async function pollHostRemoteAction(
|
||||
id: newLogId(),
|
||||
hostId,
|
||||
open: true,
|
||||
logVisible: false,
|
||||
loading: true,
|
||||
ok: null,
|
||||
title,
|
||||
@@ -229,6 +231,7 @@ export async function runHostRemoteAction(
|
||||
id: newLogId(),
|
||||
hostId,
|
||||
open: true,
|
||||
logVisible: false,
|
||||
loading: true,
|
||||
ok: null,
|
||||
title,
|
||||
@@ -246,6 +249,13 @@ export async function runHostRemoteAction(
|
||||
}
|
||||
}
|
||||
|
||||
export function toggleHostRemoteActionLog(entryId: string) {
|
||||
const entry = findLogById(entryId);
|
||||
if (!entry) return;
|
||||
entry.logVisible = !entry.logVisible;
|
||||
entry.open = true;
|
||||
}
|
||||
|
||||
export function closeHostRemoteActionLog(entryId: string) {
|
||||
clearAutoCloseTimer(entryId);
|
||||
const entry = findLogById(entryId);
|
||||
|
||||
Reference in New Issue
Block a user