diff --git a/.github/workflows/ci_ut.yml b/.github/workflows/ci_ut.yml
index 70790a7650..739c9be7fa 100644
--- a/.github/workflows/ci_ut.yml
+++ b/.github/workflows/ci_ut.yml
@@ -91,3 +91,30 @@ jobs:
mkdir -p ${LOG_DIR}
docker-compose -f $(pwd)/docker/docker-swarm/docker-compose.yml logs dolphinscheduler-postgresql > ${LOG_DIR}/db.txt
continue-on-error: true
+
+ Checkstyle:
+ name: Check code style
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ # In the checkout@v2, it doesn't support git submodule. Execute the commands manually.
+ - name: checkout submodules
+ shell: bash
+ run: |
+ git submodule sync --recursive
+ git -c protocol.version=2 submodule update --init --force --recursive --depth=1
+ - name: check code style
+ env:
+ WORKDIR: ./
+ REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ CHECKSTYLE_CONFIG: style/checkstyle.xml
+ REVIEWDOG_VERSION: v0.10.2
+ run: |
+ wget -O - -q https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.22/checkstyle-8.22-all.jar > /opt/checkstyle.jar
+ wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /opt ${REVIEWDOG_VERSION}
+ java -jar /opt/checkstyle.jar "${WORKDIR}" -c "${CHECKSTYLE_CONFIG}" -f xml \
+ | /opt/reviewdog -f=checkstyle \
+ -reporter="${INPUT_REPORTER:-github-pr-check}" \
+ -filter-mode="${INPUT_FILTER_MODE:-added}" \
+ -fail-on-error="${INPUT_FAIL_ON_ERROR:-false}"
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 17b0dc6610..7a99e2e4b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ third-party-dependencies.txt
*.iws
*.tgz
.*.swp
+.factorypath
.vim
.tmp
**/node_modules
diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile
index d0f16d5d0d..ceb94ea8c5 100644
--- a/docker/build/Dockerfile
+++ b/docker/build/Dockerfile
@@ -27,7 +27,7 @@ ENV DEBIAN_FRONTEND noninteractive
#If install slowly, you can replcae alpine's mirror with aliyun's mirror, Example:
#RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories
RUN apk update && \
- apk add dos2unix shadow bash openrc python python3 sudo vim wget iputils net-tools openssh-server py2-pip tini && \
+ apk --update add --no-cache dos2unix shadow bash openrc python2 python3 sudo vim wget iputils net-tools openssh-server py-pip tini && \
apk add --update procps && \
openrc boot && \
pip install kazoo
diff --git a/docker/build/README.md b/docker/build/README.md
index bc516bc214..951f2d6b51 100644
--- a/docker/build/README.md
+++ b/docker/build/README.md
@@ -238,6 +238,10 @@ This environment variable sets max cpu load avg for `worker-server`. The default
This environment variable sets reserved memory for `worker-server`. The default value is `0.1`.
+**`WORKER_WEIGHT`**
+
+This environment variable sets port for `worker-server`. The default value is `100`.
+
**`WORKER_LISTEN_PORT`**
This environment variable sets port for `worker-server`. The default value is `1234`.
diff --git a/docker/build/README_zh_CN.md b/docker/build/README_zh_CN.md
index c2affc0691..c4339a945c 100644
--- a/docker/build/README_zh_CN.md
+++ b/docker/build/README_zh_CN.md
@@ -238,6 +238,10 @@ Dolphin Scheduler映像使用了几个容易遗漏的环境变量。虽然这些
配置`worker-server`的保留内存,默认值 `0.1`。
+**`WORKER_WEIGHT`**
+
+配置`worker-server`的权重,默认之`100`。
+
**`WORKER_LISTEN_PORT`**
配置`worker-server`的端口,默认值 `1234`。
diff --git a/docker/build/conf/dolphinscheduler/worker.properties.tpl b/docker/build/conf/dolphinscheduler/worker.properties.tpl
index d596be94bc..83097dd9a4 100644
--- a/docker/build/conf/dolphinscheduler/worker.properties.tpl
+++ b/docker/build/conf/dolphinscheduler/worker.properties.tpl
@@ -34,4 +34,7 @@ worker.reserved.memory=${WORKER_RESERVED_MEMORY}
#worker.listen.port=${WORKER_LISTEN_PORT}
# default worker group
-#worker.group=${WORKER_GROUP}
\ No newline at end of file
+#worker.groups=${WORKER_GROUP}
+
+# default worker weight
+#worker.weight=${WORKER_WEIGHT}
\ No newline at end of file
diff --git a/docker/build/startup-init-conf.sh b/docker/build/startup-init-conf.sh
index 73fdad6798..d5cd86f1a4 100644
--- a/docker/build/startup-init-conf.sh
+++ b/docker/build/startup-init-conf.sh
@@ -74,6 +74,7 @@ export WORKER_MAX_CPULOAD_AVG=${WORKER_MAX_CPULOAD_AVG:-"100"}
export WORKER_RESERVED_MEMORY=${WORKER_RESERVED_MEMORY:-"0.1"}
export WORKER_LISTEN_PORT=${WORKER_LISTEN_PORT:-"1234"}
export WORKER_GROUP=${WORKER_GROUP:-"default"}
+export WORKER_WEIGHT=${WORKER_WEIGHT:-"100"}
#============================================================================
# Alert Server
diff --git a/docker/docker-swarm/docker-compose.yml b/docker/docker-swarm/docker-compose.yml
index 51eb0aeaa5..349b3ad790 100644
--- a/docker/docker-swarm/docker-compose.yml
+++ b/docker/docker-swarm/docker-compose.yml
@@ -187,6 +187,7 @@ services:
WORKER_MAX_CPULOAD_AVG: "100"
WORKER_RESERVED_MEMORY: "0.1"
WORKER_GROUP: "default"
+ WORKER_WEIGHT: "100"
DOLPHINSCHEDULER_DATA_BASEDIR_PATH: "/tmp/dolphinscheduler"
DATABASE_HOST: dolphinscheduler-postgresql
DATABASE_PORT: 5432
diff --git a/docker/docker-swarm/docker-stack.yml b/docker/docker-swarm/docker-stack.yml
index ca9f7c88c7..dff4a47b2c 100644
--- a/docker/docker-swarm/docker-stack.yml
+++ b/docker/docker-swarm/docker-stack.yml
@@ -187,6 +187,7 @@ services:
WORKER_MAX_CPULOAD_AVG: "100"
WORKER_RESERVED_MEMORY: "0.1"
WORKER_GROUP: "default"
+ WORKER_WEIGHT: "100"
DOLPHINSCHEDULER_DATA_BASEDIR_PATH: "/tmp/dolphinscheduler"
DATABASE_HOST: dolphinscheduler-postgresql
DATABASE_PORT: 5432
diff --git a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-worker.yaml b/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-worker.yaml
index 1e08b67b53..569341c225 100644
--- a/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-worker.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/configmap-dolphinscheduler-worker.yaml
@@ -31,6 +31,7 @@ data:
WORKER_RESERVED_MEMORY: {{ .Values.worker.configmap.WORKER_RESERVED_MEMORY | quote }}
WORKER_LISTEN_PORT: {{ .Values.worker.configmap.WORKER_LISTEN_PORT | quote }}
WORKER_GROUP: {{ .Values.worker.configmap.WORKER_GROUP | quote }}
+ WORKER_WEIGHT: {{ .Values.worker.configmap.WORKER_WEIGHT | quote }}
DOLPHINSCHEDULER_DATA_BASEDIR_PATH: {{ include "dolphinscheduler.worker.base.dir" . | quote }}
dolphinscheduler_env.sh: |-
{{- range .Values.worker.configmap.DOLPHINSCHEDULER_ENV }}
diff --git a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
index 51a83bcfa7..92c2c72398 100644
--- a/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
@@ -162,6 +162,12 @@ spec:
{{- else }}
value: {{ .Values.externalZookeeper.zookeeperQuorum }}
{{- end }}
+ - name: ZOOKEEPER_ROOT
+ {{- if .Values.zookeeper.enabled }}
+ value: "/dolphinscheduler"
+ {{- else }}
+ value: {{ .Values.externalZookeeper.zookeeperRoot }}
+ {{- end }}
- name: RESOURCE_STORAGE_TYPE
valueFrom:
configMapKeyRef:
diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
index 0949127dda..e9dc7919ca 100644
--- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
@@ -228,6 +228,12 @@ spec:
{{- else }}
value: {{ .Values.externalZookeeper.zookeeperQuorum }}
{{- end }}
+ - name: ZOOKEEPER_ROOT
+ {{- if .Values.zookeeper.enabled }}
+ value: "/dolphinscheduler"
+ {{- else }}
+ value: {{ .Values.externalZookeeper.zookeeperRoot }}
+ {{- end }}
- name: RESOURCE_STORAGE_TYPE
valueFrom:
configMapKeyRef:
diff --git a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
index 097f8d8580..ae562cc62b 100644
--- a/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
+++ b/docker/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
@@ -162,6 +162,11 @@ spec:
configMapKeyRef:
name: {{ include "dolphinscheduler.fullname" . }}-worker
key: WORKER_GROUP
+ - name: WORKER_WEUGHT
+ valueFrom:
+ configMapKeyRef:
+ name: {{ include "dolphinscheduler.fullname" . }}-worker
+ key: WORKER_WEIGHT
- name: DOLPHINSCHEDULER_DATA_BASEDIR_PATH
valueFrom:
configMapKeyRef:
@@ -225,6 +230,12 @@ spec:
{{- else }}
value: {{ .Values.externalZookeeper.zookeeperQuorum }}
{{- end }}
+ - name: ZOOKEEPER_ROOT
+ {{- if .Values.zookeeper.enabled }}
+ value: "/dolphinscheduler"
+ {{- else }}
+ value: {{ .Values.externalZookeeper.zookeeperRoot }}
+ {{- end }}
- name: RESOURCE_STORAGE_TYPE
valueFrom:
configMapKeyRef:
diff --git a/docker/kubernetes/dolphinscheduler/values.yaml b/docker/kubernetes/dolphinscheduler/values.yaml
index 8acb1d326a..3261b08401 100644
--- a/docker/kubernetes/dolphinscheduler/values.yaml
+++ b/docker/kubernetes/dolphinscheduler/values.yaml
@@ -201,6 +201,7 @@ worker:
WORKER_RESERVED_MEMORY: "0.1"
WORKER_LISTEN_PORT: "1234"
WORKER_GROUP: "default"
+ WORKER_WEIGHT: "100"
DOLPHINSCHEDULER_DATA_BASEDIR_PATH: "/tmp/dolphinscheduler"
DOLPHINSCHEDULER_ENV:
- "export HADOOP_HOME=/opt/soft/hadoop"
diff --git a/dolphinscheduler-api/pom.xml b/dolphinscheduler-api/pom.xml
index 035551e669..76dd8980b7 100644
--- a/dolphinscheduler-api/pom.xml
+++ b/dolphinscheduler-api/pom.xml
@@ -152,6 +152,10 @@
javax.servlet
servlet-api
+
+ org.apache.curator
+ curator-client
+
@@ -244,4 +248,4 @@
-
\ No newline at end of file
+
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java
index 8731b264e9..2457177cdf 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java
@@ -17,6 +17,12 @@
package org.apache.dolphinscheduler.api.controller;
+import static org.apache.dolphinscheduler.api.enums.Status.CREATE_ACCESS_TOKEN_ERROR;
+import static org.apache.dolphinscheduler.api.enums.Status.DELETE_ACCESS_TOKEN_ERROR;
+import static org.apache.dolphinscheduler.api.enums.Status.GENERATE_TOKEN_ERROR;
+import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_LIST_PAGING_ERROR;
+import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_ACCESS_TOKEN_ERROR;
+
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.AccessTokenService;
@@ -24,20 +30,26 @@ import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.User;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+
+import java.util.Map;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
-
-import java.util.Map;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
-import static org.apache.dolphinscheduler.api.enums.Status.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
/**
* access token controller
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java
index a5b8176a48..7d612b8b1d 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java
@@ -17,25 +17,34 @@
package org.apache.dolphinscheduler.api.controller;
+import static org.apache.dolphinscheduler.api.enums.Status.DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR;
+import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TASK_INSTANCE_LOG_ERROR;
+
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.LoggerService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.dao.entity.User;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
-import static org.apache.dolphinscheduler.api.enums.Status.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import springfox.documentation.annotations.ApiIgnore;
/**
@@ -70,7 +79,7 @@ public class LoggerController extends BaseController {
@GetMapping(value = "/detail")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_INSTANCE_LOG_ERROR)
- public Result queryLog(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
+ public Result queryLog(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "taskInstanceId") int taskInstanceId,
@RequestParam(value = "skipLineNum") int skipNum,
@RequestParam(value = "limit") int limit) {
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
index 6b539d01b1..29f415bac2 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
@@ -95,27 +95,65 @@ public class ProcessDefinitionController extends BaseController {
}
/**
- * copy process definition
+ * copy process definition
*
* @param loginUser login user
* @param projectName project name
- * @param processId process definition id
+ * @param processDefinitionIds process definition ids
+ * @param targetProjectId target project id
* @return copy result code
*/
@ApiOperation(value = "copyProcessDefinition", notes= "COPY_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
- @ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
+ @ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", required = true, dataType = "String", example = "3,4"),
+ @ApiImplicitParam(name = "targetProjectId", value = "TARGET_PROJECT_ID", required = true, type = "Integer")
})
@PostMapping(value = "/copy")
@ResponseStatus(HttpStatus.OK)
- @ApiException(COPY_PROCESS_DEFINITION_ERROR)
+ @ApiException(BATCH_COPY_PROCESS_DEFINITION_ERROR)
public Result copyProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
- @RequestParam(value = "processId", required = true) int processId) throws JsonProcessingException {
- logger.info("copy process definition, login user:{}, project name:{}, process definition id:{}",
- loginUser.getUserName(), projectName, processId);
- Map result = processDefinitionService.copyProcessDefinition(loginUser, projectName, processId);
- return returnDataList(result);
+ @RequestParam(value = "processDefinitionIds", required = true) String processDefinitionIds,
+ @RequestParam(value = "targetProjectId",required = true) int targetProjectId) {
+ logger.info("batch copy process definition, login user:{}, project name:{}, process definition ids:{},target project id:{}",
+ StringUtils.replaceNRTtoUnderline(loginUser.getUserName()),
+ StringUtils.replaceNRTtoUnderline(projectName),
+ StringUtils.replaceNRTtoUnderline(processDefinitionIds),
+ StringUtils.replaceNRTtoUnderline(String.valueOf(targetProjectId)));
+
+ return returnDataList(
+ processDefinitionService.batchCopyProcessDefinition(loginUser,projectName,processDefinitionIds,targetProjectId));
+ }
+
+ /**
+ * move process definition
+ *
+ * @param loginUser login user
+ * @param projectName project name
+ * @param processDefinitionIds process definition ids
+ * @param targetProjectId target project id
+ * @return move result code
+ */
+ @ApiOperation(value = "moveProcessDefinition", notes= "MOVE_PROCESS_DEFINITION_NOTES")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", required = true, dataType = "String", example = "3,4"),
+ @ApiImplicitParam(name = "targetProjectId", value = "TARGET_PROJECT_ID", required = true, type = "Integer")
+ })
+ @PostMapping(value = "/move")
+ @ResponseStatus(HttpStatus.OK)
+ @ApiException(BATCH_MOVE_PROCESS_DEFINITION_ERROR)
+ public Result moveProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
+ @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
+ @RequestParam(value = "processDefinitionIds", required = true) String processDefinitionIds,
+ @RequestParam(value = "targetProjectId",required = true) int targetProjectId) {
+ logger.info("batch move process definition, login user:{}, project name:{}, process definition ids:{},target project id:{}",
+ StringUtils.replaceNRTtoUnderline(loginUser.getUserName()),
+ StringUtils.replaceNRTtoUnderline(projectName),
+ StringUtils.replaceNRTtoUnderline(processDefinitionIds),
+ StringUtils.replaceNRTtoUnderline(String.valueOf(targetProjectId)));
+
+ return returnDataList(
+ processDefinitionService.batchMoveProcessDefinition(loginUser,projectName,processDefinitionIds,targetProjectId));
}
/**
@@ -365,7 +403,7 @@ public class ProcessDefinitionController extends BaseController {
public Result getNodeListByDefinitionIdList(
@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
- @RequestParam("processDefinitionIdList") String processDefinitionIdList) throws Exception {
+ @RequestParam("processDefinitionIdList") String processDefinitionIdList) {
logger.info("query task node name list by definitionId list, login user:{}, project name:{}, id list: {}",
loginUser.getUserName(), projectName, processDefinitionIdList);
@@ -420,7 +458,7 @@ public class ProcessDefinitionController extends BaseController {
logger.info("delete process definition by ids, login user:{}, project name:{}, process definition ids:{}",
loginUser.getUserName(), projectName, processDefinitionIds);
- Map result = new HashMap<>(5);
+ Map result = new HashMap<>();
List deleteFailedIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(processDefinitionIds)) {
String[] processDefinitionIdArray = processDefinitionIds.split(",");
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java
index 7e9473d81c..1f1ec1ed7b 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java
@@ -370,7 +370,7 @@ public class ProcessInstanceController extends BaseController {
logger.info("delete process instance by ids, login user:{}, project name:{}, process instance ids :{}",
loginUser.getUserName(), projectName, processInstanceIds);
// task queue
- Map result = new HashMap<>(5);
+ Map result = new HashMap<>();
List deleteFailedIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(processInstanceIds)) {
String[] processInstanceIdArray = processInstanceIds.split(",");
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
index cc9e0f657f..dac97bca9d 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
@@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
+import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -226,6 +227,25 @@ public class ProjectController extends BaseController {
return returnDataList(result);
}
+ /**
+ * query user created project
+ *
+ * @param loginUser login user
+ * @return projects which the user create
+ */
+ @ApiOperation(value = "queryProjectCreatedByUser", notes = "QUERY_USER_CREATED_PROJECT_NOTES")
+
+ @GetMapping(value = "/login-user-created-project")
+ @ResponseStatus(HttpStatus.OK)
+ @ApiException(QUERY_USER_CREATED_PROJECT_ERROR)
+ public Result queryProjectCreatedByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
+ logger.info("login user {}, query authorized project by user id: {}.",
+ StringUtils.replaceNRTtoUnderline(loginUser.getUserName()),
+ StringUtils.replaceNRTtoUnderline(String.valueOf(loginUser.getId())));
+ Map result = projectService.queryProjectCreatedByUser(loginUser);
+ return returnDataList(result);
+ }
+
/**
* import process definition
*
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java
index 39b9b06337..ab4dce972d 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java
@@ -432,14 +432,34 @@ public class UsersController extends BaseController {
@RequestParam(value = "userPassword") String userPassword,
@RequestParam(value = "repeatPassword") String repeatPassword,
@RequestParam(value = "email") String email) throws Exception {
- userName = userName.replaceAll("[\n|\r|\t]", "");
- userPassword = userPassword.replaceAll("[\n|\r|\t]", "");
- repeatPassword = repeatPassword.replaceAll("[\n|\r|\t]", "");
- email = email.replaceAll("[\n|\r|\t]", "");
+ userName = ParameterUtils.handleEscapes(userName);
+ userPassword = ParameterUtils.handleEscapes(userPassword);
+ repeatPassword = ParameterUtils.handleEscapes(repeatPassword);
+ email = ParameterUtils.handleEscapes(email);
logger.info("user self-register, userName: {}, userPassword {}, repeatPassword {}, eamil {}",
- userName, userPassword, repeatPassword, email);
+ userName, Constants.PASSWORD_DEFAULT, Constants.PASSWORD_DEFAULT, email);
Map result = usersService.registerUser(userName, userPassword, repeatPassword, email);
return returnDataList(result);
}
+ /**
+ * user activate
+ *
+ * @param userName user name
+ */
+ @ApiOperation(value="activateUser",notes = "ACTIVATE_USER_NOTES")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "userName", value = "USER_NAME", type = "String"),
+ })
+ @PostMapping("/activate")
+ @ResponseStatus(HttpStatus.OK)
+ @ApiException(UPDATE_USER_ERROR)
+ public Result