Browse Source

Merge remote-tracking branch 'upstream/dev' into spilit

pull/3/MERGE
lenboo 4 years ago
parent
commit
9b9952a29f
  1. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java
  2. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/BaseService.java
  3. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
  4. 28
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
  5. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
  6. 42
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
  7. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
  8. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
  9. 2
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
  10. 12
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue
  11. 52
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java

@ -75,7 +75,7 @@ public class AlertGroupService extends BaseService{
public Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { public Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -83,7 +83,7 @@ public class AlertGroupService extends BaseService{
IPage<AlertGroup> alertGroupIPage = alertGroupMapper.queryAlertGroupPage( IPage<AlertGroup> alertGroupIPage = alertGroupMapper.queryAlertGroupPage(
page, searchVal); page, searchVal);
PageInfo<AlertGroup> pageInfo = new PageInfo<>(pageNo, pageSize); PageInfo<AlertGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotalCount((int)alertGroupIPage.getTotal()); pageInfo.setTotalCount((int) alertGroupIPage.getTotal());
pageInfo.setLists(alertGroupIPage.getRecords()); pageInfo.setLists(alertGroupIPage.getRecords());
result.put(Constants.DATA_LIST, pageInfo); result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
@ -103,7 +103,7 @@ public class AlertGroupService extends BaseService{
public Map<String, Object> createAlertgroup(User loginUser, String groupName, AlertType groupType, String desc) { public Map<String, Object> createAlertgroup(User loginUser, String groupName, AlertType groupType, String desc) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
//only admin can operate //only admin can operate
if (checkAdmin(loginUser, result)){ if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -140,7 +140,7 @@ public class AlertGroupService extends BaseService{
public Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, AlertType groupType, String desc) { public Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, AlertType groupType, String desc) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)){ if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -183,7 +183,7 @@ public class AlertGroupService extends BaseService{
result.put(Constants.STATUS, false); result.put(Constants.STATUS, false);
//only admin can operate //only admin can operate
if (checkAdmin(loginUser, result)){ if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
//check exist //check exist
@ -213,7 +213,7 @@ public class AlertGroupService extends BaseService{
result.put(Constants.STATUS, false); result.put(Constants.STATUS, false);
//only admin can operate //only admin can operate
if (checkAdmin(loginUser, result)){ if (isNotAdmin(loginUser, result)) {
return result; return result;
} }

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/BaseService.java

@ -46,13 +46,13 @@ public class BaseService {
} }
/** /**
* check admin * isNotAdmin
* *
* @param loginUser login user * @param loginUser login user
* @param result result code * @param result result code
* @return true if administrator, otherwise false * @return true if not administrator, otherwise false
*/ */
protected boolean checkAdmin(User loginUser, Map<String, Object> result) { protected boolean isNotAdmin(User loginUser, Map<String, Object> result) {
//only admin can operate //only admin can operate
if (!isAdmin(loginUser)) { if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM); putMsg(result, Status.USER_NO_OPERATION_PERM);

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java

@ -60,7 +60,7 @@ public class QueueService extends BaseService {
*/ */
public Map<String, Object> queryList(User loginUser) { public Map<String, Object> queryList(User loginUser) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -82,7 +82,7 @@ public class QueueService extends BaseService {
*/ */
public Map<String, Object> queryList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { public Map<String, Object> queryList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -111,7 +111,7 @@ public class QueueService extends BaseService {
*/ */
public Map<String, Object> createQueue(User loginUser, String queue, String queueName) { public Map<String, Object> createQueue(User loginUser, String queue, String queueName) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -160,7 +160,7 @@ public class QueueService extends BaseService {
*/ */
public Map<String, Object> updateQueue(User loginUser, int id, String queue, String queueName) { public Map<String, Object> updateQueue(User loginUser, int id, String queue, String queueName) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }

28
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java

@ -1158,20 +1158,20 @@ public class ResourcesService extends BaseService {
public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) { public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
List<ResourceComponent> list ; List<ResourceComponent> list;
if (CollectionUtils.isNotEmpty(resourceList)) { if (CollectionUtils.isNotEmpty(resourceList)) {
Visitor visitor = new ResourceTreeVisitor(resourceList); Visitor visitor = new ResourceTreeVisitor(resourceList);
list = visitor.visit().getChildren(); list = visitor.visit().getChildren();
}else { } else {
list = new ArrayList<>(0); list = new ArrayList<>(0);
} }
result.put(Constants.DATA_LIST, list); result.put(Constants.DATA_LIST, list);
putMsg(result,Status.SUCCESS); putMsg(result, Status.SUCCESS);
return result; return result;
} }
@ -1185,23 +1185,23 @@ public class ResourcesService extends BaseService {
public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) { public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId); List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
List<Resource> list ; List<Resource> list;
if (resourceList != null && resourceList.size() > 0) { if (resourceList != null && resourceList.size() > 0) {
Set<Resource> resourceSet = new HashSet<>(resourceList); Set<Resource> resourceSet = new HashSet<>(resourceList);
List<Resource> authedResourceList = resourcesMapper.queryAuthorizedResourceList(userId); List<Resource> authedResourceList = resourcesMapper.queryAuthorizedResourceList(userId);
getAuthorizedResourceList(resourceSet, authedResourceList); getAuthorizedResourceList(resourceSet, authedResourceList);
list = new ArrayList<>(resourceSet); list = new ArrayList<>(resourceSet);
}else { } else {
list = new ArrayList<>(0); list = new ArrayList<>(0);
} }
Visitor visitor = new ResourceTreeVisitor(list); Visitor visitor = new ResourceTreeVisitor(list);
result.put(Constants.DATA_LIST, visitor.visit().getChildren()); result.put(Constants.DATA_LIST, visitor.visit().getChildren());
putMsg(result,Status.SUCCESS); putMsg(result, Status.SUCCESS);
return result; return result;
} }
@ -1215,7 +1215,7 @@ public class ResourcesService extends BaseService {
public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) { public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
//only admin can operate //only admin can operate
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -1231,13 +1231,11 @@ public class ResourcesService extends BaseService {
resultList = new ArrayList<>(udfFuncSet); resultList = new ArrayList<>(udfFuncSet);
} }
result.put(Constants.DATA_LIST, resultList); result.put(Constants.DATA_LIST, resultList);
putMsg(result,Status.SUCCESS); putMsg(result, Status.SUCCESS);
return result; return result;
} }
/** /**
* authorized udf function * authorized udf function
* *
@ -1247,12 +1245,12 @@ public class ResourcesService extends BaseService {
*/ */
public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) { public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId); List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId);
result.put(Constants.DATA_LIST, udfFuncs); result.put(Constants.DATA_LIST, udfFuncs);
putMsg(result,Status.SUCCESS); putMsg(result, Status.SUCCESS);
return result; return result;
} }
@ -1266,7 +1264,7 @@ public class ResourcesService extends BaseService {
*/ */
public Map<String, Object> authorizedFile(User loginUser, Integer userId) { public Map<String, Object> authorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)){ if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
List<Resource> authedResources = resourcesMapper.queryAuthorizedResourceList(userId); List<Resource> authedResources = resourcesMapper.queryAuthorizedResourceList(userId);

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java

@ -70,7 +70,7 @@ public class WorkerGroupService extends BaseService {
Integer toIndex = (pageNo - 1) * pageSize + pageSize; Integer toIndex = (pageNo - 1) * pageSize + pageSize;
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }

42
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

@ -221,9 +221,8 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
processDefineMapper.updateVersionByProcessDefinitionId(processDefine.getId(), version); processDefineMapper.updateVersionByProcessDefinitionId(processDefine.getId(), version);
// return processDefinition object with ID // return processDefinition object with ID
result.put(Constants.DATA_LIST, processDefineMapper.selectById(processDefine.getId())); result.put(Constants.DATA_LIST, processDefine.getId());
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
result.put(PROCESSDEFINITIONID, processDefine.getId());
return result; return result;
} }
@ -888,8 +887,8 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
//create process definition //create process definition
Integer processDefinitionId = Integer processDefinitionId =
Objects.isNull(createProcessResult.get(PROCESSDEFINITIONID)) Objects.isNull(createProcessResult.get(Constants.DATA_LIST))
? null : Integer.parseInt(createProcessResult.get(PROCESSDEFINITIONID).toString()); ? null : Integer.parseInt(createProcessResult.get(Constants.DATA_LIST).toString());
//scheduler param //scheduler param
return getImportProcessScheduleResult(loginUser, return getImportProcessScheduleResult(loginUser,
@ -1516,41 +1515,6 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
} }
} }
/**
* copy process definition
*
* @param loginUser login user
* @param projectName project name
* @param processId process definition id
* @return copy result code
*/
public Map<String, Object> copyProcessDefinition(User loginUser, String projectName, Integer processId) {
Map<String, Object> result = new HashMap<>(5);
Project project = projectMapper.queryByName(projectName);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
return checkResult;
}
ProcessDefinition processDefinition = processDefineMapper.selectById(processId);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
return result;
} else {
return createProcessDefinition(
loginUser,
projectName,
processDefinition.getName() + "_copy_" + System.currentTimeMillis(),
processDefinition.getProcessDefinitionJson(),
processDefinition.getDescription(),
processDefinition.getLocations(),
processDefinition.getConnects());
}
}
/** /**
* batch copy process definition * batch copy process definition
* *

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java

@ -293,7 +293,7 @@ public class ProjectServiceImpl extends BaseService implements ProjectService {
*/ */
public Map<String, Object> queryUnauthorizedProject(User loginUser, Integer userId) { public Map<String, Object> queryUnauthorizedProject(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
/** /**
@ -344,7 +344,7 @@ public class ProjectServiceImpl extends BaseService implements ProjectService {
public Map<String, Object> queryAuthorizedProject(User loginUser, Integer userId) { public Map<String, Object> queryAuthorizedProject(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -364,7 +364,7 @@ public class ProjectServiceImpl extends BaseService implements ProjectService {
public Map<String, Object> queryProjectCreatedByUser(User loginUser) { public Map<String, Object> queryProjectCreatedByUser(User loginUser) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java

@ -89,7 +89,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false); result.put(Constants.STATUS, false);
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -141,7 +141,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
public Map<String, Object> queryTenantList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { public Map<String, Object> queryTenantList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -174,7 +174,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false); result.put(Constants.STATUS, false);
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }
@ -235,7 +235,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
public Map<String, Object> deleteTenantById(User loginUser, int id) throws Exception { public Map<String, Object> deleteTenantById(User loginUser, int id) throws Exception {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)) { if (isNotAdmin(loginUser, result)) {
return result; return result;
} }

2
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java

@ -94,7 +94,7 @@ public class ProcessDefinitionControllerTest {
String connects = "[]"; String connects = "[]";
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
result.put("processDefinitionId", 1); result.put(Constants.DATA_LIST, 1);
Mockito.when(processDefinitionService.createProcessDefinition(user, projectName, name, json, Mockito.when(processDefinitionService.createProcessDefinition(user, projectName, name, json,
description, locations, connects)).thenReturn(result); description, locations, connects)).thenReturn(result);

12
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/localParams.vue

@ -59,7 +59,7 @@
</el-select> </el-select>
</template> </template>
<el-input <el-input
:disabled="isDetails" :disabled="isDetails && !isStartProcess"
type="text" type="text"
size="small" size="small"
v-model="localParamsList[$index].value" v-model="localParamsList[$index].value"
@ -68,18 +68,18 @@
@blur="_handleValue()" @blur="_handleValue()"
:style="inputStyle"> :style="inputStyle">
</el-input> </el-input>
<span class="lt-add"> <span class="lt-add" v-show="!isStartProcess">
<a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" > <a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" >
<em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" ></em> <em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" ></em>
</a> </a>
</span> </span>
<span class="add" v-if="$index === (localParamsList.length - 1)"> <span class="add" v-if="$index === (localParamsList.length - 1)" v-show="!isStartProcess">
<a href="javascript:" @click="!isDetails && _addUdp()" > <a href="javascript:" @click="!isDetails && _addUdp()" >
<em class="el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em> <em class="el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em>
</a> </a>
</span> </span>
</div> </div>
<span class="add-dp" v-if="!localParamsList.length"> <span class="add-dp" v-if="!localParamsList.length" v-show="!isStartProcess">
<a href="javascript:" @click="!isDetails && _addUdp()" > <a href="javascript:" @click="!isDetails && _addUdp()" >
<em class="iconfont el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em> <em class="iconfont el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em>
</a> </a>
@ -112,6 +112,10 @@
hide: { hide: {
type: Boolean, type: Boolean,
default: true default: true
},
isStartProcess: {
type: Boolean,
default: false
} }
}, },
methods: { methods: {

52
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue

@ -125,6 +125,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="clearfix list">
<div class="text">
<span>{{$t('Startup parameter')}}</span>
</div>
<div class="cont" style="width: 688px;">
<div style="padding-top: 6px;">
<m-local-params
ref="refLocalParams"
@on-local-params="_onLocalParams"
:udp-list="udpList"
:hide="false"
:isStartProcess="true">
</m-local-params>
</div>
</div>
</div>
<template v-if="execType"> <template v-if="execType">
<div class="clearfix list" style="margin:-6px 0 16px 0"> <div class="clearfix list" style="margin:-6px 0 16px 0">
<div class="text"> <div class="text">
@ -163,12 +179,16 @@
</div> </div>
</template> </template>
<script> <script>
import _ from 'lodash'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import mEmail from './email.vue' import mEmail from './email.vue'
import store from '@/conf/home/store' import store from '@/conf/home/store'
import { warningTypeList } from './util' import { warningTypeList } from './util'
import mPriority from '@/module/components/priority/priority' import mPriority from '@/module/components/priority/priority'
import mWorkerGroups from '@/conf/home/pages/dag/_source/formModel/_source/workerGroups' import mWorkerGroups from '@/conf/home/pages/dag/_source/formModel/_source/workerGroups'
import mLocalParams from '@/conf/home/pages/dag/_source/formModel/tasks/_source/localParams'
import disabledState from '@/module/mixin/disabledState'
import { mapMutations } from 'vuex'
export default { export default {
name: 'start-process', name: 'start-process',
@ -190,10 +210,13 @@
receiversCc: [], receiversCc: [],
runMode: 'RUN_MODE_SERIAL', runMode: 'RUN_MODE_SERIAL',
processInstancePriority: 'MEDIUM', processInstancePriority: 'MEDIUM',
workerGroup: 'default' workerGroup: 'default',
// Global custom parameters
definitionGlobalParams: [],
udpList: []
} }
}, },
mixins: [disabledState],
props: { props: {
startData: Object, startData: Object,
startNodeList: { startNodeList: {
@ -203,11 +226,21 @@
sourceType: String sourceType: String
}, },
methods: { methods: {
...mapMutations('dag', ['setIsDetails', 'resetParams']),
_onLocalParams (a) {
this.udpList = a
},
_datepicker (val) { _datepicker (val) {
this.scheduleTime = val this.scheduleTime = val
}, },
_start () { _start () {
this.spinnerLoading = true this.spinnerLoading = true
let startParams = {}
for (const item of this.udpList) {
if (item.value !== '') {
startParams[item.prop] = item.value
}
}
let param = { let param = {
processDefinitionId: this.startData.id, processDefinitionId: this.startData.id,
scheduleTime: this.scheduleTime.length && this.scheduleTime.join(',') || '', scheduleTime: this.scheduleTime.length && this.scheduleTime.join(',') || '',
@ -221,7 +254,8 @@
processInstancePriority: this.processInstancePriority, processInstancePriority: this.processInstancePriority,
receivers: this.receivers.join(',') || '', receivers: this.receivers.join(',') || '',
receiversCc: this.receiversCc.join(',') || '', receiversCc: this.receiversCc.join(',') || '',
workerGroup: this.workerGroup workerGroup: this.workerGroup,
startParams: !_.isEmpty(startParams) ? JSON.stringify(startParams) : ''
} }
// Executed from the specified node // Executed from the specified node
if (this.sourceType === 'contextmenu') { if (this.sourceType === 'contextmenu') {
@ -230,6 +264,8 @@
this.store.dispatch('dag/processStart', param).then(res => { this.store.dispatch('dag/processStart', param).then(res => {
this.$message.success(res.msg) this.$message.success(res.msg)
this.$emit('onUpdateStart') this.$emit('onUpdateStart')
// recovery
this.udpList = _.cloneDeep(this.definitionGlobalParams)
setTimeout(() => { setTimeout(() => {
this.spinnerLoading = false this.spinnerLoading = false
this.close() this.close()
@ -253,6 +289,13 @@
this.receiversCc = res.receiversCc && res.receiversCc.split(',') || [] this.receiversCc = res.receiversCc && res.receiversCc.split(',') || []
}) })
}, },
_getGlobalParams () {
this.setIsDetails(true)
this.store.dispatch('dag/getProcessDetails', this.startData.id).then(res => {
this.definitionGlobalParams = _.cloneDeep(this.store.state.dag.globalParams)
this.udpList = _.cloneDeep(this.store.state.dag.globalParams)
})
},
ok () { ok () {
this._start() this._start()
}, },
@ -270,6 +313,7 @@
this.workflowName = this.startData.name this.workflowName = this.startData.name
this._getReceiver() this._getReceiver()
this._getGlobalParams()
let stateWorkerGroupsList = this.store.state.security.workerGroupsListAll || [] let stateWorkerGroupsList = this.store.state.security.workerGroupsListAll || []
if (stateWorkerGroupsList.length) { if (stateWorkerGroupsList.length) {
this.workerGroup = stateWorkerGroupsList[0].id this.workerGroup = stateWorkerGroupsList[0].id
@ -292,7 +336,7 @@
this.workflowName = this.startData.name this.workflowName = this.startData.name
}, },
computed: {}, computed: {},
components: { mEmail, mPriority, mWorkerGroups } components: { mEmail, mPriority, mWorkerGroups, mLocalParams }
} }
</script> </script>

Loading…
Cancel
Save