break60 4 years ago
parent
commit
574ffa5fdf
  1. 13
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
  2. 3
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
  3. 9
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceMapper.xml
  4. 15
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
  5. 1
      dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/list.vue
  6. 1
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
  7. 4
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  8. 4
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

13
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java

@ -239,6 +239,7 @@ public class ProcessDefinitionController extends BaseController {
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
@ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"), @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"),
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "Int", example = "0")
}) })
@PostMapping(value = "/update") @PostMapping(value = "/update")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ -250,13 +251,23 @@ public class ProcessDefinitionController extends BaseController {
@RequestParam(value = "processDefinitionJson", required = true) String processDefinitionJson, @RequestParam(value = "processDefinitionJson", required = true) String processDefinitionJson,
@RequestParam(value = "locations", required = false) String locations, @RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "connects", required = false) String connects, @RequestParam(value = "connects", required = false) String connects,
@RequestParam(value = "description", required = false) String description) { @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "releaseState", required = false, defaultValue = "0") int releaseState) {
logger.info("login user {}, update process define, project name: {}, process define name: {}, " logger.info("login user {}, update process define, project name: {}, process define name: {}, "
+ "process_definition_json: {}, desc: {}, locations:{}, connects:{}", + "process_definition_json: {}, desc: {}, locations:{}, connects:{}",
loginUser.getUserName(), projectName, name, processDefinitionJson, description, locations, connects); loginUser.getUserName(), projectName, name, processDefinitionJson, description, locations, connects);
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectName, id, name, Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectName, id, name,
processDefinitionJson, description, locations, connects); processDefinitionJson, description, locations, connects);
// If the update fails, the result will be returned directly
Status status = (Status) result.get("status");
if (status.getCode() != 0) {
return returnDataList(result);
}
// Judge whether to go online after editing,0 means offline, 1 means online
if (releaseState == 1) {
result = processDefinitionService.releaseProcessDefinition(loginUser, projectName, id, releaseState);
}
return returnDataList(result); return returnDataList(result);
} }

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

@ -142,6 +142,7 @@ public class ProcessDefinitionControllerTest {
String description = "desc test"; String description = "desc test";
String connects = "[]"; String connects = "[]";
int id = 1; int id = 1;
int releaseState = 0;
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("processDefinitionId", 1);
@ -150,7 +151,7 @@ public class ProcessDefinitionControllerTest {
description, locations, connects)).thenReturn(result); description, locations, connects)).thenReturn(result);
Result response = processDefinitionController.updateProcessDefinition(user, projectName, name, id, json, Result response = processDefinitionController.updateProcessDefinition(user, projectName, name, id, json,
locations, connects, description); locations, connects, description,releaseState);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
} }

9
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceMapper.xml

@ -40,11 +40,14 @@
<select id="selectPaging" resultType="org.apache.dolphinscheduler.dao.entity.DataSource"> <select id="selectPaging" resultType="org.apache.dolphinscheduler.dao.entity.DataSource">
select select
<include refid="baseSql"/> d.id, d.name, d.note, d.type, d.user_id, connection_params, d.create_time, d.update_time
from t_ds_datasource ,
u.user_name as user_name
from t_ds_datasource d
join t_ds_user u on d.user_id = u.id
where 1 =1 where 1 =1
<if test="userId != 0"> <if test="userId != 0">
and id in and d.id in
(select datasource_id (select datasource_id
from t_ds_relation_datasource_user from t_ds_relation_datasource_user
where user_id=#{userId} where user_id=#{userId}

15
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml

@ -60,17 +60,20 @@
</select> </select>
<select id="queryResourcePaging" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> <select id="queryResourcePaging" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select select
<include refid="baseSql"/> d.id, d.alias, d.file_name, d.description, d.user_id, d.type, d.size, d.create_time, d.update_time,
from t_ds_resources d.pid, d.full_name, d.is_directory,
where type=#{type} and pid=#{id} u.user_name as user_name
from t_ds_resources d
join t_ds_user u on d.user_id = u.id
where d.type=#{type} and d.pid=#{id}
<if test="userId != 0"> <if test="userId != 0">
and id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId} and d.id in (select resources_id from t_ds_relation_resources_user where user_id=#{userId}
union select id as resources_id from t_ds_resources where user_id=#{userId}) union select id as resources_id from t_ds_resources where user_id=#{userId})
</if> </if>
<if test="searchVal != null and searchVal != ''"> <if test="searchVal != null and searchVal != ''">
and alias like concat('%', #{searchVal}, '%') and d.alias like concat('%', #{searchVal}, '%')
</if> </if>
order by update_time desc order by d.update_time desc
</select> </select>
<select id="queryAuthorizedResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> <select id="queryAuthorizedResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select select

1
dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/list.vue

@ -20,6 +20,7 @@
<el-table :data="list" size="mini" style="width: 100%"> <el-table :data="list" size="mini" style="width: 100%">
<el-table-column type="index" :label="$t('#')" width="50"></el-table-column> <el-table-column type="index" :label="$t('#')" width="50"></el-table-column>
<el-table-column prop="name" :label="$t('Datasource Name')"></el-table-column> <el-table-column prop="name" :label="$t('Datasource Name')"></el-table-column>
<el-table-column prop="userName" :label="$t('Datasource userName')"></el-table-column>
<el-table-column prop="type" :label="$t('Datasource Type')"></el-table-column> <el-table-column prop="type" :label="$t('Datasource Type')"></el-table-column>
<el-table-column :label="$t('Datasource Parameter')"> <el-table-column :label="$t('Datasource Parameter')">
<template slot-scope="scope"> <template slot-scope="scope">

1
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue

@ -29,6 +29,7 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="userName" :label="$t('Resource userName')"></el-table-column>
<el-table-column :label="$t('Whether directory')" width="100"> <el-table-column :label="$t('Whether directory')" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.directory? $t('Yes') : $t('No')}} {{scope.row.directory? $t('Yes') : $t('No')}}

4
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@ -671,5 +671,7 @@ export default {
'Max Memory': 'Max Memory', 'Max Memory': 'Max Memory',
'Min Memory': 'Min Memory', 'Min Memory': 'Min Memory',
'The workflow canvas is abnormal and cannot be saved, please recreate': 'The workflow canvas is abnormal and cannot be saved, please recreate', 'The workflow canvas is abnormal and cannot be saved, please recreate': 'The workflow canvas is abnormal and cannot be saved, please recreate',
Info: 'Info' Info: 'Info',
'Datasource userName': 'owner',
'Resource userName': 'owner'
} }

4
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -670,5 +670,7 @@ export default {
'Max Memory': '最大内存', 'Max Memory': '最大内存',
'Min Memory': '最小内存', 'Min Memory': '最小内存',
'The workflow canvas is abnormal and cannot be saved, please recreate': '该工作流画布异常无法保存请重新创建', 'The workflow canvas is abnormal and cannot be saved, please recreate': '该工作流画布异常无法保存请重新创建',
Info: '提示' Info: '提示',
'Datasource userName': '所属用户',
'Resource userName': '所属用户'
} }

Loading…
Cancel
Save