Skip to content

Commit 4aca66c

Browse files
authored
fix: Add existence check when restarting Docker (#10926)
Refs #10890
1 parent 944463e commit 4aca66c

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

frontend/src/views/host/firewall/status/index.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import DockerRestart from '@/components/docker-proxy/docker-restart.vue';
8989
import { MsgSuccess } from '@/utils/message';
9090
import { ElMessageBox } from 'element-plus';
9191
import { ref } from 'vue';
92+
import { loadDockerStatus } from '@/api/modules/container';
9293
9394
const props = defineProps({
9495
currentTab: String,
@@ -107,10 +108,12 @@ const onPing = ref('Disable');
107108
const oldStatus = ref();
108109
const dockerRef = ref();
109110
const operation = ref('restart');
111+
const dockerStatus = ref();
110112
const withDockerRestart = ref(false);
111113
112114
const acceptParams = (): void => {
113115
loadBaseInfo(true);
116+
loadDocker();
114117
};
115118
const emit = defineEmits(['search', 'update:is-active', 'update:loading', 'update:maskShow', 'update:name']);
116119
@@ -140,6 +143,11 @@ const loadBaseInfo = async (search: boolean) => {
140143
});
141144
};
142145
146+
const loadDocker = async () => {
147+
const res = await loadDockerStatus();
148+
dockerStatus.value = res.data.isExist;
149+
};
150+
143151
const loadInitMsg = () => {
144152
switch (props.currentTab) {
145153
case 'base':
@@ -201,7 +209,7 @@ const onUnBind = async () => {
201209
202210
const onOperate = async (op: string) => {
203211
operation.value = op;
204-
if (baseInfo.value.name === 'iptables') {
212+
if (baseInfo.value.name === 'iptables' || !dockerStatus.value) {
205213
emit('update:loading', true);
206214
emit('update:maskShow', true);
207215
await operateFire(operation.value, false)

frontend/src/views/setting/panel/proxy/index.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import { GlobalStore } from '@/store';
7878
import { storeToRefs } from 'pinia';
7979
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
8080
import DockerProxyDialog from '@/components/docker-proxy/dialog.vue';
81+
import { loadDockerStatus } from '@/api/modules/container';
8182
8283
const globalStore = GlobalStore();
8384
const emit = defineEmits<{ (e: 'search'): void }>();
@@ -105,6 +106,7 @@ const form = reactive({
105106
proxyPasswdKeepItem: false,
106107
proxyDocker: false,
107108
});
109+
const dockerStatus = ref();
108110
const withDockerRestart = ref(false);
109111
const dockerProxyRef = ref();
110112
@@ -135,6 +137,12 @@ const acceptParams = (params: DialogProps): void => {
135137
proxyDockerVisible.value = params.proxyDocker !== '';
136138
proxyVisible.value = true;
137139
form.proxyPasswdKeepItem = params.passwdKeep === 'Enable';
140+
loadDocker();
141+
};
142+
143+
const loadDocker = async () => {
144+
const res = await loadDockerStatus();
145+
dockerStatus.value = res.data.isExist;
138146
};
139147
140148
const submitChangePassword = async (formEl: FormInstance | undefined) => {
@@ -158,7 +166,7 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
158166
if (form.proxyType === 'http' || form.proxyType === 'https') {
159167
params.proxyUrl = form.proxyUrl;
160168
}
161-
if (isMasterProductPro.value && (params.proxyDocker || proxyDockerVisible.value)) {
169+
if (dockerStatus.value && isMasterProductPro.value && (params.proxyDocker || proxyDockerVisible.value)) {
162170
dockerProxyRef.value.acceptParams({
163171
syncList: 'SyncSystemProxy',
164172
open: true,

0 commit comments

Comments
 (0)