Browse Source

Merge remote-tracking branch 'upstream/dev' into json-split

pull/3/MERGE
lenboo 4 years ago
parent
commit
c3d18127be
  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. 10
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TenantServiceTest.java
  4. 2
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/shell/ShellExecutor.java
  5. 9
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/DataSourceMapper.xml
  6. 15
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
  7. 1
      dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/list.vue
  8. 1
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
  9. 4
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  10. 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 = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, 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")
@ResponseStatus(HttpStatus.OK)
@ -250,13 +251,23 @@ public class ProcessDefinitionController extends BaseController {
@RequestParam(value = "processDefinitionJson", required = true) String processDefinitionJson,
@RequestParam(value = "locations", required = false) String locations,
@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: {}, "
+ "process_definition_json: {}, desc: {}, locations:{}, connects:{}",
loginUser.getUserName(), projectName, name, processDefinitionJson, description, locations, connects);
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectName, id, name,
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);
}

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

10
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/TenantServiceTest.java

@ -35,7 +35,6 @@ import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.junit.Assert;
@ -191,14 +190,7 @@ public class TenantServiceTest {
Assert.assertEquals(Status.SUCCESS.getMsg(), result.getMsg());
// tenantCode exist
result = tenantService.verifyTenantCode(getTenant().getTenantCode());
String resultString;
if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) {
resultString = "操作系统租户[TenantServiceTest]已存在";
} else {
resultString = "tenant code TenantServiceTest already exists";
}
logger.info(result.toString());
Assert.assertEquals(resultString, result.getMsg());
Assert.assertEquals(Status.OS_TENANT_CODE_EXIST.getCode(), result.getCode().intValue());
}
/**

2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/shell/ShellExecutor.java

@ -140,9 +140,9 @@ public class ShellExecutor extends AbstractShell {
String line = "";
while ( (nRead = lines.read(buf, 0, buf.length)) > 0 ) {
line = new String(buf,0,nRead);
}
output.append(line);
}
}
/**
*

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
<include refid="baseSql"/>
from t_ds_datasource
d.id, d.name, d.note, d.type, d.user_id, connection_params, d.create_time, d.update_time
,
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
<if test="userId != 0">
and id in
and d.id in
(select datasource_id
from t_ds_relation_datasource_user
where user_id=#{userId}

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

@ -60,17 +60,20 @@
</select>
<select id="queryResourcePaging" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
select
<include refid="baseSql"/>
from t_ds_resources
where type=#{type} and pid=#{id}
d.id, d.alias, d.file_name, d.description, d.user_id, d.type, d.size, d.create_time, d.update_time,
d.pid, d.full_name, d.is_directory,
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">
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})
</if>
<if test="searchVal != null and searchVal != ''">
and alias like concat('%', #{searchVal}, '%')
and d.alias like concat('%', #{searchVal}, '%')
</if>
order by update_time desc
order by d.update_time desc
</select>
<select id="queryAuthorizedResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource">
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-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="userName" :label="$t('Datasource userName')"></el-table-column>
<el-table-column prop="type" :label="$t('Datasource Type')"></el-table-column>
<el-table-column :label="$t('Datasource Parameter')">
<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>
</template>
</el-table-column>
<el-table-column prop="userName" :label="$t('Resource userName')"></el-table-column>
<el-table-column :label="$t('Whether directory')" width="100">
<template slot-scope="scope">
{{scope.row.directory? $t('Yes') : $t('No')}}

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

@ -665,5 +665,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'
Info: 'Info',
'Datasource userName': 'owner',
'Resource userName': 'owner'
}

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

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

Loading…
Cancel
Save