refactor(XPack): license增强校验,并对过期时间进行展示
This commit is contained in:
parent
7b8aaaebb6
commit
56db0e077b
|
@ -55,7 +55,7 @@ public class XmindToTestCaseParser {
|
|||
// 递归处理案例数据
|
||||
private void makeXmind(StringBuffer processBuffer, Attached parent, int level, String nodePath, List<Attached> attacheds) {
|
||||
for (Attached item : attacheds) {
|
||||
if (isBlack(item.getTitle(), "(?:tc|tc)")) { // 用例
|
||||
if (isBlack(item.getTitle(), "(?:tc:|tc:|tc)")) { // 用例
|
||||
item.setParent(parent);
|
||||
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<template>
|
||||
<el-col v-if="auth">
|
||||
<el-row id="header-top1" type="flex" justify="space-between" align="middle">
|
||||
<el-col>
|
||||
<div class="license-head" v-if="valid === true && validData.status == 'expired'">License has expired since
|
||||
{{(validData!= undefined && validData.license!= undefined) ? validData.license.expired:''}},please
|
||||
update license.
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row id="header-top" type="flex" justify="space-between" align="middle">
|
||||
|
||||
<el-col :span="12">
|
||||
|
@ -26,11 +34,22 @@
|
|||
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
|
||||
import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
|
||||
import {saveLocalStorage} from "../common/js/utils";
|
||||
import {saveLicense} from "../common/js/utils";
|
||||
import Setting from "@/business/components/settings/router";
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
data() {
|
||||
let xpack = false;
|
||||
Setting.children.forEach(child => {
|
||||
if (child.path === "license") {
|
||||
xpack = true;
|
||||
return;
|
||||
}
|
||||
})
|
||||
return {
|
||||
valid: xpack,
|
||||
validData: {},
|
||||
auth: false
|
||||
}
|
||||
},
|
||||
|
@ -47,6 +66,15 @@
|
|||
window.location.href = "/login"
|
||||
});
|
||||
},
|
||||
beforeMount() {
|
||||
if (this.valid === true) {
|
||||
// 验证license
|
||||
this.result = this.$get("/license/valid", response => {
|
||||
this.validData = response.data;
|
||||
saveLicense(response.data);
|
||||
});
|
||||
}
|
||||
},
|
||||
components: {MsLanguageSwitch, MsUser, MsView, MsTopMenus, MsHeaderOrgWs},
|
||||
methods: {}
|
||||
}
|
||||
|
@ -98,5 +126,13 @@
|
|||
.align-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.license-head {
|
||||
height: 30px;
|
||||
background: #BA331B;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<script>
|
||||
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "@/common/js/utils";
|
||||
import Setting from "@/business/components/settings/router";
|
||||
import {LicenseKey} from '@/common/js/constants';
|
||||
|
||||
export default {
|
||||
name: "MsSettingMenu",
|
||||
|
@ -87,35 +88,35 @@
|
|||
},
|
||||
methods: {
|
||||
valid() {
|
||||
let _this = this;
|
||||
this.result = this.$get("/license/valid", response => {
|
||||
let data = response.data;
|
||||
if (data === undefined || data === null || data.status != "valid") {
|
||||
this.systems.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
_this.systems.splice(this.systems.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
let data = localStorage.getItem(LicenseKey);
|
||||
if (data != undefined && data != null) {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
if (data === undefined || data === null || data.status != "valid") {
|
||||
this.systems.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
this.systems.splice(this.systems.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
|
||||
this.organizations.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
_this.organizations.splice(this.organizations.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
this.organizations.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
this.organizations.splice(this.organizations.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
|
||||
this.workspaces.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
_this.workspaces.splice(this.workspaces.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
this.workspaces.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
this.workspaces.splice(this.workspaces.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
|
||||
this.persons.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
_this.persons.splice(this.persons.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
this.persons.forEach(item => {
|
||||
if (item.valid != undefined && item.valid === true) {
|
||||
this.persons.splice(this.persons.indexOf(item), 1);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export const TokenKey = 'Admin-Token';
|
||||
export const LicenseKey = 'License';
|
||||
export const DEFAULT_LANGUAGE = 'default_language';
|
||||
|
||||
export const ROLE_ADMIN = 'admin';
|
||||
|
|
|
@ -5,7 +5,8 @@ import {
|
|||
ROLE_TEST_MANAGER,
|
||||
ROLE_TEST_USER,
|
||||
ROLE_TEST_VIEWER,
|
||||
TokenKey
|
||||
TokenKey,
|
||||
LicenseKey
|
||||
} from "./constants";
|
||||
import axios from "axios";
|
||||
|
||||
|
@ -90,6 +91,12 @@ export function saveLocalStorage(response) {
|
|||
localStorage.setItem("roles", roles);
|
||||
}
|
||||
|
||||
export function saveLicense(data) {
|
||||
// 保存License
|
||||
localStorage.setItem(LicenseKey, JSON.stringify(data));
|
||||
}
|
||||
|
||||
|
||||
export function refreshSessionAndCookies(sign, sourceId) {
|
||||
axios.post(REFRESH_SESSION_USER_URL + "/" + sign + "/" + sourceId).then(r => {
|
||||
saveLocalStorage(r.data);
|
||||
|
@ -175,7 +182,7 @@ export function downloadFile(name, content) {
|
|||
}
|
||||
}
|
||||
|
||||
export function listenGoBack( callback) {
|
||||
export function listenGoBack(callback) {
|
||||
//监听浏览器返回操作,关闭该对话框
|
||||
if (window.history && window.history.pushState) {
|
||||
history.pushState(null, null, document.URL);
|
||||
|
@ -189,9 +196,10 @@ export function removeGoBackListener(callback) {
|
|||
|
||||
export function getUUID() {
|
||||
function S4() {
|
||||
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
||||
}
|
||||
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
|
||||
|
||||
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue