Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e6b2a577cb
|
@ -30,6 +30,9 @@
|
|||
<select id="getMemberList" resultType="io.metersphere.base.domain.User">
|
||||
SELECT `user`.* FROM user_role JOIN `user` ON user_role.user_id = `user`.id
|
||||
WHERE user_role.source_id = #{member.workspaceId} AND user_role.role_id = #{member.roleId}
|
||||
<if test="member.name != null">
|
||||
AND `user`.name like CONCAT('%', #{member.name},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -3,9 +3,11 @@ package io.metersphere.controller;
|
|||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -24,22 +26,26 @@ public class ProjectController {
|
|||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public Project addProject(@RequestBody Project project) {
|
||||
return projectService.addProject(project);
|
||||
}
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public Pager<List<Project>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, projectService.getProjectList());
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{projectId}")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public void deleteProject(@PathVariable(value = "projectId") String projectId) {
|
||||
projectService.deleteProject(projectId);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public void updateProject(@RequestBody Project Project) {
|
||||
projectService.updateProject(Project);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class UserController {
|
|||
* 获取成员用户
|
||||
*/
|
||||
@PostMapping("/member/list/{goPage}/{pageSize}")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
//@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public Pager<List<User>> getMemberList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, userService.getMemberList(request));
|
||||
|
@ -81,7 +81,7 @@ public class UserController {
|
|||
* 添加成员
|
||||
*/
|
||||
@PostMapping("/member/add")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
//@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public void addMember(@RequestBody AddMemberRequest request) {
|
||||
userService.addMember(request);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class UserController {
|
|||
* 删除成员
|
||||
*/
|
||||
@GetMapping("/member/delete/{workspaceId}/{userId}")
|
||||
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
//@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||
public void deleteMember(@PathVariable String workspaceId, @PathVariable String userId) {
|
||||
userService.deleteMember(workspaceId, userId);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
package io.metersphere.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Workspace;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.service.WorkspaceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -13,18 +19,30 @@ public class WorkspaceController {
|
|||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
@PostMapping("save")
|
||||
public Workspace saveWorkspace(@RequestBody Workspace workspace) {
|
||||
@PostMapping("add")
|
||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||
public Workspace addWorkspace(@RequestBody Workspace workspace) {
|
||||
return workspaceService.saveWorkspace(workspace);
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||
public Workspace updateWorkspace(@RequestBody Workspace workspace) {
|
||||
workspaceService.checkOwner(workspace.getId());
|
||||
return workspaceService.saveWorkspace(workspace);
|
||||
}
|
||||
|
||||
@GetMapping("delete/{workspaceId}")
|
||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||
public void saveWorkspace(@PathVariable String workspaceId) {
|
||||
workspaceService.checkOwner(workspaceId);
|
||||
workspaceService.deleteWorkspace(workspaceId);
|
||||
}
|
||||
|
||||
@PostMapping("list")
|
||||
public List<Workspace> getWorkspaceList() {
|
||||
return workspaceService.getWorkspaceList();
|
||||
@PostMapping("list/{goPage}/{pageSize}")
|
||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||
public Pager<List<Workspace>> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, workspaceService.getWorkspaceList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,26 @@ package io.metersphere.controller.request.member;
|
|||
import io.metersphere.commons.constants.RoleConstants;
|
||||
|
||||
public class QueryMemberRequest {
|
||||
private String name;
|
||||
private String workspaceId;
|
||||
private String roleId = RoleConstants.TEST_MANAGER;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getWorkspaceId() {
|
||||
return workspaceId;
|
||||
}
|
||||
|
|
|
@ -45,4 +45,9 @@ public class WorkspaceService {
|
|||
public void deleteWorkspace(String workspaceId) {
|
||||
workspaceMapper.deleteByPrimaryKey(workspaceId);
|
||||
}
|
||||
|
||||
public void checkOwner(String workspaceId) {
|
||||
// TODO 验证当前用户是否拥有当前此空间权限
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">项目</span>
|
||||
<span class="title">
|
||||
项目
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
|
@ -21,8 +24,24 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="22" :offset="1">
|
||||
<div class="table-page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page.sync="currentPage"
|
||||
:page-sizes="[5, 10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
|
||||
<el-dialog title="创建项目" :visible.sync="createVisible">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
||||
|
@ -56,6 +75,9 @@
|
|||
condition: "",
|
||||
items: [],
|
||||
form: {},
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: '请输入项目名称', trigger: 'blur'},
|
||||
|
@ -113,10 +135,19 @@
|
|||
});
|
||||
},
|
||||
list() {
|
||||
this.$post("/project/list/1/10", {}, (response) => {
|
||||
let url = "/project/list/" + this.currentPage + '/' + this.pageSize;
|
||||
this.$post(url, {}, (response) => {
|
||||
this.items = response.data;
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
this.list();
|
||||
},
|
||||
handleCurrentChange(current) {
|
||||
this.currentPage = current;
|
||||
this.list();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
<el-input type="text" size="small" placeholder="根据用户名搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" @change="search" clearable/>
|
||||
</span>
|
||||
</el-row>
|
||||
|
@ -42,16 +42,20 @@
|
|||
</el-card>
|
||||
|
||||
<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 :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
|
||||
<el-form-item label="成员" prop="userIds">
|
||||
<el-select v-model="form.userIds" multiple placeholder="请选择成员" class="select-width">
|
||||
<el-option
|
||||
v-for="item in form.userList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button>
|
||||
<el-button type="primary" @click="submitForm('form')" size="medium">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
@ -59,7 +63,6 @@
|
|||
|
||||
<script>
|
||||
import MsCreateBox from "./CreateBox";
|
||||
// import {Message} from "element-ui";
|
||||
|
||||
export default {
|
||||
name: "Member",
|
||||
|
@ -73,6 +76,11 @@
|
|||
queryPath: "/user/member/list",
|
||||
condition: "",
|
||||
tableData: [],
|
||||
rules: {
|
||||
userIds: [
|
||||
{required: true, message: '请选择成员', trigger: ['blur', 'change']}
|
||||
]
|
||||
},
|
||||
multipleSelection: [],
|
||||
currentWorkspaceId: "0a2430b1-a818-4b9b-bc04-c1229c472896",
|
||||
currentPage: 1,
|
||||
|
@ -85,6 +93,7 @@
|
|||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
this.loading = true;
|
||||
let param = {
|
||||
name: this.condition,
|
||||
workspaceId: this.currentWorkspaceId
|
||||
|
@ -98,13 +107,15 @@
|
|||
} else {
|
||||
this.$message.error(response.message);
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
search() {
|
||||
|
||||
this.initTableData();
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
|
@ -118,14 +129,17 @@
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
this.$get('/user/member/delete/' + this.currentWorkspaceId + '/' + row.id).then(() => {
|
||||
this.initTableData();
|
||||
this.loading = false;
|
||||
});
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
|
@ -133,8 +147,42 @@
|
|||
});
|
||||
},
|
||||
create() {
|
||||
this.loading = true;
|
||||
this.$get('/user/list').then(response => {
|
||||
if (response.data.success) {
|
||||
this.createVisible = true;
|
||||
this.form = {};
|
||||
this.form = {userList: response.data.data};
|
||||
} else {
|
||||
this.$message.error(response.message);
|
||||
}
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '获取用户列表失败'
|
||||
});
|
||||
});
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.loading = true;
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let param = {
|
||||
userIds: this.form.userIds,
|
||||
workspaceId: this.currentWorkspaceId
|
||||
};
|
||||
this.$post("user/member/add", param).then(() => {
|
||||
this.initTableData();
|
||||
this.createVisible = false;
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,10 +193,6 @@
|
|||
width: 240px;
|
||||
}
|
||||
|
||||
.edit {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.el-table__row:hover .edit {
|
||||
opacity: 1;
|
||||
}
|
||||
|
@ -158,4 +202,8 @@
|
|||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.select-width {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">组织</span>
|
||||
<span class="title">组织
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
|
@ -23,7 +25,6 @@
|
|||
</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="createOrganization">
|
||||
<el-form-item label="名称" prop="name">
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<font-awesome-icon class="icon account" :icon="['far', 'address-card']" size="lg"/>
|
||||
<span>账号</span>
|
||||
</template>
|
||||
<el-menu-item index="/setting/user" v-permission="['admin','test_user']">用户</el-menu-item>
|
||||
<el-menu-item index="/setting/testresourcepool" v-permission="['test_user']">测试资源池</el-menu-item>
|
||||
<el-menu-item index="/setting/organization" v-permission="['org_admin']">组织</el-menu-item>
|
||||
<el-menu-item index="/setting/user">用户</el-menu-item>
|
||||
<el-menu-item index="/setting/testresourcepool">测试资源池</el-menu-item>
|
||||
<el-menu-item index="/setting/organization">组织</el-menu-item>
|
||||
<el-menu-item index="/setting/workspace">工作空间</el-menu-item>
|
||||
<el-menu-item>API Keys</el-menu-item>
|
||||
</el-submenu>
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">测试资源池</span>
|
||||
<span class="title">测试资源池
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
|
@ -34,7 +36,6 @@
|
|||
</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">
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">用户</span>
|
||||
<span class="title">用户
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据ID,名称搜索" prefix-icon="el-icon-search" maxlength="60" v-model="condition" clearable/>
|
||||
</span>
|
||||
|
@ -36,7 +38,6 @@
|
|||
</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="createUserForm">
|
||||
<el-form-item label="ID" prop="id">
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
<el-card>
|
||||
<div slot="header">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="title">工作空间</span>
|
||||
<span class="title">
|
||||
工作空间
|
||||
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
|
@ -20,8 +23,25 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="22" :offset="1">
|
||||
<div class="table-page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page.sync="currentPage"
|
||||
:page-sizes="[5, 10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</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">
|
||||
|
@ -57,12 +77,16 @@
|
|||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
this.$post("/workspace/save", this.form, () => {
|
||||
let saveType = 'add';
|
||||
if (this.form.id) {
|
||||
saveType = 'update'
|
||||
}
|
||||
this.$post("/workspace/" + saveType, this.form, () => {
|
||||
this.createVisible = false;
|
||||
this.loading = false;
|
||||
this.list();
|
||||
Message.success('保存成功');
|
||||
})
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -96,10 +120,22 @@
|
|||
});
|
||||
},
|
||||
list() {
|
||||
this.$post('/workspace/list', {}, response => {
|
||||
this.items = response.data;
|
||||
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
|
||||
this.$post(url, {}, response => {
|
||||
let data = response.data;
|
||||
|
||||
this.items = data.listObject;
|
||||
this.total = data.itemCount;
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
this.list();
|
||||
},
|
||||
handleCurrentChange(current) {
|
||||
this.currentPage = current;
|
||||
this.list();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -108,6 +144,9 @@
|
|||
btnTips: "添加工作空间",
|
||||
condition: "",
|
||||
items: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
form: {
|
||||
// name: "",
|
||||
// description: ""
|
||||
|
|
Loading…
Reference in New Issue