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 { updateMenu } from '@/api/modules/setting';
import { MsgSuccess } from '@/utils/message';
import { GlobalStore } from '@/store';
const drawerVisible = ref();
const loading = ref();
const defaultCheck = ref([]);
const emit = defineEmits<{ (e: 'search'): void }>();
const globalStore = GlobalStore();
interface DialogProps {
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) => {
if (row.label === '/xpack') {
if (!row.isCheck) {
@ -123,6 +136,9 @@ const acceptParams = (params: DialogProps): void => {
treeData.hideMenu = [];
defaultCheck.value = [];
treeData.hideMenu.push(JSON.parse(menuList.value));
if (globalStore.isIntl) {
treeData.hideMenu = removeXAlertDashboard(treeData.hideMenu);
}
loadCheck(treeData.hideMenu, defaultCheck.value);
};

View File

@ -188,30 +188,18 @@ const appReq = reactive({
page: 1,
pageSize: 20,
});
const initData = (type: string) => ({
name: '',
appDetailID: undefined,
image: '',
params: {},
type: type,
resource: 'appstore',
rebuild: false,
source: 'mirrors.ustc.edu.cn',
});
const extensions = ref();
let runtime = reactive<Runtime.RuntimeCreate>(initData('php'));
const rules = ref<any>({
name: [Rules.appName],
resource: [Rules.requiredInput],
appID: [Rules.requiredSelect],
version: [Rules.requiredInput, Rules.paramCommon],
image: [Rules.requiredInput, Rules.imageName],
source: [Rules.requiredSelect],
});
const phpSources = [
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',
@ -240,7 +228,30 @@ const phpSources = [
label: i18n.global.t('runtime.default'),
value: 'dl-cdn.alpinelinux.org',
},
];
];
const initData = (type: string) => ({
name: '',
appDetailID: undefined,
image: '',
params: {},
type: type,
resource: 'appstore',
rebuild: false,
source: phpSources[0].value,
});
const extensions = ref();
let runtime = reactive<Runtime.RuntimeCreate>(initData('php'));
const rules = ref<any>({
name: [Rules.appName],
resource: [Rules.requiredInput],
appID: [Rules.requiredSelect],
version: [Rules.requiredInput, Rules.paramCommon],
image: [Rules.requiredInput, Rules.imageName],
source: [Rules.requiredSelect],
});
const em = defineEmits(['close', 'submit']);