mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-10 15:36:45 +08:00
fix: Modify the license import method (#8495)
This commit is contained in:
parent
e75449f19d
commit
39502b355f
16 changed files with 48 additions and 29 deletions
|
@ -2,7 +2,9 @@
|
||||||
<div>
|
<div>
|
||||||
<DialogPro v-model="open" class="level-up-pro" @close="handleClose">
|
<DialogPro v-model="open" class="level-up-pro" @close="handleClose">
|
||||||
<div style="text-align: center" v-loading="loading">
|
<div style="text-align: center" v-loading="loading">
|
||||||
<span class="text-3xl font-medium title">{{ $t('license.levelUpPro') }}</span>
|
<span class="text-3xl font-medium title">
|
||||||
|
{{ isImport ? $t('license.importLicense') : $t('license.levelUpPro') }}
|
||||||
|
</span>
|
||||||
<el-row type="flex" justify="center" class="mt-6">
|
<el-row type="flex" justify="center" class="mt-6">
|
||||||
<el-col :span="22">
|
<el-col :span="22">
|
||||||
<el-upload
|
<el-upload
|
||||||
|
@ -25,12 +27,12 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
class="mt-3 w-52"
|
class="mt-3 w-52 custom-button"
|
||||||
:disabled="loading || uploaderFiles.length == 0"
|
:disabled="loading || uploaderFiles.length == 0"
|
||||||
plain
|
plain
|
||||||
@click="submit"
|
@click="submit"
|
||||||
>
|
>
|
||||||
{{ $t('license.power') }}
|
{{ isImport ? $t('commons.button.confirm') : $t('commons.button.power') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="mt-3 mb-5">
|
<div class="mt-3 mb-5">
|
||||||
<el-button text type="primary" @click="toLxware">{{ $t('license.knowMorePro') }}</el-button>
|
<el-button text type="primary" @click="toLxware">{{ $t('license.knowMorePro') }}</el-button>
|
||||||
|
@ -56,16 +58,19 @@ const loading = ref(false);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const uploadRef = ref<UploadInstance>();
|
const uploadRef = ref<UploadInstance>();
|
||||||
const uploaderFiles = ref<UploadFiles>([]);
|
const uploaderFiles = ref<UploadFiles>([]);
|
||||||
|
const isImport = ref();
|
||||||
|
|
||||||
const oldLicense = ref();
|
const oldLicense = ref();
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
oldLicense: string;
|
oldLicense: string;
|
||||||
|
isImport: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const acceptParams = (params: DialogProps) => {
|
const acceptParams = (params: DialogProps) => {
|
||||||
oldLicense.value = params?.oldLicense || '';
|
oldLicense.value = params?.oldLicense || '';
|
||||||
uploaderFiles.value = [];
|
uploaderFiles.value = [];
|
||||||
uploadRef.value?.clearFiles();
|
uploadRef.value?.clearFiles();
|
||||||
|
isImport.value = params?.isImport;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +105,12 @@ const submit = async () => {
|
||||||
const file = uploaderFiles.value[0];
|
const file = uploaderFiles.value[0];
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file.raw);
|
formData.append('file', file.raw);
|
||||||
formData.append('title', oldLicense.value);
|
if (oldLicense.value) {
|
||||||
|
formData.append('oldLicenseName', oldLicense.value);
|
||||||
|
}
|
||||||
|
if (!isImport.value) {
|
||||||
|
formData.append('currentNode', globalStore.currentNode);
|
||||||
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await uploadLicense(oldLicense.value, formData)
|
await uploadLicense(oldLicense.value, formData)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
|
@ -130,3 +140,8 @@ defineExpose({
|
||||||
acceptParams,
|
acceptParams,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.custom-button {
|
||||||
|
letter-spacing: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</span>
|
</span>
|
||||||
<div class="flex flex-wrap items-center">
|
<div class="flex flex-wrap items-center">
|
||||||
<el-link :underline="false" type="primary" @click="toLxware">
|
<el-link :underline="false" type="primary" @click="toLxware">
|
||||||
{{ $t(!isMasterProductPro ? 'license.community' : 'license.pro') }}
|
{{ $t(!isMasterPro ? 'license.community' : 'license.pro') }}
|
||||||
</el-link>
|
</el-link>
|
||||||
<el-link :underline="false" class="version" type="primary" @click="copyText(version)">
|
<el-link :underline="false" class="version" type="primary" @click="copyText(version)">
|
||||||
{{ version }}
|
{{ version }}
|
||||||
|
@ -52,9 +52,11 @@ import { storeToRefs } from 'pinia';
|
||||||
const globalStore = GlobalStore();
|
const globalStore = GlobalStore();
|
||||||
const { docsUrl } = storeToRefs(globalStore);
|
const { docsUrl } = storeToRefs(globalStore);
|
||||||
const upgradeRef = ref();
|
const upgradeRef = ref();
|
||||||
|
const isMasterPro = computed(() => {
|
||||||
|
return globalStore.isMasterPro();
|
||||||
|
});
|
||||||
|
|
||||||
const version = ref<string>('');
|
const version = ref<string>('');
|
||||||
const isMasterProductPro = ref();
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const upgradeInfo = ref();
|
const upgradeInfo = ref();
|
||||||
const upgradeVersion = ref();
|
const upgradeVersion = ref();
|
||||||
|
@ -119,7 +121,6 @@ const onLoadUpgradeInfo = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
isMasterProductPro.value = globalStore.isMasterProductPro;
|
|
||||||
search();
|
search();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -50,6 +50,7 @@ const message = {
|
||||||
verify: 'Verify',
|
verify: 'Verify',
|
||||||
saveAndEnable: 'Save and enable',
|
saveAndEnable: 'Save and enable',
|
||||||
import: 'Import',
|
import: 'Import',
|
||||||
|
power: 'Authorization',
|
||||||
search: 'Search',
|
search: 'Search',
|
||||||
refresh: 'Refresh',
|
refresh: 'Refresh',
|
||||||
get: 'Get',
|
get: 'Get',
|
||||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
||||||
verify: '確認する',
|
verify: '確認する',
|
||||||
saveAndEnable: '保存して有効にします',
|
saveAndEnable: '保存して有効にします',
|
||||||
import: '輸入',
|
import: '輸入',
|
||||||
|
power: '認可',
|
||||||
search: '検索',
|
search: '検索',
|
||||||
refresh: 'リロード',
|
refresh: 'リロード',
|
||||||
get: '得る',
|
get: '得る',
|
||||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
||||||
verify: '검증',
|
verify: '검증',
|
||||||
saveAndEnable: '저장 및 활성화',
|
saveAndEnable: '저장 및 활성화',
|
||||||
import: '가져오기',
|
import: '가져오기',
|
||||||
|
power: '권한 부여',
|
||||||
search: '검색',
|
search: '검색',
|
||||||
refresh: '새로고침',
|
refresh: '새로고침',
|
||||||
get: '가져오기',
|
get: '가져오기',
|
||||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
||||||
verify: 'Sahkan',
|
verify: 'Sahkan',
|
||||||
saveAndEnable: 'Simpan dan aktifkan',
|
saveAndEnable: 'Simpan dan aktifkan',
|
||||||
import: 'Import',
|
import: 'Import',
|
||||||
|
power: 'Pemberian Kuasa',
|
||||||
search: 'Cari',
|
search: 'Cari',
|
||||||
refresh: 'Segarkan',
|
refresh: 'Segarkan',
|
||||||
get: 'Dapatkan',
|
get: 'Dapatkan',
|
||||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
||||||
verify: 'Verificar',
|
verify: 'Verificar',
|
||||||
saveAndEnable: 'Salvar e ativar',
|
saveAndEnable: 'Salvar e ativar',
|
||||||
import: 'Importar',
|
import: 'Importar',
|
||||||
|
power: 'Autorização',
|
||||||
search: 'Pesquisar',
|
search: 'Pesquisar',
|
||||||
refresh: 'Atualizar',
|
refresh: 'Atualizar',
|
||||||
get: 'Obter',
|
get: 'Obter',
|
||||||
|
|
|
@ -48,6 +48,7 @@ const message = {
|
||||||
verify: 'Проверить',
|
verify: 'Проверить',
|
||||||
saveAndEnable: 'Сохранить и включить',
|
saveAndEnable: 'Сохранить и включить',
|
||||||
import: 'Импорт',
|
import: 'Импорт',
|
||||||
|
power: 'Авторизация',
|
||||||
search: 'Поиск',
|
search: 'Поиск',
|
||||||
refresh: 'Обновить',
|
refresh: 'Обновить',
|
||||||
get: 'Получить',
|
get: 'Получить',
|
||||||
|
|
|
@ -50,6 +50,7 @@ const message = {
|
||||||
verify: '驗證',
|
verify: '驗證',
|
||||||
saveAndEnable: '保存並啟用',
|
saveAndEnable: '保存並啟用',
|
||||||
import: '導入',
|
import: '導入',
|
||||||
|
power: '授權',
|
||||||
search: '搜索',
|
search: '搜索',
|
||||||
refresh: '刷新',
|
refresh: '刷新',
|
||||||
get: '獲取',
|
get: '獲取',
|
||||||
|
|
|
@ -50,6 +50,7 @@ const message = {
|
||||||
verify: '验证',
|
verify: '验证',
|
||||||
saveAndEnable: '保存并启用',
|
saveAndEnable: '保存并启用',
|
||||||
import: '导入',
|
import: '导入',
|
||||||
|
power: '授权',
|
||||||
search: '搜索',
|
search: '搜索',
|
||||||
refresh: '刷新',
|
refresh: '刷新',
|
||||||
get: '获取',
|
get: '获取',
|
||||||
|
@ -1755,7 +1756,6 @@ const message = {
|
||||||
lostHelper: '许可证已达到最大重试次数,请手动点击同步按钮,以确保专业版功能正常使用,详情:',
|
lostHelper: '许可证已达到最大重试次数,请手动点击同步按钮,以确保专业版功能正常使用,详情:',
|
||||||
exceptionalHelper: '许可证同步验证异常,请手动点击同步按钮,以确保专业版功能正常使用,详情:',
|
exceptionalHelper: '许可证同步验证异常,请手动点击同步按钮,以确保专业版功能正常使用,详情:',
|
||||||
quickUpdate: '快速更新',
|
quickUpdate: '快速更新',
|
||||||
power: '授 权',
|
|
||||||
unbindHelper: '解除绑定后将清除该节点所有专业版相关设置,是否继续?',
|
unbindHelper: '解除绑定后将清除该节点所有专业版相关设置,是否继续?',
|
||||||
importLicense: '导入许可证',
|
importLicense: '导入许可证',
|
||||||
importHelper: '请点击或拖动许可文件到此处',
|
importHelper: '请点击或拖动许可文件到此处',
|
||||||
|
|
|
@ -96,6 +96,9 @@ const nodeChangeRef = ref<DropdownInstance>();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
version: String,
|
version: String,
|
||||||
});
|
});
|
||||||
|
const isMasterPro = computed(() => {
|
||||||
|
return globalStore.isMasterPro();
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['openTask']);
|
const emit = defineEmits(['openTask']);
|
||||||
bus.on('refreshTask', () => {
|
bus.on('refreshTask', () => {
|
||||||
|
@ -128,7 +131,7 @@ const changeFilter = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadNodes = async () => {
|
const loadNodes = async () => {
|
||||||
if (!globalStore.isMasterProductPro) {
|
if (!isMasterPro.value) {
|
||||||
globalStore.currentNode = 'local';
|
globalStore.currentNode = 'local';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +159,7 @@ const changeNode = (command: string) => {
|
||||||
globalStore.currentNode = command || 'local';
|
globalStore.currentNode = command || 'local';
|
||||||
globalStore.isOffline = false;
|
globalStore.isOffline = false;
|
||||||
router.push({ name: 'home' }).then(() => {
|
router.push({ name: 'home' }).then(() => {
|
||||||
location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -177,14 +180,14 @@ const changeNode = (command: string) => {
|
||||||
globalStore.currentNode = command || 'local';
|
globalStore.currentNode = command || 'local';
|
||||||
globalStore.isOffline = item.isOffline;
|
globalStore.isOffline = item.isOffline;
|
||||||
router.push({ name: 'home' }).then(() => {
|
router.push({ name: 'home' }).then(() => {
|
||||||
location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const showNodes = () => {
|
const showNodes = () => {
|
||||||
return nodes.value.length > 0 && globalStore.isMasterProductPro;
|
return nodes.value.length > 0 && isMasterPro;
|
||||||
};
|
};
|
||||||
|
|
||||||
const taskCount = ref(0);
|
const taskCount = ref(0);
|
||||||
|
|
|
@ -112,14 +112,14 @@ const loadStatus = async () => {
|
||||||
await getSystemAvailable()
|
await getSystemAvailable()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
location.reload();
|
window.location.reload();
|
||||||
toLogin();
|
toLogin();
|
||||||
clearInterval(Number(timer));
|
clearInterval(Number(timer));
|
||||||
timer = null;
|
timer = null;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
location.reload();
|
window.location.reload();
|
||||||
clearInterval(Number(timer));
|
clearInterval(Number(timer));
|
||||||
timer = null;
|
timer = null;
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,6 +22,9 @@ const GlobalStore = defineStore({
|
||||||
logo: '',
|
logo: '',
|
||||||
logoWithText: '',
|
logoWithText: '',
|
||||||
favicon: '',
|
favicon: '',
|
||||||
|
loginImage: '',
|
||||||
|
loginBackground: '',
|
||||||
|
loginBgType: '',
|
||||||
},
|
},
|
||||||
openMenuTabs: false,
|
openMenuTabs: false,
|
||||||
isFullScreen: false,
|
isFullScreen: false,
|
||||||
|
@ -89,6 +92,9 @@ const GlobalStore = defineStore({
|
||||||
isMobile() {
|
isMobile() {
|
||||||
return this.device === DeviceType.Mobile;
|
return this.device === DeviceType.Mobile;
|
||||||
},
|
},
|
||||||
|
isMasterPro() {
|
||||||
|
return this.isMasterProductPro;
|
||||||
|
},
|
||||||
setLastFilePath(path: string) {
|
setLastFilePath(path: string) {
|
||||||
this.lastFilePath = path;
|
this.lastFilePath = path;
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,9 +22,7 @@ import { reactive, ref } from 'vue';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import { changeBind, listNodeOptions } from '@/api/modules/setting';
|
import { changeBind, listNodeOptions } from '@/api/modules/setting';
|
||||||
import { GlobalStore } from '@/store';
|
|
||||||
import { Setting } from '@/api/interface/setting';
|
import { Setting } from '@/api/interface/setting';
|
||||||
const globalStore = GlobalStore();
|
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
licenseID: number;
|
licenseID: number;
|
||||||
|
@ -61,7 +59,6 @@ const onBind = async () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
globalStore.isProductPro = false;
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
|
@ -63,7 +63,6 @@ const onBind = async (formEl: FormInstance | undefined) => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
globalStore.isProductPro = false;
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
|
@ -101,10 +101,7 @@ import BindXpack from '@/views/setting/license/bind/xpack.vue';
|
||||||
import { dateFormat } from '@/utils/util';
|
import { dateFormat } from '@/utils/util';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { MsgError, MsgSuccess } from '@/utils/message';
|
import { MsgError, MsgSuccess } from '@/utils/message';
|
||||||
import { GlobalStore } from '@/store';
|
|
||||||
import { initFavicon } from '@/utils/xpack';
|
|
||||||
|
|
||||||
const globalStore = GlobalStore();
|
|
||||||
const loading = ref();
|
const loading = ref();
|
||||||
const licenseRef = ref();
|
const licenseRef = ref();
|
||||||
const bindFreeRef = ref();
|
const bindFreeRef = ref();
|
||||||
|
@ -175,13 +172,7 @@ const submitUnbind = async () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
if (unbindRow.value.freeCount !== 0) {
|
|
||||||
globalStore.isMasterProductPro = false;
|
|
||||||
initFavicon();
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
return;
|
|
||||||
}
|
|
||||||
search();
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
@ -226,7 +217,7 @@ const timestampToDate = (timestamp: number) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const toUpload = () => {
|
const toUpload = () => {
|
||||||
licenseRef.value.acceptParams();
|
licenseRef.value.acceptParams({ isImport: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadVersion = (row: any) => {
|
const loadVersion = (row: any) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue