fix(测试跟踪): 首页跳转权限控制

--bug=1018781 --user=李玉号 【系统设置】用户只开启接口、测试跟踪、性能的首页权限登陆查看缺少模块显示
https://www.tapd.cn/55049933/s/1297747
This commit is contained in:
shiziyuan9527 2022-11-17 16:54:40 +08:00 committed by lyh
parent a8ecb20a36
commit bef431e582
17 changed files with 102 additions and 37 deletions

View File

@ -22,7 +22,7 @@
<el-col :span="12"> <el-col :span="12">
<span class="main-info-card-title">{{ $t("home.dashboard.public.this_week") }}</span> <span class="main-info-card-title">{{ $t("home.dashboard.public.this_week") }}</span>
<div class="common-amount"> <div class="common-amount">
<el-button class="common-amount-button" @click="redirect('createdInWeek')"> <el-button class="common-amount-button" v-permission-disable="linkPermission" @click="redirect('createdInWeek')">
+{{ countData.createdInWeek }} +{{ countData.createdInWeek }}
<img class="main-info-card-right" src="/assets/figma/icon_right_outlined.svg" alt=""> <img class="main-info-card-right" src="/assets/figma/icon_right_outlined.svg" alt="">
</el-button> </el-button>
@ -31,7 +31,7 @@
<el-col :span="12"> <el-col :span="12">
<span class="main-info-card-title">{{ $t("home.dashboard.public.fake_error") }}</span> <span class="main-info-card-title">{{ $t("home.dashboard.public.fake_error") }}</span>
<div class="common-amount"> <div class="common-amount">
<el-button class="common-amount-button" @click="redirect('fakeError')"> <el-button class="common-amount-button" v-permission-disable="linkPermission" @click="redirect('fakeError')">
{{ countData.fakeErrorCount }} {{ countData.fakeErrorCount }}
<img class="main-info-card-right" src="/assets/figma/icon_right_outlined.svg" alt=""> <img class="main-info-card-right" src="/assets/figma/icon_right_outlined.svg" alt="">
</el-button> </el-button>
@ -54,6 +54,7 @@ export default {
countData: Object, countData: Object,
redirectPageName: String, redirectPageName: String,
redirectDataType: String, redirectDataType: String,
linkPermission: []
}, },
methods: { methods: {
redirect(seletDataType) { redirect(seletDataType) {

View File

@ -15,6 +15,7 @@
import MsChart from "metersphere-frontend/src/components/chart/MsChart"; import MsChart from "metersphere-frontend/src/components/chart/MsChart";
import {formatNumber} from "@/api/home"; import {formatNumber} from "@/api/home";
import {getUUID} from "metersphere-frontend/src/utils"; import {getUUID} from "metersphere-frontend/src/utils";
import {hasPermission} from "metersphere-frontend/src/utils/permission";
export default { export default {
name: "CountChart", name: "CountChart",
@ -173,7 +174,7 @@ export default {
}, },
} }
}, },
sublink: "/#/api/definition/" + getUUID() + "/api/thisWeekCount", sublink: hasPermission('PROJECT_API_DEFINITION:READ') ? "/#/api/definition/" + getUUID() + "/api/thisWeekCount" : "",
subtextStyle: { subtextStyle: {
color: "#1F2329", color: "#1F2329",
fontSize: 12, fontSize: 12,

View File

@ -19,6 +19,7 @@
:is-execute-info="false" :is-execute-info="false"
redirect-page-name="api" redirect-page-name="api"
redirect-data-type="apiTestCase" redirect-data-type="apiTestCase"
:link-permission="['PROJECT_API_DEFINITION:READ']"
@redirectPage="redirectPage"/> @redirectPage="redirectPage"/>
</el-col> </el-col>
<el-col :span=" 12 <el-col :span=" 12
@ -46,7 +47,7 @@
{{ $t("home.dashboard.public.covered") }} {{ $t("home.dashboard.public.covered") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'api', 'coveredTestCase', null)"> @click="redirectPage('api', 'api', 'coveredTestCase', null)">
{{ formatAmount(apiCaseData.coveredCount) }} {{ formatAmount(apiCaseData.coveredCount) }}
</el-link> </el-link>
@ -57,7 +58,7 @@
{{ $t("home.dashboard.public.not_covered") }} {{ $t("home.dashboard.public.not_covered") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'api', 'notCoveredTestCase', null)"> @click="redirectPage('api', 'api', 'notCoveredTestCase', null)">
{{ formatAmount(apiCaseData.notCoveredCount) }} {{ formatAmount(apiCaseData.notCoveredCount) }}
</el-link> </el-link>
@ -84,7 +85,7 @@
{{ $t("home.dashboard.public.executed") }} {{ $t("home.dashboard.public.executed") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'apiTestCase', 'executedCount', null)"> @click="redirectPage('api', 'apiTestCase', 'executedCount', null)">
{{ formatAmount(apiCaseData.executedCount) }} {{ formatAmount(apiCaseData.executedCount) }}
</el-link> </el-link>
@ -95,7 +96,7 @@
{{ $t("home.dashboard.public.not_executed") }} {{ $t("home.dashboard.public.not_executed") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'apiTestCase', 'unexecuteCount', null)"> @click="redirectPage('api', 'apiTestCase', 'unexecuteCount', null)">
{{ formatAmount(apiCaseData.notExecutedCount) }} {{ formatAmount(apiCaseData.notExecutedCount) }}
</el-link> </el-link>
@ -122,7 +123,7 @@
{{ $t("home.dashboard.public.pass") }} {{ $t("home.dashboard.public.pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'apiTestCase', 'executionPassCount', null)"> @click="redirectPage('api', 'apiTestCase', 'executionPassCount', null)">
{{ formatAmount(apiCaseData.passCount) }} {{ formatAmount(apiCaseData.passCount) }}
</el-link> </el-link>
@ -133,7 +134,7 @@
{{ $t("home.dashboard.public.not_pass") }} {{ $t("home.dashboard.public.not_pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'apiTestCase', 'executionFailedCount', null)"> @click="redirectPage('api', 'apiTestCase', 'executionFailedCount', null)">
{{ formatAmount(apiCaseData.unPassCount) }} {{ formatAmount(apiCaseData.unPassCount) }}
</el-link> </el-link>

View File

@ -32,7 +32,8 @@
{{ $t('home.dashboard.public.covered') }} {{ $t('home.dashboard.public.covered') }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('api', 'api', 'covered', null)"> <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'api', 'covered', null)">
{{ formatAmount(apiData.coveredCount) }} {{ formatAmount(apiData.coveredCount) }}
</el-link> </el-link>
</div> </div>
@ -42,7 +43,8 @@
{{ $t('home.dashboard.public.not_covered') }} {{ $t('home.dashboard.public.not_covered') }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('api', 'api', 'notCovered', null)"> <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'api', 'notCovered', null)">
{{ formatAmount(apiData.notCoveredCount) }} {{ formatAmount(apiData.notCoveredCount) }}
</el-link> </el-link>
</div> </div>
@ -68,7 +70,7 @@
{{ $t("home.dashboard.public.completed") }} {{ $t("home.dashboard.public.completed") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('api', 'api', 'Completed', null)"> <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']" @click="redirectPage('api', 'api', 'Completed', null)">
{{ formatAmount(apiData.finishedCount) }} {{ formatAmount(apiData.finishedCount) }}
</el-link> </el-link>
</div> </div>
@ -78,7 +80,7 @@
{{ $t("home.dashboard.public.underway") }} {{ $t("home.dashboard.public.underway") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('api', 'api', 'Underway', null)"> <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']" @click="redirectPage('api', 'api', 'Underway', null)">
{{ formatAmount(apiData.runningCount) }} {{ formatAmount(apiData.runningCount) }}
</el-link> </el-link>
</div> </div>
@ -88,7 +90,7 @@
{{ $t("home.dashboard.public.prepared") }} {{ $t("home.dashboard.public.prepared") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('api', 'api', 'Prepare', null)"> <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']" @click="redirectPage('api', 'api', 'Prepare', null)">
{{ formatAmount(apiData.notStartedCount) }} {{ formatAmount(apiData.notStartedCount) }}
</el-link> </el-link>
</div> </div>

View File

@ -18,11 +18,13 @@
<main-info-card :title="$t('home.dashboard.scenario.title')" :count-data="scenarioData" <main-info-card :title="$t('home.dashboard.scenario.title')" :count-data="scenarioData"
redirect-page-name="scenario" redirect-page-name="scenario"
redirect-data-type="scenario" redirect-data-type="scenario"
:link-permission="['PROJECT_API_SCENARIO:READ']"
@redirectPage="redirectPage" @redirectPage="redirectPage"
:is-execute-info="false"/> :is-execute-info="false"/>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<main-info-card :title="$t('home.dashboard.public.executed_times_in_week')" :count-data="scenarioData" <main-info-card :link-permission="['PROJECT_API_SCENARIO:READ']"
:title="$t('home.dashboard.public.executed_times_in_week')" :count-data="scenarioData"
:is-execute-info="true"/> :is-execute-info="true"/>
</el-col> </el-col>
</el-row> </el-row>
@ -45,7 +47,7 @@
{{ $t("home.dashboard.public.covered") }} {{ $t("home.dashboard.public.covered") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'api', 'coveredScenario', null)"> @click="redirectPage('api', 'api', 'coveredScenario', null)">
{{ formatAmount(scenarioData.coveredCount) }} {{ formatAmount(scenarioData.coveredCount) }}
</el-link> </el-link>
@ -56,7 +58,7 @@
{{ $t("home.dashboard.public.not_covered") }} {{ $t("home.dashboard.public.not_covered") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage('api', 'api', 'notCoveredScenario', null)"> @click="redirectPage('api', 'api', 'notCoveredScenario', null)">
{{ formatAmount(scenarioData.notCoveredCount) }} {{ formatAmount(scenarioData.notCoveredCount) }}
</el-link> </el-link>
@ -83,7 +85,7 @@
{{ $t("home.dashboard.public.executed") }} {{ $t("home.dashboard.public.executed") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'scenario', 'executedCount', null)"> @click="redirectPage('scenario', 'scenario', 'executedCount', null)">
{{ formatAmount(scenarioData.executedCount) }} {{ formatAmount(scenarioData.executedCount) }}
</el-link> </el-link>
@ -94,7 +96,7 @@
{{ $t("home.dashboard.public.not_executed") }} {{ $t("home.dashboard.public.not_executed") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'scenario', 'unExecuteCount', null)"> @click="redirectPage('scenario', 'scenario', 'unExecuteCount', null)">
{{ formatAmount(scenarioData.notExecutedCount) }} {{ formatAmount(scenarioData.notExecutedCount) }}
</el-link> </el-link>
@ -121,7 +123,7 @@
{{ $t("home.dashboard.public.pass") }} {{ $t("home.dashboard.public.pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'scenario', 'executionPassCount', null)"> @click="redirectPage('scenario', 'scenario', 'executionPassCount', null)">
{{ formatAmount(scenarioData.passCount) }} {{ formatAmount(scenarioData.passCount) }}
</el-link> </el-link>
@ -132,7 +134,7 @@
{{ $t("home.dashboard.public.not_pass") }} {{ $t("home.dashboard.public.not_pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'scenario', 'executionFailedCount', null)"> @click="redirectPage('scenario', 'scenario', 'executionFailedCount', null)">
{{ formatAmount(scenarioData.unPassCount) }} {{ formatAmount(scenarioData.unPassCount) }}
</el-link> </el-link>

View File

@ -18,6 +18,7 @@
<main-info-card :title="$t('home.dashboard.scenario_schedule.title')" :count-data="scenarioScheduleData" <main-info-card :title="$t('home.dashboard.scenario_schedule.title')" :count-data="scenarioScheduleData"
redirect-page-name="scenario" redirect-page-name="scenario"
redirect-data-type="schedule" redirect-data-type="schedule"
:link-permission="['PROJECT_API_SCENARIO:READ']"
@redirectPage="redirectPage" @redirectPage="redirectPage"
:is-execute-info="false"/> :is-execute-info="false"/>
</el-col> </el-col>
@ -46,7 +47,7 @@
{{ $t("home.dashboard.public.running") }} {{ $t("home.dashboard.public.running") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'schedule', 'running', null)"> @click="redirectPage('scenario', 'schedule', 'running', null)">
{{ formatAmount(scenarioScheduleData.runningCount) }} {{ formatAmount(scenarioScheduleData.runningCount) }}
</el-link> </el-link>
@ -57,7 +58,7 @@
{{ $t("home.dashboard.public.not_run") }} {{ $t("home.dashboard.public.not_run") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'schedule', 'notRun', null)"> @click="redirectPage('scenario', 'schedule', 'notRun', null)">
{{ formatAmount(scenarioScheduleData.notRunCount) }} {{ formatAmount(scenarioScheduleData.notRunCount) }}
</el-link> </el-link>
@ -84,7 +85,7 @@
{{ $t("home.dashboard.public.pass") }} {{ $t("home.dashboard.public.pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_REPORT:READ']"
@click="redirectPage('scenarioReport', 'scenario', 'scheduleExecutionPassCount', null)"> @click="redirectPage('scenarioReport', 'scenario', 'scheduleExecutionPassCount', null)">
{{ formatAmount(scenarioScheduleData.passCount) }} {{ formatAmount(scenarioScheduleData.passCount) }}
</el-link> </el-link>
@ -95,7 +96,7 @@
{{ $t("home.dashboard.public.not_pass") }} {{ $t("home.dashboard.public.not_pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" <el-link class="addition-info-num" v-permission-disable="['PROJECT_API_REPORT:READ']"
@click="redirectPage('scenarioReport', 'scenario', 'scheduleExecutionFailedCount', null)"> @click="redirectPage('scenarioReport', 'scenario', 'scheduleExecutionFailedCount', null)">
{{ formatAmount(scenarioScheduleData.unPassCount) }} {{ formatAmount(scenarioScheduleData.unPassCount) }}
</el-link> </el-link>

View File

@ -52,7 +52,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="caseTotal" :label="$t('home.new_case.relation_case')" align="right" width="120"> <el-table-column prop="caseTotal" :label="$t('home.new_case.relation_case')" align="right" width="120">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-link style="color: #783887;width: 100%;" type="info" :underline="false" <el-link style="color: #783887;width: 100%;" type="info" :underline="false" v-permission-disable="['PROJECT_API_DEFINITION:READ']"
@click="redirectPage( 'api', 'apiTestCase', 'singleList:' + row.id)"> @click="redirectPage( 'api', 'apiTestCase', 'singleList:' + row.id)">
<span style="float: right"> <span style="float: right">
{{ row.caseTotal }} {{ row.caseTotal }}
@ -63,7 +63,7 @@
<el-table-column prop="scenarioTotal" :label="$t('home.new_case.relation_scenario')" align="right" <el-table-column prop="scenarioTotal" :label="$t('home.new_case.relation_scenario')" align="right"
width="140"> width="140">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-link style="color: #783887;width: 100%;" type="info" :underline="false" <el-link style="color: #783887;width: 100%;" type="info" :underline="false" v-permission-disable="['PROJECT_API_SCENARIO:READ']"
@click="redirectPage('scenario', 'scenario','list:' +row.scenarioIds)"> @click="redirectPage('scenario', 'scenario','list:' +row.scenarioIds)">
<span style="float: right"> <span style="float: right">
{{ row.scenarioTotal }} {{ row.scenarioTotal }}
@ -96,6 +96,7 @@ import {API_STATUS} from "@/business/definition/model/JsonData";
import ApiStatus from "@/business/definition/components/list/ApiStatus"; import ApiStatus from "@/business/definition/components/list/ApiStatus";
import HomeTablePagination from "@/business/home/components/table/HomeTablePagination"; import HomeTablePagination from "@/business/home/components/table/HomeTablePagination";
import BasicStatusLabel from "metersphere-frontend/src/components/BasicStatusLabel"; import BasicStatusLabel from "metersphere-frontend/src/components/BasicStatusLabel";
import {hasPermission} from "metersphere-frontend/src/utils/permission";
export default { export default {
name: "UpdatedApiList", name: "UpdatedApiList",
@ -120,6 +121,9 @@ export default {
methods: { methods: {
clickRow(row, column, event) { clickRow(row, column, event) {
if (column.property !== 'caseTotal' && column.property !== 'scenarioTotal') { if (column.property !== 'caseTotal' && column.property !== 'scenarioTotal') {
if (!hasPermission('PROJECT_API_DEFINITION:READ')) {
return;
}
this.redirectPage('api', 'api', 'edit:' + row.id); this.redirectPage('api', 'api', 'edit:' + row.id);
} }
}, },

View File

@ -4,6 +4,7 @@ import Drag from "./drag";
import directive from './loading/directive'; import directive from './loading/directive';
import service from './loading/index'; import service from './loading/index';
import modules from "./module"; import modules from "./module";
import NoPermissionDisable from "./permission/permission-disable";
export const onceLinkClick = { export const onceLinkClick = {
@ -36,6 +37,7 @@ export default {
install(Vue) { install(Vue) {
Vue.directive('click-outside', ClickOutside); Vue.directive('click-outside', ClickOutside);
Vue.directive('permission', Permission.hasPermissions); Vue.directive('permission', Permission.hasPermissions);
Vue.directive('permission-disable', NoPermissionDisable.hasPermissions);
Vue.directive('xpack', Permission.hasLicense); Vue.directive('xpack', Permission.hasLicense);
Vue.directive('preventLinkReClick', onceLinkClick); Vue.directive('preventLinkReClick', onceLinkClick);
Vue.directive('preventReClick', onceClick); Vue.directive('preventReClick', onceClick);

View File

@ -0,0 +1,27 @@
import {hasPermissions} from "../../utils/permission"
function checkPermissions(el, binding) {
const {value} = binding;
if (value && value instanceof Array && value.length > 0) {
let hasPermission = hasPermissions(...(value));
if (!hasPermission) {
if (el.nodeName === 'A') {
el.style["pointer-events"] = "none";
} else {
el.disabled = true;
el.classList.add('is-disabled');
}
}
}
}
export default {
hasPermissions: {
inserted(el, binding) {
checkPermissions(el, binding);
},
update(el, binding) {
checkPermissions(el, binding);
}
}
}

View File

@ -34,7 +34,7 @@
{{ $t('home.case_review_dashboard.not_review') }} {{ $t('home.case_review_dashboard.not_review') }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('notReviewed')"> <el-link class="addition-info-num" @click="redirectPage('notReviewed')" v-permission-disable="['PROJECT_TRACK_CASE:READ']">
{{ formatAmount(trackData.prepareCount) }} {{ formatAmount(trackData.prepareCount) }}
</el-link> </el-link>
</div> </div>
@ -44,7 +44,7 @@
{{ $t('home.case_review_dashboard.finished_review') }} {{ $t('home.case_review_dashboard.finished_review') }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('reviewed')"> <el-link class="addition-info-num" @click="redirectPage('reviewed')" v-permission-disable="['PROJECT_TRACK_CASE:READ']">
{{ formatAmount(trackData.passCount + trackData.unPassCount) }} {{ formatAmount(trackData.passCount + trackData.unPassCount) }}
</el-link> </el-link>
</div> </div>
@ -70,7 +70,7 @@
{{ $t("home.case_review_dashboard.not_pass") }} {{ $t("home.case_review_dashboard.not_pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('UnPass')"> <el-link class="addition-info-num" @click="redirectPage('UnPass')" v-permission-disable="['PROJECT_TRACK_CASE:READ']">
{{ formatAmount(trackData.unPassCount) }} {{ formatAmount(trackData.unPassCount) }}
</el-link> </el-link>
</div> </div>
@ -80,7 +80,7 @@
{{ $t("home.case_review_dashboard.pass") }} {{ $t("home.case_review_dashboard.pass") }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('Pass')"> <el-link class="addition-info-num" @click="redirectPage('Pass')" v-permission-disable="['PROJECT_TRACK_CASE:READ']">
{{ formatAmount(trackData.passCount) }} {{ formatAmount(trackData.passCount) }}
</el-link> </el-link>
</div> </div>
@ -103,6 +103,7 @@ import hoverCard from "@/business/home/components/card/HoverCard";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {getTrackCount} from "@/api/track"; import {getTrackCount} from "@/api/track";
import {formatNumber} from "@/api/track" import {formatNumber} from "@/api/track"
import {hasPermission} from "@/business/utils/sdk-utils";
export default { export default {
name: "CaseCountCard", name: "CaseCountCard",
@ -162,6 +163,9 @@ export default {
return formatNumber(number); return formatNumber(number);
}, },
redirectPage(clickType) { redirectPage(clickType) {
if (!hasPermission('PROJECT_TRACK_CASE:READ')) {
return;
}
this.$emit("redirectPage", "testCase", "case", clickType); this.$emit("redirectPage", "testCase", "case", clickType);
} }
} }

View File

@ -32,7 +32,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="testPlan" :label="$t('home.case.test_plan')"> <el-table-column prop="testPlan" :label="$t('home.case.test_plan')">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<el-link type="info" @click="redirect('testPlanEdit',row.testPlanId)"> <el-link type="info" @click="redirect('testPlanEdit',row.testPlanId)" v-permission-disable="['PROJECT_TRACK_PLAN:READ']">
{{ row.testPlan }} {{ row.testPlan }}
</el-link> </el-link>
</template> </template>

View File

@ -34,7 +34,7 @@
{{ $t('home.relevance_dashboard.not_cover') }} {{ $t('home.relevance_dashboard.not_cover') }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('uncoverage')"> <el-link class="addition-info-num" @click="redirectPage('uncoverage')" v-permission-disable="['PROJECT_TRACK_CASE:READ']">
{{ formatAmount(relevanceData.uncoverageCount) }} {{ formatAmount(relevanceData.uncoverageCount) }}
</el-link> </el-link>
</div> </div>
@ -44,7 +44,7 @@
{{ $t('home.relevance_dashboard.cover') }} {{ $t('home.relevance_dashboard.cover') }}
</span> </span>
<div class="common-amount"> <div class="common-amount">
<el-link class="addition-info-num" @click="redirectPage('coverage')"> <el-link class="addition-info-num" @click="redirectPage('coverage')" v-permission-disable="['PROJECT_TRACK_CASE:READ']">
{{ formatAmount(relevanceData.coverageCount) }} {{ formatAmount(relevanceData.coverageCount) }}
</el-link> </el-link>
</div> </div>

View File

@ -61,6 +61,7 @@ import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/s
import {getRelateTestCaseReview} from "@/api/test-review"; import {getRelateTestCaseReview} from "@/api/test-review";
import HomePagination from "@/business/home/components/pagination/HomePagination"; import HomePagination from "@/business/home/components/pagination/HomePagination";
import BasicStatusLabel from "metersphere-frontend/src/components/BasicStatusLabel"; import BasicStatusLabel from "metersphere-frontend/src/components/BasicStatusLabel";
import {hasPermission} from "@/business/utils/sdk-utils";
export default { export default {
name: "ReviewList", name: "ReviewList",
@ -104,6 +105,9 @@ export default {
}); });
}, },
intoPlan(row) { intoPlan(row) {
if (!hasPermission('PROJECT_TRACK_REVIEW:READ')) {
return;
}
let home = this.$router.resolve('/track/review/view/' + row.id); let home = this.$router.resolve('/track/review/view/' + row.id);
if (home) { if (home) {
window.open(home.href, '_blank'); window.open(home.href, '_blank');

View File

@ -85,6 +85,7 @@ import {getTrackRunningTask} from "@/api/track";
import {updatePlanSchedule} from "@/api/remote/plan/test-plan"; import {updatePlanSchedule} from "@/api/remote/plan/test-plan";
import HomePagination from "@/business/home/components/pagination/HomePagination"; import HomePagination from "@/business/home/components/pagination/HomePagination";
import BasicTaskTypeLabel from "metersphere-frontend/src/components/BasicTaskTypeLabel"; import BasicTaskTypeLabel from "metersphere-frontend/src/components/BasicTaskTypeLabel";
import {hasPermission} from "@/business/utils/sdk-utils";
export default { export default {
name: "MsRunningTaskList", name: "MsRunningTaskList",
@ -168,10 +169,19 @@ export default {
}, },
redirect(param) { redirect(param) {
if (param.taskGroup === 'TEST_PLAN_TEST') { if (param.taskGroup === 'TEST_PLAN_TEST') {
if (!hasPermission('PROJECT_TRACK_PLAN:READ')) {
return;
}
this.$emit('redirectPage', 'testPlanEdit', '', param.scenarioId); this.$emit('redirectPage', 'testPlanEdit', '', param.scenarioId);
} else if (param.taskGroup === 'API_SCENARIO_TEST') { } else if (param.taskGroup === 'API_SCENARIO_TEST') {
if (!hasPermission('PROJECT_API_SCENARIO:READ')) {
return;
}
this.$emit('redirectPage', 'scenario', 'scenario', 'edit:' + param.scenarioId); this.$emit('redirectPage', 'scenario', 'scenario', 'edit:' + param.scenarioId);
} else if (param.taskGroup === 'SWAGGER_IMPORT') { } else if (param.taskGroup === 'SWAGGER_IMPORT') {
if (!hasPermission('PROJECT_API_DEFINITION:READ')) {
return;
}
this.$emit('redirectPage', 'api', 'api', {param}); this.$emit('redirectPage', 'api', 'api', {param});
} }
} }

View File

@ -62,6 +62,7 @@ import StatusTableItem from "../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem"; import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"; import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {hasPermission} from "metersphere-frontend/src/utils/permission";
export default { export default {
name: "TestCaseSideList", name: "TestCaseSideList",
@ -90,7 +91,10 @@ export default {
}); });
}, },
editTestCase(row, event, column) { editTestCase(row, event, column) {
this.$router.push('/track/plan/view/edit/' + row.id) if (!hasPermission('PROJECT_TRACK_PLAN:READ')) {
return;
}
this.$router.push('/track/plan/view/edit/' + row.id);
} }
} }
} }

View File

@ -49,6 +49,7 @@
import MsChart from "metersphere-frontend/src/components/chart/MsChart"; import MsChart from "metersphere-frontend/src/components/chart/MsChart";
import {getUUID} from "metersphere-frontend/src/utils"; import {getUUID} from "metersphere-frontend/src/utils";
import {formatNumber} from "@/api/track"; import {formatNumber} from "@/api/track";
import {hasPermission} from "@/business/utils/sdk-utils";
export default { export default {
name: "CaseCountChart", name: "CaseCountChart",
@ -152,7 +153,7 @@ export default {
}, },
} }
}, },
sublink: "/#/track/case/all/" + getUUID() + "/case/thisWeekCount", sublink: hasPermission('PROJECT_TRACK_CASE:READ') ? "/#/track/case/all/" + getUUID() + "/case/thisWeekCount" : '',
subtextStyle: { subtextStyle: {
color: "#1F2329", color: "#1F2329",
fontSize: 12, fontSize: 12,

View File

@ -42,6 +42,7 @@
import MsChart from "metersphere-frontend/src/components/chart/MsChart"; import MsChart from "metersphere-frontend/src/components/chart/MsChart";
import {getUUID} from "metersphere-frontend/src/utils"; import {getUUID} from "metersphere-frontend/src/utils";
import {formatNumber} from "@/api/track"; import {formatNumber} from "@/api/track";
import {hasPermission} from "@/business/utils/sdk-utils";
export default { export default {
name: "RelevanceCountChart", name: "RelevanceCountChart",
@ -141,7 +142,7 @@ export default {
}, },
} }
}, },
sublink: "/#/track/case/all/" + getUUID() + "/case/thisWeekRelevanceCount", sublink: hasPermission('PROJECT_TRACK_CASE:READ') ? "/#/track/case/all/" + getUUID() + "/case/thisWeekRelevanceCount" : "",
subtextStyle: { subtextStyle: {
color: "#1F2329", color: "#1F2329",
fontSize: 12, fontSize: 12,