You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ki...@apache.org on 2020/07/30 10:33:35 UTC
[shardingsphere-elasticjob-ui] branch master updated: Revise
distribution resources (#28)
This is an automated email from the ASF dual-hosted git repository.
kimmking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob-ui.git
The following commit(s) were added to refs/heads/master by this push:
new a61e9d0 Revise distribution resources (#28)
a61e9d0 is described below
commit a61e9d08b50c08ab2ae6c3ff63be9f85149962a5
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Thu Jul 30 18:30:09 2020 +0800
Revise distribution resources (#28)
---
.../cloud/ui/config/DynamicDataSourceConfig.java | 116 ---------------------
.../src/main/resources/application.properties | 6 --
.../src/views/data-source/module/dataSource.vue | 37 +++++--
.../views/history-status/module/historyStatus.vue | 14 ++-
.../views/history-trace/module/historyTrace.vue | 25 +++--
.../views/operation-jobs/module/operationJobs.vue | 15 +--
.../operation-servers/module/operationServers.vue | 12 +--
.../src/main/resources/application.properties | 10 +-
.../conf/elasticjob-cloud-scheduler.properties | 62 +++++++++++
.../src/main/resources/application.properties | 14 ++-
10 files changed, 145 insertions(+), 166 deletions(-)
diff --git a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/config/DynamicDataSourceConfig.java b/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/config/DynamicDataSourceConfig.java
deleted file mode 100644
index b3bab6c..0000000
--- a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/cloud/ui/config/DynamicDataSourceConfig.java
+++ /dev/null
@@ -1,116 +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.
- */
-
-package org.apache.shardingsphere.elasticjob.cloud.ui.config;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.core.env.Environment;
-import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
-
-import javax.sql.DataSource;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Dynamic datasource config.
- */
-@Configuration
-public class DynamicDataSourceConfig {
-
- public static final String DRIVER_CLASS_NAME = "spring.datasource.default.driver-class-name";
-
- public static final String DATASOURCE_URL = "spring.datasource.default.url";
-
- public static final String DATASOURCE_USERNAME = "spring.datasource.default.username";
-
- public static final String DATASOURCE_PASSWORD = "spring.datasource.default.password";
-
- public static final String DEFAULT_DATASOURCE_NAME = "default";
-
- /**
- * Declare dynamicDataSource instead of default dataSource.
- * @param environment spring environment
- * @return A subClass of AbstractRoutingDataSource
- */
- @Bean(name = "dynamicDataSource")
- @Primary
- public DynamicDataSource dynamicDataSource(final Environment environment) {
- DataSource defaultDataSource = createDefaultDataSource(environment);
- DynamicDataSource dynamicDataSource = new DynamicDataSource();
- dynamicDataSource.addDataSource(DEFAULT_DATASOURCE_NAME, defaultDataSource);
- dynamicDataSource.setDefaultTargetDataSource(defaultDataSource);
- return dynamicDataSource;
- }
-
- private DataSource createDefaultDataSource(final Environment environment) {
- String driverName = environment.getProperty(DRIVER_CLASS_NAME);
- String url = environment.getProperty(DATASOURCE_URL);
- String username = environment.getProperty(DATASOURCE_USERNAME);
- String password = environment.getProperty(DATASOURCE_PASSWORD);
- return DataSourceBuilder.create().driverClassName(driverName).type(BasicDataSource.class).url(url)
- .username(username).password(password).build();
- }
-
- public static class DynamicDataSource extends AbstractRoutingDataSource {
-
- private final Map<Object, Object> dataSourceMap = new HashMap<>(10);
-
- @Override
- protected Object determineCurrentLookupKey() {
- return DynamicDataSourceContextHolder.getDataSourceName();
- }
-
- /**
- * Add a data source.
- *
- * @param dataSourceName data source name
- * @param dataSource data source
- */
- public void addDataSource(final String dataSourceName, final DataSource dataSource) {
- dataSourceMap.put(dataSourceName, dataSource);
- setTargetDataSources(dataSourceMap);
- afterPropertiesSet();
- }
- }
-
- public static class DynamicDataSourceContextHolder {
-
- private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();
-
- /**
- * Get the specify dataSource.
- *
- * @return data source name
- */
- public static String getDataSourceName() {
- return CONTEXT_HOLDER.get();
- }
-
- /**
- * Specify a dataSource.
- *
- * @param dataSourceName data source name
- */
- public static void setDataSourceName(final String dataSourceName) {
- CONTEXT_HOLDER.set(dataSourceName);
- }
- }
-}
diff --git a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/resources/application.properties b/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/resources/application.properties
index 311c996..c2f345b 100644
--- a/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/resources/application.properties
+++ b/shardingsphere-elasticjob-cloud-ui/shardingsphere-elasticjob-cloud-ui-backend/src/main/resources/application.properties
@@ -21,9 +21,3 @@ auth.root_username=root
auth.root_password=root
auth.guest_username=guest
auth.guest_password=guest
-
-spring.datasource.default.driver-class-name=org.h2.Driver
-spring.datasource.default.url=jdbc:h2:mem:
-spring.datasource.default.username=sa
-spring.datasource.default.password=
-spring.jpa.show-sql=false
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/data-source/module/dataSource.vue b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/data-source/module/dataSource.vue
index 5caf9b4..aa0887e 100644
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/data-source/module/dataSource.vue
+++ b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/data-source/module/dataSource.vue
@@ -249,11 +249,19 @@ export default {
name: row.name
}
API.connect(params).then(res => {
- this.$notify({
- title: this.$t('common').notify.title,
- message: this.$t('common').notify.conSucMessage,
- type: 'success'
- })
+ if(res.model) {
+ this.$notify({
+ title: this.$t('common').notify.title,
+ message: this.$t('common').notify.conSucMessage,
+ type: 'success'
+ })
+ } else {
+ this.$notify({
+ title: this.$t('common').notify.title,
+ message: this.$t('common').notify.conFailMessage,
+ type: 'error'
+ })
+ }
this.load()
})
}
@@ -293,11 +301,20 @@ export default {
this.$refs[formName].validate(valid => {
if (valid) {
API.connectTest(this.form).then(res => {
- this.$notify({
- title: this.$t('common').notify.title,
- message: this.$t('common').notify.addSucMessage,
- type: 'success'
- })
+ if(res.model) {
+ this.$notify({
+ title: this.$t('common').notify.title,
+ message: this.$t('common').notify.conSucMessage,
+ type: 'success'
+ })
+ } else {
+ this.$notify({
+ title: this.$t('common').notify.title,
+ message: this.$t('common').notify.conFailMessage,
+ type: 'error'
+ })
+ }
+
})
} else {
return false
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
index c076c05..bf4505a 100644
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
+++ b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
@@ -38,8 +38,7 @@
<el-select
:placeholder="$t('historyStatus.searchForm.state')"
v-model="searchForm.state"
- clearable
- >
+ clearable>
<el-option
v-for="item in stateItems"
:key="item.value"
@@ -60,6 +59,7 @@
:prop="item.prop"
:label="item.label"
:width="item.width"
+ :formatter = "item.formatter"
/>
</el-table>
<div class="pagination">
@@ -77,7 +77,6 @@
</template>
<script>
import { mapActions } from 'vuex'
-import clone from 'lodash/clone'
import API from '../api'
export default {
name: 'HistoryStatus',
@@ -98,7 +97,14 @@ export default {
},
{
label: this.$t('historyStatus').column.createTime,
- prop: 'creationTime'
+ prop: 'creationTime',
+ formatter: function(row, cell, value) {
+ var t = new Date(value)
+ if (!t) {
+ return ''
+ }
+ return t.getFullYear() + '-' + (t.getMonth() + 1) + '-' + t.getDate() + ' ' + t.getHours() + ':' + t.getMinutes() + ':' + t.getSeconds()
+ }
},
{
label: this.$t('historyStatus').column.remark,
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-trace/module/historyTrace.vue b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-trace/module/historyTrace.vue
index 0c7dc63..7ee32c3 100644
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-trace/module/historyTrace.vue
+++ b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-trace/module/historyTrace.vue
@@ -43,8 +43,7 @@
<el-select
:placeholder="$t('historyTrace.searchForm.executeResult')"
v-model="searchForm.isSuccess"
- clearable
- >
+ clearable>
<el-option
v-for="item in executeResultItems"
:key="item.value"
@@ -105,8 +104,8 @@ export default {
{
label: this.$t('historyTrace').column.executeResult,
prop: 'success',
- formatter: function(row,cell,value) {
- return value+''
+ formatter: function(row, cell, value) {
+ return value + ''
}
},
{
@@ -115,11 +114,25 @@ export default {
},
{
label: this.$t('historyTrace').column.startTime,
- prop: 'startTime'
+ prop: 'startTime',
+ formatter: function(row, cell, value) {
+ var t = new Date(value)
+ if (!t) {
+ return ''
+ }
+ return t.getFullYear() + '-' + (t.getMonth() + 1) + '-' + t.getDate() + ' ' + t.getHours() + ':' + t.getMinutes() + ':' + t.getSeconds()
+ }
},
{
label: this.$t('historyTrace').column.completeTime,
- prop: 'completeTime'
+ prop: 'completeTime',
+ formatter: function(row, cell, value) {
+ var t = new Date(value)
+ if (!t) {
+ return ''
+ }
+ return t.getFullYear() + '-' + (t.getMonth() + 1) + '-' + t.getDate() + ' ' + t.getHours() + ':' + t.getMinutes() + ':' + t.getSeconds()
+ }
}
],
executeResultItems: [
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-jobs/module/operationJobs.vue b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-jobs/module/operationJobs.vue
index 37055a7..95360a6 100644
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-jobs/module/operationJobs.vue
+++ b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-jobs/module/operationJobs.vue
@@ -312,28 +312,23 @@ export default {
column: [
{
label: this.$t('operationJobs').labelInfo.jobName,
- prop: 'jobName',
- width : 200
+ prop: 'jobName'
},
{
label: this.$t('operationJobs').labelInfo.shardingTotalCount,
- prop: 'shardingTotalCount',
- width : 140
+ prop: 'shardingTotalCount'
},
{
label: this.$t('operationJobs').labelInfo.cron,
- prop: 'cron',
- width : 120
+ prop: 'cron'
},
{
label: this.$t('operationJobs').labelInfo.description,
- prop: 'description',
- width : 120
+ prop: 'description'
},
{
label: this.$t('operationJobs').labelInfo.status,
- prop: 'status',
- width : 120
+ prop: 'status'
}
],
statusColor: {
diff --git a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-servers/module/operationServers.vue b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-servers/module/operationServers.vue
index 1d4dc8f..12be63e 100644
--- a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-servers/module/operationServers.vue
+++ b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/operation-servers/module/operationServers.vue
@@ -115,23 +115,19 @@ export default {
column: [
{
label: this.$t('operationServers').labelInfo.serverIp,
- prop: 'serverIp',
- width : 200
+ prop: 'serverIp'
},
{
label: this.$t('operationServers').labelInfo.instancesNum,
- prop: 'instancesNum',
- width : 180
+ prop: 'instancesNum'
},
{
label: this.$t('operationServers').labelInfo.jobsNum,
- prop: 'jobsNum',
- width : 160
+ prop: 'jobsNum'
},
{
label: this.$t('operationServers').labelInfo.disabledJobsNum,
- prop: 'disabledJobsNum',
- width : 160
+ prop: 'disabledJobsNum'
}
],
searchForm: {
diff --git a/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/application.properties b/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/application.properties
index 66a405f..0edc8f3 100644
--- a/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/application.properties
+++ b/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/application.properties
@@ -15,7 +15,11 @@
# limitations under the License.
#
-server.port=8089
+server.port=8899
+
+auth.root_username=root
+auth.root_password=root
+auth.guest_username=guest
+auth.guest_password=guest
+
-user.admin.username=admin
-user.admin.password=admin
diff --git a/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/conf/elasticjob-cloud-scheduler.properties b/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/conf/elasticjob-cloud-scheduler.properties
new file mode 100644
index 0000000..7e17d93
--- /dev/null
+++ b/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-cloud-ui-bin-distribution/src/main/resources/conf/elasticjob-cloud-scheduler.properties
@@ -0,0 +1,62 @@
+#
+# 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.
+#
+
+# Routable IP address
+hostname=127.0.0.1
+
+# Username for mesos framework
+user=
+
+# Mesos zookeeper address
+mesos_url=zk://127.0.0.1:2181/mesos
+
+# Role for mesos framework
+
+#mesos_role=
+
+# ElasticJob-Cloud's zookeeper address
+zk_servers=127.0.0.1:2181
+
+# ElasticJob-Cloud's zookeeper namespace
+zk_namespace=elasticjob-cloud
+
+# ElasticJob-Cloud's zookeeper digest
+zk_digest=
+
+# Job rest API port
+http_port=8899
+
+# Max size of job accumulated
+job_state_queue_size=10000
+
+# Event trace rdb config
+
+#event_trace_rdb_driver=com.mysql.jdbc.Driver
+
+#event_trace_rdb_url=jdbc:mysql://localhost:3306/elastic_job_cloud_log
+
+#event_trace_rdb_username=root
+
+#event_trace_rdb_password=
+
+# Task reconciliation interval
+
+#reconcile_interval_minutes=-1
+
+# Enable/Disable mesos partition aware feature
+
+# enable_partition_aware=false
diff --git a/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-lite-ui-bin-distribution/src/main/resources/application.properties b/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-lite-ui-bin-distribution/src/main/resources/application.properties
index 66a405f..311c996 100644
--- a/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-lite-ui-bin-distribution/src/main/resources/application.properties
+++ b/shardingsphere-elasticjob-ui-distribution/shardingsphere-elasticjob-lite-ui-bin-distribution/src/main/resources/application.properties
@@ -15,7 +15,15 @@
# limitations under the License.
#
-server.port=8089
+server.port=8899
-user.admin.username=admin
-user.admin.password=admin
+auth.root_username=root
+auth.root_password=root
+auth.guest_username=guest
+auth.guest_password=guest
+
+spring.datasource.default.driver-class-name=org.h2.Driver
+spring.datasource.default.url=jdbc:h2:mem:
+spring.datasource.default.username=sa
+spring.datasource.default.password=
+spring.jpa.show-sql=false