Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…duler into dev
  • Loading branch information
break60 committed Jan 20, 2021
2 parents ea3c29a + 17c06ce commit 6dbc2fc
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ public Map<String, Object> createProcessDefinition(User loginUser,
processDefineMapper.updateVersionByProcessDefinitionId(processDefine.getId(), version);

// 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);
result.put(PROCESSDEFINITIONID, processDefine.getId());
return result;
}

Expand Down Expand Up @@ -888,8 +887,8 @@ private boolean checkAndImportProcessDefinition(User loginUser, String currentPr

//create process definition
Integer processDefinitionId =
Objects.isNull(createProcessResult.get(PROCESSDEFINITIONID))
? null : Integer.parseInt(createProcessResult.get(PROCESSDEFINITIONID).toString());
Objects.isNull(createProcessResult.get(Constants.DATA_LIST))
? null : Integer.parseInt(createProcessResult.get(Constants.DATA_LIST).toString());

//scheduler param
return getImportProcessScheduleResult(loginUser,
Expand Down Expand Up @@ -1516,41 +1515,6 @@ private Map<String, Object> copyProcessDefinition(User loginUser,
}
}

/**
* 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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void testCreateProcessDefinition() throws Exception {
String connects = "[]";
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
result.put("processDefinitionId", 1);
result.put(Constants.DATA_LIST, 1);

Mockito.when(processDefinitionService.createProcessDefinition(user, projectName, name, json,
description, locations, connects)).thenReturn(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</el-select>
</template>
<el-input
:disabled="isDetails"
:disabled="isDetails && !isStartProcess"
type="text"
size="small"
v-model="localParamsList[$index].value"
Expand All @@ -68,18 +68,18 @@
@blur="_handleValue()"
:style="inputStyle">
</el-input>
<span class="lt-add">
<span class="lt-add" v-show="!isStartProcess">
<a href="javascript:" style="color:red;" @click="!isDetails && _removeUdp($index)" >
<em class="el-icon-delete" :class="_isDetails" data-toggle="tooltip" :title="$t('delete')" ></em>
</a>
</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()" >
<em class="el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em>
</a>
</span>
</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()" >
<em class="iconfont el-icon-circle-plus-outline" :class="_isDetails" data-toggle="tooltip" :title="$t('Add')"></em>
</a>
Expand Down Expand Up @@ -112,6 +112,10 @@
hide: {
type: Boolean,
default: true
},
isStartProcess: {
type: Boolean,
default: false
}
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,22 @@
</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">
<div class="clearfix list" style="margin:-6px 0 16px 0">
<div class="text">
Expand Down Expand Up @@ -147,11 +163,15 @@
</div>
</template>
<script>
import _ from 'lodash'
import dayjs from 'dayjs'
import store from '@/conf/home/store'
import { warningTypeList } from './util'
import mPriority from '@/module/components/priority/priority'
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 {
name: 'start-process',
Expand All @@ -171,10 +191,13 @@
taskDependType: 'TASK_POST',
runMode: 'RUN_MODE_SERIAL',
processInstancePriority: 'MEDIUM',
workerGroup: 'default'
workerGroup: 'default',
// Global custom parameters
definitionGlobalParams: [],
udpList: []
}
},
mixins: [disabledState],
props: {
startData: Object,
startNodeList: {
Expand All @@ -184,11 +207,21 @@
sourceType: String
},
methods: {
...mapMutations('dag', ['setIsDetails', 'resetParams']),
_onLocalParams (a) {
this.udpList = a
},
_datepicker (val) {
this.scheduleTime = val
},
_start () {
this.spinnerLoading = true
let startParams = {}
for (const item of this.udpList) {
if (item.value !== '') {
startParams[item.prop] = item.value
}
}
let param = {
processDefinitionId: this.startData.id,
scheduleTime: this.scheduleTime.length && this.scheduleTime.join(',') || '',
Expand All @@ -200,7 +233,8 @@
taskDependType: this.taskDependType,
runMode: this.runMode,
processInstancePriority: this.processInstancePriority,
workerGroup: this.workerGroup
workerGroup: this.workerGroup,
startParams: !_.isEmpty(startParams) ? JSON.stringify(startParams) : ''
}
// Executed from the specified node
if (this.sourceType === 'contextmenu') {
Expand All @@ -209,6 +243,8 @@
this.store.dispatch('dag/processStart', param).then(res => {
this.$message.success(res.msg)
this.$emit('onUpdateStart')
// recovery
this.udpList = _.cloneDeep(this.definitionGlobalParams)
setTimeout(() => {
this.spinnerLoading = false
this.close()
Expand All @@ -226,6 +262,13 @@
})
})
},
_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 () {
this._start()
},
Expand All @@ -241,6 +284,7 @@
created () {
this.warningType = this.warningTypeList[0].id
this.workflowName = this.startData.name
this._getGlobalParams()
let stateWorkerGroupsList = this.store.state.security.workerGroupsListAll || []
if (stateWorkerGroupsList.length) {
this.workerGroup = stateWorkerGroupsList[0].id
Expand All @@ -263,7 +307,7 @@
this.workflowName = this.startData.name
},
computed: {},
components: { mPriority, mWorkerGroups }
components: { mPriority, mWorkerGroups, mLocalParams }
}
</script>

Expand Down

0 comments on commit 6dbc2fc

Please sign in to comment.