Skip to content

Commit 7bcfa78

Browse files
fix: fix issue with ubind license restart docker (#8836)
1 parent 5d25f97 commit 7bcfa78

File tree

6 files changed

+48
-20
lines changed

6 files changed

+48
-20
lines changed

core/app/dto/setting.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,14 @@ type Upgrade struct {
146146
}
147147

148148
type ProxyUpdate struct {
149-
ProxyUrl string `json:"proxyUrl"`
150-
ProxyType string `json:"proxyType"`
151-
ProxyPort string `json:"proxyPort"`
152-
ProxyUser string `json:"proxyUser"`
153-
ProxyPasswd string `json:"proxyPasswd"`
154-
ProxyPasswdKeep string `json:"proxyPasswdKeep"`
155-
ProxyDocker bool `json:"proxyDocker"`
149+
ProxyUrl string `json:"proxyUrl"`
150+
ProxyType string `json:"proxyType"`
151+
ProxyPort string `json:"proxyPort"`
152+
ProxyUser string `json:"proxyUser"`
153+
ProxyPasswd string `json:"proxyPasswd"`
154+
ProxyPasswdKeep string `json:"proxyPasswdKeep"`
155+
ProxyDocker bool `json:"proxyDocker"`
156+
WithDockerRestart bool `json:"withDockerRestart"`
156157
}
157158

158159
type CleanData struct {

frontend/src/api/interface/setting.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DateTimeFormats } from '@intlify/core-base';
2+
import { b } from 'vite/dist/node/types.d-aGj9QkWt';
23

34
export namespace Setting {
45
export interface SettingInfo {
@@ -83,6 +84,7 @@ export namespace Setting {
8384
proxyUser: string;
8485
proxyPasswd: string;
8586
proxyPasswdKeep: string;
87+
withDockerRestart: boolean;
8688
}
8789
export interface ApiConfig {
8890
apiInterfaceStatus: string;
@@ -238,4 +240,16 @@ export namespace Setting {
238240
isBound: boolean;
239241
name: string;
240242
}
243+
244+
export interface LicenseBind {
245+
nodeID: number;
246+
licenseID: number;
247+
syncList: string;
248+
withRestartDocker: boolean;
249+
}
250+
export interface LicenseUnbind {
251+
id: number;
252+
force: boolean;
253+
withRestartDocker: boolean;
254+
}
241255
}

frontend/src/api/modules/setting.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export const getMasterLicenseStatus = () => {
2828
export const syncLicense = (id: number) => {
2929
return http.post(`/core/licenses/sync`, { id: id });
3030
};
31-
export const bindLicense = (id: number, nodeID: number, syncList: string) => {
32-
return http.post(`/core/licenses/bind`, { nodeID: nodeID, licenseID: id, syncList: syncList }, TimeoutEnum.T_60S);
31+
export const bindLicense = (params: Setting.LicenseBind) => {
32+
return http.post(`/core/licenses/bind`, params, TimeoutEnum.T_60S);
3333
};
34-
export const unbindLicense = (id: number, force: boolean) => {
35-
return http.post(`/core/licenses/unbind`, { id: id, force: force }, TimeoutEnum.T_60S);
34+
export const unbindLicense = (params: Setting.LicenseUnbind) => {
35+
return http.post(`/core/licenses/unbind`, params, TimeoutEnum.T_60S);
3636
};
3737
export const changeBind = (id: number, nodeIDs: Array<number>) => {
3838
return http.post(`/core/licenses/bind/free`, { licenseID: id, nodeIDs: nodeIDs }, TimeoutEnum.T_60S);

frontend/src/views/setting/license/bind/xpack.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const licenseName = ref();
6666
const freeNodes = ref([]);
6767
6868
const dockerProxyRef = ref();
69-
const withDockerRestart = ref(true);
69+
const withDockerRestart = ref(false);
7070
7171
const form = reactive({
7272
nodeID: null,
@@ -95,7 +95,13 @@ const onBind = async (formEl: FormInstance | undefined) => {
9595
9696
const submit = async () => {
9797
loading.value = true;
98-
await bindLicense(form.licenseID, form.nodeID, form.syncList)
98+
console.log(withDockerRestart.value);
99+
await bindLicense({
100+
licenseID: form.licenseID,
101+
nodeID: form.nodeID,
102+
syncList: form.syncList,
103+
withRestartDocker: withDockerRestart.value,
104+
})
99105
.then(() => {
100106
loading.value = false;
101107
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));

frontend/src/views/setting/license/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ const onUnbind = async (row: any) => {
189189
};
190190
const submitUnbind = async () => {
191191
loading.value = true;
192-
await unbindLicense(unbindRow.value.id, forceUnbind.value)
192+
await unbindLicense({
193+
id: unbindRow.value.id,
194+
force: forceUnbind.value,
195+
withRestartDocker: withDockerRestart.value,
196+
})
193197
.then(() => {
194198
loading.value = false;
195199
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
</DrawerPro>
6565

6666
<ConfirmDialog ref="confirmDialogRef" @confirm="onSubmit" />
67+
<DockerProxyDialog ref="dockerProxyRef" @submit="onSubmit" v-model:with-docker-restart="withDockerRestart" />
6768
</template>
6869

6970
<script lang="ts" setup>
@@ -76,6 +77,7 @@ import { updateProxy } from '@/api/modules/setting';
7677
import { GlobalStore } from '@/store';
7778
import { storeToRefs } from 'pinia';
7879
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
80+
import DockerProxyDialog from '@/components/docker-proxy/dialog.vue';
7981
8082
const globalStore = GlobalStore();
8183
const emit = defineEmits<{ (e: 'search'): void }>();
@@ -103,6 +105,8 @@ const form = reactive({
103105
proxyPasswdKeepItem: false,
104106
proxyDocker: false,
105107
});
108+
const withDockerRestart = ref(false);
109+
const dockerProxyRef = ref();
106110
107111
interface DialogProps {
108112
url: string;
@@ -146,6 +150,7 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
146150
proxyPasswd: isClose ? '' : form.proxyPasswd,
147151
proxyPasswdKeep: '',
148152
proxyDocker: isClose ? false : form.proxyDocker,
153+
withDockerRestart: false,
149154
};
150155
if (!isClose) {
151156
params.proxyPasswdKeep = form.proxyPasswdKeepItem ? 'Enable' : 'Disable';
@@ -154,12 +159,9 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
154159
params.proxyUrl = form.proxyType + '://' + form.proxyUrl;
155160
}
156161
if (isMasterProductPro.value && (params.proxyDocker || proxyDockerVisible.value)) {
157-
let confirmParams = {
158-
header: i18n.global.t('setting.confDockerProxy'),
159-
operationInfo: i18n.global.t('setting.restartNowHelper'),
160-
submitInputInfo: i18n.global.t('setting.restartNow'),
161-
};
162-
confirmDialogRef.value!.acceptParams(confirmParams);
162+
dockerProxyRef.value.acceptParams({
163+
syncList: 'SyncSystemProxy',
164+
});
163165
} else {
164166
loading.value = true;
165167
await updateProxy(params)
@@ -188,6 +190,7 @@ const onSubmit = async () => {
188190
proxyPasswd: isClose ? '' : form.proxyPasswd,
189191
proxyPasswdKeep: '',
190192
proxyDocker: isClose ? false : form.proxyDocker,
193+
withDockerRestart: withDockerRestart.value,
191194
};
192195
if (!isClose) {
193196
params.proxyPasswdKeep = form.proxyPasswdKeepItem ? 'Enable' : 'Disable';

0 commit comments

Comments
 (0)