├── .asf.yaml ├── .gitignore ├── .mvn ├── jvm.config └── wrapper │ ├── MavenWrapperDownloader.java │ └── maven-wrapper.properties ├── LICENSE ├── NOTICE ├── README.md ├── README_ZH.md ├── RELEASE-NOTES.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── shardingsphere-ui-backend ├── pom.xml ├── shardingsphere-ui-backend-API.md └── src │ └── main │ ├── java │ └── org │ │ └── apache │ │ └── shardingsphere │ │ └── ui │ │ ├── Bootstrap.java │ │ ├── common │ │ ├── constant │ │ │ ├── ForwardServiceType.java │ │ │ └── InstanceType.java │ │ ├── domain │ │ │ ├── CenterConfig.java │ │ │ ├── CenterConfigs.java │ │ │ ├── ForwardServiceConfig.java │ │ │ └── ForwardServiceConfigs.java │ │ ├── dto │ │ │ ├── CenterConfigDTO.java │ │ │ ├── InstanceDTO.java │ │ │ ├── ReadDataSourceDTO.java │ │ │ └── ShardingSphereSchemaDTO.java │ │ └── exception │ │ │ └── ShardingSphereUIException.java │ │ ├── config │ │ └── FilterConfiguration.java │ │ ├── repository │ │ ├── CenterConfigsRepository.java │ │ ├── ConfigsRepository.java │ │ ├── ForwardServiceConfigsRepository.java │ │ └── impl │ │ │ ├── YamlCenterConfigsRepositoryImpl.java │ │ │ └── YamlForwardServiceConfigsRepositoryImpl.java │ │ ├── security │ │ ├── AuthenticationFilter.java │ │ ├── UserAccount.java │ │ └── UserAuthenticationService.java │ │ ├── servcie │ │ ├── CenterConfigService.java │ │ ├── GovernanceService.java │ │ ├── ProxyAuthenticationService.java │ │ ├── RegistryCenterService.java │ │ ├── ShardingPropertiesService.java │ │ ├── ShardingSchemaService.java │ │ ├── forward │ │ │ ├── ShardingScalingForwardService.java │ │ │ └── impl │ │ │ │ └── ShardingScalingForwardServiceImpl.java │ │ └── impl │ │ │ ├── CenterConfigServiceImpl.java │ │ │ ├── GovernanceServiceImpl.java │ │ │ ├── ProxyAuthenticationServiceImpl.java │ │ │ ├── RegistryCenterServiceImpl.java │ │ │ ├── ShardingPropertiesServiceImpl.java │ │ │ └── ShardingSchemaServiceImpl.java │ │ ├── util │ │ ├── CenterRepositoryFactory.java │ │ └── HttpClientUtil.java │ │ └── web │ │ ├── advice │ │ └── GlobalExceptionHandler.java │ │ ├── controller │ │ ├── GovernanceController.java │ │ ├── ProxyAuthenticationController.java │ │ ├── RegistryCenterController.java │ │ ├── ShardingPropertiesController.java │ │ ├── ShardingScalingForwardController.java │ │ └── ShardingSchemaController.java │ │ ├── filter │ │ └── CORSFilter.java │ │ └── response │ │ ├── ResponseResult.java │ │ └── ResponseResultUtil.java │ └── resources │ ├── application.properties │ └── logback.xml ├── shardingsphere-ui-distribution ├── pom.xml ├── shardingsphere-ui-bin-distribution │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ └── main │ │ ├── assembly │ │ └── shardingsphere-ui-bin-distribution.xml │ │ ├── release-docs │ │ ├── LICENSE │ │ ├── NOTICE │ │ └── licenses │ │ │ ├── LICENSE-antlr4-runtime.txt │ │ │ ├── LICENSE-axios.txt │ │ │ ├── LICENSE-echarts-liquidfill.txt │ │ │ ├── LICENSE-element-ui.txt │ │ │ ├── LICENSE-groovy.txt │ │ │ ├── LICENSE-incubator-echarts.txt │ │ │ ├── LICENSE-jcl-over-slf4j.txt │ │ │ ├── LICENSE-js-yaml.txt │ │ │ ├── LICENSE-jul-to-slf4j.txt │ │ │ ├── LICENSE-lodash.txt │ │ │ ├── LICENSE-logback.txt │ │ │ ├── LICENSE-moment.txt │ │ │ ├── LICENSE-normalize.txt │ │ │ ├── LICENSE-protobuf-java.txt │ │ │ ├── LICENSE-resize-detector.txt │ │ │ ├── LICENSE-slf4j.txt │ │ │ ├── LICENSE-vue-i18n.txt │ │ │ ├── LICENSE-vue-router.txt │ │ │ ├── LICENSE-vue.txt │ │ │ └── LICENSE-vuex.txt │ │ └── resources │ │ ├── application.properties │ │ ├── bin │ │ ├── start.bat │ │ ├── start.sh │ │ └── stop.sh │ │ └── logback.xml └── shardingsphere-ui-src-distribution │ ├── pom.xml │ └── src │ └── main │ └── assembly │ └── shardingsphere-ui-src-distribution.xml └── shardingsphere-ui-frontend ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── README.md ├── README_ZH.md ├── build ├── build.js ├── check-versions.js ├── rimraf.js ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js ├── webpack.prod.conf.js └── webpack.unit.conf.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── index.html ├── package.json ├── pom.xml ├── src ├── App.vue ├── assets │ ├── img │ │ ├── bg.png │ │ ├── close.png │ │ ├── data-source.png │ │ ├── del.png │ │ ├── edit.png │ │ ├── expand.png │ │ ├── link.png │ │ ├── login-logo.png │ │ ├── logo.png │ │ ├── meta-data.png │ │ ├── open.png │ │ ├── password.png │ │ ├── rules.png │ │ ├── shrink.png │ │ ├── sidebar-icon.png │ │ ├── sidebar-logo.png │ │ └── user.png │ ├── logo.png │ └── styles │ │ ├── index.scss │ │ └── theme.scss ├── components │ ├── ChartBase │ │ └── index.vue │ ├── Container │ │ └── index.vue │ ├── Footer │ │ └── index.vue │ ├── Head │ │ └── index.vue │ ├── Logo │ │ └── index.vue │ └── Menu │ │ └── index.vue ├── lang │ ├── en-US.js │ ├── index.js │ └── zh-CN.js ├── main.js ├── router │ └── index.js ├── store │ ├── actions.js │ ├── index.js │ ├── modules │ │ ├── global.js │ │ └── index.js │ └── mutation-types.js ├── utils │ ├── api.js │ └── conf.js └── views │ ├── data-scaling │ ├── api.js │ ├── index.vue │ └── module │ │ └── index.vue │ ├── login │ ├── api.js │ └── index.vue │ ├── registry-center │ ├── api.js │ ├── index.vue │ └── module │ │ └── registryCenter.vue │ ├── rule-config │ ├── api.js │ ├── index.vue │ └── module │ │ ├── authentication.vue │ │ ├── props.vue │ │ └── schema.vue │ └── runtime-status │ ├── api.js │ ├── index.vue │ └── module │ ├── dataSource.vue │ └── instance.vue ├── static ├── 404.html └── favicon.png └── test ├── karma.conf.js └── specs ├── components ├── Container.spec.js ├── Footer.spec.js ├── Head.spec.js ├── Logo.spec.js └── Menu.spec.js └── views ├── login.spec.js ├── registry-center.spec.js ├── rule-config.spec.js └── runtime-status.spec.js /.asf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | notifications: 19 | commits: notifications@shardingsphere.apache.org 20 | issues: notifications@shardingsphere.apache.org 21 | pullrequests: notifications@shardingsphere.apache.org 22 | 23 | github: 24 | description: Distributed database middleware 25 | labels: 26 | - shardingsphere 27 | - database 28 | - distributed-database 29 | - distributed-sql-database 30 | - distributed-transactions 31 | - sql 32 | - shard 33 | - database-cluster 34 | - mysql 35 | - postgresql 36 | - middleware 37 | features: 38 | issues: true 39 | projects: true 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # maven ignore 2 | target/ 3 | *.class 4 | *.jar 5 | *.war 6 | *.zip 7 | *.tar 8 | *.tar.gz 9 | 10 | # maven plugin ignore 11 | release.properties 12 | cobertura.ser 13 | *.gpg 14 | 15 | # eclipse ignore 16 | .settings/ 17 | .project 18 | .classpath 19 | 20 | # idea ignore 21 | .idea/ 22 | *.ipr 23 | *.iml 24 | *.iws 25 | 26 | # temp ignore 27 | logs/ 28 | *.log 29 | *.doc 30 | *.cache 31 | *.diff 32 | *.patch 33 | *.tmp 34 | 35 | # system ignore 36 | .DS_Store 37 | Thumbs.db 38 | 39 | # npm 40 | node_modules/ 41 | package-lock.json 42 | -------------------------------------------------------------------------------- /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Xmx1024m -XX:MaxMetaspaceSize=256m 2 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | 4 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache ShardingSphere 2 | Copyright 2018-2020 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ShardingSphere UI 2 | 3 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 4 | 5 | [![Build Status](https://builds.apache.org/job/shardingsphere-ui-dev/badge/icon)](https://builds.apache.org/job/shardingsphere-ui-dev/) 6 | ## Overview 7 | 8 | ShardingSphere UI is a management background for [ShardingSphere](https://shardingsphere.apache.org/), including: dynamic configuration, Data governance, etc. 9 | 10 | ### ShardingSphere UI Frontend 11 | 12 | shardingsphere-ui-frontend based on [Vue.js](https://github.com/vuejs/vue) and use the UI Toolkit [element](https://github.com/ElemeFE/element). 13 | 14 | * [shardingsphere-ui-frontend/README.md](shardingsphere-ui-frontend/README.md) 15 | 16 | ### ShardingSphere UI Backend 17 | 18 | shardingsphere-ui-backend is a standard spring boot project. 19 | 20 | ## How to Build 21 | 22 | ```bash 23 | git clone https://github.com/apache/shardingsphere-ui.git 24 | cd shardingsphere-ui/ 25 | mvn clean package -Prelease 26 | ``` 27 | 28 | Get the package in `shardingsphere-ui/shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/target/apache-shardingsphere-${latest.release.version}-shardingsphere-ui-bin.tar.gz` 29 | -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | # ShardingSphere UI 2 | 3 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 4 | 5 | [![Build Status](https://builds.apache.org/job/shardingsphere-ui-dev/badge/icon)](https://builds.apache.org/job/shardingsphere-ui-dev/) 6 | ## 概述 7 | 8 | ShardingSphere UI是[ShardingSphere](https://shardingsphere.apache.org/)的管理后台,包含了动态配置、数据编排等功能。 9 | 10 | ### ShardingSphere UI 前端 11 | 12 | shardingsphere-ui-frontend模块基于[Vue.js](https://github.com/vuejs/vue),并使用了UI工具包[element](https://github.com/ElemeFE/element)。 13 | 14 | * [shardingsphere-ui-frontend/README_ZH.md](shardingsphere-ui-frontend/README_ZH.md) 15 | 16 | ### ShardingSphere UI 后端 17 | 18 | shardingsphere-ui-backend模块是一个标准的spring boot项目。 19 | 20 | ## 如何构建 21 | 22 | ```bash 23 | git clone https://github.com/apache/shardingsphere-ui.git 24 | cd shardingsphere/shardingsphere-ui/ 25 | mvn clean package -Prelease 26 | ``` 27 | 28 | 从 `shardingsphere-ui/shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/target/apache-shardingsphere-${latest.release.version}-shardingsphere-ui-bin.tar.gz`中获取软件包。 29 | 30 | -------------------------------------------------------------------------------- /RELEASE-NOTES.md: -------------------------------------------------------------------------------- 1 | 2 | ## 5.0.0-alpha 3 | 4 | ### Enhancement 5 | 6 | 1. Combine the display of config center and registry center 7 | 1. Support etcd registry center 8 | 1. Support the display of metadata for each scheme 9 | 1. Support removing schema dynamically 10 | 11 | ## 4.1.1 12 | 13 | ### Enhancement 14 | 15 | 1. Add Sharding-UI dockerfile 16 | 2. Enhancement for Sharding-UI docker build 17 | 18 | ### Bug Fixes 19 | 20 | 1. Fix faild to disable slave database through ui 21 | 22 | ## 4.1.0 23 | 24 | ### New Features 25 | 26 | 1. Add a start.bat to launch for shardingsphere-ui distribution module in Windows 27 | 1. The work flow and roadmap of ShardingSphere-Scaling 28 | 29 | ### Enhancements 30 | 31 | 1. shardingsphere-ui-frontend config file problem 32 | 1. The enhancement for the first version shardingsphere-scaling-UI 33 | 1. Fix link of build status 34 | 1. Fix ui login Chinese text 35 | 1. Add sharding scaling API document 36 | 37 | ### Bug Fixes 38 | 39 | 1. Fix request error page interactive presentation problem 40 | 1. Fix ui module for new center api 41 | 1. Fix spelling error 42 | 1. UI details modification 43 | 1. Fixes ui errors when loading datasources config 44 | 45 | ## 4.0.0 46 | 47 | ### New Features 48 | 49 | 1. shardingsphere-ui-frontend multilingual support 50 | 1. Optimize the running time of UI unit test 51 | 1. Support data migration function 52 | 53 | ### Enhancements 54 | 55 | 1. Warning when maven install for npm version 56 | 1. Upgrade the node version of pom.xml file 57 | 58 | ### Bug Fixes 59 | 60 | 1. User UI interaction without login for a long time 61 | 1. Modify login chinese content 62 | 63 | ## 4.0.0-RC3 64 | 65 | ### New Features 66 | 67 | 1. Merge OpenShardingUI features 68 | 1. shardingsphere-ui-backend support spring-boot-maven-plugin plugin 69 | 70 | ### Enhancements 71 | 72 | 1. Solving npm run build error reporting problem 73 | 1. Improving shardingsphere-ui-frontend details modification 74 | 1. shardingsphere-ui-frontend optimization 75 | 1. Check shardingsphere-UI License 76 | 1. Remove unnecessary check state & refactor code 77 | 78 | ### Bug Fixes 79 | 80 | 1. Plugin version not defined 81 | 1. Build error: spring-boot-maven-plugin version not defined -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/Bootstrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | 23 | /** 24 | * bootstrap of ShardingSphere UI. 25 | */ 26 | @SpringBootApplication 27 | public class Bootstrap { 28 | 29 | /** 30 | * Main entrance of ShardingSphere UI. 31 | * 32 | * @param args startup arguments 33 | */ 34 | public static void main(final String[] args) { 35 | SpringApplication.run(Bootstrap.class, args); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/constant/ForwardServiceType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.constant; 19 | 20 | import lombok.Getter; 21 | import lombok.RequiredArgsConstructor; 22 | 23 | /** 24 | * Forward service type. 25 | */ 26 | @RequiredArgsConstructor 27 | @Getter 28 | public enum ForwardServiceType { 29 | 30 | /** 31 | * sharding scaling forward service. 32 | */ 33 | SHARDING_SCALING("ShardingScaling"); 34 | 35 | private final String name; 36 | } 37 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/constant/InstanceType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.constant; 19 | 20 | import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException; 21 | 22 | /** 23 | * Governance instance type. 24 | */ 25 | public enum InstanceType { 26 | 27 | ZOOKEEPER("Zookeeper"), ETCD("Etcd"); 28 | 29 | private final String name; 30 | 31 | InstanceType(final String name) { 32 | this.name = name; 33 | } 34 | 35 | /** 36 | * Get instance type via name. 37 | * 38 | * @param name instance name 39 | * @return instance type 40 | */ 41 | public static InstanceType nameOf(final String name) { 42 | for (InstanceType each : InstanceType.values()) { 43 | if ((each.name).equals(name)) { 44 | return each; 45 | } 46 | } 47 | throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, String.format("Unsupported governance instance type `%s`", name)); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/domain/CenterConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.domain; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | import java.util.Properties; 24 | 25 | /** 26 | * Center config. 27 | */ 28 | @Getter 29 | @Setter 30 | public final class CenterConfig { 31 | 32 | private String name; 33 | 34 | private String instanceType; 35 | 36 | private String serverLists; 37 | 38 | private String governanceName; 39 | 40 | private String digest; 41 | 42 | private boolean activated; 43 | 44 | private Properties props = new Properties(); 45 | } 46 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/domain/CenterConfigs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.domain; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | /** 27 | * Center configs. 28 | */ 29 | @Getter 30 | @Setter 31 | public final class CenterConfigs { 32 | 33 | private List centerConfigs = new ArrayList<>(); 34 | } 35 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/domain/ForwardServiceConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.domain; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | /** 24 | * Forward service config. 25 | */ 26 | @Setter 27 | @Getter 28 | public final class ForwardServiceConfig { 29 | 30 | private String serviceName; 31 | 32 | private String serviceType; 33 | 34 | private String serviceUrl; 35 | } 36 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/domain/ForwardServiceConfigs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.domain; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | import java.util.Optional; 26 | 27 | /** 28 | * Forward service configs. 29 | */ 30 | @Getter 31 | @Setter 32 | public final class ForwardServiceConfigs { 33 | 34 | private Map forwardServiceConfigs = new HashMap<>(); 35 | 36 | /** 37 | * Put forward service config. 38 | * 39 | * @param forwardServiceType forward service type 40 | * @param forwardServiceConfig forward service config 41 | */ 42 | public void putForwardServiceConfig(final String forwardServiceType, final ForwardServiceConfig forwardServiceConfig) { 43 | forwardServiceConfigs.put(forwardServiceType, forwardServiceConfig); 44 | } 45 | 46 | /** 47 | * Get forward service config by type. 48 | * 49 | * @param forwardServiceType forward service config 50 | * @return forward service config 51 | */ 52 | public Optional getForwardServiceConfig(final String forwardServiceType) { 53 | return Optional.ofNullable(forwardServiceConfigs.get(forwardServiceType)); 54 | } 55 | 56 | /** 57 | * Remove forward service config by type. 58 | * 59 | * @param forwardServiceType forward service config 60 | * @return forward service config 61 | */ 62 | public Optional removeForwardServiceConfig(final String forwardServiceType) { 63 | return Optional.ofNullable(forwardServiceConfigs.remove(forwardServiceType)); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/CenterConfigDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.dto; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | /** 24 | * CenterConfig DTO 25 | */ 26 | @Getter 27 | @Setter 28 | public final class CenterConfigDTO { 29 | 30 | private String name; 31 | 32 | private String instanceType; 33 | 34 | private String serverLists; 35 | 36 | private String namespace; 37 | 38 | private String governanceName; 39 | 40 | private String governanceType; 41 | 42 | private String digest; 43 | 44 | private String primaryName; 45 | } 46 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/InstanceDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.dto; 19 | 20 | import lombok.Getter; 21 | import lombok.NoArgsConstructor; 22 | import lombok.Setter; 23 | 24 | /** 25 | * Instance DTO. 26 | */ 27 | @Setter 28 | @Getter 29 | @NoArgsConstructor 30 | public final class InstanceDTO { 31 | 32 | private static final String DELIMITER = "@"; 33 | 34 | private String serverIp; 35 | 36 | private String instanceId; 37 | 38 | private boolean enabled; 39 | 40 | public InstanceDTO(final String instanceId, final boolean enabled) { 41 | this.instanceId = instanceId; 42 | this.enabled = enabled; 43 | this.serverIp = instanceId.split(DELIMITER)[0]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/ReadDataSourceDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.dto; 19 | 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | 25 | /** 26 | * Read data source DTO. 27 | */ 28 | @Setter 29 | @Getter 30 | @NoArgsConstructor 31 | @AllArgsConstructor 32 | public final class ReadDataSourceDTO { 33 | 34 | private String schema; 35 | 36 | private String writeDataSourceName; 37 | 38 | private String readDataSourceName; 39 | 40 | private boolean enabled; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/dto/ShardingSphereSchemaDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.dto; 19 | 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | 25 | /** 26 | * ShardingSphere schema DTO. 27 | */ 28 | @Setter 29 | @Getter 30 | @NoArgsConstructor 31 | @AllArgsConstructor 32 | public final class ShardingSphereSchemaDTO { 33 | 34 | private String name; 35 | 36 | private String ruleConfiguration; 37 | 38 | private String dataSourceConfiguration; 39 | } 40 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/common/exception/ShardingSphereUIException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.common.exception; 19 | 20 | import lombok.Getter; 21 | 22 | /** 23 | * ShardingSphere UI system exception. 24 | */ 25 | @Getter 26 | public final class ShardingSphereUIException extends RuntimeException { 27 | 28 | public static final int INVALID_PARAM = 400; 29 | 30 | public static final int NO_RIGHT = 403; 31 | 32 | public static final int SERVER_ERROR = 500; 33 | 34 | private final int errorCode; 35 | 36 | private final String errorMessage; 37 | 38 | public ShardingSphereUIException(final int errorCode, final String errorMessage) { 39 | super(errorMessage); 40 | this.errorCode = errorCode; 41 | this.errorMessage = errorMessage; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/config/FilterConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.config; 19 | 20 | import org.apache.shardingsphere.ui.security.AuthenticationFilter; 21 | import org.apache.shardingsphere.ui.security.UserAuthenticationService; 22 | import org.apache.shardingsphere.ui.web.filter.CORSFilter; 23 | import org.springframework.beans.factory.annotation.Autowired; 24 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 25 | import org.springframework.context.annotation.Bean; 26 | import org.springframework.context.annotation.Configuration; 27 | 28 | import java.util.ArrayList; 29 | import java.util.List; 30 | 31 | /** 32 | * Web filter configuration. 33 | */ 34 | @Configuration 35 | public class FilterConfiguration { 36 | 37 | @Autowired 38 | private UserAuthenticationService userAuthenticationService; 39 | 40 | /** 41 | * Register the CORS filter. 42 | * 43 | * @return filter registration bean 44 | */ 45 | @Bean 46 | public FilterRegistrationBean corsFilter() { 47 | CORSFilter corsFilter = new CORSFilter(); 48 | FilterRegistrationBean filterRegBean = new FilterRegistrationBean(); 49 | filterRegBean.setFilter(corsFilter); 50 | List urlPatterns = new ArrayList<>(); 51 | urlPatterns.add("/api/*"); 52 | filterRegBean.setUrlPatterns(urlPatterns); 53 | return filterRegBean; 54 | } 55 | 56 | /** 57 | * Register the authentication filter. 58 | * 59 | * @return filter registration bean 60 | */ 61 | @Bean 62 | public FilterRegistrationBean authenticationFilter() { 63 | AuthenticationFilter authenticationFilter = new AuthenticationFilter(); 64 | authenticationFilter.setUserAuthenticationService(userAuthenticationService); 65 | FilterRegistrationBean filterRegBean = new FilterRegistrationBean(); 66 | filterRegBean.setFilter(authenticationFilter); 67 | List urlPatterns = new ArrayList<>(); 68 | urlPatterns.add("/api/*"); 69 | filterRegBean.setUrlPatterns(urlPatterns); 70 | return filterRegBean; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/repository/CenterConfigsRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.repository; 19 | 20 | import org.apache.shardingsphere.ui.common.domain.CenterConfigs; 21 | 22 | /** 23 | * Center configs repository interface. 24 | */ 25 | public interface CenterConfigsRepository extends ConfigsRepository { 26 | } 27 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/repository/ConfigsRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.repository; 19 | 20 | /** 21 | * Configs repository. 22 | */ 23 | public interface ConfigsRepository { 24 | 25 | /** 26 | * Load configs. 27 | * 28 | * @return configs 29 | */ 30 | T load(); 31 | 32 | /** 33 | * Save configs. 34 | * 35 | * @param configs configs 36 | */ 37 | void save(T configs); 38 | } 39 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/repository/ForwardServiceConfigsRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.repository; 19 | 20 | import org.apache.shardingsphere.ui.common.domain.ForwardServiceConfigs; 21 | 22 | /** 23 | * Sharding scaling config repository. 24 | */ 25 | public interface ForwardServiceConfigsRepository extends ConfigsRepository { 26 | } 27 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/repository/impl/YamlCenterConfigsRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.repository.impl; 19 | 20 | import org.apache.shardingsphere.ui.common.domain.CenterConfigs; 21 | import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException; 22 | import org.apache.shardingsphere.ui.repository.CenterConfigsRepository; 23 | import org.springframework.stereotype.Repository; 24 | import org.yaml.snakeyaml.Yaml; 25 | import org.yaml.snakeyaml.constructor.Constructor; 26 | 27 | import java.io.BufferedOutputStream; 28 | import java.io.File; 29 | import java.io.FileInputStream; 30 | import java.io.FileOutputStream; 31 | import java.io.IOException; 32 | import java.io.InputStreamReader; 33 | import java.nio.charset.StandardCharsets; 34 | 35 | /** 36 | * Implementation of Center configs repository. 37 | */ 38 | @Repository 39 | public final class YamlCenterConfigsRepositoryImpl implements CenterConfigsRepository { 40 | 41 | private final File file; 42 | 43 | public YamlCenterConfigsRepositoryImpl() { 44 | file = new File(new File(System.getProperty("user.home")), "shardingsphere-ui-configs.yaml"); 45 | } 46 | 47 | @Override 48 | public CenterConfigs load() { 49 | if (!file.exists()) { 50 | return new CenterConfigs(); 51 | } 52 | 53 | try (FileInputStream fileInputStream = new FileInputStream(file); 54 | InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8)) { 55 | return new Yaml(new Constructor(CenterConfigs.class)).loadAs(inputStreamReader, CenterConfigs.class); 56 | } catch (IOException e) { 57 | throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, "load center config error"); 58 | } 59 | 60 | } 61 | 62 | @Override 63 | public void save(final CenterConfigs centerConfigs) { 64 | Yaml yaml = new Yaml(); 65 | try (BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file))) { 66 | bufferedOutputStream.write(yaml.dumpAsMap(centerConfigs).getBytes()); 67 | bufferedOutputStream.flush(); 68 | } catch (IOException e) { 69 | throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, "save center config error"); 70 | } 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/repository/impl/YamlForwardServiceConfigsRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.repository.impl; 19 | 20 | import java.io.BufferedOutputStream; 21 | import java.io.File; 22 | import java.io.FileInputStream; 23 | import java.io.FileOutputStream; 24 | import java.io.IOException; 25 | import java.io.InputStreamReader; 26 | import java.nio.charset.StandardCharsets; 27 | 28 | import org.apache.shardingsphere.ui.common.domain.ForwardServiceConfigs; 29 | import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException; 30 | import org.apache.shardingsphere.ui.repository.ForwardServiceConfigsRepository; 31 | import org.springframework.stereotype.Repository; 32 | import org.yaml.snakeyaml.Yaml; 33 | import org.yaml.snakeyaml.constructor.Constructor; 34 | 35 | /** 36 | * Implementation of forward service configs repository. 37 | */ 38 | @Repository 39 | public final class YamlForwardServiceConfigsRepositoryImpl implements ForwardServiceConfigsRepository { 40 | 41 | private final File file; 42 | 43 | public YamlForwardServiceConfigsRepositoryImpl() { 44 | file = new File(new File(System.getProperty("user.home")), "shardingsphere-ui-forward-services.yaml"); 45 | } 46 | 47 | @Override 48 | public ForwardServiceConfigs load() { 49 | if (!file.exists()) { 50 | return new ForwardServiceConfigs(); 51 | } 52 | try (FileInputStream fileInputStream = new FileInputStream(file); 53 | InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8)) { 54 | return new Yaml(new Constructor(ForwardServiceConfigs.class)).loadAs(inputStreamReader, ForwardServiceConfigs.class); 55 | } catch (IOException e) { 56 | throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, "load forward services config error"); 57 | } 58 | } 59 | 60 | @Override 61 | public void save(final ForwardServiceConfigs forwardServiceConfigs) { 62 | Yaml yaml = new Yaml(); 63 | try (BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file))) { 64 | bufferedOutputStream.write(yaml.dumpAsMap(forwardServiceConfigs).getBytes()); 65 | bufferedOutputStream.flush(); 66 | } catch (IOException e) { 67 | throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, "save registry config error"); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/security/UserAccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.security; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | /** 24 | * User account. 25 | */ 26 | @Getter 27 | @Setter 28 | public final class UserAccount { 29 | 30 | private String username; 31 | 32 | private String password; 33 | } 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/security/UserAuthenticationService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.security; 19 | 20 | import com.google.common.base.Strings; 21 | import com.google.gson.Gson; 22 | import lombok.Getter; 23 | import lombok.Setter; 24 | import org.apache.commons.codec.binary.Base64; 25 | import org.springframework.boot.context.properties.ConfigurationProperties; 26 | import org.springframework.stereotype.Component; 27 | 28 | /** 29 | * User authentication service. 30 | */ 31 | @Component 32 | @ConfigurationProperties(prefix = "user.admin") 33 | public final class UserAuthenticationService { 34 | 35 | @Getter 36 | @Setter 37 | private String username; 38 | 39 | @Getter 40 | @Setter 41 | private String password; 42 | 43 | private final Base64 base64 = new Base64(); 44 | 45 | private Gson gson = new Gson(); 46 | 47 | /** 48 | * Check user. 49 | * 50 | * @param userAccount user account 51 | * @return check success or failure 52 | */ 53 | public boolean checkUser(final UserAccount userAccount) { 54 | if (null == userAccount || Strings.isNullOrEmpty(userAccount.getUsername()) || Strings.isNullOrEmpty(userAccount.getPassword())) { 55 | return false; 56 | } 57 | return username.equals(userAccount.getUsername()) && password.equals(userAccount.getPassword()); 58 | } 59 | 60 | /** 61 | * Get user authentication token. 62 | * 63 | * @return authentication token 64 | */ 65 | public String getToken() { 66 | return base64.encodeToString(gson.toJson(this).getBytes()); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/CenterConfigService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie; 19 | 20 | 21 | import org.apache.shardingsphere.ui.common.domain.CenterConfig; 22 | import org.apache.shardingsphere.ui.common.domain.CenterConfigs; 23 | import org.apache.shardingsphere.ui.common.dto.CenterConfigDTO; 24 | 25 | import java.util.Optional; 26 | 27 | /** 28 | * Center config service. 29 | */ 30 | public interface CenterConfigService { 31 | 32 | /** 33 | * Load center config. 34 | * 35 | * @param name center config name 36 | * @return center config 37 | */ 38 | CenterConfig load(String name); 39 | 40 | /** 41 | * Load the activated center config. 42 | * 43 | * @return activated center config 44 | */ 45 | Optional loadActivated(); 46 | 47 | /** 48 | * Add center config. 49 | * 50 | * @param config center config 51 | */ 52 | void add(CenterConfig config); 53 | 54 | /** 55 | * Delete center config. 56 | * 57 | * @param name center config name 58 | */ 59 | void delete(String name); 60 | 61 | /** 62 | * Set activated center config. 63 | * 64 | * @param name center config name 65 | */ 66 | void setActivated(String name); 67 | 68 | /** 69 | * Load all center configs. 70 | * 71 | * @return all center configs. 72 | */ 73 | CenterConfigs loadAll(); 74 | 75 | /** 76 | * update config center 77 | * 78 | * @param config center config 79 | */ 80 | void update(CenterConfigDTO config); 81 | } 82 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/GovernanceService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie; 19 | 20 | import org.apache.shardingsphere.ui.common.dto.InstanceDTO; 21 | import org.apache.shardingsphere.ui.common.dto.ReadDataSourceDTO; 22 | 23 | import java.util.Collection; 24 | 25 | /** 26 | * Governance operation service. 27 | */ 28 | public interface GovernanceService { 29 | 30 | /** 31 | * Get all instances. 32 | * 33 | * @return all instances 34 | */ 35 | Collection getALLInstance(); 36 | 37 | /** 38 | * Update instance status. 39 | * 40 | * @param instanceId instance id 41 | * @param enabled enabled 42 | */ 43 | void updateInstanceStatus(String instanceId, boolean enabled); 44 | 45 | /** 46 | * Get all read data source. 47 | * 48 | * @return all read data source dto 49 | */ 50 | Collection getAllReadDataSource(); 51 | 52 | /** 53 | * update read data source status. 54 | * 55 | * @param schemaNames schema name 56 | * @param readDataSourceName read data source name 57 | * @param enabled enabled 58 | */ 59 | void updateReadDataSourceStatus(String schemaNames, String readDataSourceName, boolean enabled); 60 | } 61 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/ProxyAuthenticationService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie; 19 | 20 | /** 21 | * Sharding proxy Authentication service. 22 | */ 23 | public interface ProxyAuthenticationService { 24 | 25 | /** 26 | * Get authentication. 27 | * 28 | * @return authentication 29 | */ 30 | String getAuthentication(); 31 | 32 | /** 33 | * Update authentication. 34 | * 35 | * @param authentication authentication 36 | */ 37 | void updateAuthentication(String authentication); 38 | } 39 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/RegistryCenterService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie; 19 | 20 | import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository; 21 | 22 | /** 23 | * Registry center service. 24 | */ 25 | public interface RegistryCenterService { 26 | 27 | /** 28 | * Get activated registry center. 29 | * 30 | * @return registry center 31 | */ 32 | RegistryCenterRepository getActivatedRegistryCenter(); 33 | } 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/ShardingPropertiesService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie; 19 | 20 | /** 21 | * Sharding properties service. 22 | */ 23 | public interface ShardingPropertiesService { 24 | 25 | /** 26 | * Load sharding properties. 27 | * 28 | * @return sharding properties 29 | */ 30 | String loadShardingProperties(); 31 | 32 | /** 33 | * Update sharding properties. 34 | * 35 | * @param configData config data 36 | */ 37 | void updateShardingProperties(String configData); 38 | } 39 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/ShardingSchemaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie; 19 | 20 | import java.util.Collection; 21 | 22 | /** 23 | * Sharding schema service. 24 | */ 25 | public interface ShardingSchemaService { 26 | 27 | /** 28 | * Get all schema names. 29 | * 30 | * @return all schema names 31 | */ 32 | Collection getAllSchemaNames(); 33 | 34 | /** 35 | * Get rule configuration. 36 | * 37 | * @param schemaName schema name 38 | * @return rule configuration 39 | */ 40 | String getRuleConfiguration(String schemaName); 41 | 42 | /** 43 | * Get data source configuration. 44 | * 45 | * @param schemaName schema name 46 | * @return data source configuration 47 | */ 48 | String getDataSourceConfiguration(String schemaName); 49 | 50 | /** 51 | * Update rule configuration. 52 | * 53 | * @param schemaName schema name 54 | * @param configData config data 55 | */ 56 | void updateRuleConfiguration(String schemaName, String configData); 57 | 58 | /** 59 | * Update data source configuration. 60 | * 61 | * @param schemaName schema name 62 | * @param configData config data 63 | */ 64 | void updateDataSourceConfiguration(String schemaName, String configData); 65 | 66 | /** 67 | * Add schema configuration. 68 | * 69 | * @param schemaName schema name 70 | * @param ruleConfiguration rule configuration 71 | * @param dataSourceConfiguration data source configuration 72 | */ 73 | void addSchemaConfiguration(String schemaName, String ruleConfiguration, String dataSourceConfiguration); 74 | 75 | /** 76 | * Delete schema configuration. 77 | * 78 | * @param schemaName schema name 79 | */ 80 | void deleteSchemaConfiguration(String schemaName); 81 | 82 | /** 83 | * Get meta data configuration. 84 | * 85 | * @param schemaName schema name 86 | * @return meta data configuration 87 | */ 88 | String getMetadataConfiguration(String schemaName); 89 | } 90 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/forward/ShardingScalingForwardService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie.forward; 19 | 20 | /** 21 | * Forward server of sharding scaling. 22 | */ 23 | public interface ShardingScalingForwardService { 24 | 25 | /** 26 | * list all sharding scaling jobs. 27 | * 28 | * @return response string from sharding scaling server 29 | */ 30 | String listAllShardingScalingJobs(); 31 | 32 | /** 33 | * Start sharding scaling job. 34 | * 35 | * @param requestBody request body of start sharding scaling job 36 | * @return response string from sharding scaling server 37 | */ 38 | String startShardingScalingJobs(String requestBody); 39 | 40 | /** 41 | * Get sharding scaling job progress. 42 | * 43 | * @param jobId job id 44 | * @return response string from sharding scaling server 45 | */ 46 | String getShardingScalingJobProgress(long jobId); 47 | 48 | /** 49 | * Stop sharding scaling job. 50 | * 51 | * @param jobId job id 52 | * @return response string from sharding scaling server 53 | */ 54 | String stopShardingScalingJob(long jobId); 55 | } 56 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/ProxyAuthenticationServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie.impl; 19 | 20 | import com.google.common.base.Preconditions; 21 | import org.apache.shardingsphere.governance.core.registry.config.node.GlobalNode; 22 | import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration; 23 | import org.apache.shardingsphere.infra.yaml.engine.YamlEngine; 24 | import org.apache.shardingsphere.ui.servcie.ProxyAuthenticationService; 25 | import org.apache.shardingsphere.ui.servcie.RegistryCenterService; 26 | import org.springframework.beans.factory.annotation.Autowired; 27 | import org.springframework.stereotype.Service; 28 | 29 | import java.util.Collection; 30 | 31 | /** 32 | * Implementation of sharding proxy authentication service. 33 | */ 34 | @Service 35 | public final class ProxyAuthenticationServiceImpl implements ProxyAuthenticationService { 36 | 37 | @Autowired 38 | private RegistryCenterService registryCenterService; 39 | 40 | @Override 41 | public String getAuthentication() { 42 | return registryCenterService.getActivatedRegistryCenter().get(GlobalNode.getGlobalRuleNode()); 43 | } 44 | 45 | @Override 46 | public void updateAuthentication(final String authentication) { 47 | checkAuthenticationConfiguration(authentication); 48 | registryCenterService.getActivatedRegistryCenter() 49 | .persist(GlobalNode.getGlobalRuleNode(), authentication); 50 | } 51 | 52 | private void checkAuthenticationConfiguration(final String data) { 53 | try { 54 | Collection globalRuleConfigs = YamlEngine.unmarshal(data, Collection.class); 55 | Preconditions.checkState(!globalRuleConfigs.isEmpty()); 56 | // CHECKSTYLE:OFF 57 | } catch (final Exception ex) { 58 | // CHECKSTYLE:ON 59 | throw new IllegalArgumentException("authentication configuration is invalid."); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/RegistryCenterServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie.impl; 19 | 20 | import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository; 21 | import org.apache.shardingsphere.ui.common.domain.CenterConfig; 22 | import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException; 23 | import org.apache.shardingsphere.ui.servcie.CenterConfigService; 24 | import org.apache.shardingsphere.ui.servcie.RegistryCenterService; 25 | import org.apache.shardingsphere.ui.util.CenterRepositoryFactory; 26 | import org.springframework.beans.factory.annotation.Autowired; 27 | import org.springframework.stereotype.Service; 28 | 29 | import java.util.Optional; 30 | 31 | /** 32 | * Implementation of Registry center service. 33 | */ 34 | @Service 35 | public final class RegistryCenterServiceImpl implements RegistryCenterService { 36 | 37 | @Autowired 38 | private CenterConfigService centerConfigService; 39 | 40 | @Override 41 | public RegistryCenterRepository getActivatedRegistryCenter() { 42 | Optional optional = centerConfigService.loadActivated(); 43 | if (optional.isPresent()) { 44 | return CenterRepositoryFactory.createRegistryRepository(optional.get()); 45 | } 46 | throw new ShardingSphereUIException(ShardingSphereUIException.SERVER_ERROR, "No activated registry center!"); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/servcie/impl/ShardingPropertiesServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.servcie.impl; 19 | 20 | import org.apache.shardingsphere.governance.core.registry.config.node.GlobalNode; 21 | import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties; 22 | import org.apache.shardingsphere.infra.yaml.engine.YamlEngine; 23 | import org.apache.shardingsphere.ui.servcie.RegistryCenterService; 24 | import org.apache.shardingsphere.ui.servcie.ShardingPropertiesService; 25 | import org.springframework.stereotype.Service; 26 | 27 | import javax.annotation.Resource; 28 | import java.util.Properties; 29 | 30 | /** 31 | * Implementation of sharding properties service. 32 | */ 33 | @Service 34 | public final class ShardingPropertiesServiceImpl implements ShardingPropertiesService { 35 | 36 | @Resource 37 | private RegistryCenterService registryCenterService; 38 | 39 | @Override 40 | public String loadShardingProperties() { 41 | return registryCenterService.getActivatedRegistryCenter().get(GlobalNode.getPropsPath()); 42 | } 43 | 44 | @Override 45 | public void updateShardingProperties(final String configData) { 46 | checkShardingProperties(configData); 47 | registryCenterService.getActivatedRegistryCenter().persist(GlobalNode.getPropsPath(), configData); 48 | } 49 | 50 | private void checkShardingProperties(final String configData) { 51 | try { 52 | Properties props = YamlEngine.unmarshal(configData, Properties.class); 53 | new ConfigurationProperties(props); 54 | // CHECKSTYLE:OFF 55 | } catch (final Exception ex) { 56 | // CHECKSTYLE:ON 57 | throw new IllegalArgumentException("Sharding properties is invalid.", ex); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/advice/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.web.advice; 19 | 20 | import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException; 21 | import org.apache.shardingsphere.ui.web.response.ResponseResult; 22 | import org.apache.shardingsphere.ui.web.response.ResponseResultUtil; 23 | import lombok.extern.slf4j.Slf4j; 24 | import org.springframework.web.bind.annotation.ControllerAdvice; 25 | import org.springframework.web.bind.annotation.ExceptionHandler; 26 | import org.springframework.web.bind.annotation.ResponseBody; 27 | 28 | /** 29 | * Global exception handler. 30 | */ 31 | @Slf4j 32 | @ControllerAdvice 33 | public final class GlobalExceptionHandler { 34 | 35 | /** 36 | * Handle exception. 37 | * 38 | * @param ex exception 39 | * @return response result 40 | */ 41 | @ExceptionHandler(Exception.class) 42 | @ResponseBody 43 | public ResponseResult handleException(final Exception ex) { 44 | log.error("schedule error", ex); 45 | if (ex instanceof IllegalArgumentException) { 46 | return ResponseResultUtil.handleIllegalArgumentException(ex.getMessage()); 47 | } else if (ex instanceof ShardingSphereUIException) { 48 | return ResponseResultUtil.handleShardingSphereUIException((ShardingSphereUIException) ex); 49 | } 50 | return ResponseResultUtil.handleUncaughtException(ex.getMessage()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/controller/ProxyAuthenticationController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.web.controller; 19 | 20 | import org.apache.shardingsphere.ui.servcie.ProxyAuthenticationService; 21 | import org.apache.shardingsphere.ui.web.response.ResponseResult; 22 | import org.apache.shardingsphere.ui.web.response.ResponseResultUtil; 23 | import org.springframework.beans.factory.annotation.Autowired; 24 | import org.springframework.web.bind.annotation.RequestBody; 25 | import org.springframework.web.bind.annotation.RequestMapping; 26 | import org.springframework.web.bind.annotation.RequestMethod; 27 | import org.springframework.web.bind.annotation.RestController; 28 | 29 | import java.util.Map; 30 | 31 | /** 32 | * RESTful API of sharding proxy authentication. 33 | */ 34 | @RestController 35 | @RequestMapping("/api/authentication") 36 | public final class ProxyAuthenticationController { 37 | 38 | @Autowired 39 | private ProxyAuthenticationService proxyAuthenticationService; 40 | 41 | /** 42 | * Load authentication. 43 | * 44 | * @return response result 45 | */ 46 | @RequestMapping(value = "", method = RequestMethod.GET) 47 | public ResponseResult loadAuthentication() { 48 | return ResponseResultUtil.build(proxyAuthenticationService.getAuthentication()); 49 | } 50 | 51 | /** 52 | * Update authentication. 53 | * 54 | * @param configMap config map 55 | * @return response result 56 | */ 57 | @RequestMapping(value = "", method = RequestMethod.PUT) 58 | public ResponseResult updateAuthentication(@RequestBody final Map configMap) { 59 | proxyAuthenticationService.updateAuthentication(configMap.get("authentication")); 60 | return ResponseResultUtil.success(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/controller/ShardingPropertiesController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.web.controller; 19 | 20 | import org.apache.shardingsphere.ui.servcie.ShardingPropertiesService; 21 | import org.apache.shardingsphere.ui.web.response.ResponseResult; 22 | import org.apache.shardingsphere.ui.web.response.ResponseResultUtil; 23 | import org.springframework.web.bind.annotation.RequestBody; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | import org.springframework.web.bind.annotation.RequestMethod; 26 | import org.springframework.web.bind.annotation.RestController; 27 | 28 | import javax.annotation.Resource; 29 | import java.util.Map; 30 | 31 | /** 32 | * RESTFul API of sharding properties. 33 | */ 34 | @RestController 35 | @RequestMapping("/api/props") 36 | public final class ShardingPropertiesController { 37 | 38 | @Resource 39 | private ShardingPropertiesService shardingPropertiesService; 40 | 41 | /** 42 | * Load sharding properties. 43 | * 44 | * @return response result 45 | */ 46 | @RequestMapping(value = "", method = RequestMethod.GET) 47 | public ResponseResult loadShardingProperties() { 48 | return ResponseResultUtil.build(shardingPropertiesService.loadShardingProperties()); 49 | } 50 | 51 | /** 52 | * Update sharding properties. 53 | * 54 | * @param configMap config map 55 | * @return response result 56 | */ 57 | @RequestMapping(value = "", method = RequestMethod.PUT) 58 | public ResponseResult updateShardingProperties(@RequestBody final Map configMap) { 59 | shardingPropertiesService.updateShardingProperties(configMap.get("props")); 60 | return ResponseResultUtil.success(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/filter/CORSFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.web.filter; 19 | 20 | import org.springframework.http.HttpStatus; 21 | 22 | import javax.servlet.Filter; 23 | import javax.servlet.FilterChain; 24 | import javax.servlet.FilterConfig; 25 | import javax.servlet.ServletException; 26 | import javax.servlet.ServletRequest; 27 | import javax.servlet.ServletResponse; 28 | import javax.servlet.http.HttpServletRequest; 29 | import javax.servlet.http.HttpServletResponse; 30 | import java.io.IOException; 31 | 32 | /** 33 | * CORS filter. 34 | */ 35 | public final class CORSFilter implements Filter { 36 | 37 | @Override 38 | public void init(final FilterConfig filterConfig) { 39 | } 40 | 41 | @Override 42 | public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException { 43 | HttpServletResponse response = (HttpServletResponse) servletResponse; 44 | HttpServletRequest request = (HttpServletRequest) servletRequest; 45 | response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); 46 | response.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS"); 47 | response.setHeader("Access-Control-Max-Age", "3600"); 48 | response.setHeader("Access-Control-Allow-Credentials", "true"); 49 | response.setHeader("Access-Control-Allow-Headers", "Content-Type,Access-Token"); 50 | if ("OPTIONS".equals(request.getMethod())) { 51 | response.setStatus(HttpStatus.OK.value()); 52 | } else { 53 | filterChain.doFilter(request, response); 54 | } 55 | } 56 | 57 | @Override 58 | public void destroy() { 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/response/ResponseResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.shardingsphere.ui.web.response; 19 | 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | 25 | import java.io.Serializable; 26 | 27 | /** 28 | * Restful Response result. 29 | */ 30 | @Getter 31 | @Setter 32 | @NoArgsConstructor 33 | @AllArgsConstructor 34 | public final class ResponseResult implements Serializable { 35 | 36 | private static final long serialVersionUID = 8144393142115317354L; 37 | 38 | private boolean success = true; 39 | 40 | private int errorCode; 41 | 42 | private String errorMsg; 43 | 44 | private T model; 45 | } 46 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | server.port=8088 19 | 20 | user.admin.username=admin 21 | user.admin.password=admin 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-backend/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | [%-5level] %d{HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 4.0.0 21 | 22 | org.apache.shardingsphere 23 | shardingsphere-ui 24 | 5.0.0-RC1-SNAPSHOT 25 | 26 | shardingsphere-ui-distribution 27 | ${project.artifactId} 28 | pom 29 | 30 | 31 | true 32 | 33 | 34 | 35 | shardingsphere-ui-src-distribution 36 | shardingsphere-ui-bin-distribution 37 | 38 | 39 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | FROM java:8 19 | MAINTAINER ShardingSphere "dev@shardingsphere.apache.org" 20 | 21 | ARG APP_NAME 22 | ENV LOCAL_PATH /opt/shardingsphere-ui 23 | 24 | ADD target/${APP_NAME}.tar.gz /opt 25 | RUN mv /opt/${APP_NAME} ${LOCAL_PATH} 26 | 27 | ENTRYPOINT ${LOCAL_PATH}/bin/start.sh ${PORT} && tail -f ${LOCAL_PATH}/logs/stdout.log 28 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/assembly/shardingsphere-ui-bin-distribution.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | shardingsphere-ui-bin 21 | 22 | tar.gz 23 | 24 | true 25 | ${project.build.finalName}-shardingsphere-ui-bin 26 | 27 | 28 | 29 | src/main/resources/bin 30 | unix 31 | 32 | *.sh 33 | 34 | bin 35 | 0755 36 | 37 | 38 | src/main/resources/bin 39 | windows 40 | 41 | *.bat 42 | 43 | bin 44 | 0755 45 | 46 | 47 | src/main/resources 48 | 49 | application.properties 50 | logback.xml 51 | 52 | conf 53 | 0644 54 | 55 | 56 | ../../ 57 | 58 | DISCLAIMER 59 | 60 | 61 | 62 | src/main/release-docs 63 | 64 | **/* 65 | 66 | / 67 | 68 | 69 | 70 | 71 | 72 | lib 73 | 0644 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-antlr4-runtime.txt: -------------------------------------------------------------------------------- 1 | ANTLR 4 License 2 | --------------- 3 | 4 | [The "BSD 3-clause license"] 5 | Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. Neither the name of the copyright holder nor the names of its contributors 17 | may be used to endorse or promote products derived from this software 18 | without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-axios.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-present Matt Zabriskie 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-echarts-liquidfill.txt: -------------------------------------------------------------------------------- 1 | Copyright 2019 Ovilia 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-element-ui.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-present ElemeFE 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-jcl-over-slf4j.txt: -------------------------------------------------------------------------------- 1 | jcl-over-slf4j License 2 | --------------- 3 | 4 | Copyright (c) 2004-2017 QOS.ch 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-js-yaml.txt: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (C) 2011-2015 by Vitaly Puzrin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-jul-to-slf4j.txt: -------------------------------------------------------------------------------- 1 | jul-to-slf4j License 2 | --------------- 3 | 4 | Copyright (c) 2004-2017 QOS.ch 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-lodash.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright JS Foundation and other contributors 4 | 5 | Based on Underscore.js, copyright Jeremy Ashkenas, 6 | DocumentCloud and Investigative Reporters & Editors 7 | 8 | This software consists of voluntary contributions made by many 9 | individuals. For exact contribution history, see the revision history 10 | available at https://github.com/lodash/lodash 11 | 12 | The following license applies to all parts of this software except as 13 | documented below: 14 | 15 | ==== 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining 18 | a copy of this software and associated documentation files (the 19 | "Software"), to deal in the Software without restriction, including 20 | without limitation the rights to use, copy, modify, merge, publish, 21 | distribute, sublicense, and/or sell copies of the Software, and to 22 | permit persons to whom the Software is furnished to do so, subject to 23 | the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be 26 | included in all copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 29 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 32 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 33 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 34 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 | 36 | ==== 37 | 38 | Copyright and related rights for sample code are waived via CC0. Sample 39 | code is defined as all source code displayed within the prose of the 40 | documentation. 41 | 42 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 43 | 44 | ==== 45 | 46 | Files located in the node_modules and vendor directories are externally 47 | maintained libraries used by this software which have their own 48 | licenses; we recommend you read them, as their terms may differ from the 49 | terms above. -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-logback.txt: -------------------------------------------------------------------------------- 1 | Logback License 2 | --------------- 3 | 4 | Logback: the reliable, generic, fast and flexible logging framework. 5 | Copyright (C) 1999-2015, QOS.ch. All rights reserved. 6 | 7 | This program and the accompanying materials are dual-licensed under 8 | either the terms of the Eclipse Public License v1.0 as published by 9 | the Eclipse Foundation 10 | 11 | or (per the licensee's choosing) 12 | 13 | under the terms of the GNU Lesser General Public License version 2.1 14 | as published by the Free Software Foundation. 15 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-moment.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) JS Foundation and other contributors 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-normalize.txt: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright © Nicolas Gallagher and Jonathan Neal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-protobuf-java.txt: -------------------------------------------------------------------------------- 1 | protobuf-java License 2 | --------------- 3 | 4 | https://opensource.org/licenses/BSD-3-Clause 5 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-resize-detector.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-present, GU Yiling. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | 24 | The MIT License (MIT) 25 | 26 | Copyright (c) 2013 Sebastián Décima 27 | 28 | Permission is hereby granted, free of charge, to any person obtaining a copy of 29 | this software and associated documentation files (the "Software"), to deal in 30 | the Software without restriction, including without limitation the rights to 31 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 32 | the Software, and to permit persons to whom the Software is furnished to do so, 33 | subject to the following conditions: 34 | 35 | The above copyright notice and this permission notice shall be included in all 36 | copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 40 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 41 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 42 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 43 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-slf4j.txt: -------------------------------------------------------------------------------- 1 | SLF4J License 2 | --------------- 3 | 4 | Copyright (c) 2004-2017 QOS.ch 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-vue-i18n.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 kazuya kawaguchi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-vue-router.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2016 Evan You 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-vue.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-present, Yuxi (Evan) You 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/release-docs/licenses/LICENSE-vuex.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2016 Evan You 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | server.port=8088 19 | 20 | user.admin.username=admin 21 | user.admin.password=admin 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/resources/bin/start.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Licensed to the Apache Software Foundation (ASF) under one or more 3 | @rem contributor license agreements. See the NOTICE file distributed with 4 | @rem this work for additional information regarding copyright ownership. 5 | @rem The ASF licenses this file to You under the Apache License, Version 2.0 6 | @rem (the "License"); you may not use this file except in compliance with 7 | @rem the License. You may obtain a copy of the License at 8 | @rem 9 | @rem http://www.apache.org/licenses/LICENSE-2.0 10 | @rem 11 | @rem Unless required by applicable law or agreed to in writing, software 12 | @rem distributed under the License is distributed on an "AS IS" BASIS, 13 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | @rem See the License for the specific language governing permissions and 15 | @rem limitations under the License. 16 | @rem 17 | 18 | @echo off & setlocal enabledelayedexpansion 19 | 20 | cd %~dp0 21 | 22 | set SERVER_NAME=ShardingSphere-UI 23 | 24 | set CLASS_PATH=".;..\conf;..\lib\*" 25 | 26 | set JAVA_OPTS=-server -Xmx1g -Xms1g -Xmn512m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 27 | 28 | set MAIN_CLASS=org.apache.shardingsphere.ui.Bootstrap 29 | 30 | echo Starting the %SERVER_NAME% ... 31 | 32 | java %JAVA_OPTS% -Dfile.encoding=UTF-8 -classpath %CLASS_PATH% %MAIN_CLASS% 33 | 34 | pause 35 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/resources/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | SERVER_NAME=ShardingSphere-UI 20 | 21 | cd `dirname $0` 22 | cd .. 23 | DEPLOY_DIR=`pwd` 24 | 25 | LOGS_DIR=${DEPLOY_DIR}/logs 26 | if [ ! -d ${LOGS_DIR} ]; then 27 | mkdir ${LOGS_DIR} 28 | fi 29 | 30 | STDOUT_FILE=${LOGS_DIR}/stdout.log 31 | 32 | PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | grep -v grep | awk '{print $2}'` 33 | if [ -n "$PIDS" ]; then 34 | echo "ERROR: The $SERVER_NAME already started!" 35 | echo "PID: $PIDS" 36 | exit 1 37 | fi 38 | 39 | CLASS_PATH=.:${DEPLOY_DIR}/conf:${DEPLOY_DIR}/lib/* 40 | JAVA_OPTS=" -server -Xmx1g -Xms1g -Xmn512m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 " 41 | 42 | MAIN_CLASS=org.apache.shardingsphere.ui.Bootstrap 43 | echo "Starting the $SERVER_NAME ..." 44 | 45 | nohup java ${JAVA_OPTS} -classpath ${CLASS_PATH} ${MAIN_CLASS} > ${STDOUT_FILE} 2>&1 & 46 | sleep 1 47 | echo "Please check the STDOUT file: $STDOUT_FILE" 48 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/resources/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | SERVER_NAME=ShardingSphere-UI 20 | 21 | cd `dirname $0` 22 | cd .. 23 | DEPLOY_DIR=`pwd` 24 | 25 | PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | grep -v grep |awk '{print $2}'` 26 | if [ -z "$PIDS" ]; then 27 | echo "ERROR: The $SERVER_NAME does not started!" 28 | exit 1 29 | fi 30 | 31 | echo -e "Stopping the $SERVER_NAME ...\c" 32 | for PID in ${PIDS} ; do 33 | kill ${PID} > /dev/null 2>&1 34 | done 35 | 36 | COUNT=0 37 | while [ ${COUNT} -lt 1 ]; do 38 | echo -e ".\c" 39 | sleep 1 40 | COUNT=1 41 | for PID in ${PIDS} ; do 42 | PID_EXIST=`ps -f -p ${PID} | grep java` 43 | if [ -n "$PID_EXIST" ]; then 44 | COUNT=0 45 | break 46 | fi 47 | done 48 | done 49 | 50 | echo "OK!" 51 | echo "PID: $PIDS" 52 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-bin-distribution/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | [%-5level] %d{HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-distribution/shardingsphere-ui-src-distribution/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 4.0.0 21 | 22 | org.apache.shardingsphere 23 | shardingsphere-ui-distribution 24 | 5.0.0-RC1-SNAPSHOT 25 | 26 | shardingsphere-ui-src-distribution 27 | ${project.artifactId} 28 | 29 | 30 | 31 | org.apache.shardingsphere 32 | shardingsphere-ui-frontend 33 | ${project.version} 34 | 35 | 36 | org.apache.shardingsphere 37 | shardingsphere-ui-backend 38 | ${project.version} 39 | 40 | 41 | 42 | 43 | 44 | release 45 | 46 | apache-shardingsphere-${project.version} 47 | 48 | 49 | maven-assembly-plugin 50 | 51 | 52 | shardingsphere-ui-src 53 | package 54 | 55 | single 56 | 57 | 58 | 59 | src/main/assembly/shardingsphere-ui-src-distribution.xml 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/.babelrc: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | { 18 | "presets": [ 19 | "@babel/preset-env" 20 | ], 21 | "plugins": ["transform-vue-jsx", "@babel/plugin-transform-runtime", "@babel/plugin-syntax-dynamic-import"], 22 | "env": { 23 | "test": { 24 | "plugins": ["istanbul"] 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | node/ 4 | /dist/ 5 | /test/coverage/ 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | package-lock.json 10 | 11 | # Editor directories and files 12 | .prettierrc 13 | .idea 14 | .vscode 15 | *.suo 16 | *.ntvs* 17 | *.njsproj 18 | *.sln 19 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/.postcssrc.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // https://github.com/michael-ciniawsky/postcss-load-config 19 | 20 | module.exports = { 21 | "plugins": { 22 | "postcss-import": {}, 23 | "postcss-url": {}, 24 | // to edit target browsers: use "browserslist" field in package.json 25 | "autoprefixer": {} 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/README.md: -------------------------------------------------------------------------------- 1 | # ShardingSphere UI Frontend 2 | 3 | ## How to Build 4 | 5 | ```bash 6 | # install dependencies 7 | npm install 8 | 9 | # serve with hot reload at localhost:8080 10 | npm run dev 11 | 12 | # build for production with minification 13 | npm run build 14 | 15 | # build for production and view the bundle analyzer report 16 | npm run build --report 17 | ``` 18 | 19 | ## How to Run unit tests 20 | 21 | ```bash 22 | # Karma does unit testing for components and pages 23 | npm run unit 24 | ``` 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/README_ZH.md: -------------------------------------------------------------------------------- 1 | # ShardingSphere UI 前端 2 | 3 | ## 如何构建 4 | 5 | ```bash 6 | # install dependencies 7 | npm install 8 | 9 | # serve with hot reload at localhost:8080 10 | npm run dev 11 | 12 | # build for production with minification 13 | npm run build 14 | 15 | # build for production and view the bundle analyzer report 16 | npm run build --report 17 | ``` 18 | 19 | ## 如何运行单元测试 20 | 21 | ```bash 22 | # Karma does unit testing for components and pages 23 | npm run unit 24 | ``` 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/build/build.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 'use strict' 19 | require('./check-versions')() 20 | 21 | process.env.NODE_ENV = 'production' 22 | 23 | const ora = require('ora') 24 | const rm = require('rimraf') 25 | const path = require('path') 26 | const chalk = require('chalk') 27 | const webpack = require('webpack') 28 | const config = require('../config') 29 | const webpackConfig = require('./webpack.prod.conf') 30 | 31 | const spinner = ora('building for production...') 32 | spinner.start() 33 | 34 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 35 | if (err) throw err 36 | webpack(webpackConfig, (err, stats) => { 37 | spinner.stop() 38 | if (err) throw err 39 | process.stdout.write(stats.toString({ 40 | colors: true, 41 | modules: false, 42 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 43 | chunks: false, 44 | chunkModules: false 45 | }) + '\n\n') 46 | 47 | if (stats.hasErrors()) { 48 | console.log(chalk.red(' Build failed with errors.\n')) 49 | process.exit(1) 50 | } 51 | 52 | console.log(chalk.cyan(' Build complete.\n')) 53 | console.log(chalk.yellow( 54 | ' Tip: built files are meant to be served over an HTTP server.\n' + 55 | ' Opening index.html over file:// won\'t work.\n' 56 | )) 57 | }) 58 | }) 59 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/build/check-versions.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 'use strict' 19 | const chalk = require('chalk') 20 | const semver = require('semver') 21 | const packageConfig = require('../package.json') 22 | const shell = require('shelljs') 23 | 24 | function exec (cmd) { 25 | return require('child_process').execSync(cmd).toString().trim() 26 | } 27 | 28 | const versionRequirements = [ 29 | { 30 | name: 'node', 31 | currentVersion: semver.clean(process.version), 32 | versionRequirement: packageConfig.engines.node 33 | } 34 | ] 35 | 36 | if (shell.which('npm')) { 37 | versionRequirements.push({ 38 | name: 'npm', 39 | currentVersion: exec('npm --version'), 40 | versionRequirement: packageConfig.engines.npm 41 | }) 42 | } 43 | 44 | module.exports = function () { 45 | const warnings = [] 46 | 47 | for (let i = 0; i < versionRequirements.length; i++) { 48 | const mod = versionRequirements[i] 49 | 50 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 51 | warnings.push(mod.name + ': ' + 52 | chalk.red(mod.currentVersion) + ' should be ' + 53 | chalk.green(mod.versionRequirement) 54 | ) 55 | } 56 | } 57 | 58 | if (warnings.length) { 59 | console.log('') 60 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 61 | console.log() 62 | 63 | for (let i = 0; i < warnings.length; i++) { 64 | const warning = warnings[i] 65 | console.log(' ' + warning) 66 | } 67 | 68 | console.log() 69 | process.exit(1) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 'use strict' 19 | 20 | module.exports = { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/build/webpack.unit.conf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | const path = require('path') 18 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 19 | const { VueLoaderPlugin } = require('vue-loader') 20 | const vueLoaderConfig = require('./vue-loader.conf') 21 | const utils = require('./utils') 22 | const config = require('../config') 23 | 24 | function resolve(dir) { 25 | return path.join(__dirname, '..', dir) 26 | } 27 | 28 | const webpackConfig = { 29 | mode: 'production', 30 | resolve: { 31 | extensions: ['.js', '.vue', '.json'], 32 | alias: { 33 | '@': resolve('src') 34 | } 35 | }, 36 | module: { 37 | rules: [ 38 | { 39 | test: /\.vue$/, 40 | loader: 'vue-loader', 41 | options: vueLoaderConfig 42 | }, 43 | { 44 | test: /\.js$/, 45 | loader: 'babel-loader', 46 | include: [resolve('src'), resolve('test')] 47 | }, 48 | { 49 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 50 | loader: 'url-loader', 51 | exclude: [resolve('src/icons')], 52 | options: { 53 | limit: 10000, 54 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 55 | } 56 | }, 57 | { 58 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 59 | loader: 'url-loader', 60 | options: { 61 | limit: 10000, 62 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 63 | } 64 | } 65 | ].concat( 66 | utils.styleLoaders({ 67 | sourceMap: config.build.productionSourceMap, 68 | extract: true, 69 | usePostCSS: true 70 | }) 71 | ) 72 | }, 73 | devtool: 'eval', 74 | plugins: [ 75 | new VueLoaderPlugin(), 76 | new MiniCssExtractPlugin({ 77 | filename: utils.assetsPath('css/[name].[contenthash].css') 78 | }) 79 | ] 80 | } 81 | 82 | delete webpackConfig.entry; 83 | 84 | module.exports = webpackConfig; -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/config/dev.env.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 'use strict' 19 | const merge = require('webpack-merge') 20 | const prodEnv = require('./prod.env') 21 | 22 | module.exports = merge(prodEnv, { 23 | NODE_ENV: process.env.NODE_ENV !== 'mock' ? '"development"' : '"mock"' 24 | }) 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/config/prod.env.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | 'use strict' 19 | module.exports = { 20 | NODE_ENV: '"production"' 21 | } 22 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/index.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ShardingSphere UI 24 | 25 | 26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/App.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 36 | 37 | 72 | 77 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/bg.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/close.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/data-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/data-source.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/del.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/del.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/edit.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/expand.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/link.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/login-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/login-logo.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/logo.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/meta-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/meta-data.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/open.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/password.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/rules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/rules.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/shrink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/shrink.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/sidebar-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/sidebar-icon.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/sidebar-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/sidebar-logo.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/img/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/img/user.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/src/assets/logo.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/styles/index.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | body { 18 | height: 100%; 19 | -moz-osx-font-smoothing: grayscale; 20 | -webkit-font-smoothing: antialiased; 21 | text-rendering: optimizeLegibility; 22 | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; 23 | } 24 | 25 | label { 26 | font-weight: 700; 27 | } 28 | 29 | html { 30 | height: 100%; 31 | box-sizing: border-box; 32 | } 33 | 34 | #app { 35 | height: 100%; 36 | } 37 | 38 | *, 39 | *:before, 40 | *:after { 41 | box-sizing: inherit; 42 | } 43 | 44 | a, 45 | a:focus, 46 | a:hover { 47 | cursor: pointer; 48 | color: inherit; 49 | outline: none; 50 | text-decoration: none; 51 | } 52 | 53 | div:focus { 54 | outline: none; 55 | } 56 | 57 | a:focus, 58 | a:active { 59 | outline: none; 60 | } 61 | 62 | a, 63 | a:focus, 64 | a:hover { 65 | cursor: pointer; 66 | color: inherit; 67 | text-decoration: none; 68 | } 69 | 70 | .clearfix { 71 | &:after { 72 | visibility: hidden; 73 | display: block; 74 | font-size: 0; 75 | content: " "; 76 | clear: both; 77 | height: 0; 78 | } 79 | } 80 | 81 | li { 82 | list-style: none; 83 | } 84 | 85 | //main-container全局样式 86 | .app-main { 87 | min-height: 100% 88 | } 89 | 90 | .app-container { 91 | padding: 20px; 92 | } 93 | 94 | .el-table th>.cell { 95 | color: #4a4a4a; 96 | } 97 | 98 | .el-table .cell { 99 | color: #4a4a4a; 100 | } 101 | 102 | .el-form-item__label { 103 | color: #4a4a4a; 104 | } 105 | 106 | .el-radio__label { 107 | color: #4a4a4a; 108 | } 109 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/assets/styles/theme.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | $--color-primary: #E17425; 18 | $--font-path: '~element-ui/lib/theme-chalk/fonts'; 19 | @import "~element-ui/packages/theme-chalk/src/index"; 20 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/components/Container/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 36 | 37 | 60 | 61 | 66 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/components/Footer/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 23 | 28 | 41 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/components/Logo/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 26 | 31 | 59 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/lang/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import ENUS from './en-US' 19 | import ZHCN from './zh-CN' 20 | export default { 21 | 'zh-CN': ZHCN, 22 | 'en-US': ENUS 23 | } 24 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import Vue from 'vue' 19 | import App from './App' 20 | import router from './router' 21 | import ElementUI from 'element-ui' 22 | import locale from 'element-ui/lib/locale/lang/en' 23 | import VueI18n from 'vue-i18n' 24 | import Language from './lang/index' 25 | import store from './store' 26 | import Vuex from 'vuex' 27 | import 'normalize.css/normalize.css' 28 | import '@/assets/styles/theme.scss' 29 | import '@/assets/styles/index.scss' 30 | 31 | Vue.config.productionTip = false 32 | Vue.use(ElementUI, { locale }) 33 | Vue.use(VueI18n) 34 | Vue.use(Vuex) 35 | 36 | // language setting init 37 | const lang = localStorage.getItem('language') || 'en-US' 38 | Vue.config.lang = lang 39 | 40 | // language setting 41 | const locales = Language 42 | const mergeZH = locales['zh-CN'] 43 | const mergeEN = locales['en-US'] 44 | 45 | const i18n = new VueI18n({ 46 | locale: lang, 47 | silentFallbackWarn: true, 48 | messages: { 49 | 'zh-CN': mergeZH, 50 | 'en-US': mergeEN 51 | } 52 | }) 53 | 54 | /* eslint-disable no-new */ 55 | new Vue({ 56 | el: '#app', 57 | router, 58 | store, 59 | i18n, 60 | components: { App }, 61 | template: '' 62 | }) 63 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/router/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import Vue from 'vue' 19 | import Router from 'vue-router' 20 | 21 | Vue.use(Router) 22 | 23 | export const constantRouterMap = [ 24 | { 25 | path: '*', 26 | redirect: '/registry-center' 27 | }, 28 | { 29 | path: '/registry-center', 30 | component: () => import('@/views/registry-center'), 31 | hidden: true, 32 | name: 'Registry center' 33 | }, 34 | { 35 | path: '/login', 36 | component: () => import('@/views/login'), 37 | hidden: true 38 | }, 39 | { 40 | path: '/rule-config', 41 | component: () => import('@/views/rule-config'), 42 | hidden: true, 43 | name: 'Rule config' 44 | }, 45 | { 46 | path: '/runtime-status', 47 | component: () => import('@/views/runtime-status'), 48 | hidden: true, 49 | name: 'Runtime status' 50 | }, 51 | { 52 | path: '/data-scaling', 53 | component: () => import('@/views/data-scaling'), 54 | hidden: true, 55 | name: 'Data scaling' 56 | } 57 | ] 58 | 59 | export default new Router({ 60 | scrollBehavior: () => ({ y: 0 }), 61 | routes: constantRouterMap 62 | }) 63 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/store/actions.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import * as types from './mutation-types' 19 | 20 | const makeAction = type => { 21 | return ({ commit }, ...args) => commit(type, ...args) 22 | } 23 | // global actions 24 | export const setRegCenterActivated = makeAction(types.REG_CENTER_ACTIVATED) 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/store/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import Vue from 'vue' 19 | import Vuex from 'vuex' 20 | 21 | import * as actions from './actions' 22 | import modules from './modules/index' 23 | 24 | Vue.use(Vuex) 25 | 26 | export default new Vuex.Store({ 27 | actions, 28 | modules, 29 | strict: false 30 | }) 31 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/store/modules/global.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import * as types from '../mutation-types' 19 | 20 | const state = { 21 | regCenterActivated: '' 22 | } 23 | 24 | const mutations = { 25 | [types.REG_CENTER_ACTIVATED](state, params) { 26 | state.regCenterActivated = params 27 | } 28 | } 29 | 30 | export default { 31 | state, 32 | mutations 33 | } 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/store/modules/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | const files = require.context('.', false, /\.js$/) 19 | const modules = {} 20 | 21 | files.keys().forEach((key) => { 22 | if (key === './index.js') return 23 | modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default 24 | }) 25 | 26 | export default modules 27 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // global mutation types 19 | export const REG_CENTER_ACTIVATED = 'REG_CENTER_ACTIVATED' 20 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/utils/conf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | const HOST = '' 19 | const OTHERHOST = '' 20 | 21 | export default { 22 | HOST, 23 | OTHERHOST 24 | } 25 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/data-scaling/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import API from '@/utils/api' 19 | import ruleConfigApi from '@/views/rule-config/api' 20 | 21 | const { getSchema, getSchemaDataSource, getSchemaRule, getSchemaMetadata } = ruleConfigApi 22 | 23 | export default { 24 | getJobServer: (params = {}) => API.get(`/api/shardingscaling`, params), 25 | postJobServer: (params = {}) => API.post(`/api/shardingscaling`, params), 26 | getJobStart: (params = {}) => 27 | API.post(`/api/shardingscaling/job/start`, params), 28 | getJobList: (params = {}) => 29 | API.get(`/api/shardingscaling/job/list`, params), 30 | getJobProgress: jobId => 31 | API.get(`/api/shardingscaling/job/progress/${jobId}`), 32 | getJobStop: jobId => 33 | API.get(`/api/shardingscaling/job/stop/${jobId}`), 34 | getSchema, 35 | getSchemaDataSource, 36 | getSchemaRule, 37 | getSchemaMetadata 38 | } 39 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/data-scaling/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/login/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import API from '@/utils/api' 19 | 20 | export default { 21 | getLogin: (params = {}) => API.post(`/api/login`, params) 22 | } 23 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/registry-center/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import API from '@/utils/api' 19 | 20 | export default { 21 | getRegCenter: (params = {}) => API.get(`/api/reg-center`, params), 22 | deleteRegCenter: (params = {}) => API.delete(`/api/reg-center`, params), 23 | postRegCenter: (params = {}) => API.post(`/api/reg-center`, params), 24 | getRegCenterActivated: (params = {}) => API.get(`/api/reg-center/activated`, params), 25 | postRegCenterConnect: (params = {}) => API.post(`/api/reg-center/connect`, params), 26 | updateRegCenter: (params = {}) => API.post(`/api/reg-center/update`, params) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/registry-center/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/rule-config/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import API from '@/utils/api' 19 | 20 | export default { 21 | // schema start 22 | getSchema: (params = {}) => API.get(`/api/schema`, params), 23 | addSchema: (params = {}) => API.post(`/api/schema`, params), 24 | deleteSchema: (schemaName) => API.delete(`/api/schema/${schemaName}`), 25 | getSchemaRule: (schemaName) => API.get(`/api/schema/rule/${schemaName}`), 26 | putSchemaRule: (schemaName, params = {}) => API.put(`/api/schema/rule/${schemaName}`, params), 27 | getSchemaDataSource: (schemaName) => API.get(`/api/schema/datasource/${schemaName}`), 28 | putSchemaDataSource: (schemaName, params = {}) => API.put(`/api/schema/datasource/${schemaName}`, params), 29 | getSchemaMetadata: (schemaName) => API.get(`/api/schema/metadata/${schemaName}`), 30 | // Authentication 31 | getAuth: () => API.get(`/api/authentication`), 32 | putAuth: (params = {}) => API.put(`/api/authentication`, params), 33 | // props 34 | getProps: () => API.get(`/api/props`), 35 | putProps: (params = {}) => API.put(`/api/props`, params) 36 | } 37 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/rule-config/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 28 | 60 | 65 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/rule-config/module/authentication.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 30 | 81 | 102 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/rule-config/module/props.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 30 | 82 | 103 | 104 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/runtime-status/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import API from '@/utils/api' 19 | 20 | export default { 21 | getOrcheData: (params = {}) => API.get(`/api/governance/datasource`, params), 22 | putOrcheData: (params = {}) => API.put(`/api/governance/datasource`, params), 23 | getOrcheInstance: (params = {}) => API.get(`/api/governance/instance`, params), 24 | putOrcheInstance: (params = {}) => API.put(`/api/governance/instance`, params) 25 | } 26 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/runtime-status/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 27 | 53 | 55 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/runtime-status/module/dataSource.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 45 | 46 | 101 | 102 | 111 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/src/views/runtime-status/module/instance.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 45 | 46 | 97 | 98 | 107 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/static/404.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | ShardingSphere-UI 25 | 26 | 27 | 28 |
404
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/shardingsphere-ui/bdc05f113359e13bc683b0bdf4b89a5edbe512e3/shardingsphere-ui-frontend/static/favicon.png -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/karma.conf.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | const webpackConfig = require('../build/webpack.unit.conf') 18 | process.env.CHROME_BIN = require('puppeteer').executablePath() 19 | 20 | module.exports = function(config) { 21 | config.set({ 22 | frameworks: ['mocha'], 23 | files: ['specs/**/*.spec.js'], 24 | preprocessors: { 25 | '**/*.spec.js': ['webpack', 'sourcemap'] 26 | }, 27 | webpack: webpackConfig, 28 | reporters: ['spec', 'coverage'], 29 | coverageReporter: { 30 | dir: './coverage', 31 | reporters: [{ type: 'lcov', subdir: '.' }, { type: 'text-summary' }] 32 | }, 33 | browsers: ['ChromeHeadless'] 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/components/Container.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount } from '@vue/test-utils' 19 | import Container from '../../../src/components/Container/index.vue' 20 | 21 | describe('Container/index.vue', () => { 22 | it('Container Does the component exist?', () => { 23 | const wrapper = shallowMount(Container) 24 | expect(wrapper.isVueInstance()).to.be.true 25 | }) 26 | 27 | it('setData()', () => { 28 | const wrapper = shallowMount(Container) 29 | wrapper.setData({ isCollapse: true }) 30 | expect(wrapper.vm.isCollapse).to.equal(true) 31 | }) 32 | 33 | it('onTogger()', () => { 34 | const wrapper = shallowMount(Container) 35 | const sHead = wrapper.find('.s-head') 36 | sHead.trigger('click') 37 | expect(wrapper.vm.isCollapse).to.equal(false) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/components/Footer.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount } from '@vue/test-utils' 19 | import Footer from '../../../src/components/Footer/index.vue' 20 | 21 | describe('Footer/index.vue', () => { 22 | it('Footer Does the component exist?', () => { 23 | const wrapper = shallowMount(Footer) 24 | expect(wrapper.find('div').text()).contains('Copyright') 25 | }) 26 | }) 27 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/components/Head.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount, createLocalVue, mount } from '@vue/test-utils' 19 | import VueI18n from 'vue-i18n' 20 | import Head from '../../../src/components/Head/index.vue' 21 | import Language from '../../../src/lang/index' 22 | import store from '../../../src/store' 23 | import Vuex from 'vuex' 24 | 25 | const localVue = createLocalVue() 26 | 27 | localVue.use(VueI18n) 28 | localVue.use(Vuex) 29 | 30 | // language setting init 31 | const navLang = navigator.language 32 | const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false 33 | const lang = window.localStorage.getItem('language') || localLang || 'zh-CN' 34 | localVue.config.lang = lang 35 | 36 | // language setting 37 | const locales = Language 38 | const mergeZH = locales['zh-CN'] 39 | const mergeEN = locales['en-US'] 40 | 41 | const i18n = new VueI18n({ 42 | locale: 'en-US', 43 | messages: { 44 | 'zh-CN': mergeZH, 45 | 'en-US': mergeEN 46 | } 47 | }) 48 | 49 | describe('Head/index.vue', () => { 50 | it('Head Does the component exist?', () => { 51 | const wrapper = shallowMount(Head, { 52 | localVue, 53 | i18n, 54 | store 55 | }) 56 | expect(wrapper.isVueInstance()).to.be.true 57 | }) 58 | 59 | it('setData()', () => { 60 | const wrapper = shallowMount(Head, { 61 | localVue, 62 | i18n, 63 | store 64 | }) 65 | wrapper.setData({ isCollapse: true }) 66 | expect(wrapper.vm.isCollapse).to.equal(true) 67 | }) 68 | 69 | it('togger()', () => { 70 | const wrapper = shallowMount(Head, { 71 | localVue, 72 | i18n, 73 | store 74 | }) 75 | const headIcon = wrapper.find('.icon-item') 76 | headIcon.trigger('click') 77 | expect(wrapper.vm.isCollapse).to.equal(true) 78 | }) 79 | }) 80 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/components/Logo.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount } from '@vue/test-utils' 19 | import Logo from '../../../src/components/Logo/index.vue' 20 | 21 | describe('Logo/index.vue', () => { 22 | it('Logo Does the component exist?', () => { 23 | const wrapper = shallowMount(Logo) 24 | expect(wrapper.isVueInstance()).to.be.true 25 | }) 26 | }) 27 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/components/Menu.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount, createLocalVue, mount } from '@vue/test-utils' 19 | import VueI18n from 'vue-i18n' 20 | import Vuex from 'vuex' 21 | import Menu from '../../../src/components/Menu/index.vue' 22 | import Language from '../../../src/lang/index' 23 | import store from '../../../src/store' 24 | import router from '../../../src/router' 25 | 26 | const localVue = createLocalVue() 27 | 28 | localVue.use(VueI18n) 29 | localVue.use(Vuex) 30 | 31 | // language setting init 32 | const navLang = navigator.language 33 | const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false 34 | const lang = window.localStorage.getItem('language') || localLang || 'zh-CN' 35 | localVue.config.lang = lang 36 | 37 | // language setting 38 | const locales = Language 39 | const mergeZH = locales['zh-CN'] 40 | const mergeEN = locales['en-US'] 41 | 42 | const i18n = new VueI18n({ 43 | locale: 'en-US', 44 | messages: { 45 | 'zh-CN': mergeZH, 46 | 'en-US': mergeEN 47 | } 48 | }) 49 | 50 | describe('Menu/index.vue', () => { 51 | it('Menu Does the component exist?', () => { 52 | const wrapper = shallowMount(Menu, { 53 | localVue, 54 | i18n, 55 | store, 56 | router, 57 | propsData: { 58 | isCollapse: false 59 | } 60 | }) 61 | expect(wrapper.isVueInstance()).to.be.true 62 | }) 63 | 64 | it('setData()', () => { 65 | const wrapper = shallowMount(Menu, { 66 | localVue, 67 | i18n, 68 | store, 69 | router 70 | }) 71 | wrapper.setProps({ isCollapse: true }) 72 | expect(wrapper.vm.isCollapse).to.equal(false) 73 | }) 74 | }) 75 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/views/login.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount, createLocalVue, mount } from '@vue/test-utils' 19 | import VueI18n from 'vue-i18n' 20 | import Vuex from 'vuex' 21 | import Login from '../../../src/views/login/index.vue' 22 | import Language from '../../../src/lang/index' 23 | import store from '../../../src/store' 24 | import router from '../../../src/router' 25 | 26 | const localVue = createLocalVue() 27 | 28 | localVue.use(VueI18n) 29 | localVue.use(Vuex) 30 | 31 | // language setting init 32 | const navLang = navigator.language 33 | const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false 34 | const lang = window.localStorage.getItem('language') || localLang || 'zh-CN' 35 | localVue.config.lang = lang 36 | 37 | // language setting 38 | const locales = Language 39 | const mergeZH = locales['zh-CN'] 40 | const mergeEN = locales['en-US'] 41 | 42 | const i18n = new VueI18n({ 43 | locale: 'en-US', 44 | messages: { 45 | 'zh-CN': mergeZH, 46 | 'en-US': mergeEN 47 | } 48 | }) 49 | 50 | describe('Login/index.vue', () => { 51 | it('Login Does the pages exist?', () => { 52 | const wrapper = shallowMount(Login, { 53 | localVue, 54 | i18n, 55 | store, 56 | router 57 | }) 58 | expect(wrapper.isVueInstance()).to.be.true 59 | }) 60 | }) 61 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/views/registry-center.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount, createLocalVue, mount } from '@vue/test-utils' 19 | import VueI18n from 'vue-i18n' 20 | import Vuex from 'vuex' 21 | import registryCenter from '../../../src/views/registry-center/module/registryCenter.vue' 22 | import Language from '../../../src/lang/index' 23 | import store from '../../../src/store' 24 | import router from '../../../src/router' 25 | 26 | const localVue = createLocalVue() 27 | 28 | localVue.use(VueI18n) 29 | localVue.use(Vuex) 30 | 31 | // language setting init 32 | const navLang = navigator.language 33 | const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false 34 | const lang = window.localStorage.getItem('language') || localLang || 'zh-CN' 35 | localVue.config.lang = lang 36 | 37 | // language setting 38 | const locales = Language 39 | const mergeZH = locales['zh-CN'] 40 | const mergeEN = locales['en-US'] 41 | 42 | const i18n = new VueI18n({ 43 | locale: 'en-US', 44 | messages: { 45 | 'zh-CN': mergeZH, 46 | 'en-US': mergeEN 47 | } 48 | }) 49 | 50 | describe('registry-center/registryCenter.vue', () => { 51 | it('registryCenter Does the pages exist?', () => { 52 | const wrapper = shallowMount(registryCenter, { 53 | localVue, 54 | i18n, 55 | store, 56 | router 57 | }) 58 | expect(wrapper.isVueInstance()).to.be.true 59 | }) 60 | 61 | it('add()', () => { 62 | const wrapper = shallowMount(registryCenter, { 63 | localVue, 64 | i18n, 65 | store, 66 | router 67 | }) 68 | const btnPlus = wrapper.find('.btn-plus') 69 | btnPlus.trigger('click') 70 | expect(wrapper.vm.regustDialogVisible).to.equal(true) 71 | }) 72 | }) 73 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/views/rule-config.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | import { expect } from 'chai' 19 | import { shallowMount, createLocalVue, mount } from '@vue/test-utils' 20 | import VueI18n from 'vue-i18n' 21 | import Vuex from 'vuex' 22 | import authentication from '../../../src/views/rule-config/module/authentication.vue' 23 | import schema from '../../../src/views/rule-config/module/schema.vue' 24 | import props from '../../../src/views/rule-config/module/props.vue' 25 | import Language from '../../../src/lang/index' 26 | import store from '../../../src/store' 27 | import router from '../../../src/router' 28 | 29 | const localVue = createLocalVue() 30 | 31 | localVue.use(VueI18n) 32 | localVue.use(Vuex) 33 | 34 | // language setting init 35 | const navLang = navigator.language 36 | const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false 37 | const lang = window.localStorage.getItem('language') || localLang || 'zh-CN' 38 | localVue.config.lang = lang 39 | 40 | // language setting 41 | const locales = Language 42 | const mergeZH = locales['zh-CN'] 43 | const mergeEN = locales['en-US'] 44 | 45 | const i18n = new VueI18n({ 46 | locale: 'en-US', 47 | messages: { 48 | 'zh-CN': mergeZH, 49 | 'en-US': mergeEN 50 | } 51 | }) 52 | 53 | describe('rule-config', () => { 54 | it('authentication Does the pages exist?', () => { 55 | const wrapper = shallowMount(authentication, { 56 | localVue, 57 | i18n, 58 | store, 59 | router 60 | }) 61 | expect(wrapper.isVueInstance()).to.be.true 62 | }) 63 | 64 | it('schema Does the pages exist?', () => { 65 | const wrapper = shallowMount(schema, { 66 | localVue, 67 | i18n, 68 | store, 69 | router 70 | }) 71 | expect(wrapper.isVueInstance()).to.be.true 72 | }) 73 | 74 | it('props Does the pages exist?', () => { 75 | const wrapper = shallowMount(props, { 76 | localVue, 77 | i18n, 78 | store, 79 | router 80 | }) 81 | expect(wrapper.isVueInstance()).to.be.true 82 | }) 83 | }) 84 | -------------------------------------------------------------------------------- /shardingsphere-ui-frontend/test/specs/views/runtime-status.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { expect } from 'chai' 18 | import { shallowMount, createLocalVue, mount } from '@vue/test-utils' 19 | import VueI18n from 'vue-i18n' 20 | import Vuex from 'vuex' 21 | import dataSource from '../../../src/views/runtime-status/module/dataSource.vue' 22 | import instance from '../../../src/views/runtime-status/module/instance.vue' 23 | import Language from '../../../src/lang/index' 24 | import store from '../../../src/store' 25 | import router from '../../../src/router' 26 | 27 | const localVue = createLocalVue() 28 | 29 | localVue.use(VueI18n) 30 | localVue.use(Vuex) 31 | 32 | // language setting init 33 | const navLang = navigator.language 34 | const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false 35 | const lang = window.localStorage.getItem('language') || localLang || 'zh-CN' 36 | localVue.config.lang = lang 37 | 38 | // language setting 39 | const locales = Language 40 | const mergeZH = locales['zh-CN'] 41 | const mergeEN = locales['en-US'] 42 | 43 | const i18n = new VueI18n({ 44 | locale: 'en-US', 45 | messages: { 46 | 'zh-CN': mergeZH, 47 | 'en-US': mergeEN 48 | } 49 | }) 50 | 51 | describe('runtime-status', () => { 52 | it('dataSource Does the pages exist?', () => { 53 | const wrapper = shallowMount(dataSource, { 54 | localVue, 55 | i18n, 56 | store, 57 | router 58 | }) 59 | expect(wrapper.isVueInstance()).to.be.true 60 | }) 61 | 62 | it('instance Does the pages exist?', () => { 63 | const wrapper = shallowMount(instance, { 64 | localVue, 65 | i18n, 66 | store, 67 | router 68 | }) 69 | expect(wrapper.isVueInstance()).to.be.true 70 | }) 71 | }) 72 | --------------------------------------------------------------------------------