提交 799c8152 编写于 作者: Q QiWang 提交者: Liang Zhang

sharding-ui-frontend optimization correlation (#3357)

* fix[sharding-ui-frontend]:solving npm run build error reporting problem

* refactor[sharding-ui-frontend]:delete .gitkeep

* refactor[sharding-ui-frontend]:replace Chinese

* refactor[sharding-ui-frontend]:rewrite logo.spec.js file

* refactor[sharding-ui-frontend]:delete redundant code and unify code format

* refactor[sharding-ui-frontend]:delete element ui theme css style and add custom theme color css style

* refactor[sharding-ui-frontend]:move karma.conf.js file,modify unit commands,delete favicon.ico file

* refactor[sharding-ui-frontend]:delete iconfont font

* refactor[sharding-ui-frontend]:move favicon.png file

* refactor[sharding-ui-frontend]:pom file add npm run unit

* refactor[sharding-ui-frontend]:modify karma.conf.js, turn off auto-start browser

* refactor[sharding-ui-frontend]:pom.xml file add npm version

* refactor[sharding-ui-frontend]:add missing terminator

* refactor[sharding-ui-frontend]:add puppeteer

* feature[incubator-shardingsphere]:delete. gitkeep from pom.xml

* fix: sharding-ui-frontend optimization correlation #3264

* add artifact of sharding-ui

* Support encrypt rule configuration.

* Fix get slave datasource info error.

* refactor[sharding-ui-frontend]:delete host

* refactor[sharding-ui-frontend]:delete host

* fix[sharding-ui-frontend]:modify test file

* fix[sharding-ui-frontend]:delete English tag

* refactor:modify code format
上级 c2139fe0
......@@ -130,5 +130,6 @@ Artifact:
```
sharding-distribution/sharding-jdbc-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-jdbc-bin.tar.gz: Binary package of Sharding-JDBC
sharding-distribution/sharding-proxy-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-proxy-bin.tar.gz: Binary package of Sharding-Proxy
sharding-distribution/sharding-ui-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-ui-bin.tar.gz: Binary package of Sharding-UI
sharding-distribution/shardingsphere-src-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-src.zip: Source code package of ShardingSphere
```
......@@ -127,5 +127,6 @@ ShardingSphere是多接入端共同组成的生态圈。
```
sharding-distribution/sharding-jdbc-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-jdbc-bin.tar.gz: Sharding-JDBC的二进制包
sharding-distribution/sharding-proxy-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-proxy-bin.tar.gz: Sharding-Proxy的二进制包
sharding-distribution/sharding-ui-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-sharding-ui-bin.tar.gz: Sharding-UI的二进制包
sharding-distribution/shardingsphere-src-distribution/target/apache-shardingsphere-incubating-${latest.release.version}-src.zip: ShardingSphere的源码包
```
......@@ -22,7 +22,6 @@ import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfigura
import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
import org.apache.shardingsphere.core.rule.MasterSlaveRule;
import org.apache.shardingsphere.core.rule.ShardingRule;
import java.util.Collection;
import java.util.LinkedList;
......
......@@ -28,6 +28,7 @@ import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
import org.apache.shardingsphere.orchestration.internal.registry.state.node.StateNodeStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
......@@ -68,10 +69,12 @@ public final class OrchestrationServiceImpl implements OrchestrationService {
Collection<SlaveDataSourceDTO> result = new ArrayList<>();
for (String schemaName : shardingSchemaService.getAllSchemaNames()) {
String configData = shardingSchemaService.getRuleConfiguration(schemaName);
if (configData.contains("tables:\n")) {
handleShardingRuleConfiguration(result, configData, schemaName);
} else {
handleMasterSlaveRuleConfiguration(result, configData, schemaName);
if (!configData.contains("encryptors:\n")) {
if (configData.contains("tables:\n")) {
handleShardingRuleConfiguration(result, configData, schemaName);
} else {
handleMasterSlaveRuleConfiguration(result, configData, schemaName);
}
}
}
return result;
......
......@@ -78,7 +78,8 @@ public final class ShardingSchemaServiceImpl implements ShardingSchemaService {
private void checkRuleConfiguration(final String configData) {
try {
RuleConfiguration ruleConfig = configData.contains("tables:\n")
RuleConfiguration ruleConfig = configData.contains("encryptors:\n")
? ConfigurationYamlConverter.loadEncryptRuleConfiguration(configData) : configData.contains("tables:\n")
? ConfigurationYamlConverter.loadShardingRuleConfiguration(configData) : ConfigurationYamlConverter.loadMasterSlaveRuleConfiguration(configData);
Preconditions.checkState(ruleConfig != null, "rule configuration is invalid.");
// CHECKSTYLE:OFF
......
......@@ -22,15 +22,18 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.api.config.encrypt.EncryptRuleConfiguration;
import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration;
import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
import org.apache.shardingsphere.core.config.DataSourceConfiguration;
import org.apache.shardingsphere.core.rule.Authentication;
import org.apache.shardingsphere.core.yaml.config.common.YamlAuthenticationConfiguration;
import org.apache.shardingsphere.core.yaml.config.encrypt.YamlEncryptRuleConfiguration;
import org.apache.shardingsphere.core.yaml.config.masterslave.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.core.yaml.config.sharding.YamlShardingRuleConfiguration;
import org.apache.shardingsphere.core.yaml.engine.YamlEngine;
import org.apache.shardingsphere.core.yaml.swapper.impl.AuthenticationYamlSwapper;
import org.apache.shardingsphere.core.yaml.swapper.impl.EncryptRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.core.yaml.swapper.impl.MasterSlaveRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.core.yaml.swapper.impl.ShardingRuleConfigurationYamlSwapper;
import org.apache.shardingsphere.orchestration.yaml.config.YamlDataSourceConfiguration;
......@@ -106,4 +109,13 @@ public final class ConfigurationYamlConverter {
return YamlEngine.unmarshalProperties(data);
}
/**
* Load encrypt rule configuration.
*
* @param data data
* @return encrypt rule configuration
*/
public static EncryptRuleConfiguration loadEncryptRuleConfiguration(final String data) {
return new EncryptRuleConfigurationYamlSwapper().swap(YamlEngine.unmarshal(data, YamlEncryptRuleConfiguration.class));
}
}
......@@ -16,9 +16,9 @@
-->
<template>
<div class="footer-wrapper">
Copyright © 2016 - 2018 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
</div>
<div
class="footer-wrapper"
>Copyright © The Apache Software Foundation, Licensed under the Apache License, Version 4.0.0-RC3.</div>
</template>
<script>
export default {
......
......@@ -33,9 +33,9 @@
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="lang-more">
<!-- <div class="lang-more">
<el-tag>English</el-tag>
</div>
</div> -->
</div>
<el-breadcrumb separator="/" class="bread-nav">
<el-breadcrumb-item>
......
......@@ -17,32 +17,38 @@
export default {
common: {
menuData: [{
title: 'Data governance',
child: [{
title: 'Config regist',
href: '/config-regist'
}, {
title: 'Config manage',
href: '/config-manage'
}, {
title: 'Orchestration',
href: '/orchestration'
}]
}],
menuData: [
{
title: 'Data governance',
child: [
{
title: 'Registry Center',
href: '/registry-center'
},
{
title: 'Rule Config',
href: '/rule-config'
},
{
title: 'Runtime Status',
href: '/runtime-status'
}
]
}
],
connected: 'Connected',
connection: 'Connection',
del: 'Delete',
notify: {
title: 'Prompt',
conSucMessage: 'Connection succeeded',
conFailMessage: 'Connection failed',
delSucMessage: 'Delete succeeded',
delFailMessage: 'Delete failed',
updateCompletedMessage: 'Update completed',
updateFaildMessage: 'Update faild'
conSucMessage: 'Connection Succeeded',
conFailMessage: 'Connection Failed',
delSucMessage: 'Delete Succeeded',
delFailMessage: 'Delete Failed',
updateCompletedMessage: 'Update Completed',
updateFaildMessage: 'Update Faild'
},
loginOut: 'Sign out'
loginOut: 'Sign Out'
},
login: {
btnTxt: 'Login',
......@@ -62,29 +68,32 @@ export default {
btnTxt: 'ADD',
registDialog: {
title: 'Add a registry',
name: 'name',
centerType: 'centerType',
address: 'address',
orchestrationName: 'orchestrationName',
namespaces: 'Namespaces',
name: 'Name',
centerType: 'Center Type',
address: 'Address',
orchestrationName: 'Orchestration Name',
namespaces: 'Namespace',
digest: 'Digest',
btnConfirmTxt: 'Confirm',
btnCancelTxt: 'Cancel'
},
table: {
operate: 'operate'
operate: 'Operate',
operateConnect: 'Connect',
operateConnected: 'Connected',
operateDel: 'Del'
},
rules: {
name: 'Please enter the name of the registration center',
address: 'Please enter the registration center address',
namespaces: 'Please enter a namespace',
centerType: 'Please select a centerType',
orchestrationName: 'Please enter a orchestrationName',
address: 'Please enter the registration center Address',
namespaces: 'Please enter a Namespace',
centerType: 'Please select a Center Type',
orchestrationName: 'Please enter a Orchestration Name',
digest: 'Please enter a digest'
}
},
orchestration: {
serviceNode: 'Service node',
serviceNode: 'Service Node',
slaveDataSourceName: 'Slave DataSource Info',
dataSource: {
schema: 'Schema',
......@@ -97,6 +106,11 @@ export default {
}
},
configManage: {
schema: {
name: 'Name',
ruleConfig: 'Rule Config',
dataSourceConfig: 'Data Source Config'
},
schemaRules: {
name: 'Please enter the name of the schema',
ruleConfig: 'Please enter the rule config of the schema',
......
......@@ -17,19 +17,25 @@
export default {
common: {
menuData: [{
title: '数据治理',
child: [{
title: '注册配置中心',
href: '/config-regist'
}, {
title: '配置管理',
href: '/config-manage'
}, {
title: 'Orchestration',
href: '/orchestration'
}]
}],
menuData: [
{
title: '数据治理',
child: [
{
title: '注册配置中心',
href: '/config-regist'
},
{
title: '配置管理',
href: '/config-manage'
},
{
title: 'Orchestration',
href: '/orchestration'
}
]
}
],
connect: '已连接',
connection: '连接',
del: '删除',
......@@ -72,7 +78,10 @@ export default {
btnCancelTxt: '取消'
},
table: {
operate: '操作'
operate: '操作',
operateConnect: '连接',
operateConnected: '已激活',
operateDel: '删除'
},
rules: {
name: '请输入注册中心名称',
......@@ -97,6 +106,11 @@ export default {
}
},
configManage: {
schema: {
name: '名称',
ruleConfig: '分片配置规则',
dataSourceConfig: '据源配置规则'
},
schemaRules: {
name: '请输入名称',
ruleConfig: '请输入数据分片配置规则',
......
......@@ -23,13 +23,13 @@ Vue.use(Router)
export const constantRouterMap = [
{
path: '*',
redirect: '/config-regist'
redirect: '/registry-center'
},
{
path: '/config-regist',
component: () => import('@/views/index/index'),
path: '/registry-center',
component: () => import('@/views/registry-center/index'),
hidden: true,
name: 'Config regist'
name: 'Registry center'
},
{
path: '/login',
......@@ -37,16 +37,16 @@ export const constantRouterMap = [
hidden: true
},
{
path: '/config-manage',
component: () => import('@/views/config-manage/index'),
path: '/rule-config',
component: () => import('@/views/rule-config/index'),
hidden: true,
name: 'Config manage'
name: 'Rule config'
},
{
path: '/orchestration',
component: () => import('@/views/orchestration/index'),
path: '/runtime-status',
component: () => import('@/views/runtime-status/index'),
hidden: true,
name: 'Orchestration'
name: 'Runtime status'
}
]
......
......@@ -16,15 +16,15 @@
-->
<template>
<s-regist-config />
<s-registry-center />
</template>
<script>
import SRegistConfig from './module/registConfig'
import SRegistryCenter from './module/registryCenter'
export default {
name: 'Index',
name: 'RegistryCenter',
components: {
SRegistConfig
SRegistryCenter
}
}
</script>
......
......@@ -36,19 +36,32 @@
/>
<el-table-column :label="$t('index.table.operate')" fixed="right" width="140">
<template slot-scope="scope">
<el-button
:disabled="scope.row.activated"
type="primary"
icon="el-icon-link"
size="small"
@click="handleConnect(scope.row)"
/>
<el-button
size="small"
type="danger"
icon="el-icon-delete"
@click="handlerDel(scope.row)"
/>
<el-tooltip
:content="!scope.row.activated ? $t('index.table.operateConnect'): $t('index.table.operateConnected')"
class="item"
effect="dark"
placement="top"
>
<el-button
type="primary"
icon="el-icon-link"
size="small"
@click="handleConnect(scope.row)"
/>
</el-tooltip>
<el-tooltip
:content="$t('index.table.operateDel')"
class="item"
effect="dark"
placement="top"
>
<el-button
size="small"
type="danger"
icon="el-icon-delete"
@click="handlerDel(scope.row)"
/>
</el-tooltip>
</template>
</el-table-column>
</el-table>
......@@ -67,9 +80,9 @@
:visible.sync="regustDialogVisible"
width="1010px"
>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form ref="form" :model="form" :rules="rules" label-width="170px">
<el-form-item :label="$t('index.registDialog.name')" prop="name">
<el-input v-model="form.name" autocomplete="off" />
<el-input :placeholder="$t('index.rules.name')" v-model="form.name" autocomplete="off" />
</el-form-item>
<el-form-item :label="$t('index.registDialog.centerType')" prop="centerType">
<el-radio-group v-model="form.centerType">
......@@ -77,16 +90,32 @@
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('index.registDialog.address')" prop="address">
<el-input v-model="form.address" autocomplete="off" />
<el-input
:placeholder="$t('index.rules.address')"
v-model="form.address"
autocomplete="off"
/>
</el-form-item>
<el-form-item :label="$t('index.registDialog.orchestrationName')" prop="orchestrationName">
<el-input v-model="form.orchestrationName" autocomplete="off" />
<el-input
:placeholder="$t('index.rules.orchestrationName')"
v-model="form.orchestrationName"
autocomplete="off"
/>
</el-form-item>
<el-form-item :label="$t('index.registDialog.namespaces')" prop="namespaces">
<el-input v-model="form.namespaces" autocomplete="off" />
<el-input
:placeholder="$t('index.rules.namespaces')"
v-model="form.namespaces"
autocomplete="off"
/>
</el-form-item>
<el-form-item :label="$t('index.registDialog.digest')">
<el-input v-model="form.digest" autocomplete="off" />
<el-input
:placeholder="$t('index.rules.digest')"
v-model="form.digest"
autocomplete="off"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -104,7 +133,7 @@ import { mapActions } from 'vuex'
import clone from 'lodash/clone'
import API from '../api'
export default {
name: 'RegistConfig',
name: 'RegistryCenter',
data() {
return {
regustDialogVisible: false,
......@@ -121,13 +150,13 @@ export default {
label: this.$t('index').registDialog.address,
prop: 'serverLists'
},
{
label: this.$t('index').registDialog.orchestrationName,
prop: 'orchestrationName'
},
{
label: this.$t('index').registDialog.namespaces,
prop: 'namespace'
},
{
label: this.$t('index').registDialog.orchestrationName,
prop: 'orchestrationName'
}
],
form: {
......
......@@ -18,9 +18,9 @@
<template>
<el-row class="box-card">
<el-radio-group v-model="radioValue" @change="onChange">
<el-radio-button label="schema" />
<el-radio-button label="authentication" />
<el-radio-button label="props" />
<el-radio-button label="Schema" />
<el-radio-button label="Authentication" />
<el-radio-button label="Props" />
</el-radio-group>
<component :is="currentView" />
</el-row>
......@@ -39,17 +39,17 @@ export default {
},
data() {
return {
radioValue: 'schema',
radioValue: 'Schema',
currentView: MSchema
}
},
methods: {
onChange(val) {
if (val === 'schema') {
if (val === 'Schema') {
this.currentView = MSchema
} else if (val === 'authentication') {
} else if (val === 'Authentication') {
this.currentView = MAuthentication
} else if (val === 'props') {
} else if (val === 'Props') {
this.currentView = MProps
}
}
......
......@@ -72,12 +72,17 @@
</span>
</el-dialog>
<el-dialog :visible.sync="addSchemaDialogVisible" title="Add Schema" width="80%" top="3vh">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form-item label="name" prop="name">
<el-input v-model="form.name" autocomplete="off" />
<el-form ref="form" :model="form" :rules="rules" label-width="170px">
<el-form-item :label="$t('configManage.schema.name')" prop="name">
<el-input
:placeholder="$t('configManage.schemaRules.name')"
v-model="form.name"
autocomplete="off"
/>
</el-form-item>
<el-form-item label="ruleConfig" prop="ruleConfig">
<el-form-item :label="$t('configManage.schema.ruleConfig')" prop="ruleConfig">
<el-input
:placeholder="$t('configManage.schemaRules.ruleConfig')"
:rows="8"
v-model="form.ruleConfig"
autocomplete="off"
......@@ -85,8 +90,9 @@
class="edit-text"
/>
</el-form-item>
<el-form-item label="dataSourceConfig" prop="dataSourceConfig">
<el-form-item :label="$t('configManage.schema.dataSourceConfig')" prop="dataSourceConfig">
<el-input
:placeholder="$t('configManage.schemaRules.dataSourceConfig')"
:rows="8"
v-model="form.dataSourceConfig"
autocomplete="off"
......
......@@ -18,7 +18,7 @@ import { expect } from 'chai'
import { shallowMount, createLocalVue, mount } from '@vue/test-utils'
import VueI18n from 'vue-i18n'
import Vuex from 'vuex'
import registConfig from '../../../src/views/index/module/registConfig.vue'
import registryCenter from '../../../src/views/registry-center/module/registryCenter.vue'
import Language from '../../../src/lang/index'
import store from '../../../src/store'
import router from '../../../src/router'
......@@ -47,9 +47,9 @@ const i18n = new VueI18n({
}
})
describe('index/registConfig.vue', () => {
it('registConfig Does the pages exist?', () => {
const wrapper = shallowMount(registConfig, {
describe('registry-center/registryCenter.vue', () => {
it('registryCenter Does the pages exist?', () => {
const wrapper = shallowMount(registryCenter, {
localVue,
i18n,
store,
......@@ -59,7 +59,7 @@ describe('index/registConfig.vue', () => {
})
it('add()', () => {
const wrapper = shallowMount(registConfig, {
const wrapper = shallowMount(registryCenter, {
localVue,
i18n,
store,
......
......@@ -19,9 +19,9 @@ import { expect } from 'chai'
import { shallowMount, createLocalVue, mount } from '@vue/test-utils'
import VueI18n from 'vue-i18n'
import Vuex from 'vuex'
import authentication from '../../../src/views/config-manage/module/authentication.vue'
import schema from '../../../src/views/config-manage/module/schema.vue'
import props from '../../../src/views/config-manage/module/props.vue'
import authentication from '../../../src/views/rule-config/module/authentication.vue'
import schema from '../../../src/views/rule-config/module/schema.vue'
import props from '../../../src/views/rule-config/module/props.vue'
import Language from '../../../src/lang/index'
import store from '../../../src/store'
import router from '../../../src/router'
......@@ -50,7 +50,7 @@ const i18n = new VueI18n({
}
})
describe('config-manage', () => {
describe('rule-config', () => {
it('authentication Does the pages exist?', () => {
const wrapper = shallowMount(authentication, {
localVue,
......
......@@ -18,8 +18,8 @@ import { expect } from 'chai'
import { shallowMount, createLocalVue, mount } from '@vue/test-utils'
import VueI18n from 'vue-i18n'
import Vuex from 'vuex'
import dataSource from '../../../src/views/orchestration/module/dataSource.vue'
import instance from '../../../src/views/orchestration/module/instance.vue'
import dataSource from '../../../src/views/runtime-status/module/dataSource.vue'
import instance from '../../../src/views/runtime-status/module/instance.vue'
import Language from '../../../src/lang/index'
import store from '../../../src/store'
import router from '../../../src/router'
......@@ -48,7 +48,7 @@ const i18n = new VueI18n({
}
})
describe('orchestration', () => {
describe('runtime-status', () => {
it('dataSource Does the pages exist?', () => {
const wrapper = shallowMount(dataSource, {
localVue,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册