Merge pull request #11 from menghaoranss/issue6653-6

Refactor registry center
diff --git a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/CenterConfigDTO.java b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/CenterConfigDTO.java
index d7f426f..5eebbb8 100644
--- a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/CenterConfigDTO.java
+++ b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/CenterConfigDTO.java
@@ -42,4 +42,10 @@
     private String digest;
     
     private String primaryName;
+    
+    private String additionalConfigCenterType;
+    
+    private String additionalConfigCenterServerList;
+    
+    private String additionalDigest;
 }
diff --git a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/CenterConfigServiceImpl.java b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/CenterConfigServiceImpl.java
index 9487eb2..3da4ee6 100644
--- a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/CenterConfigServiceImpl.java
+++ b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/CenterConfigServiceImpl.java
@@ -106,6 +106,9 @@
             toBeUpdatedConfig.setServerLists(config.getServerLists());
             toBeUpdatedConfig.setOrchestrationName(config.getOrchestrationName());
             toBeUpdatedConfig.setDigest(config.getDigest());
+            toBeUpdatedConfig.setAdditionalConfigCenterServerList(config.getAdditionalConfigCenterServerList());
+            toBeUpdatedConfig.setAdditionalConfigCenterType(config.getAdditionalConfigCenterType());
+            toBeUpdatedConfig.setAdditionalDigest(config.getAdditionalDigest());
             centerConfigsRepository.save(configs);
         }
     }
diff --git a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/OrchestrationServiceImpl.java b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/OrchestrationServiceImpl.java
index 1ca61fb..46f1713 100644
--- a/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/OrchestrationServiceImpl.java
+++ b/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/OrchestrationServiceImpl.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.ui.servcie.impl;
 
+import com.google.common.base.Joiner;
 import org.apache.shardingsphere.governance.core.registry.RegistryCenterNodeStatus;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
@@ -82,7 +83,7 @@
     @Override
     public void updateSlaveDataSourceStatus(final String schemaNames, final String slaveDataSourceName, final boolean enabled) {
         String value = enabled ? "" : RegistryCenterNodeStatus.DISABLED.toString();
-        registryCenterService.getActivatedRegistryCenter().persist(registryCenterService.getActivatedStateNode().getDataSourcesNodeFullPath(schemaNames + "." + slaveDataSourceName), value);
+        registryCenterService.getActivatedRegistryCenter().persist(registryCenterService.getActivatedStateNode().getDataSourcesNodeDataSourcePath(schemaNames, slaveDataSourceName), value);
     }
     
     private String getInstancesNodeFullRootPath() {
@@ -121,11 +122,14 @@
     
     private Collection<String> getDisabledSchemaDataSourceNames() {
         List<String> result = new ArrayList<>();
-        List<String> schemaDataSourceNames = registryCenterService.getActivatedRegistryCenter().getChildrenKeys(registryCenterService.getActivatedStateNode().getDataSourcesNodeFullRootPath());
-        for (String schemaDataSourceName : schemaDataSourceNames) {
-            String value = registryCenterService.getActivatedRegistryCenter().get(registryCenterService.getActivatedStateNode().getDataSourcesNodeFullPath(schemaDataSourceName));
-            if (RegistryCenterNodeStatus.DISABLED.toString().equalsIgnoreCase(value)) {
-                result.add(schemaDataSourceName);
+        List<String> schemaNames = registryCenterService.getActivatedRegistryCenter().getChildrenKeys(registryCenterService.getActivatedStateNode().getDataSourcesNodeFullRootPath());
+        for (String schemaName : schemaNames) {
+            List<String> dataSourceNames = registryCenterService.getActivatedRegistryCenter().getChildrenKeys(registryCenterService.getActivatedStateNode().getDataSourcesNodeSchemaPath(schemaName));
+            for (String dataSourceName : dataSourceNames) {
+                String value = registryCenterService.getActivatedRegistryCenter().get(registryCenterService.getActivatedStateNode().getDataSourcesNodeDataSourcePath(schemaName, dataSourceName));
+                if (RegistryCenterNodeStatus.DISABLED.toString().equalsIgnoreCase(value)) {
+                    result.add(Joiner.on(".").join(schemaName, dataSourceName));
+                }
             }
         }
         return result;
diff --git a/shardingsphere-ui-frontend/src/lang/en-US.js b/shardingsphere-ui-frontend/src/lang/en-US.js
index afff882..3798553 100644
--- a/shardingsphere-ui-frontend/src/lang/en-US.js
+++ b/shardingsphere-ui-frontend/src/lang/en-US.js
@@ -90,10 +90,10 @@
       editTitle: 'Edit registry center',
       name: 'Name',
       centerType: 'Type',
-      additionalCenterType: 'Additional type',
+      additionalCenterType: 'Additional Type',
       address: 'Address',
-      additionalAddress: 'Additional address',
-      orchestrationName: 'Orchestration Name',
+      additionalAddress: 'Additional Address',
+      orchestrationName: 'Governance Name',
       namespaces: 'Namespace',
       digest: 'Digest',
       btnConfirmTxt: 'Confirm',
@@ -111,7 +111,7 @@
       address: 'Please enter the registration center Address',
       namespaces: 'Please enter a Namespace',
       centerType: 'Please select a Center Type',
-      orchestrationName: 'Please enter a Orchestration Name',
+      orchestrationName: 'Please enter a Governance Name',
       digest: 'Please enter a digest'
     }
   },
@@ -123,7 +123,7 @@
       name: 'Name',
       centerType: 'Instance Type',
       address: 'Address',
-      orchestrationName: 'Orchestration Name',
+      orchestrationName: 'Governance Name',
       namespaces: 'Namespace',
       digest: 'Digest',
       btnConfirmTxt: 'Confirm',
@@ -141,7 +141,7 @@
       address: 'Please enter the config center Address',
       namespaces: 'Please enter a Namespace',
       centerType: 'Please select a Center Type',
-      orchestrationName: 'Please enter a Orchestration Name',
+      orchestrationName: 'Please enter a Governance Name',
       digest: 'Please enter a digest'
     }
   },
