Skip to content

Commit af0d21c

Browse files
author
ssongliu
committed
feat: Page compatibility with Enterprise Edition requirements
1 parent 49fb2c0 commit af0d21c

36 files changed

Lines changed: 306 additions & 91 deletions

File tree

โ€Žfrontend/src/api/interface/setting.tsโ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,22 @@ export namespace Setting {
253253
smsTotal: number;
254254
smsUsed: number;
255255
}
256+
export interface LicenseEE {
257+
deviceID: string;
258+
corporation: string;
259+
isv: string;
260+
expired: string;
261+
product: string;
262+
edition: string;
263+
licenseVersion: string;
264+
count: number;
265+
serialNo: string;
266+
remark: string;
267+
ext: string;
268+
269+
status: string;
270+
message: string;
271+
}
256272
export interface NodeItem {
257273
id: number;
258274
addr: string;

โ€Žfrontend/src/api/modules/backup.tsโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const checkBackup = (params: Backup.BackupOperate) => {
2323
if (request.credential) {
2424
request.credential = Base64.encode(request.credential);
2525
}
26-
if (!params.isPublic || !globalStore.isProductPro) {
26+
if (!params.isPublic || !globalStore.isXpackNodeOrEE()) {
2727
return http.postLocalNode<Backup.CheckResult>(`/backups/conn/check`, request);
2828
}
2929
return http.post<Backup.CheckResult>(`/backups/conn/check`, request);
@@ -36,7 +36,7 @@ export const listBucket = (params: Backup.ForBucket) => {
3636
if (request.credential) {
3737
request.credential = Base64.encode(request.credential);
3838
}
39-
if (!params.isPublic || !globalStore.isProductPro) {
39+
if (!params.isPublic || !globalStore.isXpackNodeOrEE()) {
4040
return http.postLocalNode('/backups/buckets', request, TimeoutEnum.T_40S);
4141
}
4242
return http.post('/backups/buckets', request, TimeoutEnum.T_40S);

โ€Žfrontend/src/api/modules/setting.tsโ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export const listAppNodes = () => {
5757
export const loadNodeByUser = () => {
5858
return http.get<Array<Setting.NodeItem>>(`/core/xpackee/users/nodes`);
5959
};
60+
export const uploadXpackEELicense = (params: FormData) => {
61+
return http.upload('/core/xpackee/licenses/upload', params);
62+
};
63+
export const getXpackEELicense = () => {
64+
return http.get<Setting.LicenseEE>(`/core/xpackee/licenses/info`);
65+
};
6066
export const getXpackEELicenseStatus = () => {
6167
return http.get<Setting.LicenseStatus>(`/core/xpackee/licenses/status`);
6268
};

โ€Žfrontend/src/components/license-import/index.vueโ€Ž

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
import i18n from '@/lang';
6060
import { ref } from 'vue';
6161
import { MsgSuccess } from '@/utils/message';
62-
import { uploadLicense } from '@/api/modules/setting';
62+
import { uploadLicense, uploadXpackEELicense } from '@/api/modules/setting';
6363
import DockerProxy from '@/components/docker-proxy/index.vue';
6464
import { GlobalStore } from '@/store';
6565
import { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile, genFileId } from 'element-plus';
@@ -126,6 +126,19 @@ const submit = async () => {
126126
const file = uploaderFiles.value[0];
127127
const formData = new FormData();
128128
formData.append('file', file.raw);
129+
if (globalStore.isXpackEE) {
130+
loading.value = true;
131+
await uploadXpackEELicense(formData)
132+
.then(async () => {
133+
handleAfterSubmit();
134+
})
135+
.catch(() => {
136+
loading.value = false;
137+
uploadRef.value!.clearFiles();
138+
uploaderFiles.value = [];
139+
});
140+
return;
141+
}
129142
if (oldLicense.value) {
130143
formData.append('oldLicenseName', oldLicense.value);
131144
}
@@ -137,23 +150,7 @@ const submit = async () => {
137150
loading.value = true;
138151
await uploadLicense(oldLicense.value, formData)
139152
.then(async () => {
140-
loading.value = false;
141-
uploadRef.value!.clearFiles();
142-
uploaderFiles.value = [];
143-
open.value = false;
144-
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
145-
if (!isImport.value) {
146-
globalStore.isProductPro = true;
147-
globalStore.isMasterProductPro = true;
148-
}
149-
if (!withoutReload.value) {
150-
loadMasterProductProFromDB();
151-
loadProductProFromDB();
152-
getXpackSettingForTheme();
153-
window.location.reload();
154-
} else {
155-
em('search');
156-
}
153+
handleAfterSubmit();
157154
})
158155
.catch(() => {
159156
loading.value = false;
@@ -162,6 +159,28 @@ const submit = async () => {
162159
});
163160
};
164161
162+
const handleAfterSubmit = () => {
163+
loading.value = false;
164+
uploadRef.value!.clearFiles();
165+
uploaderFiles.value = [];
166+
open.value = false;
167+
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
168+
if (!isImport.value) {
169+
if (!globalStore.isXpackEE) globalStore.isProductPro = true;
170+
globalStore.isMasterProductPro = true;
171+
} else {
172+
globalStore.isXpackEELicensed = true;
173+
}
174+
if (!withoutReload.value) {
175+
loadMasterProductProFromDB();
176+
loadProductProFromDB();
177+
getXpackSettingForTheme();
178+
window.location.reload();
179+
} else {
180+
em('search');
181+
}
182+
};
183+
165184
defineExpose({
166185
acceptParams,
167186
});

โ€Žfrontend/src/components/system-upgrade/index.vueโ€Ž

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
</span>
1919
<div class="flex flex-wrap items-center">
2020
<el-link underline="never" type="primary" @click="toLxware">
21-
<span v-if="isMasterPro">
21+
<span v-if="isXpackEE">
22+
{{ $t('license.ee') }}
23+
</span>
24+
<span v-else-if="isMasterPro">
2225
{{ $t('license.pro') }}
2326
</span>
2427
<span v-else-if="isOffLine">
@@ -68,6 +71,9 @@ const releasesRef = ref();
6871
const isMasterPro = computed(() => {
6972
return globalStore.isMasterPro();
7073
});
74+
const isXpackEE = computed(() => {
75+
return globalStore.isEE();
76+
});
7177
7278
const version = ref<string>('');
7379
const loading = ref(false);

โ€Žfrontend/src/global/use-theme.tsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const useTheme = () => {
1111
itemTheme = prefersDark ? 'dark' : 'light';
1212
}
1313
document.documentElement.className = itemTheme === 'dark' ? 'dark' : 'light';
14-
if (globalStore.isMasterProductPro && themeConfig.themeColor) {
14+
if (globalStore.isXpackOrEE() && themeConfig.themeColor) {
1515
try {
1616
const themeColor = JSON.parse(themeConfig.themeColor);
1717
const color = itemTheme === 'dark' ? themeColor.dark : themeColor.light;

โ€Žfrontend/src/lang/modules/en.tsโ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,6 +2168,7 @@ const message = {
21682168
community: 'OSS',
21692169
oss: 'Open Source Software',
21702170
pro: 'Pro',
2171+
ee: 'Enterprise Edition',
21712172
trial: 'Trial',
21722173
add: 'Add Community Edition',
21732174
licenseBindHelper: 'Free node quotas can only be used when the license is bound to a node',
@@ -2199,6 +2200,16 @@ const message = {
21992200
knowMorePro: 'Learn More',
22002201
closeAlert: 'The current page can be closed in the panel settings',
22012202
introduce: 'Feature Introduction',
2203+
deviceID: 'Device ID',
2204+
corporation: 'Licensing Company',
2205+
expired: 'Expiration Date',
2206+
edition: 'Edition',
2207+
standard: 'Standard Edition',
2208+
enterprise: 'Enterprise Edition',
2209+
licenseVersion: 'License Version',
2210+
count: 'License Count',
2211+
serialNo: 'Serial Number',
2212+
remark: 'Remarks',
22022213
waf: 'Upgrading to the professional version can provide features such as interception map, logs, block records, geographical location blocking, custom rules, custom interception pages, etc.',
22032214
tamper: 'Upgrading to the professional version can protect websites from unauthorized modifications or tampering.',
22042215
tamperHelper: 'Operation failed, the file or folder has tamper protection enabled. Please check and try again!',

โ€Žfrontend/src/lang/modules/es-es.tsโ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,7 @@ const message = {
21852185
community: 'OSS',
21862186
oss: 'Software Open Source',
21872187
pro: 'Pro',
2188+
ee: 'Ediciรณn Empresarial',
21882189
trial: 'Prueba',
21892190
add: 'Agregar versiรณn Community',
21902191
licenseBindHelper:
@@ -2215,6 +2216,16 @@ const message = {
22152216
knowMorePro: 'Ver mรกs',
22162217
closeAlert: 'Puede cerrar la pรกgina en la configuraciรณn del panel',
22172218
introduce: 'Introducciรณn de funciones',
2219+
deviceID: 'ID del Dispositivo',
2220+
corporation: 'Empresa Licenciadora',
2221+
expired: 'Fecha de Vencimiento',
2222+
edition: 'Ediciรณn',
2223+
standard: 'Ediciรณn Estรกndar',
2224+
enterprise: 'Ediciรณn Empresarial',
2225+
licenseVersion: 'Versiรณn de la Licencia',
2226+
count: 'Cantidad de Licencias',
2227+
serialNo: 'Nรบmero de Serie',
2228+
remark: 'Comentarios',
22182229
waf: 'Actualizar a Pro permite interceptaciรณn, logs, geobloqueo, reglas, pรกginas personalizadas, etc.',
22192230
tamper: 'Actualizar a Pro protege sitios ante modificaciones no autorizadas.',
22202231
tamperHelper:

โ€Žfrontend/src/lang/modules/ja.tsโ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,6 +2087,7 @@ const message = {
20872087
community: '็„กๆ–™',
20882088
oss: '็„กๆ–™',
20892089
pro: 'ๅฐ‚้–€',
2090+
ee: 'ใ‚จใƒณใ‚ฟใƒผใƒ—ใƒฉใ‚คใ‚บ็‰ˆ',
20902091
trial: 'ไฝ“้จ“',
20912092
add: 'ใ‚ณใƒŸใƒฅใƒ‹ใƒ†ใ‚ฃ็‰ˆใ‚’่ฟฝๅŠ ',
20922093
licenseBindHelper: 'ใƒฉใ‚คใ‚ปใƒณใ‚นใŒใƒŽใƒผใƒ‰ใซใƒใ‚คใƒณใƒ‰ใ•ใ‚Œใฆใ„ใ‚‹ๅ ดๅˆใซใฎใฟใ€็„กๆ–™ใƒŽใƒผใƒ‰ใ‚ฏใ‚ฉใƒผใ‚ฟใ‚’ไฝฟ็”จใงใใพใ™',
@@ -2120,6 +2121,16 @@ const message = {
21202121
knowMorePro: 'ใ‚‚ใฃใจ่ฉณใ—ใ็Ÿฅใ‚‹',
21212122
closeAlert: '็พๅœจใฎใƒšใƒผใ‚ธใฏใƒ‘ใƒใƒซ่จญๅฎšใง้–‰ใ˜ใ‚‹ใ“ใจใŒใงใใพใ™',
21222123
introduce: 'ๆฉŸ่ƒฝใฎ็ดนไป‹',
2124+
deviceID: 'ใƒ‡ใƒใ‚คใ‚นID',
2125+
corporation: 'ใƒฉใ‚คใ‚ปใƒณใ‚นไผš็คพ',
2126+
expired: 'ๆœ‰ๅŠนๆœŸ้™',
2127+
edition: 'ใ‚จใƒ‡ใ‚ฃใ‚ทใƒงใƒณ',
2128+
standard: 'ใ‚นใ‚ฟใƒณใƒ€ใƒผใƒ‰็‰ˆ',
2129+
enterprise: 'ใ‚จใƒณใ‚ฟใƒผใƒ—ใƒฉใ‚คใ‚บ็‰ˆ',
2130+
licenseVersion: 'ใƒฉใ‚คใ‚ปใƒณใ‚นใƒใƒผใ‚ธใƒงใƒณ',
2131+
count: 'ใƒฉใ‚คใ‚ปใƒณใ‚นๆ•ฐ',
2132+
serialNo: 'ใ‚ทใƒชใ‚ขใƒซ็•ชๅท',
2133+
remark: 'ๅ‚™่€ƒ',
21232134
waf: 'ใƒ—ใƒญใƒ•ใ‚งใƒƒใ‚ทใƒงใƒŠใƒซใƒใƒผใ‚ธใƒงใƒณใซใ‚ขใƒƒใƒ—ใ‚ฐใƒฌใƒผใƒ‰ใ™ใ‚‹ใจใ€ใ‚คใƒณใ‚ฟใƒผใ‚ปใƒ—ใƒˆใƒžใƒƒใƒ—ใ€ใƒญใ‚ฐใ€ใƒ–ใƒญใƒƒใ‚ฏใƒฌใ‚ณใƒผใƒ‰ใ€ๅœฐ็†็š„ไฝ็ฝฎใƒ–ใƒญใƒƒใ‚ญใƒณใ‚ฐใ€ใ‚ซใ‚นใ‚ฟใƒ ใƒซใƒผใƒซใ€ใ‚ซใ‚นใ‚ฟใƒ ใ‚คใƒณใ‚ฟใƒผใ‚ปใƒ—ใƒˆใƒšใƒผใ‚ธใชใฉใฎๆฉŸ่ƒฝใ‚’ๆไพ›ใงใใพใ™ใ€‚',
21242135
tamper: 'ใƒ—ใƒญใฎใƒใƒผใ‚ธใƒงใƒณใซใ‚ขใƒƒใƒ—ใ‚ฐใƒฌใƒผใƒ‰ใ™ใ‚‹ใจใ€ไธๆญฃใชๅค‰ๆ›ดใ‚„ๆ”นใ–ใ‚“ใ‹ใ‚‰Webใ‚ตใ‚คใƒˆใ‚’ไฟ่ญทใงใใพใ™ใ€‚',
21252136
setting:

โ€Žfrontend/src/lang/modules/ko.tsโ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,7 @@ const message = {
20522052
community: 'OSS',
20532053
oss: '์˜คํ”ˆ ์†Œ์Šค ์†Œํ”„ํŠธ์›จ์–ด',
20542054
pro: 'Pro',
2055+
ee: '์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์—๋””์…˜',
20552056
trial: '์ฒดํ—˜ํŒ',
20562057
add: '์ปค๋ฎค๋‹ˆํ‹ฐ ์—๋””์…˜ ์ถ”๊ฐ€',
20572058
licenseBindHelper: '๋ผ์ด์„ ์Šค๊ฐ€ ๋…ธ๋“œ์— ๋ฐ”์ธ๋”ฉ๋œ ๊ฒฝ์šฐ์—๋งŒ ๋ฌด๋ฃŒ ๋…ธ๋“œ ํ• ๋‹น๋Ÿ‰์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค',
@@ -2084,6 +2085,16 @@ const message = {
20842085
knowMorePro: '๋” ์•Œ์•„๋ณด๊ธฐ',
20852086
closeAlert: 'ํ˜„์žฌ ํŽ˜์ด์ง€๋Š” ํŒจ๋„ ์„ค์ •์—์„œ ๋‹ซ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.',
20862087
introduce: '๊ธฐ๋Šฅ ์†Œ๊ฐœ',
2088+
deviceID: '์žฅ์น˜ ID',
2089+
corporation: '๋ผ์ด์„ ์‹ฑ ํšŒ์‚ฌ',
2090+
expired: '๋งŒ๋ฃŒ ๋‚ ์งœ',
2091+
edition: '์—๋””์…˜',
2092+
standard: '์Šคํƒ ๋‹ค๋“œ ์—๋””์…˜',
2093+
enterprise: '์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ์—๋””์…˜',
2094+
licenseVersion: '๋ผ์ด์„ ์Šค ๋ฒ„์ „',
2095+
count: '๋ผ์ด์„ ์Šค ์ˆ˜',
2096+
serialNo: '์ผ๋ จ๋ฒˆํ˜ธ',
2097+
remark: '๋น„๊ณ ',
20872098
waf: '์ „๋ฌธ ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜๋ฉด ์ฐจ๋‹จ ๋งต, ๋กœ๊ทธ, ์ฐจ๋‹จ ๊ธฐ๋ก, ์ง€๋ฆฌ์  ์œ„์น˜ ์ฐจ๋‹จ, ์‚ฌ์šฉ์ž ์ •์˜ ๊ทœ์น™, ์‚ฌ์šฉ์ž ์ •์˜ ์ฐจ๋‹จ ํŽ˜์ด์ง€ ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ์ œ๊ณต๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.',
20882099
tamper: '์ „๋ฌธ ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜๋ฉด ์›น์‚ฌ์ดํŠธ๋ฅผ ๋ฌด๋‹จ ์ˆ˜์ •์ด๋‚˜ ๋ณ€์กฐ๋กœ๋ถ€ํ„ฐ ๋ณดํ˜ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.',
20892100
setting: '์ „๋ฌธ ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜๋ฉด ํŒจ๋„ ๋กœ๊ณ , ํ™˜์˜ ๋ฉ”์‹œ์ง€ ๋“ฑ ์ •๋ณด๋ฅผ ์‚ฌ์šฉ์ž ์ •์˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.',

0 commit comments

Comments
ย (0)