1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

feat: Modify international version functions (#7686)

This commit is contained in:
2025-01-10 10:19:44 +08:00 committed by GitHub
parent 6f3c5586fc
commit dab83fee20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 59 additions and 32 deletions

View File

@ -49,11 +49,13 @@ import { ElMessageBox } from 'element-plus';
import i18n from '@/lang'; import i18n from '@/lang';
import { updateMenu } from '@/api/modules/setting'; import { updateMenu } from '@/api/modules/setting';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { GlobalStore } from '@/store';
const drawerVisible = ref(); const drawerVisible = ref();
const loading = ref(); const loading = ref();
const defaultCheck = ref([]); const defaultCheck = ref([]);
const emit = defineEmits<{ (e: 'search'): void }>(); const emit = defineEmits<{ (e: 'search'): void }>();
const globalStore = GlobalStore();
interface DialogProps { interface DialogProps {
menuList: string; menuList: string;
} }
@ -82,6 +84,17 @@ function loadCheck(data: any, checkList: any) {
} }
} }
const removeXAlertDashboard = (data: any): any => {
return data
.filter((item: { label: string }) => item.label !== 'XAlertDashboard')
.map((item: { children: any }) => {
if (Array.isArray(item.children)) {
item.children = removeXAlertDashboard(item.children);
}
return item;
});
};
const onSaveStatus = async (row: any) => { const onSaveStatus = async (row: any) => {
if (row.label === '/xpack') { if (row.label === '/xpack') {
if (!row.isCheck) { if (!row.isCheck) {
@ -123,6 +136,9 @@ const acceptParams = (params: DialogProps): void => {
treeData.hideMenu = []; treeData.hideMenu = [];
defaultCheck.value = []; defaultCheck.value = [];
treeData.hideMenu.push(JSON.parse(menuList.value)); treeData.hideMenu.push(JSON.parse(menuList.value));
if (globalStore.isIntl) {
treeData.hideMenu = removeXAlertDashboard(treeData.hideMenu);
}
loadCheck(treeData.hideMenu, defaultCheck.value); loadCheck(treeData.hideMenu, defaultCheck.value);
}; };

View File

@ -188,6 +188,48 @@ const appReq = reactive({
page: 1, page: 1,
pageSize: 20, pageSize: 20,
}); });
const phpSources = globalStore.isIntl
? [
{
label: i18n.global.t('runtime.default'),
value: 'dl-cdn.alpinelinux.org',
},
{
label: i18n.global.t('runtime.xtom'),
value: 'mirrors.xtom.com',
},
]
: [
{
label: i18n.global.t('runtime.ustc'),
value: 'mirrors.ustc.edu.cn',
},
{
label: i18n.global.t('runtime.netease'),
value: 'mirrors.163.com',
},
{
label: i18n.global.t('runtime.aliyun'),
value: 'mirrors.aliyun.com',
},
{
label: i18n.global.t('runtime.tsinghua'),
value: 'mirrors.tuna.tsinghua.edu.cn',
},
{
label: i18n.global.t('runtime.xtomhk'),
value: 'mirrors.xtom.com.hk',
},
{
label: i18n.global.t('runtime.xtom'),
value: 'mirrors.xtom.com',
},
{
label: i18n.global.t('runtime.default'),
value: 'dl-cdn.alpinelinux.org',
},
];
const initData = (type: string) => ({ const initData = (type: string) => ({
name: '', name: '',
appDetailID: undefined, appDetailID: undefined,
@ -196,7 +238,7 @@ const initData = (type: string) => ({
type: type, type: type,
resource: 'appstore', resource: 'appstore',
rebuild: false, rebuild: false,
source: 'mirrors.ustc.edu.cn', source: phpSources[0].value,
}); });
const extensions = ref(); const extensions = ref();
@ -211,37 +253,6 @@ const rules = ref<any>({
source: [Rules.requiredSelect], source: [Rules.requiredSelect],
}); });
const phpSources = [
{
label: i18n.global.t('runtime.ustc'),
value: 'mirrors.ustc.edu.cn',
},
{
label: i18n.global.t('runtime.netease'),
value: 'mirrors.163.com',
},
{
label: i18n.global.t('runtime.aliyun'),
value: 'mirrors.aliyun.com',
},
{
label: i18n.global.t('runtime.tsinghua'),
value: 'mirrors.tuna.tsinghua.edu.cn',
},
{
label: i18n.global.t('runtime.xtomhk'),
value: 'mirrors.xtom.com.hk',
},
{
label: i18n.global.t('runtime.xtom'),
value: 'mirrors.xtom.com',
},
{
label: i18n.global.t('runtime.default'),
value: 'dl-cdn.alpinelinux.org',
},
];
const em = defineEmits(['close', 'submit']); const em = defineEmits(['close', 'submit']);
const handleClose = () => { const handleClose = () => {