feat: 用户信息添加Jira信息配置
This commit is contained in:
parent
752366d1f9
commit
b0153eb550
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class User implements Serializable {
|
||||
|
@ -34,5 +33,7 @@ public class User implements Serializable {
|
|||
|
||||
private String createUser;
|
||||
|
||||
private String platformInfo;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -16,15 +16,21 @@ public interface UserMapper {
|
|||
|
||||
int insertSelective(User record);
|
||||
|
||||
List<User> selectByExampleWithBLOBs(UserExample example);
|
||||
|
||||
List<User> selectByExample(UserExample example);
|
||||
|
||||
User selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") User record, @Param("example") UserExample example);
|
||||
|
||||
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(User record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(User record);
|
||||
|
||||
int updateByPrimaryKey(User record);
|
||||
}
|
|
@ -17,6 +17,9 @@
|
|||
<result column="last_project_id" jdbcType="VARCHAR" property="lastProjectId" />
|
||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.User">
|
||||
<result column="platform_info" jdbcType="LONGVARCHAR" property="platformInfo" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
|
@ -79,6 +82,25 @@
|
|||
id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id,
|
||||
last_organization_id, phone, `source`, last_project_id, create_user
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
platform_info
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.UserExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from user
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
|
@ -93,9 +115,11 @@
|
|||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from user
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
@ -114,12 +138,14 @@
|
|||
`password`, `status`, create_time,
|
||||
update_time, `language`, last_workspace_id,
|
||||
last_organization_id, phone, `source`,
|
||||
last_project_id, create_user)
|
||||
last_project_id, create_user, platform_info
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
|
||||
#{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR},
|
||||
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
|
||||
#{lastProjectId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR})
|
||||
#{lastProjectId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{platformInfo,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
|
||||
insert into user
|
||||
|
@ -166,6 +192,9 @@
|
|||
<if test="createUser != null">
|
||||
create_user,
|
||||
</if>
|
||||
<if test="platformInfo != null">
|
||||
platform_info,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -210,6 +239,9 @@
|
|||
<if test="createUser != null">
|
||||
#{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="platformInfo != null">
|
||||
#{platformInfo,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
|
||||
|
@ -263,11 +295,35 @@
|
|||
<if test="record.createUser != null">
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.platformInfo != null">
|
||||
platform_info = #{record.platformInfo,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update user
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
email = #{record.email,jdbcType=VARCHAR},
|
||||
`password` = #{record.password,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
`language` = #{record.language,jdbcType=VARCHAR},
|
||||
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
|
||||
last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR},
|
||||
phone = #{record.phone,jdbcType=VARCHAR},
|
||||
`source` = #{record.source,jdbcType=VARCHAR},
|
||||
last_project_id = #{record.lastProjectId,jdbcType=VARCHAR},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
platform_info = #{record.platformInfo,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update user
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
|
@ -330,9 +386,30 @@
|
|||
<if test="createUser != null">
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="platformInfo != null">
|
||||
platform_info = #{platformInfo,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.User">
|
||||
update user
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
email = #{email,jdbcType=VARCHAR},
|
||||
`password` = #{password,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
`language` = #{language,jdbcType=VARCHAR},
|
||||
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
|
||||
last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
`source` = #{source,jdbcType=VARCHAR},
|
||||
last_project_id = #{lastProjectId,jdbcType=VARCHAR},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
platform_info = #{platformInfo,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.User">
|
||||
update user
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
|
|
|
@ -145,14 +145,7 @@ public class UserController {
|
|||
@PostMapping("/update/current")
|
||||
@MsAuditLog(module = "personal_information_personal_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
|
||||
public UserDTO updateCurrentUser(@RequestBody User user) {
|
||||
String currentUserId = SessionUtils.getUserId();
|
||||
if (!StringUtils.equals(currentUserId, user.getId())) {
|
||||
MSException.throwException(Translator.get("not_authorized"));
|
||||
}
|
||||
userService.updateUser(user);
|
||||
UserDTO userDTO = userService.getUserDTO(user.getId());
|
||||
SessionUtils.putUser(SessionUser.fromUser(userDTO));
|
||||
return SessionUtils.getUser();
|
||||
return userService.updateCurrentUser(user);
|
||||
}
|
||||
|
||||
@PostMapping("/switch/source/org/{sourceId}")
|
||||
|
|
|
@ -16,6 +16,8 @@ public class BaseQueryRequest {
|
|||
|
||||
private String workspaceId;
|
||||
|
||||
private String organizationId;
|
||||
|
||||
private List<String> ids;
|
||||
|
||||
private List<String> moduleIds;
|
||||
|
|
|
@ -21,4 +21,12 @@ public class UserDTO extends User {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class PlatformInfo {
|
||||
private String jiraAccount;
|
||||
private String jiraPassword;
|
||||
private String tapdUserName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.service;
|
|||
|
||||
import com.alibaba.excel.EasyExcelFactory;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
|
||||
|
@ -1358,4 +1359,29 @@ public class UserService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UserDTO updateCurrentUser(User user) {
|
||||
String currentUserId = SessionUtils.getUserId();
|
||||
if (!StringUtils.equals(currentUserId, user.getId())) {
|
||||
MSException.throwException(Translator.get("not_authorized"));
|
||||
}
|
||||
updateUser(user);
|
||||
UserDTO userDTO = getUserDTO(user.getId());
|
||||
SessionUtils.putUser(SessionUser.fromUser(userDTO));
|
||||
return SessionUtils.getUser();
|
||||
}
|
||||
|
||||
public UserDTO.PlatformInfo getCurrentPlatformInfo(String orgId, String userId) {
|
||||
User user = userMapper.selectByPrimaryKey(userId);
|
||||
String platformInfoStr = user.getPlatformInfo();
|
||||
if (StringUtils.isBlank(orgId) || StringUtils.isBlank(platformInfoStr)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject platformInfos = JSONObject.parseObject(platformInfoStr);
|
||||
JSONObject platformInfo = platformInfos.getJSONObject(orgId);
|
||||
if (platformInfo == null) {
|
||||
return null;
|
||||
}
|
||||
return JSONObject.parseObject(JSONObject.toJSONString(platformInfo), UserDTO.PlatformInfo.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,11 @@ import io.metersphere.commons.utils.LogUtil;
|
|||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.IntegrationRequest;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.service.IntegrationService;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.service.ResourceService;
|
||||
import io.metersphere.service.UserService;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import io.metersphere.track.service.TestCaseService;
|
||||
|
@ -48,6 +50,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
protected ExtIssuesMapper extIssuesMapper;
|
||||
protected ResourceService resourceService;
|
||||
protected RestTemplate restTemplateIgnoreSSL;
|
||||
protected UserService userService;
|
||||
|
||||
protected String testCaseId;
|
||||
protected String projectId;
|
||||
|
@ -81,12 +84,13 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
this.testCaseIssuesMapper = CommonBeanFactory.getBean(TestCaseIssuesMapper.class);
|
||||
this.projectService = CommonBeanFactory.getBean(ProjectService.class);
|
||||
this.testCaseService = CommonBeanFactory.getBean(TestCaseService.class);
|
||||
this.userService = CommonBeanFactory.getBean(UserService.class);
|
||||
this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class);
|
||||
this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class);
|
||||
this.resourceService = CommonBeanFactory.getBean(ResourceService.class);
|
||||
this.testCaseId = issuesRequest.getTestCaseId();
|
||||
this.projectId = issuesRequest.getProjectId();
|
||||
//
|
||||
|
||||
this.restTemplateIgnoreSSL = restTemplate;
|
||||
}
|
||||
|
||||
|
@ -191,4 +195,8 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
protected UserDTO.PlatformInfo getUserPlatInfo(String orgId, String userId) {
|
||||
return userService.getCurrentPlatformInfo(orgId, userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ import io.metersphere.commons.constants.IssuesStatus;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.CustomFieldItemDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.track.dto.DemandDTO;
|
||||
import io.metersphere.track.issue.client.JiraClientV2;
|
||||
import io.metersphere.track.issue.domain.JiraAddIssueResponse;
|
||||
|
@ -44,13 +46,20 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
super(issuesRequest);
|
||||
}
|
||||
|
||||
public JiraConfig getConfig() {
|
||||
public JiraConfig getConfig(String orgId) {
|
||||
JiraConfig jiraConfig = null;
|
||||
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
||||
if (StringUtils.isNotBlank(config)) {
|
||||
return JSONObject.parseObject(config, JiraConfig.class);
|
||||
} else {
|
||||
return null;
|
||||
jiraConfig = JSONObject.parseObject(config, JiraConfig.class);
|
||||
UserDTO.PlatformInfo userPlatInfo = getUserPlatInfo(orgId, SessionUtils.getUserId());
|
||||
if (userPlatInfo != null && StringUtils.isNotBlank(userPlatInfo.getJiraAccount())
|
||||
&& StringUtils.isNotBlank(userPlatInfo.getJiraPassword())) {
|
||||
jiraConfig.setAccount(userPlatInfo.getJiraAccount());
|
||||
jiraConfig.setPassword(userPlatInfo.getJiraPassword());
|
||||
}
|
||||
}
|
||||
validateConfig(jiraConfig);
|
||||
return jiraConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,7 +73,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
} else {
|
||||
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
setConfig();
|
||||
setConfig(issuesRequest.getOrganizationId());
|
||||
issues.forEach(item -> {
|
||||
String issuesId = item.getId();
|
||||
parseIssue(item, jiraClientV2.getIssues(issuesId));
|
||||
|
@ -118,7 +127,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
|
||||
@Override
|
||||
public void filter(List<IssuesDao> issues) {
|
||||
setConfig();
|
||||
setConfig(null);
|
||||
issues.forEach((issuesDao) -> {
|
||||
parseIssue(issuesDao, jiraClientV2.getIssues(issuesDao.getId()));
|
||||
if (StringUtils.isBlank(issuesDao.getId())) {
|
||||
|
@ -138,10 +147,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
List<DemandDTO> list = new ArrayList<>();
|
||||
|
||||
try {
|
||||
String key = this.getProjectId(projectId);
|
||||
if (StringUtils.isBlank(key)) {
|
||||
MSException.throwException("未关联Jira 项目Key");
|
||||
}
|
||||
String key = validateJiraKey(projectId);
|
||||
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
||||
JSONObject object = JSON.parseObject(config);
|
||||
|
||||
|
@ -186,25 +192,31 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIssue(IssuesUpdateRequest issuesRequest) {
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Jira.toString());
|
||||
|
||||
JiraConfig config = getConfig();
|
||||
private void validateConfig(JiraConfig config) {
|
||||
jiraClientV2.setConfig(config);
|
||||
|
||||
if (config == null) {
|
||||
MSException.throwException("jira config is null");
|
||||
}
|
||||
if (StringUtils.isBlank(config.getIssuetype())) {
|
||||
MSException.throwException("Jira 问题类型为空");
|
||||
}
|
||||
}
|
||||
|
||||
String jiraKey = getProjectId(issuesRequest.getProjectId());
|
||||
|
||||
private String validateJiraKey(String projectId) {
|
||||
String jiraKey = getProjectId(projectId);
|
||||
if (StringUtils.isBlank(jiraKey)) {
|
||||
MSException.throwException("未关联Jira 项目Key");
|
||||
}
|
||||
return jiraKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIssue(IssuesUpdateRequest issuesRequest) {
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Jira.toString());
|
||||
|
||||
JiraConfig config = setConfig(issuesRequest.getOrganizationId());// todo
|
||||
|
||||
String jiraKey = validateJiraKey(issuesRequest.getProjectId());
|
||||
|
||||
String content = issuesRequest.getDescription();
|
||||
|
||||
|
@ -275,7 +287,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
|
||||
@Override
|
||||
public void testAuth() {
|
||||
setConfig();
|
||||
setConfig(null);
|
||||
jiraClientV2.getIssueCreateMetadata();
|
||||
}
|
||||
|
||||
|
@ -294,13 +306,14 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
return project.getJiraKey();
|
||||
}
|
||||
|
||||
public void setConfig() {
|
||||
JiraConfig config = getConfig();
|
||||
public JiraConfig setConfig(String orgId) {
|
||||
JiraConfig config = getConfig(orgId);
|
||||
jiraClientV2.setConfig(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
public IssuesWithBLOBs getJiraIssues(IssuesWithBLOBs issuesDao, String issueId) {
|
||||
setConfig();
|
||||
setConfig(null);
|
||||
if (issuesDao == null) {
|
||||
issuesDao = new IssuesDao();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import java.util.List;
|
|||
public class IssuesUpdateRequest extends IssuesWithBLOBs {
|
||||
private String content;
|
||||
private String testCaseId;
|
||||
private String organizationId;
|
||||
|
||||
private List<String> tapdUsers;
|
||||
/**
|
||||
* zentao bug 处理人
|
||||
|
|
|
@ -4,3 +4,6 @@ ALTER TABLE api_scenario ADD version INT(10) DEFAULT 0 NULL COMMENT '版本号';
|
|||
ALTER TABLE load_test ADD scenario_version INT(10) DEFAULT 0 NULL COMMENT '关联的接口自动化版本号';
|
||||
|
||||
ALTER TABLE load_test ADD scenario_id varchar(255) NULL COMMENT '关联的场景自动化ID';
|
||||
|
||||
-- 对接Jira等平台认证信息
|
||||
ALTER TABLE `user` ADD platform_info LONGTEXT NULL COMMENT ' 其他平台对接信息';
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
|
@ -0,0 +1,29 @@
|
|||
<template>
|
||||
<el-form label-position="right" label-width="100px" size="small">
|
||||
<el-form-item :label="'Jira 信息'">
|
||||
<ms-instructions-icon size="10" :content="'该信息为对接 Jira 的用户认证信息,若未填写,则使用组织中配置的默认信息'"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'Jira ' + $t('organization.integration.account')" prop="account">
|
||||
<el-input v-model="data.jiraAccount" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'Jira ' + $t('organization.integration.password')" prop="password">
|
||||
<el-input v-model="data.jiraPassword" auto-complete="new-password"
|
||||
:placeholder="$t('organization.integration.input_api_password')" show-password/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
|
||||
export default {
|
||||
name: "JiraUserInfo",
|
||||
components: {MsInstructionsIcon},
|
||||
props: ['data'],
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.instructions-icon {
|
||||
margin-left: -5px;
|
||||
}
|
||||
</style>
|
|
@ -51,6 +51,8 @@
|
|||
<el-input v-model="form.phone" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<jira-user-info v-if="hasJira" :data="currentPlatformInfo"/>
|
||||
<tapd-user-info v-if="hasTapd" :data="currentPlatformInfo"/>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="updateVisible = false"
|
||||
|
@ -79,20 +81,27 @@
|
|||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {TokenKey} from "../../../../common/js/constants";
|
||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||
import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
|
||||
import {
|
||||
getCurrentOrganizationId,
|
||||
getCurrentUser,
|
||||
listenGoBack,
|
||||
removeGoBackListener
|
||||
} from "../../../../common/js/utils";
|
||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||
import {EMAIL_REGEX, PHONE_REGEX} from "@/common/js/regex";
|
||||
import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo";
|
||||
import TapdUserInfo from "@/business/components/settings/personal/TapdUserInfo";
|
||||
import {getIntegrationService} from "@/network/organization";
|
||||
|
||||
export default {
|
||||
name: "MsPersonSetting",
|
||||
components: {MsDialogFooter, MsTableOperatorButton},
|
||||
components: {TapdUserInfo, JiraUserInfo, MsDialogFooter, MsTableOperatorButton},
|
||||
inject: [
|
||||
'reload'
|
||||
],
|
||||
|
@ -105,8 +114,15 @@ export default {
|
|||
tableData: [],
|
||||
updatePath: '/user/update/current',
|
||||
updatePasswordPath: '/user/update/password',
|
||||
form: {},
|
||||
form: {platformInfo: {}},
|
||||
currentPlatformInfo: {
|
||||
jiraAccount: '',
|
||||
jiraPassword: '',
|
||||
tapdUserName: ''
|
||||
},
|
||||
ruleForm: {},
|
||||
hasJira: false,
|
||||
hasTapd: false,
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: this.$t('member.input_name'), trigger: 'blur'},
|
||||
|
@ -168,11 +184,36 @@ export default {
|
|||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
},
|
||||
edit(row) {
|
||||
edit: function (row) {
|
||||
this.updateVisible = true;
|
||||
this.form = Object.assign({}, row);
|
||||
this.getPlatformInfo(row);
|
||||
listenGoBack(this.handleClose);
|
||||
},
|
||||
getPlatformInfo(row) {
|
||||
if (row.platformInfo) {
|
||||
this.form.platformInfo = JSON.parse(row.platformInfo);
|
||||
} else {
|
||||
this.form.platformInfo = {};
|
||||
}
|
||||
let orgId = getCurrentOrganizationId();
|
||||
if (!this.form.platformInfo[orgId]) {
|
||||
this.form.platformInfo[orgId] = {};
|
||||
}
|
||||
this.currentPlatformInfo = this.form.platformInfo[orgId];
|
||||
this.result = getIntegrationService((data) => {
|
||||
let platforms = data.map(d => d.platform);
|
||||
if (platforms.indexOf("Tapd") !== -1) {
|
||||
this.hasTapd = true;
|
||||
}
|
||||
if (platforms.indexOf("Jira") !== -1) {
|
||||
this.hasJira = true;
|
||||
}
|
||||
// if (platforms.indexOf("Zentao") !== -1) {
|
||||
// this.zentao = true;
|
||||
// }
|
||||
});
|
||||
},
|
||||
editPassword(row) {
|
||||
this.editPasswordVisible = true;
|
||||
listenGoBack(this.handleClose);
|
||||
|
@ -190,7 +231,10 @@ export default {
|
|||
updateUser(updateUserForm) {
|
||||
this.$refs[updateUserForm].validate(valid => {
|
||||
if (valid) {
|
||||
this.result = this.$post(this.updatePath, this.form, response => {
|
||||
let param = {};
|
||||
Object.assign(param, this.form);
|
||||
param.platformInfo = JSON.stringify(this.form.platformInfo);
|
||||
this.result = this.$post(this.updatePath, param, response => {
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
localStorage.setItem(TokenKey, JSON.stringify(response.data));
|
||||
this.updateVisible = false;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<template>
|
||||
<el-form label-position="right" label-width="100px" size="small">
|
||||
<el-form-item :label="'Tapd 昵称'">
|
||||
<ms-instructions-icon size="10" effect="light">
|
||||
<template>
|
||||
<img class="jira-image" src="../../../../assets/tapd-user.png"/>
|
||||
</template>
|
||||
</ms-instructions-icon>
|
||||
</el-form-item>
|
||||
<el-form-item :label="'Tapd 昵称'" prop="account">
|
||||
<el-input v-model="data.tapdUserName" :placeholder="$t('organization.integration.input_api_account')"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
|
||||
export default {
|
||||
name: "TapdUserInfo",
|
||||
components: {MsInstructionsIcon},
|
||||
props: ['data'],
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.instructions-icon {
|
||||
margin-left: -5px;
|
||||
}
|
||||
</style>
|
|
@ -76,7 +76,7 @@ import {buildCustomFields, getTemplate, parseCustomField} from "@/common/js/cust
|
|||
import CustomFiledComponent from "@/business/components/settings/workspace/template/CustomFiledComponent";
|
||||
import TestCaseIssueList from "@/business/components/track/issue/TestCaseIssueList";
|
||||
import IssueEditDetail from "@/business/components/track/issue/IssueEditDetail";
|
||||
import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
|
||||
import {getCurrentOrganizationId, getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
|
||||
import {getIssueTemplate} from "@/network/custom-field-template";
|
||||
|
||||
export default {
|
||||
|
@ -234,6 +234,7 @@ export default {
|
|||
let param = {};
|
||||
Object.assign(param, this.form);
|
||||
param.projectId = this.projectId;
|
||||
param.organizationId = getCurrentOrganizationId();
|
||||
buildCustomFields(this.form, param, this.issueTemplate);
|
||||
if (this.isPlan) {
|
||||
param.testCaseIds = [this.caseId];
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import {getCurrentOrganizationId} from "@/common/js/utils";
|
||||
import {get} from "@/common/js/ajax";
|
||||
|
||||
export function getIntegrationService(success) {
|
||||
return get("/service/integration/all/" + getCurrentOrganizationId(), response => {
|
||||
let data = response.data;
|
||||
if (success) {
|
||||
success(response.data);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue