diff --git a/dolphinscheduler-alert/pom.xml b/dolphinscheduler-alert/pom.xml index 5958bfbb8f..a416f2f08e 100644 --- a/dolphinscheduler-alert/pom.xml +++ b/dolphinscheduler-alert/pom.xml @@ -21,7 +21,7 @@ org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dolphinscheduler-alert ${project.artifactId} diff --git a/dolphinscheduler-api/pom.xml b/dolphinscheduler-api/pom.xml index 5c822ee362..c49e186198 100644 --- a/dolphinscheduler-api/pom.xml +++ b/dolphinscheduler-api/pom.xml @@ -21,7 +21,7 @@ org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dolphinscheduler-api ${project.artifactId} diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java index 2f2cb9ca6f..697d364dfd 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java @@ -27,6 +27,7 @@ import org.apache.dolphinscheduler.api.service.ResourcesService; import org.apache.dolphinscheduler.api.service.UdfFuncService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.enums.UdfType; import org.apache.dolphinscheduler.common.utils.ParameterUtils; @@ -275,7 +276,7 @@ public class ResourcesController extends BaseController { * @param type resource type * @return resource list */ - @ApiOperation(value = "queryResourceJarList", notes = "QUERY_RESOURCE_LIST_NOTES") + @ApiOperation(value = "queryResourceByProgramType", notes = "QUERY_RESOURCE_LIST_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") }) @@ -283,10 +284,14 @@ public class ResourcesController extends BaseController { @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_RESOURCES_LIST_ERROR) public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value = "type") ResourceType type + @RequestParam(value = "type") ResourceType type, + @RequestParam(value = "programType",required = false) ProgramType programType ) { - logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type.toString()); - Map result = resourceService.queryResourceJarList(loginUser, type); + String programTypeName = programType == null ? "" : programType.name(); + String userName = loginUser.getUserName(); + userName = userName.replaceAll("[\n|\r|\t]", "_"); + logger.info("query resource list, login user:{}, resource type:{}, program type:{}", userName,programTypeName); + Map result = resourceService.queryResourceByProgramType(loginUser, type,programType); return returnDataList(result); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java index c918a160af..9c3a84cf43 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilter.java @@ -31,24 +31,29 @@ public class ResourceFilter implements IFilter { /** * resource suffix */ - private String suffix; + private Set suffixs = new HashSet<>(); /** * resource list */ private List resourceList; /** - * parent list + * constructor + * @param suffix resource suffix + * @param resourceList resource list */ - //Set parentList = new HashSet<>(); + public ResourceFilter(String suffix, List resourceList) { + this.suffixs.add(suffix); + this.resourceList = resourceList; + } /** * constructor - * @param suffix resource suffix + * @param suffixs resource suffixs * @param resourceList resource list */ - public ResourceFilter(String suffix, List resourceList) { - this.suffix = suffix; + public ResourceFilter(Set suffixs, List resourceList) { + this.suffixs = suffixs; this.resourceList = resourceList; } @@ -59,7 +64,13 @@ public class ResourceFilter implements IFilter { public Set fileFilter(){ Set resources = resourceList.stream().filter(t -> { String alias = t.getAlias(); - return alias.endsWith(suffix); + boolean result = false; + for (String suffix : suffixs) { + if (alias.endsWith(suffix)) { + result = true; + } + } + return result; }).collect(Collectors.toSet()); return resources; } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java index e1a9c85aa1..f66e035eae 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java @@ -30,6 +30,7 @@ import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.utils.*; import org.apache.dolphinscheduler.dao.entity.*; @@ -654,21 +655,33 @@ public class ResourcesService extends BaseService { } /** - * query resource list + * query resource list by program type * * @param loginUser login user * @param type resource type * @return resource list */ - public Map queryResourceJarList(User loginUser, ResourceType type) { + public Map queryResourceByProgramType(User loginUser, ResourceType type, ProgramType programType) { Map result = new HashMap<>(5); + String suffix = ".jar"; int userId = loginUser.getId(); if(isAdmin(loginUser)){ userId = 0; } + if (programType != null) { + switch (programType) { + case JAVA: + break; + case SCALA: + break; + case PYTHON: + suffix = ".py"; + break; + } + } List allResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal(),0); - List resources = new ResourceFilter(".jar",new ArrayList<>(allResourceList)).filter(); + List resources = new ResourceFilter(suffix,new ArrayList<>(allResourceList)).filter(); Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources); result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren()); putMsg(result,Status.SUCCESS); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java index a56e3f83ef..a2ebd270bb 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java @@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.api.controller; import com.alibaba.fastjson.JSON; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; +import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.enums.UdfType; import org.apache.dolphinscheduler.common.utils.JSONUtils; @@ -452,4 +453,28 @@ public class ResourcesControllerTest extends AbstractControllerTest{ Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } + + @Test + public void testqueryResourceJarList() throws Exception { + + MultiValueMap paramsMap = new LinkedMultiValueMap<>(); + paramsMap.add("type", ResourceType.FILE.name()); + //paramsMap.add("programType", ProgramType.PYTHON.name()); + paramsMap.add("programType", "JAVA"); + + + MvcResult mvcResult = mockMvc.perform(get("/resources/list/jar") + .header(SESSION_ID, sessionId) + .params(paramsMap)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andReturn(); + + Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); + result.getCode().equals(Status.SUCCESS.getCode()); + JSONObject object = (JSONObject) JSON.parse(mvcResult.getResponse().getContentAsString()); + + Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); + logger.info(mvcResult.getResponse().getContentAsString()); + } } diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java index 8a4a16c4f0..8e3be6a2c9 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/dto/resources/filter/ResourceFilterTest.java @@ -23,7 +23,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** * resource filter test @@ -48,9 +50,11 @@ public class ResourceFilterTest { allList.add(resource5); allList.add(resource6); allList.add(resource7); + Set suffixSet = new HashSet<>(); + suffixSet.add(".jar"); + suffixSet.add(".txt"); - - ResourceFilter resourceFilter = new ResourceFilter(".jar",allList); + ResourceFilter resourceFilter = new ResourceFilter(suffixSet,allList); List resourceList = resourceFilter.filter(); Assert.assertNotNull(resourceList); resourceList.stream().forEach(t-> logger.info(t.toString())); diff --git a/dolphinscheduler-common/pom.xml b/dolphinscheduler-common/pom.xml index 290fa91b54..86e9de6cf8 100644 --- a/dolphinscheduler-common/pom.xml +++ b/dolphinscheduler-common/pom.xml @@ -21,7 +21,7 @@ org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dolphinscheduler-common dolphinscheduler-common diff --git a/dolphinscheduler-dao/pom.xml b/dolphinscheduler-dao/pom.xml index c97b52d201..8ef43b51b6 100644 --- a/dolphinscheduler-dao/pom.xml +++ b/dolphinscheduler-dao/pom.xml @@ -21,7 +21,7 @@ org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dolphinscheduler-dao ${project.artifactId} diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java index 3d35b68aac..d111a8c4f8 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/upgrade/UpgradeDao.java @@ -343,6 +343,14 @@ public abstract class UpgradeDao extends AbstractBaseDao { if (param != null) { List resourceList = JSONUtils.toList(param.getString("resourceList"), ResourceInfo.class); + ResourceInfo mainJar = JSONUtils.parseObject(param.getString("mainJar"), ResourceInfo.class); + if (mainJar != null && mainJar.getId() == 0) { + String fullName = mainJar.getRes().startsWith("/") ? mainJar.getRes() : String.format("/%s",mainJar.getRes()); + if (resourcesMap.containsKey(fullName)) { + mainJar.setId(resourcesMap.get(fullName)); + param.put("mainJar",JSONUtils.parseObject(JSONObject.toJSONString(mainJar))); + } + } if (CollectionUtils.isNotEmpty(resourceList)) { List newResourceList = resourceList.stream().map(resInfo -> { diff --git a/dolphinscheduler-dist/pom.xml b/dolphinscheduler-dist/pom.xml index ca3834e90b..8accc18f4c 100644 --- a/dolphinscheduler-dist/pom.xml +++ b/dolphinscheduler-dist/pom.xml @@ -20,7 +20,7 @@ dolphinscheduler org.apache.dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT 4.0.0 diff --git a/dolphinscheduler-plugin-api/pom.xml b/dolphinscheduler-plugin-api/pom.xml index 2bffba811d..b5963a0ea3 100644 --- a/dolphinscheduler-plugin-api/pom.xml +++ b/dolphinscheduler-plugin-api/pom.xml @@ -21,7 +21,7 @@ org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dolphinscheduler-plugin-api ${project.artifactId} diff --git a/dolphinscheduler-remote/pom.xml b/dolphinscheduler-remote/pom.xml index dcc57633bb..7a6aef783e 100644 --- a/dolphinscheduler-remote/pom.xml +++ b/dolphinscheduler-remote/pom.xml @@ -19,7 +19,7 @@ dolphinscheduler org.apache.dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT 4.0.0 diff --git a/dolphinscheduler-server/pom.xml b/dolphinscheduler-server/pom.xml index 4cbce0ab47..f32207bc77 100644 --- a/dolphinscheduler-server/pom.xml +++ b/dolphinscheduler-server/pom.xml @@ -21,7 +21,7 @@ org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dolphinscheduler-server dolphinscheduler-server diff --git a/dolphinscheduler-service/pom.xml b/dolphinscheduler-service/pom.xml index 3c4ea53ebb..4e0bdbb983 100644 --- a/dolphinscheduler-service/pom.xml +++ b/dolphinscheduler-service/pom.xml @@ -19,7 +19,7 @@ dolphinscheduler org.apache.dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT 4.0.0 diff --git a/dolphinscheduler-ui/pom.xml b/dolphinscheduler-ui/pom.xml index 13644bad91..53b872929b 100644 --- a/dolphinscheduler-ui/pom.xml +++ b/dolphinscheduler-ui/pom.xml @@ -20,7 +20,7 @@ dolphinscheduler org.apache.dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT 4.0.0 diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue index 98aaaa5ff4..c43a5eaa2a 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue @@ -434,7 +434,6 @@ this.$message.warning(`${i18n.$t('Failed to create node to save')}`) return } - // Global parameters (optional) this._udpTopFloorPop().then(() => { return this._save() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue index 0fe5d0cbdb..dca5adec8b 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue @@ -22,6 +22,7 @@ 0) { - this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) + this.$message.warning(`${i18n.$t('Please delete all non-existing resources')}`) return false } @@ -389,19 +402,20 @@ } let noResources = [{ id: -1, - name: $t('Unauthorized or deleted resources'), - fullName: '/'+$t('Unauthorized or deleted resources'), + name: $t('No resources exist'), + fullName: '/'+$t('No resources exist'), children: [] }] if(optionsCmp.length>0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.mainJarList = _.filter(this.mainJarList, o=> { return o.id!==-1 }) this.mainJarList = this.mainJarList.concat(noResources) } } @@ -465,13 +479,24 @@ } }, created () { + let o = this.backfillItem let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar + let pythonList = this.store.state.dag.resourcesListPy this.diGuiTree(item) this.diGuiTree(items) + this.diGuiTree(pythonList) + this.mainJarList = item - this.mainJarLists = items - let o = this.backfillItem + this.jarList = items + this.pyList = pythonList + + if(!_.isEmpty(o) && o.params.programType === 'PYTHON') { + this.mainJarLists = pythonList + } else { + this.mainJarLists = items + } + // Non-null objects represent backfill if (!_.isEmpty(o)) { this.mainClass = o.params.mainClass || '' diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue index 26d74bd990..451283557c 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue @@ -19,7 +19,7 @@
{{$t('Program Type')}}
- + 0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.mainJarList = _.filter(this.mainJarList, o=> { return o.id!==-1 }) this.mainJarList = this.mainJarList.concat(noResources) } } @@ -263,7 +276,7 @@ // noRes if (this.noRes.length>0) { - this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) + this.$message.warning(`${i18n.$t('Please delete all non-existing resources')}`) return false } @@ -343,13 +356,24 @@ } }, created () { + let o = this.backfillItem let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar + let pythonList = this.store.state.dag.resourcesListPy this.diGuiTree(item) this.diGuiTree(items) + this.diGuiTree(pythonList) + this.mainJarList = item - this.mainJarLists = items - let o = this.backfillItem + this.jarList = items + this.pyList = pythonList + + if(!_.isEmpty(o) && o.params.programType === 'PYTHON') { + this.mainJarLists = pythonList + } else { + this.mainJarLists = items + } + // Non-null objects represent backfill if (!_.isEmpty(o)) { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue index 40b8c6a0b7..117c050590 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue @@ -129,7 +129,7 @@ // noRes if (this.noRes.length>0) { - this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) + this.$message.warning(`${i18n.$t('Please delete all non-existing resources')}`) return false } @@ -222,19 +222,20 @@ } let noResources = [{ id: -1, - name: $t('Unauthorized or deleted resources'), - fullName: '/'+$t('Unauthorized or deleted resources'), + name: $t('No resources exist'), + fullName: '/'+$t('No resources exist'), children: [] }] if(optionsCmp.length>0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.resourceOptions = _.filter(this.resourceOptions, o=> { return o.id!==-1 }) this.resourceOptions = this.resourceOptions.concat(noResources) } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue index 48c5322b16..0c07a9afc1 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue @@ -165,7 +165,7 @@ } // noRes if (this.noRes.length>0) { - this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) + this.$message.warning(`${i18n.$t('Please delete all non-existing resources')}`) return false } // Process resourcelist @@ -260,19 +260,20 @@ } let noResources = [{ id: -1, - name: $t('Unauthorized or deleted resources'), - fullName: '/'+$t('Unauthorized or deleted resources'), + name: $t('No resources exist'), + fullName: '/'+$t('No resources exist'), children: [] }] if(optionsCmp.length>0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.options = _.filter(this.options, o=> { return o.id!==-1 }) this.options = this.options.concat(noResources) } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue index 2c59707c69..b678a72321 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue @@ -22,6 +22,7 @@ 0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.mainJarList = _.filter(this.mainJarList, o=> { return o.id!==-1 }) this.mainJarList = this.mainJarList.concat(noResources) } } @@ -387,7 +401,7 @@ // noRes if (this.noRes.length>0) { - this.$message.warning(`${i18n.$t('Please delete all non-existent resources')}`) + this.$message.warning(`${i18n.$t('Please delete all non-existing resources')}`) return false } @@ -512,13 +526,22 @@ } }, created () { + let o = this.backfillItem let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar + let pythonList = this.store.state.dag.resourcesListPy this.diGuiTree(item) this.diGuiTree(items) + this.diGuiTree(pythonList) + this.mainJarList = item - this.mainJarLists = items - let o = this.backfillItem + this.jarList = items + this.pyList = pythonList + if(!_.isEmpty(o) && o.params.programType === 'PYTHON') { + this.mainJarLists = pythonList + } else { + this.mainJarLists = items + } // Non-null objects represent backfill if (!_.isEmpty(o)) { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js index 34f78b03b8..07871b2c93 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js @@ -666,7 +666,18 @@ JSP.prototype.saveStore = function () { y: v.y } }) - + let targetArrBool = false + _.forEach(locations, item => { + if(item.targetarr) { + targetArrBool = true + return false + } + }) + if(connects.length && !targetArrBool) { + Vue.$message.warning(`${i18n.$t('The workflow canvas is abnormal and cannot be saved, please recreate')}`) + return false + } + // return false // Storage node store.commit('dag/setTasks', tasks) // Store coordinate information @@ -697,13 +708,6 @@ JSP.prototype.handleEvent = function () { console.log(sourceId,targetId) let rtTargetArrs = rtTargetArr(targetId) let rtSouceArrs = rtTargetArr(sourceId) - /** - * When connecting, connection is prohibited when the sourceId and target nodes are empty - */ - if(!sourceId && !targetId) { - Vue.$message.warning(`${i18n.$t('This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow')}`) - return false - } /** * Recursive search for nodes */ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue index b1d7a7b1e2..42c6b12234 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue @@ -62,6 +62,7 @@ this.getResourcesList(), // get jar this.getResourcesListJar(), + this.getResourcesListJar('PYTHON'), // get worker group list this.getWorkerGroupsAll(), this.getTenantList() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue index eedf741b6e..078c5e695c 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue @@ -57,10 +57,9 @@ this.getProjectList(), // get jar this.getResourcesListJar(), + this.getResourcesListJar('PYTHON'), // get resource this.getResourcesList(), - // get jar - this.getResourcesListJar(), // get worker group list this.getWorkerGroupsAll(), this.getTenantList() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue index daa30d7c44..f82cea414a 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue @@ -64,6 +64,7 @@ this.getResourcesList(), // get jar this.getResourcesListJar(), + this.getResourcesListJar('PYTHON'), // get worker group list this.getWorkerGroupsAll(), this.getTenantList() diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js index a549aafaa2..a2f1516bf0 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js @@ -374,16 +374,21 @@ export default { /** * get jar */ - getResourcesListJar ({ state }) { + getResourcesListJar ({ state }, payload) { return new Promise((resolve, reject) => { if (state.resourcesListJar.length) { resolve() return } io.get('resources/list/jar', { - type: 'FILE' + type: 'FILE', + programType: payload }, res => { - state.resourcesListJar = res.data + if(payload) { + state.resourcesListPy = res.data + } else { + state.resourcesListJar = res.data + } resolve(res.data) }).catch(res => { reject(res) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js index cbd828fe01..02d466870a 100755 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js @@ -109,6 +109,7 @@ export default { state.processListS = (payload && payload.processListS) || [] state.resourcesListS = (payload && payload.resourcesListS) || [] state.resourcesListJar = (payload && payload.resourcesListJar) || [] + state.resourcesListPy = (payload && payload.resourcesListPy) || [] state.projectListS = (payload && payload.projectListS) || [] state.isDetails = (payload && payload.isDetails) || false state.runFlag = (payload && payload.runFlag) || '' diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js index 05dfa77161..b2aad5ec3a 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js @@ -55,6 +55,8 @@ export default { resourcesListS: [], // tasks resourcesListJar resourcesListJar: [], + // tasks resourcesListPy + resourcesListPy: [], // tasks datasource Type dsTypeListS: [ { diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js index 5f7a707f87..b5616a7869 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js @@ -591,8 +591,8 @@ export default { 'Branch flow': 'Branch flow', 'Cannot select the same node for successful branch flow and failed branch flow': 'Cannot select the same node for successful branch flow and failed branch flow', 'Successful branch flow and failed branch flow are required': 'conditions node Successful and failed branch flow are required', - 'Unauthorized or deleted resources': 'Unauthorized or deleted resources', - 'Please delete all non-existent resources': 'Please delete all non-existent resources', + 'No resources exist': 'No resources exist', + 'Please delete all non-existing resources': 'Please delete all non-existing resources', 'The Worker group no longer exists, please select the correct Worker group!': 'The Worker group no longer exists, please select the correct Worker group!', 'Please confirm whether the workflow has been saved before downloading': 'Please confirm whether the workflow has been saved before downloading', 'User name length is between 3 and 39': 'User name length is between 3 and 39', @@ -601,5 +601,5 @@ export default { 'Connection name': 'Connection name', 'Current connection settings': 'Current connection settings', 'Please save the DAG before formatting': 'Please save the DAG before formatting', - 'This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow': 'This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow' + 'The workflow canvas is abnormal and cannot be saved, please recreate': 'The workflow canvas is abnormal and cannot be saved, please recreate' } diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js index 5dec5096b3..5a32d15e8c 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -591,8 +591,8 @@ export default { 'Branch flow': '分支流转', 'Cannot select the same node for successful branch flow and failed branch flow': '成功分支流转和失败分支流转不能选择同一个节点', 'Successful branch flow and failed branch flow are required': 'conditions节点成功和失败分支流转必填', - 'Unauthorized or deleted resources': '未授权或已删除资源', - 'Please delete all non-existent resources': '请删除所有未授权或已删除资源', + 'No resources exist': '不存在资源', + 'Please delete all non-existing resources': '请删除所有不存在资源', 'The Worker group no longer exists, please select the correct Worker group!': '该Worker分组已经不存在,请选择正确的Worker分组!', 'Please confirm whether the workflow has been saved before downloading': '下载前请确定工作流是否已保存', 'User name length is between 3 and 39': '用户名长度在3~39之间', @@ -607,5 +607,5 @@ export default { 'Connection name': '连线名', 'Current connection settings': '当前连线设置', 'Please save the DAG before formatting': '格式化前请先保存DAG', - 'This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow': '此画布异常,无法进行节点连线,请保存或退出当前工作流' + 'The workflow canvas is abnormal and cannot be saved, please recreate': '该工作流画布异常,无法保存,请重新创建' } diff --git a/pom.xml b/pom.xml index 80dceb71f6..f13cf9a05d 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 4.0.0 org.apache.dolphinscheduler dolphinscheduler - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT pom ${project.artifactId} http://dolphinscheduler.apache.org