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:
parent
6f3c5586fc
commit
dab83fee20
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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',
|
||||
@ -242,6 +230,29 @@ const phpSources = [
|
||||
},
|
||||
];
|
||||
|
||||
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']);
|
||||
|
||||
const handleClose = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user