Skip to content

Commit d36311c

Browse files
authored
fix: Fix the problem of abnormal theme color switching (#8012)
1 parent a81d564 commit d36311c

File tree

5 files changed

+11
-26
lines changed

5 files changed

+11
-26
lines changed

agent/app/repo/monitor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (u *MonitorRepo) GetIO(opts ...DBOption) ([]model.MonitorIO, error) {
4141
for _, opt := range opts {
4242
db = opt(db)
4343
}
44-
err := db.First(&data).Error
44+
err := db.Find(&data).Error
4545
return data, err
4646
}
4747
func (u *MonitorRepo) GetNetwork(opts ...DBOption) ([]model.MonitorNetwork, error) {
@@ -50,7 +50,7 @@ func (u *MonitorRepo) GetNetwork(opts ...DBOption) ([]model.MonitorNetwork, erro
5050
for _, opt := range opts {
5151
db = opt(db)
5252
}
53-
err := db.First(&data).Error
53+
err := db.Find(&data).Error
5454
return data, err
5555
}
5656

frontend/src/layout/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { GlobalStore, MenuStore, TabsStore } from '@/store';
2323
import { DeviceType } from '@/enums/app';
2424
import { getSystemAvailable } from '@/api/modules/setting';
2525
import { useRoute, useRouter } from 'vue-router';
26-
import { loadMasterProductProFromDB, loadProductProFromDB } from '@/utils/xpack';
26+
import { loadMasterProductProFromDB, loadProductProFromDB, getXpackSettingForTheme } from '@/utils/xpack';
2727
import { useTheme } from '@/global/use-theme';
2828
import TaskList from '@/components/task-list/index.vue';
2929
const { switchTheme } = useTheme();
@@ -108,6 +108,7 @@ onMounted(() => {
108108
loadStatus();
109109
loadProductProFromDB();
110110
loadMasterProductProFromDB();
111+
getXpackSettingForTheme();
111112
globalStore.isFullScreen = false;
112113
113114
const mqList = window.matchMedia('(prefers-color-scheme: dark)');

frontend/src/utils/xpack.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,6 @@ export async function loadMasterProductProFromDB() {
8787
}
8888

8989
export async function getXpackSettingForTheme() {
90-
const res = await getMasterLicenseStatus();
91-
if (!res.data) {
92-
globalStore.isMasterProductPro = false;
93-
resetXSetting();
94-
switchTheme();
95-
initFavicon();
96-
return;
97-
}
98-
globalStore.isMasterProductPro = res.data.status === 'Bound';
99-
if (!globalStore.isMasterProductPro) {
100-
globalStore.isMasterProductPro = false;
101-
resetXSetting();
102-
switchTheme();
103-
initFavicon();
104-
return;
105-
}
106-
10790
let searchXSetting;
10891
const xpackModules = import.meta.glob('../xpack/api/modules/setting.ts', { eager: true });
10992
if (xpackModules['../xpack/api/modules/setting.ts']) {

frontend/src/views/login/components/login-form.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ import { MsgSuccess } from '@/utils/message';
184184
import { useI18n } from 'vue-i18n';
185185
import { getSettingInfo } from '@/api/modules/setting';
186186
import { encryptPassword } from '@/utils/util';
187+
import { getXpackSettingForTheme } from '@/utils/xpack';
187188
188189
const i18n = useI18n();
189190
const themeConfig = computed(() => globalStore.themeConfig);
@@ -334,7 +335,6 @@ const login = (formEl: FormInstance | undefined) => {
334335
menuStore.setMenuList([]);
335336
tabsStore.removeAllTabs();
336337
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
337-
loadDataFromDB();
338338
router.push({ name: 'home' });
339339
} catch (res) {
340340
if (res.code === 401) {
@@ -369,7 +369,6 @@ const mfaLogin = async (auto: boolean) => {
369369
menuStore.setMenuList([]);
370370
tabsStore.removeAllTabs();
371371
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
372-
loadDataFromDB();
373372
router.push({ name: 'home' });
374373
} catch (res) {
375374
if (res.code === 401) {
@@ -415,6 +414,8 @@ const getSetting = async () => {
415414
onMounted(() => {
416415
globalStore.isOnRestart = false;
417416
getSetting();
417+
loadDataFromDB();
418+
getXpackSettingForTheme();
418419
if (!globalStore.ignoreCaptcha) {
419420
loginVerify();
420421
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<el-input type="password" show-password clearable v-model.trim="passForm.oldPassword" />
66
</el-form-item>
77
<el-form-item
8-
v-if="complexityVerification === 'disable'"
8+
v-if="complexityVerification === 'Disable'"
99
:label="$t('setting.newPassword')"
1010
prop="newPassword"
1111
>
1212
<el-input type="password" show-password clearable v-model.trim="passForm.newPassword" />
1313
</el-form-item>
1414
<el-form-item
15-
v-if="complexityVerification === 'enable'"
15+
v-if="complexityVerification === 'Enable'"
1616
:label="$t('setting.newPassword')"
1717
prop="newPasswordComplexity"
1818
>
@@ -80,7 +80,7 @@ const acceptParams = (params: DialogProps): void => {
8080
};
8181
8282
function checkPassword(rule: any, value: any, callback: any) {
83-
let password = complexityVerification.value === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
83+
let password = complexityVerification.value === 'Disable' ? passForm.newPassword : passForm.newPasswordComplexity;
8484
if (password !== passForm.retryPassword) {
8585
return callback(new Error(i18n.global.t('commons.rule.rePassword')));
8686
}
@@ -92,7 +92,7 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
9292
formEl.validate(async (valid) => {
9393
if (!valid) return;
9494
let password =
95-
complexityVerification.value === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
95+
complexityVerification.value === 'Disable' ? passForm.newPassword : passForm.newPasswordComplexity;
9696
if (password === passForm.oldPassword) {
9797
MsgError(i18n.global.t('setting.duplicatePassword'));
9898
return;

0 commit comments

Comments
 (0)