Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
05f62c24af
|
@ -0,0 +1,33 @@
|
|||
package io.metersphere.controller;
|
||||
|
||||
import io.metersphere.base.domain.TestResourcePool;
|
||||
import io.metersphere.service.TestResourcePoolService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("testresourcepool")
|
||||
@RestController
|
||||
public class TestResourcePoolController {
|
||||
|
||||
@Resource
|
||||
private TestResourcePoolService testResourcePoolService;
|
||||
|
||||
@PostMapping("/add")
|
||||
public TestResourcePool addTestResourcePool(@RequestBody TestResourcePool testResourcePool) {
|
||||
return testResourcePoolService.addTestResourcePool(testResourcePool);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{testResourcePoolId}")
|
||||
public void deleteTestResourcePool(@PathVariable(value = "testResourcePoolId") String testResourcePoolId) {
|
||||
testResourcePoolService.deleteTestResourcePool(testResourcePoolId);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public void updateTestResourcePool(@RequestBody TestResourcePool testResourcePool) {
|
||||
testResourcePoolService.updateTestResourcePool(testResourcePool);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<TestResourcePool> getTestResourcePoolList() { return testResourcePoolService.getTestResourcePoolList(); }
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import io.metersphere.base.domain.TestResourcePool;
|
||||
import io.metersphere.base.mapper.TestResourcePoolMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestResourcePoolService {
|
||||
|
||||
@Resource
|
||||
private TestResourcePoolMapper testResourcePoolMapper;
|
||||
|
||||
public TestResourcePool addTestResourcePool(TestResourcePool testResourcePool) {
|
||||
testResourcePool.setId(UUID.randomUUID().toString());
|
||||
testResourcePool.setCreateTime(System.currentTimeMillis());
|
||||
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||
testResourcePool.setStatus("1");
|
||||
testResourcePoolMapper.insertSelective(testResourcePool);
|
||||
return testResourcePool;
|
||||
}
|
||||
|
||||
public void deleteTestResourcePool(String testResourcePoolId) {
|
||||
testResourcePoolMapper.deleteByPrimaryKey(testResourcePoolId);
|
||||
}
|
||||
|
||||
public void updateTestResourcePool(TestResourcePool testResourcePool) {
|
||||
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
||||
}
|
||||
|
||||
public List<TestResourcePool> getTestResourcePoolList() {
|
||||
return testResourcePoolMapper.selectByExample(null);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-dropdown size="medium" @command="handleCommand">
|
||||
<span class="dropdown-link">
|
||||
莫 鹍<i class="el-icon-caret-bottom el-icon--right"/>
|
||||
{{currentUser.name}}<i class="el-icon-caret-bottom el-icon--right"/>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="personal">个人信息</el-dropdown-item>
|
||||
|
@ -11,8 +11,18 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
const TokenKey = 'Admin-Token';
|
||||
|
||||
export default {
|
||||
name: "MsUser",
|
||||
computed: {
|
||||
currentUser: () => {
|
||||
let user = Cookies.get(TokenKey);
|
||||
return JSON.parse(user);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(command) {
|
||||
switch (command) {
|
||||
|
|
|
@ -6,6 +6,8 @@ import Workspace from "../settings/Workspace";
|
|||
import User from "../settings/User";
|
||||
import CreateTestPlan from "../testPlan/CreateTestPlan";
|
||||
import Organization from "../settings/Organization";
|
||||
import WorkspaceUser from "../settings/WorkSpcaeUser";
|
||||
import TestResourcePool from "../settings/TestResourcePool";
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
|
@ -35,6 +37,13 @@ const router = new VueRouter({
|
|||
{
|
||||
path: 'organization',
|
||||
component: Organization
|
||||
},{
|
||||
path:'workspace/user',
|
||||
component: WorkspaceUser
|
||||
},
|
||||
{
|
||||
path: 'testresourcepool',
|
||||
component: TestResourcePool
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1,62 +1,63 @@
|
|||
<template>
|
||||
<el-menu menu-trigger="click" :default-active="$route.path" router>
|
||||
<el-submenu index="1">
|
||||
<template slot="title">
|
||||
<font-awesome-icon class="icon account" :icon="['far', 'address-card']" size="lg"/>
|
||||
<span>账号</span>
|
||||
</template>
|
||||
<el-menu-item index="/content/user">用户</el-menu-item>
|
||||
<el-menu-item index="/content/organization">组织</el-menu-item>
|
||||
<el-menu-item index="/content/workspace">工作空间</el-menu-item>
|
||||
<el-menu-item>API Keys</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-submenu index=2>
|
||||
<template slot="title">
|
||||
<font-awesome-icon class="icon workspace" :icon="['far', 'clone']" size="lg"/>
|
||||
<span>工作空间</span>
|
||||
</template>
|
||||
<el-menu-item>成员</el-menu-item>
|
||||
<el-menu-item>证书</el-menu-item>
|
||||
<el-menu-item>测试计划</el-menu-item>
|
||||
<el-menu-item>警告</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-submenu index="3">
|
||||
<template slot="title">
|
||||
<font-awesome-icon class="icon" :icon="['far', 'user']" size="lg"/>
|
||||
<span>个人</span>
|
||||
</template>
|
||||
<el-menu-item>个人设置</el-menu-item>
|
||||
<el-menu-item>API Keys</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
<el-menu menu-trigger="click" :default-active="$route.path" router>
|
||||
<el-submenu index="1">
|
||||
<template slot="title">
|
||||
<font-awesome-icon class="icon account" :icon="['far', 'address-card']" size="lg"/>
|
||||
<span>账号</span>
|
||||
</template>
|
||||
<el-menu-item index="/content/user">用户</el-menu-item>
|
||||
<el-menu-item index="/content/testresourcepool">测试资源池</el-menu-item>
|
||||
<el-menu-item index="/content/organization">组织</el-menu-item>
|
||||
<el-menu-item index="/content/workspace">工作空间</el-menu-item>
|
||||
<el-menu-item>API Keys</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-submenu index=2>
|
||||
<template slot="title">
|
||||
<font-awesome-icon class="icon workspace" :icon="['far', 'clone']" size="lg"/>
|
||||
<span>工作空间</span>
|
||||
</template>
|
||||
<el-menu-item index="/content/workspace/user">成员</el-menu-item>
|
||||
<el-menu-item>证书</el-menu-item>
|
||||
<el-menu-item>测试计划</el-menu-item>
|
||||
<el-menu-item>警告</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-submenu index="3">
|
||||
<template slot="title">
|
||||
<font-awesome-icon class="icon" :icon="['far', 'user']" size="lg"/>
|
||||
<span>个人</span>
|
||||
</template>
|
||||
<el-menu-item>个人设置</el-menu-item>
|
||||
<el-menu-item>API Keys</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "MsSettingMenu"
|
||||
}
|
||||
export default {
|
||||
name: "MsSettingMenu"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-menu {
|
||||
border-right: 0;
|
||||
}
|
||||
.el-menu {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.el-menu-item {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
.el-menu-item {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 24px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.icon {
|
||||
width: 24px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.account {
|
||||
color: #5a78f0;
|
||||
}
|
||||
.account {
|
||||
color: #5a78f0;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
color: #44b349;
|
||||
}
|
||||
.workspace {
|
||||
color: #44b349;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
<template>
|
||||
<div v-loading="loading">
|
||||
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">测试资源池</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
</span>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-table :data="items" style="width: 100%">
|
||||
<el-table-column prop="name" label="名称"/>
|
||||
<el-table-column prop="description" label="描述"/>
|
||||
<el-table-column prop="status" label="启用/禁用">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.status"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
@change="changeSwitch(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column>
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
||||
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
<el-dialog title="创建资源池" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
|
||||
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createTestResourcePoolForm">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="createTestResourcePool('createTestResourcePoolForm')" size="medium">创建</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="修改资源池" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
|
||||
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateTestResourcePoolForm">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')" size="medium">修改</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsCreateBox from "./CreateBox";
|
||||
|
||||
export default {
|
||||
name: "MsTestResourcePool",
|
||||
components: {MsCreateBox},
|
||||
created() {
|
||||
this.getTestResourcePoolList();
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
this.createVisible = true;
|
||||
},
|
||||
edit(row) {
|
||||
window.console.log(row);
|
||||
// this.loading = true;
|
||||
this.updateVisible = true;
|
||||
this.form = row;
|
||||
},
|
||||
del(row) {
|
||||
window.console.log(row);
|
||||
this.$confirm('此操作将永久删除该资源池, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$get(`/testresourcepool/delete/${row.id}`).then(() => {
|
||||
this.getTestResourcePoolList()
|
||||
});
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
},
|
||||
createTestResourcePool(createTestResourcePoolForm) {
|
||||
this.$refs[createTestResourcePoolForm].validate( valide => {
|
||||
if (valide) {
|
||||
this.$post("/testresourcepool/add", this.form)
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '添加成功!'
|
||||
},
|
||||
this.createVisible = false,
|
||||
this.getTestResourcePoolList())
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
updateTestResourcePool(updateTestResourcePoolForm) {
|
||||
this.$refs[updateTestResourcePoolForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.$post("/testresourcepool/update", this.form)
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '修改成功!'
|
||||
},
|
||||
this.updateVisible = false,
|
||||
this.getOrganizationList(),
|
||||
self.loading = false)
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
getTestResourcePoolList() {
|
||||
this.$get("/testresourcepool/list").then(response => {
|
||||
this.items = response.data.data;
|
||||
})
|
||||
},
|
||||
closeFunc() {
|
||||
this.form = {};
|
||||
},
|
||||
changeSwitch(row) {
|
||||
this.$post('/testresourcepool/update', row).then(() =>{
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '状态修改成功!'
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
createVisible: false,
|
||||
updateVisible: false,
|
||||
btnTips: "添加资源池",
|
||||
condition: "",
|
||||
items: [],
|
||||
form: {},
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: '请输入资源池名称', trigger: 'blur'},
|
||||
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||
message: '资源池名称不支持特殊字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
description: [
|
||||
{ max: 60, message: '最大长度 60 个字符', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search {
|
||||
width: 240px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,137 @@
|
|||
<template>
|
||||
<div v-loading="loading">
|
||||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">工作空间</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
</span>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-table :data="items" style="width: 100%">
|
||||
<el-table-column prop="name" label="名称"/>
|
||||
<el-table-column prop="description" label="描述"/>
|
||||
<el-table-column width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle
|
||||
class="edit"/>
|
||||
<el-popconfirm title="这个工作空间确定要删除吗?" @onConfirm="del(scope.row)">
|
||||
<el-button slot="reference" type="primary" icon="el-icon-delete" size="mini"
|
||||
circle
|
||||
class="edit"/>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
<el-dialog title="创建工作空间" :visible.sync="createVisible" width="30%">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述">
|
||||
<el-input type="textarea" v-model="form.description"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsCreateBox from "./CreateBox";
|
||||
import {Message} from "element-ui";
|
||||
|
||||
export default {
|
||||
name: "MsWorkspace",
|
||||
components: {MsCreateBox},
|
||||
mounted() {
|
||||
this.list();
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
this.createVisible = true;
|
||||
this.form = {};
|
||||
},
|
||||
submit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
this.$post("/workspace/save", this.form, () => {
|
||||
this.createVisible = false;
|
||||
this.loading = false;
|
||||
this.list();
|
||||
Message.success('保存成功');
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
edit(row) {
|
||||
this.createVisible = true;
|
||||
window.console.log(row);
|
||||
this.loading = true;
|
||||
this.form = row;
|
||||
|
||||
// let self = this;
|
||||
// let getUser1 = this.$get("/test/user");
|
||||
// let getUser2 = this.$get("/test/sleep");
|
||||
// this.$all([getUser1, getUser2], function (r1, r2) {
|
||||
// window.console.log(r1.data.data, r2.data.data);
|
||||
// self.loading = false;
|
||||
// });
|
||||
},
|
||||
del(row) {
|
||||
this.$get('/workspace/delete/' + row.id, () => {
|
||||
Message.success('删除成功');
|
||||
this.list();
|
||||
});
|
||||
window.console.log(row);
|
||||
},
|
||||
list() {
|
||||
this.$post('/workspace/list', {}, response => {
|
||||
this.items = response.data;
|
||||
})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
createVisible: false,
|
||||
btnTips: "添加工作空间",
|
||||
condition: "",
|
||||
items: [],
|
||||
form: {
|
||||
// name: "",
|
||||
// description: ""
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: '请输入工作空间名称', trigger: 'blur'},
|
||||
{min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur'}
|
||||
]
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.edit {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.el-table__row:hover .edit {
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue