From 838927a32143cc5fd688419045c9497d912403e8 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 24 Dec 2020 13:57:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=20v-tester=20=E6=8C=87=E4=BB=A4=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=AA=E6=9C=89=E5=BD=93=E5=89=8D=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E7=A9=BA=E9=97=B4=E7=9A=84=E5=8F=AA=E8=AF=BB=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9A=84=E6=97=B6=E5=80=99=E9=9A=90=E8=97=8F=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/components/list/ApiList.vue | 588 +++++++++--------- .../components/module/ApiModuleHeader.vue | 214 +++---- frontend/src/business/main.js | 4 +- frontend/src/business/permission.js | 16 +- 4 files changed, 420 insertions(+), 402 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 000f4a6cb8..9f52e3bf0b 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -39,8 +39,9 @@ :label="$t('api_test.definition.api_type')" show-overflow-tooltip> @@ -78,10 +79,10 @@ @@ -97,326 +98,325 @@ diff --git a/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue b/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue index 27bc01b314..ae018299fd 100644 --- a/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue +++ b/frontend/src/business/components/api/definition/components/module/ApiModuleHeader.vue @@ -1,123 +1,125 @@ diff --git a/frontend/src/business/main.js b/frontend/src/business/main.js index aa30149491..5fa89340c7 100644 --- a/frontend/src/business/main.js +++ b/frontend/src/business/main.js @@ -11,7 +11,7 @@ import YanProgress from 'yan-progress'; import './permission' // permission control import i18n from "../i18n/i18n"; import store from "./store"; -import {permission, roles, xpack} from './permission' +import {permission, roles, tester, xpack} from './permission' import chart from "../common/js/chart"; import CalendarHeatmap from "../common/js/calendar-heatmap"; import '../common/css/menu-header.css'; @@ -41,6 +41,8 @@ Vue.directive('roles', roles); Vue.directive('xpack', xpack); +Vue.directive('tester', tester); + new Vue({ el: '#app', router, diff --git a/frontend/src/business/permission.js b/frontend/src/business/permission.js index c8d98f5bb6..2d9b98d271 100644 --- a/frontend/src/business/permission.js +++ b/frontend/src/business/permission.js @@ -1,6 +1,6 @@ import router from './components/common/router/router' import {TokenKey} from '@/common/js/constants'; -import {hasLicense, hasRolePermissions, hasRoles} from "@/common/js/utils"; +import {checkoutTestManagerOrTestUser, hasLicense, hasRolePermissions, hasRoles} from "@/common/js/utils"; import NProgress from 'nprogress' // progress bar import 'nprogress/nprogress.css' // progress bar style const whiteList = ['/login']; // no redirect whitelist @@ -25,6 +25,20 @@ export const xpack = { } }; +export const tester = { + inserted(el, binding) { + checkTestManagerOrTestUser(el, binding); + } +}; + +function checkTestManagerOrTestUser(el, binding) { + let v = checkoutTestManagerOrTestUser(); + + if (!v) { + el.parentNode && el.parentNode.removeChild(el) + } +} + function checkLicense(el, binding, type) { let v = hasLicense()