Merge branch 'upstream-develop'
This commit is contained in:
commit
17990b01a2
15
console/src/main/resources/static/console-fe/.babelrc
Normal file
15
console/src/main/resources/static/console-fe/.babelrc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"react-app"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"transform-decorators-legacy",
|
||||||
|
[
|
||||||
|
"babel-plugin-import",
|
||||||
|
{
|
||||||
|
"libraryName": "@alifd/next",
|
||||||
|
"style": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
# production
|
# production
|
||||||
/dist
|
/dist
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"disableCSSModules": true,
|
|
||||||
"outputPath": "./build",
|
|
||||||
"proxy": {
|
|
||||||
"/": {
|
|
||||||
"target": "http://11.163.128.36:8848", //这边写你自己的服务Ip
|
|
||||||
"changeOrigin": true,
|
|
||||||
"pathRewrite": { "^/" : "" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extraBabelPlugins": [
|
|
||||||
"transform-decorators-legacy"
|
|
||||||
]
|
|
||||||
}
|
|
@ -47,18 +47,14 @@ npm run build
|
|||||||
##
|
##
|
||||||
|
|
||||||
# 代理配置
|
# 代理配置
|
||||||
根目录下的 .webpackrc
|
`build/webpack.dev.conf.js`
|
||||||
修改proxy属性
|
修改proxy属性
|
||||||
|
|
||||||
```
|
```
|
||||||
"proxy": {
|
proxy: [{
|
||||||
"/": {
|
context: ['/'],
|
||||||
"target": "http://ip:port/", //这边写你自己的服务Ip
|
changeOrigin: true,
|
||||||
"changeOrigin": true,
|
secure: false,
|
||||||
"pathRewrite": { "^/" : "" }
|
target: 'http://ip:port',
|
||||||
}
|
}],
|
||||||
},
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# dva api
|
|
||||||
[https://github.com/dvajs/dva/blob/master/docs/api/README.md](https://github.com/dvajs/dva/blob/master/docs/api/README.md)
|
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
#! /usr/bin/env node
|
|
||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const cp = require('child_process');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
// 默认打包存放地址
|
|
||||||
const buildDir = path.join(__dirname, 'build');
|
|
||||||
// 打包后文件存放地址
|
|
||||||
const targetDir = path.join(__dirname, '../');
|
|
||||||
|
|
||||||
const spawnAsync = (...args) =>
|
|
||||||
new Promise((resolve, reject) => {
|
|
||||||
const worker = cp.spawn(...args, { stdio: 'inherit' });
|
|
||||||
worker.on('close', resolve);
|
|
||||||
worker.on('error', reject);
|
|
||||||
});
|
|
||||||
|
|
||||||
const mkdir = dir => {
|
|
||||||
if (!fs.existsSync(dir)) {
|
|
||||||
fs.mkdirSync(dir);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const copyDir = (sourceDir, targetDir) => {
|
|
||||||
if (!fs.existsSync(sourceDir) || !fs.statSync(sourceDir).isDirectory()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdir(targetDir);
|
|
||||||
|
|
||||||
fs.readdirSync(sourceDir).forEach(_fileName => {
|
|
||||||
const sourceFileName = path.join(sourceDir, _fileName);
|
|
||||||
const targetFileName = path.join(targetDir, _fileName);
|
|
||||||
const fileStat = fs.statSync(sourceFileName);
|
|
||||||
if (fileStat.isDirectory()) {
|
|
||||||
copyDir(sourceFileName, targetFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileStat.isFile()) {
|
|
||||||
fs.writeFileSync(targetFileName, fs.readFileSync(sourceFileName));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
spawnAsync('roadhog', ['build']).then(() => copyDir(buildDir, targetDir));
|
|
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
'red': ['\x1B[31m', '\x1B[39m'],
|
||||||
|
'green': ['\x1B[32m', '\x1B[39m'],
|
||||||
|
'yellow': ['\x1B[33m', '\x1B[39m'],
|
||||||
|
};
|
||||||
|
|
||||||
|
const distPath = path.join(__dirname, '../dist/');
|
||||||
|
const rootPath = path.join(__dirname, '../../');
|
||||||
|
|
||||||
|
console.log('\n\n> Start copying the dist directory...\n');
|
||||||
|
|
||||||
|
function delDir(dest) {
|
||||||
|
let paths = fs.readdirSync(dest);
|
||||||
|
paths.forEach(function(p) {
|
||||||
|
const target = path.join(dest, p);
|
||||||
|
const st = fs.statSync(target);
|
||||||
|
if (st.isFile()) {
|
||||||
|
console.log(`\r${styles.red[0]}Delete File${styles.red[1]}: ${target}`);
|
||||||
|
fs.unlinkSync(target);
|
||||||
|
}
|
||||||
|
if (st.isDirectory()) {
|
||||||
|
console.log(`\r${styles.red[0]}Delete Directory${styles.red[1]}: ${target}`);
|
||||||
|
delDir(target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
paths = fs.readdirSync(dest);
|
||||||
|
if (!paths.length) {
|
||||||
|
fs.rmdirSync(dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyDir(source, dest) {
|
||||||
|
const paths = fs.readdirSync(source);
|
||||||
|
paths.forEach(function(p) {
|
||||||
|
const src = path.join(source, p);
|
||||||
|
const target = path.join(dest, p);
|
||||||
|
const st = fs.statSync(src);
|
||||||
|
if (st.isFile()) {
|
||||||
|
if (fs.existsSync(target)) {
|
||||||
|
console.log(`\r${styles.red[0]}Delete File${styles.red[1]}: ${target}`);
|
||||||
|
fs.unlinkSync(target);
|
||||||
|
}
|
||||||
|
console.log(`\r${styles.yellow[0]}Copy File${styles.yellow[1]}: ${target}`);
|
||||||
|
const readStream = fs.createReadStream(src);
|
||||||
|
const writeStream = fs.createWriteStream(target);
|
||||||
|
readStream.pipe(writeStream);
|
||||||
|
}
|
||||||
|
if (st.isDirectory()) {
|
||||||
|
if (fs.existsSync(target)) {
|
||||||
|
console.log(`\r${styles.red[0]}Delete Directory${styles.red[1]}: ${target}`);
|
||||||
|
delDir(target);
|
||||||
|
}
|
||||||
|
console.log(`\r${styles.yellow[0]}Create Directory${styles.yellow[1]}: ${target}`);
|
||||||
|
fs.mkdirSync(target);
|
||||||
|
copyDir(src, target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
copyDir(distPath, rootPath);
|
||||||
|
|
||||||
|
console.log(`\n>${styles.green[0]} Copy complete!${styles.green[0]}\n`);
|
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
|
const isDev = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
function resolve(dir) {
|
||||||
|
return path.join(__dirname, '..', dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: {
|
||||||
|
main: './src/index.js',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: './js/[name].[chunkhash:8].js',
|
||||||
|
path: path.resolve(__dirname, '../dist'),
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx', '.json'],
|
||||||
|
alias: {
|
||||||
|
'@': resolve('src'),
|
||||||
|
utils: resolve('src/utils'),
|
||||||
|
components: resolve('src/components'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(css|scss)$/,
|
||||||
|
use: [isDev ? 'style-loader' : MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(js|jsx)$/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
enforce: 'pre',
|
||||||
|
include: [resolve('src')],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(js|jsx)$/,
|
||||||
|
include: [resolve('src')],
|
||||||
|
use: ['babel-loader'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: '/img/[name].[hash:8].[ext]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(ttf|woff|svg)$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
name: '/fonts/[name].[hash:8].[ext]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: 'index.html',
|
||||||
|
template: './public/index.html',
|
||||||
|
minify: !isDev,
|
||||||
|
}),
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{
|
||||||
|
from: resolve('public'),
|
||||||
|
to: './',
|
||||||
|
ignore: ['index.html'],
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
};
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const base = require('./webpack.base.conf');
|
||||||
|
|
||||||
|
module.exports = Object.assign({}, base, {
|
||||||
|
output: {
|
||||||
|
filename: './js/[name].js',
|
||||||
|
path: path.resolve(__dirname, '../dist'),
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
port: 8000,
|
||||||
|
proxy: [{
|
||||||
|
context: ['/'],
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
target: 'http://11.163.128.36:8848',
|
||||||
|
}],
|
||||||
|
disableHostCheck: true,
|
||||||
|
open: true,
|
||||||
|
hot: true,
|
||||||
|
overlay: true
|
||||||
|
},
|
||||||
|
mode: 'development',
|
||||||
|
devtool: 'eval-source-map',
|
||||||
|
plugins: [
|
||||||
|
...base.plugins,
|
||||||
|
new webpack.HotModuleReplacementPlugin()
|
||||||
|
]
|
||||||
|
});
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const base = require('./webpack.base.conf');
|
||||||
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||||
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||||
|
|
||||||
|
module.exports = Object.assign({}, base, {
|
||||||
|
optimization: {
|
||||||
|
minimizer: [
|
||||||
|
new UglifyJsPlugin({
|
||||||
|
cache: true,
|
||||||
|
parallel: true,
|
||||||
|
sourceMap: true,
|
||||||
|
}),
|
||||||
|
new OptimizeCSSAssetsPlugin({}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new CleanWebpackPlugin(path.resolve(__dirname, '../dist'), {
|
||||||
|
root: path.resolve(__dirname, '../'),
|
||||||
|
}),
|
||||||
|
...base.plugins,
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: './css/[name].[hash:8].css',
|
||||||
|
chunkFilename: '[id].css',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
mode: 'production',
|
||||||
|
});
|
@ -1,4 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
"name": "console-fe",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "console fe",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js",
|
||||||
|
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.conf.js && node build/copy-dist.js",
|
||||||
|
"eslint": "eslint --ext .js src/",
|
||||||
|
"eslint-fix": "eslint --ext .js --fix src/"
|
||||||
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
@ -11,39 +21,62 @@
|
|||||||
"git add"
|
"git add"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"license": "Apache-2.0",
|
||||||
"start": "roadhog dev",
|
"repository": {
|
||||||
"build": "node build.js",
|
"type": "git",
|
||||||
"dist": "roadhog build",
|
"url": "git+https://github.com/alibaba/nacos.git"
|
||||||
"eslint": "eslint --ext .js src/",
|
|
||||||
"eslint-fix": "eslint --ext .js --fix src/"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@alifd/next": "^1.7.6",
|
|
||||||
"dva": "^2.3.1",
|
|
||||||
"jquery": "^3.3.1",
|
|
||||||
"moment": "^2.22.2",
|
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"react": "^16.2.0",
|
|
||||||
"react-dom": "^16.2.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-cli": "^6.26.0",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-plugin-dva-hmr": "^0.3.2",
|
"babel-loader": "^7.1.5",
|
||||||
|
"babel-plugin-import": "^1.10.0",
|
||||||
|
"babel-plugin-transform-decorators": "^6.24.1",
|
||||||
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
||||||
"babel-preset-es2015": "^6.24.1",
|
"babel-preset-env": "^1.7.0",
|
||||||
"babel-preset-react": "^6.24.1",
|
"babel-preset-react-app": "^3.1.1",
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
"babel-runtime": "^6.23.0",
|
||||||
|
"clean-webpack-plugin": "^0.1.19",
|
||||||
|
"copy-webpack-plugin": "^4.6.0",
|
||||||
|
"cross-env": "^5.2.0",
|
||||||
|
"css-loader": "^1.0.0",
|
||||||
"eslint": "^5.9.0",
|
"eslint": "^5.9.0",
|
||||||
"eslint-config-ali": "^4.0.0",
|
"eslint-config-ali": "^4.0.0",
|
||||||
"eslint-config-prettier": "^3.3.0",
|
"eslint-config-prettier": "^3.3.0",
|
||||||
|
"eslint-loader": "^2.1.1",
|
||||||
"eslint-plugin-import": "^2.14.0",
|
"eslint-plugin-import": "^2.14.0",
|
||||||
"eslint-plugin-prettier": "^3.0.0",
|
"eslint-plugin-prettier": "^3.0.0",
|
||||||
"eslint-plugin-react": "^7.11.1",
|
"eslint-plugin-react": "^7.11.1",
|
||||||
|
"file-loader": "^2.0.0",
|
||||||
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"husky": "^1.1.4",
|
"husky": "^1.1.4",
|
||||||
"lint-staged": "^8.0.4",
|
"lint-staged": "^8.0.4",
|
||||||
|
"mini-css-extract-plugin": "^0.4.3",
|
||||||
|
"node-sass": "^4.1.0",
|
||||||
|
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||||
"prettier": "1.15.2",
|
"prettier": "1.15.2",
|
||||||
"roadhog": "^2.0.0"
|
"sass-loader": "^7.1.0",
|
||||||
|
"style-loader": "^0.23.0",
|
||||||
|
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||||
|
"url-loader": "^1.1.1",
|
||||||
|
"webpack": "^4.20.2",
|
||||||
|
"webpack-cli": "^3.1.2",
|
||||||
|
"webpack-dev-server": "^3.1.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@alifd/next": "^1.9.19",
|
||||||
|
"axios": "^0.18.0",
|
||||||
|
"jquery": "^3.3.1",
|
||||||
|
"moment": "^2.22.2",
|
||||||
|
"prop-types": "^15.6.2",
|
||||||
|
"react": "^16.6.0",
|
||||||
|
"react-dom": "^16.6.0",
|
||||||
|
"react-redux": "^5.1.0",
|
||||||
|
"react-router": "^4.3.1",
|
||||||
|
"react-router-dom": "^4.3.1",
|
||||||
|
"react-router-redux": "^4.0.8",
|
||||||
|
"redux": "^4.0.1",
|
||||||
|
"redux-thunk": "^2.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="css/icon.css">
|
<link rel="stylesheet" type="text/css" href="css/icon.css">
|
||||||
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
|
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
|
||||||
<!-- 第三方css结束 -->
|
<!-- 第三方css结束 -->
|
||||||
<link rel="stylesheet" type="text/css" href="index.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -49,9 +48,7 @@
|
|||||||
<script src="js/diff_match_patch.js"></script>
|
<script src="js/diff_match_patch.js"></script>
|
||||||
<script src="js/merge.js"></script>
|
<script src="js/merge.js"></script>
|
||||||
<script src="js/loader.js"></script>
|
<script src="js/loader.js"></script>
|
||||||
|
|
||||||
<!-- 第三方js结束 -->
|
<!-- 第三方js结束 -->
|
||||||
<script src="index.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -15,7 +15,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Dialog, Pagination, Transfer } from '@alifd/next';
|
import { Dialog, Pagination, Transfer } from '@alifd/next';
|
||||||
import { request, aliwareIntl } from '../../globalLib';
|
import { request, aliwareIntl } from '../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
|
|
||||||
class BatchHandle extends React.Component {
|
class BatchHandle extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { getParams, request, aliwareIntl } from '../../globalLib';
|
import { getParams, request, aliwareIntl } from '../../globalLib';
|
||||||
import { Button, Dialog, Field, Form, Select } from '@alifd/next';
|
import { Button, Dialog, Field, Form, Select } from '@alifd/next';
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { aliwareIntl } from '../../globalLib';
|
import { aliwareIntl } from '../../globalLib';
|
||||||
import { Button, Dialog, Grid, Icon } from '@alifd/next';
|
import { Button, Dialog, Grid, Icon } from '@alifd/next';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { aliwareIntl } from '../../globalLib';
|
import { aliwareIntl } from '../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { Button, Dialog, Grid } from '@alifd/next';
|
import { Button, Dialog, Grid } from '@alifd/next';
|
||||||
|
|
||||||
const { Row, Col } = Grid;
|
const { Row, Col } = Grid;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { request, aliwareIntl } from '../../globalLib';
|
import { request, aliwareIntl } from '../../globalLib';
|
||||||
import { Button, Dialog, Field, Form, Input, Loading } from '@alifd/next';
|
import { Button, Dialog, Field, Form, Input, Loading } from '@alifd/next';
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class EditorNameSpace extends React.Component {
|
|||||||
this.field.setValues(record);
|
this.field.setValues(record);
|
||||||
request({
|
request({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: `/nacos/v1/console/namespaces?show=all&namespaceId=${record.namespace}`,
|
url: `v1/console/namespaces?show=all&namespaceId=${record.namespace}`,
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res !== null) {
|
if (res !== null) {
|
||||||
this.field.setValue('namespaceDesc', res.namespaceDesc);
|
this.field.setValue('namespaceDesc', res.namespaceDesc);
|
||||||
@ -89,7 +89,7 @@ class EditorNameSpace extends React.Component {
|
|||||||
beforeSend: () => {
|
beforeSend: () => {
|
||||||
this.openLoading();
|
this.openLoading();
|
||||||
},
|
},
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
contentType: 'application/x-www-form-urlencoded',
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
data: {
|
data: {
|
||||||
namespace: values.namespace,
|
namespace: values.namespace,
|
||||||
@ -120,7 +120,7 @@ class EditorNameSpace extends React.Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
request({
|
request({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.namespaceList = res.data;
|
window.namespaceList = res.data;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { aliwareIntl } from '../../globalLib';
|
import { aliwareIntl } from '../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { Button, Dialog, Form } from '@alifd/next';
|
import { Button, Dialog, Form } from '@alifd/next';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { aliwareIntl } from '../../globalLib';
|
import { aliwareIntl } from '@/globalLib';
|
||||||
import './index.less';
|
import { isParentEdas } from '@/lib';
|
||||||
|
import './index.scss';
|
||||||
import { Balloon, Button, Dialog, Form, Icon, Select, Upload } from '@alifd/next';
|
import { Balloon, Button, Dialog, Form, Icon, Select, Upload } from '@alifd/next';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
@ -50,8 +51,6 @@ class ImportDialog extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {}
|
|
||||||
|
|
||||||
openDialog(payload, callback) {
|
openDialog(payload, callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -96,7 +95,7 @@ class ImportDialog extends React.Component {
|
|||||||
this.state.tenant.id
|
this.state.tenant.id
|
||||||
}?policy=${this.state.policy}`;
|
}?policy=${this.state.policy}`;
|
||||||
|
|
||||||
if (window.globalConfig.isParentEdas()) {
|
if (isParentEdas()) {
|
||||||
uploadLink = `/authgw/${window.edasprefix}${uploadLink}`;
|
uploadLink = `/authgw/${window.edasprefix}${uploadLink}`;
|
||||||
}
|
}
|
||||||
const helpTip = (
|
const helpTip = (
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { Dialog } from '@alifd/next';
|
import { Dialog } from '@alifd/next';
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../globalLib';
|
import { getParams, setParams, request, aliwareIntl } from '../../globalLib';
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class NameSpaceList extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
request({
|
request({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.handleNameSpaces(res.data);
|
this.handleNameSpaces(res.data);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { request, aliwareIntl } from '../../globalLib';
|
import { request, aliwareIntl } from '../../globalLib';
|
||||||
import { Button, Dialog, Field, Form, Input, Loading } from '@alifd/next';
|
import { Button, Dialog, Field, Form, Input, Loading } from '@alifd/next';
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class NewNameSpace extends React.Component {
|
|||||||
});
|
});
|
||||||
request({
|
request({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
contentType: 'application/x-www-form-urlencoded',
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
beforeSend: () => {
|
beforeSend: () => {
|
||||||
this.openLoading();
|
this.openLoading();
|
||||||
@ -140,7 +140,7 @@ class NewNameSpace extends React.Component {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
request({
|
request({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.namespaceList = res.data;
|
window.namespaceList = res.data;
|
||||||
|
@ -17,7 +17,7 @@ import { Button } from '@alifd/next';
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import NameSpaceList from '../NameSpaceList';
|
import NameSpaceList from '../NameSpaceList';
|
||||||
import { setParams, request } from '../../globalLib';
|
import { setParams, request } from '../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
|
|
||||||
class RegionGroup extends React.Component {
|
class RegionGroup extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { getParams, aliwareIntl } from '../../globalLib';
|
import { getParams, aliwareIntl } from '../../globalLib';
|
||||||
import { Dialog, Loading, Tab } from '@alifd/next';
|
import { Dialog, Loading, Tab } from '@alifd/next';
|
||||||
|
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { aliwareIntl } from '../../globalLib';
|
import { aliwareIntl } from '../../globalLib';
|
||||||
import './index.less';
|
|
||||||
import { Button, Dialog, Grid, Icon } from '@alifd/next';
|
import { Button, Dialog, Grid, Icon } from '@alifd/next';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
const { Row, Col } = Grid;
|
const { Row, Col } = Grid;
|
||||||
|
|
||||||
class SuccessDialog extends React.Component {
|
class SuccessDialog extends React.Component {
|
||||||
|
@ -11,31 +11,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.normal {
|
export const LANGUAGE_KEY = 'site_language';
|
||||||
font-family: Georgia, sans-serif;
|
export const LANGUAGE_SWITCH = 'LANGUAGE_SWITCH';
|
||||||
margin-top: 3em;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
// TODO: 后端暂时没有统一成功失败标记
|
||||||
font-size: 2.5rem;
|
// export const SUCCESS_RESULT_CODE = 'SUCCESS';
|
||||||
font-weight: normal;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome {
|
|
||||||
height: 328px;
|
|
||||||
background: url(../assets/yay.jpg) no-repeat center 0;
|
|
||||||
background-size: 388px 328px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list {
|
|
||||||
font-size: 1.2em;
|
|
||||||
margin-top: 1.8em;
|
|
||||||
list-style: none;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list code {
|
|
||||||
background: #f7f7f7;
|
|
||||||
}
|
|
@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 入口页
|
|
||||||
*/
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { connect } from 'dva';
|
|
||||||
import MainLayout from '../layouts/MainLayout';
|
|
||||||
import { Message, Loading } from '@alifd/next';
|
|
||||||
import _menu from '../menu';
|
|
||||||
import { nacosEvent } from '../globalLib';
|
|
||||||
|
|
||||||
class App extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
shownotice: 'none',
|
|
||||||
noticecontent: '',
|
|
||||||
nacosLoading: {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
// 监听loading事件
|
|
||||||
nacosEvent.listenAllTask('nacosLoadingEvent', nacosLoading => {
|
|
||||||
this.setState({
|
|
||||||
nacosLoading,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
UNSAFE_componentWillUpdate(nextProps, nextState) {
|
|
||||||
const { errcode, errinfo } = nextProps;
|
|
||||||
if (errcode === 1) {
|
|
||||||
this.openErr(errinfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
nacosEvent.remove('nacosLoadingEvent');
|
|
||||||
}
|
|
||||||
|
|
||||||
openErr(message) {
|
|
||||||
const self = this;
|
|
||||||
setTimeout(() => {
|
|
||||||
self.props.dispatch({ type: 'error/clear' });
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
getChildContext() {
|
|
||||||
return { history: this.props.history };
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { errcode, errinfo } = this.props;
|
|
||||||
return (
|
|
||||||
<Loading
|
|
||||||
className="nacos-loading"
|
|
||||||
shape="flower"
|
|
||||||
tip="loading..."
|
|
||||||
visible={false}
|
|
||||||
fullScreen
|
|
||||||
{...this.state.nacosLoading}
|
|
||||||
>
|
|
||||||
<MainLayout {...this.props} navList={_menu.data}>
|
|
||||||
{errcode === 1 ? (
|
|
||||||
<Message
|
|
||||||
title={errinfo}
|
|
||||||
closable
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
zIndex: 99999,
|
|
||||||
width: 800,
|
|
||||||
left: '50%',
|
|
||||||
marginLeft: -400,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
{this.props.children}
|
|
||||||
</MainLayout>
|
|
||||||
</Loading>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
App.propTypes = {};
|
|
||||||
App.childContextTypes = {
|
|
||||||
history: PropTypes.object,
|
|
||||||
};
|
|
||||||
function mapStateToProps(state) {
|
|
||||||
const { errinfo, errcode } = state.error;
|
|
||||||
return {
|
|
||||||
errinfo,
|
|
||||||
errcode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export default connect(mapStateToProps)(App);
|
|
@ -12,7 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import projectConfig from './config';
|
import projectConfig from './config';
|
||||||
import serviceConfig from './serviceMock';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import i18DocObj from './i18ndoc';
|
import i18DocObj from './i18ndoc';
|
||||||
@ -455,8 +454,8 @@ const request = (function(_global) {
|
|||||||
const middlewareList = [];
|
const middlewareList = [];
|
||||||
const middlewareBackList = [];
|
const middlewareBackList = [];
|
||||||
const serviceMap = {};
|
const serviceMap = {};
|
||||||
const serviceList = serviceConfig.serviceList || [];
|
const serviceList = [];
|
||||||
const methodList = serviceConfig.method || [];
|
const methodList = [];
|
||||||
/**
|
/**
|
||||||
* 获取真实url信息
|
* 获取真实url信息
|
||||||
*/
|
*/
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
html,
|
|
||||||
body,
|
|
||||||
:global(#root) {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
:global(.mainwrapper) {
|
|
||||||
position: absolute !important;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
:global(.sideleft) {
|
|
||||||
float: left;
|
|
||||||
background-color: #eaedf1;
|
|
||||||
position: absolute;
|
|
||||||
top: 0px;
|
|
||||||
bottom: 0px;
|
|
||||||
z-index: 2;
|
|
||||||
overflow: hidden;
|
|
||||||
width: 180px;
|
|
||||||
}
|
|
||||||
:global(.sideleft .toptitle) {
|
|
||||||
width: 100%;
|
|
||||||
height: 70px;
|
|
||||||
line-height: 70px;
|
|
||||||
background: #d9dee4;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-weight: bold;
|
|
||||||
text-indent: 20px;
|
|
||||||
}
|
|
||||||
:global(.maincontainer) {
|
|
||||||
position: absolute;
|
|
||||||
width: auto;
|
|
||||||
top: 0px;
|
|
||||||
bottom: 0px;
|
|
||||||
left: 180px;
|
|
||||||
right: 0px;
|
|
||||||
overflow: hidden;
|
|
||||||
overflow-y: auto;
|
|
||||||
-o-transition: all 0.2s ease;
|
|
||||||
-ms-transition: all 0.2s ease;
|
|
||||||
-moz-transition: all 0.2s ease;
|
|
||||||
-webkit-transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
:global(.viewFramework-product-navbar .product-nav-list li .active) {
|
|
||||||
background-color: #fff !important;
|
|
||||||
}
|
|
@ -11,23 +11,124 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import dva from 'dva';
|
/**
|
||||||
import '@alifd/next/dist/next.css';
|
* 入口页
|
||||||
import './index.css';
|
*/
|
||||||
import './index.less';
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import { createStore, combineReducers, compose, applyMiddleware } from 'redux';
|
||||||
|
import { routerReducer } from 'react-router-redux';
|
||||||
|
import thunk from 'redux-thunk';
|
||||||
|
import { Provider, connect } from 'react-redux';
|
||||||
|
import { HashRouter, Route, Switch, Redirect } from 'react-router-dom';
|
||||||
|
import { ConfigProvider, Loading } from '@alifd/next';
|
||||||
|
|
||||||
// 1. Initialize
|
import _menu from './menu';
|
||||||
const app = dva();
|
|
||||||
|
|
||||||
// 2. Plugins
|
import Layout from './layouts/MainLayout';
|
||||||
// app.use({});
|
import CookieHelp from './utils/cookie';
|
||||||
|
import { LANGUAGE_KEY } from './constants';
|
||||||
|
|
||||||
// 3. Model
|
import Namespace from './pages/NameSpace';
|
||||||
// app.model(require('./models/example').default);
|
import Newconfig from './pages/ConfigurationManagement/NewConfig';
|
||||||
app.model(require('./models/error').default);
|
import Configsync from './pages/ConfigurationManagement/ConfigSync';
|
||||||
app.model(require('./models/loading').default);
|
import Configdetail from './pages/ConfigurationManagement/ConfigDetail';
|
||||||
// 4. Router
|
import Configeditor from './pages/ConfigurationManagement/ConfigEditor';
|
||||||
app.router(require('./router').default);
|
import HistoryDetail from './pages/ConfigurationManagement/HistoryDetail';
|
||||||
|
import ConfigRollback from './pages/ConfigurationManagement/ConfigRollback';
|
||||||
|
import HistoryRollback from './pages/ConfigurationManagement/HistoryRollback';
|
||||||
|
import ListeningToQuery from './pages/ConfigurationManagement/ListeningToQuery';
|
||||||
|
import ConfigurationManagement from './pages/ConfigurationManagement/ConfigurationManagement';
|
||||||
|
import ServiceList from './pages/ServiceManagement/ServiceList';
|
||||||
|
import ServiceDetail from './pages/ServiceManagement/ServiceDetail';
|
||||||
|
|
||||||
// 5. Start
|
import * as reducers from './reducers';
|
||||||
app.start('#root');
|
import { changeLanguage } from './reducers/locale';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
module.hot && module.hot.accept();
|
||||||
|
|
||||||
|
if (!CookieHelp.getValue(LANGUAGE_KEY)) {
|
||||||
|
CookieHelp.setValue(LANGUAGE_KEY, navigator.language === 'zh-CN' ? 'zh-CN' : 'en-US');
|
||||||
|
}
|
||||||
|
|
||||||
|
const reducer = combineReducers({
|
||||||
|
...reducers,
|
||||||
|
routing: routerReducer,
|
||||||
|
});
|
||||||
|
|
||||||
|
const store = createStore(
|
||||||
|
reducer,
|
||||||
|
compose(
|
||||||
|
applyMiddleware(thunk),
|
||||||
|
window.devToolsExtension ? window.devToolsExtension() : f => f
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
@connect(
|
||||||
|
state => ({ ...state.locale }),
|
||||||
|
{ changeLanguage }
|
||||||
|
)
|
||||||
|
class App extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
shownotice: 'none',
|
||||||
|
noticecontent: '',
|
||||||
|
nacosLoading: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const language = CookieHelp.getValue(LANGUAGE_KEY);
|
||||||
|
this.props.changeLanguage(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
generateRouter() {
|
||||||
|
return (
|
||||||
|
<HashRouter>
|
||||||
|
<Layout navList={_menu.data}>
|
||||||
|
<Switch>
|
||||||
|
<Route path="/" exact render={() => <Redirect to="/configurationManagement" />} />
|
||||||
|
<Route path="/namespace" component={Namespace} />
|
||||||
|
<Route path="/newconfig" component={Newconfig} />
|
||||||
|
<Route path="/configsync" component={Configsync} />
|
||||||
|
<Route path="/configdetail" component={Configdetail} />
|
||||||
|
<Route path="/configeditor" component={Configeditor} />
|
||||||
|
<Route path="/historyDetail" component={HistoryDetail} />
|
||||||
|
<Route path="/configRollback" component={ConfigRollback} />
|
||||||
|
<Route path="/historyRollback" component={HistoryRollback} />
|
||||||
|
<Route path="/listeningToQuery" component={ListeningToQuery} />
|
||||||
|
<Route path="/configurationManagement" component={ConfigurationManagement} />
|
||||||
|
<Route path="/serviceManagement" component={ServiceList} />
|
||||||
|
<Route path="/serviceDetail" component={ServiceDetail} />
|
||||||
|
</Switch>
|
||||||
|
</Layout>
|
||||||
|
</HashRouter>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { locale } = this.props;
|
||||||
|
return (
|
||||||
|
<Loading
|
||||||
|
className="nacos-loading"
|
||||||
|
shape="flower"
|
||||||
|
tip="loading..."
|
||||||
|
visible={false}
|
||||||
|
fullScreen
|
||||||
|
{...this.state.nacosLoading}
|
||||||
|
>
|
||||||
|
<ConfigProvider locale={locale}>{this.generateRouter()}</ConfigProvider>
|
||||||
|
</Loading>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<App />
|
||||||
|
</Provider>,
|
||||||
|
document.getElementById('root')
|
||||||
|
);
|
||||||
|
@ -11,6 +11,57 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
html,
|
||||||
|
body,
|
||||||
|
:global(#root) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
:global(.mainwrapper) {
|
||||||
|
position: absolute !important;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
:global(.sideleft) {
|
||||||
|
float: left;
|
||||||
|
background-color: #eaedf1;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
z-index: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
:global(.sideleft .toptitle) {
|
||||||
|
width: 100%;
|
||||||
|
height: 70px;
|
||||||
|
line-height: 70px;
|
||||||
|
background: #d9dee4;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-weight: bold;
|
||||||
|
text-indent: 20px;
|
||||||
|
}
|
||||||
|
:global(.maincontainer) {
|
||||||
|
position: absolute;
|
||||||
|
width: auto;
|
||||||
|
top: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 180px;
|
||||||
|
right: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
-o-transition: all 0.2s ease;
|
||||||
|
-ms-transition: all 0.2s ease;
|
||||||
|
-moz-transition: all 0.2s ease;
|
||||||
|
-webkit-transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
:global(.viewFramework-product-navbar .product-nav-list li .active) {
|
||||||
|
background-color: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
.clearfix:after {
|
.clearfix:after {
|
||||||
content: '.';
|
content: '.';
|
||||||
clear: both;
|
clear: both;
|
@ -16,7 +16,7 @@ import PropTypes from 'prop-types';
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import siteConfig from '../config';
|
import siteConfig from '../config';
|
||||||
import { getLink } from '../utils/nacosutil';
|
import { getLink } from '../utils/nacosutil';
|
||||||
import './index.css';
|
import './index.scss';
|
||||||
|
|
||||||
const languageSwitch = [
|
const languageSwitch = [
|
||||||
{
|
{
|
||||||
@ -62,15 +62,8 @@ class Header extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switchLang() {
|
switchLang() {
|
||||||
let language;
|
const language = this.state.language === 'zh-cn' ? 'en-us' : 'zh-cn';
|
||||||
if (this.state.language === 'zh-cn') {
|
this.setState({ language });
|
||||||
language = 'en-us';
|
|
||||||
} else {
|
|
||||||
language = 'zh-cn';
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
language,
|
|
||||||
});
|
|
||||||
this.props.onLanguageChange(language);
|
this.props.onLanguageChange(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { withRouter } from 'react-router-dom';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Icon } from '@alifd/next';
|
import { Icon } from '@alifd/next';
|
||||||
import siteConfig from '../config';
|
import siteConfig from '../config';
|
||||||
@ -19,7 +20,8 @@ import Header from './Header';
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { aliwareGetCookieByKeyName, setParams, aliwareIntl } from '../globalLib';
|
import { aliwareGetCookieByKeyName, setParams, aliwareIntl } from '../globalLib';
|
||||||
|
|
||||||
export default class MainLayout extends React.Component {
|
@withRouter
|
||||||
|
class MainLayout extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
navList: PropTypes.array,
|
navList: PropTypes.array,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
@ -464,3 +466,5 @@ export default class MainLayout extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default MainLayout;
|
||||||
|
@ -16,15 +16,11 @@ let hasAlert = false;
|
|||||||
|
|
||||||
window.edasprefix = 'acm'; // 固定的edas网关需要的项目名
|
window.edasprefix = 'acm'; // 固定的edas网关需要的项目名
|
||||||
|
|
||||||
|
export const isParentEdas = () =>
|
||||||
|
window.parent && window.parent.location.host.indexOf('edas') !== -1;
|
||||||
|
|
||||||
window.globalConfig = {
|
window.globalConfig = {
|
||||||
isParentEdas() {
|
isParentEdas,
|
||||||
try {
|
|
||||||
if (window.parent.location.host.indexOf('edas') !== -1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (error) {}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
request.middleWare((_config = {}) => {
|
request.middleWare((_config = {}) => {
|
||||||
@ -197,9 +193,7 @@ window.addEventListener('resize', () => {
|
|||||||
// 判断是否是国际站国际用户
|
// 判断是否是国际站国际用户
|
||||||
window.isIntel = function() {
|
window.isIntel = function() {
|
||||||
const { host } = window.location;
|
const { host } = window.location;
|
||||||
if (host.indexOf('alibabacloud.com') !== -1) {
|
return host.indexOf('alibabacloud.com') !== -1;
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default {};
|
||||||
|
@ -11,27 +11,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {
|
const I18N_CONF = {
|
||||||
namespace: 'example',
|
Header: {
|
||||||
|
home: 'HOME',
|
||||||
state: {},
|
docs: 'DOCS',
|
||||||
|
blog: 'BLOG',
|
||||||
subscriptions: {
|
community: 'COMMUNITY',
|
||||||
setup({ dispatch, history }) {
|
languageSwitchButton: '中',
|
||||||
// eslint-disable-line
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
effects: {
|
|
||||||
*fetch({ payload }, { call, put }) {
|
|
||||||
// eslint-disable-line
|
|
||||||
yield put({ type: 'save' });
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
reducers: {
|
|
||||||
save(state, action) {
|
|
||||||
return { ...state, ...action.payload };
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
export default I18N_CONF;
|
@ -11,8 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import request from '../utils/request';
|
import enUS from './en-US';
|
||||||
|
import zhCN from './zh-CN';
|
||||||
|
|
||||||
export function query() {
|
export default { enUS, zhCN };
|
||||||
return request('/api/users');
|
|
||||||
}
|
|
@ -11,34 +11,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {
|
const I18N_CONF = {
|
||||||
namespace: 'error',
|
Header: {
|
||||||
|
home: '首页',
|
||||||
state: {
|
docs: '文档',
|
||||||
errinfo: '未知错误',
|
blog: '博客',
|
||||||
errcode: 0,
|
community: '社区',
|
||||||
erralert: false,
|
languageSwitchButton: 'En',
|
||||||
},
|
|
||||||
|
|
||||||
subscriptions: {
|
|
||||||
setup({ dispatch, history }) {
|
|
||||||
// eslint-disable-line
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
effects: {
|
|
||||||
*fetch({ payload }, { call, put }) {
|
|
||||||
// eslint-disable-line
|
|
||||||
yield put({ type: 'save' });
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
reducers: {
|
|
||||||
save(state, action) {
|
|
||||||
return { ...state, ...action.payload, errcode: 1 };
|
|
||||||
},
|
|
||||||
clear(state, action) {
|
|
||||||
return { ...state, errinfo: '', errcode: 0 };
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
export default I18N_CONF;
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespace: 'loading',
|
|
||||||
|
|
||||||
state: {
|
|
||||||
loading: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
subscriptions: {
|
|
||||||
setup({ dispatch, history }) {
|
|
||||||
// eslint-disable-line
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
effects: {
|
|
||||||
*open({ payload }, { call, put }) {
|
|
||||||
try {
|
|
||||||
yield put({ type: 'save', payload: { loading: true } });
|
|
||||||
} catch (e) {
|
|
||||||
yield put({ type: 'error/save', payload: { errinfo: e.message } });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
*close({ payload }, { call, put }) {
|
|
||||||
try {
|
|
||||||
yield put({ type: 'save', payload: { loading: false } });
|
|
||||||
} catch (e) {
|
|
||||||
yield put({ type: 'error/save', payload: { errinfo: e.message } });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
reducers: {
|
|
||||||
save(state, action) {
|
|
||||||
return { ...state, ...action.payload };
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
@ -12,9 +12,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
|
||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
|
||||||
import { Button, Dialog, Field, Form, Input, Loading, Tab } from '@alifd/next';
|
import { Button, Dialog, Field, Form, Input, Loading, Tab } from '@alifd/next';
|
||||||
|
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
const TabPane = Tab.Item;
|
const TabPane = Tab.Item;
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
@ -95,7 +96,7 @@ class ConfigDetail extends React.Component {
|
|||||||
this.tenant = getParams('namespace') || '';
|
this.tenant = getParams('namespace') || '';
|
||||||
this.edasAppName = getParams('edasAppName') || '';
|
this.edasAppName = getParams('edasAppName') || '';
|
||||||
this.inApp = this.edasAppName;
|
this.inApp = this.edasAppName;
|
||||||
const url = `/nacos/v1/cs/configs?show=all&dataId=${this.dataId}&group=${this.group}`;
|
const url = `v1/cs/configs?show=all&dataId=${this.dataId}&group=${this.group}`;
|
||||||
request({
|
request({
|
||||||
url,
|
url,
|
||||||
beforeSend() {
|
beforeSend() {
|
||||||
|
@ -16,7 +16,7 @@ import $ from 'jquery';
|
|||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import DiffEditorDialog from '../../../components/DiffEditorDialog';
|
import DiffEditorDialog from '../../../components/DiffEditorDialog';
|
||||||
import SuccessDialog from '../../../components/SuccessDialog';
|
import SuccessDialog from '../../../components/SuccessDialog';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import {
|
import {
|
||||||
Balloon,
|
Balloon,
|
||||||
Button,
|
Button,
|
||||||
@ -157,7 +157,7 @@ class ConfigEditor extends React.Component {
|
|||||||
const self = this;
|
const self = this;
|
||||||
this.tenant = getParams('namespace') || '';
|
this.tenant = getParams('namespace') || '';
|
||||||
this.serverId = getParams('serverId') || 'center';
|
this.serverId = getParams('serverId') || 'center';
|
||||||
const url = `/nacos/v1/cs/configs?show=all&dataId=${this.dataId}&group=${this.group}`;
|
const url = `v1/cs/configs?show=all&dataId=${this.dataId}&group=${this.group}`;
|
||||||
request({
|
request({
|
||||||
url,
|
url,
|
||||||
beforeSend() {
|
beforeSend() {
|
||||||
@ -343,7 +343,7 @@ class ConfigEditor extends React.Component {
|
|||||||
content,
|
content,
|
||||||
tenant: this.tenant,
|
tenant: this.tenant,
|
||||||
};
|
};
|
||||||
const url = '/nacos/v1/cs/configs';
|
const url = 'v1/cs/configs';
|
||||||
request({
|
request({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
contentType: 'application/x-www-form-urlencoded',
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import { Button, Dialog, Field, Form, Input } from '@alifd/next';
|
import { Button, Dialog, Field, Form, Input } from '@alifd/next';
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class ConfigRollback extends React.Component {
|
|||||||
const self = this;
|
const self = this;
|
||||||
this.tenant = getParams('namespace') || '';
|
this.tenant = getParams('namespace') || '';
|
||||||
this.serverId = getParams('serverId') || 'center';
|
this.serverId = getParams('serverId') || 'center';
|
||||||
const url = `/nacos/v1/cs/history?dataId=${this.dataId}&group=${this.group}&nid=${this.nid}`;
|
const url = `v1/cs/history?dataId=${this.dataId}&group=${this.group}&nid=${this.nid}`;
|
||||||
request({
|
request({
|
||||||
url,
|
url,
|
||||||
success(result) {
|
success(result) {
|
||||||
@ -131,9 +131,9 @@ class ConfigRollback extends React.Component {
|
|||||||
tenant: self.tenant,
|
tenant: self.tenant,
|
||||||
};
|
};
|
||||||
|
|
||||||
let url = '/nacos/v1/cs/configs';
|
let url = 'v1/cs/configs';
|
||||||
if (self.opType.trim() === 'I') {
|
if (self.opType.trim() === 'I') {
|
||||||
url = `/nacos/v1/cs/configs?dataId=${self.dataId}&group=${self.group}`;
|
url = `v1/cs/configs?dataId=${self.dataId}&group=${self.group}`;
|
||||||
postData = {};
|
postData = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import React from 'react';
|
|||||||
import { Button, Checkbox, Dialog, Field, Form, Input, Loading } from '@alifd/next';
|
import { Button, Checkbox, Dialog, Field, Form, Input, Loading } from '@alifd/next';
|
||||||
import SuccessDialog from '../../../components/SuccessDialog';
|
import SuccessDialog from '../../../components/SuccessDialog';
|
||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
|
|
||||||
class ConfigSync extends React.Component {
|
class ConfigSync extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -13,15 +13,14 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import BatchHandle from '../../../components/BatchHandle';
|
import BatchHandle from 'components/BatchHandle';
|
||||||
import RegionGroup from '../../../components/RegionGroup';
|
import RegionGroup from 'components/RegionGroup';
|
||||||
import ShowCodeing from '../../../components/ShowCodeing';
|
import ShowCodeing from 'components/ShowCodeing';
|
||||||
import DeleteDialog from '../../../components/DeleteDialog';
|
import DeleteDialog from 'components/DeleteDialog';
|
||||||
import CloneDialog from '../../../components/CloneDialog';
|
import CloneDialog from 'components/CloneDialog';
|
||||||
import ImportDialog from '../../../components/ImportDialog';
|
import ImportDialog from 'components/ImportDialog';
|
||||||
import ExportDialog from '../../../components/ExportDialog';
|
import ExportDialog from 'components/ExportDialog';
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import './index.less';
|
|
||||||
import {
|
import {
|
||||||
Balloon,
|
Balloon,
|
||||||
Button,
|
Button,
|
||||||
@ -41,6 +40,8 @@ import {
|
|||||||
Table,
|
Table,
|
||||||
} from '@alifd/next';
|
} from '@alifd/next';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
const { Panel } = Collapse;
|
const { Panel } = Collapse;
|
||||||
|
|
||||||
const DashboardCard = ({ data = {}, height }) => (
|
const DashboardCard = ({ data = {}, height }) => (
|
||||||
@ -343,9 +344,9 @@ class ConfigurationManagement extends React.Component {
|
|||||||
this.serverId = getParams('serverId') || '';
|
this.serverId = getParams('serverId') || '';
|
||||||
let urlPrefix = '';
|
let urlPrefix = '';
|
||||||
if (this.dataId.indexOf('*') !== -1 || this.group.indexOf('*') !== -1) {
|
if (this.dataId.indexOf('*') !== -1 || this.group.indexOf('*') !== -1) {
|
||||||
urlPrefix = '/nacos/v1/cs/configs?search=blur';
|
urlPrefix = 'v1/cs/configs?search=blur';
|
||||||
} else {
|
} else {
|
||||||
urlPrefix = '/nacos/v1/cs/configs?search=accurate';
|
urlPrefix = 'v1/cs/configs?search=accurate';
|
||||||
}
|
}
|
||||||
|
|
||||||
request({
|
request({
|
||||||
@ -431,7 +432,7 @@ class ConfigurationManagement extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
const url = `/nacos/v1/cs/configs?dataId=${record.dataId}&group=${record.group}`;
|
const url = `v1/cs/configs?dataId=${record.dataId}&group=${record.group}`;
|
||||||
request({
|
request({
|
||||||
url,
|
url,
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
|
||||||
import './index.less';
|
|
||||||
import { Button, Field, Form, Input } from '@alifd/next';
|
import { Button, Field, Form, Input } from '@alifd/next';
|
||||||
|
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
class HistoryDetail extends React.Component {
|
class HistoryDetail extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -58,7 +59,7 @@ class HistoryDetail extends React.Component {
|
|||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: `/nacos/v1/cs/history?dataId=${this.dataId}&group=${this.group}&nid=${this.nid}`,
|
url: `v1/cs/history?dataId=${this.dataId}&group=${this.group}&nid=${this.nid}`,
|
||||||
success(result) {
|
success(result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
const data = result;
|
const data = result;
|
||||||
|
@ -15,7 +15,7 @@ import React from 'react';
|
|||||||
import { Field, Form, Input, Loading, Pagination, Table } from '@alifd/next';
|
import { Field, Form, Input, Loading, Pagination, Table } from '@alifd/next';
|
||||||
import RegionGroup from '../../../components/RegionGroup';
|
import RegionGroup from '../../../components/RegionGroup';
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
|
|
||||||
class HistoryRollback extends React.Component {
|
class HistoryRollback extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -123,7 +123,7 @@ class HistoryRollback extends React.Component {
|
|||||||
beforeSend() {
|
beforeSend() {
|
||||||
self.openLoading();
|
self.openLoading();
|
||||||
},
|
},
|
||||||
url: `/nacos/v1/cs/history?search=accurate&dataId=${this.dataId}&group=${
|
url: `v1/cs/history?search=accurate&dataId=${this.dataId}&group=${
|
||||||
this.group
|
this.group
|
||||||
}&&pageNo=${pageNo}&pageSize=${this.state.pageSize}`,
|
}&&pageNo=${pageNo}&pageSize=${this.state.pageSize}`,
|
||||||
success(data) {
|
success(data) {
|
||||||
@ -362,6 +362,7 @@ class HistoryRollback extends React.Component {
|
|||||||
margin: 0,
|
margin: 0,
|
||||||
paddingLeft: 10,
|
paddingLeft: 10,
|
||||||
borderLeft: '3px solid #09c',
|
borderLeft: '3px solid #09c',
|
||||||
|
fontSize: 16,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{aliwareIntl.get('com.alibaba.nacos.page.historyRollback.queryresult')}
|
{aliwareIntl.get('com.alibaba.nacos.page.historyRollback.queryresult')}
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import RegionGroup from '../../../components/RegionGroup';
|
import RegionGroup from '../../../components/RegionGroup';
|
||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import './index.less';
|
|
||||||
import { Field, Form, Grid, Input, Loading, Pagination, Select, Table } from '@alifd/next';
|
import { Field, Form, Grid, Input, Loading, Pagination, Select, Table } from '@alifd/next';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const { Row, Col } = Grid;
|
const { Row, Col } = Grid;
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ class ListeningToQuery extends React.Component {
|
|||||||
const type = this.getValue('type');
|
const type = this.getValue('type');
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
const ip = this.getValue('ip');
|
const ip = this.getValue('ip');
|
||||||
queryUrl = `/nacos/v1/cs/listener?ip=${ip}`;
|
queryUrl = `v1/cs/listener?ip=${ip}`;
|
||||||
const tenant = window.nownamespace || getParams('namespace') || '';
|
const tenant = window.nownamespace || getParams('namespace') || '';
|
||||||
if (tenant) {
|
if (tenant) {
|
||||||
queryUrl += `&tenant=${tenant}`;
|
queryUrl += `&tenant=${tenant}`;
|
||||||
@ -76,7 +77,7 @@ class ListeningToQuery extends React.Component {
|
|||||||
const dataId = this.getValue('dataId');
|
const dataId = this.getValue('dataId');
|
||||||
const group = this.getValue('group');
|
const group = this.getValue('group');
|
||||||
if (!dataId || !group) return false;
|
if (!dataId || !group) return false;
|
||||||
queryUrl = `/nacos/v1/cs/configs/listener?dataId=${dataId}&group=${group}`;
|
queryUrl = `v1/cs/configs/listener?dataId=${dataId}&group=${group}`;
|
||||||
}
|
}
|
||||||
request({
|
request({
|
||||||
url: queryUrl,
|
url: queryUrl,
|
||||||
@ -280,6 +281,7 @@ class ListeningToQuery extends React.Component {
|
|||||||
borderLeft: '3px solid #09c',
|
borderLeft: '3px solid #09c',
|
||||||
margin: 0,
|
margin: 0,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
|
fontSize: 16,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.query_results:_query')}
|
{aliwareIntl.get('com.alibaba.nacos.page.listeningToQuery.query_results:_query')}
|
||||||
|
@ -15,7 +15,6 @@ import React from 'react';
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import SuccessDialog from '../../../components/SuccessDialog';
|
import SuccessDialog from '../../../components/SuccessDialog';
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
||||||
import './index.less';
|
|
||||||
import {
|
import {
|
||||||
Balloon,
|
Balloon,
|
||||||
Button,
|
Button,
|
||||||
@ -30,6 +29,8 @@ import {
|
|||||||
Radio,
|
Radio,
|
||||||
} from '@alifd/next';
|
} from '@alifd/next';
|
||||||
|
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const { Group: RadioGroup } = Radio;
|
const { Group: RadioGroup } = Radio;
|
||||||
const { AutoComplete: Combobox } = Select;
|
const { AutoComplete: Combobox } = Select;
|
||||||
@ -238,7 +239,7 @@ class NewConfig extends React.Component {
|
|||||||
tenant: this.tenant,
|
tenant: this.tenant,
|
||||||
};
|
};
|
||||||
this.serverId = getParams('serverId') || 'center';
|
this.serverId = getParams('serverId') || 'center';
|
||||||
const url = '/nacos/v1/cs/configs';
|
const url = 'v1/cs/configs';
|
||||||
request({
|
request({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
contentType: 'application/x-www-form-urlencoded',
|
contentType: 'application/x-www-form-urlencoded',
|
||||||
|
@ -18,7 +18,7 @@ import DeleteDialog from '../../components/DeleteDialog';
|
|||||||
import NewNameSpace from '../../components/NewNameSpace';
|
import NewNameSpace from '../../components/NewNameSpace';
|
||||||
import EditorNameSpace from '../../components/EditorNameSpace';
|
import EditorNameSpace from '../../components/EditorNameSpace';
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../globalLib';
|
import { getParams, setParams, request, aliwareIntl } from '../../globalLib';
|
||||||
import './index.less';
|
import './index.scss';
|
||||||
|
|
||||||
class NameSpace extends React.Component {
|
class NameSpace extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -42,7 +42,7 @@ class NameSpace extends React.Component {
|
|||||||
request({
|
request({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
beforeSend() {},
|
beforeSend() {},
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const data = res.data || [];
|
const data = res.data || [];
|
||||||
@ -98,7 +98,7 @@ class NameSpace extends React.Component {
|
|||||||
detailNamespace(record) {
|
detailNamespace(record) {
|
||||||
const { namespace } = record; // 获取ak,sk
|
const { namespace } = record; // 获取ak,sk
|
||||||
request({
|
request({
|
||||||
url: `/nacos/v1/console/namespaces?show=all&namespaceId=${namespace}`,
|
url: `v1/console/namespaces?show=all&namespaceId=${namespace}`,
|
||||||
beforeSend: () => {
|
beforeSend: () => {
|
||||||
this.openLoading();
|
this.openLoading();
|
||||||
},
|
},
|
||||||
@ -177,7 +177,7 @@ class NameSpace extends React.Component {
|
|||||||
),
|
),
|
||||||
language: aliwareIntl.currentLanguageCode || 'zh-cn',
|
language: aliwareIntl.currentLanguageCode || 'zh-cn',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
const url = `/nacos/v1/console/namespaces?namespaceId=${record.namespace}`;
|
const url = `v1/console/namespaces?namespaceId=${record.namespace}`;
|
||||||
request({
|
request({
|
||||||
url,
|
url,
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
@ -214,7 +214,7 @@ class NameSpace extends React.Component {
|
|||||||
refreshNameSpace() {
|
refreshNameSpace() {
|
||||||
request({
|
request({
|
||||||
type: 'get',
|
type: 'get',
|
||||||
url: '/nacos/v1/console/namespaces',
|
url: 'v1/console/namespaces',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.namespaceList = res.data;
|
window.namespaceList = res.data;
|
||||||
|
@ -54,7 +54,7 @@ class EditClusterDialog extends React.Component {
|
|||||||
} = this.state.editCluster;
|
} = this.state.editCluster;
|
||||||
request({
|
request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/nacos/v1/ns/cluster/update',
|
url: 'v1/ns/cluster/update',
|
||||||
data: {
|
data: {
|
||||||
serviceName,
|
serviceName,
|
||||||
clusterName: name,
|
clusterName: name,
|
||||||
|
@ -46,7 +46,7 @@ class EditInstanceDialog extends React.Component {
|
|||||||
const { ip, port, weight, enabled, metadataText } = this.state.editInstance;
|
const { ip, port, weight, enabled, metadataText } = this.state.editInstance;
|
||||||
request({
|
request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/nacos/v1/ns/instance/update',
|
url: 'v1/ns/instance/update',
|
||||||
data: { serviceName, clusterName, ip, port, weight, enable: enabled, metadata: metadataText },
|
data: { serviceName, clusterName, ip, port, weight, enable: enabled, metadata: metadataText },
|
||||||
dataType: 'text',
|
dataType: 'text',
|
||||||
beforeSend: () => openLoading(),
|
beforeSend: () => openLoading(),
|
||||||
|
@ -48,7 +48,7 @@ class EditServiceDialog extends React.Component {
|
|||||||
const { name, protectThreshold, healthCheckMode, metadataText } = editService;
|
const { name, protectThreshold, healthCheckMode, metadataText } = editService;
|
||||||
request({
|
request({
|
||||||
method: isCreate ? 'PUT' : 'POST',
|
method: isCreate ? 'PUT' : 'POST',
|
||||||
url: `/nacos/v1/ns/service/${isCreate ? 'create' : 'update'}`,
|
url: `v1/ns/service/${isCreate ? 'create' : 'update'}`,
|
||||||
data: { serviceName: name, protectThreshold, healthCheckMode, metadata: metadataText },
|
data: { serviceName: name, protectThreshold, healthCheckMode, metadata: metadataText },
|
||||||
dataType: 'text',
|
dataType: 'text',
|
||||||
beforeSend: () => this.setState({ loading: true }),
|
beforeSend: () => this.setState({ loading: true }),
|
||||||
|
@ -51,7 +51,7 @@ class InstanceTable extends React.Component {
|
|||||||
if (!clusterName) return;
|
if (!clusterName) return;
|
||||||
const { pageSize, pageNum } = this.state;
|
const { pageSize, pageNum } = this.state;
|
||||||
request({
|
request({
|
||||||
url: '/nacos/v1/ns/catalog/instanceList',
|
url: 'v1/ns/catalog/instanceList',
|
||||||
data: {
|
data: {
|
||||||
serviceName,
|
serviceName,
|
||||||
clusterName,
|
clusterName,
|
||||||
@ -76,7 +76,7 @@ class InstanceTable extends React.Component {
|
|||||||
newVal.list[index].enabled = !enabled;
|
newVal.list[index].enabled = !enabled;
|
||||||
request({
|
request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/nacos/v1/ns/instance/update',
|
url: 'v1/ns/instance/update',
|
||||||
data: { serviceName, clusterName, ip, port, weight, enable: !enabled },
|
data: { serviceName, clusterName, ip, port, weight, enable: !enabled },
|
||||||
dataType: 'text',
|
dataType: 'text',
|
||||||
beforeSend: () => this.openLoading(),
|
beforeSend: () => this.openLoading(),
|
||||||
@ -119,7 +119,7 @@ class InstanceTable extends React.Component {
|
|||||||
/>
|
/>
|
||||||
<Table.Column
|
<Table.Column
|
||||||
title={I18N.OPERATION}
|
title={I18N.OPERATION}
|
||||||
width={150}
|
width={160}
|
||||||
cell={(value, index, record) => (
|
cell={(value, index, record) => (
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
|
@ -17,9 +17,9 @@ import { Button, Card, Form, Loading } from '@alifd/next';
|
|||||||
import EditServiceDialog from './EditServiceDialog';
|
import EditServiceDialog from './EditServiceDialog';
|
||||||
import EditClusterDialog from './EditClusterDialog';
|
import EditClusterDialog from './EditClusterDialog';
|
||||||
import InstanceTable from './InstanceTable';
|
import InstanceTable from './InstanceTable';
|
||||||
import queryString from 'query-string';
|
import { getParameter } from 'utils/nacosutil';
|
||||||
import { I18N } from './constant';
|
import { I18N } from './constant';
|
||||||
import './ServiceDetail.less';
|
import './ServiceDetail.scss';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const pageFormLayout = {
|
const pageFormLayout = {
|
||||||
@ -31,7 +31,7 @@ class ServiceDetail extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
serviceName: queryString.parse(props.location.search).name,
|
serviceName: getParameter(props.location.search, 'name'),
|
||||||
loading: false,
|
loading: false,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
clusters: [],
|
clusters: [],
|
||||||
@ -53,7 +53,7 @@ class ServiceDetail extends React.Component {
|
|||||||
getServiceDetail() {
|
getServiceDetail() {
|
||||||
const { serviceName } = this.state;
|
const { serviceName } = this.state;
|
||||||
request({
|
request({
|
||||||
url: `/nacos/v1/ns/catalog/serviceDetail?serviceName=${serviceName}`,
|
url: `v1/ns/catalog/serviceDetail?serviceName=${serviceName}`,
|
||||||
beforeSend: () => this.openLoading(),
|
beforeSend: () => this.openLoading(),
|
||||||
success: ({ clusters = [], service = {} }) => this.setState({ service, clusters }),
|
success: ({ clusters = [], service = {} }) => this.setState({ service, clusters }),
|
||||||
complete: () => this.closeLoading(),
|
complete: () => this.closeLoading(),
|
||||||
|
@ -29,7 +29,7 @@ import {
|
|||||||
} from '@alifd/next';
|
} from '@alifd/next';
|
||||||
import EditServiceDialog from '../ServiceDetail/EditServiceDialog';
|
import EditServiceDialog from '../ServiceDetail/EditServiceDialog';
|
||||||
import { I18N, STATUS_COLOR_MAPPING } from './constant';
|
import { I18N, STATUS_COLOR_MAPPING } from './constant';
|
||||||
import './ServiceList.less';
|
import './ServiceList.scss';
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const { Row, Col } = Grid;
|
const { Row, Col } = Grid;
|
||||||
@ -69,7 +69,7 @@ class ServiceList extends React.Component {
|
|||||||
const { currentPage, pageSize, keyword } = this.state;
|
const { currentPage, pageSize, keyword } = this.state;
|
||||||
const parameter = [`startPg=${currentPage}`, `pgSize=${pageSize}`, `keyword=${keyword}`];
|
const parameter = [`startPg=${currentPage}`, `pgSize=${pageSize}`, `keyword=${keyword}`];
|
||||||
request({
|
request({
|
||||||
url: `/nacos/v1/ns/catalog/serviceList?${parameter.join('&')}`,
|
url: `v1/ns/catalog/serviceList?${parameter.join('&')}`,
|
||||||
beforeSend: () => this.openLoading(),
|
beforeSend: () => this.openLoading(),
|
||||||
success: ({ count = 0, serviceList = [] } = {}) => {
|
success: ({ count = 0, serviceList = [] } = {}) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -98,7 +98,7 @@ class ServiceList extends React.Component {
|
|||||||
onOk: () => {
|
onOk: () => {
|
||||||
request({
|
request({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: `/nacos/v1/ns/service/remove?serviceName=${serviceName}`,
|
url: `v1/ns/service/remove?serviceName=${serviceName}`,
|
||||||
dataType: 'text',
|
dataType: 'text',
|
||||||
beforeSend: () => this.openLoading(),
|
beforeSend: () => this.openLoading(),
|
||||||
success: res => {
|
success: res => {
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import locale from './locale';
|
||||||
|
|
||||||
|
export default { locale };
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import fusionEnUS from '@alifd/next/lib/locale/en-us';
|
||||||
|
import fusionZhCN from '@alifd/next/lib/locale/zh-cn';
|
||||||
|
import I18N from '../locales';
|
||||||
|
import { LANGUAGE_KEY, LANGUAGE_SWITCH } from '../constants';
|
||||||
|
import CookieHelp from '../utils/cookie';
|
||||||
|
|
||||||
|
const enUS = Object.assign({}, fusionEnUS, I18N.enUS);
|
||||||
|
const zhCN = Object.assign({}, fusionZhCN, I18N.zhCN);
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
language: 'en-US',
|
||||||
|
locale: enUS,
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeLanguage = lang => dispatch => {
|
||||||
|
const language = lang === 'zh-CN' ? 'zh-CN' : 'en-US';
|
||||||
|
CookieHelp.setValue(LANGUAGE_KEY, language);
|
||||||
|
dispatch({ type: LANGUAGE_SWITCH, language, locale: language === 'zh-CN' ? zhCN : enUS });
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (state = initialState, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case LANGUAGE_SWITCH:
|
||||||
|
return { ...state, ...action };
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { changeLanguage };
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { Router, Route, Switch } from 'dva/router';
|
|
||||||
import './lib.js';
|
|
||||||
import App from './containers/App';
|
|
||||||
import Namespace from './pages/NameSpace';
|
|
||||||
import Newconfig from './pages/ConfigurationManagement/NewConfig';
|
|
||||||
import Configsync from './pages/ConfigurationManagement/ConfigSync';
|
|
||||||
import Configdetail from './pages/ConfigurationManagement/ConfigDetail';
|
|
||||||
import Configeditor from './pages/ConfigurationManagement/ConfigEditor';
|
|
||||||
import HistoryDetail from './pages/ConfigurationManagement/HistoryDetail';
|
|
||||||
import ConfigRollback from './pages/ConfigurationManagement/ConfigRollback';
|
|
||||||
import HistoryRollback from './pages/ConfigurationManagement/HistoryRollback';
|
|
||||||
import ListeningToQuery from './pages/ConfigurationManagement/ListeningToQuery';
|
|
||||||
import ConfigurationManagement from './pages/ConfigurationManagement/ConfigurationManagement';
|
|
||||||
import ServiceList from './pages/ServiceManagement/ServiceList';
|
|
||||||
import ServiceDetail from './pages/ServiceManagement/ServiceDetail';
|
|
||||||
|
|
||||||
function RouterConfig({ history }) {
|
|
||||||
return (
|
|
||||||
<Router history={history}>
|
|
||||||
<Switch>
|
|
||||||
<App history={history}>
|
|
||||||
<Route path="/Namespace" component={Namespace} />
|
|
||||||
<Route path="/Newconfig" component={Newconfig} />
|
|
||||||
<Route path="/Configsync" component={Configsync} />
|
|
||||||
<Route path="/Configdetail" component={Configdetail} />
|
|
||||||
<Route path="/Configeditor" component={Configeditor} />
|
|
||||||
<Route path="/HistoryDetail" component={HistoryDetail} />
|
|
||||||
<Route path="/ConfigRollback" component={ConfigRollback} />
|
|
||||||
<Route path="/HistoryRollback" component={HistoryRollback} />
|
|
||||||
<Route path="/ListeningToQuery" component={ListeningToQuery} />
|
|
||||||
<Route path="/ConfigurationManagement" component={ConfigurationManagement} />
|
|
||||||
<Route path="/ServiceManagement" component={ServiceList} />
|
|
||||||
<Route path="/ServiceDetail" component={ServiceDetail} />
|
|
||||||
</App>
|
|
||||||
</Switch>
|
|
||||||
</Router>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
RouterConfig.propTypes = {
|
|
||||||
history: PropTypes.object,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default RouterConfig;
|
|
@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import { connect } from 'dva';
|
|
||||||
import styles from './IndexPage.css';
|
|
||||||
|
|
||||||
function IndexPage() {
|
|
||||||
return (
|
|
||||||
<div className={styles.normal}>
|
|
||||||
<div className="test" />
|
|
||||||
<h1 className={styles.title}>Yay! Welcome to dva!</h1>
|
|
||||||
<div className={styles.welcome} />
|
|
||||||
<ul className={styles.list}>
|
|
||||||
<li>
|
|
||||||
To get started, edit <code>src/index.js</code> and save to reload.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/dvajs/dva-docs/blob/master/v1/en-us/getting-started.md">
|
|
||||||
Getting Started
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
IndexPage.propTypes = {};
|
|
||||||
|
|
||||||
export default connect()(IndexPage);
|
|
@ -1,207 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
method: ['get', 'post', 'put', 'delete', 'patch'],
|
|
||||||
serviceList: [
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.dashlist',
|
|
||||||
name: '',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/info',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2018-05-19T07:24:01.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 0,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.getLink',
|
|
||||||
name: 'getLink',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/viper/getLink',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2017-12-03T07:38:56.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 0,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.getLinks',
|
|
||||||
name: 'getLinks',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/viper/getLinks',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2017-12-03T07:38:56.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 0,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.deleteNameSpace',
|
|
||||||
name: '删除命名空间',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/service/serverId/{serverId}/namespace/{namespace}',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2017-12-03T07:38:56.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 3,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.getMetaData',
|
|
||||||
name: '获取metaData',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/meta/data',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2017-12-03T07:38:56.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 0,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.sendVerifyCode',
|
|
||||||
name: '发送验证码',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/meta/sendVerifyCode',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2017-12-03T07:38:56.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 0,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
registerName: 'com.alibaba.nacos.service.getDomain',
|
|
||||||
name: '获取region',
|
|
||||||
registerTo: null,
|
|
||||||
url: '/diamond-ops/env/domain',
|
|
||||||
defaults: '{}',
|
|
||||||
params: '{}',
|
|
||||||
config: null,
|
|
||||||
initialize: null,
|
|
||||||
share: 0,
|
|
||||||
exports: null,
|
|
||||||
proxy: '',
|
|
||||||
serviceDoc: null,
|
|
||||||
ctime: '2017-12-03T07:38:56.000Z',
|
|
||||||
mtime: '2018-08-28T10:19:46.000Z',
|
|
||||||
author_id: 23,
|
|
||||||
project_id: 'nacos',
|
|
||||||
is_mock: 0,
|
|
||||||
method: 0,
|
|
||||||
is_param: 0,
|
|
||||||
is_proxy: 0,
|
|
||||||
cookie: '{}',
|
|
||||||
header: '{}',
|
|
||||||
isJsonData: 0,
|
|
||||||
paramsType: '[]',
|
|
||||||
autoLoading: 0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
@ -0,0 +1,15 @@
|
|||||||
|
function getValue(key) {
|
||||||
|
if (!document.cookie) return null;
|
||||||
|
const list = document.cookie.split(';') || [];
|
||||||
|
for (const item of list) {
|
||||||
|
const [k, v] = item.split('=');
|
||||||
|
if (k === key) return v;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setValue(key, value) {
|
||||||
|
document.cookie = `${key}=${value}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { getValue, setValue };
|
@ -39,3 +39,10 @@ export const getLink = link => {
|
|||||||
}
|
}
|
||||||
return link;
|
return link;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getParameter = (search, name) => {
|
||||||
|
const [, query = ''] = search.split('?');
|
||||||
|
const [hit = ''] = query.split('&').filter(item => name === item.split('=')[0]);
|
||||||
|
const [, value = ''] = hit.split('=');
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
@ -1,43 +1,33 @@
|
|||||||
/*
|
import axios from 'axios';
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
import { Message } from '@alifd/next';
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
// import { SUCCESS_RESULT_CODE } from '../constants';
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import fetch from 'dva/fetch';
|
const API_GENERAL_ERROR_MESSAGE = 'Request error, please try again later!';
|
||||||
|
|
||||||
function parseJSON(response) {
|
const request = () => {
|
||||||
return response.json();
|
const instance = axios.create();
|
||||||
}
|
|
||||||
|
|
||||||
function checkStatus(response) {
|
instance.interceptors.response.use(
|
||||||
if (response.status >= 200 && response.status < 300) {
|
response => {
|
||||||
return response;
|
const { success, resultCode, resultMessage = API_GENERAL_ERROR_MESSAGE } = response.data;
|
||||||
}
|
// if (!success && resultCode !== SUCCESS_RESULT_CODE) {
|
||||||
|
// Message.error(resultMessage);
|
||||||
|
// return Promise.reject(new Error(resultMessage));
|
||||||
|
// }
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (error.response) {
|
||||||
|
const { status } = error.response;
|
||||||
|
Message.error(`HTTP ERROR: ${status}`);
|
||||||
|
} else {
|
||||||
|
Message.error(API_GENERAL_ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const error = new Error(response.statusText);
|
return instance;
|
||||||
error.response = response;
|
};
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
export default request();
|
||||||
* Requests a URL, returning a promise.
|
|
||||||
*
|
|
||||||
* @param {string} url The URL we want to request
|
|
||||||
* @param {object} [options] The options we want to pass to "fetch"
|
|
||||||
* @return {object} An object containing either "data" or "err"
|
|
||||||
*/
|
|
||||||
export default function request(url, options) {
|
|
||||||
return fetch(url, options)
|
|
||||||
.then(checkStatus)
|
|
||||||
.then(parseJSON)
|
|
||||||
.then(data => ({ data }))
|
|
||||||
.catch(err => ({ err }));
|
|
||||||
}
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
1
console/src/main/resources/static/css/main.a1b00967.css
Normal file
1
console/src/main/resources/static/css/main.a1b00967.css
Normal file
File diff suppressed because one or more lines are too long
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title>Nacos</title>
|
<title>Nacos</title>
|
||||||
<link rel="shortcut icon" href="//www.aliyun.com/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="//www.aliyun.com/favicon.ico" type="image/x-icon">
|
||||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
|
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
|
||||||
<link rel="stylesheet" type="text/css" href="css/console1412.css">
|
<link rel="stylesheet" type="text/css" href="css/console1412.css">
|
||||||
<!-- 第三方css开始 -->
|
<!-- 第三方css开始 -->
|
||||||
@ -28,8 +28,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="css/icon.css">
|
<link rel="stylesheet" type="text/css" href="css/icon.css">
|
||||||
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
|
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
|
||||||
<!-- 第三方css结束 -->
|
<!-- 第三方css结束 -->
|
||||||
<link rel="stylesheet" type="text/css" href="index.css">
|
<link href="./css/main.a1b00967.css" rel="stylesheet"></head>
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root" style="overflow:hidden"></div>
|
<div id="root" style="overflow:hidden"></div>
|
||||||
@ -49,9 +48,7 @@
|
|||||||
<script src="js/diff_match_patch.js"></script>
|
<script src="js/diff_match_patch.js"></script>
|
||||||
<script src="js/merge.js"></script>
|
<script src="js/merge.js"></script>
|
||||||
<script src="js/loader.js"></script>
|
<script src="js/loader.js"></script>
|
||||||
|
|
||||||
<!-- 第三方js结束 -->
|
<!-- 第三方js结束 -->
|
||||||
<script src="index.js"></script>
|
<script type="text/javascript" src="./js/main.23a1a48a.js"></script></body>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
87
console/src/main/resources/static/js/main.23a1a48a.js
Normal file
87
console/src/main/resources/static/js/main.23a1a48a.js
Normal file
File diff suppressed because one or more lines are too long
@ -1,607 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import $ from 'jquery';
|
|
||||||
import { getParams, request, aliwareIntl } from '../../../globalLib';
|
|
||||||
import DiffEditorDialog from '../../../components/DiffEditorDialog';
|
|
||||||
import SuccessDialog from '../../../components/SuccessDialog';
|
|
||||||
import './index.less';
|
|
||||||
import { Balloon, Button, Dialog, Field, Form, Icon, Input, Loading, Radio, Select, Tab, Message } from '@alifd/next';
|
|
||||||
const TabPane = Tab.Item;
|
|
||||||
const FormItem = Form.Item;
|
|
||||||
const { Group: RadioGroup } = Radio;
|
|
||||||
|
|
||||||
/*****************************此行为标记行, 请勿删和修改此行, 文件和组件依赖请写在此行上面, 主体代码请写在此行下面的class中*****************************/
|
|
||||||
class ConfigEditor extends React.Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.edasAppName = getParams('edasAppName') || '';
|
|
||||||
this.edasAppId = getParams('edasAppId') || '';
|
|
||||||
this.inApp = this.edasAppName;
|
|
||||||
this.field = new Field(this);
|
|
||||||
this.dataId = getParams('dataId') || 'yanlin';
|
|
||||||
this.group = getParams('group') || 'DEFAULT_GROUP';
|
|
||||||
this.tenant = getParams('namespace') | '';
|
|
||||||
this.state = {
|
|
||||||
configType: 'text',
|
|
||||||
codeValue: ``,
|
|
||||||
envname: 'center',
|
|
||||||
targetEnvName: '',
|
|
||||||
envlist: [],
|
|
||||||
envvalues: [],
|
|
||||||
loading: false,
|
|
||||||
showmore: false,
|
|
||||||
activeKey: 'normal',
|
|
||||||
hasbeta: false,
|
|
||||||
ips: '',
|
|
||||||
checkedBeta: false,
|
|
||||||
tagLst: [],
|
|
||||||
config_tags: [],
|
|
||||||
switchEncrypt: false,
|
|
||||||
tag: [{ title: aliwareIntl.get('com.alibaba.nacos.page.configeditor.official'), key: 'normal' }]
|
|
||||||
};
|
|
||||||
this.codeValue = '';
|
|
||||||
this.mode = 'text';
|
|
||||||
this.ips = '';
|
|
||||||
this.valueMap = {}; //存储不同版本的数据
|
|
||||||
this.searchDataId = getParams('searchDataId') || '';
|
|
||||||
this.searchGroup = getParams('searchGroup') || '';
|
|
||||||
}
|
|
||||||
componentDidMount() {
|
|
||||||
if (this.dataId.startsWith("cipher-")) {
|
|
||||||
this.setState({
|
|
||||||
switchEncrypt: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.betaips = document.getElementById('betaips');
|
|
||||||
this.getDataDetail();
|
|
||||||
this.chontenttab = document.getElementById('chontenttab'); //diff标签
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
initMoacoEditor(language, value) {
|
|
||||||
if (!window.monaco) {
|
|
||||||
window.importEditor(() => {
|
|
||||||
this.monacoEditor = window.monaco.editor.create(document.getElementById('container'), {
|
|
||||||
value: value,
|
|
||||||
language: this.state.configType,
|
|
||||||
codeLens: true,
|
|
||||||
selectOnLineNumbers: true,
|
|
||||||
roundedSelection: false,
|
|
||||||
readOnly: false,
|
|
||||||
lineNumbersMinChars: true,
|
|
||||||
theme: 'vs-dark',
|
|
||||||
wordWrapColumn: 120,
|
|
||||||
folding: false,
|
|
||||||
showFoldingControls: 'always',
|
|
||||||
wordWrap: 'wordWrapColumn',
|
|
||||||
cursorStyle: 'line',
|
|
||||||
automaticLayout: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.monacoEditor = window.monaco.editor.create(document.getElementById('container'), {
|
|
||||||
value: value,
|
|
||||||
language: this.state.configType,
|
|
||||||
codeLens: true,
|
|
||||||
selectOnLineNumbers: true,
|
|
||||||
roundedSelection: false,
|
|
||||||
readOnly: false,
|
|
||||||
lineNumbersMinChars: true,
|
|
||||||
theme: 'vs-dark',
|
|
||||||
wordWrapColumn: 120,
|
|
||||||
folding: false,
|
|
||||||
showFoldingControls: 'always',
|
|
||||||
wordWrap: 'wordWrapColumn',
|
|
||||||
cursorStyle: 'line',
|
|
||||||
automaticLayout: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleMore() {
|
|
||||||
this.setState({
|
|
||||||
showmore: !this.state.showmore
|
|
||||||
});
|
|
||||||
}
|
|
||||||
navTo(url) {
|
|
||||||
|
|
||||||
this.serverId = getParams('serverId') || '';
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
this.props.history.push(`${url}?serverId=${this.serverId || ''}&dataId=${this.dataId}&group=${this.group}&namespace=${this.tenant}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
openLoading() {
|
|
||||||
this.setState({
|
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
closeLoading() {
|
|
||||||
this.setState({
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getDataDetail() {
|
|
||||||
let self = this;
|
|
||||||
this.tenant = getParams('namespace') || '';
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
let url = `/nacos/v1/cs/configs?show=all&dataId=${this.dataId}&group=${this.group}`;
|
|
||||||
request({
|
|
||||||
url: url,
|
|
||||||
beforeSend: function () {
|
|
||||||
self.openLoading();
|
|
||||||
},
|
|
||||||
success: function (result) {
|
|
||||||
|
|
||||||
if (result != null) {
|
|
||||||
let data = result;
|
|
||||||
self.valueMap['normal'] = data;
|
|
||||||
self.field.setValue('dataId', data.dataId);
|
|
||||||
//self.field.setValue('content', data.content);
|
|
||||||
self.field.setValue('appName', self.inApp ? self.edasAppName : data.appName);
|
|
||||||
//self.field.setValue('envs', self.serverId);
|
|
||||||
self.field.setValue('group', data.group);
|
|
||||||
|
|
||||||
//self.field.setValue('type', data.type);
|
|
||||||
self.field.setValue('desc', data.desc);
|
|
||||||
//self.field.setValue('md5', data.md5);
|
|
||||||
self.codeValue = data.content || '';
|
|
||||||
let type = data.type || 'text';
|
|
||||||
self.setState({ //设置radio 高亮
|
|
||||||
configType: type
|
|
||||||
});
|
|
||||||
self.initMoacoEditor(type, self.codeValue);
|
|
||||||
|
|
||||||
//self.createCodeMirror('text', self.codeValue);
|
|
||||||
//self.codeValue = self.commoneditor.doc.getValue();
|
|
||||||
if (data.configTags != null) {
|
|
||||||
let tagArr = data.configTags.split(",");
|
|
||||||
self.setConfigTags(tagArr);
|
|
||||||
}
|
|
||||||
|
|
||||||
let envvalues = [];
|
|
||||||
let env = {};
|
|
||||||
self.serverId = env.serverId;
|
|
||||||
self.targetEnvs = envvalues;
|
|
||||||
} else {
|
|
||||||
Dialog.alert({
|
|
||||||
language: aliwareIntl.currentLanguageCode || 'zh-cn',
|
|
||||||
title: aliwareIntl.get('com.alibaba.nacos.page.configeditor.wrong'),
|
|
||||||
content: result.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
complete: function () {
|
|
||||||
self.closeLoading();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
goList() {
|
|
||||||
|
|
||||||
let tenant = getParams('namespace');
|
|
||||||
this.props.history.push(`/configurationManagement?serverId=${this.serverId}&group=${this.searchGroup}&dataId=${this.searchDataId}&namespace=${tenant}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
createCodeMirror(mode, value) {
|
|
||||||
let commontarget = this.refs["commoneditor"];
|
|
||||||
commontarget.innerHTML = '';
|
|
||||||
this.commoneditor = window.CodeMirror(commontarget, {
|
|
||||||
value: value,
|
|
||||||
mode: mode,
|
|
||||||
lineNumbers: true,
|
|
||||||
theme: 'xq-light',
|
|
||||||
lint: true,
|
|
||||||
gutters: ["CodeMirror-lint-markers"],
|
|
||||||
extraKeys: {
|
|
||||||
"F1": function (cm) {
|
|
||||||
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
|
||||||
},
|
|
||||||
"Esc": function (cm) {
|
|
||||||
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.commoneditor.on('change', this.codemirrorValueChanged.bind(this));
|
|
||||||
}
|
|
||||||
codemirrorValueChanged(doc) {
|
|
||||||
if (this.diffeditor) {
|
|
||||||
this.diffeditor.edit.doc.setValue(doc.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
createDiffCodeMirror(leftCode, rightCode) {
|
|
||||||
let target = this.refs["diffeditor"];
|
|
||||||
target.innerHTML = '';
|
|
||||||
|
|
||||||
this.diffeditor = window.CodeMirror.MergeView(target, {
|
|
||||||
value: leftCode || '',
|
|
||||||
origLeft: null,
|
|
||||||
orig: rightCode || '',
|
|
||||||
lineNumbers: true,
|
|
||||||
mode: this.mode,
|
|
||||||
theme: 'xq-light',
|
|
||||||
highlightDifferences: true,
|
|
||||||
connect: 'align',
|
|
||||||
collapseIdentical: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
changeConfig(value) {
|
|
||||||
if (value === 0) {
|
|
||||||
this.createCodeMirror('text', this.codeValue);
|
|
||||||
this.mode = 'text';
|
|
||||||
}
|
|
||||||
if (value === 1) {
|
|
||||||
this.createCodeMirror('application/json', this.codeValue);
|
|
||||||
this.mode = 'application/json';
|
|
||||||
}
|
|
||||||
if (value === 2) {
|
|
||||||
this.createCodeMirror('xml', this.codeValue);
|
|
||||||
this.mode = 'xml';
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
configType: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setCodeValue(value) {
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
codeValue: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
toggleDiff(checked) {
|
|
||||||
if (checked) {
|
|
||||||
this.chontenttab.style.display = 'block';
|
|
||||||
|
|
||||||
let nowvalue = this.commoneditor.doc.getValue();
|
|
||||||
if (!this.diffeditor) {
|
|
||||||
this.createDiffCodeMirror(nowvalue, this.codeValue);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.chontenttab.style.display = 'none';
|
|
||||||
//this.diffeditor = null;
|
|
||||||
//let target = this.refs["diffeditor"];
|
|
||||||
//target.innerHTML = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
publishConfig() {
|
|
||||||
this.field.validate((errors, values) => {
|
|
||||||
if (errors) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let content = '';
|
|
||||||
let self = this;
|
|
||||||
// if (this.commoneditor) {
|
|
||||||
// content = this.commoneditor.doc.getValue();
|
|
||||||
// //content = content.replace("↵", "\n\r");
|
|
||||||
// } else {
|
|
||||||
// content = this.codeValue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.monacoEditor) {
|
|
||||||
content = this.monacoEditor.getValue();
|
|
||||||
} else {
|
|
||||||
content = this.codeValue;
|
|
||||||
}
|
|
||||||
if (!content) {
|
|
||||||
Message.error({
|
|
||||||
content: aliwareIntl.get("nacos.page.ConfigEditor.submit_failed"),
|
|
||||||
align: "cc cc"
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.codeValue = content;
|
|
||||||
this.tenant = getParams('namespace') || '';
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
|
|
||||||
let payload = {
|
|
||||||
dataId: this.field.getValue('dataId'),
|
|
||||||
appName: this.inApp ? this.edasAppId : this.field.getValue('appName'),
|
|
||||||
group: this.field.getValue('group'),
|
|
||||||
desc: this.field.getValue('desc'),
|
|
||||||
config_tags: this.state.config_tags.join(),
|
|
||||||
type: this.state.configType,
|
|
||||||
content: content,
|
|
||||||
tenant: this.tenant
|
|
||||||
|
|
||||||
};
|
|
||||||
let url = `/nacos/v1/cs/configs`;
|
|
||||||
request({
|
|
||||||
type: 'post',
|
|
||||||
contentType: 'application/x-www-form-urlencoded',
|
|
||||||
url: url,
|
|
||||||
data: payload,
|
|
||||||
success: function (res) {
|
|
||||||
let _payload = {};
|
|
||||||
_payload.maintitle = aliwareIntl.get('com.alibaba.nacos.page.configeditor.toedittitle');
|
|
||||||
_payload.title = <div>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.toedit')}</div>;
|
|
||||||
_payload.content = '';
|
|
||||||
_payload.dataId = payload.dataId;
|
|
||||||
_payload.group = payload.group;
|
|
||||||
|
|
||||||
if (res != null) {
|
|
||||||
_payload.isok = true;
|
|
||||||
let activeKey = self.state.activeKey.split('-')[0];
|
|
||||||
if (activeKey === 'normal' && self.hasips === true) {
|
|
||||||
//如果是在normal面板选择了beta发布
|
|
||||||
let sufex = new Date().getTime();
|
|
||||||
self.setState({
|
|
||||||
tag: [{ title: aliwareIntl.get('com.alibaba.nacos.page.configeditor.official'), key: `normal-${sufex}` }, { title: 'BETA', key: `beta-${sufex}` }], hasbeta: true,
|
|
||||||
activeKey: `beta-${sufex}`
|
|
||||||
});
|
|
||||||
payload.betaIps = payload.betaIps || payload.ips;
|
|
||||||
self.valueMap['beta'] = payload; //赋值beta
|
|
||||||
self.changeTab(`beta-${sufex}`);
|
|
||||||
}
|
|
||||||
if (activeKey === 'normal' && self.hasips === false) {
|
|
||||||
//如果是在normal面板选择了发布
|
|
||||||
self.valueMap['normal'] = payload; //赋值正式
|
|
||||||
}
|
|
||||||
if (activeKey === 'beta' && self.hasips === true) {
|
|
||||||
//如果是在beta面板继续beta发布
|
|
||||||
self.valueMap['beta'] = payload; //赋值beta
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_payload.isok = false;
|
|
||||||
_payload.message = res.message;
|
|
||||||
}
|
|
||||||
self.refs['success'].openDialog(_payload
|
|
||||||
);
|
|
||||||
},
|
|
||||||
error: function () { }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
validateChart(rule, value, callback) {
|
|
||||||
const chartReg = /[@#\$%\^&\*]+/g;
|
|
||||||
|
|
||||||
if (chartReg.test(value)) {
|
|
||||||
callback(aliwareIntl.get('com.alibaba.nacos.page.configeditor.vdchart'));
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
changeEnv(values) {
|
|
||||||
this.targetEnvs = values;
|
|
||||||
this.setState({
|
|
||||||
envvalues: values
|
|
||||||
});
|
|
||||||
}
|
|
||||||
changeBeta(selected) {
|
|
||||||
if (selected) {
|
|
||||||
this.betaips.style.display = 'block';
|
|
||||||
} else {
|
|
||||||
this.betaips.style.display = 'none';
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
checkedBeta: selected
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getIps(value) {
|
|
||||||
this.ips = value;
|
|
||||||
this.setState({
|
|
||||||
ips: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setConfigTags(value) {
|
|
||||||
if (value.length > 5) {
|
|
||||||
value.pop();
|
|
||||||
}
|
|
||||||
value.forEach((v, i) => {
|
|
||||||
if (v.indexOf(',') !== -1 || v.indexOf('=') !== -1) {
|
|
||||||
value.splice(i, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.setState({
|
|
||||||
config_tags: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
onInputUpdate(value) {
|
|
||||||
if (this.inputtimmer) {
|
|
||||||
clearTimeout(this.inputtimmer);
|
|
||||||
}
|
|
||||||
this.inputtimmer = setTimeout(() => {
|
|
||||||
let tagLst = this.state.tagLst,
|
|
||||||
hastag = false;
|
|
||||||
tagLst.forEach((v, i) => {
|
|
||||||
if (v.value === value) {
|
|
||||||
hastag = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!hastag) {
|
|
||||||
tagLst.push({
|
|
||||||
value: value,
|
|
||||||
label: value,
|
|
||||||
time: Math.random()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.setState({ tagLst: tagLst });
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
openDiff(hasips) {
|
|
||||||
this.hasips = hasips; //是否包含ips
|
|
||||||
let leftvalue = this.monacoEditor.getValue(); //this.commoneditor.doc.getValue();
|
|
||||||
let rightvalue = this.codeValue;
|
|
||||||
leftvalue = leftvalue.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
|
|
||||||
rightvalue = rightvalue.replace(/\r\n/g, "\n").replace(/\n/g, "\r\n");
|
|
||||||
//let rightvalue = this.diffeditor.doc.getValue();
|
|
||||||
//console.log(this.commoneditor, leftvalue==rightvalue)
|
|
||||||
this.refs['diffeditor'].openDialog(leftvalue, rightvalue);
|
|
||||||
}
|
|
||||||
changeTab(value) {
|
|
||||||
|
|
||||||
let self = this;
|
|
||||||
let key = value.split('-')[0];
|
|
||||||
|
|
||||||
let data = this.valueMap[key];
|
|
||||||
this.setState({
|
|
||||||
activeKey: value
|
|
||||||
});
|
|
||||||
self.field.setValue('dataId', data.dataId);
|
|
||||||
|
|
||||||
self.field.setValue('appName', self.inApp ? self.edasAppName : data.appName);
|
|
||||||
//self.field.setValue('envs', self.serverId);
|
|
||||||
self.field.setValue('group', data.group);
|
|
||||||
//self.field.setValue('md5', data.md5);
|
|
||||||
self.codeValue = data.content || '';
|
|
||||||
self.createCodeMirror('text', self.codeValue);
|
|
||||||
if (data.betaIps) {
|
|
||||||
self.getIps(data.betaIps);
|
|
||||||
self.changeBeta(true);
|
|
||||||
} else {
|
|
||||||
self.getIps('');
|
|
||||||
self.changeBeta(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newChangeConfig(value) {
|
|
||||||
this.setState({
|
|
||||||
configType: value
|
|
||||||
});
|
|
||||||
this.changeModel(value);
|
|
||||||
}
|
|
||||||
changeModel(type, value) {
|
|
||||||
if (!this.monacoEditor) {
|
|
||||||
$('#container').empty();
|
|
||||||
this.initMoacoEditor(type, value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let oldModel = this.monacoEditor.getModel();
|
|
||||||
let oldValue = this.monacoEditor.getValue();
|
|
||||||
let newModel = window.monaco.editor.createModel(oldValue, type);
|
|
||||||
this.monacoEditor.setModel(newModel);
|
|
||||||
if (oldModel) {
|
|
||||||
oldModel.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
render() {
|
|
||||||
const { init } = this.field;
|
|
||||||
const formItemLayout = {
|
|
||||||
labelCol: {
|
|
||||||
span: 2
|
|
||||||
},
|
|
||||||
wrapperCol: {
|
|
||||||
span: 22
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// const list = [{
|
|
||||||
// value: 0,
|
|
||||||
// label: 'TEXT'
|
|
||||||
// }, {
|
|
||||||
// value: 1,
|
|
||||||
// label: 'JSON'
|
|
||||||
// }, {
|
|
||||||
// value: 2,
|
|
||||||
// label: 'XML'
|
|
||||||
// }];
|
|
||||||
const list = [{
|
|
||||||
value: 'text',
|
|
||||||
label: 'TEXT'
|
|
||||||
}, {
|
|
||||||
value: 'json',
|
|
||||||
label: 'JSON'
|
|
||||||
}, {
|
|
||||||
value: 'xml',
|
|
||||||
label: 'XML'
|
|
||||||
}, {
|
|
||||||
value: 'yaml',
|
|
||||||
label: 'YAML'
|
|
||||||
}, {
|
|
||||||
value: 'html',
|
|
||||||
label: 'HTML'
|
|
||||||
}, {
|
|
||||||
value: 'properties',
|
|
||||||
label: 'Properties'
|
|
||||||
}];
|
|
||||||
let activeKey = this.state.activeKey.split('-')[0];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={{ padding: 10 }}>
|
|
||||||
<Loading shape="flower" style={{ position: 'relative', width: '100%' }} visible={this.state.loading} tip="Loading..." color="#333">
|
|
||||||
<h1 style={{ overflow: 'hidden', height: 50, width: '100%' }}>
|
|
||||||
<div>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.toedit')}</div>
|
|
||||||
|
|
||||||
</h1>
|
|
||||||
{this.state.hasbeta ? <div style={{ display: 'inline-block', height: 40, width: '80%', overflow: 'hidden' }}>
|
|
||||||
|
|
||||||
<Tab shape={'wrapped'} onChange={this.changeTab.bind(this)} lazyLoad={false} activeKey={this.state.activeKey}>
|
|
||||||
{this.state.tag.map(tab => <TabPane title={tab.title} key={tab.key}></TabPane>)}
|
|
||||||
</Tab>
|
|
||||||
|
|
||||||
</div> : ''}
|
|
||||||
|
|
||||||
<Form field={this.field}>
|
|
||||||
<FormItem label="Data ID:" {...formItemLayout}>
|
|
||||||
<Input disabled={true} {...init('dataId', {
|
|
||||||
rules: [{
|
|
||||||
required: true,
|
|
||||||
message: aliwareIntl.get('com.alibaba.nacos.page.configeditor.recipient_from')
|
|
||||||
}, { validator: this.validateChart.bind(this) }]
|
|
||||||
})} />
|
|
||||||
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label="Group:" {...formItemLayout}>
|
|
||||||
<Input disabled={true} {...init('group', {
|
|
||||||
rules: [{
|
|
||||||
required: true,
|
|
||||||
message: aliwareIntl.get('com.alibaba.nacos.page.configeditor.Home_application:')
|
|
||||||
}, { validator: this.validateChart.bind(this) }]
|
|
||||||
})} />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label="" {...formItemLayout}>
|
|
||||||
<div>
|
|
||||||
<a style={{ fontSize: '12px' }} onClick={this.toggleMore.bind(this)}>{this.state.showmore ? aliwareIntl.get('com.alibaba.nacos.page.configeditor.more_advanced_options') : aliwareIntl.get('com.alibaba.nacos.page.configeditor.group_is_not_empty')}</a>
|
|
||||||
</div>
|
|
||||||
</FormItem>
|
|
||||||
<div style={{ height: this.state.showmore ? 'auto' : '0', overflow: 'hidden' }}>
|
|
||||||
|
|
||||||
<FormItem label={aliwareIntl.get('nacos.page.configeditor.Tags')} {...formItemLayout}>
|
|
||||||
<Select size="medium" hasArrow style={{ width: '100%' }} autoWidth={true} multiple={true} mode="tag" filterLocal={true} placeholder={aliwareIntl.get('nacos.page.configurationManagement.Please_enter_tag')} dataSource={this.state.tagLst} value={this.state.config_tags} onChange={this.setConfigTags.bind(this)} hasClear language={aliwareIntl.currentLanguageCode}>
|
|
||||||
</Select>
|
|
||||||
</FormItem>
|
|
||||||
|
|
||||||
<FormItem label={aliwareIntl.get('com.alibaba.nacos.page.configeditor.the_target_environment:')} {...formItemLayout}>
|
|
||||||
<Input {...init('appName')} readOnly={!!this.inApp} />
|
|
||||||
</FormItem>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<FormItem label={aliwareIntl.get('nacos.page.configeditor.Description')} {...formItemLayout}>
|
|
||||||
<Input.TextArea htmlType="text" multiple rows={3} {...init('desc')} />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label={aliwareIntl.get('com.alibaba.nacos.page.configeditor.configure_contents_of')} {...formItemLayout}>
|
|
||||||
<RadioGroup dataSource={list} value={this.state.configType} onChange={this.newChangeConfig.bind(this)} />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label={<span style={{ marginRight: 5 }}>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.configcontent')}<Balloon trigger={<Icon type="help" size={'small'} style={{ color: '#1DC11D', marginRight: 5, verticalAlign: 'middle', marginTop: 2 }} />} align="t" style={{ marginRight: 5 }} triggerType="hover">
|
|
||||||
<p>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.Esc_exit')}</p>
|
|
||||||
<p>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.release_beta')}</p>
|
|
||||||
</Balloon>:</span>} {...formItemLayout}>
|
|
||||||
<div style={{ clear: 'both', height: 300 }} id="container"></div>
|
|
||||||
</FormItem>
|
|
||||||
<FormItem {...formItemLayout} label="">
|
|
||||||
<div style={{ textAlign: 'right' }}>
|
|
||||||
{activeKey === 'beta' ? <Button style={{ marginRight: 10 }} type="primary" onClick={this.openDiff.bind(this, true)}>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.release')}</Button> : ''}
|
|
||||||
{activeKey === 'normal' ? <Button type="primary" disabled={this.state.hasbeta} style={{ marginRight: 10 }} onClick={this.openDiff.bind(this, this.state.checkedBeta)}>{this.state.checkedBeta ? aliwareIntl.get('com.alibaba.nacos.page.configeditor.release') : aliwareIntl.get('com.alibaba.nacos.page.configeditor.return')}</Button> : <Button type="primary" style={{ marginRight: 10 }} onClick={this.openDiff.bind(this, false)}>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.return')}</Button>}
|
|
||||||
|
|
||||||
<Button type="normal" onClick={this.goList.bind(this)}>{aliwareIntl.get('com.alibaba.nacos.page.configeditor.')}</Button>
|
|
||||||
</div>
|
|
||||||
</FormItem>
|
|
||||||
</Form>
|
|
||||||
<DiffEditorDialog ref="diffeditor" publishConfig={this.publishConfig.bind(this)} />
|
|
||||||
<SuccessDialog ref="success" />
|
|
||||||
</Loading>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*****************************此行为标记行, 请勿删和修改此行, 主体代码请写在此行上面的class中, 组件导出语句及其他信息请写在此行下面*****************************/
|
|
||||||
export default ConfigEditor;
|
|
@ -1,666 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import BatchHandle from '../../../components/BatchHandle';
|
|
||||||
import RegionGroup from '../../../components/RegionGroup';
|
|
||||||
import ShowCodeing from '../../../components/ShowCodeing';
|
|
||||||
import DeleteDialog from '../../../components/DeleteDialog';
|
|
||||||
import CloneDialog from '../../../components/CloneDialog';
|
|
||||||
import ImportDialog from '../../../components/ImportDialog';
|
|
||||||
import ExportDialog from '../../../components/ExportDialog';
|
|
||||||
import { getParams, setParams, request, aliwareIntl } from '../../../globalLib';
|
|
||||||
import './index.less';
|
|
||||||
import { Button, Checkbox, Collapse, Dialog, Dropdown, Field, Form, Icon, Input, Loading, Menu, Pagination, Select, Slider, Table } from '@alifd/next';
|
|
||||||
const Accordion = Collapse;
|
|
||||||
const FormItem = Form.Item;
|
|
||||||
const { Panel } = Collapse;
|
|
||||||
|
|
||||||
/*****************************此行为标记行, 请勿删和修改此行, 文件和组件依赖请写在此行上面, 主体代码请写在此行下面的class中*****************************/
|
|
||||||
const DashboardCard = ({ data, height }) => <div>
|
|
||||||
{data.modeType === 'notice' ? <div data-spm-click={"gostr=/aliyun;locaid=notice"}><Slider style={{ marginBottom: data.modeList.length > 1 ? 20 : 10 }} arrows={false}>
|
|
||||||
{data.modeList.map((item, index) => <div key={index} className={"slider-img-wrapper"}>
|
|
||||||
<div className={"alert alert-success"} style={{ minHeight: 120, backgroundColor: '#e9feff' }}>
|
|
||||||
<div className={"alert-success-text"} style={{ fontWeight: 'bold' }}>{aliwareIntl.get("nacos.page.configurationManagement.Important_reminder0") /*重要提醒*/}</div>
|
|
||||||
<strong style={{ color: '#777a7e' }}>
|
|
||||||
<span>{item.title}</span>
|
|
||||||
</strong>
|
|
||||||
<strong>
|
|
||||||
<span><a style={{ marginLeft: 10, color: '#33cde5' }} href={item.url} target={"_blank"}>{aliwareIntl.get("nacos.page.configurationManagement.view_details1") /*查看详情*/}</a></span>
|
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
</div>)}
|
|
||||||
</Slider> </div> : <div className={"dash-card-contentwrappers"} style={{ height: height ? height : 'auto' }} data-spm-click={`gostr=/aliyun;locaid=${data.modeType}`}>
|
|
||||||
<h3 className={"dash-card-title"}>{data.modeName}</h3>
|
|
||||||
<div className={"dash-card-contentlist"}>
|
|
||||||
{data.modeList ? data.modeList.map(item => {
|
|
||||||
return <div className={"dash-card-contentitem"}>
|
|
||||||
<a href={item.url} target={"_blank"}>{item.title}</a>
|
|
||||||
{item.tag === 'new' ? <img style={{ width: 28, marginLeft: 2, verticalAlign: 'text-bottom' }} src={"//img.alicdn.com/tps/TB1pS2YMVXXXXcCaXXXXXXXXXXX-56-24.png"} alt="" /> : ''}
|
|
||||||
{item.tag === 'hot' ? <img style={{ width: 28, marginLeft: 2, verticalAlign: 'text-bottom' }} src={"//img.alicdn.com/tps/TB1nusxPXXXXXb0aXXXXXXXXXXX-56-24.png"} alt="" /> : ''}
|
|
||||||
</div>;
|
|
||||||
}) : ''}
|
|
||||||
</div>
|
|
||||||
</div>} </div>;
|
|
||||||
class ConfigurationManagement extends React.Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.field = new Field(this);
|
|
||||||
this.appName = getParams('appName') || getParams('edasAppId') || '';
|
|
||||||
this.preAppName = this.appName;
|
|
||||||
this.group = getParams('group') || '';
|
|
||||||
this.preGroup = this.group;
|
|
||||||
this.dataId = getParams('dataId') || '';
|
|
||||||
this.preDataId = this.dataId;
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
this.edasAppId = getParams('edasAppId') || '';
|
|
||||||
this.edasAppName = getParams('edasAppName') || '';
|
|
||||||
this.inApp = this.edasAppId;
|
|
||||||
this.state = {
|
|
||||||
value: "",
|
|
||||||
visible: false,
|
|
||||||
total: 0,
|
|
||||||
pageSize: 10,
|
|
||||||
currentPage: 1,
|
|
||||||
dataSource: [],
|
|
||||||
fieldValue: [],
|
|
||||||
showAppName: false,
|
|
||||||
showgroup: false,
|
|
||||||
dataId: this.dataId,
|
|
||||||
group: this.group,
|
|
||||||
appName: this.appName,
|
|
||||||
config_tags: [],
|
|
||||||
tagLst: [],
|
|
||||||
selectValue: [],
|
|
||||||
loading: false,
|
|
||||||
groupList: [],
|
|
||||||
groups: [],
|
|
||||||
tenant: true,
|
|
||||||
nownamespace_id: window.nownamespace || '',
|
|
||||||
nownamespace_name: window.namespaceShowName || '',
|
|
||||||
selectedRecord: [],
|
|
||||||
selectedKeys: [],
|
|
||||||
hasdash: false,
|
|
||||||
isCn: true,
|
|
||||||
contentList: [],
|
|
||||||
isAdvancedQuery: false,
|
|
||||||
isCheckAll: false
|
|
||||||
};
|
|
||||||
let obj = {
|
|
||||||
dataId: this.dataId || '',
|
|
||||||
group: this.preGroup || '',
|
|
||||||
appName: this.appName || ''
|
|
||||||
};
|
|
||||||
setParams(obj);
|
|
||||||
this.batchHandle = null;
|
|
||||||
this.toggleShowQuestionnaire = this.toggleShowQuestionnaire.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
// this.getGroup();
|
|
||||||
if (aliwareIntl.currentLanguageCode === 'zh-cn') {
|
|
||||||
// this.getContentList(); //在中文站获取概览页
|
|
||||||
this.setState({
|
|
||||||
isCn: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
isCn: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (window._getLink && window._getLink("isCn") === "true") {
|
|
||||||
if (!this.checkQuestionnaire()) {
|
|
||||||
if (window.location.host === 'acm.console.aliyun.com') {
|
|
||||||
Dialog.alert({
|
|
||||||
title: aliwareIntl.get("nacos.page.configurationManagement.questionnaire2") /*问卷调查*/
|
|
||||||
, style: {
|
|
||||||
width: '60%'
|
|
||||||
},
|
|
||||||
content: <div>
|
|
||||||
<div style={{ fontSize: '15px', lineHeight: '22px' }}>{aliwareIntl.get("nacos.page.configurationManagement.a_ACM_front-end_monitoring_questionnaire,_the_time_limit_to_receive_Ali_cloud_voucher_details_shoved_stamp_the3") /*答ACM前端监控调查问卷,限时领取阿里云代金券详情猛戳:*/}<a href={"https://survey.aliyun.com/survey/k0BjJ2ARC"} target={"_blank"}>{aliwareIntl.get("nacos.page.configurationManagement.questionnaire2") /*问卷调查*/}</a>
|
|
||||||
</div>
|
|
||||||
<div style={{ fontSize: '15px' }}>{aliwareIntl.get("nacos.page.configurationManagement.no_longer_display4") /*不再显示:*/}<Checkbox onChange={this.toggleShowQuestionnaire} />
|
|
||||||
</div>
|
|
||||||
</div>,
|
|
||||||
language: aliwareIntl.currentLanguageCode
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取概览页数据
|
|
||||||
*/
|
|
||||||
getContentList() {
|
|
||||||
|
|
||||||
request({
|
|
||||||
url: 'com.alibaba.nacos.service.dashlist', //以 com.alibaba. 开头最终会转换为真正的url地址
|
|
||||||
data: {},
|
|
||||||
$data: {}, //替换请求url路径中{}占位符的内容
|
|
||||||
success: res => {
|
|
||||||
console.log(res);
|
|
||||||
if (res.code === 200 && res.data) {
|
|
||||||
if (res.data.length === 0) {
|
|
||||||
this.setState({
|
|
||||||
hasdash: false
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
hasdash: true,
|
|
||||||
contentList: res.data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
toggleShowQuestionnaire(value) {
|
|
||||||
if (value) {
|
|
||||||
localStorage.setItem('acm_questionnaire', 1);
|
|
||||||
} else {
|
|
||||||
localStorage.removeItem('acm_questionnaire');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkQuestionnaire() {
|
|
||||||
|
|
||||||
let acm_questionnaire = localStorage.getItem('acm_questionnaire');
|
|
||||||
if (acm_questionnaire) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回车事件
|
|
||||||
*/
|
|
||||||
keyDownSearch(e) {
|
|
||||||
var theEvent = e || window.event;
|
|
||||||
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
|
|
||||||
if (code === 13) {
|
|
||||||
this.getData();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
navTo(url, record) {
|
|
||||||
|
|
||||||
this.serverId = getParams('serverId') || '';
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
this.props.history.push(`${url}?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${record.group}&namespace=${this.tenant}`);
|
|
||||||
}
|
|
||||||
openLoading() {
|
|
||||||
this.setState({
|
|
||||||
loading: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
closeLoading() {
|
|
||||||
this.setState({
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
UNSAFE_componentWillMount() {
|
|
||||||
window.addEventListener('keydown', this.keyDownSearch.bind(this), false);
|
|
||||||
}
|
|
||||||
componentWillUnMount() {
|
|
||||||
window.removeEventListener('keydown', this.keyDownSearch.bind(this));
|
|
||||||
}
|
|
||||||
onSearch() { }
|
|
||||||
|
|
||||||
onChange() { }
|
|
||||||
cleanAndGetData(needclean = false) {
|
|
||||||
if (needclean) {
|
|
||||||
this.dataId = '';
|
|
||||||
this.group = '';
|
|
||||||
this.setState({
|
|
||||||
group: '',
|
|
||||||
dataId: ''
|
|
||||||
});
|
|
||||||
setParams({
|
|
||||||
group: '',
|
|
||||||
dataId: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.getData();
|
|
||||||
}
|
|
||||||
getData(pageNo = 1, clearSelect = true) {
|
|
||||||
let self = this;
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
this.serverId = getParams('serverId') || '';
|
|
||||||
let urlPrefix = "";
|
|
||||||
if (this.dataId.indexOf("*") !== -1 || this
|
|
||||||
.group.indexOf("*") !== -1) {
|
|
||||||
urlPrefix = "/nacos/v1/cs/configs?search=blur";
|
|
||||||
} else {
|
|
||||||
urlPrefix = "/nacos/v1/cs/configs?search=accurate";
|
|
||||||
}
|
|
||||||
|
|
||||||
request({
|
|
||||||
url: `${urlPrefix}&dataId=${this.dataId}&group=${this.group}&appName=${this.appName}&config_tags=${this.state.config_tags || ''}&pageNo=${pageNo}&pageSize=${this.state.pageSize}`,
|
|
||||||
beforeSend: function () {
|
|
||||||
self.openLoading();
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
if (data != null) {
|
|
||||||
self.setState({
|
|
||||||
dataSource: data.pageItems,
|
|
||||||
total: data.totalCount,
|
|
||||||
currentPage: data.pageNumber
|
|
||||||
});
|
|
||||||
if (clearSelect) {
|
|
||||||
self.setState({
|
|
||||||
selectedRecord: [],
|
|
||||||
selectedKeys: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.setState({
|
|
||||||
tenant: self.tenant
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function (data) {
|
|
||||||
self.setState({
|
|
||||||
dataSource: [],
|
|
||||||
total: 0,
|
|
||||||
currentPage: 0
|
|
||||||
});
|
|
||||||
},
|
|
||||||
complete: function () {
|
|
||||||
self.closeLoading();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
showMore() { }
|
|
||||||
chooseNav(record, key) {
|
|
||||||
let self = this;
|
|
||||||
switch (key) {
|
|
||||||
case 'nav1':
|
|
||||||
self.navTo('/historyRollback', record);
|
|
||||||
break;
|
|
||||||
case 'nav2':
|
|
||||||
self.navTo('/pushTrajectory', record);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case 'nav3':
|
|
||||||
self.navTo('/listeningToQuery', record);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
removeConfig(record) {
|
|
||||||
let self = this;
|
|
||||||
Dialog.confirm({
|
|
||||||
language: aliwareIntl.currentLanguageCode || 'zh-cn',
|
|
||||||
title: aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.Remove_configuration'),
|
|
||||||
content: <div style={{ marginTop: '-20px' }}>
|
|
||||||
<h3>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.suredelete')}</h3>
|
|
||||||
<p>
|
|
||||||
<span style={{ color: '#999', marginRight: 5 }}>Data ID:</span>
|
|
||||||
<span style={{ color: '#c7254e' }}>
|
|
||||||
{record.dataId}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<span style={{ color: '#999', marginRight: 5 }}>Group:</span>
|
|
||||||
<span style={{ color: '#c7254e' }}>
|
|
||||||
{record.group}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<span style={{ color: '#999', marginRight: 5 }}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.environment')}</span>
|
|
||||||
<span style={{ color: '#c7254e' }}>
|
|
||||||
{self.serverId || ''}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>,
|
|
||||||
onOk: () => {
|
|
||||||
let url = `/nacos/v1/cs/configs?dataId=${record.dataId}&group=${record.group}`;
|
|
||||||
request({
|
|
||||||
url: url,
|
|
||||||
type: 'delete',
|
|
||||||
success: function (res) {
|
|
||||||
let _payload = {};
|
|
||||||
|
|
||||||
_payload.title = aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.configuration_management');
|
|
||||||
_payload.content = '';
|
|
||||||
_payload.dataId = record.dataId;
|
|
||||||
_payload.group = record.group;
|
|
||||||
if (res === true) {
|
|
||||||
_payload.isok = true;
|
|
||||||
} else {
|
|
||||||
_payload.isok = false;
|
|
||||||
_payload.message = res.message;
|
|
||||||
}
|
|
||||||
self.refs['delete'].openDialog(_payload);
|
|
||||||
self.getData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
renderLastTime(value, index, record) {
|
|
||||||
return <div>{aliwareIntl.intlNumberFormat(record.lastModifiedTime)}</div>;
|
|
||||||
}
|
|
||||||
showCode(record) {
|
|
||||||
this.refs['showcode'].openDialog(record);
|
|
||||||
}
|
|
||||||
renderCol(value, index, record) {
|
|
||||||
|
|
||||||
return <div>
|
|
||||||
<a onClick={this.goDetail.bind(this, record)} style={{ marginRight: 5 }}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.details')}</a>
|
|
||||||
<span style={{ marginRight: 5 }}>|</span>
|
|
||||||
<a style={{ marginRight: 5 }} onClick={this.showCode.bind(this, record)}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.the_sample_code')}</a>
|
|
||||||
<span style={{ marginRight: 5 }}>|</span>
|
|
||||||
<a style={{ marginRight: 5 }} onClick={this.goEditor.bind(this, record)}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.edit')}</a>
|
|
||||||
<span style={{ marginRight: 5 }}>|</span>
|
|
||||||
<a style={{ marginRight: 5 }} onClick={this.removeConfig.bind(this, record)}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.delete')}</a>
|
|
||||||
<span style={{ marginRight: 5 }}>|</span>
|
|
||||||
|
|
||||||
<Dropdown trigger={<span style={{ color: '#33cde5' }}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.more')}<Icon type={"arrow-down-filling"} size={'xxs'} /></span>} triggerType={"click"}>
|
|
||||||
<Menu onItemClick={this.chooseNav.bind(this, record)}>
|
|
||||||
<Menu.Item key={"nav1"}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.version')}</Menu.Item>
|
|
||||||
<Menu.Item key={"nav3"}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.listener_query')}</Menu.Item>
|
|
||||||
</Menu>
|
|
||||||
</Dropdown>
|
|
||||||
|
|
||||||
</div>;
|
|
||||||
}
|
|
||||||
changePage(value) {
|
|
||||||
this.setState({
|
|
||||||
currentPage: value
|
|
||||||
}, () => {
|
|
||||||
this.getData(value, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
handlePageSizeChange(pageSize) {
|
|
||||||
this.setState({
|
|
||||||
pageSize
|
|
||||||
}, () => {
|
|
||||||
this.changePage(1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
onInputUpdate() { }
|
|
||||||
chooseFieldChange(fieldValue) {
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
fieldValue
|
|
||||||
});
|
|
||||||
}
|
|
||||||
showSelect(value) {
|
|
||||||
this.setState({
|
|
||||||
selectValue: value
|
|
||||||
});
|
|
||||||
if (value.indexOf('appName') !== -1) {
|
|
||||||
this.setState({
|
|
||||||
showAppName: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
showAppName: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (value.indexOf('group') !== -1) {
|
|
||||||
this.setState({
|
|
||||||
showgroup: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
showgroup: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.chooseFieldChange(value);
|
|
||||||
}
|
|
||||||
getAppName(value) {
|
|
||||||
this.appName = value;
|
|
||||||
this.setState({
|
|
||||||
appName: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setAppName(value) {
|
|
||||||
this.appName = value;
|
|
||||||
this.setState({
|
|
||||||
appName: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getDataId(value) {
|
|
||||||
this.dataId = value;
|
|
||||||
this.setState({
|
|
||||||
dataId: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setConfigTags(value) {
|
|
||||||
this.setState({
|
|
||||||
config_tags: value
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* groupId赋值
|
|
||||||
*/
|
|
||||||
setGroup(value) {
|
|
||||||
this.group = value || '';
|
|
||||||
this.setState({
|
|
||||||
group: value || ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
selectAll() {
|
|
||||||
setParams('dataId', this.dataId);
|
|
||||||
setParams('group', this.group);
|
|
||||||
setParams('appName', this.appName);
|
|
||||||
this.getData();
|
|
||||||
}
|
|
||||||
resetAll() {
|
|
||||||
this.dataId = '';
|
|
||||||
this.appName = '';
|
|
||||||
this.group = '';
|
|
||||||
this.setState({
|
|
||||||
selectValue: [],
|
|
||||||
dataId: '',
|
|
||||||
appName: '',
|
|
||||||
group: '',
|
|
||||||
showAppName: false,
|
|
||||||
showgroup: false
|
|
||||||
});
|
|
||||||
this.selectAll();
|
|
||||||
}
|
|
||||||
chooseEnv(value) {
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
this.props.history.push(`/newconfig?serverId=${this.serverId || ''}&namespace=${this.tenant}&edasAppName=${this.edasAppName}&edasAppId=${this.edasAppId}&searchDataId=${this.dataId}&searchGroup=${this.group}`);
|
|
||||||
}
|
|
||||||
setNowNameSpace(name, id) {
|
|
||||||
this.setState({
|
|
||||||
nownamespace_name: name,
|
|
||||||
nownamespace_id: id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
goDetail(record) {
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
// 点击详情到另一个页面, 返回时候要保留原来的搜索条件 比如: record.dataId为详情的, this.dataId为搜索条件的.
|
|
||||||
this.props.history.push(`/configdetail?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${record.group}&namespace=${this.tenant}&edasAppName=${this.edasAppName}&searchDataId=${this.dataId}&searchGroup=${this.group}`);
|
|
||||||
}
|
|
||||||
goEditor(record) {
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
this.props.history.push(`/configeditor?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${record.group}&namespace=${this.tenant}&edasAppName=${this.edasAppName}&edasAppId=${this.edasAppId}&searchDataId=${this.dataId}&searchGroup=${this.group}`);
|
|
||||||
}
|
|
||||||
goConfigSync(record) {
|
|
||||||
this.serverId = getParams('serverId') || 'center';
|
|
||||||
this.tenant = getParams('namespace') || ''; //为当前实例保存tenant参数
|
|
||||||
this.props.history.push(`/configsync?serverId=${this.serverId || ''}&dataId=${record.dataId}&group=${record.group}&namespace=${this.tenant}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
onSelectChange(...args) {
|
|
||||||
let record = [];
|
|
||||||
console.log(args, 'args');
|
|
||||||
args[1].forEach(item => {
|
|
||||||
if (args[0].indexOf(item.id) >= 0 && this.state.selectedKeys.indexOf(item.id) < 0) {
|
|
||||||
record.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.state.selectedRecord.forEach(item => {
|
|
||||||
if (args[0].indexOf(item.id) >= 0) {
|
|
||||||
record.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.setState({
|
|
||||||
selectedRecord: record,
|
|
||||||
selectedKeys: args[0],
|
|
||||||
isCheckAll: record.length > 0 && record.length === this.state.dataSource.length
|
|
||||||
});
|
|
||||||
console.log(this.state, 'this.state');
|
|
||||||
}
|
|
||||||
|
|
||||||
onPageSelectAll(selected, records) {
|
|
||||||
console.log(this.refs["dataTable"].props.dataSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
getBatchFailedContent(res) {
|
|
||||||
return <div>
|
|
||||||
<div style={{ fontSize: 18, color: "#373D41", overflow: "auto" }}>{res.message}</div>
|
|
||||||
{"data" in res && res.data != null && <Accordion style={{ width: '500px' }}>
|
|
||||||
{"failedItems" in res.data && res.data.failedItems.length > 0 ? <Panel title={aliwareIntl.get('nacos.page.configurationManagement.failed_entry') + res.data.failedItems.length}>
|
|
||||||
<Table dataSource={res.data.failedItems} fixedHeader={true} maxBodyHeight={400} language={aliwareIntl.currentLanguageCode}>
|
|
||||||
<Table.Column title={'Data ID'} dataIndex={"dataId"} />
|
|
||||||
<Table.Column title={'Group'} dataIndex={"group"} />
|
|
||||||
</Table>
|
|
||||||
</Panel> : <Panel style={{ display: 'none' }} />}
|
|
||||||
{"succeededItems" in res.data && res.data.succeededItems.length > 0 ? <Panel title={aliwareIntl.get('nacos.page.configurationManagement.successful_entry') + res.data.succeededItems.length}>
|
|
||||||
<Table dataSource={res.data.succeededItems} fixedHeader={true} maxBodyHeight={400} language={aliwareIntl.currentLanguageCode}>
|
|
||||||
<Table.Column title={'Data ID'} dataIndex={"dataId"} />
|
|
||||||
<Table.Column title={'Group'} dataIndex={"group"} />
|
|
||||||
</Table>
|
|
||||||
</Panel> : <Panel style={{ display: 'none' }} />}
|
|
||||||
{"unprocessedItems" in res.data && res.data.unprocessedItems.length > 0 ? <Panel title={aliwareIntl.get('nacos.page.configurationManagement.unprocessed_entry') + res.data.unprocessedItems.length}>
|
|
||||||
<Table dataSource={res.data.unprocessedItems} fixedHeader={true} maxBodyHeight={400} language={aliwareIntl.currentLanguageCode}>
|
|
||||||
<Table.Column title={'Data ID'} dataIndex={"dataId"} />
|
|
||||||
<Table.Column title={'Group'} dataIndex={"group"} />
|
|
||||||
</Table>
|
|
||||||
</Panel> : <Panel style={{ display: 'none' }} />}
|
|
||||||
</Accordion>}
|
|
||||||
</div>;
|
|
||||||
}
|
|
||||||
onClickBatchHandle() {
|
|
||||||
this.batchHandle && this.batchHandle.openDialog({
|
|
||||||
serverId: this.serverId,
|
|
||||||
group: this.group,
|
|
||||||
dataId: this.dataId,
|
|
||||||
appName: this.appName,
|
|
||||||
config_tags: this.state.config_tags || '',
|
|
||||||
pageSize: this.state.pageSize
|
|
||||||
});
|
|
||||||
}
|
|
||||||
changeAdvancedQuery = () => {
|
|
||||||
this.setState({
|
|
||||||
isAdvancedQuery: !this.state.isAdvancedQuery
|
|
||||||
});
|
|
||||||
};
|
|
||||||
checkAllHandle(checked) {
|
|
||||||
this.setState({
|
|
||||||
isCheckAll: checked,
|
|
||||||
selectedKeys: checked ? this.state.dataSource.map(item => item.id) : [],
|
|
||||||
selectedRecord: checked ? this.state.dataSource : []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
render() {
|
|
||||||
const pubnodedata = aliwareIntl.get('pubnodata');
|
|
||||||
const locale = {
|
|
||||||
empty: pubnodedata
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<BatchHandle ref={ref => this.batchHandle = ref} />
|
|
||||||
<Loading shape={"flower"} style={{ position: 'relative', width: '100%', overflow: 'auto' }} visible={this.state.loading} tip={"Loading..."} color={"#333"}>
|
|
||||||
<div className={this.state.hasdash ? 'dash-page-container' : ''}>
|
|
||||||
<div className={this.state.hasdash ? 'dash-left-container' : ''} style={{ position: 'relative', padding: 10 }}>
|
|
||||||
<div style={{ display: this.inApp ? 'none' : 'block', marginTop: -15 }}>
|
|
||||||
<RegionGroup namespaceCallBack={this.cleanAndGetData.bind(this)} setNowNameSpace={this.setNowNameSpace.bind(this)} />
|
|
||||||
</div>
|
|
||||||
<div style={{ display: this.inApp ? 'none' : 'block', position: 'relative', width: '100%', overflow: 'hidden', height: '40px' }}>
|
|
||||||
<h3 style={{ height: 30, width: '100%', lineHeight: '30px', padding: 0, margin: 0, paddingLeft: 10, borderLeft: '3px solid #09c', color: '#ccc', fontSize: '12px' }}>
|
|
||||||
<span style={{ fontSize: '14px', color: '#000', marginRight: 8 }}>{aliwareIntl.get("nacos.page.configurationManagement.configuration_management8") /*配置管理*/}</span>
|
|
||||||
<span style={{ fontSize: '14px', color: '#000', marginRight: 8 }}>|</span>
|
|
||||||
<span style={{ fontSize: '14px', color: '#000', marginRight: 8 }}>{this.state.nownamespace_name}</span>
|
|
||||||
<span style={{ fontSize: '14px', color: '#000', marginRight: 18 }}>{this.state.nownamespace_id}</span>
|
|
||||||
{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.query_results')}
|
|
||||||
<strong style={{ fontWeight: 'bold' }}> {this.state.total} </strong>
|
|
||||||
{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.article_meet_the_requirements')}
|
|
||||||
</h3>
|
|
||||||
<div style={{ position: 'absolute', textAlign: 'right', zIndex: 2, right: 0, top: 0 }}>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style={{ position: 'relative', marginTop: 10, height: this.state.isAdvancedQuery ? 'auto' : 48, overflow: "hidden" }}>
|
|
||||||
<Form direction={"hoz"} inline>
|
|
||||||
<FormItem label={"Data ID:"}>
|
|
||||||
<Input htmlType={"text"} placeholder={aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.fuzzyd')} style={{ width: 200 }} value={this.state.dataId} onChange={this.getDataId.bind(this)} />
|
|
||||||
</FormItem>
|
|
||||||
|
|
||||||
<FormItem label={"Group:"}>
|
|
||||||
<Select.AutoComplete style={{ width: 200 }} size={"medium"} placeholder={aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.fuzzyg')} dataSource={this.state.groups} value={this.state.group} onChange={this.setGroup.bind(this)} hasClear language={aliwareIntl.currentLanguageCode}>
|
|
||||||
</Select.AutoComplete>
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label={""}>
|
|
||||||
<Button type={"primary"} style={{ marginRight: 10 }} onClick={this.selectAll.bind(this)} data-spm-click={"gostr=/aliyun;locaid=dashsearch"}>{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.query')}</Button>
|
|
||||||
</FormItem>
|
|
||||||
<FormItem style={this.inApp ? { display: "none" } : { verticalAlign: "middle", marginTop: 0, marginLeft: 10 }}>
|
|
||||||
<div style={{ color: '#33cde5', fontSize: 12, cursor: 'pointer' }} onClick={this.changeAdvancedQuery}>
|
|
||||||
<span style={{ marginRight: 5, lineHeight: "28px" }}>{aliwareIntl.get("nacos.page.configurationManagement.advanced_query9") /*高级查询*/}</span><Icon type={this.state.isAdvancedQuery ? 'arrow-up-filling' : 'arrow-down-filling'} size={'xs'} />
|
|
||||||
</div>
|
|
||||||
</FormItem>
|
|
||||||
<br />
|
|
||||||
<FormItem style={this.inApp ? { display: "none" } : {}} label={aliwareIntl.get("nacos.page.configurationManagement.HOME_Application0") /*归属应用:*/}>
|
|
||||||
<Input htmlType={"text"} placeholder={aliwareIntl.get("nacos.page.configurationManagement.Please_enter_the_name_of_the_app1") /*请输入应用名称*/} style={{ width: 200 }} value={this.state.appName} onChange={this.setAppName.bind(this)} />
|
|
||||||
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label={aliwareIntl.get('nacos.page.configurationManagement.Tags')}>
|
|
||||||
<Select style={{ width: 200 }} size={"medium"} hasArrow multiple={true} mode="tag" filterLocal={false} placeholder={aliwareIntl.get('nacos.page.configurationManagement.Please_enter_tag')} dataSource={this.state.tagLst} value={this.state.config_tags} onChange={this.setConfigTags.bind(this)} hasClear language={aliwareIntl.currentLanguageCode} />
|
|
||||||
</FormItem>
|
|
||||||
</Form>
|
|
||||||
<div style={{ position: 'absolute', right: 10, top: 4 }}>
|
|
||||||
<Icon type={"add"} size={'medium'} style={{ color: 'black', marginRight: 0, verticalAlign: 'middle', cursor: 'pointer', backgroundColor: '#eee', border: '1px solid #ddd', padding: '3px 6px' }} onClick={this.chooseEnv.bind(this)} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<Table dataSource={this.state.dataSource} locale={locale} fixedHeader={true} maxBodyHeight={400} language={aliwareIntl.currentLanguageCode} ref={"dataTable"}>
|
|
||||||
<Table.Column title={'Data Id'} dataIndex={"dataId"} />
|
|
||||||
<Table.Column title={'Group'} dataIndex={"group"} />
|
|
||||||
{!this.inApp ? <Table.Column title={aliwareIntl.get('nacos.page.configurationManagement.HOME_Application')} dataIndex={"appName"} /> : <div></div>}
|
|
||||||
<Table.Column title={aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.operation')} cell={this.renderCol.bind(this)} />
|
|
||||||
</Table>
|
|
||||||
{this.state.dataSource.length > 0 && <div style={{ marginTop: 10, overflow: "hidden" }}>
|
|
||||||
<Pagination style={{ float: "right" }} pageSizeList={[10, 20, 30]} pageSizeSelector={"dropdown"} onPageSizeChange={this.handlePageSizeChange.bind(this)} current={this.state.currentPage} language={aliwareIntl.currentLanguageCode || 'zh-cn'} total={this.state.total} pageSize={this.state.pageSize} onChange={this.changePage.bind(this)} />
|
|
||||||
</div>}
|
|
||||||
</div>
|
|
||||||
<ShowCodeing ref={"showcode"} />
|
|
||||||
<DeleteDialog ref={"delete"} />
|
|
||||||
<CloneDialog ref={"cloneDialog"} />
|
|
||||||
<ImportDialog ref={"importDialog"} />
|
|
||||||
<ExportDialog ref={"exportDialog"} />
|
|
||||||
</div>
|
|
||||||
{this.state.hasdash ? <div className={"dash-right-container"} style={{ overflow: 'auto', height: window.innerHeight - 40 }}>
|
|
||||||
{this.state.contentList.map((v, i) => {
|
|
||||||
return <DashboardCard data={v} height={'auto'} key={`show${i}`} />;
|
|
||||||
})}
|
|
||||||
</div> : ''}
|
|
||||||
</div>
|
|
||||||
</Loading>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
/*****************************此行为标记行, 请勿删和修改此行, 主体代码请写在此行上面的class中, 组件导出语句及其他信息请写在此行下面*****************************/
|
|
||||||
export default ConfigurationManagement;
|
|
6
pom.xml
6
pom.xml
@ -240,11 +240,11 @@
|
|||||||
<exclude>src/test/resources/*</exclude>
|
<exclude>src/test/resources/*</exclude>
|
||||||
<exclude>src/main/resources/static/**/*.js</exclude>
|
<exclude>src/main/resources/static/**/*.js</exclude>
|
||||||
<exclude>src/main/resources/**/*.svg</exclude>
|
<exclude>src/main/resources/**/*.svg</exclude>
|
||||||
<exclude>src/main/resources/static/public/css/console1412.css</exclude>
|
<exclude>src/main/resources/static/css/console1412.css</exclude>
|
||||||
<exclude>src/main/resources/static/js/vs/**/*</exclude>
|
<exclude>src/main/resources/static/js/vs/**/*</exclude>
|
||||||
<exclude>src/main/resources/static/console-fe/public/js/vs/editor/editor.main.css</exclude>
|
<exclude>src/main/resources/static/console-fe/public/js/vs/editor/editor.main.css</exclude>
|
||||||
<exclude>src/main/resources/static/console-fe/public/css/console1412.css</exclude>
|
<exclude>src/main/resources/static/console-fe/dist/js/vs/editor/editor.main.css</exclude>
|
||||||
<exclude>src/main/resources/static/console-fe/.vscode/settings.json</exclude>
|
<exclude>src/main/resources/static/console-fe/dist/*/*</exclude>
|
||||||
<exclude>bin/*</exclude>
|
<exclude>bin/*</exclude>
|
||||||
<exclude>conf/*</exclude>
|
<exclude>conf/*</exclude>
|
||||||
<exclude>derby.log</exclude>
|
<exclude>derby.log</exclude>
|
||||||
|
Loading…
Reference in New Issue
Block a user