Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/init/migration/migrations/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var InitSetting = &gormigrate.Migration{
if err := tx.Create(&model.Setting{Key: "ProxyPasswd", Value: ""}).Error; err != nil {
return err
}
if err := tx.Create(&model.Setting{Key: "PrsoxyPasswdKeep", Value: ""}).Error; err != nil {
if err := tx.Create(&model.Setting{Key: "ProxyPasswdKeep", Value: ""}).Error; err != nil {
return err
}
val := `{"id":"1","label":"/xpack","isCheck":true,"title":"xpack.menu","children":[{"id":"2","label":"Dashboard","isCheck":true,"title":"xpack.waf.name","path":"/xpack/waf/dashboard"},{"id":"3","label":"Tamper","isCheck":true,"title":"xpack.tamper.tamper","path":"/xpack/tamper"},{"id":"4","label":"GPU","isCheck":true,"title":"xpack.gpu.gpu","path":"/xpack/gpu"},{"id":"5","label":"XSetting","isCheck":true,"title":"xpack.setting.setting","path":"/xpack/setting"},{"id":"6","label":"MonitorDashboard","isCheck":true,"title":"xpack.monitor.name","path":"/xpack/monitor/dashboard"},{"id":"7","label":"XAlertDashboard","isCheck":true,"title":"xpack.alert.alert","path":"/xpack/alert/dashboard"},{"id":"8","label":"Node","isCheck":true,"title":"xpack.node.nodeManagement","path":"/xpack/node"}]}`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code snippet is mostly correct, but there seems to be a typo in the value being created for PrsoxyPasswdKeep. The first character of " PrsoxyPasswdKeep" should likely be removed ("P"). Here's the corrected line:

if err := tx.Create(&model.Setting{Key: "ProxyPasswdKeep", Value: ""}).Error; err != nil {

This change ensures that the key matches what would be expected in the database schema. No other issues have been identified based on the information provided.

Expand Down
10 changes: 5 additions & 5 deletions frontend/src/views/setting/panel/proxy/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<template #default>
{{ $t('setting.proxyHelper') }}
<ul class="-ml-5">
<li v-if="isMasterProductPro">{{ $t('setting.proxyHelper1') }}</li>
<li v-if="isMasterProductPro">{{ $t('setting.proxyHelper2') }}</li>
<li v-if="isMasterProductPro">{{ $t('setting.proxyHelper4') }}</li>
<li>{{ $t('setting.proxyHelper1') }}</li>
<li>{{ $t('setting.proxyHelper2') }}</li>
<li>{{ $t('setting.proxyHelper4') }}</li>
<li>{{ $t('setting.proxyHelper3') }}</li>
</ul>
</template>
Expand Down Expand Up @@ -217,11 +217,11 @@ const onSubmit = async () => {
proxyUrl = '';
}
await updateXpackSettingByKey('ProxyDocker', proxyUrl);
await updateDaemonJson(`${form.proxyType}-proxy`, proxyUrl);
emit('search');
handleClose();
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
} catch (error) {
} finally {
} catch {
loading.value = false;
}
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no significant irregularities or issues with the code changes. However, there is an issue with how error handling is structured:

Issue:
The catch block lacks proper exception catching and should include it to handle any errors that might occur during the execution of asynchronous operations.

Optimization Suggestions:
Consider replacing the empty catch block with something like this:

} catch (error) {
    console.error("Error updating Docker Proxy settings:", error); // Log Error for debugging purposes
}

This not only helps in capturing and logging errors but also prevents silent failures which could make troubleshooting more difficult.

Expand Down
Loading