fix(权限设置): 性能测试权限控制

This commit is contained in:
Captain.B 2021-05-27 10:25:58 +08:00 committed by 刘瑞斌
parent 3f20f5e834
commit 308d35aaf2
7 changed files with 31 additions and 24 deletions

View File

@ -10,7 +10,7 @@
<ms-table :data="tableData" :select-node-ids="selectNodeIds" :condition="condition" :page-size="pageSize"
:total="total" enableSelection
:batch-operators="trashEnable ? trashButtons : buttons" :screenHeight="screenHeight"
:batch-operators="trashEnable ? trashButtons : buttons" :screen-height="screenHeight"
:operators="tableOperatorButtons" operator-width="200px"
@refresh="initTable"
@openCustomHeader="customHeader"
@ -362,7 +362,7 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
screenHeight: document.documentElement.clientHeight - 310,//,
screenHeight: 'calc(100vh - 310px)',//,
environmentId: undefined,
selectDataCounts: 0,
};

View File

@ -16,17 +16,17 @@
</el-breadcrumb>
</el-row>
<el-row class="ms-report-view-btns">
<el-button :disabled="report.status !== 'Running' || testDeleted" type="primary" plain
<el-button :disabled="isReadOnly || report.status !== 'Running' || testDeleted" type="primary" plain
size="mini"
@click="dialogFormVisible=true">
{{ $t('report.test_stop_now') }}
</el-button>
<el-button :disabled="report.status !== 'Completed' || testDeleted" type="success" plain
<el-button :disabled="isReadOnly || report.status !== 'Completed' || testDeleted" type="success" plain
size="mini"
@click="rerun(testId)">
{{ $t('report.test_execute_again') }}
</el-button>
<el-button type="info" plain size="mini" @click="handleExport(reportName)">
<el-button :disabled="isReadOnly" type="info" plain size="mini" @click="handleExport(reportName)">
{{ $t('test_track.plan_view.export_report') }}
</el-button>
<el-button :disabled="report.status !== 'Completed'" type="default" plain
@ -127,7 +127,7 @@ import MsPerformancePressureConfig from "./components/PerformancePressureConfig"
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {exportPdf} from "@/common/js/utils";
import {exportPdf, hasPermission} from "@/common/js/utils";
import html2canvas from 'html2canvas';
import MsPerformanceReportExport from "./PerformanceReportExport";
import {Message} from "element-ui";
@ -165,6 +165,7 @@ export default {
minutes: '0',
seconds: '0',
title: 'Logging',
isReadOnly: false,
report: {},
websocket: null,
dialogFormVisible: false,
@ -410,6 +411,7 @@ export default {
}
},
created() {
this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_REPORT:READ+DELETE');
this.reportId = this.$route.path.split('/')[4];
this.getReport(this.reportId);
this.getPoolType(this.reportId);

View File

@ -103,10 +103,13 @@
:label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('test_track.module.rename')" icon="el-icon-edit"
v-permission="['PROJECT_PERFORMANCE_REPORT:READ+DELETE']"
@exec="handleRename(scope.row)" type="success"/>
<ms-table-operator-button :tip="$t('api_report.detail')" icon="el-icon-s-data"
v-permission="['PROJECT_PERFORMANCE_REPORT:READ']"
@exec="handleView(scope.row)" type="primary"/>
<ms-table-operator-button :tip="$t('load_test.report.diff')" icon="el-icon-s-operation"
v-permission="['PROJECT_PERFORMANCE_REPORT:READ']"
@exec="handleDiff(scope.row)" type="warning"/>
<ms-table-operator-button :tip="$t('api_report.delete')"
v-permission="['PROJECT_PERFORMANCE_REPORT:READ+DELETE']"

View File

@ -62,7 +62,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig";
import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig";
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, hasPermission} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import MsChangeHistory from "../../history/ChangeHistory";
@ -121,7 +121,7 @@ export default {
},
created() {
this.isReadOnly = false;
this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_TEST:READ+EDIT');
this.getTest(this.$route.params.testId);
},
mounted() {

View File

@ -214,6 +214,7 @@
<script>
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import EditMonitor from "@/business/components/performance/test/components/EditMonitor";
import {hasPermission} from "@/common/js/utils";
export default {
name: "PerformanceAdvancedConfig",
@ -238,20 +239,18 @@ export default {
{start: 30001, end: 60000, granularity: 600},
{start: 60001, end: 180000, granularity: 1800},
{start: 180001, end: 360000, granularity: 3600},
]
],
readOnly: false,
};
},
props: {
readOnly: {
type: Boolean,
default: false
},
testId: String,
},
mounted() {
if (this.testId) {
this.getAdvancedConfig();
}
this.readOnly = !hasPermission('PROJECT_PERFORMANCE_TEST:READ+EDIT');
},
watch: {
testId() {

View File

@ -5,8 +5,10 @@
</el-row>
<el-row type="flex" justify="start" align="middle">
<ms-table-button icon="el-icon-circle-plus-outline"
:disabled="isReadOnly"
:content="$t('load_test.load_exist_jmx')" @click="loadJMX()"/>
<ms-table-button icon="el-icon-share"
:disabled="isReadOnly"
@click="loadApiAutomation()"
:content="$t('load_test.load_api_automation_jmx')"/>
</el-row>
@ -24,7 +26,7 @@
inactive-color="#DCDFE6"
active-value="true"
inactive-value="false"
:disabled="threadGroupDisable(row)"
:disabled="isReadOnly || threadGroupDisable(row)"
/>
</template>
</el-table-column>
@ -34,7 +36,9 @@
<span v-if="row.tgType === 'PostThreadGroup' || row.tgType === 'SetupThreadGroup'">
{{ row.tgType }}
</span>
<el-select v-else v-model="row.tgType" :placeholder="$t('commons.please_select')" size="small"
<el-select v-else v-model="row.tgType"
:disabled="isReadOnly"
:placeholder="$t('commons.please_select')" size="small"
@change="tgTypeChange(row)">
<el-option v-for="tg in threadGroupForSelect" :key="tg.tagName" :label="tg.name"
:value="tg.testclass"></el-option>
@ -59,6 +63,7 @@
<el-row type="flex" justify="start" align="middle">
<ms-table-button icon="el-icon-circle-plus-outline"
:disabled="isReadOnly"
:content="$t('load_test.load_exist_file')" @click="loadFile()"/>
</el-row>
<el-table class="basic-config" :data="tableData">
@ -121,6 +126,7 @@ import MsDialogFooter from "@/business/components/common/components/MsDialogFoot
import ExistFiles from "@/business/components/performance/test/components/ExistFiles";
import ExistScenarios from "@/business/components/performance/test/components/ExistScenarios";
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
import {hasPermission} from "@/common/js/utils";
export default {
name: "PerformanceBasicConfig",
@ -129,14 +135,11 @@ export default {
test: {
type: Object
},
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
return {
result: {},
isReadOnly: false,
projectLoadingResult: {},
getFileMetadataPath: "/performance/file/metadata",
getFileMetadataById: "/performance/file/getMetadataById",
@ -176,6 +179,7 @@ export default {
if (this.test.id) {
this.getFileMetadata(this.test);
}
this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_TEST:READ+EDIT');
},
watch: {
test() {

View File

@ -190,6 +190,7 @@
import echarts from "echarts";
import MsChart from "@/business/components/common/chart/MsChart";
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
import {hasPermission} from "@/common/js/utils";
const HANDLER = "handler";
const THREAD_GROUP_TYPE = "tgType";
@ -228,10 +229,6 @@ export default {
},
testId: {
type: String
},
isReadOnly: {
type: Boolean,
default: false
}
},
data() {
@ -253,6 +250,7 @@ export default {
serializeThreadGroups: false,
autoStop: false,
autoStopDelay: 30,
isReadOnly: false,
};
},
mounted() {
@ -263,6 +261,7 @@ export default {
}
this.resourcePool = this.test.testResourcePoolId;
this.getResourcePools();
this.isReadOnly = !hasPermission('PROJECT_PERFORMANCE_TEST:READ+EDIT');
},
watch: {
test(n) {