renamed backup

This commit is contained in:
silenceqi 2021-02-19 22:22:00 +08:00
parent 317fbd4e20
commit 2573bcaf92
9 changed files with 97 additions and 165 deletions

View File

@ -31,6 +31,7 @@ func (h *APIHandler) HandleCreateClusterAction(w http.ResponseWriter, req *http.
} }
// TODO validate data format // TODO validate data format
esClient := elastic.GetClient(h.Config.Elasticsearch) esClient := elastic.GetClient(h.Config.Elasticsearch)
esClient.
id := util.GetUUID() id := util.GetUUID()
conf.Created = time.Now() conf.Created = time.Now()
conf.Updated = conf.Created conf.Updated = conf.Created

View File

@ -28,7 +28,7 @@ export default [
{ {
path: '/cluster/overview', path: '/cluster/overview',
name: 'overview', name: 'overview',
component: './Cluster/ClusterList', component: './Cluster/Overview',
}, { }, {
path: '/cluster/monitoring/:name', path: '/cluster/monitoring/:name',
name: 'cluster', name: 'cluster',
@ -280,13 +280,13 @@ export default [
component: './SearchManage/template/Template', component: './SearchManage/template/Template',
}, },
{ {
path: '/backup/index', path: '/backup/bakandrestore',
name: 'index', name: 'index',
component: './SearchManage/template/Template', component: './Backup/BakAndRestore',
},{ },{
path: '/backup/lifecycle', path: '/backup/lifecycle',
name: 'lifecycle', name: 'lifecycle',
component: './SearchManage/template/Template', component: './Backup/BakCycle',
} }
] ]
}, },

View File

