From ab9caec50eca3d51bdeecbd517f84a89a1c0d48c Mon Sep 17 00:00:00 2001 From: zsmdata <3656562@qq.com> Date: Wed, 11 Dec 2019 18:03:02 +0800 Subject: [PATCH 01/33] fix #1441 --- .../main/java/org/apache/dolphinscheduler/common/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index 440446e567..791c0bb558 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -315,7 +315,7 @@ public final class Constants { /** * user name regex */ - public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9_-]{3,20}$"); + public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,20}$"); /** * email regex From b6928fe04529012f750810a6cfc3bb0894ccb168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 18 Mar 2020 15:30:21 +0800 Subject: [PATCH 02/33] support custom datax config --- .../common/task/datax/DataxParameters.java | 40 ++++++++++++--- .../server/worker/task/datax/DataxTask.java | 39 ++++++++++++--- .../worker/task/datax/DataxTaskTest.java | 49 ++++++++++++++----- 3 files changed, 100 insertions(+), 28 deletions(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java index 95dd505c02..505e34b0a1 100755 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java @@ -27,6 +27,16 @@ import org.apache.dolphinscheduler.common.task.AbstractParameters; */ public class DataxParameters extends AbstractParameters { + /** + * if custom json config,eg 0, 1 + */ + private Integer customConfig; + + /** + * if customConfig eq 1 ,then json is usable + */ + private String json; + /** * data source type,eg MYSQL, POSTGRES ... */ @@ -157,16 +167,32 @@ public class DataxParameters extends AbstractParameters { this.jobSpeedRecord = jobSpeedRecord; } + public Integer getCustomConfig() { + return customConfig; + } + + public void setCustomConfig(Integer customConfig) { + this.customConfig = customConfig; + } + + public String getJson() { + return json; + } + + public void setJson(String json) { + this.json = json; + } + @Override public boolean checkParameters() { - if (!(dataSource != 0 - && dataTarget != 0 - && StringUtils.isNotEmpty(sql) - && StringUtils.isNotEmpty(targetTable))) { - return false; + if (customConfig == 0) { + return dataSource != 0 + && dataTarget != 0 + && StringUtils.isNotEmpty(sql) + && StringUtils.isNotEmpty(targetTable); + } else { + return StringUtils.isNotEmpty(json); } - - return true; } @Override diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java index 952030ea62..8083bb6869 100755 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java @@ -192,24 +192,47 @@ public class DataxTask extends AbstractTask { throws Exception { // generate json String fileName = String.format("%s/%s_job.json", taskDir, taskProps.getTaskAppId()); + String json; Path path = new File(fileName).toPath(); if (Files.exists(path)) { return fileName; } - JSONObject job = new JSONObject(); - job.put("content", buildDataxJobContentJson()); - job.put("setting", buildDataxJobSettingJson()); - JSONObject root = new JSONObject(); - root.put("job", job); - root.put("core", buildDataxCoreJson()); - logger.debug("datax job json : {}", root.toString()); + if (dataXParameters.getCustomConfig() == 1){ + + json = dataXParameters.getJson().replaceAll("\\r\\n", "\n"); + + /** + * combining local and global parameters + */ + Map paramsMap = ParamUtils.convert(taskProps.getUserDefParamsMap(), + taskProps.getDefinedParams(), + dataXParameters.getLocalParametersMap(), + taskProps.getCmdTypeIfComplement(), + taskProps.getScheduleTime()); + if (paramsMap != null){ + json = ParameterUtils.convertParameterPlaceholders(json, ParamUtils.convert(paramsMap)); + } + + }else { + + JSONObject job = new JSONObject(); + job.put("content", buildDataxJobContentJson()); + job.put("setting", buildDataxJobSettingJson()); + + JSONObject root = new JSONObject(); + root.put("job", job); + root.put("core", buildDataxCoreJson()); + json = root.toString(); + } + + logger.debug("datax job json : {}", json); // create datax json file - FileUtils.writeStringToFile(new File(fileName), root.toString(), StandardCharsets.UTF_8); + FileUtils.writeStringToFile(new File(fileName), json, StandardCharsets.UTF_8); return fileName; } diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java index bd7f27530a..34a09934f4 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java @@ -44,6 +44,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; +import static org.apache.dolphinscheduler.common.enums.CommandType.START_PROCESS; + /** * DataxTask Tester. */ @@ -59,6 +61,8 @@ public class DataxTaskTest { private ApplicationContext applicationContext; + private TaskProps props = new TaskProps(); + @Before public void before() throws Exception { @@ -70,7 +74,6 @@ public class DataxTaskTest { springApplicationContext.setApplicationContext(applicationContext); Mockito.when(applicationContext.getBean(ProcessService.class)).thenReturn(processService); - TaskProps props = new TaskProps(); props.setTaskDir("/tmp"); props.setTaskAppId(String.valueOf(System.currentTimeMillis())); props.setTaskInstId(1); @@ -78,10 +81,8 @@ public class DataxTaskTest { props.setEnvFile(".dolphinscheduler_env.sh"); props.setTaskStartTime(new Date()); props.setTaskTimeout(0); - props.setTaskParams( - "{\"targetTable\":\"test\",\"postStatements\":[],\"jobSpeedByte\":1024,\"jobSpeedRecord\":1000,\"dtType\":\"MYSQL\",\"datasource\":1,\"dsType\":\"MYSQL\",\"datatarget\":2,\"jobSpeedByte\":0,\"sql\":\"select 1 as test from dual\",\"preStatements\":[\"delete from test\"],\"postStatements\":[\"delete from test\"]}"); - dataxTask = PowerMockito.spy(new DataxTask(props, logger)); - dataxTask.init(); + props.setCmdTypeIfComplement(START_PROCESS); + setTaskParems(0); Mockito.when(processService.findDataSourceById(1)).thenReturn(getDataSource()); Mockito.when(processService.findDataSourceById(2)).thenReturn(getDataSource()); @@ -91,6 +92,22 @@ public class DataxTaskTest { Mockito.when(shellCommandExecutor.run(fileName, processService)).thenReturn(0); } + private void setTaskParems(Integer customConfig) { + if (customConfig == 1) { + props.setTaskParams( + "{\"customConfig\":1, \"localParams\":[{\"prop\":\"test\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"38294729\"}],\"json\":\"{\\\"job\\\":{\\\"setting\\\":{\\\"speed\\\":{\\\"byte\\\":1048576},\\\"errorLimit\\\":{\\\"record\\\":0,\\\"percentage\\\":0.02}},\\\"content\\\":[{\\\"reader\\\":{\\\"name\\\":\\\"rdbmsreader\\\",\\\"parameter\\\":{\\\"username\\\":\\\"xxx\\\",\\\"password\\\":\\\"${test}\\\",\\\"column\\\":[\\\"id\\\",\\\"name\\\"],\\\"splitPk\\\":\\\"pk\\\",\\\"connection\\\":[{\\\"querySql\\\":[\\\"SELECT * from dual\\\"],\\\"jdbcUrl\\\":[\\\"jdbc:dm://ip:port/database\\\"]}],\\\"fetchSize\\\":1024,\\\"where\\\":\\\"1 = 1\\\"}},\\\"writer\\\":{\\\"name\\\":\\\"streamwriter\\\",\\\"parameter\\\":{\\\"print\\\":true}}}]}}\"}"); + +// "{\"customConfig\":1,\"json\":\"{\\\"job\\\":{\\\"setting\\\":{\\\"speed\\\":{\\\"byte\\\":1048576},\\\"errorLimit\\\":{\\\"record\\\":0,\\\"percentage\\\":0.02}},\\\"content\\\":[{\\\"reader\\\":{\\\"name\\\":\\\"rdbmsreader\\\",\\\"parameter\\\":{\\\"username\\\":\\\"xxx\\\",\\\"password\\\":\\\"xxx\\\",\\\"column\\\":[\\\"id\\\",\\\"name\\\"],\\\"splitPk\\\":\\\"pk\\\",\\\"connection\\\":[{\\\"querySql\\\":[\\\"SELECT * from dual\\\"],\\\"jdbcUrl\\\":[\\\"jdbc:dm://ip:port/database\\\"]}],\\\"fetchSize\\\":1024,\\\"where\\\":\\\"1 = 1\\\"}},\\\"writer\\\":{\\\"name\\\":\\\"streamwriter\\\",\\\"parameter\\\":{\\\"print\\\":true}}}]}}\"}"); + } else { + props.setTaskParams( + "{\"customConfig\":0,\"targetTable\":\"test\",\"postStatements\":[],\"jobSpeedByte\":1024,\"jobSpeedRecord\":1000,\"dtType\":\"MYSQL\",\"datasource\":1,\"dsType\":\"MYSQL\",\"datatarget\":2,\"jobSpeedByte\":0,\"sql\":\"select 1 as test from dual\",\"preStatements\":[\"delete from test\"],\"postStatements\":[\"delete from test\"]}"); + + } + + dataxTask = PowerMockito.spy(new DataxTask(props, logger)); + dataxTask.init(); + } + private DataSource getDataSource() { DataSource dataSource = new DataSource(); dataSource.setType(DbType.MYSQL); @@ -102,7 +119,7 @@ public class DataxTaskTest { private ProcessInstance getProcessInstance() { ProcessInstance processInstance = new ProcessInstance(); - processInstance.setCommandType(CommandType.START_PROCESS); + processInstance.setCommandType(START_PROCESS); processInstance.setScheduleTime(new Date()); return processInstance; } @@ -229,18 +246,24 @@ public class DataxTaskTest { */ @Test public void testBuildDataxJsonFile() - throws Exception { + throws Exception { try { - Method method = DataxTask.class.getDeclaredMethod("buildDataxJsonFile"); - method.setAccessible(true); - String filePath = (String) method.invoke(dataxTask, null); - Assert.assertNotNull(filePath); - } - catch (Exception e) { + setTaskParems(1); + buildDataJson(); + setTaskParems(0); + buildDataJson(); + } catch (Exception e) { Assert.fail(e.getMessage()); } } + public void buildDataJson() throws Exception { + Method method = DataxTask.class.getDeclaredMethod("buildDataxJsonFile"); + method.setAccessible(true); + String filePath = (String) method.invoke(dataxTask, null); + Assert.assertNotNull(filePath); + } + /** * Method: buildDataxJobContentJson() */ From 8c4ba3a55753cde0f2cd741c0c6d8222e0c27396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 18 Mar 2020 15:38:45 +0800 Subject: [PATCH 03/33] support datax custom config --- .../common/task/datax/DataxParameters.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java index 505e34b0a1..c11852bd1f 100755 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java @@ -87,6 +87,22 @@ public class DataxParameters extends AbstractParameters { */ private int jobSpeedRecord; + public Integer getCustomConfig() { + return customConfig; + } + + public void setCustomConfig(Integer customConfig) { + this.customConfig = customConfig; + } + + public String getJson() { + return json; + } + + public void setJson(String json) { + this.json = json; + } + public String getDsType() { return dsType; } @@ -167,21 +183,6 @@ public class DataxParameters extends AbstractParameters { this.jobSpeedRecord = jobSpeedRecord; } - public Integer getCustomConfig() { - return customConfig; - } - - public void setCustomConfig(Integer customConfig) { - this.customConfig = customConfig; - } - - public String getJson() { - return json; - } - - public void setJson(String json) { - this.json = json; - } @Override public boolean checkParameters() { @@ -203,7 +204,9 @@ public class DataxParameters extends AbstractParameters { @Override public String toString() { return "DataxParameters{" + - "dsType='" + dsType + '\'' + + "customConfig=" + customConfig + '\'' + + ", json=" + json + '\'' + + ", dsType='" + dsType + '\'' + ", dataSource=" + dataSource + ", dtType='" + dtType + '\'' + ", dataTarget=" + dataTarget + From b32a3f31a112b89babcfc01998e348cdf0945b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 18 Mar 2020 17:10:30 +0800 Subject: [PATCH 04/33] support datax custom config --- .../dolphinscheduler/common/task/datax/DataxParameters.java | 4 ++-- .../server/worker/task/datax/DataxTaskTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java index c11852bd1f..e1fb5a0bac 100755 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java @@ -204,8 +204,8 @@ public class DataxParameters extends AbstractParameters { @Override public String toString() { return "DataxParameters{" + - "customConfig=" + customConfig + '\'' + - ", json=" + json + '\'' + + "customConfig=" + customConfig + + ", json='" + json + '\'' + ", dsType='" + dsType + '\'' + ", dataSource=" + dataSource + ", dtType='" + dtType + '\'' + diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java index 34a09934f4..c2dbd268e6 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java @@ -95,7 +95,7 @@ public class DataxTaskTest { private void setTaskParems(Integer customConfig) { if (customConfig == 1) { props.setTaskParams( - "{\"customConfig\":1, \"localParams\":[{\"prop\":\"test\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"38294729\"}],\"json\":\"{\\\"job\\\":{\\\"setting\\\":{\\\"speed\\\":{\\\"byte\\\":1048576},\\\"errorLimit\\\":{\\\"record\\\":0,\\\"percentage\\\":0.02}},\\\"content\\\":[{\\\"reader\\\":{\\\"name\\\":\\\"rdbmsreader\\\",\\\"parameter\\\":{\\\"username\\\":\\\"xxx\\\",\\\"password\\\":\\\"${test}\\\",\\\"column\\\":[\\\"id\\\",\\\"name\\\"],\\\"splitPk\\\":\\\"pk\\\",\\\"connection\\\":[{\\\"querySql\\\":[\\\"SELECT * from dual\\\"],\\\"jdbcUrl\\\":[\\\"jdbc:dm://ip:port/database\\\"]}],\\\"fetchSize\\\":1024,\\\"where\\\":\\\"1 = 1\\\"}},\\\"writer\\\":{\\\"name\\\":\\\"streamwriter\\\",\\\"parameter\\\":{\\\"print\\\":true}}}]}}\"}"); + "{\"customConfig\":1, \"localParams\":[{\"prop\":\"test\",\"value\":\"38294729\"}],\"json\":\"{\\\"job\\\":{\\\"setting\\\":{\\\"speed\\\":{\\\"byte\\\":1048576},\\\"errorLimit\\\":{\\\"record\\\":0,\\\"percentage\\\":0.02}},\\\"content\\\":[{\\\"reader\\\":{\\\"name\\\":\\\"rdbmsreader\\\",\\\"parameter\\\":{\\\"username\\\":\\\"xxx\\\",\\\"password\\\":\\\"${test}\\\",\\\"column\\\":[\\\"id\\\",\\\"name\\\"],\\\"splitPk\\\":\\\"pk\\\",\\\"connection\\\":[{\\\"querySql\\\":[\\\"SELECT * from dual\\\"],\\\"jdbcUrl\\\":[\\\"jdbc:dm://ip:port/database\\\"]}],\\\"fetchSize\\\":1024,\\\"where\\\":\\\"1 = 1\\\"}},\\\"writer\\\":{\\\"name\\\":\\\"streamwriter\\\",\\\"parameter\\\":{\\\"print\\\":true}}}]}}\"}"); // "{\"customConfig\":1,\"json\":\"{\\\"job\\\":{\\\"setting\\\":{\\\"speed\\\":{\\\"byte\\\":1048576},\\\"errorLimit\\\":{\\\"record\\\":0,\\\"percentage\\\":0.02}},\\\"content\\\":[{\\\"reader\\\":{\\\"name\\\":\\\"rdbmsreader\\\",\\\"parameter\\\":{\\\"username\\\":\\\"xxx\\\",\\\"password\\\":\\\"xxx\\\",\\\"column\\\":[\\\"id\\\",\\\"name\\\"],\\\"splitPk\\\":\\\"pk\\\",\\\"connection\\\":[{\\\"querySql\\\":[\\\"SELECT * from dual\\\"],\\\"jdbcUrl\\\":[\\\"jdbc:dm://ip:port/database\\\"]}],\\\"fetchSize\\\":1024,\\\"where\\\":\\\"1 = 1\\\"}},\\\"writer\\\":{\\\"name\\\":\\\"streamwriter\\\",\\\"parameter\\\":{\\\"print\\\":true}}}]}}\"}"); } else { From 74708b3b84f494facfb989ccf40ff20eb4cf94da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 18 Mar 2020 17:59:10 +0800 Subject: [PATCH 05/33] support datax custom config --- .../org/apache/dolphinscheduler/api/utils/CheckUtilsTest.java | 1 + .../dolphinscheduler/common/task/datax/DataxParameters.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/CheckUtilsTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/CheckUtilsTest.java index 24a0ed31d6..308ed8e9b6 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/CheckUtilsTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/utils/CheckUtilsTest.java @@ -211,6 +211,7 @@ public class CheckUtilsTest { // DataxParameters DataxParameters dataxParameters = new DataxParameters(); assertFalse(CheckUtils.checkTaskNodeParameters(JSONUtils.toJsonString(dataxParameters), TaskType.DATAX.toString())); + dataxParameters.setCustomConfig(0); dataxParameters.setDataSource(111); dataxParameters.setDataTarget(333); dataxParameters.setSql("sql"); diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java index e1fb5a0bac..f153360d63 100755 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/datax/DataxParameters.java @@ -186,6 +186,7 @@ public class DataxParameters extends AbstractParameters { @Override public boolean checkParameters() { + if (customConfig == null) return false; if (customConfig == 0) { return dataSource != 0 && dataTarget != 0 @@ -204,7 +205,7 @@ public class DataxParameters extends AbstractParameters { @Override public String toString() { return "DataxParameters{" + - "customConfig=" + customConfig + + "customConfig=" + customConfig + ", json='" + json + '\'' + ", dsType='" + dsType + '\'' + ", dataSource=" + dataSource + From 8ed2646e65b0a72f27d61efa5202c22ac6aa2801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 22 Apr 2020 14:10:34 +0800 Subject: [PATCH 06/33] fix #2450 --- .../apache/dolphinscheduler/api/service/ExecutorService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java index d290886572..51f5420ac5 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ExecutorService.java @@ -499,7 +499,7 @@ public class ExecutorService extends BaseService{ // determine whether to complement if(commandType == CommandType.COMPLEMENT_DATA){ runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode; - if(null != start && null != end && start.before(end)){ + if(null != start && null != end && !start.after(end)){ if(runMode == RunMode.RUN_MODE_SERIAL){ cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(start)); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(end)); From 798b133ec11b80585d0859c7f2dbf20e0373d74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 29 Apr 2020 14:48:38 +0800 Subject: [PATCH 07/33] fix #2481 --- .../src/main/resources/config/install_config.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dolphinscheduler-server/src/main/resources/config/install_config.conf b/dolphinscheduler-server/src/main/resources/config/install_config.conf index cba117e048..fab6b32d51 100644 --- a/dolphinscheduler-server/src/main/resources/config/install_config.conf +++ b/dolphinscheduler-server/src/main/resources/config/install_config.conf @@ -27,6 +27,9 @@ dbhost="192.168.xx.xx:3306" # db username username="xx" +# database name +dbname="dolphinscheduler" + # db passwprd # NOTICE: if there are special characters, please use the \ to escape, for example, `[` escape to `\[` password="xx" From 9d22d8beacb919c04ee2bc8f69a5035d3ae22e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Wed, 29 Apr 2020 14:50:20 +0800 Subject: [PATCH 08/33] fix #2481 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index a1323952a7..7fad7fa77a 100644 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ if [ $dbtype == "postgresql" ];then datasourceDriverClassname="org.postgresql.Driver" fi sed -i ${txt} "s#spring.datasource.driver-class-name.*#spring.datasource.driver-class-name=${datasourceDriverClassname}#g" conf/datasource.properties -sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:${dbtype}://${dbhost}/dolphinscheduler?characterEncoding=UTF-8#g" conf/datasource.properties +sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:${dbtype}://${dbhost}/${dbname}?characterEncoding=UTF-8&allowMultiQueries=true#g" conf/datasource.properties sed -i ${txt} "s#spring.datasource.username.*#spring.datasource.username=${username}#g" conf/datasource.properties sed -i ${txt} "s#spring.datasource.password.*#spring.datasource.password=${password}#g" conf/datasource.properties From 519e8c22efb1f88ec054a23ed1fda5b07dade10e Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Wed, 29 Apr 2020 23:59:30 +0800 Subject: [PATCH 09/33] Add eslint to check frontend codes style, closes #1463 --- .github/workflows/ci_frontend.yml | 1 + dolphinscheduler-ui/.eslintrc | 6 - dolphinscheduler-ui/.eslintrc.yml | 17 + dolphinscheduler-ui/package.json | 8 + dolphinscheduler-ui/src/js/conf/home/index.js | 10 +- .../js/conf/home/pages/dag/_source/config.js | 62 ++-- .../src/js/conf/home/pages/dag/_source/dag.js | 303 ++++++++------- .../formModel/tasks/_source/commcon.js | 14 +- .../pages/dag/_source/jumpAffirm/index.js | 6 +- .../pages/dag/_source/plugIn/downChart.js | 22 +- .../home/pages/dag/_source/plugIn/dragZoom.js | 3 +- .../pages/dag/_source/plugIn/jsPlumbHandle.js | 156 ++++---- .../home/pages/dag/_source/plugIn/util.js | 32 +- .../pages/servers/_source/gaugeOption.js | 26 +- .../_source/instanceConditions/common.js | 2 +- .../definition/pages/list/_source/util.js | 8 +- .../definition/pages/tree/_source/tree.js | 23 +- .../definition/pages/tree/_source/util.js | 6 +- .../pages/index/_source/chartConfig.js | 9 +- .../instance/pages/gantt/_source/gantt.js | 33 +- .../pages/file/pages/_source/common.js | 2 +- .../pages/file/pages/details/_source/utils.js | 1 - .../src/js/conf/home/router/index.js | 16 +- .../src/js/conf/home/store/dag/actions.js | 74 ++-- .../src/js/conf/home/store/dag/mutations.js | 36 +- .../src/js/conf/home/store/dag/state.js | 4 +- .../js/conf/home/store/datasource/actions.js | 18 +- .../src/js/conf/home/store/monitor/actions.js | 8 +- .../js/conf/home/store/projects/actions.js | 18 +- .../js/conf/home/store/resource/actions.js | 30 +- .../js/conf/home/store/security/actions.js | 76 ++-- .../src/js/conf/home/store/security/state.js | 2 +- .../src/js/conf/home/store/user/actions.js | 14 +- .../src/js/conf/login/index.js | 4 +- .../src/js/module/ana-charts/common.js | 4 +- .../src/js/module/ana-charts/index.js | 2 +- .../module/ana-charts/packages/bar/index.js | 6 +- .../ana-charts/packages/funnel/index.js | 4 +- .../module/ana-charts/packages/line/index.js | 4 +- .../module/ana-charts/packages/pie/index.js | 10 +- .../module/ana-charts/packages/radar/index.js | 2 +- .../ana-charts/packages/scatter/index.js | 2 +- .../src/js/module/axios/querystring.js | 64 ++-- .../crontab/source/_source/i18n/index.js | 1 - .../source/_source/i18n/locale/en_US.js | 86 ++--- .../source/_source/i18n/locale/zh_CN.js | 86 ++--- .../components/crontab/source/util/index.js | 26 +- .../components/secondaryMenu/_source/menu.js | 4 +- .../src/js/module/download/index.js | 8 +- .../src/js/module/i18n/locale/en_US.js | 348 +++++++++--------- .../src/js/module/i18n/locale/zh_CN.js | 348 +++++++++--------- dolphinscheduler-ui/src/js/module/io/index.js | 11 +- .../src/js/module/mixin/disabledState.js | 3 +- .../src/js/module/mixin/listUrlParamHandle.js | 6 +- .../src/js/module/permissions/index.js | 4 +- .../src/js/module/util/index.js | 4 +- .../src/js/module/util/routerUtil.js | 3 - .../src/js/module/util/util.js | 9 +- .../src/lib/external/config.js | 2 +- dolphinscheduler-ui/src/lib/external/email.js | 2 +- 60 files changed, 1042 insertions(+), 1057 deletions(-) delete mode 100644 dolphinscheduler-ui/.eslintrc create mode 100644 dolphinscheduler-ui/.eslintrc.yml diff --git a/.github/workflows/ci_frontend.yml b/.github/workflows/ci_frontend.yml index 494d12dbae..45dcbf1e35 100644 --- a/.github/workflows/ci_frontend.yml +++ b/.github/workflows/ci_frontend.yml @@ -48,6 +48,7 @@ jobs: - name: Compile run: | cd dolphinscheduler-ui + npm run lint npm install node-sass --unsafe-perm npm install npm run build diff --git a/dolphinscheduler-ui/.eslintrc b/dolphinscheduler-ui/.eslintrc deleted file mode 100644 index e1d1a03e1c..0000000000 --- a/dolphinscheduler-ui/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -globals: - $: true - expect: true -rules: - "no-new": "off" - "no-labels": [2, {"allowLoop": true}] diff --git a/dolphinscheduler-ui/.eslintrc.yml b/dolphinscheduler-ui/.eslintrc.yml new file mode 100644 index 0000000000..5251c5af7c --- /dev/null +++ b/dolphinscheduler-ui/.eslintrc.yml @@ -0,0 +1,17 @@ +env: + browser: true + es6: true + jquery: true +extends: + - 'plugin:vue/essential' + - standard +globals: + Atomics: readonly + SharedArrayBuffer: readonly + PUBLIC_PATH: readonly +parserOptions: + ecmaVersion: 2018 + sourceType: module +plugins: + - vue +rules: {} diff --git a/dolphinscheduler-ui/package.json b/dolphinscheduler-ui/package.json index b23969803b..c74a0c109f 100644 --- a/dolphinscheduler-ui/package.json +++ b/dolphinscheduler-ui/package.json @@ -8,6 +8,7 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.dev.js", "clean": "rimraf dist", "start": "npm run dev", + "lint": "eslint ./src --fix", "build:release": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/dolphinscheduler/ui webpack --config ./build/webpack.config.release.js" }, "dependencies": { @@ -50,6 +51,13 @@ "css-loader": "^0.28.8", "cssnano": "4.1.10", "env-parse": "^1.0.5", + "eslint": "^6.8.0", + "eslint-config-standard": "^14.1.1", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-standard": "^4.0.1", + "eslint-plugin-vue": "^6.2.2", "file-loader": "^5.0.2", "globby": "^8.0.1", "html-loader": "^0.5.5", diff --git a/dolphinscheduler-ui/src/js/conf/home/index.js b/dolphinscheduler-ui/src/js/conf/home/index.js index 1913088eca..3c518d8952 100644 --- a/dolphinscheduler-ui/src/js/conf/home/index.js +++ b/dolphinscheduler-ui/src/js/conf/home/index.js @@ -31,15 +31,15 @@ import Permissions from '@/module/permissions' import 'ans-ui/lib/ans-ui.min.css' import ans from 'ans-ui/lib/ans-ui.min' import en_US from 'ans-ui/lib/locale/en' // eslint-disable-line -import'normalize.css/normalize.css' +import 'normalize.css/normalize.css' import 'sass/conf/home/index.scss' -import'bootstrap/dist/css/bootstrap.min.css' +import 'bootstrap/dist/css/bootstrap.min.css' -import'bootstrap/dist/js/bootstrap.min.js' +import 'bootstrap/dist/js/bootstrap.min.js' import 'canvg/dist/browser/canvg.min.js' // Component internationalization -let useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: en_US } : {} +const useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: en_US } : {} // Vue.use(ans) Vue.use(ans, useOpt) @@ -74,7 +74,7 @@ Permissions.request().then(res => { methods: { initApp () { $('.global-loading').hide() - let bootstrapTooltip = $.fn.tooltip.noConflict() + const bootstrapTooltip = $.fn.tooltip.noConflict() $.fn.tooltip = bootstrapTooltip $('body').tooltip({ selector: '[data-toggle="tooltip"]', diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js index db8acf3073..56d0168893 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js @@ -16,7 +16,6 @@ */ import i18n from '@/module/i18n' -import Permissions from '@/module/permissions' /** * Operation bar config @@ -26,7 +25,7 @@ import Permissions from '@/module/permissions' * @desc tooltip */ const toolOper = (dagThis) => { - let disabled =!!dagThis.$store.state.dag.isDetails// Permissions.getAuth() === false ? false : !dagThis.$store.state.dag.isDetails + const disabled = !!dagThis.$store.state.dag.isDetails// Permissions.getAuth() === false ? false : !dagThis.$store.state.dag.isDetails return [ { code: 'pointer', @@ -67,7 +66,7 @@ const toolOper = (dagThis) => { * @desc tooltip * @code Backend definition identifier */ -let publishStatus = [ +const publishStatus = [ { id: 0, desc: `${i18n.$t('Unpublished')}`, @@ -90,7 +89,7 @@ let publishStatus = [ * @desc tooltip * @code identifier */ -let runningType = [ +const runningType = [ { desc: `${i18n.$t('Start Process')}`, code: 'START_PROCESS' @@ -146,85 +145,85 @@ let runningType = [ * @icoUnicode iconfont * @isSpin is loading (Need to execute the code block to write if judgment) */ -let tasksState = { - 'SUBMITTED_SUCCESS': { +const tasksState = { + SUBMITTED_SUCCESS: { id: 0, desc: `${i18n.$t('Submitted successfully')}`, color: '#A9A9A9', icoUnicode: 'ans-icon-dot-circle', isSpin: false }, - 'RUNNING_EXEUTION': { + RUNNING_EXEUTION: { id: 1, desc: `${i18n.$t('Executing')}`, color: '#0097e0', icoUnicode: 'ans-icon-gear', isSpin: true }, - 'READY_PAUSE': { + READY_PAUSE: { id: 2, desc: `${i18n.$t('Ready to pause')}`, color: '#07b1a3', icoUnicode: 'ans-icon-pause-solid', isSpin: false }, - 'PAUSE': { + PAUSE: { id: 3, desc: `${i18n.$t('Pause')}`, color: '#057c72', icoUnicode: 'ans-icon-pause', isSpin: false }, - 'READY_STOP': { + READY_STOP: { id: 4, desc: `${i18n.$t('Ready to stop')}`, color: '#FE0402', icoUnicode: 'ans-icon-coin', isSpin: false }, - 'STOP': { + STOP: { id: 5, desc: `${i18n.$t('Stop')}`, color: '#e90101', icoUnicode: 'ans-icon-stop', isSpin: false }, - 'FAILURE': { + FAILURE: { id: 6, desc: `${i18n.$t('failed')}`, color: '#000000', icoUnicode: 'ans-icon-fail-empty', isSpin: false }, - 'SUCCESS': { + SUCCESS: { id: 7, desc: `${i18n.$t('success')}`, color: '#33cc00', icoUnicode: 'ans-icon-success-empty', isSpin: false }, - 'NEED_FAULT_TOLERANCE': { + NEED_FAULT_TOLERANCE: { id: 8, desc: `${i18n.$t('Need fault tolerance')}`, color: '#FF8C00', icoUnicode: 'ans-icon-pen', isSpin: false }, - 'KILL': { + KILL: { id: 9, desc: `${i18n.$t('kill')}`, color: '#a70202', icoUnicode: 'ans-icon-minus-circle-empty', isSpin: false }, - 'WAITTING_THREAD': { + WAITTING_THREAD: { id: 10, desc: `${i18n.$t('Waiting for thread')}`, color: '#912eed', icoUnicode: 'ans-icon-sand-clock', isSpin: false }, - 'WAITTING_DEPEND': { + WAITTING_DEPEND: { id: 11, desc: `${i18n.$t('Waiting for dependence')}`, color: '#5101be', @@ -239,62 +238,61 @@ let tasksState = { * @desc tooltip * @color color (tree and gantt) */ -let tasksType = { - 'SHELL': { +const tasksType = { + SHELL: { desc: 'SHELL', color: '#646464' }, - 'SUB_PROCESS': { + SUB_PROCESS: { desc: 'SUB_PROCESS', color: '#0097e0' }, - 'PROCEDURE': { + PROCEDURE: { desc: 'PROCEDURE', color: '#525CCD' }, - 'SQL': { + SQL: { desc: 'SQL', color: '#7A98A1' }, - 'SPARK': { + SPARK: { desc: 'SPARK', color: '#E46F13' }, - 'FLINK': { + FLINK: { desc: 'FLINK', color: '#E46F13' }, - 'MR': { + MR: { desc: 'MapReduce', color: '#A0A5CC' }, - 'PYTHON': { + PYTHON: { desc: 'PYTHON', color: '#FED52D' }, - 'DEPENDENT': { + DEPENDENT: { desc: 'DEPENDENT', color: '#2FBFD8' }, - 'HTTP': { + HTTP: { desc: 'HTTP', color: '#E46F13' }, - 'DATAX': { + DATAX: { desc: 'DataX', color: '#1fc747' }, - 'SQOOP': { + SQOOP: { desc: 'SQOOP', color: '#E46F13' }, - 'CONDITIONS': { + CONDITIONS: { desc: 'CONDITIONS', color: '#E46F13' } } - export { toolOper, publishStatus, diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js index 240f3246aa..3f47076ce3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js @@ -24,7 +24,7 @@ import store from '@/conf/home/store' /** * Prototype method */ -let Dag = function () { +const Dag = function () { this.dag = {} this.instance = {} } @@ -49,7 +49,7 @@ Dag.prototype.setConfig = function (o) { * create dag */ Dag.prototype.create = function () { - let self = this + const self = this jsPlumb.ready(() => { JSP.init({ dag: this.dag, @@ -98,36 +98,35 @@ Dag.prototype.toolbarEvent = function ({ item, code, is }) { * Echo data display */ Dag.prototype.backfill = function (arg) { - if(arg) { + if (arg) { let locationsValue = store.state.dag.locations - let locationsValue1 = store.state.dag.locations - let locationsValue2 = store.state.dag.locations - let arr = [] - for (let i in locationsValue1) { - let objs = new Object(); + const locationsValue1 = store.state.dag.locations + const locationsValue2 = store.state.dag.locations + const arr = [] + for (const i in locationsValue1) { + const objs = {} objs.id = i - arr.push(Object.assign(objs,locationsValue1[i])); //Attributes + arr.push(Object.assign(objs, locationsValue1[i])) // Attributes } - let tmp = [] - for(let i in locationsValue2) { - if(locationsValue2[i].targetarr !='' && locationsValue2[i].targetarr.split(',').length>1) { + const tmp = [] + for (const i in locationsValue2) { + if (locationsValue2[i].targetarr !== '' && locationsValue2[i].targetarr.split(',').length > 1) { tmp.push(locationsValue2[i]) } } - function copy (array) { - let newArray = [] - for(let item of array) { - newArray.push(item); + const copy = function (array) { + const newArray = [] + for (const item of array) { + newArray.push(item) } - return newArray; + return newArray } - - let newArr = copy(arr) - function getNewArr() { - for(let i= 0; i1) { + const newArr = copy(arr) + const getNewArr = function () { + for (let i = 0; i < newArr.length; i++) { + if (newArr[i].targetarr !== '' && newArr[i].targetarr.split(',').length > 1) { newArr[i].targetarr = newArr[i].targetarr.split(',').shift() } } @@ -141,154 +140,154 @@ Dag.prototype.backfill = function (arg) { * @param {String} idStr id key name * @param {String} childrenStr children key name */ - function fommat({arrayList, pidStr = 'targetarr', idStr = 'id', childrenStr = 'children'}) { - let listOjb = {}; // Used to store objects of the form {key: obj} - let treeList = []; // An array to store the final tree structure data - // Transform the data into {key: obj} format, which is convenient for the following data processing - for (let i = 0; i < arrayList.length; i++) { - listOjb[arrayList[i][idStr]] = arrayList[i] - } - // Format data based on pid - for (let j = 0; j < arrayList.length; j++) { - // Determine if the parent exists - // let haveParent = arrayList[j].targetarr.split(',').length>1?listOjb[arrayList[j].targetarr.split(',')[0]]:listOjb[arrayList[j][pidStr]] - let haveParent = listOjb[arrayList[j][pidStr]] - if (haveParent) { - // If there is no parent children field, create a children field - !haveParent[childrenStr] && (haveParent[childrenStr] = []) - // Insert child in parent - haveParent[childrenStr].push(arrayList[j]) - } else { - // If there is no parent, insert directly into the outermost layer - treeList.push(arrayList[j]) - } - } - return treeList + const fommat = function ({ arrayList, pidStr = 'targetarr', idStr = 'id', childrenStr = 'children' }) { + const listOjb = {} // Used to store objects of the form {key: obj} + const treeList = [] // An array to store the final tree structure data + // Transform the data into {key: obj} format, which is convenient for the following data processing + for (let i = 0; i < arrayList.length; i++) { + listOjb[arrayList[i][idStr]] = arrayList[i] } - let datas = fommat({arrayList: newArr,pidStr: 'targetarr'}) - // Count the number of leaf nodes - function getLeafCountTree(json) { - if(!json.children) { - json.colspan = 1; - return 1; + // Format data based on pid + for (let j = 0; j < arrayList.length; j++) { + // Determine if the parent exists + // let haveParent = arrayList[j].targetarr.split(',').length>1?listOjb[arrayList[j].targetarr.split(',')[0]]:listOjb[arrayList[j][pidStr]] + const haveParent = listOjb[arrayList[j][pidStr]] + if (haveParent) { + // If there is no parent children field, create a children field + !haveParent[childrenStr] && (haveParent[childrenStr] = []) + // Insert child in parent + haveParent[childrenStr].push(arrayList[j]) } else { - let leafCount = 0; - for(let i = 0 ; i < json.children.length ; i++){ - leafCount = leafCount + getLeafCountTree(json.children[i]); - } - json.colspan = leafCount; - return leafCount; + // If there is no parent, insert directly into the outermost layer + treeList.push(arrayList[j]) } } - // Number of tree node levels - let countTree = getLeafCountTree(datas[0]) - function getMaxFloor(treeData) { - let max = 0 - function each (data, floor) { - data.forEach(e => { - e.floor = floor - e.x=floor*170 - if (floor > max) { - max = floor - } - if (e.children) { - each(e.children, floor + 1) - } - }) - } - each(treeData,1) - return max + return treeList + } + const datas = fommat({ arrayList: newArr, pidStr: 'targetarr' }) + // Count the number of leaf nodes + const getLeafCountTree = function (json) { + if (!json.children) { + json.colspan = 1 + return 1 + } else { + let leafCount = 0 + for (let i = 0; i < json.children.length; i++) { + leafCount = leafCount + getLeafCountTree(json.children[i]) } - getMaxFloor(datas) - // The last child of each node - let lastchildren = []; - forxh(datas); - function forxh(list) { - for (let i = 0; i < list.length; i++) { - let chlist = list[i]; - if (chlist.children) { - forxh(chlist.children); - } else { - lastchildren.push(chlist); - } + json.colspan = leafCount + return leafCount + } + } + // Number of tree node levels + const countTree = getLeafCountTree(datas[0]) + const getMaxFloor = function (treeData) { + let max = 0 + function each (data, floor) { + data.forEach(e => { + e.floor = floor + e.x = floor * 170 + if (floor > max) { + max = floor } - } - // Get all parent nodes above the leaf node - function treeFindPath (tree, func, path,n) { - if (!tree) return [] - for (const data of tree) { - path.push(data.name) - if (func(data)) return path - if (data.children) { - const findChildren = treeFindPath(data.children, func, path,n) - if (findChildren.length) return findChildren - } - path.pop() + if (e.children) { + each(e.children, floor + 1) } - return [] - } - function toLine(data){ - return data.reduce((arrData, {id, name, targetarr, x, y, children = []}) => - arrData.concat([{id, name, targetarr, x, y}], toLine(children)), []) + }) + } + each(treeData, 1) + return max + } + getMaxFloor(datas) + // The last child of each node + let lastchildren = [] + const forxh = function (list) { + for (let i = 0; i < list.length; i++) { + const chlist = list[i] + if (chlist.children) { + forxh(chlist.children) + } else { + lastchildren.push(chlist) } - let listarr = toLine(datas); - let listarrs = toLine(datas) - let dataObject = {} - for(let i = 0; i + arrData.concat([{ id, name, targetarr, x, y }], toLine(children)), []) + } + const listarr = toLine(datas) + const listarrs = toLine(datas) + const dataObject = {} + for (let i = 0; i < listarrs.length; i++) { + delete (listarrs[i].id) + } - for(let a = 0; a value2) { - return 1; - } else { - return 0; - } - }; + if (value1 < value2) { + return -1 + } else if (value1 > value2) { + return 1 + } else { + return 0 } + } + } - lastchildren = lastchildren.sort(createComparisonFunction('x')) + lastchildren = lastchildren.sort(createComparisonFunction('x')) - // Coordinate value of each leaf node - for(let a = 0; a data.targetarr===lastchildren[i].targetarr,[],i+1) - for(let j = 0; j data.targetarr === lastchildren[i].targetarr, [], i + 1) + for (let j = 0; j < node.length; j++) { + for (let k = 0; k < listarrs.length; k++) { + if (node[j] === listarrs[k].name) { + listarrs[k].y = (i + 1) * 120 } } - for(let a = 0; a1) { - dataObject[Object.keys(locationsValue1)[0]].y = (countTree/2)*120+50 + } + } + for (let i = 0; i < tmp.length; i++) { + for (const objs in dataObject) { + if (tmp[i].name === dataObject[objs].name) { + dataObject[objs].targetarr = tmp[i].targetarr } + } + } + for (let a = 0; a < lastchildren.length; a++) { + dataObject[lastchildren[a].id].y = (a + 1) * 120 + } + if (countTree > 1) { + dataObject[Object.keys(locationsValue1)[0]].y = (countTree / 2) * 120 + 50 + } locationsValue = dataObject - let self = this + const self = this jsPlumb.ready(() => { JSP.init({ dag: this.dag, @@ -310,7 +309,7 @@ Dag.prototype.backfill = function (arg) { }) }) } else { - let self = this + const self = this jsPlumb.ready(() => { JSP.init({ dag: this.dag, diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js index cdf632f13d..37d471cccb 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js @@ -43,7 +43,7 @@ const cycleList = [ * cycle value */ const dateValueList = { - 'hour': [ + hour: [ { value: 'last1Hour', label: `${i18n.$t('Last1Hour')}` @@ -57,7 +57,7 @@ const dateValueList = { label: `${i18n.$t('Last3Hours')}` } ], - 'day': [ + day: [ { value: 'today', label: `${i18n.$t('today')}` @@ -79,7 +79,7 @@ const dateValueList = { label: `${i18n.$t('Last7Days')}` } ], - 'week': [ + week: [ { value: 'thisWeek', label: `${i18n.$t('ThisWeek')}` @@ -117,7 +117,7 @@ const dateValueList = { label: `${i18n.$t('LastSunday')}` } ], - 'month': [ + month: [ { value: 'thisMonth', label: `${i18n.$t('ThisMonth')}` @@ -221,15 +221,15 @@ const sqlTypeList = [ const positionList = [ { id: 'PARAMETER', - code: "Parameter" + code: 'Parameter' }, { id: 'BODY', - code: "Body" + code: 'Body' }, { id: 'HEADERS', - code: "Headers" + code: 'Headers' } ] const nodeStatusList = [ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js index 88a258c6fe..360a0fb356 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js @@ -21,7 +21,7 @@ import store from '@/conf/home/store' import router from '@/conf/home/router' import { uuid, findComponentDownward } from '@/module/util/' -let Affirm = {} +const Affirm = {} let $root = {} let $routerType = '' let $isPop = true @@ -59,7 +59,7 @@ Affirm.paramVerification = (name) => { if (!$isPop) { return true } - let dagStore = store.state.dag + const dagStore = store.state.dag let flag = false if ($routerType === 'definition-create') { // No nodes jump out directly @@ -100,7 +100,7 @@ Affirm.isPop = (fn) => { Vue.$modal.destroy() }) }, - close () { + close () { fn() Vue.$modal.destroy() } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js index 3dd13895b0..1c851a175f 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js @@ -21,7 +21,7 @@ import { tasksAll } from './util' import html2canvas from 'html2canvas' import { findComponentDownward } from '@/module/util/' -let DownChart = function () { +const DownChart = function () { this.dag = {} } @@ -31,10 +31,10 @@ let DownChart = function () { DownChart.prototype.maxVal = function () { return new Promise((resolve, reject) => { // All nodes - let tasksAllList = tasksAll() - let dom = $('.dag-container') - let y = parseInt(_.maxBy(tasksAllList, 'y').y + 60) - let x = parseInt(_.maxBy(tasksAllList, 'x').x + 100) + const tasksAllList = tasksAll() + const dom = $('.dag-container') + const y = parseInt(_.maxBy(tasksAllList, 'y').y + 60) + const x = parseInt(_.maxBy(tasksAllList, 'x').x + 100) resolve({ width: (x > 600 ? x : dom.width()) + 100, @@ -60,9 +60,9 @@ DownChart.prototype.download = function ({ dagThis }) { // svg handle const nodesToRecover = [] const nodesToRemove = [] - let parentNode = node.parentNode - let svg = node.outerHTML.trim() - let canvas = document.createElement('canvas') + const parentNode = node.parentNode + const svg = node.outerHTML.trim() + const canvas = document.createElement('canvas') canvg(canvas, svg) if (node.style.position) { canvas.style.position += node.style.position @@ -102,10 +102,10 @@ DownChart.prototype.download = function ({ dagThis }) { heigth: height, useCORS: true // Enable cross-domain configuration }).then((canvas) => { - let name = `${this.dag.name}.png` - let url = canvas.toDataURL('image/png', 1) + const name = `${this.dag.name}.png` + const url = canvas.toDataURL('image/png', 1) setTimeout(() => { - let triggerDownload = $('').attr('href', url).attr('download', name).appendTo('body') + const triggerDownload = $('').attr('href', url).attr('download', name).appendTo('body') triggerDownload[0].click() triggerDownload.remove() }, 100) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js index b084e2e9c8..2027f8e1ea 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js @@ -23,7 +23,7 @@ const DragZoom = function () { } DragZoom.prototype.init = function () { - let $canvas = $('#canvas') + const $canvas = $('#canvas') this.element = d3.select('#canvas') this.zoom = d3.behavior.zoom() .scaleExtent([0.5, 2]) @@ -35,5 +35,4 @@ DragZoom.prototype.init = function () { this.element.call(this.zoom).on('dblclick.zoom', null) } - export default new DragZoom() 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 c77127d49a..b0bc0fe7c1 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 @@ -24,7 +24,6 @@ import { jsPlumb } from 'jsplumb' import DragZoom from './dragZoom' import store from '@/conf/home/store' import router from '@/conf/home/router' -import Permissions from '@/module/permissions' import { uuid, findComponentDownward } from '@/module/util/' import { @@ -32,10 +31,11 @@ import { rtTasksTpl, setSvgColor, saveTargetarr, - rtTargetarrArr } from './util' + rtTargetarrArr +} from './util' import mStart from '@/conf/home/pages/projects/pages/definition/pages/list/_source/start' -let JSP = function () { +const JSP = function () { this.dag = {} this.selectedElement = {} @@ -75,7 +75,7 @@ JSP.prototype.init = function ({ dag, instance, options }) { this.setConfig({ isDrag: !store.state.dag.isDetails, isAttachment: false, - isNewNodes: !store.state.dag.isDetails,//Permissions.getAuth() === false ? false : !store.state.dag.isDetails, + isNewNodes: !store.state.dag.isDetails, // Permissions.getAuth() === false ? false : !store.state.dag.isDetails, isDblclick: true, isContextmenu: true, isClick: false @@ -105,7 +105,7 @@ JSP.prototype.setConfig = function (o) { * Node binding event */ JSP.prototype.tasksEvent = function (selfId) { - let tasks = $(`#${selfId}`) + const tasks = $(`#${selfId}`) // Bind right event tasks.on('contextmenu', e => { this.tasksContextmenu(e) @@ -129,7 +129,7 @@ JSP.prototype.tasksEvent = function (selfId) { JSP.prototype.draggable = function () { if (this.config.isNewNodes) { let selfId - let self = this + const self = this $('.toolbar-btn .roundedRect').draggable({ scope: 'plant', helper: 'clone', @@ -146,7 +146,7 @@ JSP.prototype.draggable = function () { drop: function (ev, ui) { let id = 'tasks-' + Math.ceil(Math.random() * 100000) // eslint-disable-line // Get mouse coordinates - let left = parseInt(ui.offset.left - $(this).offset().left) + const left = parseInt(ui.offset.left - $(this).offset().left) let top = parseInt(ui.offset.top - $(this).offset().top) - 10 if (top < 25) { top = 25 @@ -162,7 +162,7 @@ JSP.prototype.draggable = function () { })) // Get the generated node - let thisDom = jsPlumb.getSelector('.statemachine-demo .w') + const thisDom = jsPlumb.getSelector('.statemachine-demo .w') // Generating a connection node self.JspInstance.batch(() => { @@ -193,13 +193,13 @@ JSP.prototype.jsonHandle = function ({ largeJson, locations }) { $('#canvas').append(rtTasksTpl({ id: v.id, name: v.name, - x: locations[v.id]['x'], - y: locations[v.id]['y'], - targetarr: locations[v.id]['targetarr'], + x: locations[v.id].x, + y: locations[v.id].y, + targetarr: locations[v.id].targetarr, isAttachment: this.config.isAttachment, taskType: v.type, runFlag: v.runFlag, - nodenumber: locations[v.id]['nodenumber'], + nodenumber: locations[v.id].nodenumber })) // contextmenu event @@ -263,29 +263,29 @@ JSP.prototype.initNode = function (el) { */ JSP.prototype.tasksContextmenu = function (event) { if (this.config.isContextmenu) { - let routerName = router.history.current.name + const routerName = router.history.current.name // state - let isOne = routerName === 'projects-definition-details' && this.dag.releaseState !== 'NOT_RELEASE' + const isOne = routerName === 'projects-definition-details' && this.dag.releaseState !== 'NOT_RELEASE' // hide - let isTwo = store.state.dag.isDetails + const isTwo = store.state.dag.isDetails - let html = [ + const html = [ `${i18n.$t('Start')}`, `${i18n.$t('Edit')}`, `${i18n.$t('Copy')}`, `${i18n.$t('Delete')}` ] - let operationHtml = () => { + const operationHtml = () => { return html.splice(',') } - let e = event - let $id = e.currentTarget.id - let $contextmenu = $('#contextmenu') - let $name = $(`#${$id}`).find('.name-p').text() - let $left = e.pageX + document.body.scrollLeft - 5 - let $top = e.pageY + document.body.scrollTop - 5 + const e = event + const $id = e.currentTarget.id + const $contextmenu = $('#contextmenu') + const $name = $(`#${$id}`).find('.name-p').text() + const $left = e.pageX + document.body.scrollLeft - 5 + const $top = e.pageY + document.body.scrollTop - 5 $contextmenu.css({ left: $left, top: $top, @@ -297,10 +297,10 @@ JSP.prototype.tasksContextmenu = function (event) { if (isOne) { // start run $('#startRunning').on('click', () => { - let name = store.state.dag.name - let id = router.history.current.params.id + const name = store.state.dag.name + const id = router.history.current.params.id store.dispatch('dag/getStartCheck', { processDefinitionId: id }).then(res => { - let modal = Vue.$modal.dialog({ + const modal = Vue.$modal.dialog({ closable: false, showMask: true, escClose: true, @@ -332,9 +332,9 @@ JSP.prototype.tasksContextmenu = function (event) { }) }) } - if (!isTwo) { + if (!isTwo) { // edit node - $(`#editNodes`).click(ev => { + $('#editNodes').click(ev => { findComponentDownward(this.dag.$root, 'dag-chart')._createNodes({ id: $id, type: $(`#${$id}`).attr('data-tasks-type') @@ -359,7 +359,7 @@ JSP.prototype.tasksContextmenu = function (event) { JSP.prototype.tasksDblclick = function (e) { // Untie event if (this.config.isDblclick) { - let id = $(e.currentTarget.offsetParent).attr('id') + const id = $(e.currentTarget.offsetParent).attr('id') findComponentDownward(this.dag.$root, 'dag-chart')._createNodes({ id: id, @@ -373,10 +373,10 @@ JSP.prototype.tasksDblclick = function (e) { */ JSP.prototype.tasksClick = function (e) { let $id - let self = this - let $body = $(`body`) + const self = this + const $body = $('body') if (this.config.isClick) { - let $connect = this.selectedElement.connect + const $connect = this.selectedElement.connect $('.w').removeClass('jtk-tasks-active') $(e.currentTarget).addClass('jtk-tasks-active') if ($connect) { @@ -406,7 +406,7 @@ JSP.prototype.tasksClick = function (e) { * paste */ JSP.prototype.removePaste = function () { - let $body = $(`body`) + const $body = $('body') // Unbind copy and paste events $body.unbind('copy').unbind('paste') // Remove selected node parameters @@ -421,7 +421,7 @@ JSP.prototype.removePaste = function () { JSP.prototype.connectClick = function (e) { // Set svg color setSvgColor(e, '#0097e0') - let $id = this.selectedElement.id + const $id = this.selectedElement.id if ($id) { $(`#${$id}`).removeClass('jtk-tasks-active') this.selectedElement.id = null @@ -434,24 +434,10 @@ JSP.prototype.connectClick = function (e) { * @param {Pointer} */ JSP.prototype.handleEventPointer = function (is) { - let wDom = $('.w') this.setConfig({ isClick: is, isAttachment: false }) - // wDom.removeClass('jtk-ep') - // if (!is) { - // wDom.removeClass('jtk-tasks-active') - // this.selectedElement = {} - // _.map($('#canvas svg'), v => { - // if ($(v).attr('class')) { - // _.map($(v).find('path'), v1 => { - // $(v1).attr('fill', '#555') - // $(v1).attr('stroke', '#555') - // }) - // } - // }) - // } } /** @@ -459,7 +445,7 @@ JSP.prototype.handleEventPointer = function (is) { * @param {Line} */ JSP.prototype.handleEventLine = function (is) { - let wDom = $('.w') + const wDom = $('.w') this.setConfig({ isAttachment: is }) @@ -471,8 +457,8 @@ JSP.prototype.handleEventLine = function (is) { * @param {Remove} */ JSP.prototype.handleEventRemove = function () { - let $id = this.selectedElement.id || null - let $connect = this.selectedElement.connect || null + const $id = this.selectedElement.id || null + const $connect = this.selectedElement.connect || null if ($id) { this.removeNodes(this.selectedElement.id) } else { @@ -489,9 +475,9 @@ JSP.prototype.handleEventRemove = function () { JSP.prototype.removeNodes = function ($id) { // Delete node processing(data-targetarr) _.map(tasksAll(), v => { - let targetarr = v.targetarr.split(',') + const targetarr = v.targetarr.split(',') if (targetarr.length) { - let newArr = _.filter(targetarr, v1 => v1 !== $id) + const newArr = _.filter(targetarr, v1 => v1 !== $id) $(`#${v.id}`).attr('data-targetarr', newArr.toString()) } }) @@ -502,7 +488,7 @@ JSP.prototype.removeNodes = function ($id) { $(`#${$id}`).remove() // callback onRemoveNodes event - this.options&&this.options.onRemoveNodes&&this.options.onRemoveNodes($id) + this.options && this.options.onRemoveNodes && this.options.onRemoveNodes($id) } /** @@ -513,15 +499,15 @@ JSP.prototype.removeConnect = function ($connect) { return } // Remove connections and remove node and node dependencies - let targetId = $connect.targetId - let sourceId = $connect.sourceId + const targetId = $connect.targetId + const sourceId = $connect.sourceId let targetarr = rtTargetarrArr(targetId) if (targetarr.length) { targetarr = _.filter(targetarr, v => v !== sourceId) $(`#${targetId}`).attr('data-targetarr', targetarr.toString()) } - if ($(`#${sourceId}`).attr('data-tasks-type')=='CONDITIONS') { - $(`#${sourceId}`).attr('data-nodenumber',Number($(`#${sourceId}`).attr('data-nodenumber'))-1) + if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS') { + $(`#${sourceId}`).attr('data-nodenumber', Number($(`#${sourceId}`).attr('data-nodenumber')) - 1) } this.JspInstance.deleteConnection($connect) @@ -533,24 +519,24 @@ JSP.prototype.removeConnect = function ($connect) { */ JSP.prototype.copyNodes = function ($id) { let newNodeInfo = _.cloneDeep(_.find(store.state.dag.tasks, v => v.id === $id)) - let newNodePors = store.state.dag.locations[$id] + const newNodePors = store.state.dag.locations[$id] // Unstored nodes do not allow replication if (!newNodePors) { return } // Generate random id - let newUuId = `${uuid() + uuid()}` - let id = newNodeInfo.id.length > 8 ? newNodeInfo.id.substr(0, 7) : newNodeInfo.id - let name = newNodeInfo.name.length > 8 ? newNodeInfo.name.substr(0, 7) : newNodeInfo.name + const newUuId = `${uuid() + uuid()}` + const id = newNodeInfo.id.length > 8 ? newNodeInfo.id.substr(0, 7) : newNodeInfo.id + const name = newNodeInfo.name.length > 8 ? newNodeInfo.name.substr(0, 7) : newNodeInfo.name // new id - let newId = `${id || ''}-${newUuId}` + const newId = `${id || ''}-${newUuId}` // new name - let newName = `${name || ''}-${newUuId}` + const newName = `${name || ''}-${newUuId}` // coordinate x - let newX = newNodePors.x + 100 + const newX = newNodePors.x + 100 // coordinate y - let newY = newNodePors.y + 40 + const newY = newNodePors.y + 40 // Generate template node $('#canvas').append(rtTasksTpl({ @@ -563,7 +549,7 @@ JSP.prototype.copyNodes = function ($id) { })) // Get the generated node - let thisDom = jsPlumb.getSelector('.statemachine-demo .w') + const thisDom = jsPlumb.getSelector('.statemachine-demo .w') // Copy node information newNodeInfo = Object.assign(newNodeInfo, { @@ -604,7 +590,7 @@ JSP.prototype.handleEventScreen = function ({ item, is }) { item.icon = 'ans-icon-max' screenOpen = false } - let $mainLayoutModel = $('.main-layout-model') + const $mainLayoutModel = $('.main-layout-model') if (screenOpen) { $mainLayoutModel.addClass('dag-screen') } else { @@ -619,21 +605,21 @@ JSP.prototype.handleEventScreen = function ({ item, is }) { */ JSP.prototype.saveStore = function () { return new Promise((resolve, reject) => { - let connects = [] - let locations = {} - let tasks = [] + const connects = [] + const locations = {} + const tasks = [] - let is = (id) => { + const is = (id) => { return !!_.filter(tasksAll(), v => v.id === id).length } // task _.map(_.cloneDeep(store.state.dag.tasks), v => { if (is(v.id)) { - let preTasks = [] - let id = $(`#${v.id}`) - let tar = id.attr('data-targetarr') - let idDep = tar ? id.attr('data-targetarr').split(',') : [] + const preTasks = [] + const id = $(`#${v.id}`) + const tar = id.attr('data-targetarr') + const idDep = tar ? id.attr('data-targetarr').split(',') : [] if (idDep.length) { _.map(idDep, v1 => { preTasks.push($(`#${v1}`).find('.name-p').text()) @@ -655,12 +641,11 @@ JSP.prototype.saveStore = function () { _.map(this.JspInstance.getConnections(), v => { connects.push({ - 'endPointSourceId': v.sourceId, - 'endPointTargetId': v.targetId + endPointSourceId: v.sourceId, + endPointTargetId: v.targetId }) }) - _.map(tasksAll(), v => { locations[v.id] = { name: v.name, @@ -671,7 +656,6 @@ JSP.prototype.saveStore = function () { } }) - // Storage node store.commit('dag/setTasks', tasks) // Store coordinate information @@ -692,14 +676,14 @@ JSP.prototype.saveStore = function () { JSP.prototype.handleEvent = function () { this.JspInstance.bind('beforeDrop', function (info) { - let sourceId = info['sourceId']// 出 - let targetId = info['targetId']// 入 + const sourceId = info.sourceId// 出 + const targetId = info.targetId// 入 /** * Recursive search for nodes */ let recursiveVal const recursiveTargetarr = (arr, targetId) => { - for (let i in arr) { + for (const i in arr) { if (arr[i] === targetId) { recursiveVal = targetId } else { @@ -719,10 +703,10 @@ JSP.prototype.handleEvent = function () { return false } - if ($(`#${sourceId}`).attr('data-tasks-type')=='CONDITIONS' && $(`#${sourceId}`).attr('data-nodenumber')==2) { + if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS' && $(`#${sourceId}`).attr('data-nodenumber') === 2) { return false } else { - $(`#${sourceId}`).attr('data-nodenumber',Number($(`#${sourceId}`).attr('data-nodenumber'))+1) + $(`#${sourceId}`).attr('data-nodenumber', Number($(`#${sourceId}`).attr('data-nodenumber')) + 1) } // Storage node dependency information @@ -744,7 +728,7 @@ JSP.prototype.jspBackfill = function ({ connects, locations, largeJson }) { locations: locations }) - let wNodes = jsPlumb.getSelector('.statemachine-demo .w') + const wNodes = jsPlumb.getSelector('.statemachine-demo .w') // Backfill line this.JspInstance.batch(() => { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js index 17e7faf477..e44363911b 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js @@ -23,7 +23,7 @@ import store from '@/conf/home/store' * Node, to array */ const rtTargetarrArr = (id) => { - let ids = $(`#${id}`).attr('data-targetarr') + const ids = $(`#${id}`).attr('data-targetarr') return ids ? ids.split(',') : [] } @@ -31,8 +31,8 @@ const rtTargetarrArr = (id) => { * Store node id to targetarr */ const saveTargetarr = (valId, domId) => { - let $target = $(`#${domId}`) - let targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}` + const $target = $(`#${domId}`) + const targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}` $target.attr('data-targetarr', targetStr) } @@ -44,20 +44,20 @@ const rtBantpl = () => { * return node html */ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType, runFlag, nodenumber }) => { - let tpl = `` + let tpl = '' tpl += `
` - tpl += `
` - tpl += `
` + tpl += '
' + tpl += '
' tpl += `
` tpl += `${name}` - tpl += `
` - tpl += `
` - tpl += `
` + tpl += '
' + tpl += '
' + tpl += '
' if (runFlag === 'FORBIDDEN') { tpl += rtBantpl() } - tpl += `
` - tpl += `
` + tpl += '
' + tpl += '' return tpl } @@ -66,9 +66,9 @@ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType, runFlag * Get all tasks nodes */ const tasksAll = () => { - let a = [] + const a = [] $('#canvas .w').each(function (idx, elem) { - let e = $(elem) + const e = $(elem) a.push({ id: e.attr('id'), name: e.find('.name-p').text(), @@ -117,10 +117,10 @@ const setSvgColor = (e, color) => { * Get all node ids */ const allNodesId = () => { - let idArr = [] + const idArr = [] $('.w').each((i, o) => { - let $obj = $(o) - let $span = $obj.find('.name-p').text() + const $obj = $(o) + const $span = $obj.find('.name-p').text() if ($span) { idArr.push({ id: $obj.attr('id'), diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js b/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js index 6d64db5e02..a61f80f530 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js @@ -30,21 +30,21 @@ export default function (value) { color: [ [ 0.5, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line offset: 1, - color: '#1CAD52'// 50% Color in place + color: '#1CAD52'// 50% Color in place }, { offset: 0.8, - color: '#1CAD52'// 40% Color in place - }], false) ], // 100% Color in place + color: '#1CAD52'// 40% Color in place + }], false)], // 100% Color in place [ 0.7, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line offset: 1, - color: '#FFC539'// 70% Color in place + color: '#FFC539'// 70% Color in place }, { offset: 0.8, - color: '#FEEC49'// 66% Color in place + color: '#FEEC49'// 66% Color in place }, { offset: 0, - color: '#C7DD6B'// 50% Color in place - }], false) ], + color: '#C7DD6B'// 50% Color in place + }], false)], [ 0.9, new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ // eslint-disable-line offset: 1, color: '#E75F25' // 90% Color in place @@ -54,14 +54,14 @@ export default function (value) { }, { offset: 0, color: '#FFC539' // 70% Color in place - }], false) ], + }], false)], [1, new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { // eslint-disable-line offset: 0.2, color: '#E75F25' // 92% Color in place }, { offset: 0, color: '#D9452C' // 90% Color in place - }], false) ] + }], false)] ], width: 10 } @@ -92,10 +92,10 @@ export default function (value) { show: true, lineStyle: { // Property linestyle controls line style color: [ // Dial Color - [ 0.5, '#20AE51' ], // 0-50%Color in place - [ 0.7, '#FFED44' ], // 51%-70%Color in place - [ 0.9, '#FF9618' ], // 70%-90%Color in place - [ 1, '#DA462C']// 90%-100%Color in place + [0.5, '#20AE51'], // 0-50%Color in place + [0.7, '#FFED44'], // 51%-70%Color in place + [0.9, '#FF9618'], // 70%-90%Color in place + [1, '#DA462C']// 90%-100%Color in place ], width: 30// Dial width } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js index 091b8178f9..254098a65b 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js @@ -20,7 +20,7 @@ import i18n from '@/module/i18n' /** * State code table */ -let stateType = [ +const stateType = [ { code: '', label: `${i18n.$t('none')}` diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js index 2259dea9cd..308af45a48 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js @@ -17,7 +17,7 @@ import i18n from '@/module/i18n' -let warningTypeList = [ +const warningTypeList = [ { id: 'NONE', code: `${i18n.$t('none_1')}` @@ -42,9 +42,9 @@ const isEmial = (val) => { } const fuzzyQuery = (list, keyWord) => { - let len = list.length - let arr = [] - let reg = new RegExp(keyWord) + const len = list.length + const arr = [] + const reg = new RegExp(keyWord) for (let i = 0; i < len; i++) { if (list[i].match(reg)) { arr.push(list[i]) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js index 5ff02e869f..af2d26831b 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js @@ -21,7 +21,7 @@ import { tasksType, tasksState } from '@/conf/home/pages/dag/_source/config' let self = this -let Tree = function () { +const Tree = function () { self = this this.selfTree = {} this.tree = function () {} @@ -57,7 +57,7 @@ Tree.prototype.init = function ({ data, limit, selfTree }) { this.duration = 400 this.i = 0 this.tree = d3.layout.tree().nodeSize([0, 46]) - let tasks = this.tree.nodes(data) + const tasks = this.tree.nodes(data) this.diagonal = d3.svg .diagonal() @@ -142,9 +142,9 @@ Tree.prototype.treeToggles = function (clicked_d) { // eslint-disable-line */ Tree.prototype.treeUpdate = function (source) { return new Promise((resolve, reject) => { - let tasks = this.tree.nodes(this.root) - let height = Math.max(500, tasks.length * this.config.barHeight + this.config.margin.top + this.config.margin.bottom) - let width = (this.config.nodesMax * 70) + (this.squareNum * (this.config.squareSize + this.config.squarePading)) + this.config.margin.left + this.config.margin.right + 50 + const tasks = this.tree.nodes(this.root) + const height = Math.max(500, tasks.length * this.config.barHeight + this.config.margin.top + this.config.margin.bottom) + const width = (this.config.nodesMax * 70) + (this.squareNum * (this.config.squareSize + this.config.squarePading)) + this.config.margin.left + this.config.margin.right + 50 d3.select('svg') .transition() @@ -156,12 +156,12 @@ Tree.prototype.treeUpdate = function (source) { n.x = i * this.config.barHeight }) - let task = this.svg.selectAll('g.node') + const task = this.svg.selectAll('g.node') .data(tasks, (d) => { return d.id || (d.id = ++this.i) }) - let nodeEnter = task.enter() + const nodeEnter = task.enter() .append('g') .attr('class', this.nodesClass) .attr('transform', () => 'translate(' + source.y0 + ',' + source.x0 + ')') @@ -201,7 +201,7 @@ Tree.prototype.treeUpdate = function (source) { } }) .attr('class', 'state') - .style('fill', d => d.state && tasksState[d.state].color || '#ffffff') + .style('fill', d => (d.state && tasksState[d.state].color) || '#ffffff') .attr('data-toggle', 'tooltip') .attr('rx', d => d.type ? 0 : 12) .attr('ry', d => d.type ? 0 : 12) @@ -231,7 +231,6 @@ Tree.prototype.treeUpdate = function (source) { .attr('transform', d => 'translate(' + d.y + ',' + d.x + ')') .style('opacity', 1) - // Convert the exit node to the new location of the parent node。 task.exit().transition() .duration(this.duration) @@ -240,14 +239,14 @@ Tree.prototype.treeUpdate = function (source) { .remove() // Update link - let link = this.svg.selectAll('path.link') + const link = this.svg.selectAll('path.link') .data(this.tree.links(tasks), d => d.target.id) // Enter any new links in the previous location of the parent node。 link.enter().insert('path', 'g') .attr('class', 'link') .attr('d', (d) => { - let o = { x: source.x0, y: source.y0 } + const o = { x: source.x0, y: source.y0 } return this.diagonal({ source: o, target: o }) }) .transition() @@ -263,7 +262,7 @@ Tree.prototype.treeUpdate = function (source) { link.exit().transition() .duration(this.duration) .attr('d', (d) => { - let o = { x: source.x, y: source.y } + const o = { x: source.x, y: source.y } return this.diagonal({ source: o, target: o }) }) .remove() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js index eb37e82a6c..2df1783593 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js @@ -22,7 +22,7 @@ import { tasksState } from '@/conf/home/pages/dag/_source/config' * Node prompt dom */ const rtInstancesTooltip = (data) => { - let str = `
` + let str = '
' str += `id : ${data.id}
` str += `host : ${data.host}
` str += `name : ${data.name}
` @@ -33,7 +33,7 @@ const rtInstancesTooltip = (data) => { str += `startTime : ${data.startTime ? formatDate(data.startTime) : '-'}
` str += `endTime : ${data.endTime ? formatDate(data.endTime) : '-'}
` str += `duration : ${data.duration}
` - str += `
` + str += '
' return str } @@ -42,7 +42,7 @@ const rtInstancesTooltip = (data) => { * Easy to calculate the width dynamically */ const rtCountMethod = list => { - let arr = [] + const arr = [] function count (list, t) { let toggle = false list.forEach(v => { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js index b8601a69c9..9fb18eaa91 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js @@ -18,7 +18,7 @@ import _ from 'lodash' import { tasksState } from '@/conf/home/pages/dag/_source/config' -let pie = { +const pie = { series: [ { type: 'pie', @@ -37,7 +37,7 @@ let pie = { ] } -let bar = { +const bar = { title: { text: '' }, @@ -56,7 +56,7 @@ let bar = { }, tooltip: { formatter (v) { - let val = v[0].name.split(',') + const val = v[0].name.split(',') return `${val[0]} (${v[0].value})` } }, @@ -66,7 +66,7 @@ let bar = { }] } -let simple = { +const simple = { xAxis: { splitLine: { show: false @@ -93,7 +93,6 @@ let simple = { }, color: ['#D5050B', '#0398E1'] - } export { pie, bar, simple } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js index e808c94627..5a4366b06f 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js @@ -19,13 +19,13 @@ import * as d3 from 'd3' import { formatDate } from '@/module/filter/filter' import { tasksState } from '@/conf/home/pages/dag/_source/config' -let Gantt = function () { +const Gantt = function () { this.el = '' this.tasks = [] this.width = null this.height = null this.taskNames = [] - this.tickFormat = `%H:%M:%S` + this.tickFormat = '%H:%M:%S' this.margin = { top: 10, right: 40, @@ -41,20 +41,20 @@ Gantt.prototype.init = function ({ el, tasks }) { this.tasks = tasks this.taskNames = _.map(_.cloneDeep(tasks), v => v.taskName) this.taskNames = this.taskNames.reduce(function (prev, cur) { - prev.indexOf(cur) === -1 && prev.push(cur); - return prev; - },[]) + prev.indexOf(cur) === -1 && prev.push(cur) + return prev + }, []) this.height = parseInt(this.taskNames.length * 30) this.width = $(this.el).width() - this.margin.right - this.margin.left - 5 this.x = d3.time.scale() - .domain([ this.startTimeXAxis, this.endTimeXAxis ]) - .range([ 0, this.width ]) + .domain([this.startTimeXAxis, this.endTimeXAxis]) + .range([0, this.width]) .clamp(true) this.y = d3.scale.ordinal() .domain(this.taskNames) - .rangeRoundBands([ 0, this.height - this.margin.top - this.margin.bottom ], 0.1) + .rangeRoundBands([0, this.height - this.margin.top - this.margin.bottom], 0.1) this.xAxis = d3.svg.axis() .scale(this.x) @@ -97,13 +97,13 @@ Gantt.prototype.compXAxisTimes = function () { */ Gantt.prototype.initializeXAxis = function () { this.x = d3.time.scale() - .domain([ this.startTimeXAxis, this.endTimeXAxis ]) - .range([ 0, this.width ]) + .domain([this.startTimeXAxis, this.endTimeXAxis]) + .range([0, this.width]) .clamp(true) this.y = d3.scale.ordinal() .domain(this.taskNames) - .rangeRoundBands([ 0, this.height - this.margin.top - this.margin.bottom ], 0.1) + .rangeRoundBands([0, this.height - this.margin.top - this.margin.bottom], 0.1) this.xAxis = d3.svg.axis() .scale(this.x) @@ -151,9 +151,9 @@ Gantt.prototype.drawChart = function () { .attr('transform', 'translate(0, ' + (this.height - this.margin.top - this.margin.bottom) + ')') .transition() .call(this.xAxis) - .selectAll("text") - .attr("transform", `rotate(-${this.width / ($('.tick').length - 1) > 50 ? 0 : Math.acos(this.width / ($('.tick').length - 1) / 50) * 57 })`) - .style("text-anchor", `${this.width / ($('.tick').length - 1) > 50 ? 'middle' : 'end'}`) + .selectAll('text') + .attr('transform', `rotate(-${this.width / ($('.tick').length - 1) > 50 ? 0 : Math.acos(this.width / ($('.tick').length - 1) / 50) * 57})`) + .style('text-anchor', `${this.width / ($('.tick').length - 1) > 50 ? 'middle' : 'end'}`) svg.append('g') .attr('class', 'y axis') @@ -169,15 +169,14 @@ Gantt.prototype.drawChart = function () { * Tip prompt */ Gantt.prototype.tip = function (d) { - let str = `
` + let str = '
' str += `taskName : ${d.taskName}
` str += `status : ${tasksState[d.status].desc} (${d.status})
` str += `startTime : ${formatDate(d.isoStart)}
` str += `endTime : ${formatDate(d.isoEnd)}
` str += `duration : ${d.duration}
` - str += `
` + str += '
' return str } - export default new Gantt() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js index 8e534f9237..595217397e 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js @@ -18,6 +18,6 @@ /** * Create file type */ -let filtTypeArr = ['txt', 'log', 'sh', 'conf', 'cfg', 'py', 'java', 'sql', 'xml', 'hql', 'properties'] +const filtTypeArr = ['txt', 'log', 'sh', 'conf', 'cfg', 'py', 'java', 'sql', 'xml', 'hql', 'properties'] export { filtTypeArr } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js index bf20a8c5ff..283931edc3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js @@ -32,7 +32,6 @@ const handlerSuffix = { '.properties': 'textile' } - export { handlerSuffix } diff --git a/dolphinscheduler-ui/src/js/conf/home/router/index.js b/dolphinscheduler-ui/src/js/conf/home/router/index.js index 93815e72ea..91e015b2fa 100644 --- a/dolphinscheduler-ui/src/js/conf/home/router/index.js +++ b/dolphinscheduler-ui/src/js/conf/home/router/index.js @@ -426,7 +426,7 @@ const router = new Router({ name: 'monitor', component: resolve => require(['../pages/monitor/index'], resolve), meta: { - title: `monitor` + title: 'monitor' }, redirect: { name: 'servers-master' @@ -453,7 +453,7 @@ const router = new Router({ name: 'servers-alert', component: resolve => require(['../pages/monitor/pages/servers/alert'], resolve), meta: { - title: `Alert` + title: 'Alert' } }, { @@ -461,7 +461,7 @@ const router = new Router({ name: 'servers-rpcserver', component: resolve => require(['../pages/monitor/pages/servers/rpcserver'], resolve), meta: { - title: `Rpcserver` + title: 'Rpcserver' } }, { @@ -469,7 +469,7 @@ const router = new Router({ name: 'servers-zookeeper', component: resolve => require(['../pages/monitor/pages/servers/zookeeper'], resolve), meta: { - title: `Zookeeper` + title: 'Zookeeper' } }, { @@ -477,7 +477,7 @@ const router = new Router({ name: 'servers-apiserver', component: resolve => require(['../pages/monitor/pages/servers/apiserver'], resolve), meta: { - title: `Apiserver` + title: 'Apiserver' } }, { @@ -485,7 +485,7 @@ const router = new Router({ name: 'servers-db', component: resolve => require(['../pages/monitor/pages/servers/db'], resolve), meta: { - title: `DB` + title: 'DB' } }, { @@ -493,7 +493,7 @@ const router = new Router({ name: 'statistics', component: resolve => require(['../pages/monitor/pages/servers/statistics'], resolve), meta: { - title: `statistics` + title: 'statistics' } } ] @@ -502,7 +502,7 @@ const router = new Router({ }) router.beforeEach((to, from, next) => { - let $body = $('body') + const $body = $('body') $body.find('.tooltip.fade.top.in').remove() if (to.meta.title) { document.title = `${to.meta.title} - DolphinScheduler` 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 f282c8e30a..a403e36b9d 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js @@ -28,7 +28,7 @@ export default { io.get(`projects/${state.projectName}/instance/task-list-by-process-id`, { processInstanceId: payload }, res => { - let arr = _.map(res.data.taskList, v => { + const arr = _.map(res.data.taskList, v => { return _.cloneDeep(_.assign(tasksState[v.state], { name: v.name, stateId: v.id, @@ -108,7 +108,7 @@ export default { // locations state.locations = JSON.parse(res.data.locations) // Process definition - let processDefinitionJson = JSON.parse(res.data.processDefinitionJson) + const processDefinitionJson = JSON.parse(res.data.processDefinitionJson) // tasks info state.tasks = processDefinitionJson.tasks // tasks cache @@ -129,7 +129,7 @@ export default { }) }, -/** + /** * Get process definition DAG diagram details */ copyProcess ({ state }, payload) { @@ -161,7 +161,7 @@ export default { // locations state.locations = JSON.parse(res.data.locations) // process instance - let processInstanceJson = JSON.parse(res.data.processInstanceJson) + const processInstanceJson = JSON.parse(res.data.processInstanceJson) // tasks info state.tasks = processInstanceJson.tasks // tasks cache @@ -176,7 +176,7 @@ export default { state.tenantId = processInstanceJson.tenantId - //startup parameters + // startup parameters state.startup = _.assign(state.startup, _.pick(res.data, ['commandType', 'failureStrategy', 'processInstancePriority', 'workerGroup', 'warningType', 'warningGroupId', 'receivers', 'receiversCc'])) state.startup.commandParam = JSON.parse(res.data.commandParam) @@ -191,7 +191,7 @@ export default { */ saveDAGchart ({ state }, payload) { return new Promise((resolve, reject) => { - let data = { + const data = { globalParams: state.globalParams, tasks: state.tasks, tenantId: state.tenantId, @@ -215,7 +215,7 @@ export default { */ updateDefinition ({ state }, payload) { return new Promise((resolve, reject) => { - let data = { + const data = { globalParams: state.globalParams, tasks: state.tasks, tenantId: state.tenantId, @@ -240,7 +240,7 @@ export default { */ updateInstance ({ state }, payload) { return new Promise((resolve, reject) => { - let data = { + const data = { globalParams: state.globalParams, tasks: state.tasks, tenantId: state.tenantId, @@ -294,16 +294,16 @@ export default { getProjectList ({ state }, payload) { return new Promise((resolve, reject) => { if (state.projectListS.length) { - resolve() - return - } - io.get(`projects/query-project-list`, payload, res => { - state.projectListS = res.data - resolve(res.data) - }).catch(res => { - reject(res) + resolve() + return + } + io.get('projects/query-project-list', payload, res => { + state.projectListS = res.data + resolve(res.data) + }).catch(res => { + reject(res) + }) }) - }) }, /** * Get a list of process definitions by project id @@ -312,17 +312,17 @@ export default { return new Promise((resolve, reject) => { io.get(`projects/${state.projectName}/process/queryProcessDefinitionAllByProjectId`, payload, res => { resolve(res.data) - }).catch(res => { - reject(res) + }).catch(res => { + reject(res) + }) }) - }) }, /** * get datasource */ getDatasourceList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`datasources/list`, { + io.get('datasources/list', { type: payload }, res => { resolve(res) @@ -340,7 +340,7 @@ export default { resolve() return } - io.get(`resources/list`, { + io.get('resources/list', { type: 'FILE' }, res => { state.resourcesListS = res.data @@ -359,7 +359,7 @@ export default { resolve() return } - io.get(`resources/list/jar`, { + io.get('resources/list/jar', { type: 'FILE' }, res => { state.resourcesListJar = res.data @@ -387,7 +387,7 @@ export default { */ getNotifyGroupList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`alert-group/list`, res => { + io.get('alert-group/list', res => { state.notifyGroupListS = _.map(res.data, v => { return { id: v.id, @@ -469,7 +469,7 @@ export default { return new Promise((resolve, reject) => { io.post(`projects/${state.projectName}/schedule/preview`, payload, res => { resolve(res.data) - //alert(res.data) + // alert(res.data) }).catch(e => { reject(e) }) @@ -579,11 +579,11 @@ export default { if (!data) { return } - let blob = new Blob([data]) - let fileName = `${fileNameS}.json` + const blob = new Blob([data]) + const fileName = `${fileNameS}.json` if ('download' in document.createElement('a')) { // 不是IE浏览器 - let url = window.URL.createObjectURL(blob) - let link = document.createElement('a') + const url = window.URL.createObjectURL(blob) + const link = document.createElement('a') link.style.display = 'none' link.href = url link.setAttribute('download', fileName) @@ -596,9 +596,9 @@ export default { } } - io.get(`projects/${state.projectName}/process/export`,{processDefinitionId: payload.processDefinitionId,}, res => { + io.get(`projects/${state.projectName}/process/export`, { processDefinitionId: payload.processDefinitionId }, res => { downloadBlob(res, payload.processDefinitionName) - }, e => { + }, e => { }, { responseType: 'blob' @@ -621,7 +621,7 @@ export default { */ getUdfList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/udf-func/list`, payload, res => { + io.get('resources/udf-func/list', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -645,7 +645,7 @@ export default { */ getTaskRecordList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/task-record/list-paging`, payload, res => { + io.get('projects/task-record/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -657,7 +657,7 @@ export default { */ getHistoryTaskRecordList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/task-record/history-list-paging`, payload, res => { + io.get('projects/task-record/history-list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -724,7 +724,7 @@ export default { /** * remove timing */ - deleteTiming({ state }, payload){ + deleteTiming ({ state }, payload) { return new Promise((resolve, reject) => { io.get(`projects/${state.projectName}/schedule/delete`, payload, res => { resolve(res) @@ -735,11 +735,11 @@ export default { }, getResourceId ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/queryResource`, payload, res => { + io.get('resources/queryResource', payload, res => { resolve(res.data) }).catch(e => { reject(e) }) }) - }, + } } 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 b6142bb762..509ae3c103 100755 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js @@ -100,27 +100,27 @@ export default { */ resetParams (state, payload) { $('#canvas').html('') - state.globalParams = payload && payload.globalParams || [] - state.tasks = payload && payload.tasks || [] - state.name = payload && payload.name || '' - state.description = payload && payload.description || '' - state.timeout = payload && payload.timeout || 0 - state.tenantId = payload && payload.tenantId || -1 - state.processListS = payload && payload.processListS || [] - state.resourcesListS = payload && payload.resourcesListS || [] - state.resourcesListJar = payload && payload.resourcesListJar || [] - state.projectListS = payload && payload.projectListS || [] - state.isDetails = payload && payload.isDetails || false - state.runFlag = payload && payload.runFlag || '' - state.locations = payload && payload.locations || {} - state.connects = payload && payload.connects || [] + state.globalParams = (payload && payload.globalParams) || [] + state.tasks = (payload && payload.tasks) || [] + state.name = (payload && payload.name) || '' + state.description = (payload && payload.description) || '' + state.timeout = (payload && payload.timeout) || 0 + state.tenantId = (payload && payload.tenantId) || -1 + state.processListS = (payload && payload.processListS) || [] + state.resourcesListS = (payload && payload.resourcesListS) || [] + state.resourcesListJar = (payload && payload.resourcesListJar) || [] + state.projectListS = (payload && payload.projectListS) || [] + state.isDetails = (payload && payload.isDetails) || false + state.runFlag = (payload && payload.runFlag) || '' + state.locations = (payload && payload.locations) || {} + state.connects = (payload && payload.connects) || [] }, /** * add task * object {} */ addTasks (state, payload) { - let i = _.findIndex(state.tasks, v => v.id === payload.id) + const i = _.findIndex(state.tasks, v => v.id === payload.id) if (i !== -1) { state.tasks[i] = Object.assign(state.tasks[i], {}, payload) } else { @@ -129,9 +129,9 @@ export default { if (state.cacheTasks[payload.id]) { state.cacheTasks[payload.id] = Object.assign(state.cacheTasks[payload.id], {}, payload) } else { - state.cacheTasks[payload.id] = payload; + state.cacheTasks[payload.id] = payload } - let dom = $(`#${payload.id}`) + const dom = $(`#${payload.id}`) state.locations[payload.id] = _.assign(state.locations[payload.id], { name: dom.find('.name-p').text(), targetarr: dom.attr('data-targetarr'), @@ -149,7 +149,7 @@ export default { if (state.cacheTasks[payload.id]) { state.cacheTasks[payload.id] = Object.assign(state.cacheTasks[payload.id], {}, payload) } else { - state.cacheTasks[payload.id] = payload; + state.cacheTasks[payload.id] = payload } } } 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 0605a26666..05dfa77161 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js @@ -18,7 +18,7 @@ import localStore from '@/module/util/localStorage' // Get the name of the item currently clicked -let projectName = localStore.getItem('projectName') +const projectName = localStore.getItem('projectName') export default { // name @@ -34,7 +34,7 @@ export default { // Timeout alarm timeout: 0, // tenant id - tenantId:-1, + tenantId: -1, // Node location information locations: {}, // Node-to-node connection diff --git a/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js index c54a37f706..f8166d610c 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/datasource/actions.js @@ -27,7 +27,7 @@ export default { */ createDatasources ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`datasources/create`, payload, res => { + io.post('datasources/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -40,7 +40,7 @@ export default { */ connectDatasources ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`datasources/connect`, payload, res => { + io.post('datasources/connect', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -53,7 +53,7 @@ export default { */ getDatasourcesList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`datasources/list`, payload, res => { + io.get('datasources/list', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -68,7 +68,7 @@ export default { */ getDatasourcesListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`datasources/list-paging`, payload, res => { + io.get('datasources/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -80,7 +80,7 @@ export default { */ deleteDatasource ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`datasources/delete`, payload, res => { + io.get('datasources/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -92,7 +92,7 @@ export default { */ updateDatasource ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`datasources/update`, payload, res => { + io.post('datasources/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -101,7 +101,7 @@ export default { }, getEditDatasource ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`datasources/update-ui`, payload, res => { + io.post('datasources/update-ui', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -110,7 +110,7 @@ export default { }, verifyName ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`datasources/verify-name`, payload, res => { + io.get('datasources/verify-name', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -119,7 +119,7 @@ export default { }, getKerberosStartupState ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`datasources/kerberos-startup-state`, payload, res => { + io.get('datasources/kerberos-startup-state', payload, res => { resolve(res.data) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/monitor/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/monitor/actions.js index 1b2e2b8471..8380d12712 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/monitor/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/monitor/actions.js @@ -20,7 +20,7 @@ import io from '@/module/io' export default { getMasterData ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`monitor/master/list`, payload, res => { + io.get('monitor/master/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -29,7 +29,7 @@ export default { }, getWorkerData ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`monitor/worker/list`, payload, res => { + io.get('monitor/worker/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -38,7 +38,7 @@ export default { }, getDatabaseData ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`monitor/database`, payload, res => { + io.get('monitor/database', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -47,7 +47,7 @@ export default { }, getZookeeperData ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`monitor/zookeeper/list`, payload, res => { + io.get('monitor/zookeeper/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js index cae76b2016..43273de9e2 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js @@ -23,7 +23,7 @@ export default { */ getProjectsList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/list-paging`, payload, res => { + io.get('projects/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -35,7 +35,7 @@ export default { */ createProjects ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`projects/create`, payload, res => { + io.post('projects/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -47,7 +47,7 @@ export default { */ deleteProjects ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/delete`, payload, res => { + io.get('projects/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -59,7 +59,7 @@ export default { */ updateProjects ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`projects/update`, payload, res => { + io.post('projects/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -71,7 +71,7 @@ export default { */ getTaskCtatusCount ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/analysis/task-state-count`, payload, res => { + io.get('projects/analysis/task-state-count', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -83,7 +83,7 @@ export default { */ getCommandStateCount ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/analysis/command-state-count`, payload, res => { + io.get('projects/analysis/command-state-count', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -95,7 +95,7 @@ export default { */ getQueueCount ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/analysis/queue-count`, payload, res => { + io.get('projects/analysis/queue-count', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -107,7 +107,7 @@ export default { */ getProcessStateCount ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/analysis/process-state-count`, payload, res => { + io.get('projects/analysis/process-state-count', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -119,7 +119,7 @@ export default { */ getDefineUserCount ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`projects/analysis/define-user-count`, payload, res => { + io.get('projects/analysis/define-user-count', payload, res => { resolve(res) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js index c27c6d0ceb..b3b80a65ef 100755 --- a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js @@ -23,7 +23,7 @@ export default { */ getResourcesListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/list-paging`, payload, res => { + io.get('resources/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -32,7 +32,7 @@ export default { }, getResourceId ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/queryResource`, payload, res => { + io.get('resources/queryResource', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -41,7 +41,7 @@ export default { }, getResourcesList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/list`, payload, res => { + io.get('resources/list', payload, res => { resolve(res) }).catch(res => { reject(res) @@ -53,7 +53,7 @@ export default { */ deleteResource ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/delete`, payload, res => { + io.get('resources/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -65,7 +65,7 @@ export default { */ resourceVerifyName ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/verify-name`, payload, res => { + io.get('resources/verify-name', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -77,7 +77,7 @@ export default { */ getViewResources ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/view`, payload, res => { + io.get('resources/view', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -89,7 +89,7 @@ export default { */ createUdfFunc ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`resources/udf-func/create`, payload, res => { + io.post('resources/udf-func/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -101,7 +101,7 @@ export default { */ updateUdfFunc ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`resources/udf-func/update`, payload, res => { + io.post('resources/udf-func/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -113,7 +113,7 @@ export default { */ verifyUdfFuncName ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/udf-func/verify-name`, payload, res => { + io.get('resources/udf-func/verify-name', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -126,7 +126,7 @@ export default { */ deleteUdf ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/udf-func/delete`, payload, res => { + io.get('resources/udf-func/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -138,7 +138,7 @@ export default { */ getUdfFuncListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`resources/udf-func/list-paging`, payload, res => { + io.get('resources/udf-func/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -150,7 +150,7 @@ export default { */ updateContent ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`resources/update-content`, payload, res => { + io.post('resources/update-content', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -162,7 +162,7 @@ export default { */ createResourceFile ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`resources/online-create`, payload, res => { + io.post('resources/online-create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -174,7 +174,7 @@ export default { */ createResourceFolder ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`resources/directory/create`, payload, res => { + io.post('resources/directory/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -186,7 +186,7 @@ export default { */ resourceRename ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`resources/update`, payload, res => { + io.post('resources/update', payload, res => { resolve(res) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js index bba7f975b2..94e8a69605 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js @@ -25,7 +25,7 @@ export default { * @param tenant/verifyTenantCode */ verifyName ({ state }, payload) { - let o = { + const o = { user: { param: { userName: payload.userName @@ -47,7 +47,7 @@ export default { } return new Promise((resolve, reject) => { - io.get(o[payload.type]['api'], o[payload.type]['param'], res => { + io.get(o[payload.type].api, o[payload.type].param, res => { resolve(res) }).catch(e => { reject(e) @@ -64,7 +64,7 @@ export default { */ createUser ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`users/create`, payload, res => { + io.post('users/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -77,7 +77,7 @@ export default { */ verifyUserName ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`users/verify-user-name`, payload, res => { + io.post('users/verify-user-name', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -92,7 +92,7 @@ export default { */ getUsersListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`users/list-paging`, payload, res => { + io.get('users/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -104,7 +104,7 @@ export default { */ getUsersList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`users/list`, payload, res => { + io.get('users/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -116,7 +116,7 @@ export default { */ getUsersAll ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`users/list-all`, payload, res => { + io.get('users/list-all', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -134,7 +134,7 @@ export default { */ updateUser ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`users/update`, payload, res => { + io.post('users/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -147,7 +147,7 @@ export default { */ deleteUser ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`users/delete`, payload, res => { + io.post('users/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -158,12 +158,12 @@ export default { * Obtain authorized and unauthorized items */ getAuthList ({ state }, payload) { - let o = { + const o = { type: payload.type, category: payload.category } - let param = {} + const param = {} // Manage user if (o.type === 'user') { param.alertgroupId = payload.id @@ -197,12 +197,12 @@ export default { }, getResourceList ({ state }, payload) { - let o = { + const o = { type: payload.type, category: payload.category } - let param = {} + const param = {} // Manage user if (o.type === 'user') { param.alertgroupId = payload.id @@ -254,7 +254,7 @@ export default { */ getUsersDetails ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`users/select-by-id`, payload, res => { + io.post('users/select-by-id', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -266,7 +266,7 @@ export default { */ getTenantListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`tenant/list-paging`, payload, res => { + io.get('tenant/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -278,8 +278,8 @@ export default { */ getTenantList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`tenant/list`, payload, res => { - let list=res.data + io.get('tenant/list', payload, res => { + const list = res.data list.unshift({ id: -1, tenantName: 'Default' @@ -296,7 +296,7 @@ export default { */ getQueueList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`queue/list`, payload, res => { + io.get('queue/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -308,7 +308,7 @@ export default { */ createQueue ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`tenant/create`, payload, res => { + io.post('tenant/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -320,7 +320,7 @@ export default { */ updateQueue ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`tenant/update`, payload, res => { + io.post('tenant/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -332,7 +332,7 @@ export default { */ deleteQueue ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`tenant/delete`, payload, res => { + io.post('tenant/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -344,7 +344,7 @@ export default { */ getAlertgroupP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`alert-group/list-paging`, payload, res => { + io.get('alert-group/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -356,7 +356,7 @@ export default { */ getAlertgroup ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`alert-group/list`, payload, res => { + io.get('alert-group/list', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -368,7 +368,7 @@ export default { */ createAlertgrou ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`alert-group/create`, payload, res => { + io.post('alert-group/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -380,7 +380,7 @@ export default { */ updateAlertgrou ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`alert-group/update`, payload, res => { + io.post('alert-group/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -392,7 +392,7 @@ export default { */ deleteAlertgrou ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`alert-group/delete`, payload, res => { + io.post('alert-group/delete', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -404,7 +404,7 @@ export default { */ getProcessMasterList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`process/master/list`, payload, res => { + io.get('process/master/list', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -416,7 +416,7 @@ export default { */ getProcessWorkerList ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`process/worker/list`, payload, res => { + io.get('process/worker/list', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -428,7 +428,7 @@ export default { */ getQueueListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`queue/list-paging`, payload, res => { + io.get('queue/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -440,7 +440,7 @@ export default { */ createQueueQ ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`queue/create`, payload, res => { + io.post('queue/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -452,7 +452,7 @@ export default { */ updateQueueQ ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`queue/update`, payload, res => { + io.post('queue/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -464,7 +464,7 @@ export default { */ verifyQueueQ ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`queue/verify-queue`, payload, res => { + io.post('queue/verify-queue', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -476,7 +476,7 @@ export default { */ getWorkerGroups ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`worker-group/list-paging`, payload, res => { + io.get('worker-group/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -488,10 +488,10 @@ export default { */ getWorkerGroupsAll ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`worker-group/all-groups`, payload, res => { + io.get('worker-group/all-groups', payload, res => { let list = res.data - if(list.length>0) { - list = list.map(item=>{ + if (list.length > 0) { + list = list.map(item => { return { id: item, name: item @@ -512,7 +512,7 @@ export default { }, saveWorkerGroups ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`worker-group/save`, payload, res => { + io.post('worker-group/save', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -521,7 +521,7 @@ export default { }, deleteWorkerGroups ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`worker-group/delete-by-id`, payload, res => { + io.get('worker-group/delete-by-id', payload, res => { resolve(res) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/security/state.js b/dolphinscheduler-ui/src/js/conf/home/store/security/state.js index cbb67a1823..f3533265a9 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/security/state.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/security/state.js @@ -16,5 +16,5 @@ */ export default { workerGroupsListAll: [], - tenantAllList : [] + tenantAllList: [] } diff --git a/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js index 951d9a0814..57b4641e1d 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/user/actions.js @@ -23,7 +23,7 @@ export default { */ getUserInfo ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`users/get-user-info`, payload, res => { + io.get('users/get-user-info', payload, res => { state.userInfo = res.data resolve(res.data) }).catch(e => { @@ -35,7 +35,7 @@ export default { * sign out */ signOut () { - io.post(`signOut`, res => { + io.post('signOut', res => { setTimeout(() => { window.location.href = `${PUBLIC_PATH}/view/login/index.html` }, 100) @@ -52,7 +52,7 @@ export default { */ getTokenListP ({ state }, payload) { return new Promise((resolve, reject) => { - io.get(`access-token/list-paging`, payload, res => { + io.get('access-token/list-paging', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -68,7 +68,7 @@ export default { */ createToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`access-token/create`, payload, res => { + io.post('access-token/create', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -84,7 +84,7 @@ export default { */ updateToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`access-token/update`, payload, res => { + io.post('access-token/update', payload, res => { resolve(res) }).catch(e => { reject(e) @@ -99,7 +99,7 @@ export default { */ generateToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`access-token/generate`, payload, res => { + io.post('access-token/generate', payload, res => { resolve(res.data) }).catch(e => { reject(e) @@ -113,7 +113,7 @@ export default { */ deleteToken ({ state }, payload) { return new Promise((resolve, reject) => { - io.post(`access-token/delete`, payload, res => { + io.post('access-token/delete', payload, res => { resolve(res) }).catch(e => { reject(e) diff --git a/dolphinscheduler-ui/src/js/conf/login/index.js b/dolphinscheduler-ui/src/js/conf/login/index.js index d8f938d926..d9b93539bb 100644 --- a/dolphinscheduler-ui/src/js/conf/login/index.js +++ b/dolphinscheduler-ui/src/js/conf/login/index.js @@ -25,7 +25,7 @@ import 'ans-ui/lib/ans-ui.min.css' import ans from 'ans-ui/lib/ans-ui.min' import 'sass/conf/login/index.scss' -import'bootstrap/dist/js/bootstrap.min.js' +import 'bootstrap/dist/js/bootstrap.min.js' Vue.use(ans) @@ -41,7 +41,7 @@ new Vue({ }, methods: { initApp () { - let bootstrapTooltip = $.fn.tooltip.noConflict() + const bootstrapTooltip = $.fn.tooltip.noConflict() $.fn.tooltip = bootstrapTooltip $('body').tooltip({ selector: '[data-toggle="tooltip"]', diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/common.js b/dolphinscheduler-ui/src/js/module/ana-charts/common.js index d02aa03f1c..018f63849e 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/common.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/common.js @@ -52,7 +52,7 @@ function getChartContainers (el) { throw new Error('No corresponding DOM object found!') } let list - if (HTMLElement.prototype.isPrototypeOf(el)) { + if (Object.prototype.isPrototypeOf.call(HTMLElement.prototype, el)) { list = new Array(el) } else { list = Array.from(el) @@ -70,7 +70,7 @@ function getChartContainers (el) { */ export const checkKeyInModel = (model, ...params) => { for (const key of params) { - if (!model.hasOwnProperty(key)) { + if (!Object.prototype.hasOwnProperty.call(model, key)) { throw new Error('Data format error! The specified property was not found:' + key) } } diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/index.js index 2781d16389..8189cca762 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/index.js @@ -55,7 +55,7 @@ const Chart = { // Corresponding methods for injection of different components for (const key in components) { - if (components.hasOwnProperty(key)) { + if (Object.prototype.hasOwnProperty.call(components, key)) { Chart[key.toLowerCase()] = (el, data, options) => { return init(components[key], el, data, options) } diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/packages/bar/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/packages/bar/index.js index 26107cc3b2..42639fd561 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/packages/bar/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/packages/bar/index.js @@ -242,7 +242,7 @@ export default class Bar extends Base { } = this.settings const valueAxis = { type: 'value' } let yAxisModel = reverseAxis ? xAxis : valueAxis - let xAxisModel = reverseAxis ? valueAxis : xAxis + const xAxisModel = reverseAxis ? valueAxis : xAxis // Use custom Y-axis overlay if (yAxis) { yAxisModel = yAxis @@ -267,7 +267,7 @@ export default class Bar extends Base { // time axis if (timelineOptions) { - let opts = { + const opts = { baseOption: { timeline: timelineOptions.timeline, tooltip: { @@ -296,7 +296,7 @@ export default class Bar extends Base { // When the simple chart title is empty, the chart is vertically centered const top = !title && this.simple ? '3%' : 60 - let opts = { + const opts = { title: { text: title }, diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/packages/funnel/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/packages/funnel/index.js index 3bf1741a47..5a5e243ad9 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/packages/funnel/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/packages/funnel/index.js @@ -118,10 +118,10 @@ export default class Funnel extends Base { * Drawing charts */ apply () { - let { title, series, legendData } = this.options + const { title, series, legendData } = this.options // Injection configuration to series - let { insertSeries } = this.settings + const { insertSeries } = this.settings let _series = series if (insertSeries && insertSeries.length && series.length) { _series = this.injectDataIntoSeries(insertSeries, _series) diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/packages/line/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/packages/line/index.js index 2c1140efbf..94ebc84412 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/packages/line/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/packages/line/index.js @@ -162,7 +162,7 @@ export default class Line extends Base { } = this.settings const valueAxis = { type: 'value' } let yAxisModel = reverseAxis ? xAxis : valueAxis - let xAxisModel = reverseAxis ? valueAxis : xAxis + const xAxisModel = reverseAxis ? valueAxis : xAxis // Use custom Y-axis overlay if (yAxis) { yAxisModel = yAxis @@ -175,7 +175,7 @@ export default class Line extends Base { _series = this.injectDataIntoSeries(insertSeries, _series) } - let opts = { + const opts = { title: { text: title }, diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/packages/pie/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/packages/pie/index.js index be4d351622..f39f90b70f 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/packages/pie/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/packages/pie/index.js @@ -60,8 +60,8 @@ export default class Pie extends Base { checkKeyInModel(data[0], textKey, dataKey) const legendData = [] - let radius = ring ? ['50%', '70%'] : '60%' - let center = title ? ['50%', '60%'] : ['50%', '50%'] + const radius = ring ? ['50%', '70%'] : '60%' + const center = title ? ['50%', '60%'] : ['50%', '50%'] const series = [{ radius: radius, center: center, @@ -88,16 +88,16 @@ export default class Pie extends Base { * Drawing charts */ apply () { - let { title, series, legendData } = this.options + const { title, series, legendData } = this.options // Injection configuration to series - let { insertSeries } = this.settings + const { insertSeries } = this.settings let _series = series if (insertSeries && insertSeries.length && series.length) { _series = this.injectDataIntoSeries(insertSeries, _series) } - let opts = { + const opts = { title: { text: title, x: 'center' diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/packages/radar/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/packages/radar/index.js index b7f1fb7189..375dd1caf9 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/packages/radar/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/packages/radar/index.js @@ -87,7 +87,7 @@ export default class Radar extends Base { targetSeries._raw.push(data[i]) // index - let targetIndicator = indicator.find(i => i.name === textItem) + const targetIndicator = indicator.find(i => i.name === textItem) if (!targetIndicator) { indicator.push({ name: textItem }) } diff --git a/dolphinscheduler-ui/src/js/module/ana-charts/packages/scatter/index.js b/dolphinscheduler-ui/src/js/module/ana-charts/packages/scatter/index.js index d62dcecd4b..d6c09ee474 100755 --- a/dolphinscheduler-ui/src/js/module/ana-charts/packages/scatter/index.js +++ b/dolphinscheduler-ui/src/js/module/ana-charts/packages/scatter/index.js @@ -120,7 +120,7 @@ export default class Scatter extends Base { apply () { const { title, series, legendData = [] } = this.options - let { + const { // Custom X axis xAxis, // Custom Y axis diff --git a/dolphinscheduler-ui/src/js/module/axios/querystring.js b/dolphinscheduler-ui/src/js/module/axios/querystring.js index 16b0cbc1fb..7ac580c4df 100755 --- a/dolphinscheduler-ui/src/js/module/axios/querystring.js +++ b/dolphinscheduler-ui/src/js/module/axios/querystring.js @@ -16,45 +16,45 @@ */ /* istanbul ignore next */ var param = function (a) { - var s = [], - rbracket = /\[\]$/, - isArray = function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]' - }, - add = function (k, v) { - v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v - s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v) - }, - buildParams = function (prefix, obj) { - var i, len, key + var s = [] + var rbracket = /\[\]$/ + var isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]' + } + var add = function (k, v) { + v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v + s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v) + } + var buildParams = function (prefix, obj) { + var i, len, key - if (prefix) { - if (isArray(obj)) { - for (i = 0, len = obj.length; i < len; i++) { - if (rbracket.test(prefix)) { - add(prefix, obj[i]) - } else { - buildParams(prefix + '[' + (typeof obj[i] === 'object' ? i : '') + ']', obj[i]) - } - } - } else if (obj && String(obj) === '[object Object]') { - for (key in obj) { - buildParams(prefix + '[' + key + ']', obj[key]) - } - } else { - add(prefix, obj) - } - } else if (isArray(obj)) { + if (prefix) { + if (isArray(obj)) { for (i = 0, len = obj.length; i < len; i++) { - add(obj[i].name, obj[i].value) + if (rbracket.test(prefix)) { + add(prefix, obj[i]) + } else { + buildParams(prefix + '[' + (typeof obj[i] === 'object' ? i : '') + ']', obj[i]) + } } - } else { + } else if (obj && String(obj) === '[object Object]') { for (key in obj) { - buildParams(key, obj[key]) + buildParams(prefix + '[' + key + ']', obj[key]) } + } else { + add(prefix, obj) + } + } else if (isArray(obj)) { + for (i = 0, len = obj.length; i < len; i++) { + add(obj[i].name, obj[i].value) + } + } else { + for (key in obj) { + buildParams(key, obj[key]) } - return s } + return s + } return buildParams('', a).join('&').replace(/%20/g, '+') } diff --git a/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/index.js b/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/index.js index baac1b189b..12bf6a18c7 100755 --- a/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/index.js +++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/index.js @@ -25,4 +25,3 @@ export default { } } } - diff --git a/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/en_US.js index 1db86ebb08..ce067ffcf6 100755 --- a/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/en_US.js @@ -15,62 +15,62 @@ * limitations under the License. */ export default { - '秒': 'second', - '分': 'minute', - '时': 'hour', - '天': 'day', - '月': 'month', - '年': 'year', - '星期一': 'Monday', - '星期二': 'Tuesday', - '星期三': 'Wednesday', - '星期四': 'Thursday', - '星期五': 'Friday', - '星期六': 'Saturday', - '星期天': 'Sunday', - '每一秒钟': 'Every second', - '每隔': 'Every', + 秒: 'second', + 分: 'minute', + 时: 'hour', + 天: 'day', + 月: 'month', + 年: 'year', + 星期一: 'Monday', + 星期二: 'Tuesday', + 星期三: 'Wednesday', + 星期四: 'Thursday', + 星期五: 'Friday', + 星期六: 'Saturday', + 星期天: 'Sunday', + 每一秒钟: 'Every second', + 每隔: 'Every', '秒执行 从': 'second carried out', - '秒开始': 'Start', + 秒开始: 'Start', '具体秒数(可多选)': 'Specific second(multiple)', - '请选择具体秒数': 'Please enter a specific second', - '周期从': 'Cycle from', - '到': 'to', - '每一分钟': 'Every minute', + 请选择具体秒数: 'Please enter a specific second', + 周期从: 'Cycle from', + 到: 'to', + 每一分钟: 'Every minute', '分执行 从': 'minute carried out', - '分开始': 'Start', + 分开始: 'Start', '具体分钟数(可多选)': 'Specific minute(multiple)', - '请选择具体分钟数': 'Please enter a specific minute', - '每一小时': 'Every hour', + 请选择具体分钟数: 'Please enter a specific minute', + 每一小时: 'Every hour', '小时执行 从': 'hour carried out', - '小时开始': 'Start', + 小时开始: 'Start', '具体小时数(可多选)': 'Specific hour(multiple)', - '请选择具体小时数': 'Please enter a hour', - '每一天': 'Every day', + 请选择具体小时数: 'Please enter a hour', + 每一天: 'Every day', '周执行 从': 'week carried out', - '开始': 'Start', + 开始: 'Start', '天执行 从': 'day carried out', - '天开始': 'Start', + 天开始: 'Start', '具体星期几(可多选)': 'Specific day of the week(multiple)', - '请选择具体周几': 'Please enter a week', + 请选择具体周几: 'Please enter a week', '具体天数(可多选)': 'Specific days(multiple)', - '请选择具体天数': 'Please enter a days', - '在这个月的最后一天': 'On the last day of the month', - '在这个月的最后一个工作日': 'On the last working day of the month', - '在这个月的最后一个': 'At the last of this month', - '在本月底前': 'Before the end of this month', + 请选择具体天数: 'Please enter a days', + 在这个月的最后一天: 'On the last day of the month', + 在这个月的最后一个工作日: 'On the last working day of the month', + 在这个月的最后一个: 'At the last of this month', + 在本月底前: 'Before the end of this month', '最近的工作日(周一至周五)至本月': 'The most recent business day (Monday to Friday) to this month', - '在这个月的第': 'In this months', - '每一月': 'Every month', + 在这个月的第: 'In this months', + 每一月: 'Every month', '月执行 从': 'month carried out', - '月开始': 'Start', + 月开始: 'Start', '具体月数(可多选)': 'Specific months(multiple)', - '请选择具体月数': 'Please enter a months', - '每一年': 'Every year', + 请选择具体月数: 'Please enter a months', + 每一年: 'Every year', '年执行 从': 'year carried out', - '年开始': 'Start', + 年开始: 'Start', '具体年数(可多选)': 'Specific year(multiple)', - '请选择具体年数': 'Please enter a year', - '小时': 'hour', - '日': 'day' + 请选择具体年数: 'Please enter a year', + 小时: 'hour', + 日: 'day' } diff --git a/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/zh_CN.js index a38ab50f52..c84939fc59 100755 --- a/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/_source/i18n/locale/zh_CN.js @@ -15,62 +15,62 @@ * limitations under the License. */ export default { - '秒': '秒', - '分': '分', - '时': '时', - '天': '天', - '月': '月', - '年': '年', - '星期一': '星期一', - '星期二': '星期二', - '星期三': '星期三', - '星期四': '星期四', - '星期五': '星期五', - '星期六': '星期六', - '星期天': '星期天', - '每一秒钟': '每一秒钟', - '每隔': '每隔', + 秒: '秒', + 分: '分', + 时: '时', + 天: '天', + 月: '月', + 年: '年', + 星期一: '星期一', + 星期二: '星期二', + 星期三: '星期三', + 星期四: '星期四', + 星期五: '星期五', + 星期六: '星期六', + 星期天: '星期天', + 每一秒钟: '每一秒钟', + 每隔: '每隔', '秒执行 从': '秒执行 从', - '秒开始': '秒开始', + 秒开始: '秒开始', '具体秒数(可多选)': '具体秒数(可多选)', - '请选择具体秒数': '请选择具体秒数', - '周期从': '周期从', - '到': '到', - '每一分钟': '每一分钟', + 请选择具体秒数: '请选择具体秒数', + 周期从: '周期从', + 到: '到', + 每一分钟: '每一分钟', '分执行 从': '分执行 从', - '分开始': '分开始', + 分开始: '分开始', '具体分钟数(可多选)': '具体分钟数(可多选)', - '请选择具体分钟数': '请选择具体分钟数', - '每一小时': '每一小时', + 请选择具体分钟数: '请选择具体分钟数', + 每一小时: '每一小时', '小时执行 从': '小时执行 从', - '小时开始': '小时开始', + 小时开始: '小时开始', '具体小时数(可多选)': '具体小时数(可多选)', - '请选择具体小时数': '请选择具体小时数', - '每一天': '每一天', + 请选择具体小时数: '请选择具体小时数', + 每一天: '每一天', '周执行 从': '周执行 从', - '开始': '开始', + 开始: '开始', '天执行 从': '天执行 从', - '天开始': '天开始', + 天开始: '天开始', '具体星期几(可多选)': '具体星期几(可多选)', - '请选择具体周几': '请选择具体周几', + 请选择具体周几: '请选择具体周几', '具体天数(可多选)': '具体天数(可多选)', - '请选择具体天数': '请选择具体天数', - '在这个月的最后一天': '在这个月的最后一天', - '在这个月的最后一个工作日': '在这个月的最后一个工作日', - '在这个月的最后一个': '在这个月的最后一个', - '在本月底前': '在本月底前', + 请选择具体天数: '请选择具体天数', + 在这个月的最后一天: '在这个月的最后一天', + 在这个月的最后一个工作日: '在这个月的最后一个工作日', + 在这个月的最后一个: '在这个月的最后一个', + 在本月底前: '在本月底前', '最近的工作日(周一至周五)至本月': '最近的工作日(周一至周五)至本月', - '在这个月的第': '在这个月的第', - '每一月': '每一月', + 在这个月的第: '在这个月的第', + 每一月: '每一月', '月执行 从': '月执行 从', - '月开始': '月开始', + 月开始: '月开始', '具体月数(可多选)': '具体月数(可多选)', - '请选择具体月数': '请选择具体月数', - '每一年': '每一年', + 请选择具体月数: '请选择具体月数', + 每一年: '每一年', '年执行 从': '年执行 从', - '年开始': '年开始', + 年开始: '年开始', '具体年数(可多选)': '具体年数(可多选)', - '请选择具体年数': '请选择具体年数', - '小时': '小时', - '日': '日' + 请选择具体年数: '请选择具体年数', + 小时: '小时', + 日: '日' } diff --git a/dolphinscheduler-ui/src/js/module/components/crontab/source/util/index.js b/dolphinscheduler-ui/src/js/module/components/crontab/source/util/index.js index c4a228c900..47f5e34478 100755 --- a/dolphinscheduler-ui/src/js/module/components/crontab/source/util/index.js +++ b/dolphinscheduler-ui/src/js/module/components/crontab/source/util/index.js @@ -23,37 +23,37 @@ import _ from 'lodash' * @param end End value */ const range = (start, end) => { - let length = end - start + 1 + const length = end - start + 1 let step = start - 1 return Array.apply(null, { length: length }).map(function (v, i) { step++; return step }) } -let selectList = { - '60': _.map(range(0, 59), v => { +const selectList = { + 60: _.map(range(0, 59), v => { return { value: v + '', label: v + '' } }), - '24': _.map(range(0, 23), v => { + 24: _.map(range(0, 23), v => { return { value: v + '', label: v + '' } }), - '12': _.map(range(0, 12), v => { + 12: _.map(range(0, 12), v => { return { value: v + '', label: v + '' } }), - 'year': _.map(range(2018, 2030), v => { + year: _.map(range(2018, 2030), v => { return { value: v + '', label: v + '' } }), - 'week': [ + week: [ { value: 1, label: '星期天' @@ -83,7 +83,7 @@ let selectList = { label: '星期六' } ], - 'specificWeek': [ + specificWeek: [ { value: 'SUN', label: 'SUN' @@ -113,13 +113,13 @@ let selectList = { label: 'SAT' } ], - 'day': _.map(range(1, 31), v => { + day: _.map(range(1, 31), v => { return { value: v + '', label: v + '' } }), - 'lastWeeks': [ + lastWeeks: [ { value: '1L', label: '星期天' @@ -161,8 +161,8 @@ const isStr = (str, v) => { const isWeek = (str) => { let flag = false - let data = str.split(',') - let isSpecificWeek = (key) => { + const data = str.split(',') + const isSpecificWeek = (key) => { return _.findIndex(selectList.specificWeek, v => v.value === key) !== -1 } _.map(data, v => { @@ -173,7 +173,6 @@ const isWeek = (str) => { return flag } - /** * template * @@ -206,7 +205,6 @@ const template = (string, ...args) => { }) } - export { selectList, isStr, diff --git a/dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js b/dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js index 7d6e31b84a..82c9864d2b 100644 --- a/dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js +++ b/dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js @@ -19,7 +19,7 @@ import i18n from '@/module/i18n' import config from '~/external/config' import Permissions from '@/module/permissions' -let menu = { +const menu = { projects: [ { name: `${i18n.$t('Project Home')}`, @@ -225,7 +225,7 @@ let menu = { icon: 'ans-icon-menu', children: [ { - name: "Statistics", + name: 'Statistics', path: 'statistics', id: 0, disabled: true diff --git a/dolphinscheduler-ui/src/js/module/download/index.js b/dolphinscheduler-ui/src/js/module/download/index.js index d2b30cc14c..552df62e9e 100644 --- a/dolphinscheduler-ui/src/js/module/download/index.js +++ b/dolphinscheduler-ui/src/js/module/download/index.js @@ -19,8 +19,8 @@ import i18n from '@/module/i18n' /** * download file */ -let downloadFile = ($url, $obj) => { - let param = { +const downloadFile = ($url, $obj) => { + const param = { url: $url, obj: $obj } @@ -30,9 +30,9 @@ let downloadFile = ($url, $obj) => { return } - let generatorInput = function (obj) { + const generatorInput = function (obj) { let result = '' - let keyArr = Object.keys(obj) + const keyArr = Object.keys(obj) keyArr.forEach(function (key) { result += "" }) 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 0e83689149..69d2782d5a 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js @@ -18,11 +18,11 @@ export default { 'User Name': 'User Name', 'Please enter user name': 'Please enter user name', - 'Password': 'Password', + Password: 'Password', 'Please enter your password': 'Please enter your password', 'Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22': 'Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22', - 'Login': 'Login', - 'Home': 'Home', + Login: 'Login', + Home: 'Home', 'Failed to create node to save': 'Failed to create node to save', 'Global parameters': 'Global parameters', 'Local parameters': 'Local parameters', @@ -36,14 +36,14 @@ export default { 'Node name': 'Node name', 'Please enter name(required)': 'Please enter name(required)', 'Run flag': 'Run flag', - 'Normal': 'Normal', + Normal: 'Normal', 'Prohibition execution': 'Prohibition execution', 'Please enter description': 'Please enter description', 'Number of failed retries': 'Number of failed retries', - 'Times': 'Times', + Times: 'Times', 'Failed retry interval': 'Failed retry interval', - 'Minute': 'Minute', - 'Cancel': 'Cancel', + Minute: 'Minute', + Cancel: 'Cancel', 'Confirm add': 'Confirm add', 'The newly created sub-Process has not yet been executed and cannot enter the sub-Process': 'The newly created sub-Process has not yet been executed and cannot enter the sub-Process', 'The task has not been executed and cannot enter the sub-Process': 'The task has not been executed and cannot enter the sub-Process', @@ -53,7 +53,7 @@ export default { 'Refresh Log': 'Refresh Log', 'Enter full screen': 'Enter full screen', 'Cancel full screen': 'Cancel full screen', - 'Close': 'Close', + Close: 'Close', 'Update log success': 'Update log success', 'No more logs': 'No more logs', 'No log': 'No log', @@ -62,7 +62,7 @@ export default { 'Please enter description(optional)': 'Please enter description(optional)', 'Set global': 'Set global', 'Whether to update the process definition': 'Whether to update the process definition', - 'Add': 'Add', + Add: 'Add', 'DAG graph name cannot be empty': 'DAG graph name cannot be empty', 'Create Datasource': 'Create Datasource', 'Project Home': 'Project Home', @@ -75,9 +75,9 @@ export default { 'Create User': 'Create User', 'User Information': 'User Information', 'Edit Password': 'Edit Password', - 'success': 'success', - 'failed': 'failed', - 'delete': 'delete', + success: 'success', + failed: 'failed', + delete: 'delete', 'Please choose': 'Please choose', 'Please enter a positive integer': 'Please enter a positive integer', 'Program Type': 'Program Type', @@ -88,13 +88,13 @@ export default { 'Please enter Command-line parameters': 'Please enter Command-line parameters', 'Other parameters': 'Other parameters', 'Please enter other parameters': 'Please enter other parameters', - 'Resources': 'Resources', + Resources: 'Resources', 'Custom Parameters': 'Custom Parameters', 'Custom template': 'Custom template', - 'Datasource': 'Datasource', - 'methods': 'methods', + Datasource: 'Datasource', + methods: 'methods', 'Please enter method(optional)': 'Please enter method(optional)', - 'Script': 'Script', + Script: 'Script', 'Please enter script(required)': 'Please enter script(required)', 'Deploy Mode': 'Deploy Mode', 'Driver core number': 'Driver core number', @@ -112,11 +112,11 @@ export default { 'Please enter ExecutorPlease enter Executor core number': 'Please enter ExecutorPlease enter Executor core number', 'Core number should be positive integer': 'Core number should be positive integer', 'SQL Type': 'SQL Type', - 'Title': 'Title', + Title: 'Title', 'Please enter the title of email': 'Please enter the title of email', - 'Table': 'Table', - 'TableMode': 'Table', - 'Attachment': 'Attachment', + Table: 'Table', + TableMode: 'Table', + Attachment: 'Attachment', 'SQL Parameter': 'SQL Parameter', 'SQL Statement': 'SQL Statement', 'UDF Function': 'UDF Function', @@ -127,12 +127,12 @@ export default { 'Mail subject required': 'Mail subject required', 'Child Node': 'Child Node', 'Please select a sub-Process': 'Please select a sub-Process', - 'Edit': 'Edit', + Edit: 'Edit', 'Datasource Name': 'Datasource Name', 'Please enter datasource name': 'Please enter datasource name', - 'IP': 'IP', + IP: 'IP', 'Please enter IP': 'Please enter IP', - 'Port': 'Port', + Port: 'Port', 'Please enter port': 'Please enter port', 'Database Name': 'Database Name', 'Please enter database name': 'Please enter database name', @@ -151,13 +151,13 @@ export default { 'Datasource Parameter': 'Datasource Parameter', 'Create Time': 'Create Time', 'Update Time': 'Update Time', - 'Operation': 'Operation', + Operation: 'Operation', 'Click to view': 'Click to view', 'Delete?': 'Delete?', - 'Confirm': 'Confirm', + Confirm: 'Confirm', 'Task status statistics': 'Task Status Statistics', - 'Number': 'Number', - 'State': 'State', + Number: 'Number', + State: 'State', 'Process Status Statistics': 'Process Status Statistics', 'Process Definition Statistics': 'Process Definition Statistics', 'Project Name': 'Project Name', @@ -165,42 +165,42 @@ export default { 'Owned Users': 'Owned Users', 'Process Pid': 'Process Pid', 'Zk registration directory': 'Zk registration directory', - 'cpuUsage': 'cpuUsage', - 'memoryUsage': 'memoryUsage', + cpuUsage: 'cpuUsage', + memoryUsage: 'memoryUsage', 'Last heartbeat time': 'Last heartbeat time', 'Edit Tenant': 'Edit Tenant', 'Tenant Code': 'Tenant Code', 'Tenant Name': 'Tenant Name', - 'Queue': 'Queue', + Queue: 'Queue', 'Please select a queue': 'Please select a queue', 'Please enter the tenant code in English': 'Please enter the tenant code in English', 'Please enter tenant code in English': 'Please enter tenant code in English', 'Edit User': 'Edit User', - 'Tenant': 'Tenant', - 'Email': 'Email', - 'Phone': 'Phone', + Tenant: 'Tenant', + Email: 'Email', + Phone: 'Phone', 'Please enter phone number': 'Please enter phone number', 'Please enter main class': 'Please enter main class', 'Please enter email': 'Please enter email', 'Please enter the correct email format': 'Please enter the correct email format', 'Please enter the correct mobile phone format': 'Please enter the correct mobile phone format', - 'Project': 'Project', - 'Authorize': 'Authorize', + Project: 'Project', + Authorize: 'Authorize', 'File resources': 'File resources', 'UDF resources': 'UDF resources', 'Please select UDF resources directory': 'Please select UDF resources directory', - 'UDF resources directory' : 'UDF resources directory', + 'UDF resources directory': 'UDF resources directory', 'Upload File Size': 'Upload File size cannot exceed 1g', 'Edit alarm group': 'Edit alarm group', 'Create alarm group': 'Create alarm group', 'Group Name': 'Group Name', 'Please enter group name': 'Please enter group name', 'Group Type': 'Group Type', - 'Remarks': 'Remarks', - 'SMS': 'SMS', + Remarks: 'Remarks', + SMS: 'SMS', 'Managing Users': 'Managing Users', - 'Permission': 'Permission', - 'Administrator': 'Administrator', + Permission: 'Permission', + Administrator: 'Administrator', 'Confirm Password': 'Confirm Password', 'Please enter confirm password': 'Please enter confirm password', 'Password cannot be in Chinese': 'Password cannot be in Chinese', @@ -210,7 +210,7 @@ export default { 'The password is inconsistent with the confirmation password': 'The password is inconsistent with the confirmation password', 'Please select the datasource': 'Please select the datasource', 'Please select resources': 'Please select resources', - 'Query': 'Query', + Query: 'Query', 'Non Query': 'Non Query', 'prop(required)': 'prop(required)', 'value(optional)': 'value(optional)', @@ -220,18 +220,18 @@ export default { 'prop is repeat': 'prop is repeat', 'Start Time': 'Start Time', 'End Time': 'End Time', - 'crontab': 'crontab', + crontab: 'crontab', 'Failure Strategy': 'Failure Strategy', - 'online': 'online', - 'offline': 'offline', + online: 'online', + offline: 'offline', 'Task Status': 'Task Status', 'Process Instance': 'Process Instance', 'Task Instance': 'Task Instance', 'Select date range': 'Select date range', - 'Date': 'Date', - 'waiting': 'waiting', - 'execution': 'execution', - 'finish': 'finish', + Date: 'Date', + waiting: 'waiting', + execution: 'execution', + finish: 'finish', 'Create File': 'Create File', 'Create folder': 'Create folder', 'File Name': 'File Name', @@ -239,13 +239,13 @@ export default { 'File Format': 'File Format', 'Folder Format': 'Folder Format', 'File Content': 'File Content', - 'Create': 'Create', + Create: 'Create', 'Please enter the resource content': 'Please enter the resource content', 'Resource content cannot exceed 3000 lines': 'Resource content cannot exceed 3000 lines', 'File Details': 'File Details', 'Download Details': 'Download Details', - 'Return': 'Return', - 'Save': 'Save', + Return: 'Return', + Save: 'Save', 'File Manage': 'File Manage', 'Upload Files': 'Upload Files', 'Create UDF Function': 'Create UDF Function', @@ -253,22 +253,22 @@ export default { 'Service-Master': 'Service-Master', 'Service-Worker': 'Service-Worker', 'Process Name': 'Process Name', - 'Executor': 'Executor', + Executor: 'Executor', 'Run Type': 'Run Type', 'Scheduling Time': 'Scheduling Time', 'Run Times': 'Run Times', - 'host': 'host', + host: 'host', 'fault-tolerant sign': 'fault-tolerant sign', - 'Rerun': 'Rerun', + Rerun: 'Rerun', 'Recovery Failed': 'Recovery Failed', - 'Stop': 'Stop', - 'Pause': 'Pause', + Stop: 'Stop', + Pause: 'Pause', 'Recovery Suspend': 'Recovery Suspend', - 'Gantt': 'Gantt', - 'Name': 'Name', + Gantt: 'Gantt', + Name: 'Name', 'Node Type': 'Node Type', 'Submit Time': 'Submit Time', - 'Duration': 'Duration', + Duration: 'Duration', 'Retry Count': 'Retry Count', 'Task Name': 'Task Name', 'Task Date': 'Task Date', @@ -276,25 +276,25 @@ export default { 'Record Number': 'Record Number', 'Target Table': 'Target Table', 'Online viewing type is not supported': 'Online viewing type is not supported', - 'Size': 'Size', - 'Rename': 'Rename', - 'Download': 'Download', - 'Export': 'Export', - 'Submit': 'Submit', + Size: 'Size', + Rename: 'Rename', + Download: 'Download', + Export: 'Export', + Submit: 'Submit', 'Edit UDF Function': 'Edit UDF Function', - 'type': 'type', + type: 'type', 'UDF Function Name': 'UDF Function Name', - 'FILE': 'FILE', - 'UDF': 'UDF', + FILE: 'FILE', + UDF: 'UDF', 'File Subdirectory': 'File Subdirectory', 'Please enter a function name': 'Please enter a function name', 'Package Name': 'Package Name', 'Please enter a Package name': 'Please enter a Package name', - 'Parameter': 'Parameter', + Parameter: 'Parameter', 'Please enter a parameter': 'Please enter a parameter', 'UDF Resources': 'UDF Resources', 'Upload Resources': 'Upload Resources', - 'Instructions': 'Instructions', + Instructions: 'Instructions', 'Please enter a instructions': 'Please enter a instructions', 'Please enter a UDF function name': 'Please enter a UDF function name', 'Select UDF Resources': 'Select UDF Resources', @@ -303,52 +303,52 @@ export default { 'Library Name': 'Library Name', 'UDF Resource Name': 'UDF Resource Name', 'File Size': 'File Size', - 'Description': 'Description', + Description: 'Description', 'Drag Nodes and Selected Items': 'Drag Nodes and Selected Items', 'Select Line Connection': 'Select Line Connection', 'Delete selected lines or nodes': 'Delete selected lines or nodes', 'Full Screen': 'Full Screen', - 'Unpublished': 'Unpublished', + Unpublished: 'Unpublished', 'Start Process': 'Start Process', 'Execute from the current node': 'Execute from the current node', 'Recover tolerance fault process': 'Recover tolerance fault process', 'Resume the suspension process': 'Resume the suspension process', 'Execute from the failed nodes': 'Execute from the failed nodes', 'Complement Data': 'Complement Data', - 'slot':'slot', - 'taskManager':'taskManager', - 'jobManagerMemory':'jobManagerMemory', - 'taskManagerMemory':'taskManagerMemory', + slot: 'slot', + taskManager: 'taskManager', + jobManagerMemory: 'jobManagerMemory', + taskManagerMemory: 'taskManagerMemory', 'Scheduling execution': 'Scheduling execution', 'Recovery waiting thread': 'Recovery waiting thread', 'Submitted successfully': 'Submitted successfully', - 'Executing': 'Executing', + Executing: 'Executing', 'Ready to pause': 'Ready to pause', 'Ready to stop': 'Ready to stop', 'Need fault tolerance': 'Need fault tolerance', - 'kill': 'kill', + kill: 'kill', 'Waiting for thread': 'Waiting for thread', 'Waiting for dependence': 'Waiting for dependence', - 'Start': 'Start', - 'Copy': 'Copy', + Start: 'Start', + Copy: 'Copy', 'Copy name': 'Copy name', - 'Delete': 'Delete', + Delete: 'Delete', 'Please enter keyword': 'Please enter keyword', 'File Upload': 'File Upload', 'Drag the file into the current upload window': 'Drag the file into the current upload window', 'Drag area upload': 'Drag area upload', - 'Upload': 'Upload', + Upload: 'Upload', 'Please enter file name': 'Please enter file name', 'Please select the file to upload': 'Please select the file to upload', 'Resources manage': 'Resources', - 'Security': 'Security', - 'Logout': 'Logout', + Security: 'Security', + Logout: 'Logout', 'No data': 'No data', 'Uploading...': 'Uploading...', 'Loading...': 'Loading...', - 'List': 'List', + List: 'List', 'Unable to download without proper url': 'Unable to download without proper url', - 'Process': 'Process', + Process: 'Process', 'Process definition': 'Process definition', 'Task record': 'Task record', 'Warning group manage': 'Warning group manage', @@ -361,13 +361,13 @@ export default { 'Create process': 'Create process', 'Import process': 'Import process', 'Timing state': 'Timing state', - 'Timing': 'Timing', - 'TreeView': 'TreeView', + Timing: 'Timing', + TreeView: 'TreeView', 'Mailbox already exists! Recipients and copyers cannot repeat': 'Mailbox already exists! Recipients and copyers cannot repeat', 'Mailbox input is illegal': 'Mailbox input is illegal', 'Please set the parameters before starting': 'Please set the parameters before starting', - 'Continue': 'Continue', - 'End': 'End', + Continue: 'Continue', + End: 'End', 'Node execution': 'Node execution', 'Backward execution': 'Backward execution', 'Forward execution': 'Forward execution', @@ -375,8 +375,8 @@ export default { 'Notification strategy': 'Notification strategy', 'Notification group': 'Notification group', 'Please select a notification group': 'Please select a notification group', - 'Recipient': 'Recipient', - 'Cc': 'Cc', + Recipient: 'Recipient', + Cc: 'Cc', 'Whether it is a complement process?': 'Whether it is a complement process?', 'Schedule date': 'Schedule date', 'Mode of execution': 'Mode of execution', @@ -386,15 +386,15 @@ export default { 'Start and stop time': 'Start and stop time', 'Please select time': 'Please select time', 'Please enter crontab': 'Please enter crontab', - 'none_1': 'none', - 'success_1': 'success', - 'failure_1': 'failure', - 'All_1': 'All', - 'Toolbar': 'Toolbar', + none_1: 'none', + success_1: 'success', + failure_1: 'failure', + All_1: 'All', + Toolbar: 'Toolbar', 'View variables': 'View variables', 'Format DAG': 'Format DAG', 'Refresh DAG status': 'Refresh DAG status', - 'Return_1': 'Return', + Return_1: 'Return', 'Please enter format': 'Please enter format', 'connection parameter': 'connection parameter', 'Process definition details': 'Process definition details', @@ -404,8 +404,8 @@ export default { 'Create Resource': 'Create Resource', 'User Center': 'User Center', 'Please enter method': 'Please enter method', - 'none': 'none', - 'name': 'name', + none: 'none', + name: 'name', 'Process priority': 'Process priority', 'Task priority': 'Task priority', 'Task timeout alarm': 'Task timeout alarm', @@ -416,36 +416,36 @@ export default { 'Timeout strategy must be selected': 'Timeout strategy must be selected', 'Timeout must be a positive integer': 'Timeout must be a positive integer', 'Add dependency': 'Add dependency', - 'and': 'and', - 'or': 'or', - 'month': 'month', - 'week': 'week', - 'day': 'day', - 'hour': 'hour', - 'Running': 'Running', + and: 'and', + or: 'or', + month: 'month', + week: 'week', + day: 'day', + hour: 'hour', + Running: 'Running', 'Waiting for dependency to complete': 'Waiting for dependency to complete', - 'Selected': 'Selected', - 'Last1Hour': 'Last1Hour', - 'Last2Hours': 'Last2Hours', - 'Last3Hours': 'Last3Hours', - 'today': 'today', - 'Last1Days': 'Last1Days', - 'Last2Days': 'Last2Days', - 'Last3Days': 'Last3Days', - 'Last7Days': 'Last7Days', - 'ThisWeek': 'ThisWeek', - 'LastWeek': 'LastWeek', - 'LastMonday': 'LastMonday', - 'LastTuesday': 'LastTuesday', - 'LastWednesday': 'LastWednesday', - 'LastThursday': 'LastThursday', - 'LastFriday': 'LastFriday', - 'LastSaturday': 'LastSaturday', - 'LastSunday': 'LastSunday', - 'ThisMonth': 'ThisMonth', - 'LastMonth': 'LastMonth', - 'LastMonthBegin': 'LastMonthBegin', - 'LastMonthEnd': 'LastMonthEnd', + Selected: 'Selected', + Last1Hour: 'Last1Hour', + Last2Hours: 'Last2Hours', + Last3Hours: 'Last3Hours', + today: 'today', + Last1Days: 'Last1Days', + Last2Days: 'Last2Days', + Last3Days: 'Last3Days', + Last7Days: 'Last7Days', + ThisWeek: 'ThisWeek', + LastWeek: 'LastWeek', + LastMonday: 'LastMonday', + LastTuesday: 'LastTuesday', + LastWednesday: 'LastWednesday', + LastThursday: 'LastThursday', + LastFriday: 'LastFriday', + LastSaturday: 'LastSaturday', + LastSunday: 'LastSunday', + ThisMonth: 'ThisMonth', + LastMonth: 'LastMonth', + LastMonthBegin: 'LastMonthBegin', + LastMonthEnd: 'LastMonthEnd', 'Refresh status succeeded': 'Refresh status succeeded', 'Queue manage': 'Queue manage', 'Create queue': 'Create queue', @@ -464,21 +464,21 @@ export default { 'Please enter the IP address separated by commas': 'Please enter the IP address separated by commas', 'Note: Multiple IP addresses have been comma separated': 'Note: Multiple IP addresses have been comma separated', 'Failure time': 'Failure time', - 'User': 'User', + User: 'User', 'Please enter token': 'Please enter token', 'Generate token': 'Generate token', - 'Monitor': 'Monitor', - 'Group': 'Group', + Monitor: 'Monitor', + Group: 'Group', 'Queue statistics': 'Queue statistics', 'Command status statistics': 'Command status statistics', 'Task kill': 'Task Kill', 'Task queue': 'Task queue', 'Error command count': 'Error command count', 'Normal command count': 'Normal command count', - 'Manage': ' Manage', + Manage: ' Manage', 'Number of connections': 'Number of connections', - 'Sent': 'Sent', - 'Received': 'Received', + Sent: 'Sent', + Received: 'Received', 'Min latency': 'Min latency', 'Avg latency': 'Avg latency', 'Max latency': 'Max latency', @@ -502,9 +502,9 @@ export default { 'tasks number of waiting running': 'tasks number of waiting running', 'task number of ready to kill': 'task number of ready to kill', 'Statistics manage': 'Statistics Manage', - 'statistics': 'Statistics', - 'select tenant':'select tenant', - 'Please enter Principal':'Please enter Principal', + statistics: 'Statistics', + 'select tenant': 'select tenant', + 'Please enter Principal': 'Please enter Principal', 'The start time must not be the same as the end': 'The start time must not be the same as the end', 'Startup parameter': 'Startup parameter', 'Startup type': 'Startup type', @@ -512,14 +512,14 @@ export default { 'Next five execution times': 'Next five execution times', 'Execute time': 'Execute time', 'Complement range': 'Complement range', - 'Http Url':'Http Url', - 'Http Method':'Http Method', - 'Http Parameters':'Http Parameters', - 'Http Parameters Key':'Http Parameters Key', - 'Http Parameters Position':'Http Parameters Position', - 'Http Parameters Value':'Http Parameters Value', - 'Http Check Condition':'Http Check Condition', - 'Http Condition':'Http Condition', + 'Http Url': 'Http Url', + 'Http Method': 'Http Method', + 'Http Parameters': 'Http Parameters', + 'Http Parameters Key': 'Http Parameters Key', + 'Http Parameters Position': 'Http Parameters Position', + 'Http Parameters Value': 'Http Parameters Value', + 'Http Check Condition': 'Http Check Condition', + 'Http Condition': 'Http Condition', 'Please Enter Http Url': 'Please Enter Http Url(required)', 'Please Enter Http Condition': 'Please Enter Http Condition', 'There is no data for this period of time': 'There is no data for this period of time', @@ -527,18 +527,18 @@ export default { 'Please enter the correct IP': 'Please enter the correct IP', 'Please generate token': 'Please generate token', 'Spark Version': 'Spark Version', - 'TargetDataBase': 'target database', - 'TargetTable': 'target table', + TargetDataBase: 'target database', + TargetTable: 'target table', 'Please enter the table of target': 'Please enter the table of target', 'Please enter a Target Table(required)': 'Please enter a Target Table(required)', - 'SpeedByte': 'speed(byte count)', - 'SpeedRecord': 'speed(record count)', + SpeedByte: 'speed(byte count)', + SpeedRecord: 'speed(record count)', '0 means unlimited by byte': '0 means unlimited', '0 means unlimited by count': '0 means unlimited', 'Modify User': 'Modify User', 'Whether directory': 'Whether directory', - 'Yes': 'Yes', - 'No': 'No', + Yes: 'Yes', + No: 'No', 'Please enter Mysql Database(required)': 'Please enter Mysql Database(required)', 'Please enter Mysql Table(required)': 'Please enter Mysql Table(required)', 'Please enter Columns (Comma separated)': 'Please enter Columns (Comma separated)', @@ -553,34 +553,34 @@ export default { 'Please enter Lines Terminated': 'Please enter Lines Terminated', 'Please enter Concurrency': 'Please enter Concurrency', 'Please enter Update Key': 'Please enter Update Key', - 'Direct': 'Direct', - 'Type': 'Type', - 'ModelType': 'ModelType', - 'ColumnType': 'ColumnType', - 'Database': 'Database', - 'Column': 'Column', + Direct: 'Direct', + Type: 'Type', + ModelType: 'ModelType', + ColumnType: 'ColumnType', + Database: 'Database', + Column: 'Column', 'Map Column Hive': 'Map Column Hive', 'Map Column Java': 'Map Column Java', 'Export Dir': 'Export Dir', 'Hive partition Keys': 'Hive partition Keys', 'Hive partition Values': 'Hive partition Values', - 'FieldsTerminated': 'FieldsTerminated', - 'LinesTerminated': 'LinesTerminated', - 'IsUpdate': 'IsUpdate', - 'UpdateKey': 'UpdateKey', - 'UpdateMode': 'UpdateMode', + FieldsTerminated: 'FieldsTerminated', + LinesTerminated: 'LinesTerminated', + IsUpdate: 'IsUpdate', + UpdateKey: 'UpdateKey', + UpdateMode: 'UpdateMode', 'Target Dir': 'Target Dir', - 'DeleteTargetDir': 'DeleteTargetDir', - 'FileType': 'FileType', - 'CompressionCodec': 'CompressionCodec', - 'CreateHiveTable': 'CreateHiveTable', - 'DropDelimiter': 'DropDelimiter', - 'OverWriteSrc': 'OverWriteSrc', - 'ReplaceDelimiter': 'ReplaceDelimiter', - 'Concurrency': 'Concurrency', - 'Form': 'Form', - 'OnlyUpdate': 'OnlyUpdate', - 'AllowInsert': 'AllowInsert', + DeleteTargetDir: 'DeleteTargetDir', + FileType: 'FileType', + CompressionCodec: 'CompressionCodec', + CreateHiveTable: 'CreateHiveTable', + DropDelimiter: 'DropDelimiter', + OverWriteSrc: 'OverWriteSrc', + ReplaceDelimiter: 'ReplaceDelimiter', + Concurrency: 'Concurrency', + Form: 'Form', + OnlyUpdate: 'OnlyUpdate', + AllowInsert: 'AllowInsert', 'Data Source': 'Data Source', 'Data Target': 'Data Target', 'All Columns': 'All Columns', @@ -589,5 +589,5 @@ export default { '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': 'Successful branch flow 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', + 'Please delete all non-existent resources': 'Please delete all non-existent resources' } 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 134ca84a58..aad9a89f34 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -18,11 +18,11 @@ export default { 'User Name': '用户名', 'Please enter user name': '请输入用户名', - 'Password': '密码', + Password: '密码', 'Please enter your password': '请输入密码', 'Password consists of at least two combinations of numbers, letters, and characters, and the length is between 6-22': '密码至少包含数字,字母和字符的两种组合,长度在6-22之间', - 'Login': '登录', - 'Home': '首页', + Login: '登录', + Home: '首页', 'Failed to create node to save': '未创建节点保存失败', 'Global parameters': '全局参数', 'Local parameters': '局部参数', @@ -36,14 +36,14 @@ export default { 'Node name': '节点名称', 'Please enter name(required)': '请输入名称(必填)', 'Run flag': '运行标志', - 'Normal': '正常', + Normal: '正常', 'Prohibition execution': '禁止执行', 'Please enter description': '请输入描述', 'Number of failed retries': '失败重试次数', - 'Times': '次', + Times: '次', 'Failed retry interval': '失败重试间隔', - 'Minute': '分', - 'Cancel': '取消', + Minute: '分', + Cancel: '取消', 'Confirm add': '确认添加', 'The newly created sub-Process has not yet been executed and cannot enter the sub-Process': '新创建子工作流还未执行,不能进入子工作流', 'The task has not been executed and cannot enter the sub-Process': '该任务还未执行,不能进入子工作流', @@ -53,7 +53,7 @@ export default { 'Refresh Log': '刷新日志', 'Enter full screen': '进入全屏', 'Cancel full screen': '取消全屏', - 'Close': '关闭', + Close: '关闭', 'Update log success': '更新日志成功', 'No more logs': '暂无更多日志', 'No log': '暂无日志', @@ -62,7 +62,7 @@ export default { 'Please enter description(optional)': '请输入描述(选填)', 'Set global': '设置全局', 'Whether to update the process definition': '是否更新流程定义', - 'Add': '添加', + Add: '添加', 'DAG graph name cannot be empty': 'DAG图名称不能为空', 'Create Datasource': '创建数据源', 'Project Home': '项目首页', @@ -75,9 +75,9 @@ export default { 'Create User': '创建用户', 'User Information': '用户信息', 'Edit Password': '密码修改', - 'success': '成功', - 'failed': '失败', - 'delete': '删除', + success: '成功', + failed: '失败', + delete: '删除', 'Please choose': '请选择', 'Please enter a positive integer': '请输入正整数', 'Program Type': '程序类型', @@ -88,14 +88,14 @@ export default { 'Please enter Command-line parameters': '请输入命令行参数', 'Other parameters': '其他参数', 'Please enter other parameters': '请输入其他参数', - 'Resources': '资源', + Resources: '资源', 'Custom Parameters': '自定义参数', 'Custom template': '自定义模版', 'Please enter main class': '请填写主函数的class', - 'Datasource': '数据源', - 'methods': '方法', + Datasource: '数据源', + methods: '方法', 'Please enter method(optional)': '请输入方法(选填)', - 'Script': '脚本', + Script: '脚本', 'Please enter script(required)': '请输入脚本(必填)', 'Deploy Mode': '部署方式', 'Driver core number': 'Driver内核数', @@ -113,16 +113,16 @@ export default { 'Please enter ExecutorPlease enter Executor core number': '请填写Executor内核数', 'Core number should be positive integer': '内核数为正整数', 'SQL Type': 'sql类型', - 'Title': '主题', + Title: '主题', 'Please enter the title of email': '请输入邮件主题', - 'Table': '表名', - 'TableMode': '表格', - 'Attachment': '附件', + Table: '表名', + TableMode: '表格', + Attachment: '附件', 'SQL Parameter': 'sql参数', 'SQL Statement': 'sql语句', 'UDF Function': 'UDF函数', - 'FILE': '文件', - 'UDF': 'UDF', + FILE: '文件', + UDF: 'UDF', 'File Subdirectory': '文件子目录', 'Please enter a SQL Statement(required)': '请输入sql语句(必填)', 'Please enter a JSON Statement(required)': '请输入json语句(必填)', @@ -131,12 +131,12 @@ export default { 'Mail subject required': '邮件主题必填', 'Child Node': '子节点', 'Please select a sub-Process': '请选择子工作流', - 'Edit': '编辑', + Edit: '编辑', 'Datasource Name': '数据源名称', 'Please enter datasource name': '请输入数据源名称', - 'IP': 'IP主机名', + IP: 'IP主机名', 'Please enter IP': '请输入IP主机名', - 'Port': '端口', + Port: '端口', 'Please enter port': '请输入端口', 'Database Name': '数据库名', 'Please enter database name': '请输入数据库名', @@ -155,13 +155,13 @@ export default { 'Datasource Parameter': '数据源参数', 'Create Time': '创建时间', 'Update Time': '更新时间', - 'Operation': '操作', + Operation: '操作', 'Click to view': '点击查看', 'Delete?': '确定删除吗?', - 'Confirm': '确定', + Confirm: '确定', 'Task status statistics': '任务状态统计', - 'Number': '数量', - 'State': '状态', + Number: '数量', + State: '状态', 'Process Status Statistics': '流程状态统计', 'Process Definition Statistics': '流程定义统计', 'Project Name': '项目名称', @@ -169,25 +169,25 @@ export default { 'Owned Users': '所属用户', 'Process Pid': '进程pid', 'Zk registration directory': 'zk注册目录', - 'cpuUsage': 'cpuUsage', - 'memoryUsage': 'memoryUsage', + cpuUsage: 'cpuUsage', + memoryUsage: 'memoryUsage', 'Last heartbeat time': '最后心跳时间', 'Edit Tenant': '编辑租户', 'Tenant Code': '租户编码', 'Tenant Name': '租户名称', - 'Queue': '队列', + Queue: '队列', 'Please enter the tenant code in English': '请输入租户编码只允许英文', 'Please enter tenant code in English': '请输入英文租户编码', 'Edit User': '编辑用户', - 'Tenant': '租户', - 'Email': '邮件', - 'Phone': '手机', + Tenant: '租户', + Email: '邮件', + Phone: '手机', 'Please enter phone number': '请输入手机', 'Please enter email': '请输入邮箱', 'Please enter the correct email format': '请输入正确的邮箱格式', 'Please enter the correct mobile phone format': '请输入正确的手机格式', - 'Project': '项目', - 'Authorize': '授权', + Project: '项目', + Authorize: '授权', 'File resources': '文件资源', 'UDF resources': 'UDF资源', 'UDF resources directory': 'UDF资源目录', @@ -197,11 +197,11 @@ export default { 'Group Name': '组名称', 'Please enter group name': '请输入组名称', 'Group Type': '组类型', - 'Remarks': '备注', - 'SMS': '短信', + Remarks: '备注', + SMS: '短信', 'Managing Users': '管理用户', - 'Permission': '权限', - 'Administrator': '管理员', + Permission: '权限', + Administrator: '管理员', 'Confirm Password': '确认密码', 'Please enter confirm password': '请输入确认密码', 'Password cannot be in Chinese': '密码不能为中文', @@ -211,7 +211,7 @@ export default { 'The password is inconsistent with the confirmation password': '密码与确认密码不一致,请重新确认', 'Please select the datasource': '请选择数据源', 'Please select resources': '请选择资源', - 'Query': '查询', + Query: '查询', 'Non Query': '非查询', 'prop(required)': 'prop(必填)', 'value(optional)': 'value(选填)', @@ -221,18 +221,18 @@ export default { 'prop is repeat': 'prop中有重复', 'Start Time': '开始时间', 'End Time': '结束时间', - 'crontab': 'crontab', + crontab: 'crontab', 'Failure Strategy': '失败策略', - 'online': '上线', - 'offline': '下线', + online: '上线', + offline: '下线', 'Task Status': '任务状态', 'Process Instance': '工作流实例', 'Task Instance': '任务实例', 'Select date range': '选择日期区间', - 'Date': '日期', - 'waiting': '等待', - 'execution': '执行中', - 'finish': '完成', + Date: '日期', + waiting: '等待', + execution: '执行中', + finish: '完成', 'Create File': '创建文件', 'Create folder': '创建文件夹', 'File Name': '文件名称', @@ -241,13 +241,13 @@ export default { 'Folder Format': '文件夹格式', 'File Content': '文件内容', 'Upload File Size': '文件大小不能超过1G', - 'Create': '创建', + Create: '创建', 'Please enter the resource content': '请输入资源内容', 'Resource content cannot exceed 3000 lines': '资源内容不能超过3000行', 'File Details': '文件详情', 'Download Details': '下载详情', - 'Return': '返回', - 'Save': '保存', + Return: '返回', + Save: '保存', 'File Manage': '文件管理', 'Upload Files': '上传文件', 'Create UDF Function': '创建UDF函数', @@ -255,22 +255,22 @@ export default { 'Service-Master': '服务管理-Master', 'Service-Worker': '服务管理-Worker', 'Process Name': '工作流名称', - 'Executor': '执行用户', + Executor: '执行用户', 'Run Type': '运行类型', 'Scheduling Time': '调度时间', 'Run Times': '运行次数', - 'host': 'host', + host: 'host', 'fault-tolerant sign': '容错标识', - 'Rerun': '重跑', + Rerun: '重跑', 'Recovery Failed': '恢复失败', - 'Stop': '停止', - 'Pause': '暂停', + Stop: '停止', + Pause: '暂停', 'Recovery Suspend': '恢复运行', - 'Gantt': '甘特图', - 'Name': '名称', + Gantt: '甘特图', + Name: '名称', 'Node Type': '节点类型', 'Submit Time': '提交时间', - 'Duration': '运行时长', + Duration: '运行时长', 'Retry Count': '重试次数', 'Task Name': '任务名称', 'Task Date': '任务日期', @@ -278,22 +278,22 @@ export default { 'Record Number': '记录数', 'Target Table': '目标表', 'Online viewing type is not supported': '不支持在线查看类型', - 'Size': '大小', - 'Rename': '重命名', - 'Download': '下载', - 'Export': '导出', - 'Submit': '提交', + Size: '大小', + Rename: '重命名', + Download: '下载', + Export: '导出', + Submit: '提交', 'Edit UDF Function': '编辑UDF函数', - 'type': '类型', + type: '类型', 'UDF Function Name': 'UDF函数名称', 'Please enter a function name': '请输入函数名', 'Package Name': '包名类名', 'Please enter a Package name': '请输入包名类名', - 'Parameter': '参数', + Parameter: '参数', 'Please enter a parameter': '请输入参数', 'UDF Resources': 'UDF资源', 'Upload Resources': '上传资源', - 'Instructions': '使用说明', + Instructions: '使用说明', 'Please enter a instructions': '请输入使用说明', 'Please enter a UDF function name': '请输入UDF函数名称', 'Select UDF Resources': '请选择UDF资源', @@ -302,12 +302,12 @@ export default { 'Library Name': '库名', 'UDF Resource Name': 'UDF资源名称', 'File Size': '文件大小', - 'Description': '描述', + Description: '描述', 'Drag Nodes and Selected Items': '拖动节点和选中项', 'Select Line Connection': '选择线条连接', 'Delete selected lines or nodes': '删除选中的线或节点', 'Full Screen': '全屏', - 'Unpublished': '未发布', + Unpublished: '未发布', 'Start Process': '启动工作流', 'Execute from the current node': '从当前节点开始执行', 'Recover tolerance fault process': '恢复被容错的工作流', @@ -317,33 +317,33 @@ export default { 'Scheduling execution': '调度执行', 'Recovery waiting thread': '恢复等待线程', 'Submitted successfully': '提交成功', - 'Executing': '正在执行', + Executing: '正在执行', 'Ready to pause': '准备暂停', 'Ready to stop': '准备停止', 'Need fault tolerance': '需要容错', - 'kill': 'kill', + kill: 'kill', 'Waiting for thread': '等待线程', 'Waiting for dependence': '等待依赖', - 'Start': '运行', - 'Copy': '复制节点', + Start: '运行', + Copy: '复制节点', 'Copy name': '复制名称', - 'Delete': '删除', + Delete: '删除', 'Please enter keyword': '请输入关键词', 'File Upload': '文件上传', 'Drag the file into the current upload window': '请将文件拖拽到当前上传窗口内!', 'Drag area upload': '拖动区域上传', - 'Upload': '上传', + Upload: '上传', 'Please enter file name': '请输入文件名', 'Please select the file to upload': '请选择要上传的文件', 'Resources manage': '资源中心', - 'Security': '安全中心', - 'Logout': '退出', + Security: '安全中心', + Logout: '退出', 'No data': '查询无数据', 'Uploading...': '文件上传中', 'Loading...': '正在努力加载中...', - 'List': '列表', + List: '列表', 'Unable to download without proper url': '无下载url无法下载', - 'Process': '工作流', + Process: '工作流', 'Process definition': '工作流定义', 'Task record': '任务记录', 'Warning group manage': '告警组管理', @@ -356,13 +356,13 @@ export default { 'Create process': '创建工作流', 'Import process': '导入工作流', 'Timing state': '定时状态', - 'Timing': '定时', - 'TreeView': '树形图', + Timing: '定时', + TreeView: '树形图', 'Mailbox already exists! Recipients and copyers cannot repeat': '邮箱已存在!收件人和抄送人不能重复', 'Mailbox input is illegal': '邮箱输入不合法', 'Please set the parameters before starting': '启动前请先设置参数', - 'Continue': '继续', - 'End': '结束', + Continue: '继续', + End: '结束', 'Node execution': '节点执行', 'Backward execution': '向后执行', 'Forward execution': '向前执行', @@ -370,8 +370,8 @@ export default { 'Notification strategy': '通知策略', 'Notification group': '通知组', 'Please select a notification group': '请选择通知组', - 'Recipient': '收件人', - 'Cc': '抄送人', + Recipient: '收件人', + Cc: '抄送人', 'Whether it is a complement process?': '是否补数', 'Schedule date': '调度日期', 'Mode of execution': '执行方式', @@ -381,15 +381,15 @@ export default { 'Start and stop time': '起止时间', 'Please select time': '请选择时间', 'Please enter crontab': '请输入crontab', - 'none_1': '都不发', - 'success_1': '成功发', - 'failure_1': '失败发', - 'All_1': '成功或失败都发', - 'Toolbar': '工具栏', + none_1: '都不发', + success_1: '成功发', + failure_1: '失败发', + All_1: '成功或失败都发', + Toolbar: '工具栏', 'View variables': '查看变量', 'Format DAG': '格式化DAG', 'Refresh DAG status': '刷新DAG状态', - 'Return_1': '返回上一节点', + Return_1: '返回上一节点', 'Please enter format': '请输入格式为', 'connection parameter': '连接参数', 'Process definition details': '流程定义详情', @@ -399,8 +399,8 @@ export default { 'Create Resource': '创建资源', 'User Center': '用户中心', 'Please enter method': '请输入方法', - 'none': '无', - 'name': '名称', + none: '无', + name: '名称', 'Process priority': '流程优先级', 'Task priority': '任务优先级', 'Task timeout alarm': '任务超时告警', @@ -411,36 +411,36 @@ export default { 'Timeout strategy must be selected': '超时策略必须选一个', 'Timeout must be a positive integer': '超时时长必须为正整数', 'Add dependency': '添加依赖', - 'and': '且', - 'or': '或', - 'month': '月', - 'week': '周', - 'day': '日', - 'hour': '时', - 'Running': '正在运行', + and: '且', + or: '或', + month: '月', + week: '周', + day: '日', + hour: '时', + Running: '正在运行', 'Waiting for dependency to complete': '等待依赖完成', - 'Selected': '已选', - 'Last1Hour': '前1小时', - 'Last2Hours': '前2小时', - 'Last3Hours': '前3小时', - 'today': '今天', - 'Last1Days': '昨天', - 'Last2Days': '前两天', - 'Last3Days': '前三天', - 'Last7Days': '前七天', - 'ThisWeek': '本周', - 'LastWeek': '上周', - 'LastMonday': '上周一', - 'LastTuesday': '上周二', - 'LastWednesday': '上周三', - 'LastThursday': '上周四', - 'LastFriday': '上周五', - 'LastSaturday': '上周六', - 'LastSunday': '上周日', - 'ThisMonth': '本月', - 'LastMonth': '上月', - 'LastMonthBegin': '上月初', - 'LastMonthEnd': '上月末', + Selected: '已选', + Last1Hour: '前1小时', + Last2Hours: '前2小时', + Last3Hours: '前3小时', + today: '今天', + Last1Days: '昨天', + Last2Days: '前两天', + Last3Days: '前三天', + Last7Days: '前七天', + ThisWeek: '本周', + LastWeek: '上周', + LastMonday: '上周一', + LastTuesday: '上周二', + LastWednesday: '上周三', + LastThursday: '上周四', + LastFriday: '上周五', + LastSaturday: '上周六', + LastSunday: '上周日', + ThisMonth: '本月', + LastMonth: '上月', + LastMonthBegin: '上月初', + LastMonthEnd: '上月末', 'Refresh status succeeded': '刷新状态成功', 'Queue manage': '队列管理', 'Create queue': '创建队列', @@ -459,21 +459,21 @@ export default { 'Please enter the IP address separated by commas': '请输入IP地址多个用英文逗号隔开', 'Note: Multiple IP addresses have been comma separated': '注意:多个IP地址以英文逗号分割', 'Failure time': '失效时间', - 'User': '用户', + User: '用户', 'Please enter token': '请输入令牌', 'Generate token': '生成令牌', - 'Monitor': '监控中心', - 'Group': '分组', + Monitor: '监控中心', + Group: '分组', 'Queue statistics': '队列统计', 'Command status statistics': '命令状态统计', 'Task kill': '等待kill任务', 'Task queue': '等待执行任务', 'Error command count': '错误指令数', 'Normal command count': '正确指令数', - 'Manage': '管理', + Manage: '管理', 'Number of connections': '连接数', - 'Sent': '发送量', - 'Received': '接收量', + Sent: '发送量', + Received: '接收量', 'Min latency': '最低延时', 'Avg latency': '平均延时', 'Max latency': '最大延时', @@ -498,9 +498,9 @@ export default { 'tasks number of waiting running': '待运行任务数', 'task number of ready to kill': '待杀死任务数', 'Statistics manage': '统计管理', - 'statistics': '统计', - 'select tenant':'选择租户', - 'Please enter Principal':'请输入Principal', + statistics: '统计', + 'select tenant': '选择租户', + 'Please enter Principal': '请输入Principal', 'The start time must not be the same as the end': '开始时间和结束时间不能相同', 'Startup parameter': '启动参数', 'Startup type': '启动类型', @@ -508,18 +508,18 @@ export default { 'Next five execution times': '接下来五次执行时间', 'Execute time': '执行时间', 'Complement range': '补数范围', - 'slot':'slot数量', - 'taskManager':'taskManage数量', - 'jobManagerMemory':'jobManager内存数', - 'taskManagerMemory':'taskManager内存数', - 'Http Url':'请求地址', - 'Http Method':'请求类型', - 'Http Parameters':'请求参数', - 'Http Parameters Key':'参数名', - 'Http Parameters Position':'参数位置', - 'Http Parameters Value':'参数值', - 'Http Check Condition':'校验条件', - 'Http Condition':'校验内容', + slot: 'slot数量', + taskManager: 'taskManage数量', + jobManagerMemory: 'jobManager内存数', + taskManagerMemory: 'taskManager内存数', + 'Http Url': '请求地址', + 'Http Method': '请求类型', + 'Http Parameters': '请求参数', + 'Http Parameters Key': '参数名', + 'Http Parameters Position': '参数位置', + 'Http Parameters Value': '参数值', + 'Http Check Condition': '校验条件', + 'Http Condition': '校验内容', 'Please Enter Http Url': '请填写请求地址(必填)', 'Please Enter Http Condition': '请填写校验内容', 'There is no data for this period of time': '该时间段无数据', @@ -527,18 +527,18 @@ export default { 'Please enter the correct IP': '请输入正确的IP', 'Please generate token': '请生成Token', 'Spark Version': 'Spark版本', - 'TargetDataBase': '目标库', - 'TargetTable': '目标表', + TargetDataBase: '目标库', + TargetTable: '目标表', 'Please enter the table of target': '请输入目标表名', 'Please enter a Target Table(required)': '请输入目标表(必填)', - 'SpeedByte': '限流(字节数)', - 'SpeedRecord': '限流(记录数)', + SpeedByte: '限流(字节数)', + SpeedRecord: '限流(记录数)', '0 means unlimited by byte': 'KB,0代表不限制', '0 means unlimited by count': '0代表不限制', 'Modify User': '修改用户', - 'Whether directory' : '是否文件夹', - 'Yes': '是', - 'No': '否', + 'Whether directory': '是否文件夹', + Yes: '是', + No: '否', 'Please enter Mysql Database(required)': '请输入Mysql数据库(必填)', 'Please enter Mysql Table(required)': '请输入Mysql表名(必填)', 'Please enter Columns (Comma separated)': '请输入列名,用 , 隔开', @@ -553,34 +553,34 @@ export default { 'Please enter Lines Terminated': '请输入行分隔符', 'Please enter Concurrency': '请输入并发度', 'Please enter Update Key': '请输入更新列', - 'Direct': '流向', - 'Type': '类型', - 'ModelType': '模式', - 'ColumnType': '列类型', - 'Database': '数据库', - 'Column': '列', + Direct: '流向', + Type: '类型', + ModelType: '模式', + ColumnType: '列类型', + Database: '数据库', + Column: '列', 'Map Column Hive': 'Hive类型映射', 'Map Column Java': 'Java类型映射', 'Export Dir': '数据源路径', 'Hive partition Keys': 'Hive 分区键', 'Hive partition Values': 'Hive 分区值', - 'FieldsTerminated': '列分隔符', - 'LinesTerminated': '行分隔符', - 'IsUpdate': '是否更新', - 'UpdateKey': '更新列', - 'UpdateMode': '更新类型', + FieldsTerminated: '列分隔符', + LinesTerminated: '行分隔符', + IsUpdate: '是否更新', + UpdateKey: '更新列', + UpdateMode: '更新类型', 'Target Dir': '目标路径', - 'DeleteTargetDir': '是否删除目录', - 'FileType': '保存格式', - 'CompressionCodec': '压缩类型', - 'CreateHiveTable': '是否创建新表', - 'DropDelimiter': '是否删除分隔符', - 'OverWriteSrc': '是否覆盖数据源', - 'ReplaceDelimiter': '替换分隔符', - 'Concurrency': '并发度', - 'Form': '表单', - 'OnlyUpdate': '只更新', - 'AllowInsert': '无更新便插入', + DeleteTargetDir: '是否删除目录', + FileType: '保存格式', + CompressionCodec: '压缩类型', + CreateHiveTable: '是否创建新表', + DropDelimiter: '是否删除分隔符', + OverWriteSrc: '是否覆盖数据源', + ReplaceDelimiter: '替换分隔符', + Concurrency: '并发度', + Form: '表单', + OnlyUpdate: '只更新', + AllowInsert: '无更新便插入', 'Data Source': '数据来源', 'Data Target': '数据目的', 'All Columns': '全表导入', @@ -589,5 +589,5 @@ export default { 'Cannot select the same node for successful branch flow and failed branch flow': '成功分支流转和失败分支流转不能选择同一个节点', 'Successful branch flow and failed branch flow are required': '成功分支流转和失败分支流转必填', 'Unauthorized or deleted resources': '未授权或已删除资源', - 'Please delete all non-existent resources': '请删除所有未授权或已删除资源', + 'Please delete all non-existent resources': '请删除所有未授权或已删除资源' } diff --git a/dolphinscheduler-ui/src/js/module/io/index.js b/dolphinscheduler-ui/src/js/module/io/index.js index eedb40e00b..9b806ab59d 100644 --- a/dolphinscheduler-ui/src/js/module/io/index.js +++ b/dolphinscheduler-ui/src/js/module/io/index.js @@ -18,7 +18,6 @@ import io from '@/module/axios/index' import cookies from 'js-cookie' - const apiPrefix = '/dolphinscheduler' const reSlashPrefix = /^\/+/ @@ -73,13 +72,13 @@ io.interceptors.response.use( // Global request interceptor registion io.interceptors.request.use( config => { - let sIdCookie = cookies.get('sessionId') - let sessionId = sessionStorage.getItem("sessionId") - let requstUrl = config.url.substring(config.url.lastIndexOf("/")+1) - if(sIdCookie !== null && requstUrl!=='login' && sIdCookie!=sessionId) { + const sIdCookie = cookies.get('sessionId') + const sessionId = sessionStorage.getItem('sessionId') + const requstUrl = config.url.substring(config.url.lastIndexOf('/') + 1) + if (sIdCookie !== null && requstUrl !== 'login' && sIdCookie !== sessionId) { window.location.href = `${PUBLIC_PATH}/view/login/index.html` } else { - let { method } = config + const { method } = config if (method === 'get') { config.params = Object.assign({}, config.params, { _t: Math.random() diff --git a/dolphinscheduler-ui/src/js/module/mixin/disabledState.js b/dolphinscheduler-ui/src/js/module/mixin/disabledState.js index 4b814a1908..3a2b954232 100644 --- a/dolphinscheduler-ui/src/js/module/mixin/disabledState.js +++ b/dolphinscheduler-ui/src/js/module/mixin/disabledState.js @@ -17,7 +17,6 @@ import store from '@/conf/home/store' import router from '@/conf/home/router' -import Permissions from '@/module/permissions' export default { data () { @@ -28,7 +27,7 @@ export default { } }, created () { - this.isDetails =this.store.state.dag.isDetails// Permissions.getAuth() ? this.store.state.dag.isDetails : true + this.isDetails = this.store.state.dag.isDetails// Permissions.getAuth() ? this.store.state.dag.isDetails : true }, computed: { _isDetails () { diff --git a/dolphinscheduler-ui/src/js/module/mixin/listUrlParamHandle.js b/dolphinscheduler-ui/src/js/module/mixin/listUrlParamHandle.js index 13c54071b3..1e1a7b8bbe 100644 --- a/dolphinscheduler-ui/src/js/module/mixin/listUrlParamHandle.js +++ b/dolphinscheduler-ui/src/js/module/mixin/listUrlParamHandle.js @@ -23,7 +23,7 @@ import { setUrlParams } from '@/module/util/routerUtil' export default { watch: { // watch pageNo - 'searchParams': { + searchParams: { deep: true, handler () { setUrlParams(this.searchParams) @@ -48,8 +48,8 @@ export default { _debounceGET: _.debounce(function (flag) { this._getList(flag) }, 100, { - 'leading': false, - 'trailing': true + leading: false, + trailing: true }) } } diff --git a/dolphinscheduler-ui/src/js/module/permissions/index.js b/dolphinscheduler-ui/src/js/module/permissions/index.js index a604c53d44..21278851ef 100644 --- a/dolphinscheduler-ui/src/js/module/permissions/index.js +++ b/dolphinscheduler-ui/src/js/module/permissions/index.js @@ -19,7 +19,7 @@ import _ from 'lodash' import Vue from 'vue' import store from '@/conf/home/store' -let Permissions = function () { +const Permissions = function () { this.isAuth = true } @@ -44,7 +44,7 @@ Permissions.prototype = { if ($(el).prop('tagName') === 'BUTTON') { $(el).attr('disabled', true) } else { - setTimeout(function(){el.parentNode.removeChild(el)},100) + setTimeout(function () { el.parentNode.removeChild(el) }, 100) } } } diff --git a/dolphinscheduler-ui/src/js/module/util/index.js b/dolphinscheduler-ui/src/js/module/util/index.js index 6b122f9172..5829c80013 100644 --- a/dolphinscheduler-ui/src/js/module/util/index.js +++ b/dolphinscheduler-ui/src/js/module/util/index.js @@ -51,7 +51,7 @@ export function findComponentDownward (context, componentName) { * uuid('v-ani-%{s}-translate') // -> v-ani-xxx */ export function uuid (prefix) { - let id = Math.floor(Math.random() * 10000).toString(36) + const id = Math.floor(Math.random() * 10000).toString(36) return prefix ? ( ~prefix.indexOf('%{s}') ? ( prefix.replace(/%\{s\}/g, id) @@ -59,7 +59,6 @@ export function uuid (prefix) { ) : id } - /** * template * @@ -92,4 +91,3 @@ export function template (string, ...args) { } }) } - diff --git a/dolphinscheduler-ui/src/js/module/util/routerUtil.js b/dolphinscheduler-ui/src/js/module/util/routerUtil.js index c19a8e7609..a4a70520ae 100644 --- a/dolphinscheduler-ui/src/js/module/util/routerUtil.js +++ b/dolphinscheduler-ui/src/js/module/util/routerUtil.js @@ -15,9 +15,6 @@ * limitations under the License. */ -import merge from 'webpack-merge' -import router from '@/conf/home/router' - export function setUrlParams (o) { // router.push({ // query: merge(router.history.current.query, o) diff --git a/dolphinscheduler-ui/src/js/module/util/util.js b/dolphinscheduler-ui/src/js/module/util/util.js index 2cbded3f7b..49e3bb2ee8 100644 --- a/dolphinscheduler-ui/src/js/module/util/util.js +++ b/dolphinscheduler-ui/src/js/module/util/util.js @@ -20,9 +20,9 @@ */ const bytesToSize = (bytes) => { if (bytes === 0) return '0 B' - let k = 1024, // or 1024 - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - i = Math.floor(Math.log(bytes) / Math.log(k)) + const k = 1024 // or 1024 + const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + const i = Math.floor(Math.log(bytes) / Math.log(k)) return parseInt((bytes / Math.pow(k, i)).toPrecision(3)) + ' ' + sizes[i] } @@ -33,7 +33,7 @@ const bytesToSize = (bytes) => { const isJson = (str) => { if (typeof str === 'string') { try { - let obj = JSON.parse(str) + const obj = JSON.parse(str) if (typeof obj === 'object' && obj) { return true } else { @@ -69,7 +69,6 @@ const syntaxHighlight = (json) => { }) } - export { bytesToSize, isJson, diff --git a/dolphinscheduler-ui/src/lib/external/config.js b/dolphinscheduler-ui/src/lib/external/config.js index 497540be7b..161bbee92e 100644 --- a/dolphinscheduler-ui/src/lib/external/config.js +++ b/dolphinscheduler-ui/src/lib/external/config.js @@ -19,5 +19,5 @@ */ export default { // task record switch - recordSwitch:false + recordSwitch: false } diff --git a/dolphinscheduler-ui/src/lib/external/email.js b/dolphinscheduler-ui/src/lib/external/email.js index 6b10efbf0f..f3f932af6a 100644 --- a/dolphinscheduler-ui/src/lib/external/email.js +++ b/dolphinscheduler-ui/src/lib/external/email.js @@ -14,4 +14,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export default ["test@analysys.com.cn"] +export default ['test@analysys.com.cn'] From ba8492f428d38e681bf26d92cdbfc1d1a99059f1 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 30 Apr 2020 00:01:57 +0800 Subject: [PATCH 10/33] Reorder lint action --- .github/workflows/ci_frontend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_frontend.yml b/.github/workflows/ci_frontend.yml index 45dcbf1e35..b8e11252c8 100644 --- a/.github/workflows/ci_frontend.yml +++ b/.github/workflows/ci_frontend.yml @@ -48,9 +48,9 @@ jobs: - name: Compile run: | cd dolphinscheduler-ui - npm run lint npm install node-sass --unsafe-perm npm install + npm run lint npm run build License-check: From 234d6b609a5aa66166cb0aa5194ca2da4b94e40b Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 30 Apr 2020 00:04:43 +0800 Subject: [PATCH 11/33] Add license header to eslint --- dolphinscheduler-ui/.eslintrc.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dolphinscheduler-ui/.eslintrc.yml b/dolphinscheduler-ui/.eslintrc.yml index 5251c5af7c..8d4020f7c4 100644 --- a/dolphinscheduler-ui/.eslintrc.yml +++ b/dolphinscheduler-ui/.eslintrc.yml @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + env: browser: true es6: true From f3fbdfc8e7391f98f3b263e599ecda4e9d06986e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E9=B8=A3?= Date: Thu, 30 Apr 2020 15:03:00 +0800 Subject: [PATCH 13/33] 1 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7fad7fa77a..a74fe67531 100644 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ if [ $dbtype == "postgresql" ];then datasourceDriverClassname="org.postgresql.Driver" fi sed -i ${txt} "s#spring.datasource.driver-class-name.*#spring.datasource.driver-class-name=${datasourceDriverClassname}#g" conf/datasource.properties -sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:${dbtype}://${dbhost}/${dbname}?characterEncoding=UTF-8&allowMultiQueries=true#g" conf/datasource.properties +sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:${dbtype}://${dbhost}/${dbname}?characterEncoding=UTF-8\&allowMultiQueries=true#g" conf/datasource.properties sed -i ${txt} "s#spring.datasource.username.*#spring.datasource.username=${username}#g" conf/datasource.properties sed -i ${txt} "s#spring.datasource.password.*#spring.datasource.password=${password}#g" conf/datasource.properties From 85f3ac10a0adf567393ff098f6ffd66b06cdff39 Mon Sep 17 00:00:00 2001 From: hgaol Date: Wed, 29 Apr 2020 00:36:36 +0800 Subject: [PATCH 14/33] feat: add plugin management for alert service --- .../dolphinscheduler/alert/AlertServer.java | 36 ++- .../alert/manager/EmailManager.java | 4 +- .../manager/EnterpriseWeChatManager.java | 10 +- .../alert/plugin/EmailAlertPlugin.java | 133 ++++++++++ .../alert/runner/AlertSender.java | 110 +++------ .../alert/utils/Constants.java | 17 ++ .../alert/utils/EnterpriseWeChatUtils.java | 8 +- .../alert/utils/MailUtils.java | 16 +- .../src/main/resources/alert.properties | 2 +- .../alert/plugin/EmailAlertPluginTest.java | 78 ++++++ .../utils/EnterpriseWeChatUtilsTest.java | 13 +- .../alert/utils/MailUtilsTest.java | 10 +- dolphinscheduler-common/pom.xml | 5 +- .../dolphinscheduler/common/Constants.java | 7 + .../common/plugin/FilePluginManager.java | 89 +++++++ .../common/plugin/PluginClassLoader.java | 134 ++++++++++ .../common/plugin/PluginManager.java | 33 +++ dolphinscheduler-plugin-api/pom.xml | 35 +++ .../plugin/api/AlertPlugin.java | 45 ++++ .../plugin/model/AlertData.java | 125 ++++++++++ .../plugin/model/AlertInfo.java | 61 +++++ .../plugin/model/PluginName.java | 45 ++++ .../plugin/spi/AlertPluginProvider.java | 33 +++ .../plugin/utils/PropertyUtils.java | 232 ++++++++++++++++++ .../plugin/utils/PropertyUtilsTest.java | 67 +++++ .../src/test/resources/plugin.properties | 5 + .../server/worker/task/sql/SqlTask.java | 2 +- pom.xml | 11 +- 28 files changed, 1251 insertions(+), 115 deletions(-) create mode 100644 dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java create mode 100644 dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java create mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java create mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java create mode 100644 dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginManager.java create mode 100644 dolphinscheduler-plugin-api/pom.xml create mode 100644 dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/api/AlertPlugin.java create mode 100644 dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java create mode 100644 dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertInfo.java create mode 100644 dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/PluginName.java create mode 100644 dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/spi/AlertPluginProvider.java create mode 100644 dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java create mode 100644 dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java create mode 100644 dolphinscheduler-plugin-api/src/test/resources/plugin.properties diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java index 58a37c2f41..dafa33adac 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java @@ -16,8 +16,11 @@ */ package org.apache.dolphinscheduler.alert; +import org.apache.dolphinscheduler.alert.plugin.EmailAlertPlugin; import org.apache.dolphinscheduler.alert.runner.AlertSender; import org.apache.dolphinscheduler.alert.utils.Constants; +import org.apache.dolphinscheduler.alert.utils.PropertyUtils; +import org.apache.dolphinscheduler.common.plugin.FilePluginManager; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.DaoFactory; @@ -25,6 +28,7 @@ import org.apache.dolphinscheduler.dao.entity.Alert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.net.MalformedURLException; import java.util.List; /** @@ -41,34 +45,52 @@ public class AlertServer { private static AlertServer instance; - public AlertServer() { + private FilePluginManager alertPluginManager; + + private static final String[] whitePrefixes = new String[]{"org.apache.dolphinscheduler.plugin.utils."}; + + private static final String[] excludePrefixes = new String[]{ + "org.apache.dolphinscheduler.plugin.", + "ch.qos.logback.", + "org.slf4j." + }; + public AlertServer() { + try { + alertPluginManager = + new FilePluginManager(PropertyUtils.getString(Constants.PLUGIN_DIR), whitePrefixes, excludePrefixes); + // add default alert plugins + alertPluginManager.addPlugin(new EmailAlertPlugin()); + } catch (MalformedURLException e) { + logger.error("Failed to start alert server", e); + System.exit(1); + } } - public synchronized static AlertServer getInstance(){ + public synchronized static AlertServer getInstance() { if (null == instance) { instance = new AlertServer(); } return instance; } - public void start(){ + public void start() { logger.info("alert server ready start "); - while (Stopper.isRunning()){ + while (Stopper.isRunning()) { try { Thread.sleep(Constants.ALERT_SCAN_INTERVAL); } catch (InterruptedException e) { - logger.error(e.getMessage(),e); + logger.error(e.getMessage(), e); Thread.currentThread().interrupt(); } List alerts = alertDao.listWaitExecutionAlert(); - alertSender = new AlertSender(alerts, alertDao); + alertSender = new AlertSender(alerts, alertDao, alertPluginManager); alertSender.run(); } } - public static void main(String[] args){ + public static void main(String[] args) { AlertServer alertServer = AlertServer.getInstance(); alertServer.start(); } diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java index 047ee8bfed..8e78971594 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java @@ -35,7 +35,7 @@ public class EmailManager { * @param showType the showType * @return the send result */ - public Map send(List receviersList,List receviersCcList,String title,String content,ShowType showType){ + public Map send(List receviersList,List receviersCcList,String title,String content,String showType){ return MailUtils.sendMails(receviersList, receviersCcList, title, content, showType); } @@ -48,7 +48,7 @@ public class EmailManager { * @param showType the showType * @return the send result */ - public Map send(List receviersList,String title,String content,ShowType showType){ + public Map send(List receviersList,String title,String content,String showType){ return MailUtils.sendMails(receviersList,title, content, showType); } diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EnterpriseWeChatManager.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EnterpriseWeChatManager.java index bb06be6561..43649d6758 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EnterpriseWeChatManager.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EnterpriseWeChatManager.java @@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.alert.manager; import org.apache.dolphinscheduler.alert.utils.Constants; import org.apache.dolphinscheduler.alert.utils.EnterpriseWeChatUtils; -import org.apache.dolphinscheduler.dao.entity.Alert; +import org.apache.dolphinscheduler.plugin.model.AlertInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,18 +35,18 @@ public class EnterpriseWeChatManager { private static final Logger logger = LoggerFactory.getLogger(EnterpriseWeChatManager.class); /** * Enterprise We Chat send - * @param alert the alert + * @param alertInfo the alert info * @param token the token * @return the send result */ - public Map send(Alert alert, String token){ + public Map send(AlertInfo alertInfo, String token){ Map retMap = new HashMap<>(); retMap.put(Constants.STATUS, false); String agentId = EnterpriseWeChatUtils.ENTERPRISE_WE_CHAT_AGENT_ID; String users = EnterpriseWeChatUtils.ENTERPRISE_WE_CHAT_USERS; List userList = Arrays.asList(users.split(",")); - logger.info("send message {}",alert); - String msg = EnterpriseWeChatUtils.makeUserSendMsg(userList, agentId,EnterpriseWeChatUtils.markdownByAlert(alert)); + logger.info("send message {}", alertInfo.getAlertData().getTitle()); + String msg = EnterpriseWeChatUtils.makeUserSendMsg(userList, agentId,EnterpriseWeChatUtils.markdownByAlert(alertInfo.getAlertData())); try { EnterpriseWeChatUtils.sendEnterpriseWeChat(Constants.UTF_8, msg, token); } catch (IOException e) { diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java new file mode 100644 index 0000000000..d20306b153 --- /dev/null +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPlugin.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.alert.plugin; + +import org.apache.dolphinscheduler.alert.manager.EmailManager; +import org.apache.dolphinscheduler.alert.manager.EnterpriseWeChatManager; +import org.apache.dolphinscheduler.alert.utils.Constants; +import org.apache.dolphinscheduler.alert.utils.EnterpriseWeChatUtils; +import org.apache.dolphinscheduler.common.utils.CollectionUtils; +import org.apache.dolphinscheduler.common.utils.StringUtils; +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; +import org.apache.dolphinscheduler.plugin.model.AlertData; +import org.apache.dolphinscheduler.plugin.model.AlertInfo; +import org.apache.dolphinscheduler.plugin.model.PluginName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.*; + +/** + * EmailAlertPlugin + * + * This plugin is a default plugin, and mix up email and enterprise wechat, because adapt with former alert behavior + */ +public class EmailAlertPlugin implements AlertPlugin { + + private static final Logger logger = LoggerFactory.getLogger(EmailAlertPlugin.class); + + private PluginName pluginName; + + private static final EmailManager emailManager = new EmailManager(); + private static final EnterpriseWeChatManager weChatManager = new EnterpriseWeChatManager(); + + public EmailAlertPlugin() { + this.pluginName = new PluginName(); + this.pluginName.setEnglish(Constants.PLUGIN_DEFAULT_EMAIL_EN); + this.pluginName.setChinese(Constants.PLUGIN_DEFAULT_EMAIL_CH); + } + + @Override + public String getId() { + return Constants.PLUGIN_DEFAULT_EMAIL; + } + + @Override + public PluginName getName() { + return pluginName; + } + + @Override + @SuppressWarnings("unchecked") + public Map process(AlertInfo info) { + Map retMaps = new HashMap<>(); + + AlertData alert = info.getAlertData(); + + List receviersList = (List) info.getProp(Constants.PLUGIN_DEFAULT_EMAIL_RECEIVERS); + + // receiving group list + // custom receiver + String receivers = alert.getReceivers(); + if (StringUtils.isNotEmpty(receivers)) { + String[] splits = receivers.split(","); + receviersList.addAll(Arrays.asList(splits)); + } + + List receviersCcList = new ArrayList<>(); + // Custom Copier + String receiversCc = alert.getReceiversCc(); + if (StringUtils.isNotEmpty(receiversCc)) { + String[] splits = receiversCc.split(","); + receviersCcList.addAll(Arrays.asList(splits)); + } + + if (CollectionUtils.isEmpty(receviersList) && CollectionUtils.isEmpty(receviersCcList)) { + logger.warn("alert send error : At least one receiver address required"); + retMaps.put(Constants.STATUS, "false"); + retMaps.put(Constants.MESSAGE, "execution failure,At least one receiver address required."); + return retMaps; + } + + retMaps = emailManager.send(receviersList, receviersCcList, alert.getTitle(), alert.getContent(), + alert.getShowType()); + + //send flag + boolean flag = false; + + if (retMaps == null) { + retMaps = new HashMap<>(); + retMaps.put(Constants.MESSAGE, "alert send error."); + retMaps.put(Constants.STATUS, "false"); + logger.info("alert send error : {}", retMaps.get(Constants.MESSAGE)); + return retMaps; + } + + flag = Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS))); + + if (flag) { + logger.info("alert send success"); + retMaps.put(Constants.MESSAGE, "email send success."); + if (EnterpriseWeChatUtils.isEnable()) { + logger.info("Enterprise WeChat is enable!"); + try { + String token = EnterpriseWeChatUtils.getToken(); + weChatManager.send(info, token); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } + + } else { + retMaps.put(Constants.MESSAGE, "alert send error."); + logger.info("alert send error : {}", retMaps.get(Constants.MESSAGE)); + } + + return retMaps; + } + +} diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java index 5feb36b60f..071877ae54 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java @@ -16,44 +16,41 @@ */ package org.apache.dolphinscheduler.alert.runner; -import org.apache.dolphinscheduler.alert.manager.EmailManager; -import org.apache.dolphinscheduler.alert.manager.EnterpriseWeChatManager; import org.apache.dolphinscheduler.alert.utils.Constants; -import org.apache.dolphinscheduler.alert.utils.EnterpriseWeChatUtils; import org.apache.dolphinscheduler.common.enums.AlertStatus; -import org.apache.dolphinscheduler.common.enums.AlertType; -import org.apache.dolphinscheduler.common.utils.CollectionUtils; -import org.apache.dolphinscheduler.common.utils.StringUtils; +import org.apache.dolphinscheduler.common.plugin.PluginManager; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.dao.entity.User; +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; +import org.apache.dolphinscheduler.plugin.model.AlertData; +import org.apache.dolphinscheduler.plugin.model.AlertInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; /** * alert sender */ -public class AlertSender{ +public class AlertSender { private static final Logger logger = LoggerFactory.getLogger(AlertSender.class); - private static final EmailManager emailManager= new EmailManager(); - private static final EnterpriseWeChatManager weChatManager= new EnterpriseWeChatManager(); - - private List alertList; private AlertDao alertDao; + private PluginManager pluginManager; - public AlertSender(){} - public AlertSender(List alertList, AlertDao alertDao){ + public AlertSender() { + } + + public AlertSender(List alertList, AlertDao alertDao, PluginManager pluginManager) { super(); this.alertList = alertList; this.alertDao = alertDao; + this.pluginManager = pluginManager; } public void run() { @@ -61,92 +58,53 @@ public class AlertSender{ List users; Map retMaps = null; - for(Alert alert:alertList){ + for (Alert alert : alertList) { users = alertDao.listUserByAlertgroupId(alert.getAlertGroupId()); // receiving group list List receviersList = new ArrayList<>(); - for(User user:users){ + for (User user : users) { receviersList.add(user.getEmail()); } - // custom receiver - String receivers = alert.getReceivers(); - if (StringUtils.isNotEmpty(receivers)){ - String[] splits = receivers.split(","); - receviersList.addAll(Arrays.asList(splits)); - } - // copy list - List receviersCcList = new ArrayList<>(); + AlertData alertData = new AlertData(); + alertData.setId(alert.getId()) + .setAlertGroupId(alert.getAlertGroupId()) + .setContent(alert.getContent()) + .setLog(alert.getLog()) + .setReceivers(alert.getReceivers()) + .setReceiversCc(alert.getReceiversCc()) + .setShowType(alert.getShowType().getDescp()) + .setTitle(alert.getTitle()); + AlertInfo alertInfo = new AlertInfo(); + alertInfo.setAlertData(alertData); - // Custom Copier - String receiversCc = alert.getReceiversCc(); - - if (StringUtils.isNotEmpty(receiversCc)){ - String[] splits = receiversCc.split(","); - receviersCcList.addAll(Arrays.asList(splits)); - } - - if (CollectionUtils.isEmpty(receviersList) && CollectionUtils.isEmpty(receviersCcList)) { - logger.warn("alert send error : At least one receiver address required"); - alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, "execution failure,At least one receiver address required.", alert.getId()); - continue; - } + alertInfo.addProp("receivers", receviersList); - if (alert.getAlertType() == AlertType.EMAIL){ - retMaps = emailManager.send(receviersList,receviersCcList, alert.getTitle(), alert.getContent(),alert.getShowType()); + AlertPlugin emailPlugin = pluginManager.findOne(Constants.PLUGIN_DEFAULT_EMAIL); + retMaps = emailPlugin.process(alertInfo); - alert.setInfo(retMaps); - }else if (alert.getAlertType() == AlertType.SMS){ - retMaps = emailManager.send(getReciversForSMS(users), alert.getTitle(), alert.getContent(),alert.getShowType()); - alert.setInfo(retMaps); + if (retMaps == null || !Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS)))) { + alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, String.valueOf(retMaps.get(Constants.MESSAGE)), alert.getId()); + logger.info("alert send error : {}", retMaps.get(Constants.MESSAGE)); } else { - logger.error("AlertType is not defined. code: {}, descp: {}", - alert.getAlertType().getCode(), - alert.getAlertType().getDescp()); - return; - } - - //send flag - boolean flag = false; - - if (null != retMaps) { - flag = Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS))); - } - - if (flag) { - alertDao.updateAlert(AlertStatus.EXECUTION_SUCCESS, "execution success", alert.getId()); + alertDao.updateAlert(AlertStatus.EXECUTION_SUCCESS, (String) retMaps.get(Constants.MESSAGE), alert.getId()); logger.info("alert send success"); - if (EnterpriseWeChatUtils.isEnable()) { - logger.info("Enterprise WeChat is enable!"); - try { - String token = EnterpriseWeChatUtils.getToken(); - weChatManager.send(alert, token); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - } else { - if (null != retMaps) { - alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, String.valueOf(retMaps.get(Constants.MESSAGE)), alert.getId()); - logger.info("alert send error : {}", retMaps.get(Constants.MESSAGE)); - } } } } - /** * get a list of SMS users + * * @param users * @return */ - private List getReciversForSMS(List users){ + private List getReciversForSMS(List users) { List list = new ArrayList<>(); - for (User user : users){ + for (User user : users) { list.add(user.getPhone()); } return list; diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java index 28be8aa195..8fa38c62fc 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/Constants.java @@ -156,4 +156,21 @@ public class Constants { public static final String ENTERPRISE_WECHAT_AGENT_ID = "enterprise.wechat.agent.id"; public static final String ENTERPRISE_WECHAT_USERS = "enterprise.wechat.users"; + + /** + * plugin config + */ + public static final String PLUGIN_DIR = "plugin.dir"; + + public static final String PLUGIN_DEFAULT_EMAIL = "email"; + + public static final String PLUGIN_DEFAULT_EMAIL_CH = "邮件"; + + public static final String PLUGIN_DEFAULT_EMAIL_EN = "email"; + + public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERS = "receivers"; + + public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs"; + + public static final String RETMAP_MSG = "msg"; } diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java index 170c0dd37e..4613adaa55 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java @@ -22,6 +22,7 @@ import org.apache.dolphinscheduler.dao.entity.Alert; import com.alibaba.fastjson.JSON; import com.google.common.reflect.TypeToken; +import org.apache.dolphinscheduler.plugin.model.AlertData; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -253,14 +254,13 @@ public class EnterpriseWeChatUtils { /** * Determine the mardown style based on the show type of the alert - * @param alert the alert * @return the markdown alert table/text */ - public static String markdownByAlert(Alert alert){ + public static String markdownByAlert(AlertData alert){ String result = ""; - if (alert.getShowType() == ShowType.TABLE) { + if (alert.getShowType().equals(ShowType.TABLE.getDescp())) { result = markdownTable(alert.getTitle(),alert.getContent()); - }else if(alert.getShowType() == ShowType.TEXT){ + }else if(alert.getShowType().equals(ShowType.TEXT.getDescp())){ result = markdownText(alert.getTitle(),alert.getContent()); } return result; diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java index ef364cb1c2..bb565f5133 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/MailUtils.java @@ -74,7 +74,7 @@ public class MailUtils { * @param showType the show type * @return the result map */ - public static Map sendMails(Collection receivers, String title, String content,ShowType showType) { + public static Map sendMails(Collection receivers, String title, String content,String showType) { return sendMails(receivers, null, title, content, showType); } @@ -87,7 +87,7 @@ public class MailUtils { * @param showType the show type * @return the send result */ - public static Map sendMails(Collection receivers, Collection receiversCc, String title, String content, ShowType showType) { + public static Map sendMails(Collection receivers, Collection receiversCc, String title, String content, String showType) { Map retMap = new HashMap<>(); retMap.put(Constants.STATUS, false); @@ -98,7 +98,7 @@ public class MailUtils { receivers.removeIf(StringUtils::isEmpty); - if (showType == ShowType.TABLE || showType == ShowType.TEXT){ + if (showType.equals(ShowType.TABLE.getDescp()) || showType.equals(ShowType.TEXT.getDescp())) { // send email HtmlEmail email = new HtmlEmail(); @@ -125,10 +125,10 @@ public class MailUtils { } catch (Exception e) { handleException(receivers, retMap, e); } - }else if (showType == ShowType.ATTACHMENT || showType == ShowType.TABLEATTACHMENT){ + }else if (showType.equals(ShowType.ATTACHMENT.getDescp()) || showType.equals(ShowType.TABLEATTACHMENT.getDescp())) { try { - String partContent = (showType == ShowType.ATTACHMENT ? "Please see the attachment " + title + Constants.EXCEL_SUFFIX_XLS : htmlTable(content,false)); + String partContent = (showType.equals(ShowType.ATTACHMENT.getDescp()) ? "Please see the attachment " + title + Constants.EXCEL_SUFFIX_XLS : htmlTable(content,false)); attachment(receivers,receiversCc,title,content,partContent); @@ -290,7 +290,7 @@ public class MailUtils { * @return the result map * @throws EmailException */ - private static Map getStringObjectMap(String title, String content, ShowType showType, Map retMap, HtmlEmail email) throws EmailException { + private static Map getStringObjectMap(String title, String content, String showType, Map retMap, HtmlEmail email) throws EmailException { /** * the subject of the message to be sent @@ -299,9 +299,9 @@ public class MailUtils { /** * to send information, you can use HTML tags in mail content because of the use of HtmlEmail */ - if (showType == ShowType.TABLE) { + if (showType.equals(ShowType.TABLE.getDescp())) { email.setMsg(htmlTable(content)); - } else if (showType == ShowType.TEXT) { + } else if (showType.equals(ShowType.TEXT.getDescp())) { email.setMsg(htmlText(content)); } diff --git a/dolphinscheduler-alert/src/main/resources/alert.properties b/dolphinscheduler-alert/src/main/resources/alert.properties index 3e83c01235..19b55fec97 100644 --- a/dolphinscheduler-alert/src/main/resources/alert.properties +++ b/dolphinscheduler-alert/src/main/resources/alert.properties @@ -45,5 +45,5 @@ enterprise.wechat.enable=false #enterprise.wechat.team.send.msg={\"toparty\":\"$toParty\",\"agentid\":\"$agentId\",\"msgtype\":\"text\",\"text\":{\"content\":\"$msg\"},\"safe\":\"0\"} #enterprise.wechat.user.send.msg={\"touser\":\"$toUser\",\"agentid\":\"$agentId\",\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"$msg\"}} - +plugin.dir=/Users/xx/your/path/to/plugin/dir diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java new file mode 100644 index 0000000000..6c1f2f6d0d --- /dev/null +++ b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.alert.plugin; + +import org.apache.dolphinscheduler.alert.utils.Constants; +import org.apache.dolphinscheduler.common.enums.ShowType; +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; +import org.apache.dolphinscheduler.plugin.model.AlertData; +import org.apache.dolphinscheduler.plugin.model.AlertInfo; +import org.apache.dolphinscheduler.plugin.model.PluginName; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +public class EmailAlertPluginTest { + + private static final Logger logger = LoggerFactory.getLogger(EmailAlertPluginTest.class); + + private AlertPlugin plugin; + + @Before + public void before() { + plugin = new EmailAlertPlugin(); + } + + @Test + public void getId() { + String id = plugin.getId(); + assertEquals(Constants.PLUGIN_DEFAULT_EMAIL, id); + } + + @Test + public void getName() { + PluginName pluginName = plugin.getName(); + assertEquals(Constants.PLUGIN_DEFAULT_EMAIL_CH, pluginName.getChinese()); + assertEquals(Constants.PLUGIN_DEFAULT_EMAIL_EN, pluginName.getEnglish()); + } + + @Test + public void process() { + AlertInfo alertInfo = new AlertInfo(); + AlertData alertData = new AlertData(); + alertData.setId(1) + .setAlertGroupId(1) + .setContent("[\"alarm time:2018-02-05\", \"service name:MYSQL_ALTER\", \"alarm name:MYSQL_ALTER_DUMP\", " + + "\"get the alarm exception.!,interface error,exception information:timed out\", \"request address:http://blog.csdn.net/dreamInTheWorld/article/details/78539286\"]") + .setLog("test log") + .setReceivers("bitace@163.com") + .setReceiversCc("bitace@163.com") + .setShowType(ShowType.TEXT.getDescp()) + .setTitle("test title"); + + alertInfo.setAlertData(alertData); + List list = new ArrayList(){{ add("bitace@163.com"); }}; + alertInfo.addProp("receivers", list); + plugin.process(alertInfo); + } +} \ No newline at end of file diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtilsTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtilsTest.java index d0f3538c1b..2b405cc436 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtilsTest.java +++ b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtilsTest.java @@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSON; import org.apache.dolphinscheduler.common.enums.AlertType; import org.apache.dolphinscheduler.common.enums.ShowType; import org.apache.dolphinscheduler.dao.entity.Alert; +import org.apache.dolphinscheduler.plugin.model.AlertData; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; @@ -120,14 +121,22 @@ public class EnterpriseWeChatUtilsTest { @Test public void testMarkdownByAlertForText(){ Alert alertForText = createAlertForText(); - String result = EnterpriseWeChatUtils.markdownByAlert(alertForText); + AlertData alertData = new AlertData(); + alertData.setTitle(alertForText.getTitle()) + .setShowType(alertForText.getShowType().getDescp()) + .setContent(alertForText.getContent()); + String result = EnterpriseWeChatUtils.markdownByAlert(alertData); Assert.assertNotNull(result); } @Test public void testMarkdownByAlertForTable(){ Alert alertForText = createAlertForTable(); - String result = EnterpriseWeChatUtils.markdownByAlert(alertForText); + AlertData alertData = new AlertData(); + alertData.setTitle(alertForText.getTitle()) + .setShowType(alertForText.getShowType().getDescp()) + .setContent(alertForText.getContent()); + String result = EnterpriseWeChatUtils.markdownByAlert(alertData); Assert.assertNotNull(result); } diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/MailUtilsTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/MailUtilsTest.java index 1820a1ef89..11322da0e3 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/MailUtilsTest.java +++ b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/MailUtilsTest.java @@ -58,7 +58,7 @@ public class MailUtilsTest { alert.setAlertType(AlertType.EMAIL); alert.setAlertGroupId(4); - MailUtils.sendMails(Arrays.asList(receivers),Arrays.asList(receiversCc),alert.getTitle(),alert.getContent(), ShowType.TEXT); + MailUtils.sendMails(Arrays.asList(receivers),Arrays.asList(receiversCc),alert.getTitle(),alert.getContent(), ShowType.TEXT.getDescp()); } @@ -70,7 +70,7 @@ public class MailUtilsTest { String[] mails = new String[]{"xx@xx.com"}; for(Alert alert : alerts){ - MailUtils.sendMails(Arrays.asList(mails),"gaojing", alert.getContent(), alert.getShowType()); + MailUtils.sendMails(Arrays.asList(mails),"gaojing", alert.getContent(), ShowType.TABLE.getDescp()); } } @@ -111,7 +111,7 @@ public class MailUtilsTest { alert.setContent(content); alert.setAlertType(AlertType.EMAIL); alert.setAlertGroupId(1); - MailUtils.sendMails(Arrays.asList(mails),"gaojing", alert.getContent(), ShowType.TABLE); + MailUtils.sendMails(Arrays.asList(mails),"gaojing", alert.getContent(), ShowType.TABLE.getDescp()); } /** @@ -170,7 +170,7 @@ public class MailUtilsTest { alert.setContent(content); alert.setAlertType(AlertType.EMAIL); alert.setAlertGroupId(1); - MailUtils.sendMails(Arrays.asList(mails),"gaojing",alert.getContent(),ShowType.ATTACHMENT); + MailUtils.sendMails(Arrays.asList(mails),"gaojing",alert.getContent(),ShowType.ATTACHMENT.getDescp()); } @Test @@ -183,7 +183,7 @@ public class MailUtilsTest { alert.setContent(content); alert.setAlertType(AlertType.EMAIL); alert.setAlertGroupId(1); - MailUtils.sendMails(Arrays.asList(mails),"gaojing",alert.getContent(),ShowType.TABLEATTACHMENT); + MailUtils.sendMails(Arrays.asList(mails),"gaojing",alert.getContent(),ShowType.TABLEATTACHMENT.getDescp()); } } diff --git a/dolphinscheduler-common/pom.xml b/dolphinscheduler-common/pom.xml index ca75a84a62..3954159dfa 100644 --- a/dolphinscheduler-common/pom.xml +++ b/dolphinscheduler-common/pom.xml @@ -32,12 +32,15 @@ 3.1.0 + + org.apache.dolphinscheduler + dolphinscheduler-plugin-api + com.alibaba fastjson compile - org.apache.httpcomponents httpclient diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index 853ab95d1c..effa4f0f8e 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -954,4 +954,11 @@ public final class Constants { * authorize readable perm */ public static final int AUTHORIZE_READABLE_PERM=4; + + + /** + * plugin configurations + */ + public static final String PLUGIN_JAR_SUFFIX = ".jar"; + } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java new file mode 100644 index 0000000000..1a260f25cd --- /dev/null +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.common.plugin; + +import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; +import org.apache.dolphinscheduler.plugin.spi.AlertPluginProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.concurrent.ConcurrentHashMap; + +/** + * FilePluginManager + */ +public class FilePluginManager implements PluginManager { + + private static final Logger logger = LoggerFactory.getLogger(FilePluginManager.class); + + private Map pluginMap = new ConcurrentHashMap<>(); + + private Map> pluginLoaderMap = new ConcurrentHashMap<>(); + + private Map classLoaderMap = new ConcurrentHashMap<>(); + + public FilePluginManager(String dirPath, String[] whitePrefixes, String[] excludePrefixes) throws MalformedURLException { + logger.info("start to load jar files in {}", dirPath); + File[] files = new File(dirPath).listFiles(); + if (files == null) { + logger.error("not a valid path - {}", dirPath); + System.exit(1); + } + for (File file : files) { + if (file.isDirectory() && !file.getPath().endsWith(Constants.PLUGIN_JAR_SUFFIX)) { + continue; + } + String pluginName = file.getName() + .substring(0, file.getName().length() - Constants.PLUGIN_JAR_SUFFIX.length()); + URL[] urls = new URL[]{ file.toURI().toURL() }; + PluginClassLoader classLoader = + new PluginClassLoader(urls, Thread.currentThread().getContextClassLoader(), whitePrefixes, excludePrefixes); + classLoaderMap.put(pluginName, classLoader); + + ServiceLoader loader = ServiceLoader.load(AlertPluginProvider.class, classLoader); + pluginLoaderMap.put(pluginName, loader); + + loader.forEach(provider -> { + AlertPlugin plugin = provider.createPlugin(); + pluginMap.put(plugin.getId(), plugin); + logger.info("loaded plugin - {}", plugin.getId()); + }); + } + } + + @Override + public AlertPlugin findOne(String name) { + return pluginMap.get(name); + } + + @Override + public Map findAll() { + return pluginMap; + } + + @Override + public void addPlugin(AlertPlugin plugin) { + pluginMap.put(plugin.getId(), plugin); + } + +} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java new file mode 100644 index 0000000000..8579e1cd96 --- /dev/null +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java @@ -0,0 +1,134 @@ +package org.apache.dolphinscheduler.common.plugin; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +/** + * Plugin Class Loader + */ +public class PluginClassLoader extends URLClassLoader { + + private static final Logger logger = LoggerFactory.getLogger(PluginClassLoader.class); + + private static final String JAVA_PACKAGE_PREFIX = "java."; + private static final String JAVAX_PACKAGE_PREFIX = "javax."; + + private final String[] whitePrefixes; + + private final String[] excludePrefixes; + + public PluginClassLoader(URL[] urls, ClassLoader parent, String[] whitePrefix, String[] excludePreifx) { + super(urls, parent); + this.whitePrefixes = whitePrefix; + this.excludePrefixes = excludePreifx; + } + + @Override + public Class loadClass(String name) throws ClassNotFoundException { + logger.trace("Received request to load class '{}'", name); + synchronized (getClassLoadingLock(name)) { + if (name.startsWith(JAVA_PACKAGE_PREFIX) || name.startsWith(JAVAX_PACKAGE_PREFIX)) { + return findSystemClass(name); + } + + boolean isWhitePrefixes = fromWhitePrefix(name); + boolean isExcludePrefixed = fromExcludePrefix(name); + + // if the class is part of the plugin engine use parent class loader + if (!isWhitePrefixes && isExcludePrefixed) { + return getParent().loadClass(name); + } + + // check whether it's already been loaded + Class loadedClass = findLoadedClass(name); + if (loadedClass != null) { + logger.debug("Found loaded class '{}'", name); + return loadedClass; + } + + // nope, try to load locally + try { + loadedClass = findClass(name); + logger.debug("Found class '{}' in plugin classpath", name); + return loadedClass; + } catch (ClassNotFoundException e) { + // try next step + } + + // use the standard ClassLoader (which follows normal parent delegation) + return super.loadClass(name); + } + } + + private boolean fromWhitePrefix(String name) { + for (String whitePrefix : this.whitePrefixes) { + if (name.startsWith(whitePrefix)) { + return true; + } + } + return false; + } + + private boolean fromExcludePrefix(String name) { + for (String excludePrefix : this.excludePrefixes) { + if (name.startsWith(excludePrefix)) { + return true; + } + } + return false; + } + + @Override + public Enumeration getResources(String name) throws IOException { + List allRes = new LinkedList<>(); + + Enumeration thisRes = findResources(name); + if (thisRes != null) { + while (thisRes.hasMoreElements()) { + allRes.add(thisRes.nextElement()); + } + } + + Enumeration parentRes = super.findResources(name); + if (parentRes != null) { + while (parentRes.hasMoreElements()) { + allRes.add(parentRes.nextElement()); + } + } + + return new Enumeration() { + Iterator it = allRes.iterator(); + + @Override + public boolean hasMoreElements() { + return it.hasNext(); + } + + @Override + public URL nextElement() { + return it.next(); + } + }; + } + + @Override + public URL getResource(String name) { + URL res = null; + + if (res == null) { + res = findResource(name); + } + if (res == null) { + res = super.getResource(name); + } + return res; + } +} diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginManager.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginManager.java new file mode 100644 index 0000000000..f8078841e4 --- /dev/null +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginManager.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.common.plugin; + +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; + +import java.util.Map; + +/** + * PluginManager + */ +public interface PluginManager { + + AlertPlugin findOne(String name); + + Map findAll(); + + void addPlugin(AlertPlugin plugin); +} diff --git a/dolphinscheduler-plugin-api/pom.xml b/dolphinscheduler-plugin-api/pom.xml new file mode 100644 index 0000000000..54160ea720 --- /dev/null +++ b/dolphinscheduler-plugin-api/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + org.apache.dolphinscheduler + dolphinscheduler + 1.2.1-SNAPSHOT + + dolphinscheduler-plugin-api + ${project.artifactId} + jar + + + UTF-8 + + + + + org.slf4j + slf4j-api + + + junit + junit + test + + + commons-io + commons-io + + + + diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/api/AlertPlugin.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/api/AlertPlugin.java new file mode 100644 index 0000000000..deb7ff6aa4 --- /dev/null +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/api/AlertPlugin.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.api; + +import org.apache.dolphinscheduler.plugin.model.AlertInfo; +import org.apache.dolphinscheduler.plugin.model.PluginName; + +import java.util.Map; + +/** + * Plugin + */ +public interface AlertPlugin { + + /** + * Get alert plugin id + * + * @return alert plugin id, which should be unique + */ + String getId(); + + /** + * Get alert plugin name, which will show in front end portal + * + * @return plugin name + */ + PluginName getName(); + + Map process(AlertInfo info); + +} diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java new file mode 100644 index 0000000000..4a277b509c --- /dev/null +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java @@ -0,0 +1,125 @@ +package org.apache.dolphinscheduler.plugin.model; + +/** + * AlertData + */ +public class AlertData { + + /** + * alert primary key + */ + private int id; + /** + * title + */ + private String title; + /** + * content + */ + private String content; + /** + * log + */ + private String log; + /** + * alertgroup_id + */ + private int alertGroupId; + /** + * receivers + */ + private String receivers; + /** + * show_type + */ + private String showType; + /** + * receivers_cc + */ + private String receiversCc; + + public AlertData() { + } + + public int getId() { + return id; + } + + public AlertData setId(int id) { + this.id = id; + return this; + } + + public String getTitle() { + return title; + } + + public AlertData setTitle(String title) { + this.title = title; + return this; + } + + public String getContent() { + return content; + } + + public AlertData setContent(String content) { + this.content = content; + return this; + } + + public String getLog() { + return log; + } + + public AlertData setLog(String log) { + this.log = log; + return this; + } + + public int getAlertGroupId() { + return alertGroupId; + } + + public AlertData setAlertGroupId(int alertGroupId) { + this.alertGroupId = alertGroupId; + return this; + } + + public String getReceivers() { + return receivers; + } + + public AlertData setReceivers(String receivers) { + this.receivers = receivers; + return this; + } + + public String getReceiversCc() { + return receiversCc; + } + + public AlertData setReceiversCc(String receiversCc) { + this.receiversCc = receiversCc; + return this; + } + + public String getShowType() { + return showType; + } + + public AlertData setShowType(String showType) { + this.showType = showType; + return this; + } + + public AlertData(int id, String title, String content, String log, int alertGroupId, String receivers, String receiversCc) { + this.id = id; + this.title = title; + this.content = content; + this.log = log; + this.alertGroupId = alertGroupId; + this.receivers = receivers; + this.receiversCc = receiversCc; + } +} diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertInfo.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertInfo.java new file mode 100644 index 0000000000..1d71ed7d8a --- /dev/null +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertInfo.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.model; + +import java.util.HashMap; +import java.util.Map; + +/** + * AlertInfo + */ +public class AlertInfo { + + private Map alertProps; + + private AlertData alertData; + + public AlertInfo() { + this.alertProps = new HashMap<>(); + } + + public Map getAlertProps() { + return alertProps; + } + + public AlertInfo setAlertProps(Map alertProps) { + this.alertProps = alertProps; + return this; + } + + public AlertInfo addProp(String key, Object value) { + this.alertProps.put(key, value); + return this; + } + + public Object getProp(String key) { + return this.alertProps.get(key); + } + + public AlertData getAlertData() { + return alertData; + } + + public AlertInfo setAlertData(AlertData alertData) { + this.alertData = alertData; + return this; + } +} diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/PluginName.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/PluginName.java new file mode 100644 index 0000000000..8066e45f1d --- /dev/null +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/PluginName.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.model; + +/** + * PluginName + */ +public class PluginName { + + private String chinese; + + private String english; + + public String getChinese() { + return chinese; + } + + public PluginName setChinese(String chinese) { + this.chinese = chinese; + return this; + } + + public String getEnglish() { + return english; + } + + public PluginName setEnglish(String english) { + this.english = english; + return this; + } +} diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/spi/AlertPluginProvider.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/spi/AlertPluginProvider.java new file mode 100644 index 0000000000..594636f4eb --- /dev/null +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/spi/AlertPluginProvider.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.spi; + +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; + +/** + * PluginProvider + */ +public interface AlertPluginProvider { + + /** + * create an alert plugin + * + * @return an alert plugin + */ + AlertPlugin createPlugin(); + +} diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java new file mode 100644 index 0000000000..21970fddcb --- /dev/null +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java @@ -0,0 +1,232 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.utils; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * property utils + * single instance + */ +public class PropertyUtils { + + /** + * logger + */ + private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class); + + private static final Properties properties = new Properties(); + + private PropertyUtils() { + throw new IllegalStateException("PropertyUtils class"); + } + + static { + String[] propertyFiles = new String[]{"/plugin.properties"}; + for (String fileName : propertyFiles) { + InputStream fis = null; + try { + fis = PropertyUtils.class.getResourceAsStream(fileName); + properties.load(fis); + + } catch (IOException e) { + logger.error(e.getMessage(), e); + if (fis != null) { + IOUtils.closeQuietly(fis); + } + System.exit(1); + } finally { + IOUtils.closeQuietly(fis); + } + } + } + + /** + * get property value + * + * @param key property name + * @return property value + */ + public static String getString(String key) { + if (key == null) { + return null; + } + return properties.getProperty(key.trim()); + } + + /** + * get property value + * + * @param key property name + * @param defaultVal default value + * @return property value + */ + public static String getString(String key, String defaultVal) { + String val = properties.getProperty(key.trim()); + return val == null ? defaultVal : val; + } + + /** + * get property value + * + * @param key property name + * @return get property int value , if key == null, then return -1 + */ + public static int getInt(String key) { + return getInt(key, -1); + } + + /** + * + * @param key key + * @param defaultValue default value + * @return property value + */ + public static int getInt(String key, int defaultValue) { + String value = getString(key); + if (value == null) { + return defaultValue; + } + + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + logger.info(e.getMessage(),e); + } + return defaultValue; + } + + /** + * get property value + * + * @param key property name + * @return property value + */ + public static boolean getBoolean(String key) { + String value = properties.getProperty(key.trim()); + if(null != value){ + return Boolean.parseBoolean(value); + } + + return false; + } + + /** + * get property value + * + * @param key property name + * @param defaultValue default value + * @return property value + */ + public static Boolean getBoolean(String key, boolean defaultValue) { + String value = properties.getProperty(key.trim()); + if(null != value){ + return Boolean.parseBoolean(value); + } + + return defaultValue; + } + + /** + * get property long value + * @param key key + * @param defaultVal default value + * @return property value + */ + public static long getLong(String key, long defaultVal) { + String val = getString(key); + return val == null ? defaultVal : Long.parseLong(val); + } + + /** + * + * @param key key + * @return property value + */ + public static long getLong(String key) { + return getLong(key,-1); + } + + /** + * + * @param key key + * @param defaultVal default value + * @return property value + */ + public static double getDouble(String key, double defaultVal) { + String val = getString(key); + return val == null ? defaultVal : Double.parseDouble(val); + } + + + /** + * get array + * @param key property name + * @param splitStr separator + * @return property value through array + */ + public static String[] getArray(String key, String splitStr) { + String value = getString(key); + if (value == null) { + return new String[0]; + } + try { + String[] propertyArray = value.split(splitStr); + return propertyArray; + } catch (NumberFormatException e) { + logger.info(e.getMessage(),e); + } + return new String[0]; + } + + /** + * + * @param key key + * @param type type + * @param defaultValue default value + * @param T + * @return get enum value + */ + public > T getEnum(String key, Class type, + T defaultValue) { + String val = getString(key); + return val == null ? defaultValue : Enum.valueOf(type, val); + } + + /** + * get all properties with specified prefix, like: fs. + * @param prefix prefix to search + * @return all properties with specified prefix + */ + public static Map getPrefixedProperties(String prefix) { + Map matchedProperties = new HashMap<>(); + for (String propName : properties.stringPropertyNames()) { + if (propName.startsWith(prefix)) { + matchedProperties.put(propName, properties.getProperty(propName)); + } + } + return matchedProperties; + } +} diff --git a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java new file mode 100644 index 0000000000..2911cf7485 --- /dev/null +++ b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java @@ -0,0 +1,67 @@ +package org.apache.dolphinscheduler.plugin.utils; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.*; + +public class PropertyUtilsTest { + + private static final Logger logger = LoggerFactory.getLogger(PropertyUtilsTest.class); + + /** + * Test getString + */ + @Test + public void testGetString() { + + String result = PropertyUtils.getString("test.string"); + logger.info(result); + assertEquals("teststring", result); + + //If key is null, then return null + result = PropertyUtils.getString(null); + assertNull(result); + } + + + /** + * Test getBoolean + */ + @Test + public void testGetBoolean() { + + //Expected true + Boolean result = PropertyUtils.getBoolean("test.true"); + assertTrue(result); + + //Expected false + result = PropertyUtils.getBoolean("test.false"); + assertFalse(result); + } + + /** + * Test getLong + */ + @Test + public void testGetLong() { + long result = PropertyUtils.getLong("test.long"); + assertSame(result, 100L); + } + + /** + * Test getDouble + */ + @Test + public void testGetDouble() { + + //If key is undefine in alert.properties, and there is a defaultval, then return defaultval + double result = PropertyUtils.getDouble("abc", 5.0); + assertEquals(result, 5.0, 0); + + result = PropertyUtils.getDouble("cba", 5.0); + assertEquals(3.1, result, 0.01); + } + +} \ No newline at end of file diff --git a/dolphinscheduler-plugin-api/src/test/resources/plugin.properties b/dolphinscheduler-plugin-api/src/test/resources/plugin.properties new file mode 100644 index 0000000000..b3151c72d7 --- /dev/null +++ b/dolphinscheduler-plugin-api/src/test/resources/plugin.properties @@ -0,0 +1,5 @@ +test.string=teststring +test.false=false +test.true=true +cba=3.1 +test.long=100 \ No newline at end of file diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java index 84e4e54a50..ccd4bb2214 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java @@ -457,7 +457,7 @@ public class SqlTask extends AbstractTask { String showTypeName = sqlParameters.getShowType().replace(COMMA,"").trim(); if(EnumUtils.isValidEnum(ShowType.class,showTypeName)){ Map mailResult = MailUtils.sendMails(receviersList, - receviersCcList, title, content, ShowType.valueOf(showTypeName)); + receviersCcList, title, content, ShowType.valueOf(showTypeName).getDescp()); if(!(boolean) mailResult.get(STATUS)){ throw new RuntimeException("send mail failed!"); } diff --git a/pom.xml b/pom.xml index dad1e3696b..52339cd183 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,6 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - 4.0.0 @@ -205,6 +204,11 @@ dolphinscheduler-server ${project.version} + + org.apache.dolphinscheduler + dolphinscheduler-plugin-api + ${project.version} + org.apache.dolphinscheduler dolphinscheduler-common @@ -346,7 +350,7 @@ mysql mysql-connector-java ${mysql.connector.version} - test + com.h2database @@ -974,6 +978,7 @@ dolphinscheduler-dist dolphinscheduler-remote dolphinscheduler-service + dolphinscheduler-plugin-api - + \ No newline at end of file From 3c6d813617376b2e3bcb04838104b4986eeb1f72 Mon Sep 17 00:00:00 2001 From: hgaol Date: Wed, 29 Apr 2020 12:30:30 +0800 Subject: [PATCH 15/33] add license to plugin api pom file --- .../common/plugin/PluginClassLoader.java | 16 ++++++++++++++++ dolphinscheduler-plugin-api/pom.xml | 17 +++++++++++++++++ .../plugin/model/AlertData.java | 16 ++++++++++++++++ .../plugin/utils/PropertyUtilsTest.java | 16 ++++++++++++++++ .../src/test/resources/plugin.properties | 17 +++++++++++++++++ 5 files changed, 82 insertions(+) diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java index 8579e1cd96..8700fbf474 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.dolphinscheduler.common.plugin; import org.slf4j.Logger; diff --git a/dolphinscheduler-plugin-api/pom.xml b/dolphinscheduler-plugin-api/pom.xml index 54160ea720..b958b21616 100644 --- a/dolphinscheduler-plugin-api/pom.xml +++ b/dolphinscheduler-plugin-api/pom.xml @@ -1,4 +1,21 @@ + + diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java index 4a277b509c..da6576f7c6 100644 --- a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.dolphinscheduler.plugin.model; /** diff --git a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java index 2911cf7485..5620857698 100644 --- a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java +++ b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.dolphinscheduler.plugin.utils; import org.junit.Test; diff --git a/dolphinscheduler-plugin-api/src/test/resources/plugin.properties b/dolphinscheduler-plugin-api/src/test/resources/plugin.properties index b3151c72d7..d2ea3831be 100644 --- a/dolphinscheduler-plugin-api/src/test/resources/plugin.properties +++ b/dolphinscheduler-plugin-api/src/test/resources/plugin.properties @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + test.string=teststring test.false=false test.true=true From 906ffa09a9387d560b8e1e2c0177e87e3368ebf2 Mon Sep 17 00:00:00 2001 From: hgaol Date: Wed, 29 Apr 2020 13:37:27 +0800 Subject: [PATCH 16/33] resolve code checks --- .../dolphinscheduler/alert/AlertServer.java | 14 +- .../alert/manager/EmailManager.java | 1 - .../alert/runner/AlertSender.java | 20 +-- .../alert/utils/EnterpriseWeChatUtils.java | 9 +- .../alert/plugin/EmailAlertPluginTest.java | 10 +- .../common/plugin/FilePluginManager.java | 22 ++- .../common/plugin/PluginClassLoader.java | 10 +- .../common/plugin/FilePluginManagerTest.java | 72 ++++++++++ .../common/plugin/PluginClassLoaderTest.java | 61 ++++++++ .../plugin/model/AlertData.java | 12 -- .../plugin/utils/PropertyUtils.java | 130 ++++++------------ .../plugin/model/AlertDataTest.java | 80 +++++++++++ .../plugin/model/AlertInfoTest.java | 54 ++++++++ .../plugin/utils/PropertyUtilsTest.java | 4 +- pom.xml | 11 +- 15 files changed, 367 insertions(+), 143 deletions(-) create mode 100644 dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/FilePluginManagerTest.java create mode 100644 dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoaderTest.java create mode 100644 dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertDataTest.java create mode 100644 dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertInfoTest.java diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java index dafa33adac..347336cada 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java @@ -28,7 +28,6 @@ import org.apache.dolphinscheduler.dao.entity.Alert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.net.MalformedURLException; import java.util.List; /** @@ -56,15 +55,10 @@ public class AlertServer { }; public AlertServer() { - try { - alertPluginManager = - new FilePluginManager(PropertyUtils.getString(Constants.PLUGIN_DIR), whitePrefixes, excludePrefixes); - // add default alert plugins - alertPluginManager.addPlugin(new EmailAlertPlugin()); - } catch (MalformedURLException e) { - logger.error("Failed to start alert server", e); - System.exit(1); - } + alertPluginManager = + new FilePluginManager(PropertyUtils.getString(Constants.PLUGIN_DIR), whitePrefixes, excludePrefixes); + // add default alert plugins + alertPluginManager.addPlugin(new EmailAlertPlugin()); } public synchronized static AlertServer getInstance() { diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java index 8e78971594..96feb7f09e 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/manager/EmailManager.java @@ -17,7 +17,6 @@ package org.apache.dolphinscheduler.alert.manager; import org.apache.dolphinscheduler.alert.utils.MailUtils; -import org.apache.dolphinscheduler.common.enums.ShowType; import java.util.List; import java.util.Map; diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java index 071877ae54..d3ac852b0f 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/runner/AlertSender.java @@ -54,9 +54,7 @@ public class AlertSender { } public void run() { - List users; - Map retMaps = null; for (Alert alert : alertList) { users = alertDao.listUserByAlertgroupId(alert.getAlertGroupId()); @@ -85,7 +83,10 @@ public class AlertSender { AlertPlugin emailPlugin = pluginManager.findOne(Constants.PLUGIN_DEFAULT_EMAIL); retMaps = emailPlugin.process(alertInfo); - if (retMaps == null || !Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS)))) { + if (retMaps == null) { + alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, "alert send error", alert.getId()); + logger.info("alert send error : return value is null"); + } else if (!Boolean.parseBoolean(String.valueOf(retMaps.get(Constants.STATUS)))) { alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, String.valueOf(retMaps.get(Constants.MESSAGE)), alert.getId()); logger.info("alert send error : {}", retMaps.get(Constants.MESSAGE)); } else { @@ -96,17 +97,4 @@ public class AlertSender { } - /** - * get a list of SMS users - * - * @param users - * @return - */ - private List getReciversForSMS(List users) { - List list = new ArrayList<>(); - for (User user : users) { - list.add(user.getPhone()); - } - return list; - } } diff --git a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java index 4613adaa55..d199d154aa 100644 --- a/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java +++ b/dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java @@ -18,7 +18,6 @@ package org.apache.dolphinscheduler.alert.utils; import org.apache.dolphinscheduler.common.enums.ShowType; import org.apache.dolphinscheduler.common.utils.StringUtils; -import org.apache.dolphinscheduler.dao.entity.Alert; import com.alibaba.fastjson.JSON; import com.google.common.reflect.TypeToken; @@ -67,15 +66,17 @@ public class EnterpriseWeChatUtils { * get Enterprise WeChat is enable * @return isEnable */ - public static Boolean isEnable(){ - Boolean isEnable = false; + public static boolean isEnable(){ + Boolean isEnable = null; try { isEnable = PropertyUtils.getBoolean(Constants.ENTERPRISE_WECHAT_ENABLE); } catch (Exception e) { logger.error(e.getMessage(),e); } + if (isEnable == null) { + return false; + } return isEnable; - } /** diff --git a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java index 6c1f2f6d0d..52c2fc050e 100644 --- a/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java +++ b/dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/plugin/EmailAlertPluginTest.java @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; +import java.util.Map; import static org.junit.Assert.*; @@ -65,14 +66,15 @@ public class EmailAlertPluginTest { .setContent("[\"alarm time:2018-02-05\", \"service name:MYSQL_ALTER\", \"alarm name:MYSQL_ALTER_DUMP\", " + "\"get the alarm exception.!,interface error,exception information:timed out\", \"request address:http://blog.csdn.net/dreamInTheWorld/article/details/78539286\"]") .setLog("test log") - .setReceivers("bitace@163.com") - .setReceiversCc("bitace@163.com") + .setReceivers("xx@xx.com") + .setReceiversCc("xx@xx.com") .setShowType(ShowType.TEXT.getDescp()) .setTitle("test title"); alertInfo.setAlertData(alertData); - List list = new ArrayList(){{ add("bitace@163.com"); }}; + List list = new ArrayList(){{ add("xx@xx.com"); }}; alertInfo.addProp("receivers", list); - plugin.process(alertInfo); + Map ret = plugin.process(alertInfo); + assertFalse(Boolean.parseBoolean(String.valueOf(ret.get(Constants.STATUS)))); } } \ No newline at end of file diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java index 1a260f25cd..d4dd4bf283 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/FilePluginManager.java @@ -42,12 +42,30 @@ public class FilePluginManager implements PluginManager { private Map classLoaderMap = new ConcurrentHashMap<>(); - public FilePluginManager(String dirPath, String[] whitePrefixes, String[] excludePrefixes) throws MalformedURLException { + private String[] whitePrefixes; + + private String[] excludePrefixes; + + public FilePluginManager(String dirPath, String[] whitePrefixes, String[] excludePrefixes) { + this.whitePrefixes = whitePrefixes; + this.excludePrefixes = excludePrefixes; + try { + load(dirPath); + } catch (MalformedURLException e) { + logger.error("load plugins failed.", e); + } + } + + private void load(String dirPath) throws MalformedURLException { logger.info("start to load jar files in {}", dirPath); + if (dirPath == null) { + logger.error("not a valid path - {}", dirPath); + return; + } File[] files = new File(dirPath).listFiles(); if (files == null) { logger.error("not a valid path - {}", dirPath); - System.exit(1); + return; } for (File file : files) { if (file.isDirectory() && !file.getPath().endsWith(Constants.PLUGIN_JAR_SUFFIX)) { diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java index 8700fbf474..528e83a59c 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoader.java @@ -85,6 +85,9 @@ public class PluginClassLoader extends URLClassLoader { } private boolean fromWhitePrefix(String name) { + if (this.whitePrefixes == null) { + return false; + } for (String whitePrefix : this.whitePrefixes) { if (name.startsWith(whitePrefix)) { return true; @@ -94,6 +97,9 @@ public class PluginClassLoader extends URLClassLoader { } private boolean fromExcludePrefix(String name) { + if (this.excludePrefixes == null) { + return false; + } for (String excludePrefix : this.excludePrefixes) { if (name.startsWith(excludePrefix)) { return true; @@ -139,9 +145,7 @@ public class PluginClassLoader extends URLClassLoader { public URL getResource(String name) { URL res = null; - if (res == null) { - res = findResource(name); - } + res = findResource(name); if (res == null) { res = super.getResource(name); } diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/FilePluginManagerTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/FilePluginManagerTest.java new file mode 100644 index 0000000000..1a57cb10fa --- /dev/null +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/FilePluginManagerTest.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.common.plugin; + +import org.apache.dolphinscheduler.plugin.api.AlertPlugin; +import org.apache.dolphinscheduler.plugin.model.AlertInfo; +import org.apache.dolphinscheduler.plugin.model.PluginName; +import org.junit.Before; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.*; + +public class FilePluginManagerTest { + + private FilePluginManager filePluginManager; + private AlertPlugin alertPlugin; + + @Before + public void before() { + filePluginManager = new FilePluginManager(null, null, null); + alertPlugin = new AlertPlugin() { + @Override + public String getId() { + return "test"; + } + + @Override + public PluginName getName() { + return new PluginName().setChinese("ch").setEnglish("en"); + } + + @Override + public Map process(AlertInfo info) { + return new HashMap<>(); + } + }; + } + + @Test + public void findOne() { + filePluginManager.addPlugin(alertPlugin); + assertEquals(alertPlugin, filePluginManager.findOne(alertPlugin.getId())); + } + + @Test + public void findAll() { + assertNotNull(filePluginManager.findAll()); + } + + @Test + public void addPlugin() { + filePluginManager.addPlugin(alertPlugin); + assertNotNull(filePluginManager.findAll()); + } +} \ No newline at end of file diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoaderTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoaderTest.java new file mode 100644 index 0000000000..8a6bfaee13 --- /dev/null +++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/plugin/PluginClassLoaderTest.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.common.plugin; + +import org.junit.Before; +import org.junit.Test; + +import java.net.URL; + +import static org.junit.Assert.*; + +public class PluginClassLoaderTest { + + private PluginClassLoader pluginClassLoader; + private ClassLoader parent; + + @Before + public void setUp() { + parent = Thread.currentThread().getContextClassLoader(); + pluginClassLoader = new PluginClassLoader( + new URL[]{}, parent, + null, null); + } + + @Test + public void loadClassNull() { + Class clazz = null; + try { + clazz = pluginClassLoader.loadClass("java.lang.Object"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + assertEquals(null, clazz.getClassLoader()); + } + + @Test + public void loadClassApp() { + Class clazz = null; + try { + clazz = pluginClassLoader.loadClass("org.apache.dolphinscheduler.common.Constants"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + assertEquals(parent, clazz.getClassLoader()); + } + +} \ No newline at end of file diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java index da6576f7c6..89ab5c4279 100644 --- a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/model/AlertData.java @@ -54,9 +54,6 @@ public class AlertData { */ private String receiversCc; - public AlertData() { - } - public int getId() { return id; } @@ -129,13 +126,4 @@ public class AlertData { return this; } - public AlertData(int id, String title, String content, String log, int alertGroupId, String receivers, String receiversCc) { - this.id = id; - this.title = title; - this.content = content; - this.log = log; - this.alertGroupId = alertGroupId; - this.receivers = receivers; - this.receiversCc = receiversCc; - } } diff --git a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java index 21970fddcb..a244dd491e 100644 --- a/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java +++ b/dolphinscheduler-plugin-api/src/main/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtils.java @@ -22,8 +22,6 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; import java.util.Properties; /** @@ -32,9 +30,6 @@ import java.util.Properties; */ public class PropertyUtils { - /** - * logger - */ private static final Logger logger = LoggerFactory.getLogger(PropertyUtils.class); private static final Properties properties = new Properties(); @@ -44,76 +39,72 @@ public class PropertyUtils { } static { - String[] propertyFiles = new String[]{"/plugin.properties"}; - for (String fileName : propertyFiles) { - InputStream fis = null; - try { - fis = PropertyUtils.class.getResourceAsStream(fileName); - properties.load(fis); - - } catch (IOException e) { - logger.error(e.getMessage(), e); - if (fis != null) { - IOUtils.closeQuietly(fis); - } - System.exit(1); - } finally { + String propertyFiles = "/plugin.properties"; + InputStream fis = null; + try { + fis = PropertyUtils.class.getResourceAsStream(propertyFiles); + properties.load(fis); + } catch (IOException e) { + logger.error(e.getMessage(), e); + if (fis != null) { IOUtils.closeQuietly(fis); } + } finally { + IOUtils.closeQuietly(fis); } } /** * get property value * - * @param key property name + * @param key property name + * @param defaultVal default value * @return property value */ - public static String getString(String key) { - if (key == null) { - return null; - } - return properties.getProperty(key.trim()); + public static String getString(String key, String defaultVal) { + String val = properties.getProperty(key.trim()); + return val == null ? defaultVal : val; } /** * get property value * * @param key property name - * @param defaultVal default value * @return property value */ - public static String getString(String key, String defaultVal) { - String val = properties.getProperty(key.trim()); - return val == null ? defaultVal : val; + public static String getString(String key) { + if (key == null) { + return null; + } + return properties.getProperty(key.trim()); } /** * get property value * * @param key property name - * @return get property int value , if key == null, then return -1 + * @return get property int value , if key == null, then return -1 */ public static int getInt(String key) { return getInt(key, -1); } /** + * get int * - * @param key key + * @param key key * @param defaultValue default value * @return property value */ public static int getInt(String key, int defaultValue) { - String value = getString(key); + String value = properties.getProperty(key.trim()); if (value == null) { return defaultValue; } - try { return Integer.parseInt(value); } catch (NumberFormatException e) { - logger.info(e.getMessage(),e); + logger.info(e.getMessage(), e); } return defaultValue; } @@ -126,32 +117,33 @@ public class PropertyUtils { */ public static boolean getBoolean(String key) { String value = properties.getProperty(key.trim()); - if(null != value){ - return Boolean.parseBoolean(value); + if (value == null) { + return false; } - return false; + return Boolean.parseBoolean(value); } /** * get property value * - * @param key property name + * @param key property name * @param defaultValue default value * @return property value */ public static Boolean getBoolean(String key, boolean defaultValue) { String value = properties.getProperty(key.trim()); - if(null != value){ - return Boolean.parseBoolean(value); + if (value == null) { + return defaultValue; } - return defaultValue; + return Boolean.parseBoolean(value); } /** * get property long value - * @param key key + * + * @param key key * @param defaultVal default value * @return property value */ @@ -161,72 +153,38 @@ public class PropertyUtils { } /** + * get long * * @param key key * @return property value */ public static long getLong(String key) { - return getLong(key,-1); + return getLong(key, -1); } /** + * get double * - * @param key key + * @param key key * @param defaultVal default value * @return property value */ public static double getDouble(String key, double defaultVal) { - String val = getString(key); + String val = properties.getProperty(key.trim()); return val == null ? defaultVal : Double.parseDouble(val); } - /** - * get array - * @param key property name - * @param splitStr separator - * @return property value through array - */ - public static String[] getArray(String key, String splitStr) { - String value = getString(key); - if (value == null) { - return new String[0]; - } - try { - String[] propertyArray = value.split(splitStr); - return propertyArray; - } catch (NumberFormatException e) { - logger.info(e.getMessage(),e); - } - return new String[0]; - } - - /** - * - * @param key key - * @param type type + * @param key key + * @param type type * @param defaultValue default value - * @param T - * @return get enum value + * @param T + * @return get enum value */ public > T getEnum(String key, Class type, T defaultValue) { - String val = getString(key); + String val = properties.getProperty(key.trim()); return val == null ? defaultValue : Enum.valueOf(type, val); } - /** - * get all properties with specified prefix, like: fs. - * @param prefix prefix to search - * @return all properties with specified prefix - */ - public static Map getPrefixedProperties(String prefix) { - Map matchedProperties = new HashMap<>(); - for (String propName : properties.stringPropertyNames()) { - if (propName.startsWith(prefix)) { - matchedProperties.put(propName, properties.getProperty(propName)); - } - } - return matchedProperties; - } } diff --git a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertDataTest.java b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertDataTest.java new file mode 100644 index 0000000000..c19b5bc29a --- /dev/null +++ b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertDataTest.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.model; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AlertDataTest { + + private AlertData alertData; + + @Before + public void before() { + alertData = new AlertData(); + alertData.setId(1) + .setContent("content") + .setShowType("email") + .setTitle("title") + .setReceivers("receivers") + .setReceiversCc("cc") + .setLog("log") + .setAlertGroupId(1); + } + + @Test + public void getId() { + assertEquals(1, alertData.getId()); + } + + @Test + public void getTitle() { + assertEquals("title", alertData.getTitle()); + } + + @Test + public void getContent() { + assertEquals("content", alertData.getContent()); + } + + @Test + public void getLog() { + assertEquals("log", alertData.getLog()); + } + + @Test + public void getAlertGroupId() { + assertEquals(1, alertData.getAlertGroupId()); + } + + @Test + public void getReceivers() { + assertEquals("receivers", alertData.getReceivers()); + } + + @Test + public void getReceiversCc() { + assertEquals("cc", alertData.getReceiversCc()); + } + + @Test + public void getShowType() { + assertEquals("email", alertData.getShowType()); + } +} \ No newline at end of file diff --git a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertInfoTest.java b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertInfoTest.java new file mode 100644 index 0000000000..13eb595ac3 --- /dev/null +++ b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/model/AlertInfoTest.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dolphinscheduler.plugin.model; + +import org.junit.Before; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.*; + +public class AlertInfoTest { + + private AlertInfo alertInfo; + + @Before + public void before() { + alertInfo = new AlertInfo(); + } + + @Test + public void getAlertProps() { + Map map = new HashMap<>(); + alertInfo.setAlertProps(map); + assertNotNull(alertInfo.getAlertProps()); + } + + @Test + public void getProp() { + alertInfo.addProp("k", "v"); + assertEquals("v", alertInfo.getProp("k")); + } + + @Test + public void getAlertData() { + alertInfo.setAlertData(new AlertData()); + assertNotNull(alertInfo.getAlertData()); + } +} \ No newline at end of file diff --git a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java index 5620857698..614a7c009c 100644 --- a/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java +++ b/dolphinscheduler-plugin-api/src/test/java/org/apache/dolphinscheduler/plugin/utils/PropertyUtilsTest.java @@ -63,7 +63,7 @@ public class PropertyUtilsTest { @Test public void testGetLong() { long result = PropertyUtils.getLong("test.long"); - assertSame(result, 100L); + assertSame(100L, result); } /** @@ -74,7 +74,7 @@ public class PropertyUtilsTest { //If key is undefine in alert.properties, and there is a defaultval, then return defaultval double result = PropertyUtils.getDouble("abc", 5.0); - assertEquals(result, 5.0, 0); + assertEquals(5.0, result, 0); result = PropertyUtils.getDouble("cba", 5.0); assertEquals(3.1, result, 0.01); diff --git a/pom.xml b/pom.xml index 52339cd183..e922d544fc 100644 --- a/pom.xml +++ b/pom.xml @@ -350,7 +350,7 @@ mysql mysql-connector-java ${mysql.connector.version} - + test com.h2database @@ -694,6 +694,7 @@ **/alert/utils/FuncUtilsTest.java **/alert/utils/JSONUtilsTest.java **/alert/utils/MailUtilsTest.java + **/alert/plugin/EmailAlertPluginTest.java **/api/dto/resources/filter/ResourceFilterTest.java **/api/dto/resources/visitor/ResourceTreeVisitorTest.java **/api/enums/testGetEnum.java @@ -769,6 +770,8 @@ **/common/utils/HttpUtilsTest.java **/common/ConstantsTest.java **/common/utils/HadoopUtils.java + **/common/plugin/FilePluginManagerTest + **/common/plugin/PluginClassLoaderTest **/dao/mapper/AccessTokenMapperTest.java **/dao/mapper/AlertGroupMapperTest.java **/dao/mapper/CommandMapperTest.java @@ -835,6 +838,9 @@ **/dao/mapper/UserMapperTest.java **/dao/utils/DagHelperTest.java **/dao/AlertDaoTest.java + **/plugin/model/AlertDataTest.java + **/plugin/model/AlertInfoTest.java + **/plugin/utils/PropertyUtilsTest.java @@ -980,5 +986,4 @@ dolphinscheduler-service dolphinscheduler-plugin-api - - \ No newline at end of file + From c01122b440dc8a3c38d7cb48cf3081636451c235 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Thu, 30 Apr 2020 17:40:45 +0800 Subject: [PATCH 17/33] Optimize workflow instance page --- .../instance/pages/list/_source/list.vue | 47 +++++++++---------- .../pages/instance/pages/list/index.vue | 1 + 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue index af0036ab12..2996f7d731 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue @@ -19,48 +19,48 @@
- - - - - - - - - - - - - + - @@ -73,8 +73,7 @@ {{item.name}} + - -
+ + {{$t('#')}} + {{$t('Process Name')}} - {{$t('Executor')}} + + {{$t('State')}} + {{$t('Run Type')}} + {{$t('Scheduling Time')}} + {{$t('Start Time')}} + {{$t('End Time')}} + {{$t('Duration')}}s + {{$t('Run Times')}} - {{$t('host')}} - + {{$t('fault-tolerant sign')}} -
- {{$t('State')}} +
+ {{$t('host')}} + +
+ {{$t('Executor')}}
+ {{$t('Operation')}}
- {{item.executorName}} - - + {{_rtRunningType(item.commandType)}} @@ -91,14 +90,14 @@ {{item.duration || '-'}} {{item.runTimes}}{{item.recovery}} {{item.host}} - {{item.recovery}} - + {{item.executorName}} + -
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue index 4a4206218a..d26da294f3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue @@ -204,6 +204,7 @@ } .table-box { .fixed { + table-layout: auto; tr { th:last-child,td:last-child { background: inherit; From 45d58cd984e41efc5d4f83812ab7f7dce296fa3a Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 30 Apr 2020 19:34:59 +0800 Subject: [PATCH 18/33] Exclude i18n files from code analysis --- .github/workflows/ci_ut.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_ut.yml b/.github/workflows/ci_ut.yml index 1c2952b440..6d0b2a2a1d 100644 --- a/.github/workflows/ci_ut.yml +++ b/.github/workflows/ci_ut.yml @@ -75,6 +75,7 @@ jobs: -Dsonar.core.codeCoveragePlugin=jacoco -Dsonar.projectKey=apache-dolphinscheduler -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682 + -Dsonar.exclusions=dolphinscheduler-ui/src/**/i18n/locale/*.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -83,4 +84,4 @@ jobs: mkdir -p ${LOG_DIR} cd ${DOCKER_DIR} docker-compose logs db > ${LOG_DIR}/db.txt - continue-on-error: true \ No newline at end of file + continue-on-error: true From ad90df20574c725abdd252262060fde1bb82aa07 Mon Sep 17 00:00:00 2001 From: zhangchunyang Date: Thu, 30 Apr 2020 19:36:08 +0800 Subject: [PATCH 19/33] 1. add file add README.md2. delete ambari_plugin/common-services/DOLPHIN/2.0.0 (#2546) * Ambari plugin development for the dolphin scheduler in version 2.0.0 is complete * Update the Ambari plugin of DS usage documentation * delete readme whic is not completed * update version 2.0.0 backup to 1.3.0 * update ambari plugin version to 1.3.0 * add readme doc * delete common-services/DOLPHIN/2.0.0 * update the version in doc Co-authored-by: zhangchunyang Co-authored-by: zhangchunyang <18910529250@163.com> Co-authored-by: dailidong --- ambari_plugin/README.md | 68 ++ .../common-services/DOLPHIN/2.0.0/alerts.json | 164 ----- .../2.0.0/configuration/dolphin-alert.xml | 143 ---- .../configuration/dolphin-application-api.xml | 87 --- .../2.0.0/configuration/dolphin-common.xml | 158 ----- .../configuration/dolphin-datasource.xml | 467 ------------- .../2.0.0/configuration/dolphin-env.xml | 123 ---- .../2.0.0/configuration/dolphin-master.xml | 88 --- .../2.0.0/configuration/dolphin-quartz.xml | 126 ---- .../2.0.0/configuration/dolphin-worker.xml | 76 -- .../2.0.0/configuration/dolphin-zookeeper.xml | 84 --- .../DOLPHIN/2.0.0/metainfo.xml | 137 ---- .../alerts/alert_dolphin_scheduler_status.py | 124 ---- .../package/scripts/dolphin_alert_service.py | 61 -- .../package/scripts/dolphin_api_service.py | 70 -- .../2.0.0/package/scripts/dolphin_env.py | 123 ---- .../package/scripts/dolphin_logger_service.py | 61 -- .../package/scripts/dolphin_master_service.py | 61 -- .../package/scripts/dolphin_worker_service.py | 60 -- .../DOLPHIN/2.0.0/package/scripts/params.py | 154 ---- .../2.0.0/package/scripts/service_check.py | 31 - .../2.0.0/package/scripts/status_params.py | 23 - .../package/templates/alert.properties.j2 | 20 - .../templates/application-api.properties.j2 | 20 - .../package/templates/common.properties.j2 | 20 - .../templates/datasource.properties.j2 | 20 - .../package/templates/dolphin-daemon.sh.j2 | 116 --- .../package/templates/master.properties.j2 | 20 - .../package/templates/quartz.properties.j2 | 20 - .../package/templates/worker.properties.j2 | 20 - .../package/templates/zookeeper.properties.j2 | 20 - .../DOLPHIN/2.0.0/quicklinks/quicklinks.json | 26 - .../DOLPHIN/2.0.0/themes/theme.json | 661 ------------------ 33 files changed, 68 insertions(+), 3384 deletions(-) create mode 100644 ambari_plugin/README.md delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/alerts.json delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-alert.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-application-api.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-common.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-datasource.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-env.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-master.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-quartz.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-worker.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-zookeeper.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/metainfo.xml delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_alert_service.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_api_service.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_env.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_logger_service.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_master_service.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_worker_service.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/params.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/service_check.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/status_params.py delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/alert.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/application-api.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/common.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/datasource.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/dolphin-daemon.sh.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/master.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/quartz.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/worker.properties.j2 delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/zookeeper.properties.j2 delete mode 100755 ambari_plugin/common-services/DOLPHIN/2.0.0/quicklinks/quicklinks.json delete mode 100644 ambari_plugin/common-services/DOLPHIN/2.0.0/themes/theme.json diff --git a/ambari_plugin/README.md b/ambari_plugin/README.md new file mode 100644 index 0000000000..bd634d4a29 --- /dev/null +++ b/ambari_plugin/README.md @@ -0,0 +1,68 @@ +### Dolphin Scheduler的Ambari插件使用说明 + +##### 备注 + +1. 本文档适用于对Ambari中基本了解的用户 +2. 本文档是对已安装Ambari服务添加Dolphin Scheduler(1.3.0版本)服务的说明 + +##### 一 安装准备 + +1. 准备RPM包 + + - 在源码dolphinscheduler-dist目录下执行命令```mvn -U clean install rpm:attached-rpm -Prpmbuild -Dmaven.test.skip=true -X```即可生成(在目录 dolphinscheduler-dist/target/rpm/apache-dolphinscheduler-incubating/RPMS/noarch 下) + +2. 创建DS的安装用户--权限 + +3. 初始化数据库信息 + + ``` + -- 创建Dolphin Scheduler的数据库:dolphinscheduler + CREATE DATABASE dolphinscheduler DEFAULT CHARACTER SET utf8 DEFAULT COLLATE + utf8_general_ci; + + -- 初始化dolphinscheduler数据库的用户和密码,并分配权限 + -- 替换下面sql语句中的{user}为dolphinscheduler数据库的用户 + GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'%' IDENTIFIED BY '{password}'; + GRANT ALL PRIVILEGES ON dolphinscheduler.* TO '{user}'@'localhost' IDENTIFIED BY + '{password}'; + flush privileges; + ``` + + + +##### 二 Ambari安装Dolphin Scheduler + +1. Ambari界面安装Dolphin Scheduler + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_001.png) + +2. 选择Dolphin Scheduler的Master安装的节点 + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_002.png) + +3. 配置Dolphin Scheduler的Worker、Api、Logger、Alert安装的节点 + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_003.png) + +4. 设置Dolphin Scheduler服务的安装用户(**步骤一中创建的**)及所属的用户组 + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_004.png) + +5. 配置数据库的信息(和步骤一中初始化数据库中一致) + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_005.png) + +6. 配置其它的信息--如果需要的话 + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_006.png) + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_007.png) + +7. 正常执行接下来的步骤 + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_008.png) + +8. 安装成功后的界面 + + ![](https://github.com/apache/incubator-dolphinscheduler-website/blob/master/img/ambari-plugin/DS2_AMBARI_009.png) + diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/alerts.json b/ambari_plugin/common-services/DOLPHIN/2.0.0/alerts.json deleted file mode 100644 index 385c5d5599..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/alerts.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "DOLPHIN": { - "service": [], - "DOLPHIN_API": [ - { - "name": "dolphin_api_port_check", - "label": "dolphin_api_port_check", - "description": "dolphin_api_port_check.", - "interval": 10, - "scope": "ANY", - "source": { - "type": "PORT", - "uri": "{{dolphin-application-api/server.port}}", - "default_port": 12345, - "reporting": { - "ok": { - "text": "TCP OK - {0:.3f}s response on port {1}" - }, - "warning": { - "text": "TCP OK - {0:.3f}s response on port {1}", - "value": 1.5 - }, - "critical": { - "text": "Connection failed: {0} to {1}:{2}", - "value": 5.0 - } - } - } - } - ], - "DOLPHIN_MASTER": [ - { - "name": "DOLPHIN_MASTER_CHECK", - "label": "check dolphin scheduler master status", - "description": "", - "interval":10, - "scope": "HOST", - "enabled": true, - "source": { - "type": "SCRIPT", - "path": "DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py", - "parameters": [ - - { - "name": "connection.timeout", - "display_name": "Connection Timeout", - "value": 5.0, - "type": "NUMERIC", - "description": "The maximum time before this alert is considered to be CRITICAL", - "units": "seconds", - "threshold": "CRITICAL" - }, - { - "name": "alertName", - "display_name": "alertName", - "value": "DOLPHIN_MASTER", - "type": "STRING", - "description": "alert name" - } - ] - } - } - ], - "DOLPHIN_WORKER": [ - { - "name": "DOLPHIN_WORKER_CHECK", - "label": "check dolphin scheduler worker status", - "description": "", - "interval":10, - "scope": "HOST", - "enabled": true, - "source": { - "type": "SCRIPT", - "path": "DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py", - "parameters": [ - - { - "name": "connection.timeout", - "display_name": "Connection Timeout", - "value": 5.0, - "type": "NUMERIC", - "description": "The maximum time before this alert is considered to be CRITICAL", - "units": "seconds", - "threshold": "CRITICAL" - }, - { - "name": "alertName", - "display_name": "alertName", - "value": "DOLPHIN_WORKER", - "type": "STRING", - "description": "alert name" - } - ] - } - } - ], - "DOLPHIN_ALERT": [ - { - "name": "DOLPHIN_DOLPHIN_ALERT_CHECK", - "label": "check dolphin scheduler alert status", - "description": "", - "interval":10, - "scope": "HOST", - "enabled": true, - "source": { - "type": "SCRIPT", - "path": "DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py", - "parameters": [ - - { - "name": "connection.timeout", - "display_name": "Connection Timeout", - "value": 5.0, - "type": "NUMERIC", - "description": "The maximum time before this alert is considered to be CRITICAL", - "units": "seconds", - "threshold": "CRITICAL" - }, - { - "name": "alertName", - "display_name": "alertName", - "value": "DOLPHIN_ALERT", - "type": "STRING", - "description": "alert name" - } - ] - } - } - ], - "DOLPHIN_ALERT": [ - { - "name": "DOLPHIN_DOLPHIN_LOGGER_CHECK", - "label": "check dolphin scheduler alert status", - "description": "", - "interval":10, - "scope": "HOST", - "enabled": true, - "source": { - "type": "SCRIPT", - "path": "DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py", - "parameters": [ - - { - "name": "connection.timeout", - "display_name": "Connection Timeout", - "value": 5.0, - "type": "NUMERIC", - "description": "The maximum time before this alert is considered to be CRITICAL", - "units": "seconds", - "threshold": "CRITICAL" - }, - { - "name": "alertName", - "display_name": "alertName", - "value": "DOLPHIN_LOGGER", - "type": "STRING", - "description": "alert name" - } - ] - } - } - ] - } -} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-alert.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-alert.xml deleted file mode 100644 index 5f44a1a4c8..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-alert.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - alert.type - EMAIL - alert type is EMAIL/SMS - - - - alert.template - html - alter msg template, default is html template - - - - mail.protocol - SMTP - - - - - mail.server.host - xxx.xxx.com - - - - - mail.server.port - 25 - - int - - - - - - mail.sender - admin - - - - - mail.user - admin - - - - - mail.passwd - 000000 - - PASSWORD - - password - - - - - - mail.smtp.starttls.enable - true - - boolean - - - - - - mail.smtp.ssl.enable - true - - boolean - - - - - - mail.smtp.ssl.trust - xxx.xxx.com - - - - - - enterprise.wechat.enable - false - - - value-list - - - true - - - - false - - - - 1 - - - - - enterprise.wechat.corp.id - wechatId - - - - - enterprise.wechat.secret - secret - - - - - enterprise.wechat.agent.id - agentId - - - - - enterprise.wechat.users - wechatUsers - - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-application-api.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-application-api.xml deleted file mode 100644 index 766c0f477d..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-application-api.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - server.port - 12345 - - server port - - - int - - - - server.servlet.session.timeout - 7200 - - int - - - - - - server.servlet.context-path - /dolphinscheduler/ - - - - - spring.servlet.multipart.max-file-size - 1024 - - MB - int - - - - - - spring.servlet.multipart.max-request-size - 1024 - - MB - int - - - - - - server.jetty.max-http-post-size - 5000000 - - int - - - - - - spring.messages.encoding - UTF-8 - - - - spring.messages.basename - i18n/messages - - - - security.authentication.type - PASSWORD - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-common.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-common.xml deleted file mode 100644 index 439e21188a..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-common.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - resource.storage.type - Choose Resource Upload Startup Type - - Resource upload startup type : HDFS,S3,NONE - - NONE - - value-list - - - HDFS - - - - S3 - - - - NONE - - - - 1 - - - - - resource.upload.path - /dolphinscheduler - - resource store on HDFS/S3 path, resource file will store to this hadoop hdfs path, self configuration, please make sure the directory exists on hdfs and have read write permissions。"/dolphinscheduler" is recommended - - - - - data.basedir.path - /tmp/dolphinscheduler - - user data local directory path, please make sure the directory exists and have read write permissions - - - - - - hadoop.security.authentication.startup.state - false - - value-list - - - true - - - - false - - - - 1 - - whether kerberos starts - - - java.security.krb5.conf.path - /opt/krb5.conf - - java.security.krb5.conf path - - - - - login.user.keytab.username - hdfs-mycluster@ESZ.COM - - LoginUserFromKeytab user - - - - - login.user.keytab.path - /opt/hdfs.headless.keytab - - LoginUserFromKeytab path - - - - - resource.view.suffixs - txt,log,sh,conf,cfg,py,java,sql,hql,xml,properties - - - - hdfs.root.user - hdfs - - Users who have permission to create directories under the HDFS root path - - - - - fs.defaultFS - hdfs://mycluster:8020 - - HA or single namenode, - If namenode ha needs to copy core-site.xml and hdfs-site.xml to the conf directory, - support s3,for example : s3a://dolphinscheduler - - - - - fs.s3a.endpoint - http://host:9010 - - s3 need,s3 endpoint - - - - - fs.s3a.access.key - A3DXS30FO22544RE - - s3 need,s3 access key - - - - - fs.s3a.secret.key - OloCLq3n+8+sdPHUhJ21XrSxTC+JK - - s3 need,s3 secret key - - - - - kerberos.expire.time - 7 - - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-datasource.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-datasource.xml deleted file mode 100644 index 6e50a1b649..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-datasource.xml +++ /dev/null @@ -1,467 +0,0 @@ - - - - spring.datasource.initialSize - 5 - - Init connection number - - - int - - - - - spring.datasource.minIdle - 5 - - Min connection number - - - int - - - - - spring.datasource.maxActive - 50 - - Max connection number - - - int - - - - - spring.datasource.maxWait - 60000 - - Max wait time for get a connection in milliseconds. - If configuring maxWait, fair locks are enabled by default and concurrency efficiency decreases. - If necessary, unfair locks can be used by configuring the useUnfairLock attribute to true. - - - int - - - - - spring.datasource.timeBetweenEvictionRunsMillis - 60000 - - Milliseconds for check to close free connections - - - int - - - - - spring.datasource.timeBetweenConnectErrorMillis - 60000 - - The Destroy thread detects the connection interval and closes the physical connection in milliseconds - if the connection idle time is greater than or equal to minEvictableIdleTimeMillis. - - - int - - - - - spring.datasource.minEvictableIdleTimeMillis - 300000 - - The longest time a connection remains idle without being evicted, in milliseconds - - - int - - - - - spring.datasource.validationQuery - SELECT 1 - - The SQL used to check whether the connection is valid requires a query statement. - If validation Query is null, testOnBorrow, testOnReturn, and testWhileIdle will not work. - - - - - spring.datasource.validationQueryTimeout - 3 - - int - - - Check whether the connection is valid for timeout, in seconds - - - - - spring.datasource.testWhileIdle - true - - boolean - - - When applying for a connection, - if it is detected that the connection is idle longer than time Between Eviction Runs Millis, - validation Query is performed to check whether the connection is valid - - - - - spring.datasource.testOnBorrow - true - - boolean - - - Execute validation to check if the connection is valid when applying for a connection - - - - - spring.datasource.testOnReturn - false - - boolean - - - Execute validation to check if the connection is valid when the connection is returned - - - - - spring.datasource.defaultAutoCommit - true - - boolean - - - - - - - spring.datasource.keepAlive - false - - boolean - - - - - - - - spring.datasource.poolPreparedStatements - true - - boolean - - - Open PSCache, specify count PSCache for every connection - - - - - spring.datasource.maxPoolPreparedStatementPerConnectionSize - 20 - - int - - - - - - spring.datasource.spring.datasource.filters - stat,wall,log4j - - - - - spring.datasource.connectionProperties - druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 - - - - - - mybatis-plus.mapper-locations - classpath*:/org.apache.dolphinscheduler.dao.mapper/*.xml - - - - - mybatis-plus.typeEnumsPackage - org.apache.dolphinscheduler.*.enums - - - - - mybatis-plus.typeAliasesPackage - org.apache.dolphinscheduler.dao.entity - - Entity scan, where multiple packages are separated by a comma or semicolon - - - - - mybatis-plus.global-config.db-config.id-type - AUTO - - value-list - - - AUTO - - - - INPUT - - - - ID_WORKER - - - - UUID - - - - 1 - - - Primary key type AUTO:" database ID AUTO ", - INPUT:" user INPUT ID", - ID_WORKER:" global unique ID (numeric type unique ID)", - UUID:" global unique ID UUID"; - - - - - mybatis-plus.global-config.db-config.field-strategy - NOT_NULL - - value-list - - - IGNORED - - - - NOT_NULL - - - - NOT_EMPTY - - - - 1 - - - Field policy IGNORED:" ignore judgment ", - NOT_NULL:" not NULL judgment "), - NOT_EMPTY:" not NULL judgment" - - - - - mybatis-plus.global-config.db-config.column-underline - true - - boolean - - - - - - mybatis-plus.global-config.db-config.logic-delete-value - 1 - - int - - - - - - mybatis-plus.global-config.db-config.logic-not-delete-value - 0 - - int - - - - - - mybatis-plus.global-config.db-config.banner - true - - boolean - - - - - - - mybatis-plus.configuration.map-underscore-to-camel-case - true - - boolean - - - - - - mybatis-plus.configuration.cache-enabled - false - - boolean - - - - - - mybatis-plus.configuration.call-setters-on-nulls - true - - boolean - - - - - - mybatis-plus.configuration.jdbc-type-for-null - null - - - - - master.exec.threads - 100 - - int - - - - - - master.exec.task.num - 20 - - int - - - - - - master.heartbeat.interval - 10 - - int - - - - - - master.task.commit.retryTimes - 5 - - int - - - - - - master.task.commit.interval - 1000 - - int - - - - - - master.max.cpuload.avg - 100 - - int - - - - - - master.reserved.memory - 0.1 - - float - - - - - - worker.exec.threads - 100 - - int - - - - - - worker.heartbeat.interval - 10 - - int - - - - - - worker.fetch.task.num - 3 - - int - - - - - - worker.max.cpuload.avg - 100 - - int - - - - - - worker.reserved.memory - 0.1 - - float - - - - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-env.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-env.xml deleted file mode 100644 index 8e14716d05..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-env.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - dolphin.database.type - mysql - Dolphin Scheduler DataBase Type Which Is Select - Dolphin Database Type - - value-list - - - mysql - - - - postgresql - - - - 1 - - - - - - dolphin.database.host - - Dolphin Database Host - - - - - dolphin.database.port - - Dolphin Database Port - - - - - dolphin.database.username - - Dolphin Database Username - - - - - dolphin.database.password - - Dolphin Database Password - PASSWORD - - password - - - - - - dolphin.user - - Which user to install and admin dolphin scheduler - Deploy User - - - - dolphin.group - - Which user to install and admin dolphin scheduler - Deploy Group - - - - - dolphinscheduler-env-content - Dolphinscheduler Env template - This is the jinja template for dolphinscheduler.env.sh file - # -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -export HADOOP_HOME=/opt/soft/hadoop -export HADOOP_CONF_DIR=/opt/soft/hadoop/etc/hadoop -export SPARK_HOME1=/opt/soft/spark1 -export SPARK_HOME2=/opt/soft/spark2 -export PYTHON_HOME=/opt/soft/python -export JAVA_HOME=/opt/soft/java -export HIVE_HOME=/opt/soft/hive -export FLINK_HOME=/opt/soft/flink - - content - false - false - - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-master.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-master.xml deleted file mode 100644 index c8eec047fc..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-master.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - master.exec.threads - 100 - - int - - master execute thread num - - - - master.exec.task.num - 20 - - int - - master execute task number in parallel - - - - master.heartbeat.interval - 10 - - int - - master heartbeat interval - - - - master.task.commit.retryTimes - 5 - - int - - master commit task retry times - - - - master.task.commit.interval - 1000 - - int - - master commit task interval - - - - master.max.cpuload.avg - 100 - - int - - only less than cpu avg load, master server can work. default value : the number of cpu cores * 2 - - - - master.reserved.memory - 0.3 - only larger than reserved memory, master server can work. default value : physical memory * 1/10, unit is G. - - - - - master.listen.port - 5678 - - int - - master listen port - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-quartz.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-quartz.xml deleted file mode 100644 index 7a0c68b051..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-quartz.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - org.quartz.scheduler.instanceName - DolphinScheduler - - - - - org.quartz.scheduler.instanceId - AUTO - - - - org.quartz.scheduler.makeSchedulerThreadDaemon - true - - boolean - - - - - org.quartz.jobStore.useProperties - false - - boolean - - - - - org.quartz.threadPool.class - org.quartz.simpl.SimpleThreadPool - - - - org.quartz.threadPool.makeThreadsDaemons - true - - boolean - - - - - org.quartz.threadPool.threadCount - 25 - - int - - - - - org.quartz.threadPool.threadPriority - 5 - - int - - - - - org.quartz.jobStore.class - org.quartz.impl.jdbcjobstore.JobStoreTX - - - - org.quartz.jobStore.tablePrefix - QRTZ_ - - - - org.quartz.jobStore.isClustered - true - - boolean - - - - - org.quartz.jobStore.misfireThreshold - 60000 - - int - - - - - org.quartz.jobStore.clusterCheckinInterval - 5000 - - int - - - - - org.quartz.jobStore.acquireTriggersWithinLock - true - - boolean - - - - - org.quartz.jobStore.dataSource - myDs - - - - org.quartz.dataSource.myDs.connectionProvider.class - org.apache.dolphinscheduler.service.quartz.DruidConnectionProvider - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-worker.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-worker.xml deleted file mode 100644 index 97beade1bc..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-worker.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - worker.exec.threads - 100 - - int - - worker execute thread num - - - - worker.heartbeat.interval - 10 - - int - - worker heartbeat interval - - - - worker.fetch.task.num - 3 - - int - - submit the number of tasks at a time - - - - worker.max.cpuload.avg - 100 - - int - - only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2 - - - - worker.reserved.memory - 0.3 - only larger than reserved memory, worker server can work. default value : physical memory * 1/10, unit is G. - - - - - worker.listen.port - 1234 - - int - - worker listen port - - - - worker.group - default - default worker group - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-zookeeper.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-zookeeper.xml deleted file mode 100644 index 5882162254..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/configuration/dolphin-zookeeper.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - dolphinscheduler.queue.impl - zookeeper - - Task queue implementation, default "zookeeper" - - - - - zookeeper.dolphinscheduler.root - /dolphinscheduler - - dolphinscheduler root directory - - - - - zookeeper.session.timeout - 300 - - int - - - - - - - zookeeper.connection.timeout - 300 - - int - - - - - - - zookeeper.retry.base.sleep - 100 - - int - - - - - - - zookeeper.retry.max.sleep - 30000 - - int - - - - - - - zookeeper.retry.maxtime - 5 - - int - - - - - - \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/metainfo.xml b/ambari_plugin/common-services/DOLPHIN/2.0.0/metainfo.xml deleted file mode 100644 index b3c14e33cb..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/metainfo.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - 2.0 - - - DOLPHIN - Dolphin Scheduler - 分布式易扩展的可视化DAG工作流任务调度系统 - 2.0.0 - - - DOLPHIN_MASTER - DS Master - MASTER - 1+ - - - PYTHON - 600 - - - - - DOLPHIN_LOGGER - DS Logger - SLAVE - 1+ - - - PYTHON - 600 - - - - - DOLPHIN_WORKER - DS Worker - SLAVE - 1+ - - - DOLPHIN/DOLPHIN_LOGGER - host - - true - - - - - - PYTHON - 600 - - - - - DOLPHIN_ALERT - DS Alert - SLAVE - 1 - - - PYTHON - 600 - - - - - DOLPHIN_API - DS_Api - SLAVE - 1 - - - PYTHON - 600 - - - - - - ZOOKEEPER - - - - - any - - - apache-dolphinscheduler-incubating-1.2.1* - - - - - - - dolphin-alert - dolphin-app-api - dolphin-app-dao - dolphin-common - dolphin-env - dolphin-quartz - - - - - theme.json - true - - - - quicklinks - - - quicklinks.json - true - - - - - diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py deleted file mode 100644 index 87cc7b453b..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/alerts/alert_dolphin_scheduler_status.py +++ /dev/null @@ -1,124 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" - -import socket -import urllib2 -import os -import logging -import ambari_simplejson as json -from resource_management.libraries.script.script import Script -import sys -reload(sys) -sys.setdefaultencoding('utf-8') - -logger = logging.getLogger('ambari_alerts') - -config = Script.get_config() - - -def get_tokens(): - """ - Returns a tuple of tokens in the format {{site/property}} that will be used - to build the dictionary passed into execute - - :rtype tuple - """ - -def get_info(url, connection_timeout): - response = None - - try: - response = urllib2.urlopen(url, timeout=connection_timeout) - json_data = response.read() - return json_data - finally: - if response is not None: - try: - response.close() - except: - pass - - -def execute(configurations={}, parameters={}, host_name=None): - """ - Returns a tuple containing the result code and a pre-formatted result label - - Keyword arguments: - configurations : a mapping of configuration key to value - parameters : a mapping of script parameter key to value - host_name : the name of this host where the alert is running - - :type configurations dict - :type parameters dict - :type host_name str - """ - - alert_name = parameters['alertName'] - - dolphin_pidfile_dir = "/opt/soft/run/dolphinscheduler" - - pid = "0" - - - from resource_management.core import sudo - - is_running = True - pid_file_path = "" - if alert_name == 'DOLPHIN_MASTER': - pid_file_path = dolphin_pidfile_dir + "/master-server.pid" - elif alert_name == 'DOLPHIN_WORKER': - pid_file_path = dolphin_pidfile_dir + "/worker-server.pid" - elif alert_name == 'DOLPHIN_ALERT': - pid_file_path = dolphin_pidfile_dir + "/alert-server.pid" - elif alert_name == 'DOLPHIN_LOGGER': - pid_file_path = dolphin_pidfile_dir + "/logger-server.pid" - elif alert_name == 'DOLPHIN_API': - pid_file_path = dolphin_pidfile_dir + "/api-server.pid" - - if not pid_file_path or not os.path.isfile(pid_file_path): - is_running = False - - try: - pid = int(sudo.read_file(pid_file_path)) - except: - is_running = False - - try: - # Kill will not actually kill the process - # From the doc: - # If sig is 0, then no signal is sent, but error checking is still - # performed; this can be used to check for the existence of a - # process ID or process group ID. - sudo.kill(pid, 0) - except OSError: - is_running = False - - if host_name is None: - host_name = socket.getfqdn() - - if not is_running: - result_code = "CRITICAL" - else: - result_code = "OK" - - label = "The comment {0} of DOLPHIN_SCHEDULER on {1} is {2}".format(alert_name, host_name, result_code) - - return ((result_code, [label])) - -if __name__ == "__main__": - pass diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_alert_service.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_alert_service.py deleted file mode 100644 index 62255a3432..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_alert_service.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import time -from resource_management import * - -from dolphin_env import dolphin_env - - -class DolphinAlertService(Script): - def install(self, env): - import params - env.set_params(params) - self.install_packages(env) - Execute(('chmod', '-R', '777', params.dolphin_home), user=params.dolphin_user, sudo=True) - - def configure(self, env): - import params - params.pika_slave = True - env.set_params(params) - - dolphin_env() - - def start(self, env): - import params - env.set_params(params) - self.configure(env) - no_op_test = format("ls {dolphin_pidfile_dir}/alert-server.pid >/dev/null 2>&1 && ps `cat {dolphin_pidfile_dir}/alert-server.pid` | grep `cat {dolphin_pidfile_dir}/alert-server.pid` >/dev/null 2>&1") - - start_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh start alert-server") - Execute(start_cmd, user=params.dolphin_user, not_if=no_op_test) - - def stop(self, env): - import params - env.set_params(params) - stop_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh stop alert-server") - Execute(stop_cmd, user=params.dolphin_user) - time.sleep(5) - - def status(self, env): - import status_params - env.set_params(status_params) - check_process_status(status_params.dolphin_run_dir + "alert-server.pid") - - -if __name__ == "__main__": - DolphinAlertService().execute() diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_api_service.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_api_service.py deleted file mode 100644 index bdc18fb602..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_api_service.py +++ /dev/null @@ -1,70 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import time -from resource_management import * - -from dolphin_env import dolphin_env - - -class DolphinApiService(Script): - def install(self, env): - import params - env.set_params(params) - self.install_packages(env) - Execute(('chmod', '-R', '777', params.dolphin_home), user=params.dolphin_user, sudo=True) - - def configure(self, env): - import params - params.pika_slave = True - env.set_params(params) - - dolphin_env() - - def start(self, env): - import params - env.set_params(params) - self.configure(env) - - #init - init_cmd=format("sh " + params.dolphin_home + "/script/create-dolphinscheduler.sh") - Execute(init_cmd, user=params.dolphin_user) - - #upgrade - upgrade_cmd=format("sh " + params.dolphin_home + "/script/upgrade-dolphinscheduler.sh") - Execute(upgrade_cmd, user=params.dolphin_user) - - no_op_test = format("ls {dolphin_pidfile_dir}/api-server.pid >/dev/null 2>&1 && ps `cat {dolphin_pidfile_dir}/api-server.pid` | grep `cat {dolphin_pidfile_dir}/api-server.pid` >/dev/null 2>&1") - - start_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh start api-server") - Execute(start_cmd, user=params.dolphin_user, not_if=no_op_test) - - def stop(self, env): - import params - env.set_params(params) - stop_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh stop api-server") - Execute(stop_cmd, user=params.dolphin_user) - time.sleep(5) - - def status(self, env): - import status_params - env.set_params(status_params) - check_process_status(status_params.dolphin_run_dir + "api-server.pid") - - -if __name__ == "__main__": - DolphinApiService().execute() diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_env.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_env.py deleted file mode 100644 index 1661d76c75..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_env.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -from resource_management import * - - -def dolphin_env(): - import params - - Directory(params.dolphin_pidfile_dir, - mode=0777, - owner=params.dolphin_user, - group=params.dolphin_group, - create_parents=True - ) - Directory(params.dolphin_log_dir, - mode=0777, - owner=params.dolphin_user, - group=params.dolphin_group, - create_parents=True - ) - Directory(params.dolphin_conf_dir, - mode=0777, - owner=params.dolphin_user, - group=params.dolphin_group, - create_parents=True - ) - - Directory(params.dolphin_common_map['data.basedir.path'], - mode=0777, - owner=params.dolphin_user, - group=params.dolphin_group, - create_parents=True - ) - - - File(format(params.dolphin_env_path), - mode=0777, - content=InlineTemplate(params.dolphin_env_content), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - - File(format(params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh"), - mode=0755, - content=Template("dolphin-daemon.sh.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/master.properties"), - mode=0755, - content=Template("master.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/worker.properties"), - mode=0755, - content=Template("worker.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - - File(format(params.dolphin_conf_dir + "/alert.properties"), - mode=0755, - content=Template("alert.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/datasource.properties"), - mode=0755, - content=Template("datasource.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/application-api.properties"), - mode=0755, - content=Template("application-api.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/common.properties"), - mode=0755, - content=Template("common.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/quartz.properties"), - mode=0755, - content=Template("quartz.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) - - File(format(params.dolphin_conf_dir + "/zookeeper.properties"), - mode=0755, - content=Template("zookeeper.properties.j2"), - owner=params.dolphin_user, - group=params.dolphin_group - ) diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_logger_service.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_logger_service.py deleted file mode 100644 index f1c19bd66f..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_logger_service.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import time -from resource_management import * - -from dolphin_env import dolphin_env - - -class DolphinLoggerService(Script): - def install(self, env): - import params - env.set_params(params) - self.install_packages(env) - Execute(('chmod', '-R', '777', params.dolphin_home), user=params.dolphin_user, sudo=True) - - def configure(self, env): - import params - params.pika_slave = True - env.set_params(params) - - dolphin_env() - - def start(self, env): - import params - env.set_params(params) - self.configure(env) - no_op_test = format("ls {dolphin_pidfile_dir}/logger-server.pid >/dev/null 2>&1 && ps `cat {dolphin_pidfile_dir}/logger-server.pid` | grep `cat {dolphin_pidfile_dir}/logger-server.pid` >/dev/null 2>&1") - - start_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh start logger-server") - Execute(start_cmd, user=params.dolphin_user, not_if=no_op_test) - - def stop(self, env): - import params - env.set_params(params) - stop_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh stop logger-server") - Execute(stop_cmd, user=params.dolphin_user) - time.sleep(5) - - def status(self, env): - import status_params - env.set_params(status_params) - check_process_status(status_params.dolphin_run_dir + "logger-server.pid") - - -if __name__ == "__main__": - DolphinLoggerService().execute() diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_master_service.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_master_service.py deleted file mode 100644 index 6ee7ecfcf3..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_master_service.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import time -from resource_management import * - -from dolphin_env import dolphin_env - - -class DolphinMasterService(Script): - def install(self, env): - import params - env.set_params(params) - self.install_packages(env) - Execute(('chmod', '-R', '777', params.dolphin_home), user=params.dolphin_user, sudo=True) - - def configure(self, env): - import params - params.pika_slave = True - env.set_params(params) - - dolphin_env() - - def start(self, env): - import params - env.set_params(params) - self.configure(env) - no_op_test = format("ls {dolphin_pidfile_dir}/master-server.pid >/dev/null 2>&1 && ps `cat {dolphin_pidfile_dir}/master-server.pid` | grep `cat {dolphin_pidfile_dir}/master-server.pid` >/dev/null 2>&1") - start_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh start master-server") - Execute(start_cmd, user=params.dolphin_user, not_if=no_op_test) - - def stop(self, env): - import params - env.set_params(params) - stop_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh stop master-server") - Execute(stop_cmd, user=params.dolphin_user) - time.sleep(5) - - def status(self, env): - import status_params - env.set_params(status_params) - check_process_status(status_params.dolphin_run_dir + "master-server.pid") - - -if __name__ == "__main__": - DolphinMasterService().execute() diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_worker_service.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_worker_service.py deleted file mode 100644 index 2d145ee730..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/dolphin_worker_service.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" -import time -from resource_management import * - -from dolphin_env import dolphin_env - - -class DolphinWorkerService(Script): - def install(self, env): - import params - env.set_params(params) - self.install_packages(env) - Execute(('chmod', '-R', '777', params.dolphin_home), user=params.dolphin_user, sudo=True) - - def configure(self, env): - import params - params.pika_slave = True - env.set_params(params) - - dolphin_env() - - def start(self, env): - import params - env.set_params(params) - self.configure(env) - no_op_test = format("ls {dolphin_pidfile_dir}/worker-server.pid >/dev/null 2>&1 && ps `cat {dolphin_pidfile_dir}/worker-server.pid` | grep `cat {dolphin_pidfile_dir}/worker-server.pid` >/dev/null 2>&1") - start_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh start worker-server") - Execute(start_cmd, user=params.dolphin_user, not_if=no_op_test) - - def stop(self, env): - import params - env.set_params(params) - stop_cmd = format("sh " + params.dolphin_bin_dir + "/dolphinscheduler-daemon.sh stop worker-server") - Execute(stop_cmd, user=params.dolphin_user) - time.sleep(5) - - def status(self, env): - import status_params - env.set_params(status_params) - check_process_status(status_params.dolphin_run_dir + "worker-server.pid") - - -if __name__ == "__main__": - DolphinWorkerService().execute() diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/params.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/params.py deleted file mode 100644 index b09b2589f4..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/params.py +++ /dev/null @@ -1,154 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" - - -import sys -from resource_management import * -from resource_management.core.logger import Logger -from resource_management.libraries.functions import default - -Logger.initialize_logger() -reload(sys) -sys.setdefaultencoding('utf-8') - -# server configurations -config = Script.get_config() - -# conf_dir = "/etc/" -dolphin_home = "/opt/soft/dolphinscheduler" -dolphin_conf_dir = dolphin_home + "/conf" -dolphin_log_dir = dolphin_home + "/logs" -dolphin_bin_dir = dolphin_home + "/bin" -dolphin_lib_jars = dolphin_home + "/lib/*" -dolphin_pidfile_dir = "/opt/soft/run/dolphinscheduler" - -rmHosts = default("/clusterHostInfo/rm_host", []) - -# dolphin-env -dolphin_env_map = {} -dolphin_env_map.update(config['configurations']['dolphin-env']) - -# which user to install and admin dolphin scheduler -dolphin_user = dolphin_env_map['dolphin.user'] -dolphin_group = dolphin_env_map['dolphin.group'] - -# .dolphinscheduler_env.sh -dolphin_env_path = dolphin_conf_dir + '/env/dolphinscheduler_env.sh' -dolphin_env_content = dolphin_env_map['dolphinscheduler-env-content'] - -# database config -dolphin_database_config = {} -dolphin_database_config['dolphin_database_type'] = dolphin_env_map['dolphin.database.type'] -dolphin_database_config['dolphin_database_username'] = dolphin_env_map['dolphin.database.username'] -dolphin_database_config['dolphin_database_password'] = dolphin_env_map['dolphin.database.password'] -if 'mysql' == dolphin_database_config['dolphin_database_type']: - dolphin_database_config['dolphin_database_driver'] = 'com.mysql.jdbc.Driver' - dolphin_database_config['driverDelegateClass'] = 'org.quartz.impl.jdbcjobstore.StdJDBCDelegate' - dolphin_database_config['dolphin_database_url'] = 'jdbc:mysql://' + dolphin_env_map['dolphin.database.host'] \ - + ':' + dolphin_env_map['dolphin.database.port'] \ - + '/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8' -else: - dolphin_database_config['dolphin_database_driver'] = 'org.postgresql.Driver' - dolphin_database_config['driverDelegateClass'] = 'org.quartz.impl.jdbcjobstore.PostgreSQLDelegate' - dolphin_database_config['dolphin_database_url'] = 'jdbc:postgresql://' + dolphin_env_map['dolphin.database.host'] \ - + ':' + dolphin_env_map['dolphin.database.port'] \ - + '/dolphinscheduler' - - - - - -# application-alert.properties -dolphin_alert_map = {} -wechat_push_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$token' -wechat_token_url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$corpId&corpsecret=$secret' -wechat_team_send_msg = '{\"toparty\":\"$toParty\",\"agentid\":\"$agentId\",\"msgtype\":\"text\",\"text\":{\"content\":\"$msg\"},\"safe\":\"0\"}' -wechat_user_send_msg = '{\"touser\":\"$toUser\",\"agentid\":\"$agentId\",\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"$msg\"}}' - -dolphin_alert_config_map = config['configurations']['dolphin-alert'] - -if dolphin_alert_config_map['enterprise.wechat.enable']: - dolphin_alert_map['enterprise.wechat.push.ur'] = wechat_push_url - dolphin_alert_map['enterprise.wechat.token.url'] = wechat_token_url - dolphin_alert_map['enterprise.wechat.team.send.msg'] = wechat_team_send_msg - dolphin_alert_map['enterprise.wechat.user.send.msg'] = wechat_user_send_msg - -dolphin_alert_map.update(dolphin_alert_config_map) - - - -# application-api.properties -dolphin_app_api_map = {} -dolphin_app_api_map.update(config['configurations']['dolphin-application-api']) - - -# common.properties -dolphin_common_map = {} - -if 'yarn-site' in config['configurations'] and \ - 'yarn.resourcemanager.webapp.address' in config['configurations']['yarn-site']: - yarn_resourcemanager_webapp_address = config['configurations']['yarn-site']['yarn.resourcemanager.webapp.address'] - yarn_application_status_address = 'http://' + yarn_resourcemanager_webapp_address + '/ws/v1/cluster/apps/%s' - dolphin_common_map['yarn.application.status.address'] = yarn_application_status_address - -rmHosts = default("/clusterHostInfo/rm_host", []) -if len(rmHosts) > 1: - dolphin_common_map['yarn.resourcemanager.ha.rm.ids'] = ','.join(rmHosts) -else: - dolphin_common_map['yarn.resourcemanager.ha.rm.ids'] = '' - -dolphin_common_map_tmp = config['configurations']['dolphin-common'] -data_basedir_path = dolphin_common_map_tmp['data.basedir.path'] -process_exec_basepath = data_basedir_path + '/exec' -data_download_basedir_path = data_basedir_path + '/download' -dolphin_common_map['process.exec.basepath'] = process_exec_basepath -dolphin_common_map['data.download.basedir.path'] = data_download_basedir_path -dolphin_common_map['dolphinscheduler.env.path'] = dolphin_env_path -dolphin_common_map.update(config['configurations']['dolphin-common']) - -# datasource.properties -dolphin_datasource_map = {} -dolphin_datasource_map['spring.datasource.type'] = 'com.alibaba.druid.pool.DruidDataSource' -dolphin_datasource_map['spring.datasource.driver-class-name'] = dolphin_database_config['dolphin_database_driver'] -dolphin_datasource_map['spring.datasource.url'] = dolphin_database_config['dolphin_database_url'] -dolphin_datasource_map['spring.datasource.username'] = dolphin_database_config['dolphin_database_username'] -dolphin_datasource_map['spring.datasource.password'] = dolphin_database_config['dolphin_database_password'] -dolphin_datasource_map.update(config['configurations']['dolphin-datasource']) - -# master.properties -dolphin_master_map = config['configurations']['dolphin-master'] - -# quartz.properties -dolphin_quartz_map = {} -dolphin_quartz_map['org.quartz.jobStore.driverDelegateClass'] = dolphin_database_config['driverDelegateClass'] -dolphin_quartz_map.update(config['configurations']['dolphin-quartz']) - -# worker.properties -dolphin_worker_map = config['configurations']['dolphin-worker'] - -# zookeeper.properties -dolphin_zookeeper_map={} -zookeeperHosts = default("/clusterHostInfo/zookeeper_hosts", []) -if len(zookeeperHosts) > 0 and "clientPort" in config['configurations']['zoo.cfg']: - clientPort = config['configurations']['zoo.cfg']['clientPort'] - zookeeperPort = ":" + clientPort + "," - dolphin_zookeeper_map['zookeeper.quorum'] = zookeeperPort.join(zookeeperHosts) + ":" + clientPort -dolphin_zookeeper_map.update(config['configurations']['dolphin-zookeeper']) - - - diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/service_check.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/service_check.py deleted file mode 100644 index 0e12f69932..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/service_check.py +++ /dev/null @@ -1,31 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -from resource_management import * -from resource_management.libraries.functions import get_unique_id_and_date - -class ServiceCheck(Script): - def service_check(self, env): - import params - #env.set_params(params) - - # Execute(format("which pika_server")) - -if __name__ == "__main__": - ServiceCheck().execute() diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/status_params.py b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/status_params.py deleted file mode 100644 index 24b2c8b1bc..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/scripts/status_params.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -""" - -from resource_management import * - -config = Script.get_config() - -dolphin_run_dir = "/opt/soft/run/dolphinscheduler/" diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/alert.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/alert.properties.j2 deleted file mode 100644 index 73840b8c18..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/alert.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_alert_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/application-api.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/application-api.properties.j2 deleted file mode 100644 index 70118003b9..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/application-api.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_app_api_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/common.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/common.properties.j2 deleted file mode 100644 index 2220c4effa..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/common.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_common_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/datasource.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/datasource.properties.j2 deleted file mode 100644 index 40aed83543..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/datasource.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_datasource_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/dolphin-daemon.sh.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/dolphin-daemon.sh.j2 deleted file mode 100644 index 0802b74750..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/dolphin-daemon.sh.j2 +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -usage="Usage: dolphinscheduler-daemon.sh (start|stop) " - -# if no args specified, show usage -if [ $# -le 1 ]; then - echo $usage - exit 1 -fi - -startStop=$1 -shift -command=$1 -shift - -echo "Begin $startStop $command......" - -BIN_DIR=`dirname $0` -BIN_DIR=`cd "$BIN_DIR"; pwd` -DOLPHINSCHEDULER_HOME=$BIN_DIR/.. - -export HOSTNAME=`hostname` - -DOLPHINSCHEDULER_LIB_JARS={{dolphin_lib_jars}} - -DOLPHINSCHEDULER_OPTS="-server -Xmx16g -Xms4g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" -STOP_TIMEOUT=5 - -log={{dolphin_log_dir}}/dolphinscheduler-$command-$HOSTNAME.out -pid={{dolphin_pidfile_dir}}/$command.pid - -cd $DOLPHINSCHEDULER_HOME - -if [ "$command" = "api-server" ]; then - LOG_FILE="-Dlogging.config={{dolphin_conf_dir}}/logback-api.xml -Dspring.profiles.active=api" - CLASS=org.apache.dolphinscheduler.api.ApiApplicationServer -elif [ "$command" = "master-server" ]; then - LOG_FILE="-Dlogging.config={{dolphin_conf_dir}}/logback-master.xml -Ddruid.mysql.usePingMethod=false" - CLASS=org.apache.dolphinscheduler.server.master.MasterServer -elif [ "$command" = "worker-server" ]; then - LOG_FILE="-Dlogging.config={{dolphin_conf_dir}}/logback-worker.xml -Ddruid.mysql.usePingMethod=false" - CLASS=org.apache.dolphinscheduler.server.worker.WorkerServer -elif [ "$command" = "alert-server" ]; then - LOG_FILE="-Dlogging.config={{dolphin_conf_dir}}/logback-alert.xml" - CLASS=org.apache.dolphinscheduler.alert.AlertServer -elif [ "$command" = "logger-server" ]; then - CLASS=org.apache.dolphinscheduler.server.log.LoggerServer -else - echo "Error: No command named \`$command' was found." - exit 1 -fi - -case $startStop in - (start) - - if [ -f $pid ]; then - if kill -0 `cat $pid` > /dev/null 2>&1; then - echo $command running as process `cat $pid`. Stop it first. - exit 1 - fi - fi - - echo starting $command, logging to $log - - exec_command="$LOG_FILE $DOLPHINSCHEDULER_OPTS -classpath {{dolphin_conf_dir}}:{{dolphin_lib_jars}} $CLASS" - - echo "nohup java $exec_command > $log 2>&1 < /dev/null &" - nohup java $exec_command > $log 2>&1 < /dev/null & - echo $! > $pid - ;; - - (stop) - - if [ -f $pid ]; then - TARGET_PID=`cat $pid` - if kill -0 $TARGET_PID > /dev/null 2>&1; then - echo stopping $command - kill $TARGET_PID - sleep $STOP_TIMEOUT - if kill -0 $TARGET_PID > /dev/null 2>&1; then - echo "$command did not stop gracefully after $STOP_TIMEOUT seconds: killing with kill -9" - kill -9 $TARGET_PID - fi - else - echo no $command to stop - fi - rm -f $pid - else - echo no $command to stop - fi - ;; - - (*) - echo $usage - exit 1 - ;; - -esac - -echo "End $startStop $command." \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/master.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/master.properties.j2 deleted file mode 100644 index d9b85e14cf..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/master.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_master_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/quartz.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/quartz.properties.j2 deleted file mode 100644 index e027a263b5..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/quartz.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_quartz_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/worker.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/worker.properties.j2 deleted file mode 100644 index a008b74084..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/worker.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_worker_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/zookeeper.properties.j2 b/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/zookeeper.properties.j2 deleted file mode 100644 index 9eb14eaef3..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/package/templates/zookeeper.properties.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -{% for key, value in dolphin_zookeeper_map.iteritems() -%} - {{key}}={{value}} -{% endfor %} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/quicklinks/quicklinks.json b/ambari_plugin/common-services/DOLPHIN/2.0.0/quicklinks/quicklinks.json deleted file mode 100755 index 8753004fef..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/quicklinks/quicklinks.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "default", - "description": "default quick links configuration", - "configuration": { - "protocol": - { - "type":"http" - }, - - "links": [ - { - "name": "dolphin-application-ui", - "label": "DolphinApplication UI", - "requires_user_name": "false", - "component_name": "DOLPHIN_API", - "url": "%@://%@:%@/dolphinscheduler/ui/view/login/index.html", - "port":{ - "http_property": "server.port", - "http_default_port": "12345", - "regex": "^(\\d+)$", - "site": "dolphin-application-api" - } - } - ] - } -} \ No newline at end of file diff --git a/ambari_plugin/common-services/DOLPHIN/2.0.0/themes/theme.json b/ambari_plugin/common-services/DOLPHIN/2.0.0/themes/theme.json deleted file mode 100644 index 953e2323f8..0000000000 --- a/ambari_plugin/common-services/DOLPHIN/2.0.0/themes/theme.json +++ /dev/null @@ -1,661 +0,0 @@ -{ - "name": "default", - "description": "Default theme for Dolphin Scheduler service", - "configuration": { - "layouts": [ - { - "name": "default", - "tabs": [ - { - "name": "settings", - "display-name": "Settings", - "layout": { - "tab-rows": "3", - "tab-columns": "3", - "sections": [ - { - "name": "dolphin-env-config", - "display-name": "Dolphin Env Config", - "row-index": "0", - "column-index": "0", - "row-span": "1", - "column-span": "2", - "section-rows": "1", - "section-columns": "2", - "subsections": [ - { - "name": "env-row1-col1", - "display-name": "Deploy User Info", - "row-index": "0", - "column-index": "0", - "row-span": "1", - "column-span": "1" - }, - { - "name": "env-row1-col2", - "display-name": "System Env Optimization", - "row-index": "0", - "column-index": "1", - "row-span": "1", - "column-span": "1" - } - ] - }, - { - "name": "dolphin-database-config", - "display-name": "Database Config", - "row-index": "1", - "column-index": "0", - "row-span": "1", - "column-span": "2", - "section-rows": "1", - "section-columns": "3", - "subsections": [ - { - "name": "database-row1-col1", - "row-index": "0", - "column-index": "0", - "row-span": "1", - "column-span": "1" - }, - { - "name": "database-row1-col2", - "row-index": "0", - "column-index": "1", - "row-span": "1", - "column-span": "1" - }, - { - "name": "database-row1-col3", - "row-index": "0", - "column-index": "2", - "row-span": "1", - "column-span": "1" - } - ] - }, - { - "name": "dynamic-config", - "row-index": "2", - "column-index": "0", - "row-span": "1", - "column-span": "2", - "section-rows": "1", - "section-columns": "3", - "subsections": [ - { - "name": "dynamic-row1-col1", - "display-name": "Resource FS Config", - "row-index": "0", - "column-index": "0", - "row-span": "1", - "column-span": "1" - }, - { - "name": "dynamic-row1-col2", - "display-name": "Kerberos Info", - "row-index": "0", - "column-index": "1", - "row-span": "1", - "column-span": "1" - }, - { - "name": "dynamic-row1-col3", - "display-name": "Wechat Info", - "row-index": "0", - "column-index": "1", - "row-span": "1", - "column-span": "1" - } - ] - } - ] - } - } - ] - } - ], - "placement": { - "configuration-layout": "default", - "configs": [ - { - "config": "dolphin-env/dolphin.database.type", - "subsection-name": "database-row1-col1" - }, - { - "config": "dolphin-env/dolphin.database.host", - "subsection-name": "database-row1-col2" - }, - { - "config": "dolphin-env/dolphin.database.port", - "subsection-name": "database-row1-col2" - }, - { - "config": "dolphin-env/dolphin.database.username", - "subsection-name": "database-row1-col3" - }, - { - "config": "dolphin-env/dolphin.database.password", - "subsection-name": "database-row1-col3" - }, - { - "config": "dolphin-env/dolphin.user", - "subsection-name": "env-row1-col1" - }, - { - "config": "dolphin-env/dolphin.group", - "subsection-name": "env-row1-col1" - }, - { - "config": "dolphin-env/dolphinscheduler-env-content", - "subsection-name": "env-row1-col2" - }, - { - "config": "dolphin-common/resource.storage.type", - "subsection-name": "dynamic-row1-col1" - }, - { - "config": "dolphin-common/resource.upload.path", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === HDFS || ${dolphin-common/resource.storage.type} === S3", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/hdfs.root.user", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === HDFS", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/data.store2hdfs.basepath", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === HDFS", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/fs.defaultFS", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === HDFS", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/fs.s3a.endpoint", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === S3", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/fs.s3a.access.key", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === S3", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/fs.s3a.secret.key", - "subsection-name": "dynamic-row1-col1", - "depends-on": [ - { - "configs":[ - "dolphin-common/resource.storage.type" - ], - "if": "${dolphin-common/resource.storage.type} === S3", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/hadoop.security.authentication.startup.state", - "subsection-name": "dynamic-row1-col2" - }, - { - "config": "dolphin-common/java.security.krb5.conf.path", - "subsection-name": "dynamic-row1-col2", - "depends-on": [ - { - "configs":[ - "dolphin-common/hadoop.security.authentication.startup.state" - ], - "if": "${dolphin-common/hadoop.security.authentication.startup.state}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/login.user.keytab.username", - "subsection-name": "dynamic-row1-col2", - "depends-on": [ - { - "configs":[ - "dolphin-common/hadoop.security.authentication.startup.state" - ], - "if": "${dolphin-common/hadoop.security.authentication.startup.state}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/login.user.keytab.path", - "subsection-name": "dynamic-row1-col2", - "depends-on": [ - { - "configs":[ - "dolphin-common/hadoop.security.authentication.startup.state" - ], - "if": "${dolphin-common/hadoop.security.authentication.startup.state}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-common/kerberos.expire.time", - "subsection-name": "dynamic-row1-col2", - "depends-on": [ - { - "configs":[ - "dolphin-common/hadoop.security.authentication.startup.state" - ], - "if": "${dolphin-common/hadoop.security.authentication.startup.state}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-alert/enterprise.wechat.enable", - "subsection-name": "dynamic-row1-col3" - }, - { - "config": "dolphin-alert/enterprise.wechat.corp.id", - "subsection-name": "dynamic-row1-col3", - "depends-on": [ - { - "configs":[ - "dolphin-alert/enterprise.wechat.enable" - ], - "if": "${dolphin-alert/enterprise.wechat.enable}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-alert/enterprise.wechat.secret", - "subsection-name": "dynamic-row1-col3", - "depends-on": [ - { - "configs":[ - "dolphin-alert/enterprise.wechat.enable" - ], - "if": "${dolphin-alert/enterprise.wechat.enable}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-alert/enterprise.wechat.agent.id", - "subsection-name": "dynamic-row1-col3", - "depends-on": [ - { - "configs":[ - "dolphin-alert/enterprise.wechat.enable" - ], - "if": "${dolphin-alert/enterprise.wechat.enable}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - }, - { - "config": "dolphin-alert/enterprise.wechat.users", - "subsection-name": "dynamic-row1-col3", - "depends-on": [ - { - "configs":[ - "dolphin-alert/enterprise.wechat.enable" - ], - "if": "${dolphin-alert/enterprise.wechat.enable}", - "then": { - "property_value_attributes": { - "visible": true - } - }, - "else": { - "property_value_attributes": { - "visible": false - } - } - } - ] - } - ] - }, - "widgets": [ - { - "config": "dolphin-env/dolphin.database.type", - "widget": { - "type": "combo" - } - }, - { - "config": "dolphin-env/dolphin.database.host", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-env/dolphin.database.port", - "widget": { - "type": "text-field", - "units": [ - { - "unit-name": "int" - } - ] - } - }, - { - "config": "dolphin-env/dolphin.database.username", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-env/dolphin.database.password", - "widget": { - "type": "password" - } - }, - { - "config": "dolphin-env/dolphin.user", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-env/dolphin.group", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-env/dolphinscheduler-env-content", - "widget": { - "type": "text-area" - } - }, - { - "config": "dolphin-common/resource.storage.type", - "widget": { - "type": "combo" - } - }, - { - "config": "dolphin-common/resource.upload.path", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/hdfs.root.user", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/data.store2hdfs.basepath", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/fs.defaultFS", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/fs.s3a.endpoint", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/fs.s3a.access.key", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/fs.s3a.secret.key", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/hadoop.security.authentication.startup.state", - "widget": { - "type": "toggle" - } - }, - { - "config": "dolphin-common/java.security.krb5.conf.path", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/login.user.keytab.username", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/login.user.keytab.path", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-common/kerberos.expire.time", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-alert/enterprise.wechat.enable", - "widget": { - "type": "toggle" - } - }, - { - "config": "dolphin-alert/enterprise.wechat.corp.id", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-alert/enterprise.wechat.secret", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-alert/enterprise.wechat.agent.id", - "widget": { - "type": "text-field" - } - }, - { - "config": "dolphin-alert/enterprise.wechat.users", - "widget": { - "type": "text-field" - } - } - ] - } -} From 6e08b29254f3a5c340172c34a6a67e3cc8af0c48 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Sat, 2 May 2020 22:19:20 +0800 Subject: [PATCH 20/33] Add a script to check the license (#2552) * Add a script to check the license ### Motivation Check licenses in the distribution package ### Modification 1. Add a script to check licenses, and list known licenses. 1. Remove unused dep license, lombok. 1. Remove unnecessary ignored patterns in .gitignore. 1. Add missing config items to apache-rat plugin, which just checked a small part of files before. 1. Add check to GitHub Actions process ### Result 1. Newly-added dependencies should be checked and confirmed. 1. Closes #1578 * Separate rat and dependency check * Tee dependencies to stdout * Add more debug messages * Check light-weight task first --- .github/workflows/ci_backend.yml | 22 +- .gitignore | 125 +---------- dolphinscheduler-dist/release-docs/LICENSE | 1 - .../release-docs/licenses/LICENSE-lombok.txt | 19 -- dolphinscheduler-ui/package.json | 2 +- pom.xml | 18 +- tools/dependencies/check-LICENSE.sh | 39 ++++ tools/dependencies/known-dependencies.txt | 211 ++++++++++++++++++ 8 files changed, 284 insertions(+), 153 deletions(-) delete mode 100644 dolphinscheduler-dist/release-docs/licenses/LICENSE-lombok.txt create mode 100755 tools/dependencies/check-LICENSE.sh create mode 100755 tools/dependencies/known-dependencies.txt diff --git a/.github/workflows/ci_backend.yml b/.github/workflows/ci_backend.yml index 0273251e99..c24a3ecf07 100644 --- a/.github/workflows/ci_backend.yml +++ b/.github/workflows/ci_backend.yml @@ -56,21 +56,9 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 + - name: Check license + run: ./mvnw -B apache-rat:check - name: Compile - run: mvn -B clean compile package -Prelease -Dmaven.test.skip=true - License-check: - runs-on: ubuntu-latest - steps: - - 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: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Check - run: mvn -B apache-rat:check + run: mvn -B clean compile install -Prelease -Dmaven.test.skip=true + - name: Check dependency license + run: tools/dependencies/check-LICENSE.sh diff --git a/.gitignore b/.gitignore index 6dd99201a9..17b0dc6610 100644 --- a/.gitignore +++ b/.gitignore @@ -4,27 +4,24 @@ .zip .gz .DS_Store -.idea .idea/ -.idea/* -.target -.target/ -**/**/target/** -target/* -*/target -*/target/* +dist/ +all-dependencies.txt +self-modules.txt +third-party-dependencies.txt +**/target/ .settings .nbproject .classpath .project -*.iml +**/*.iml *.ipr *.iws *.tgz .*.swp .vim .tmp -node_modules +**/node_modules npm-debug.log .vscode logs/* @@ -41,110 +38,10 @@ dolphinscheduler-alert/logs/ dolphinscheduler-alert/src/main/resources/alert.properties_bak dolphinscheduler-alert/src/main/resources/logback.xml dolphinscheduler-server/src/main/resources/logback.xml -dolphinscheduler-ui/dist +dolphinscheduler-ui/dist/ dolphinscheduler-ui/node -dolphinscheduler-ui/dist/css/common.16ac5d9.css -dolphinscheduler-ui/dist/css/home/index.b444b91.css -dolphinscheduler-ui/dist/css/login/index.5866c64.css -dolphinscheduler-ui/dist/js/0.ac94e5d.js -dolphinscheduler-ui/dist/js/0.ac94e5d.js.map -dolphinscheduler-ui/dist/js/1.0b043a3.js -dolphinscheduler-ui/dist/js/1.0b043a3.js.map -dolphinscheduler-ui/dist/js/10.1bce3dc.js -dolphinscheduler-ui/dist/js/10.1bce3dc.js.map -dolphinscheduler-ui/dist/js/11.79f04d8.js -dolphinscheduler-ui/dist/js/11.79f04d8.js.map -dolphinscheduler-ui/dist/js/12.420daa5.js -dolphinscheduler-ui/dist/js/12.420daa5.js.map -dolphinscheduler-ui/dist/js/13.e5bae1c.js -dolphinscheduler-ui/dist/js/13.e5bae1c.js.map -dolphinscheduler-ui/dist/js/14.f2a0dca.js -dolphinscheduler-ui/dist/js/14.f2a0dca.js.map -dolphinscheduler-ui/dist/js/15.45373e8.js -dolphinscheduler-ui/dist/js/15.45373e8.js.map -dolphinscheduler-ui/dist/js/16.fecb0fc.js -dolphinscheduler-ui/dist/js/16.fecb0fc.js.map -dolphinscheduler-ui/dist/js/17.84be279.js -dolphinscheduler-ui/dist/js/17.84be279.js.map -dolphinscheduler-ui/dist/js/18.307ea70.js -dolphinscheduler-ui/dist/js/18.307ea70.js.map -dolphinscheduler-ui/dist/js/19.144db9c.js -dolphinscheduler-ui/dist/js/19.144db9c.js.map -dolphinscheduler-ui/dist/js/2.8b4ef29.js -dolphinscheduler-ui/dist/js/2.8b4ef29.js.map -dolphinscheduler-ui/dist/js/20.4c527e9.js -dolphinscheduler-ui/dist/js/20.4c527e9.js.map -dolphinscheduler-ui/dist/js/21.831b2a2.js -dolphinscheduler-ui/dist/js/21.831b2a2.js.map -dolphinscheduler-ui/dist/js/22.2b4bb2a.js -dolphinscheduler-ui/dist/js/22.2b4bb2a.js.map -dolphinscheduler-ui/dist/js/23.81467ef.js -dolphinscheduler-ui/dist/js/23.81467ef.js.map -dolphinscheduler-ui/dist/js/24.54a00e4.js -dolphinscheduler-ui/dist/js/24.54a00e4.js.map -dolphinscheduler-ui/dist/js/25.8d7bd36.js -dolphinscheduler-ui/dist/js/25.8d7bd36.js.map -dolphinscheduler-ui/dist/js/26.2ec5e78.js -dolphinscheduler-ui/dist/js/26.2ec5e78.js.map -dolphinscheduler-ui/dist/js/27.3ab48c2.js -dolphinscheduler-ui/dist/js/27.3ab48c2.js.map -dolphinscheduler-ui/dist/js/28.363088a.js -dolphinscheduler-ui/dist/js/28.363088a.js.map -dolphinscheduler-ui/dist/js/29.6c5853a.js -dolphinscheduler-ui/dist/js/29.6c5853a.js.map -dolphinscheduler-ui/dist/js/3.a0edb5b.js -dolphinscheduler-ui/dist/js/3.a0edb5b.js.map -dolphinscheduler-ui/dist/js/30.940fdd3.js -dolphinscheduler-ui/dist/js/30.940fdd3.js.map -dolphinscheduler-ui/dist/js/31.168a460.js -dolphinscheduler-ui/dist/js/31.168a460.js.map -dolphinscheduler-ui/dist/js/32.8df6594.js -dolphinscheduler-ui/dist/js/32.8df6594.js.map -dolphinscheduler-ui/dist/js/33.4480bbe.js -dolphinscheduler-ui/dist/js/33.4480bbe.js.map -dolphinscheduler-ui/dist/js/34.b407fe1.js -dolphinscheduler-ui/dist/js/34.b407fe1.js.map -dolphinscheduler-ui/dist/js/35.f340b0a.js -dolphinscheduler-ui/dist/js/35.f340b0a.js.map -dolphinscheduler-ui/dist/js/36.8880c2d.js -dolphinscheduler-ui/dist/js/36.8880c2d.js.map -dolphinscheduler-ui/dist/js/37.ea2a25d.js -dolphinscheduler-ui/dist/js/37.ea2a25d.js.map -dolphinscheduler-ui/dist/js/38.98a59ee.js -dolphinscheduler-ui/dist/js/38.98a59ee.js.map -dolphinscheduler-ui/dist/js/39.a5e958a.js -dolphinscheduler-ui/dist/js/39.a5e958a.js.map -dolphinscheduler-ui/dist/js/4.4ca44db.js -dolphinscheduler-ui/dist/js/4.4ca44db.js.map -dolphinscheduler-ui/dist/js/40.e187b1e.js -dolphinscheduler-ui/dist/js/40.e187b1e.js.map -dolphinscheduler-ui/dist/js/41.0e89182.js -dolphinscheduler-ui/dist/js/41.0e89182.js.map -dolphinscheduler-ui/dist/js/42.341047c.js -dolphinscheduler-ui/dist/js/42.341047c.js.map -dolphinscheduler-ui/dist/js/43.27b8228.js -dolphinscheduler-ui/dist/js/43.27b8228.js.map -dolphinscheduler-ui/dist/js/44.e8869bc.js -dolphinscheduler-ui/dist/js/44.e8869bc.js.map -dolphinscheduler-ui/dist/js/45.8d54901.js -dolphinscheduler-ui/dist/js/45.8d54901.js.map -dolphinscheduler-ui/dist/js/5.e1ed7f3.js -dolphinscheduler-ui/dist/js/5.e1ed7f3.js.map -dolphinscheduler-ui/dist/js/6.241ba07.js -dolphinscheduler-ui/dist/js/6.241ba07.js.map -dolphinscheduler-ui/dist/js/7.ab2e297.js -dolphinscheduler-ui/dist/js/7.ab2e297.js.map -dolphinscheduler-ui/dist/js/8.83ff814.js -dolphinscheduler-ui/dist/js/8.83ff814.js.map -dolphinscheduler-ui/dist/js/9.39cb29f.js -dolphinscheduler-ui/dist/js/9.39cb29f.js.map -dolphinscheduler-ui/dist/js/common.733e342.js -dolphinscheduler-ui/dist/js/common.733e342.js.map -dolphinscheduler-ui/dist/js/home/index.78a5d12.js -dolphinscheduler-ui/dist/js/home/index.78a5d12.js.map -dolphinscheduler-ui/dist/js/login/index.291b8e3.js -dolphinscheduler-ui/dist/js/login/index.291b8e3.js.map -dolphinscheduler-ui/dist/lib/external/ -/dolphinscheduler-dao/src/main/resources/dao/data_source.properties +dolphinscheduler-dao/src/main/resources/dao/data_source.properties + +.mvn/wrapper/*.jar !/zookeeper_data/ diff --git a/dolphinscheduler-dist/release-docs/LICENSE b/dolphinscheduler-dist/release-docs/LICENSE index 82e641ec72..52563f5573 100644 --- a/dolphinscheduler-dist/release-docs/LICENSE +++ b/dolphinscheduler-dist/release-docs/LICENSE @@ -474,7 +474,6 @@ The following components are provided under a MIT 2.0 license. See project link The text of each license is also included at licenses/LICENSE-[project].txt. jul-to-slf4j 1.7.25: https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j/1.7.25, MIT - lombok 1.18.6: https://mvnrepository.com/artifact/org.projectlombok/lombok/1.18.6, MIT mssql-jdbc 6.1.0.jre8: https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc/6.1.0.jre8, MIT slf4j-api 1.7.5: https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.5, MIT diff --git a/dolphinscheduler-dist/release-docs/licenses/LICENSE-lombok.txt b/dolphinscheduler-dist/release-docs/licenses/LICENSE-lombok.txt deleted file mode 100644 index 5da7dbeff3..0000000000 --- a/dolphinscheduler-dist/release-docs/licenses/LICENSE-lombok.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (C) 2009-2015 The Project Lombok Authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/dolphinscheduler-ui/package.json b/dolphinscheduler-ui/package.json index b23969803b..5dc1cb44db 100644 --- a/dolphinscheduler-ui/package.json +++ b/dolphinscheduler-ui/package.json @@ -55,7 +55,7 @@ "html-loader": "^0.5.5", "html-webpack-plugin": "^3.2.0", "mini-css-extract-plugin": "^0.8.2", - "node-sass": "^4.13.1", + "node-sass": "^4.14.0", "postcss-loader": "^3.0.0", "progress-bar-webpack-plugin": "^1.12.1", "rimraf": "^2.6.2", diff --git a/pom.xml b/pom.xml index e922d544fc..7e291d2c4e 100644 --- a/pom.xml +++ b/pom.xml @@ -876,6 +876,22 @@ apache-rat-plugin ${apache.rat.version} + false + false + + + AL20 + Apache License, 2.0 + + Licensed to the Apache Software Foundation (ASF) + + + + + + Apache License, 2.0 + + **/node_modules/** **/node/** @@ -894,7 +910,7 @@ **/*.babelrc **/*.eslintrc **/.mvn/jvm.config - **/.mvn/wrapper/maven-wrapper.properties + **/.mvn/wrapper/** true diff --git a/tools/dependencies/check-LICENSE.sh b/tools/dependencies/check-LICENSE.sh new file mode 100755 index 0000000000..d414bd40c6 --- /dev/null +++ b/tools/dependencies/check-LICENSE.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mkdir dist || true + +tar -zxf dolphinscheduler-dist/target/apache-dolphinscheduler*-bin.tar.gz --strip=1 -C dist + +# List all modules(jars) that belong to the DolphinScheduler itself, these will be ignored when checking the dependency +# licenses +echo '=== Self modules: ' && ./mvnw --batch-mode --quiet -Dexec.executable='echo' -Dexec.args='${project.artifactId}-${project.version}.jar' exec:exec | tee self-modules.txt + +echo '=== Distributed dependencies: ' && ls dist/lib | tee all-dependencies.txt + +# Exclude all self modules(jars) to generate all third-party dependencies +echo '=== Third party dependencies: ' && grep -vf self-modules.txt all-dependencies.txt | tee third-party-dependencies.txt + +# 1. Compare the third-party dependencies with known dependencies, expect that all third-party dependencies are KNOWN +# and the exit code of the command is 0, otherwise we should add its license to LICENSE file and add the dependency to +# known-dependencies.txt. 2. Unify the `sort` behaviour: here we'll sort them again in case that the behaviour of `sort` +# command in target OS is different from what we used to sort the file `known-dependencies.txt`, i.e. "sort the two file +# using the same command (and default arguments)" + +diff -w -B -U0 <(sort < tools/dependencies/known-dependencies.txt) <(sort < third-party-dependencies.txt) diff --git a/tools/dependencies/known-dependencies.txt b/tools/dependencies/known-dependencies.txt new file mode 100755 index 0000000000..6601cf9c34 --- /dev/null +++ b/tools/dependencies/known-dependencies.txt @@ -0,0 +1,211 @@ +HikariCP-3.2.0.jar +activation-1.1.jar +ant-1.6.5.jar +aopalliance-1.0.jar +apache-el-8.5.35.1.jar +apacheds-i18n-2.0.0-M15.jar +apacheds-kerberos-codec-2.0.0-M15.jar +api-asn1-api-1.0.0-M20.jar +api-util-1.0.0-M20.jar +asm-3.1.jar +aspectjweaver-1.9.2.jar +audience-annotations-0.5.0.jar +avro-1.7.4.jar +aws-java-sdk-1.7.4.jar +bonecp-0.8.0.RELEASE.jar +byte-buddy-1.9.10.jar +classmate-1.4.0.jar +clickhouse-jdbc-0.1.52.jar +commons-cli-1.2.jar +commons-codec-1.6.jar +commons-collections-3.2.2.jar +commons-collections4-4.1.jar +commons-compiler-3.0.12.jar +commons-compress-1.4.1.jar +commons-configuration-1.10.jar +commons-daemon-1.0.13.jar +commons-dbcp-1.4.jar +commons-email-1.5.jar +commons-httpclient-3.0.1.jar +commons-io-2.4.jar +commons-lang-2.6.jar +commons-logging-1.1.1.jar +commons-math3-3.1.1.jar +commons-net-3.1.jar +commons-pool-1.6.jar +core-3.1.1.jar +cron-utils-5.0.5.jar +curator-client-4.3.0.jar +curator-framework-4.3.0.jar +curator-recipes-4.3.0.jar +datanucleus-api-jdo-4.2.1.jar +datanucleus-core-4.1.6.jar +datanucleus-rdbms-4.1.7.jar +derby-10.14.2.0.jar +druid-1.1.14.jar +fastjson-1.2.61.jar +gson-2.8.5.jar +guava-20.0.jar +guice-3.0.jar +guice-servlet-3.0.jar +h2-1.4.200.jar +hadoop-annotations-2.7.3.jar +hadoop-auth-2.7.3.jar +hadoop-aws-2.7.3.jar +hadoop-client-2.7.3.jar +hadoop-common-2.7.3.jar +hadoop-hdfs-2.7.3.jar +hadoop-mapreduce-client-app-2.7.3.jar +hadoop-mapreduce-client-common-2.7.3.jar +hadoop-mapreduce-client-core-2.7.3.jar +hadoop-mapreduce-client-jobclient-2.7.3.jar +hadoop-mapreduce-client-shuffle-2.7.3.jar +hadoop-yarn-api-2.7.3.jar +hadoop-yarn-client-2.7.3.jar +hadoop-yarn-common-2.7.3.jar +hadoop-yarn-server-common-2.7.3.jar +hamcrest-core-1.3.jar +hibernate-validator-6.0.14.Final.jar +hive-common-2.1.0.jar +hive-jdbc-2.1.0.jar +hive-metastore-2.1.0.jar +hive-orc-2.1.0.jar +hive-serde-2.1.0.jar +hive-service-2.1.0.jar +hive-service-rpc-2.1.0.jar +hive-storage-api-2.1.0.jar +htrace-core-3.1.0-incubating.jar +httpclient-4.4.1.jar +httpcore-4.4.1.jar +httpmime-4.5.7.jar +jackson-annotations-2.9.8.jar +jackson-core-2.9.8.jar +jackson-core-asl-1.9.13.jar +jackson-databind-2.9.8.jar +jackson-datatype-jdk8-2.9.8.jar +jackson-datatype-jsr310-2.9.8.jar +jackson-jaxrs-1.9.13.jar +jackson-mapper-asl-1.9.13.jar +jackson-module-parameter-names-2.9.8.jar +jackson-xc-1.9.13.jar +jamon-runtime-2.3.1.jar +janino-3.0.12.jar +java-xmlbuilder-0.4.jar +javax.activation-api-1.2.0.jar +javax.annotation-api-1.3.2.jar +javax.inject-1.jar +javax.jdo-3.2.0-m3.jar +javax.mail-1.6.2.jar +javax.servlet-api-3.1.0.jar +javolution-5.5.1.jar +jaxb-api-2.3.1.jar +jaxb-impl-2.2.3-1.jar +jboss-logging-3.3.2.Final.jar +jdo-api-3.0.1.jar +jersey-client-1.9.jar +jersey-core-1.9.jar +jersey-guice-1.9.jar +jersey-json-1.9.jar +jersey-server-1.9.jar +jets3t-0.9.0.jar +jettison-1.1.jar +jetty-6.1.26.jar +jetty-continuation-9.4.14.v20181114.jar +jetty-http-9.4.14.v20181114.jar +jetty-io-9.4.14.v20181114.jar +jetty-security-9.4.14.v20181114.jar +jetty-server-9.4.14.v20181114.jar +jetty-servlet-9.4.14.v20181114.jar +jetty-servlets-9.4.14.v20181114.jar +jetty-util-6.1.26.jar +jetty-util-9.4.14.v20181114.jar +jetty-webapp-9.4.14.v20181114.jar +jetty-xml-9.4.14.v20181114.jar +jline-0.9.94.jar +jna-4.5.2.jar +jna-platform-4.5.2.jar +joda-time-2.10.1.jar +jpam-1.1.jar +jsch-0.1.42.jar +jsp-2.1-6.1.14.jar +jsp-api-2.1-6.1.14.jar +jsp-api-2.1.jar +jsqlparser-2.1.jar +jsr305-3.0.0.jar +jta-1.1.jar +jul-to-slf4j-1.7.25.jar +junit-4.12.jar +leveldbjni-all-1.8.jar +libfb303-0.9.3.jar +libthrift-0.9.3.jar +log4j-1.2-api-2.11.2.jar +log4j-1.2.17.jar +log4j-api-2.11.2.jar +log4j-core-2.11.2.jar +logback-classic-1.2.3.jar +logback-core-1.2.3.jar +lz4-1.3.0.jar +mapstruct-1.2.0.Final.jar +mssql-jdbc-6.1.0.jre8.jar +mybatis-3.5.2.jar +mybatis-plus-3.2.0.jar +mybatis-plus-annotation-3.2.0.jar +mybatis-plus-boot-starter-3.2.0.jar +mybatis-plus-core-3.2.0.jar +mybatis-plus-extension-3.2.0.jar +mybatis-spring-2.0.2.jar +netty-3.6.2.Final.jar +netty-all-4.1.33.Final.jar +opencsv-2.3.jar +oshi-core-3.5.0.jar +paranamer-2.3.jar +parquet-hadoop-bundle-1.8.1.jar +poi-3.17.jar +postgresql-42.1.4.jar +protobuf-java-2.5.0.jar +quartz-2.2.3.jar +quartz-jobs-2.2.3.jar +slf4j-api-1.7.5.jar +snakeyaml-1.23.jar +snappy-0.2.jar +snappy-java-1.0.4.1.jar +spring-aop-5.1.5.RELEASE.jar +spring-beans-5.1.5.RELEASE.jar +spring-boot-2.1.3.RELEASE.jar +spring-boot-autoconfigure-2.1.3.RELEASE.jar +spring-boot-starter-2.1.3.RELEASE.jar +spring-boot-starter-aop-2.1.3.RELEASE.jar +spring-boot-starter-jdbc-2.1.3.RELEASE.jar +spring-boot-starter-jetty-2.1.3.RELEASE.jar +spring-boot-starter-json-2.1.3.RELEASE.jar +spring-boot-starter-logging-2.1.3.RELEASE.jar +spring-boot-starter-web-2.1.3.RELEASE.jar +spring-context-5.1.5.RELEASE.jar +spring-core-5.1.5.RELEASE.jar +spring-expression-5.1.5.RELEASE.jar +spring-jcl-5.1.5.RELEASE.jar +spring-jdbc-5.1.5.RELEASE.jar +spring-plugin-core-1.2.0.RELEASE.jar +spring-plugin-metadata-1.2.0.RELEASE.jar +spring-tx-5.1.5.RELEASE.jar +spring-web-5.1.5.RELEASE.jar +spring-webmvc-5.1.5.RELEASE.jar +springfox-core-2.9.2.jar +springfox-schema-2.9.2.jar +springfox-spi-2.9.2.jar +springfox-spring-web-2.9.2.jar +springfox-swagger-common-2.9.2.jar +springfox-swagger-ui-2.9.2.jar +springfox-swagger2-2.9.2.jar +swagger-annotations-1.5.20.jar +swagger-bootstrap-ui-1.9.3.jar +swagger-models-1.5.20.jar +tephra-api-0.6.0.jar +threetenbp-1.3.6.jar +transaction-api-1.1.jar +validation-api-2.0.1.Final.jar +xercesImpl-2.9.1.jar +xml-apis-1.4.01.jar +xmlenc-0.52.jar +xz-1.0.jar +zookeeper-3.4.14.jar From 0456ea63e3329a9868c7aadcd2801858adcf5f49 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Wed, 6 May 2020 11:16:14 +0800 Subject: [PATCH 21/33] Optimize workflow instance page (#2589) Co-authored-by: dailidong --- .../instance/pages/list/_source/list.vue | 47 +++++++++---------- .../pages/instance/pages/list/index.vue | 1 + 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue index af0036ab12..2996f7d731 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue @@ -19,48 +19,48 @@
- - - - - - - - - - - - - + - @@ -73,8 +73,7 @@ {{item.name}} + - -
+ + {{$t('#')}} + {{$t('Process Name')}} - {{$t('Executor')}} + + {{$t('State')}} + {{$t('Run Type')}} + {{$t('Scheduling Time')}} + {{$t('Start Time')}} + {{$t('End Time')}} + {{$t('Duration')}}s + {{$t('Run Times')}} - {{$t('host')}} - + {{$t('fault-tolerant sign')}} -
- {{$t('State')}} +
+ {{$t('host')}} + +
+ {{$t('Executor')}}
+ {{$t('Operation')}}
- {{item.executorName}} - - + {{_rtRunningType(item.commandType)}} @@ -91,14 +90,14 @@ {{item.duration || '-'}} {{item.runTimes}}{{item.recovery}} {{item.host}} - {{item.recovery}} - + {{item.executorName}} + -
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue index 4a4206218a..d26da294f3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue @@ -204,6 +204,7 @@ } .table-box { .fixed { + table-layout: auto; tr { th:last-child,td:last-child { background: inherit; From 50e4b23e1f51e3eb24de53989006c00d0e134f0a Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Wed, 6 May 2020 11:22:11 +0800 Subject: [PATCH 22/33] Workflow definition and task instance page add scroll --- .../definition/pages/list/_source/list.vue | 24 ++++--- .../pages/definition/pages/list/index.vue | 70 +++++++++++++------ .../pages/instance/pages/list/index.vue | 32 ++++----- .../pages/taskInstance/_source/list.vue | 30 ++++---- .../projects/pages/taskInstance/index.vue | 62 +++++++++++----- 5 files changed, 140 insertions(+), 78 deletions(-) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue index 310725dd51..dd4530786d 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue @@ -19,34 +19,36 @@
- - - - - - - - - - diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue index 5dd12b4355..5fcb3f6f21 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue @@ -15,29 +15,30 @@ * limitations under the License. */
+ + {{$t('#')}} + {{$t('Process Name')}} + {{$t('State')}} + {{$t('Create Time')}} + {{$t('Update Time')}} + {{$t('Description')}} + {{$t('Modify User')}} - {{$t('Timing state')}} + +
+ {{$t('Timing state')}} +
+ {{$t('Operation')}}