Browse Source

Merge remote-tracking branch 'remotes/upstream/dev-20190415' into dev-20190415

pull/2/head
ligang 6 years ago
parent
commit
de07aabb99
  1. 17
      escheduler-api/src/main/java/cn/escheduler/api/service/AccessTokenService.java
  2. 4
      escheduler-api/src/main/java/cn/escheduler/api/service/TenantService.java
  3. 6
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapper.java
  4. 6
      escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapperProvider.java
  5. 4
      escheduler-dao/src/test/java/cn/escheduler/dao/mapper/AccessTokenMapperTest.java
  6. 5
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  7. 24
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
  8. 20
      escheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
  9. 8
      escheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/projectChart.vue
  10. 4
      escheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue
  11. 2
      escheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue

17
escheduler-api/src/main/java/cn/escheduler/api/service/AccessTokenService.java

@ -58,15 +58,16 @@ public class AccessTokenService extends BaseService {
public Map<String, Object> queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>(5);
if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM, Constants.STATUS)) {
return result;
}
Integer count = accessTokenMapper.countAccessTokenPaging(searchVal);
PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize);
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging(searchVal, pageInfo.getStart(), pageSize);
Integer count;
List<AccessToken> accessTokenList;
if (loginUser.getUserType() == UserType.ADMIN_USER){
count = accessTokenMapper.countAccessTokenPaging(0,searchVal);
accessTokenList = accessTokenMapper.queryAccessTokenPaging(0,searchVal, pageInfo.getStart(), pageSize);
}else {
count = accessTokenMapper.countAccessTokenPaging(loginUser.getId(),searchVal);
accessTokenList = accessTokenMapper.queryAccessTokenPaging(loginUser.getId(),searchVal, pageInfo.getStart(), pageSize);
}
pageInfo.setTotalCount(count);
pageInfo.setLists(accessTokenList);

4
escheduler-api/src/main/java/cn/escheduler/api/service/TenantService.java

