feat: zentao组件添加地址属性

This commit is contained in:
shiziyuan9527 2020-11-11 17:02:26 +08:00
parent 67f411f583
commit 437630eb81
4 changed files with 36 additions and 10 deletions

View File

@ -10,6 +10,9 @@
<el-input v-model="form.password" auto-complete="new-password" <el-input v-model="form.password" auto-complete="new-password"
:placeholder="$t('organization.integration.input_app_key')" show-password/> :placeholder="$t('organization.integration.input_app_key')" show-password/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('organization.integration.zentao_url')" prop="url">
<el-input v-model="form.url" :placeholder="$t('organization.integration.input_zentao_url')"/>
</el-form-item>
</el-form> </el-form>
</div> </div>
@ -63,7 +66,12 @@ export default {
required: true, required: true,
message: this.$t('organization.integration.input_app_key'), message: this.$t('organization.integration.input_app_key'),
trigger: ['change', 'blur'] trigger: ['change', 'blur']
} },
url: {
required: true,
message: this.$t('organization.integration.input_zentao_url'),
trigger: ['change', 'blur']
},
}, },
} }
}, },
@ -71,12 +79,16 @@ export default {
save() { save() {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
let formatUrl = this.form.url.trim();
if (!formatUrl.endsWith('/')) {
formatUrl = formatUrl + '/';
}
const {lastOrganizationId} = getCurrentUser(); const {lastOrganizationId} = getCurrentUser();
let param = {}; let param = {};
let auth = { let auth = {
account: this.form.account, account: this.form.account,
password: this.form.password, password: this.form.password,
url: formatUrl,
}; };
param.organizationId = lastOrganizationId; param.organizationId = lastOrganizationId;
param.platform = ZEN_TAO; param.platform = ZEN_TAO;
@ -106,6 +118,7 @@ export default {
let config = JSON.parse(data.configuration); let config = JSON.parse(data.configuration);
this.$set(this.form, 'account', config.account); this.$set(this.form, 'account', config.account);
this.$set(this.form, 'password', config.password); this.$set(this.form, 'password', config.password);
this.$set(this.form, 'url', config.url);
} else { } else {
this.clear(); this.clear();
} }
@ -114,19 +127,26 @@ export default {
clear() { clear() {
this.$set(this.form, 'account', ''); this.$set(this.form, 'account', '');
this.$set(this.form, 'password', ''); this.$set(this.form, 'password', '');
this.$set(this.form, 'url', '');
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
}); });
}, },
testConnection() { testConnection() {
if (this.form.account && this.form.password) { this.$refs['form'].validate(valid => {
this.$parent.result = this.$get("issues/auth/" + ZEN_TAO, () => { if (valid) {
this.$success(this.$t('organization.integration.verified')); if (this.form.account && this.form.password) {
}); this.$parent.result = this.$get("issues/auth/" + ZEN_TAO, () => {
} else { this.$success(this.$t('organization.integration.verified'));
this.$warning(this.$t('organization.integration.not_integrated')); });
return false; } else {
} this.$warning(this.$t('organization.integration.not_integrated'));
return false;
}
} else {
return false;
}
})
}, },
cancelIntegration() { cancelIntegration() {
if (this.form.account && this.form.password) { if (this.form.account && this.form.password) {

View File

@ -262,6 +262,8 @@ export default {
input_app_key: 'Please enter the key', input_app_key: 'Please enter the key',
input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/', input_jira_url: 'Please enter Jira address, for example: https://metersphere.atlassian.net/',
input_jira_issuetype: 'Please enter the question type', input_jira_issuetype: 'Please enter the question type',
zentao_url: 'Zentao url',
input_zentao_url: 'Please enter Zentao address, for example: http://xx.xx.xx.xx/zentao/',
use_tip: 'Usage guidelines:', use_tip: 'Usage guidelines:',
use_tip_tapd: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"', use_tip_tapd: 'Basic Auth account information is queried in "Company Management-Security and Integration-Open Platform"',
use_tip_jira: 'Jira software server authentication information is account password, Jira software cloud authentication information is account + token (account settings-security-create API token)', use_tip_jira: 'Jira software server authentication information is account password, Jira software cloud authentication information is account + token (account settings-security-create API token)',

View File

@ -262,6 +262,8 @@ export default {
input_app_key: '请输入密钥', input_app_key: '请输入密钥',
input_jira_url: '请输入Jira地址https://metersphere.atlassian.net/', input_jira_url: '请输入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '请输入问题类型', input_jira_issuetype: '请输入问题类型',
zentao_url: 'Zentao 地址',
input_zentao_url: '请输入Zentao地址http://xx.xx.xx.xx/zentao/',
use_tip: '使用指引:', use_tip: '使用指引:',
use_tip_tapd: 'Tapd Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询', use_tip_tapd: 'Tapd Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询',
use_tip_jira: 'Jira software server 认证信息为 账号密码Jira software cloud 认证信息为 账号+令牌(账户设置-安全-创建API令牌)', use_tip_jira: 'Jira software server 认证信息为 账号密码Jira software cloud 认证信息为 账号+令牌(账户设置-安全-创建API令牌)',

View File

@ -264,6 +264,8 @@ export default {
input_app_key: '請輸入密鑰', input_app_key: '請輸入密鑰',
input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/', input_jira_url: '請輸入Jira地址https://metersphere.atlassian.net/',
input_jira_issuetype: '請輸入問題類型', input_jira_issuetype: '請輸入問題類型',
zentao_url: 'Zentao 地址',
input_zentao_url: '請輸入Zentao地址http://xx.xx.xx.xx/zentao/',
use_tip: '使用指引:', use_tip: '使用指引:',
use_tip_tapd: 'Tapd Basic Auth 賬號信息在"公司管理-安全與集成-開放平臺"中查詢', use_tip_tapd: 'Tapd Basic Auth 賬號信息在"公司管理-安全與集成-開放平臺"中查詢',
use_tip_jira: 'Jira software server 認證信息為 賬號密碼Jira software cloud 認證信息為 賬號+令牌(賬戶設置-安全-創建API令牌)', use_tip_jira: 'Jira software server 認證信息為 賬號密碼Jira software cloud 認證信息為 賬號+令牌(賬戶設置-安全-創建API令牌)',