From 2573bcaf92bf419a2d5496cc79071bf7bcbdd366 Mon Sep 17 00:00:00 2001 From: silenceqi Date: Fri, 19 Feb 2021 22:22:00 +0800 Subject: [PATCH] renamed backup --- api/system/cluster_config.go | 1 + web/config/router.config.js | 8 +- .../{DataManagement => Backup}/Backup.js | 0 .../backup => Backup}/BakAndRestore.js | 106 ++---------------- .../backup => Backup}/BakAndRestore.less | 0 .../backup => Backup}/BakCycle.js | 90 +++++---------- web/src/pages/Cluster/Overview.js | 53 +++++++++ web/src/pages/DataManagement/Document.js | 2 +- web/src/pages/Synchronize/RebuildList.js | 2 +- 9 files changed, 97 insertions(+), 165 deletions(-) rename web/src/pages/{DataManagement => Backup}/Backup.js (100%) rename web/src/pages/{DataManagement/backup => Backup}/BakAndRestore.js (65%) rename web/src/pages/{DataManagement/backup => Backup}/BakAndRestore.less (100%) rename web/src/pages/{DataManagement/backup => Backup}/BakCycle.js (86%) create mode 100644 web/src/pages/Cluster/Overview.js diff --git a/api/system/cluster_config.go b/api/system/cluster_config.go index 3370d006..49fd434e 100644 --- a/api/system/cluster_config.go +++ b/api/system/cluster_config.go @@ -31,6 +31,7 @@ func (h *APIHandler) HandleCreateClusterAction(w http.ResponseWriter, req *http. } // TODO validate data format esClient := elastic.GetClient(h.Config.Elasticsearch) + esClient. id := util.GetUUID() conf.Created = time.Now() conf.Updated = conf.Created diff --git a/web/config/router.config.js b/web/config/router.config.js index 8a68b37b..fc6c109d 100644 --- a/web/config/router.config.js +++ b/web/config/router.config.js @@ -28,7 +28,7 @@ export default [ { path: '/cluster/overview', name: 'overview', - component: './Cluster/ClusterList', + component: './Cluster/Overview', }, { path: '/cluster/monitoring/:name', name: 'cluster', @@ -280,13 +280,13 @@ export default [ component: './SearchManage/template/Template', }, { - path: '/backup/index', + path: '/backup/bakandrestore', name: 'index', - component: './SearchManage/template/Template', + component: './Backup/BakAndRestore', },{ path: '/backup/lifecycle', name: 'lifecycle', - component: './SearchManage/template/Template', + component: './Backup/BakCycle', } ] }, diff --git a/web/src/pages/DataManagement/Backup.js b/web/src/pages/Backup/Backup.js similarity index 100% rename from web/src/pages/DataManagement/Backup.js rename to web/src/pages/Backup/Backup.js diff --git a/web/src/pages/DataManagement/backup/BakAndRestore.js b/web/src/pages/Backup/BakAndRestore.js similarity index 65% rename from web/src/pages/DataManagement/backup/BakAndRestore.js rename to web/src/pages/Backup/BakAndRestore.js index 6d9eb90c..9dd873ff 100644 --- a/web/src/pages/DataManagement/backup/BakAndRestore.js +++ b/web/src/pages/Backup/BakAndRestore.js @@ -1,35 +1,17 @@ import React, { Component,Fragment } from 'react'; import { connect } from 'dva'; -import { Card,Form,Input, Select,Button,message,Divider,Drawer,Descriptions } from 'antd'; +import {Card, Form, Input, Select, Button, message, Divider, Drawer, Descriptions, Table} from 'antd'; const { Option } = Select; import { formatMessage, FormattedMessage } from 'umi/locale'; import StandardTable from '@/components/StandardTable'; import styles from './BakAndRestore.less'; -const FormItem = Form.Item; -const { TextArea } = Input; -const operationTabList = [ - { - key: 'tab1', - tab: '快照', - }, - { - key: 'tab2', - tab: '仓库', - } - ]; -@connect(({logstash,loading }) => ({ - data: logstash.logstash, - loading: loading.models.logstash, - submitting: loading.effects['logstash/submitLogstashConfig'], +@connect(({ }) => ({ })) - @Form.create() class BakAndRestore extends Component { state = { - operationkey: 'tab1', snapshotVisible: false, - repVisible: false, }; componentDidMount() { // message.loading('数据加载中..', 'initdata'); @@ -38,9 +20,6 @@ class BakAndRestore extends Component { // type: 'logstash/queryInitialLogstashConfig', // }); } - onOperationTabChange = key => { - this.setState({ operationkey: key }); - }; handleSnapshotClick(record){ this.setState({ @@ -75,41 +54,6 @@ class BakAndRestore extends Component { ), }, ]; - - repoData = [{ - id: "my_local_repo", - dateCreated: "2020-10-09 20:30:23", - }]; - - repoTable = () =>{ - var data = { - list: this.repoData, - pagination: { - pageSize: 5, - } - }; - return ( -
-
- -
- -
- ); - }; - - onCloseRep = () => { - this.setState({ - repVisible: false, - }); - }; - snapshotColumns = [ { title: '快照', @@ -164,12 +108,6 @@ class BakAndRestore extends Component { }]; snapshotTable = () =>{ - var data = { - list: this.snapshotData, - pagination: { - pageSize: 5, - } - }; return (
@@ -177,11 +115,10 @@ class BakAndRestore extends Component { 新建
- + ); }; @@ -193,39 +130,14 @@ class BakAndRestore extends Component { }; render() { - const { operationkey } = this.state; - const contentList = { - tab1: ( -
- {this.snapshotTable()} -
- ), - tab2: ( -
- {this.repoTable()} - -

Some contents...

-

Some contents...

-

Some contents...

-
-
- ) - }; return ( - {contentList[operationkey]} +
+ {this.snapshotTable()} +
- -
- - {getFieldDecorator('name')()} - - - - - - - - - - - ); - } - - renderForm() { - return this.renderSimpleForm(); - } handleNewClick = ()=>{ this.setState({ drawerVisible: true, @@ -443,42 +410,41 @@ class BakCycle extends PureComponent { }; render() { - const data = { - list: this.parseData(), - pagination: { - pageSize: 5, - }, - }; - const { selectedRows, modalVisible, updateModalVisible, updateFormValues } = this.state; - const parentMethods = { - handleAdd: this.handleAdd, - handleModalVisible: this.handleModalVisible, - }; - const updateMethods = { - handleUpdateModalVisible: this.handleUpdateModalVisible, - handleUpdate: this.handleUpdate, - }; + const { + form: { getFieldDecorator }, + } = this.props; + return ( -
-
{this.renderForm()}
-
+
+
+ +
+ 备份策略模板名称: + + + + + + + + + +
- {selectedRows.length > 0 && ( - - - - )}
- diff --git a/web/src/pages/Cluster/Overview.js b/web/src/pages/Cluster/Overview.js new file mode 100644 index 00000000..aa4ad126 --- /dev/null +++ b/web/src/pages/Cluster/Overview.js @@ -0,0 +1,53 @@ +import React, {Fragment} from 'react'; +import {Card, Divider, Popconfirm, Table} from "antd"; +import Link from "_umi@2.13.16@umi/link"; +import moment from "moment"; + +class Overview extends React.Component { + state = { + data: [{id:"JFpIbacZQamv9hkgQEDZ2Q", name:"single-es", endpoint:"http://localhost:9200", health: "green", version: "7.10.0", uptime:"320883955"}] + } + + clusterColumns = [ + { + title: '名称', + dataIndex: 'name', + render: (text, record) => ( +
+ {text} +
+ ), + }, + { + title: '集群访问 URL', + dataIndex: 'endpoint' + }, + { + title: '健康状态', + dataIndex: 'health' + }, + { + title: '版本', + dataIndex: 'version' + }, + { + title: '运行时长', + dataIndex: 'uptime', + render: (text, record) => ( + moment.duration(text).humanize() + ), + } + ]; + render() { + return ( +
+ ) + } +} + +export default Overview; \ No newline at end of file diff --git a/web/src/pages/DataManagement/Document.js b/web/src/pages/DataManagement/Document.js index 59eb674e..b829a1a4 100644 --- a/web/src/pages/DataManagement/Document.js +++ b/web/src/pages/DataManagement/Document.js @@ -721,7 +721,7 @@ class Doucment extends React.Component { keyword: value, }).then(()=>{ if(this.hashChanged){ - router.push(`/data/doc?cluster=${cluster}&index=${index}`); + router.push(`/data/document?cluster=${cluster}&index=${index}`); this.hashChanged = !this.hashChanged; } }) diff --git a/web/src/pages/Synchronize/RebuildList.js b/web/src/pages/Synchronize/RebuildList.js index 64656f5d..99d1dbdb 100644 --- a/web/src/pages/Synchronize/RebuildList.js +++ b/web/src/pages/Synchronize/RebuildList.js @@ -136,7 +136,7 @@ class RebuildList extends React.Component {
-
+ {getFieldDecorator('name')()}