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
esClient := elastic.GetClient(h.Config.Elasticsearch)
esClient.
id := util.GetUUID()
conf.Created = time.Now()
conf.Updated = conf.Created

View File

@ -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',
}
]
},

View File

@ -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 (
<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 = [
{
title: '快照',
@ -164,12 +108,6 @@ class BakAndRestore extends Component {
}];
snapshotTable = () =>{
var data = {
list: this.snapshotData,
pagination: {
pageSize: 5,
}
};
return (
<div>
<div style={{marginBottom: 10}}>
@ -177,11 +115,10 @@ class BakAndRestore extends Component {
新建
</Button>
</div>
<StandardTable
selectedRows={[]}
data={data}
columns={this.snapshotColumns}
/>
<Table columns={this.snapshotColumns}
dataSource={this.snapshotData}
bordered
/>
</div>
);
};
@ -193,39 +130,14 @@ class BakAndRestore extends Component {
};
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 (
<Fragment>
<Card
className={styles.tabsCard}
bordered={false}
tabList={operationTabList}
onTabChange={this.onOperationTabChange}
>
{contentList[operationkey]}
<div>
{this.snapshotTable()}
</div>
</Card>
<Drawer
title="快照"

View File

@ -15,12 +15,9 @@ import {
Select,
TimePicker,
Switch,
Icon,
Icon, Table,
} from 'antd';
import moment from 'moment';
import StandardTable from '@/components/StandardTable';
import styles from '../../List/TableList.less';
const FormItem = Form.Item;
const { TextArea } = Input;
@ -400,36 +397,6 @@ class BakCycle extends PureComponent {
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 = ()=>{
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 (
<Fragment>
<Card bordered={false}>
<div className={styles.tableList}>
<div className={styles.tableListForm}>{this.renderForm()}</div>
<div className={styles.tableListOperator}>
<div >
<div>
<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>
{selectedRows.length > 0 && (
<span>
<Button onClick={() => this.handleDeleteClick()}>删除</Button>
</span>
)}
</div>
<StandardTable
selectedRows={selectedRows}
data={data}
<Table
dataSource={this.parseData()}
columns={this.columns}
onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange}
rowKey="name"
bordered
/>
</div>
</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,
}).then(()=>{
if(this.hashChanged){
router.push(`/data/doc?cluster=${cluster}&index=${index}`);
router.push(`/data/document?cluster=${cluster}&index=${index}`);
this.hashChanged = !this.hashChanged;
}
})

View File

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