Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-09-23 18:49:48 +08:00
commit 299abdb705
6 changed files with 34 additions and 8 deletions

View File

@ -29,7 +29,7 @@
<span class="environment-name">{{ request.environment ? request.environment.name + ': ' : '' }}</span>
<span class="environment-url">{{ displayUrl }}</span>
<span v-if="!displayUrl"
class="environment-url-tip">{{ $t('api_test.request.please_configure_environment_in_scenario') }}</span>
class="environment-url-tip">{{ $t('api_test.request.please_configure_socket_in_environment') }}</span>
</el-tag>
</el-form-item>

View File

@ -246,7 +246,7 @@ export class Scenario extends BaseConfig {
isValid() {
if (this.enable) {
for (let i = 0; i < this.requests.length; i++) {
let validator = this.requests[i].isValid(this.environmentId);
let validator = this.requests[i].isValid(this.environmentId, this.environment);
if (!validator.isValid) {
return validator;
}
@ -357,7 +357,7 @@ export class HttpRequest extends Request {
return options;
}
isValid(environmentId) {
isValid(environmentId, environment) {
if (this.enable) {
if (this.useEnvironment) {
if (!environmentId) {
@ -366,6 +366,12 @@ export class HttpRequest extends Request {
info: 'api_test.request.please_configure_environment_in_scenario'
}
}
if (!environment.config.httpConfig.socket) {
return {
isValid: false,
info: 'api_test.request.please_configure_socket_in_environment'
}
}
} else {
if (!this.url) {
return {

View File

@ -47,11 +47,14 @@
<script>
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "@/common/js/utils";
import Setting from "@/business/components/settings/router";
import {LicenseKey} from '@/common/js/constants';
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const component = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : null;
export default {
name: "MsSettingMenu",
data() {
let valid = false;
let getMenus = function (group) {
let menus = [];
Setting.children.forEach(child => {
@ -59,10 +62,7 @@
let menu = {index: Setting.path + "/" + child.path}
menu.title = child.meta.title;
menu.roles = child.meta.roles;
if (child.meta.valid != undefined && child.meta.valid === true) {
menu.valid = child.meta.valid;
valid = true;
}
menus.push(menu);
}
})
@ -77,7 +77,24 @@
isCurrentWorkspaceUser: false,
}
},
methods: {
valid() {
Promise.all([component.default.valid(this)]).then(() => {
let license = localStorage.getItem(LicenseKey);
if (license != "valid") {
this.systems.forEach(item => {
if (item.valid === true) {
this.systems.splice(this.systems.indexOf(item), 1);
}
})
}
})
}
},
mounted() {
if (component != null) {
this.valid();
}
this.isCurrentOrganizationAdmin = checkoutCurrentOrganization();
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
},

View File

@ -466,6 +466,7 @@ export default {
path: "Path",
address: "Address",
refer_to_environment: "Use Environment",
please_configure_socket_in_environment: "Please Configure Path In The Environment",
please_configure_environment_in_scenario: "Please Configure Environment In The Scenario",
please_add_environment_to_scenario: "Please Add The Environment Configuration To The Scenario First",
url_description: "etc: https://fit2cloud.com",

View File

@ -466,6 +466,7 @@ export default {
path: "请求路径",
address: "请求地址",
refer_to_environment: "引用环境",
please_configure_socket_in_environment: "请在环境中配置环境域名",
please_configure_environment_in_scenario: "请在场景中配置环境",
please_add_environment_to_scenario: "请先在场景中添加环境配置",
url_description: "例如https://fit2cloud.com",

View File

@ -466,6 +466,7 @@ export default {
path: "請求路徑",
address: "請求地址",
refer_to_environment: "引用環境",
please_configure_socket_in_environment: "請在環境中配置環境域名",
please_configure_environment_in_scenario: "請在場景中配置環境",
please_add_environment_to_scenario: "請先在場景中添加環境配置",
url_description: "例如https://fit2cloud.com",