@ -1,35 +1,17 @@
import React, { Component,Fragment } from 'react'; import React, { Component,Fragment } from 'react';
import { connect } from 'dva'; 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; const { Option } = Select;
import { formatMessage, FormattedMessage } from 'umi/locale'; import { formatMessage, FormattedMessage } from 'umi/locale';
import StandardTable from '@/components/StandardTable'; import StandardTable from '@/components/StandardTable';
import styles from './BakAndRestore.less'; import styles from './BakAndRestore.less';
const FormItem = Form.Item;
const { TextArea } = Input;
const operationTabList = [
{
key: 'tab1',
tab: '快照',
},
{
key: 'tab2',
tab: '仓库',
}
];
@connect(({logstash,loading }) => ({ @connect(({ }) => ({
data: logstash.logstash,
loading: loading.models.logstash,
submitting: loading.effects['logstash/submitLogstashConfig'],
})) }))
@Form.create() @Form.create()
class BakAndRestore extends Component { class BakAndRestore extends Component {
state = { state = {
operationkey: 'tab1',
snapshotVisible: false, snapshotVisible: false,
repVisible: false,
}; };
componentDidMount() { componentDidMount() {
// message.loading('数据加载中..', 'initdata'); // message.loading('数据加载中..', 'initdata');
@ -38,9 +20,6 @@ class BakAndRestore extends Component {
// type: 'logstash/queryInitialLogstashConfig', // type: 'logstash/queryInitialLogstashConfig',
// }); // });
} }
onOperationTabChange = key => {
this.setState({ operationkey: key });
};
handleSnapshotClick(record){ handleSnapshotClick(record){
this.setState({ 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 (
<div>
<div style={{marginBottom: 10}}>
<Button icon="plus" type="primary" onClick={() => {}}>
新建
</Button>
</div>
<StandardTable
selectedRows={[]}
data={data}
columns={this.repoColumns}
/>
</div>
);
};
onCloseRep = () => {
this.setState({
repVisible: false,
});
};
snapshotColumns = [ snapshotColumns = [
{ {
title: '快照', title: '快照',
@ -164,12 +108,6 @@ class BakAndRestore extends Component {
}]; }];
snapshotTable = () =>{ snapshotTable = () =>{
var data = {
list: this.snapshotData,
pagination: {
pageSize: 5,
}
};
return ( return (
<div> <div>
<div style={{marginBottom: 10}}> <div style={{marginBottom: 10}}>
@ -177,10 +115,9 @@ class BakAndRestore extends Component {
新建 新建
</Button> </Button>
</div> </div>
<StandardTable <Table columns={this.snapshotColumns}
selectedRows={[]} dataSource={this.snapshotData}
data={data} bordered
columns={this.snapshotColumns}
/> />
</div> </div>
); );
@ -193,39 +130,14 @@ class BakAndRestore extends Component {
}; };
render() { render() {
const { operationkey } = this.state;
const contentList = {
tab1: (
<div>
{this.snapshotTable()}
</div>
),
tab2: (
<div>
{this.repoTable()}
<Drawer
title="仓库"
placement="right"
width={720}
onClose={this.onCloseRepo}
visible={this.state.repoVisible}
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Drawer>
</div>
)
};
return ( return (
<Fragment> <Fragment>
<Card <Card
className={styles.tabsCard}
bordered={false} bordered={false}
tabList={operationTabList}
onTabChange={this.onOperationTabChange}
> >
{contentList[operationkey]} <div>
{this.snapshotTable()}
</div>
</Card> </Card>
<Drawer <Drawer
title="快照" title="快照"

View File

@ -15,12 +15,9 @@ import {
Select, Select,
TimePicker, TimePicker,
Switch, Switch,
Icon, Icon, Table,
} from 'antd'; } from 'antd';
import moment from 'moment'; import moment from 'moment';
import StandardTable from '@/components/StandardTable';
import styles from '../../List/TableList.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TextArea } = Input; const { TextArea } = Input;
@ -400,36 +397,6 @@ class BakCycle extends PureComponent {
this.handleUpdateModalVisible(); this.handleUpdateModalVisible();
}; };
renderSimpleForm() {
const {
form: { getFieldDecorator },
} = this.props;
return (
<Form onSubmit={this.handleSearch} layout="inline">
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
<Col md={8} sm={24}>
<FormItem label="备份策略模板名称">
{getFieldDecorator('name')(<Input placeholder="请输入" />)}
</FormItem>
</Col>
<Col md={8} sm={24}>
<span className={styles.submitButtons}>
<Button type="primary" htmlType="submit">
查询
</Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
重置
</Button>
</span>
</Col>
</Row>
</Form>
);
}
renderForm() {
return this.renderSimpleForm();
}
handleNewClick = ()=>{ handleNewClick = ()=>{
this.setState({ this.setState({
drawerVisible: true, drawerVisible: true,
@ -443,42 +410,41 @@ class BakCycle extends PureComponent {
}; };
render() { render() {
const data = { const {
list: this.parseData(), form: { getFieldDecorator },
pagination: { } = this.props;
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,
};
return ( return (
<Fragment> <Fragment>
<Card bordered={false}> <Card bordered={false}>
<div className={styles.tableList}> <div >
<div className={styles.tableListForm}>{this.renderForm()}</div> <div>
<div className={styles.tableListOperator}> <Row gutter={{md:16, sm:8}}>
<Col md={16} lg={8}>
备份策略模板名称<Input style={{width:200}} placeholder="请输入" />
</Col>
<Col md={8} lg={16}>
<span>
<Button type="primary" htmlType="submit">
查询
</Button>
<Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}>
重置
</Button>
</span>
</Col>
</Row>
</div>
<div style={{marginBottom: 10, marginTop:10}}>
<Button icon="plus" type="primary" onClick={() => this.handleNewClick(true)}> <Button icon="plus" type="primary" onClick={() => this.handleNewClick(true)}>
新建 新建
</Button> </Button>
{selectedRows.length > 0 && (
<span>
<Button onClick={() => this.handleDeleteClick()}>删除</Button>
</span>
)}
</div> </div>
<StandardTable <Table
selectedRows={selectedRows} dataSource={this.parseData()}
data={data}
columns={this.columns} columns={this.columns}
onSelectRow={this.handleSelectRows} rowKey="name"
onChange={this.handleStandardTableChange} bordered
/> />
</div> </div>
</Card> </Card>

View File

@ -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) => (
<div>
<Link to='/cluster/monitoring'>{text}</Link>
</div>
),
},
{
title: '集群访问 URL',
dataIndex: 'endpoint'
},
{
title: '健康状态',
dataIndex: 'health'
},
{
title: '版本',
dataIndex: 'version'
},
{
title: '运行时长',
dataIndex: 'uptime',
render: (text, record) => (
moment.duration(text).humanize()
),
}
];
render() {
return (<Card>
<Table
bordered
dataSource={this.state.data}
columns={this.clusterColumns}
rowKey="id"
/>
</Card>)
}
}
export default Overview;

View File

@ -721,7 +721,7 @@ class Doucment extends React.Component {
keyword: value, keyword: value,
}).then(()=>{ }).then(()=>{
if(this.hashChanged){ if(this.hashChanged){
router.push(`/data/doc?cluster=${cluster}&index=${index}`); router.push(`/data/document?cluster=${cluster}&index=${index}`);
this.hashChanged = !this.hashChanged; this.hashChanged = !this.hashChanged;
} }
}) })

View File

@ -136,7 +136,7 @@ class RebuildList extends React.Component {
<Card> <Card>
<Form> <Form>
<Row gutter={{md:16, sm:8}}> <Row gutter={{md:16, sm:8}}>
<Col md={8} sm={10}> <Col md={10} sm={16}>
<Form.Item {...formItemLayout} label="Rebuild Name"> <Form.Item {...formItemLayout} label="Rebuild Name">
{getFieldDecorator('name')(<Input placeholder="please input rebuild name" />)} {getFieldDecorator('name')(<Input placeholder="please input rebuild name" />)}
</Form.Item> </Form.Item>