- Выполняется на удалённом хосте… Можно перейти в другой раздел SAC. + Выполняется на удалённом хосте… Можно запустить обновление других хостов.
@@ -56,12 +56,7 @@ const messageClass = computed(() => { diff --git a/frontend/src/components/HostAgentVersionUpgrade.vue b/frontend/src/components/HostAgentVersionUpgrade.vue index af13d36..d135235 100644 --- a/frontend/src/components/HostAgentVersionUpgrade.vue +++ b/frontend/src/components/HostAgentVersionUpgrade.vue @@ -7,11 +7,8 @@ v-if="showUpgrade" type="button" class="agent-version-upgrade" - :class="{ - 'agent-version-upgrade--inactive': upgradeBlocked, - 'agent-version-upgrade--updating': updating, - }" - :disabled="updating || upgradeBlocked" + :class="{ 'agent-version-upgrade--updating': updating }" + :disabled="updating" :title="buttonTitle" @click.stop="emit('upgrade')" > @@ -35,8 +32,6 @@ const props = defineProps<{ host: HostSummary; git: AgentGitVersions | null | undefined; updating?: boolean; - /** Другой хост сейчас обновляется — стрелка видна, но неактивна (серая). */ - upgradeBlocked?: boolean; outdatedHighlight?: boolean; }>(); @@ -65,9 +60,6 @@ const buttonTitle = computed(() => { if (props.updating) { return "Обновление выполняется…"; } - if (props.upgradeBlocked) { - return "Дождитесь завершения обновления на другом хосте"; - } return upgradeTitle.value; }); @@ -127,13 +119,11 @@ const buttonTitle = computed(() => { background: rgba(63, 185, 80, 0.28); } -.agent-version-upgrade--inactive .agent-version-upgrade__arrow, .agent-version-upgrade--updating .agent-version-upgrade__arrow { background: rgba(139, 148, 158, 0.2); color: #8b949e; } -.agent-version-upgrade--inactive .agent-version-upgrade__target, .agent-version-upgrade--updating .agent-version-upgrade__target { color: #8b949e; text-decoration: none; diff --git a/frontend/src/composables/useHostRemoteAction.ts b/frontend/src/composables/useHostRemoteAction.ts index 5ea8856..1605fd5 100644 --- a/frontend/src/composables/useHostRemoteAction.ts +++ b/frontend/src/composables/useHostRemoteAction.ts @@ -12,60 +12,94 @@ import { emitHostPatch } from "../utils/hostPatchBus"; export type HostRemoteActionKind = "fallback" | "ssh-update"; -export const hostRemoteActionLog = reactive({ - open: false, - title: "", - loading: false, - ok: null as boolean | null, - message: "", - output: "", - hostId: 0, -}); +export type HostRemoteActionLogEntry = { + id: string; + hostId: number; + open: boolean; + loading: boolean; + ok: boolean | null; + title: string; + message: string; + output: string; +}; + +export const hostRemoteActionLogs = reactive{{ agentControlMessage }}
+{{ agentControlMessage }}
{{ agentControlMessage }}
+{{ agentControlMessage }}
{{ sshTestMessage }}
{{ sshTestOutput }}
@@ -289,7 +289,8 @@ import { computed, onMounted, onUnmounted, reactive, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { useSacLiveEventStream } from "../composables/useSacLiveEventStream";
import {
- hostRemoteActionLog,
+ hasOpenRemoteActionLogForHost,
+ isHostRemoteActionActive,
runHostRemoteAction,
} from "../composables/useHostRemoteAction";
import {
@@ -338,13 +339,11 @@ const winRmTestMessage = ref("");
const winRmTestOk = ref(false);
const showWinRmTestFeedback = ref(false);
const testingSsh = ref(false);
-const updatingAgent = ref(false);
const showSshTestFeedback = ref(false);
const sshTestMessage = ref("");
const sshTestOk = ref(false);
const sshTestOutput = ref("");
const requestingAgentUpdate = ref(false);
-const runningAgentFallback = ref(false);
const agentControlMessage = ref("");
const agentControlOk = ref(false);
const savingAgentConfig = ref(false);
@@ -637,22 +636,17 @@ async function runRequestAgentUpdate() {
}
async function runAgentFallback() {
- runningAgentFallback.value = true;
agentControlMessage.value = "";
const title = isWindowsHost.value ? "Обновление через WinRM" : "Fallback SSH (ssh-monitor)";
- try {
- const job = await runHostRemoteAction(hostId.value, title, "fallback");
- if (job) {
- agentControlOk.value = job.ok ?? false;
- if (job.ok) {
- agentControlMessage.value = "";
- await loadHost();
- } else {
- agentControlMessage.value = job.message || "";
- }
+ const job = await runHostRemoteAction(hostId.value, title, "fallback");
+ if (job) {
+ agentControlOk.value = job.ok ?? false;
+ if (job.ok) {
+ agentControlMessage.value = "";
+ await loadHost();
+ } else {
+ agentControlMessage.value = job.message || "";
}
- } finally {
- runningAgentFallback.value = false;
}
}
@@ -708,23 +702,18 @@ async function loadHost() {
}
async function runAgentUpdate() {
- updatingAgent.value = true;
- try {
- const job = await runHostRemoteAction(
- hostId.value,
- "Обновление ssh-monitor (SSH)",
- "ssh-update",
- );
- if (job?.ok) {
- const detail = await fetchHost(hostId.value);
- if (job.product_version) {
- detail.product_version = job.product_version;
- }
- applyHostDetail(detail);
- recalcVersionStatusFromGit(detail, agentGitVersions.value);
+ const job = await runHostRemoteAction(
+ hostId.value,
+ "Обновление ssh-monitor (SSH)",
+ "ssh-update",
+ );
+ if (job?.ok) {
+ const detail = await fetchHost(hostId.value);
+ if (job.product_version) {
+ detail.product_version = job.product_version;
}
- } finally {
- updatingAgent.value = false;
+ applyHostDetail(detail);
+ recalcVersionStatusFromGit(detail, agentGitVersions.value);
}
}
@@ -732,27 +721,21 @@ async function runAgentUpgradeFromCell() {
if (!host.value) return;
const kind = remoteActionKindForHost(host.value);
if (!kind) return;
- if (kind === "ssh-update") {
- await runAgentUpdate();
+ if (isHostRemoteActionActive(hostId.value)) {
return;
}
- runningAgentFallback.value = true;
- try {
- const job = await runHostRemoteAction(
- hostId.value,
- remoteActionTitleForHost(host.value),
- kind,
- );
- if (job?.ok) {
- const detail = await fetchHost(hostId.value);
- if (job.product_version) {
- detail.product_version = job.product_version;
- }
- applyHostDetail(detail);
- recalcVersionStatusFromGit(detail, agentGitVersions.value);
+ const job = await runHostRemoteAction(
+ hostId.value,
+ remoteActionTitleForHost(host.value),
+ kind,
+ );
+ if (job?.ok) {
+ const detail = await fetchHost(hostId.value);
+ if (job.product_version) {
+ detail.product_version = job.product_version;
}
- } finally {
- runningAgentFallback.value = false;
+ applyHostDetail(detail);
+ recalcVersionStatusFromGit(detail, agentGitVersions.value);
}
}
diff --git a/frontend/src/views/HostsView.vue b/frontend/src/views/HostsView.vue
index 475321e..31104ca 100644
--- a/frontend/src/views/HostsView.vue
+++ b/frontend/src/views/HostsView.vue
@@ -71,8 +71,7 @@