diff --git a/shardingsphere-ui-frontend/src/lang/zh-CN.js b/shardingsphere-ui-frontend/src/lang/zh-CN.js
index a10870e..3245206 100644
--- a/shardingsphere-ui-frontend/src/lang/zh-CN.js
+++ b/shardingsphere-ui-frontend/src/lang/zh-CN.js
@@ -93,7 +93,7 @@
       additionalCenterType: '扩展配置中心类型',
       additionalAddress: '扩展配置中心地址',
       address: '注册中心地址',
-      orchestrationName: '数据治理实例',
+      orchestrationName: '治理实例名称',
       namespaces: '命名空间',
       digest: '登录凭证',
       btnConfirmTxt: '确定',
diff --git a/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue b/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue
index 74076b5..a52482b 100644
--- a/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue
+++ b/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue
@@ -493,7 +493,7 @@
   computed: {
     textareaDatasourceCom() {
       const dsYamlType = new yaml.Type(
-        'tag:yaml.org,2002:org.apache.shardingsphere.orchestration.core.common.configuration.YamlDataSourceConfiguration',
+        'tag:yaml.org,2002:org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration',
         {
           kind: 'mapping',
           construct(data) {
@@ -510,7 +510,7 @@
     },
     textareaRuleCom() {
       const dsYamlType = new yaml.Type(
-        'tag:yaml.org,2002:org.apache.shardingsphere.orchestration.core.common.configuration.YamlDataSourceConfiguration',
+        'tag:yaml.org,2002:org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration',
         {
           kind: 'mapping',
           construct(data) {
diff --git a/shardingsphere-ui-frontend/src/views/registry-center/module/registryCenter.vue b/shardingsphere-ui-frontend/src/views/registry-center/module/registryCenter.vue
index 0314d95..ea57b36 100644
--- a/shardingsphere-ui-frontend/src/views/registry-center/module/registryCenter.vue
+++ b/shardingsphere-ui-frontend/src/views/registry-center/module/registryCenter.vue
@@ -98,6 +98,13 @@
         <el-form-item :label="$t('registryCenter.registDialog.name')" prop="name">
           <el-input :placeholder="$t('registryCenter.rules.name')" v-model="form.name" autocomplete="off" />
         </el-form-item>
+        <el-form-item :label="$t('registryCenter.registDialog.orchestrationName')" prop="orchestrationName">
+          <el-input
+            :placeholder="$t('registryCenter.rules.orchestrationName')"
+            v-model="form.orchestrationName"
+            autocomplete="off"
+          />
+        </el-form-item>
         <el-form-item :label="$t('registryCenter.registDialog.centerType')" prop="instanceType">
           <el-radio-group v-model="form.instanceType">
             <el-radio label="Zookeeper">Zookeeper</el-radio>
@@ -111,10 +118,10 @@
             autocomplete="off"
           />
         </el-form-item>
-        <el-form-item :label="$t('registryCenter.registDialog.orchestrationName')" prop="orchestrationName">
+        <el-form-item :label="$t('registryCenter.registDialog.digest')" id="add-digest" v-show="showAddDigest">
           <el-input
-            :placeholder="$t('registryCenter.rules.orchestrationName')"
-            v-model="form.orchestrationName"
+            :placeholder="$t('registryCenter.rules.digest')"
+            v-model="form.digest"
             autocomplete="off"
           />
         </el-form-item>
@@ -131,7 +138,7 @@
             autocomplete="off"
           />
         </el-form-item>
-        <el-form-item :label="$t('registryCenter.registDialog.digest')">
+        <el-form-item :label="$t('registryCenter.registDialog.digest')" id="add-digest-additional" v-show="showAddDigestAdditional">
           <el-input
             :placeholder="$t('registryCenter.rules.digest')"
             v-model="form.additionalDigest"
@@ -156,6 +163,13 @@
         <el-form-item :label="$t('registryCenter.registDialog.name')" prop="name">
           <el-input :placeholder="$t('registryCenter.rules.name')" v-model="editForm.name" autocomplete="off" />
         </el-form-item>
+        <el-form-item :label="$t('registryCenter.registDialog.orchestrationName')" prop="orchestrationName">
+          <el-input
+            :placeholder="$t('registryCenter.rules.orchestrationName')"
+            v-model="editForm.orchestrationName"
+            autocomplete="off"
+          />
+        </el-form-item>
         <el-form-item :label="$t('registryCenter.registDialog.centerType')" prop="instanceType">
           <el-radio-group v-model="editForm.instanceType">
             <el-radio label="Zookeeper">Zookeeper</el-radio>
@@ -169,14 +183,7 @@
             autocomplete="off"
           />
         </el-form-item>
-        <el-form-item :label="$t('registryCenter.registDialog.orchestrationName')" prop="orchestrationName">
-          <el-input
-            :placeholder="$t('registryCenter.rules.orchestrationName')"
-            v-model="editForm.orchestrationName"
-            autocomplete="off"
-          />
-        </el-form-item>
-        <el-form-item :label="$t('registryCenter.registDialog.digest')">
+        <el-form-item :label="$t('registryCenter.registDialog.digest')" v-show="showEditDigest">
           <el-input
             :placeholder="$t('registryCenter.rules.digest')"
             v-model="editForm.digest"
@@ -196,7 +203,7 @@
             autocomplete="off"
           />
         </el-form-item>
-        <el-form-item :label="$t('registryCenter.registDialog.digest')">
+        <el-form-item :label="$t('registryCenter.registDialog.digest')" v-show="showEditDigestAdditional">
           <el-input
             :placeholder="$t('registryCenter.rules.digest')"
             v-model="editForm.additionalDigest"
@@ -224,6 +231,10 @@
     return {
       regustDialogVisible: false,
       editDialogVisible: false,
+      showAddDigest:true,
+      showAddDigestAdditional:true,
+      showEditDigest:true,
+      showEditDigestAdditional:true,
       column: [
         {
           label: this.$t('registryCenter').registDialog.name,
@@ -418,6 +429,38 @@
     },
     cancelEdit() {
       this.editDialogVisible = false
+    },
+    centerTypeChanged(value) {
+      if (value === 'Zookeeper') {
+        this.showAddDigest = true
+      } else {
+        this.showAddDigest = false
+        this.form.digest = '';
+      }
+    },
+    additionalCenterTypeChanged(value) {
+      if (value === 'Zookeeper') {
+        this.showAddDigestAdditional = true
+      } else {
+        this.showAddDigestAdditional = false
+        this.form.additionalDigest = '';
+      }
+    },
+    editCenterTypeChanged(value) {
+      if (value === 'Zookeeper') {
+        this.showEditDigest = true
+      } else {
+        this.showEditDigest = false
+        this.editForm.digest = '';
+      }
+    },
+    editAdditionalCenterTypeChanged(value) {
+      if (value === 'Zookeeper') {
+        this.showEditDigestAdditional = true
+      } else {
+        this.showEditDigestAdditional = false
+        this.editForm.additionalDigest = '';
+      }
     }
   }
 }
diff --git a/shardingsphere-ui-frontend/src/views/rule-config/module/schema.vue b/shardingsphere-ui-frontend/src/views/rule-config/module/schema.vue
index e37f804..b17bd54 100644
--- a/shardingsphere-ui-frontend/src/views/rule-config/module/schema.vue
+++ b/shardingsphere-ui-frontend/src/views/rule-config/module/schema.vue
@@ -214,7 +214,7 @@
   computed: {
     textarea2() {
       const dsYamlType = new yaml.Type(
-        'tag:yaml.org,2002:org.apache.shardingsphere.orchestration.core.common.yaml.config.YamlDataSourceConfiguration',
+        'tag:yaml.org,2002:org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration',
         {
           kind: 'mapping',
           construct(data) {