@ -80,6 +80,10 @@ public class TenantService extends BaseService{
Tenant tenant = new Tenant();
Date now = new Date();
if (!tenantCode.matches("^[0-9a-zA-Z_.]{1,}$") || tenantCode.startsWith("-")){
putMsg(result, Status.VERIFY_TENANT_CODE_ERROR);
return result;
}
tenant.setTenantCode(tenantCode);
tenant.setTenantName(tenantName);
tenant.setQueueId(queueId);

6
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapper.java

@ -74,7 +74,8 @@ public interface AccessTokenMapper {
@Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE)
})
@SelectProvider(type = AccessTokenMapperProvider.class, method = "queryAccessTokenPaging")
List<AccessToken> queryAccessTokenPaging(@Param("searchVal") String searchVal,
List<AccessToken> queryAccessTokenPaging(@Param("userId") Integer userId,
@Param("searchVal") String searchVal,
@Param("offset") Integer offset,
@Param("pageSize") Integer pageSize);
@ -84,5 +85,6 @@ public interface AccessTokenMapper {
* @return
*/
@SelectProvider(type = AccessTokenMapperProvider.class, method = "countAccessTokenPaging")
Integer countAccessTokenPaging(@Param("searchVal") String searchVal);
Integer countAccessTokenPaging(@Param("userId") Integer userId
,@Param("searchVal") String searchVal);
}

6
escheduler-dao/src/main/java/cn/escheduler/dao/mapper/AccessTokenMapperProvider.java

@ -97,6 +97,9 @@ public class AccessTokenMapperProvider {
FROM(TABLE_NAME + " t,t_escheduler_user u");
Object searchVal = parameter.get("searchVal");
WHERE("u.id = t.user_id");
if(parameter.get("userId") != null && (int)parameter.get("userId") != 0){
WHERE(" u.id = #{userId}");
}
if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){
WHERE(" u.user_name like concat('%', #{searchVal}, '%')");
}
@ -115,6 +118,9 @@ public class AccessTokenMapperProvider {
FROM(TABLE_NAME + " t,t_escheduler_user u");
Object searchVal = parameter.get("searchVal");
WHERE("u.id = t.user_id");
if(parameter.get("userId") != null && (int)parameter.get("userId") != 0){
WHERE(" u.id = #{userId}");
}
if(searchVal != null && StringUtils.isNotEmpty(searchVal.toString())){
WHERE(" u.user_name like concat('%', #{searchVal}, '%') ");
}

4
escheduler-dao/src/test/java/cn/escheduler/dao/mapper/AccessTokenMapperTest.java

@ -51,10 +51,10 @@ public class AccessTokenMapperTest {
@Test
public void testListPaging(){
Integer count = accessTokenMapper.countAccessTokenPaging("");
Integer count = accessTokenMapper.countAccessTokenPaging(1,"");
Assert.assertEquals(count, (Integer) 5);
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging("", 0, 2);
List<AccessToken> accessTokenList = accessTokenMapper.queryAccessTokenPaging(1,"", 0, 2);
Assert.assertEquals(accessTokenList.size(), 5);
}

5
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -128,6 +128,7 @@
v-if="taskType === 'SQL'"
@on-params="_onParams"
ref="SQL"
:create-node-id="id"
:backfill-item="backfillItem">
</m-sql>
<!-- spark node -->
@ -429,7 +430,9 @@
}
this.isContentBox = true
},
mounted () {},
mounted () {
},
updated () {
},
beforeDestroy () {

24
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue

@ -29,15 +29,15 @@
</m-list-box>
<template v-if="!sqlType && showType.length">
<m-list-box>
<div slot="text">收件人</div>
<div slot="text">{{$t('Recipient')}}</div>
<div slot="content">
<m-email v-model="receivers" :repeat-data="receiversCc"></m-email>
<m-email v-model="receivers" :disabled="isDetails" :repeat-data="receiversCc"></m-email>
</div>
</m-list-box>
<m-list-box>
<div slot="text">抄送人</div>
<div slot="text">{{$t('Cc')}}</div>
<div slot="content">
<m-email v-model="receiversCc" :repeat-data="receivers"></m-email>
<m-email v-model="receiversCc" :disabled="isDetails" :repeat-data="receivers"></m-email>
</div>
</m-list-box>
</template>
@ -132,7 +132,8 @@
},
mixins: [disabledState],
props: {
backfillItem: Object
backfillItem: Object,
createNodeId: Number
},
methods: {
/**
@ -238,7 +239,14 @@
return editor
},
_getReceiver () {
this.store.dispatch('dag/getReceiver', { processDefinitionId: this.item.id }).then(res => {
let param = {}
let current = this.router.history.current
if (current.name === 'projects-definition-details') {
param.processDefinitionId = current.params.id
} else {
param.processInstanceId = current.params.id
}
this.store.dispatch('dag/getReceiver', param).then(res => {
this.receivers = res.receivers && res.receivers.split(',') || []
this.receiversCc = res.receiversCc && res.receiversCc.split(',') || []
})
@ -286,8 +294,8 @@
this.receivers = o.params.receivers && o.params.receivers.split(',') || []
this.receiversCc = o.params.receiversCc && o.params.receiversCc.split(',') || []
}
//
if (this.router.history.current.name === 'definition-create') {
if (!_.some(this.store.state.dag.tasks, { id: this.createNodeId }) &&
this.router.history.current.name !== 'definition-create') {
this._getReceiver()
}
},

20
escheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue

@ -1,9 +1,9 @@
<template>
<div class="ans-input email-model">
<div class="clearfix input-element">
<div class="clearfix input-element" :class="disabled ? 'disabled' : ''">
<span class="tag-wrapper" v-for="(item,$index) in activeList" :class="activeIndex === $index ? 'active' : ''">
<span class="tag-text">{{item}}</span>
<i class="remove-tag ans-icon-close" @click.stop="_del($index)"></i>
<i class="remove-tag ans-icon-close" @click.stop="_del($index)" v-if="!disabled"></i>
</span>
<x-poptip
placement="bottom-start"
@ -30,6 +30,7 @@
:style="{width:emailWidth + 'px'}"
type="text"
v-model="email"
:disabled="disabled"
:placeholder="$t('Please enter email')"
@keydown.tab="_emailTab"
@keyup.delete="_emailDelete"
@ -38,7 +39,6 @@
@keyup.down="_emailKeyup('down')">
</span>
</x-poptip>
</div>
</div>
</template>
@ -63,7 +63,11 @@
},
props: {
activeList: Array,
repeatData: Array
repeatData: Array,
disabled: {
type: Boolean,
default: false
}
},
model: {
prop: 'activeList',
@ -317,6 +321,14 @@
padding-left: 4px;
}
}
&.disabled {
.tag-wrapper {
background: #d9d9d9;
}
.email-input {
background: none;
}
}
}
}
.email-list-model {

8
escheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/projectChart.vue

@ -1,7 +1,7 @@
<template>
<div>
<template v-show="!isLoading">
<div class="perject-home-content">
<div class="perject-home-content" v-show="!msg">
<div class="time-model">
<x-datepicker
:panel-num="2"
@ -123,6 +123,7 @@
</div>
</div>
</div>
<m-no-data :msg="msg" v-if="msg"></m-no-data>
</template>
<m-spin :is-spin="isLoading" :is-left="id ? true : false">
</m-spin>
@ -154,7 +155,8 @@
projectId: this.id,
startDate: '',
endDate: ''
}
},
msg: ''
}
},
props: {
@ -297,7 +299,7 @@
this.isLoading = false
}, 800)
}).catch(e => {
console.log(e)
this.msg = e.msg || 'error'
this.isLoading = false
})
}

4
escheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue

@ -114,12 +114,12 @@
})
},
_verification () {
let isEn = /^[A-Za-z]+$/
let isEn = /^\w+$/
if (!this.tenantCode) {
this.$message.warning(`${i18n.$t('Please enter the tenant code in English')}`)
return false
}
if (!isEn.test(this.tenantCode)) {
if (!isEn.test(this.tenantCode) || this.tenantCode.split('')[0] === '_') {
this.$message.warning(`${i18n.$t('Please enter tenant code in English')}`)
return false
}

2
escheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue

@ -127,7 +127,7 @@
_verification () {
let regEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/ // eslint-disable-line
// Mobile phone number regular
let regPhone = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; // eslint-disable-line
let regPhone = /^1(3|4|5|6|7|8)\d{9}$/; // eslint-disable-line
// user name
if (!this.userName) {

Loading…
Cancel
Save