mirror of https://github.com/openspug/spug
A web update
parent
dc4b1cd5bf
commit
7fbd22772f
|
@ -7,6 +7,11 @@ export default [
|
|||
{title: '模板管理', path: '/exec/template'},
|
||||
]
|
||||
},
|
||||
{
|
||||
icon: 'flag', title: '应用发布', child: [
|
||||
{title: '应用管理', path: '/deploy/app'},
|
||||
]
|
||||
},
|
||||
{icon: 'schedule', title: '任务计划', path: '/schedule'},
|
||||
{
|
||||
icon: 'deployment-unit', title: '配置中心', child: [
|
||||
|
|
|
@ -4,6 +4,7 @@ import http from 'libs/http';
|
|||
class Store {
|
||||
@observable records = [];
|
||||
@observable record = {};
|
||||
@observable idMap = {};
|
||||
@observable isFetching = false;
|
||||
@observable formVisible = false;
|
||||
|
||||
|
@ -12,7 +13,12 @@ class Store {
|
|||
fetchRecords = () => {
|
||||
this.isFetching = true;
|
||||
return http.get('/api/config/environment/')
|
||||
.then(res => this.records = res)
|
||||
.then(res => {
|
||||
this.records = res;
|
||||
for (let item of res) {
|
||||
this.idMap[item.id] = item
|
||||
}
|
||||
})
|
||||
.finally(() => this.isFetching = false)
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Modal, Card, Icon } from 'antd';
|
||||
import store from './store';
|
||||
import styles from './index.module.css';
|
||||
|
||||
@observer
|
||||
class AddSelect extends React.Component {
|
||||
switchExt1 = () => {
|
||||
store.addVisible = false;
|
||||
store.ext1Visible = true;
|
||||
};
|
||||
|
||||
switchExt2 = () => {
|
||||
store.addVisible = false;
|
||||
store.ext2Visible = true;
|
||||
};
|
||||
|
||||
render() {
|
||||
const modalStyle = {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-around',
|
||||
backgroundColor: 'rgba(240, 242, 245, 1)',
|
||||
padding: '80px 0'
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible
|
||||
width={800}
|
||||
maskClosable={false}
|
||||
title="选择发布方式"
|
||||
bodyStyle={modalStyle}
|
||||
onCancel={() => store.addVisible = false}
|
||||
footer={null}>
|
||||
<Card
|
||||
style={{width: 300, cursor: 'pointer'}}
|
||||
bodyStyle={{display: 'flex'}}
|
||||
onClick={this.switchExt1}>
|
||||
<div style={{marginRight: 16}}>
|
||||
<Icon type="ordered-list" style={{fontSize: 36, color: '#1890ff'}}/>
|
||||
</div>
|
||||
<div>
|
||||
<div className={styles.cardTitle}>常规发布</div>
|
||||
<div className={styles.cardDesc}>
|
||||
由 Spug 来控制发布的主流程,你可以通过添加钩子脚本来执行额外的自定义操作。
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card
|
||||
style={{width: 300, cursor: 'pointer'}}
|
||||
bodyStyle={{display: 'flex'}}
|
||||
onClick={this.switchExt2}>
|
||||
<div style={{marginRight: 16}}>
|
||||
<Icon type="build" style={{fontSize: 36, color: '#1890ff'}}/>
|
||||
</div>
|
||||
<div>
|
||||
<div className={styles.cardTitle}>自定义发布</div>
|
||||
<div className={styles.cardDesc}>
|
||||
你可以完全自己定义发布的所有流程和操作,Spug 负责按顺序依次执行你记录的动作。
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AddSelect
|
|
@ -0,0 +1,29 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Modal, Steps } from 'antd';
|
||||
import Setup1 from './Setup1';
|
||||
import Setup2 from './Setup2';
|
||||
import Setup3 from './Setup3';
|
||||
import store from './store';
|
||||
import styles from './index.module.css';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Modal
|
||||
visible
|
||||
width={800}
|
||||
maskClosable={false}
|
||||
title={store.record.id ? '编辑常规发布' : '新建常规发布'}
|
||||
onCancel={() => store.ext1Visible = false}
|
||||
footer={null}>
|
||||
<Steps current={store.page} className={styles.steps}>
|
||||
<Steps.Step key={0} title="基本配置"/>
|
||||
<Steps.Step key={1} title="目标集群"/>
|
||||
<Steps.Step key={2} title="任务配置"/>
|
||||
</Steps>
|
||||
{store.page === 0 && <Setup1/>}
|
||||
{store.page === 1 && <Setup2/>}
|
||||
{store.page === 2 && <Setup3/>}
|
||||
</Modal>
|
||||
)
|
||||
})
|
|
@ -0,0 +1,46 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Modal, message } from 'antd';
|
||||
import http from 'libs/http';
|
||||
import store from './store';
|
||||
|
||||
@observer
|
||||
class ComForm extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false,
|
||||
type: null,
|
||||
body: store.record['body'],
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
this.setState({loading: true});
|
||||
const formData = this.props.form.getFieldsValue();
|
||||
formData['id'] = store.record.id;
|
||||
formData['body'] = this.state.body;
|
||||
http.post('/api/exec/template/', formData)
|
||||
.then(res => {
|
||||
message.success('操作成功');
|
||||
store.formVisible = false;
|
||||
store.fetchRecords()
|
||||
}, () => this.setState({loading: false}))
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal
|
||||
visible
|
||||
width={800}
|
||||
maskClosable={false}
|
||||
title={store.record.id ? '编辑自定义发布' : '新建自定义发布'}
|
||||
onCancel={() => store.ext2Visible = false}
|
||||
footer={null}>
|
||||
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ComForm
|
|
@ -0,0 +1,68 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Switch, Col, Form, Input, Select, Button } from "antd";
|
||||
import envStore from 'pages/config/environment/store';
|
||||
import store from './store';
|
||||
|
||||
@observer
|
||||
class Setup1 extends React.Component {
|
||||
update = (key, value) => {
|
||||
store.record[key] = value
|
||||
};
|
||||
|
||||
render() {
|
||||
const info = store.record;
|
||||
const itemLayout = {
|
||||
labelCol: {span: 6},
|
||||
wrapperCol: {span: 14}
|
||||
};
|
||||
const itemTailLayout = {
|
||||
labelCol: {span: 6},
|
||||
wrapperCol: {span: 14, offset: 6}
|
||||
};
|
||||
return (
|
||||
<Form>
|
||||
<Form.Item {...itemLayout} required label="应用名称" help="相同应用不同环境,请保持应用名称相同,以便维护">
|
||||
<Input value={info.name} onChange={e => info.name = e.target.value} placeholder="请输入应用名称"/>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} required label="发布环境">
|
||||
<Col span={16}>
|
||||
<Select value={info.env_id} onChange={v => info.env_id = v} placeholder="请选择发布环境">
|
||||
{envStore.records.map(item => (
|
||||
<Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Col>
|
||||
<Col span={6} offset={2}>
|
||||
<Link to="/config/environment">新建环境</Link>
|
||||
</Col>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} required label="Git仓库地址">
|
||||
<Input value={info['git_repo']} onChange={e => info['git_repo'] = e.target.value} placeholder="请输入Git仓库地址"/>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} label="Tag/Branch">
|
||||
<Select value={info['git_type']} onChange={v => info['git_type'] = v}>
|
||||
<Select.Option value="branch">Branch(分支)</Select.Option>
|
||||
<Select.Option value="tag">Tag(标签 / 版本)</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} label="发布审核">
|
||||
<Switch
|
||||
checkedChildren="开启"
|
||||
unCheckedChildren="关闭"
|
||||
checked={info['is_audit']}
|
||||
onChange={v => info['is_audit'] = v}/>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemTailLayout}>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!(info.name && info.env_id && info['git_repo'])}
|
||||
onClick={() => store.page += 1}>下一步</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Form.create()(Setup1)
|
|
@ -0,0 +1,80 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Form, Input, Select, Button, Icon } from "antd";
|
||||
import envStore from 'pages/config/environment/store';
|
||||
import store from './store';
|
||||
import hostStore from 'pages/host/store';
|
||||
import styles from './index.module.css';
|
||||
|
||||
@observer
|
||||
class Setup1 extends React.Component {
|
||||
componentDidMount() {
|
||||
if (envStore.records.length === 0) {
|
||||
envStore.fetchRecords()
|
||||
}
|
||||
if (hostStore.records.length === 0) {
|
||||
hostStore.fetchRecords()
|
||||
}
|
||||
}
|
||||
|
||||
checkStatus = () => {
|
||||
const info = store.record;
|
||||
return info['dst_dir'] && info['dst_repo'] && info['versions'] && info['host_ids'].filter(x => x).length > 0
|
||||
};
|
||||
|
||||
render() {
|
||||
const info = store.record;
|
||||
const itemLayout = {
|
||||
labelCol: {span: 6},
|
||||
wrapperCol: {span: 14}
|
||||
};
|
||||
const itemTailLayout = {
|
||||
labelCol: {span: 6},
|
||||
wrapperCol: {span: 14, offset: 6}
|
||||
};
|
||||
return (
|
||||
<Form>
|
||||
<Form.Item {...itemLayout} required label="目标主机部署路径" help="目标主机的应用根目录,例如:/var/www/html">
|
||||
<Input value={info['dst_dir']} onChange={e => info['dst_dir'] = e.target.value} placeholder="请输入目标主机部署路径"/>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} required label="目标主机仓库路径" help="此目录用于存储应用的历史版本,例如:/data/spug/repos">
|
||||
<Input value={info['dst_repo']} onChange={e => info['dst_repo'] = e.target.value} placeholder="请输入目标主机仓库路径"/>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} required label="保留历史版本数量" help="早于指定数量的历史版本将无法回滚">
|
||||
<Input value={info['versions']} onChange={e => info['versions'] = e.target.value} placeholder="请输入保留历史版本数量"/>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemLayout} required label="发布目标主机">
|
||||
{info['host_ids'].map((id, index) => (
|
||||
<React.Fragment key={index}>
|
||||
<Select
|
||||
value={id}
|
||||
placeholder="请选择"
|
||||
style={{width: '80%', marginRight: 10}}
|
||||
onChange={v => store.editHost(index, v)}>
|
||||
{hostStore.records.map(item => (
|
||||
<Select.Option key={item.id} value={item.id} disabled={info['host_ids'].includes(item.id)}>
|
||||
{item.name}({item['hostname']}:{item['port']})
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
{info['host_ids'].length > 1 && (
|
||||
<Icon className={styles.delIcon} type="minus-circle-o" onClick={() => store.delHost(index)}/>
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</Form.Item>
|
||||
<Form.Item {...itemTailLayout}>
|
||||
<Button type="dashed" style={{width: '80%'}} onClick={store.addHost}>
|
||||
<Icon type="plus"/>添加执行对象
|
||||
</Button>
|
||||
</Form.Item>
|
||||
<Form.Item {...itemTailLayout}>
|
||||
<Button disabled={!this.checkStatus()} type="primary" onClick={() => store.page += 1}>下一步</Button>
|
||||
<Button style={{marginLeft: 20}} onClick={() => store.page -= 1}>上一步</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Setup1
|
|
@ -0,0 +1,161 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Form, Row, Col, Button, Radio, Icon, message } from "antd";
|
||||
import Editor from 'react-ace';
|
||||
import 'ace-builds/src-noconflict/mode-text';
|
||||
import 'ace-builds/src-noconflict/mode-sh';
|
||||
import 'ace-builds/src-noconflict/theme-tomorrow';
|
||||
import envStore from 'pages/config/environment/store';
|
||||
import store from './store';
|
||||
import http from 'libs/http';
|
||||
import hostStore from 'pages/host/store';
|
||||
import styles from './index.module.css';
|
||||
|
||||
@observer
|
||||
class Setup1 extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (envStore.records.length === 0) {
|
||||
envStore.fetchRecords()
|
||||
}
|
||||
if (hostStore.records.length === 0) {
|
||||
hostStore.fetchRecords()
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
this.setState({loading: true});
|
||||
const info = store.record;
|
||||
info['extend'] = '1';
|
||||
info['host_ids'] = info['host_ids'].filter(x => x);
|
||||
http.post('/api/app/', info)
|
||||
.then(() => {
|
||||
message.success('保存成功');
|
||||
store.fetchRecords();
|
||||
store.ext1Visible = false
|
||||
}, () => this.setState({loading: false}))
|
||||
};
|
||||
|
||||
FilterLabel = (props) => (
|
||||
<div style={{display: 'inline-block', height: 39}}>
|
||||
<span>文件过滤<span style={{margin: '0 8px 0 2px'}}>:</span></span>
|
||||
<Radio.Group
|
||||
style={{marginLeft: 20}}
|
||||
value={props.type}
|
||||
onChange={e => store.record['filter_rule']['type'] = e.target.value}>
|
||||
<Radio value="contain">包含</Radio>
|
||||
<Radio value="exclude">排除</Radio>
|
||||
</Radio.Group>
|
||||
</div>
|
||||
);
|
||||
|
||||
render() {
|
||||
const info = store.record;
|
||||
const itemTailLayout = {
|
||||
labelCol: {span: 6},
|
||||
wrapperCol: {span: 14, offset: 6}
|
||||
};
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Row>
|
||||
<Col span={11}>
|
||||
<Form.Item colon={false} label={<this.FilterLabel type={info['filter_rule']['type']}/>}>
|
||||
<Editor
|
||||
mode="text"
|
||||
theme="tomorrow"
|
||||
width="100%"
|
||||
height="100px"
|
||||
placeholder="每行一条规则"
|
||||
value={info['filter_rule']['data']}
|
||||
onChange={v => info['filter_rule']['data'] = v}
|
||||
style={{border: '1px solid #e8e8e8'}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="代码迁出前执行">
|
||||
<Editor
|
||||
mode="sh"
|
||||
theme="tomorrow"
|
||||
width="100%"
|
||||
height="100px"
|
||||
placeholder="输入要执行的命令"
|
||||
value={info['hook_pre_server']}
|
||||
onChange={v => info['hook_pre_server'] = v}
|
||||
style={{border: '1px solid #e8e8e8'}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="应用发布前执行">
|
||||
<Editor
|
||||
mode="sh"
|
||||
theme="tomorrow"
|
||||
width="100%"
|
||||
height="100px"
|
||||
placeholder="输入要执行的命令"
|
||||
value={info['hook_pre_host']}
|
||||
onChange={v => info['hook_pre_host'] = v}
|
||||
style={{border: '1px solid #e8e8e8'}}/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={2}>
|
||||
<div className={styles.deployBlock} style={{marginTop: 39}}>
|
||||
<Icon type="setting" style={{fontSize: 32}}/>
|
||||
<span style={{fontSize: 12, marginTop: 5}}>基础设置</span>
|
||||
</div>
|
||||
<div className={styles.deployBlock}>
|
||||
<Icon type="gitlab" style={{fontSize: 32}}/>
|
||||
<span style={{fontSize: 12, marginTop: 5}}>检出代码</span>
|
||||
</div>
|
||||
<div className={styles.deployBlock}>
|
||||
<Icon type="swap" style={{fontSize: 32}}/>
|
||||
<span style={{fontSize: 12, marginTop: 5}}>版本切换</span>
|
||||
</div>
|
||||
</Col>
|
||||
<Col span={11}>
|
||||
<Form.Item label="自定义全局变量">
|
||||
<Editor
|
||||
mode="text"
|
||||
theme="tomorrow"
|
||||
width="100%"
|
||||
height="100px"
|
||||
placeholder="每行一个,例如:HOME=/data/spug"
|
||||
value={info['custom_envs']}
|
||||
onChange={v => info['custom_envs'] = v}
|
||||
style={{border: '1px solid #e8e8e8'}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="代码迁出后执行">
|
||||
<Editor
|
||||
mode="sh"
|
||||
theme="tomorrow"
|
||||
width="100%"
|
||||
height="100px"
|
||||
placeholder="输入要执行的命令"
|
||||
value={info['hook_post_server']}
|
||||
onChange={v => info['hook_post_server'] = v}
|
||||
style={{border: '1px solid #e8e8e8'}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="应用发布后执行">
|
||||
<Editor
|
||||
mode="sh"
|
||||
theme="tomorrow"
|
||||
width="100%"
|
||||
height="100px"
|
||||
placeholder="输入要执行的命令"
|
||||
value={info['hook_post_host']}
|
||||
onChange={v => info['hook_post_host'] = v}
|
||||
style={{border: '1px solid #e8e8e8'}}/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
<Form.Item {...itemTailLayout}>
|
||||
<Button type="primary" onClick={this.handleSubmit}>提交</Button>
|
||||
<Button style={{marginLeft: 20}} onClick={() => store.page -= 1}>上一步</Button>
|
||||
</Form.Item>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Setup1
|
|
@ -0,0 +1,77 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Table, Divider, Modal, Tag, Icon, message } from 'antd';
|
||||
import http from 'libs/http';
|
||||
import store from './store';
|
||||
import { LinkButton } from "components";
|
||||
import envStore from 'pages/config/environment/store';
|
||||
import lds from 'lodash';
|
||||
|
||||
@observer
|
||||
class ComTable extends React.Component {
|
||||
componentDidMount() {
|
||||
store.fetchRecords();
|
||||
if (envStore.records.length === 0) {
|
||||
envStore.fetchRecords()
|
||||
}
|
||||
}
|
||||
|
||||
columns = [{
|
||||
title: '序号',
|
||||
key: 'series',
|
||||
render: (_, __, index) => index + 1,
|
||||
width: 80,
|
||||
}, {
|
||||
title: '应用名称',
|
||||
dataIndex: 'name',
|
||||
}, {
|
||||
title: '模式',
|
||||
dataIndex: 'extend',
|
||||
render: value => value === '1' ? <Icon style={{fontSize: 20, color: '#1890ff'}} type="ordered-list"/> :
|
||||
<Icon style={{fontSize: 20, color: '#1890ff'}} type="build"/>
|
||||
}, {
|
||||
title: '发布环境',
|
||||
dataIndex: 'env_id',
|
||||
render: value => lds.get(envStore.idMap, `${value}.name`)
|
||||
}, {
|
||||
title: '发布审核',
|
||||
dataIndex: 'is_audit',
|
||||
render: value => value ? <Tag color="green">开启</Tag> : <Tag color="red">关闭</Tag>
|
||||
}, {
|
||||
title: '操作',
|
||||
render: info => (
|
||||
<span>
|
||||
<LinkButton onClick={() => store.showForm(info)}>编辑</LinkButton>
|
||||
<Divider type="vertical"/>
|
||||
<LinkButton onClick={() => this.handleDelete(info)}>删除</LinkButton>
|
||||
</span>
|
||||
)
|
||||
}];
|
||||
|
||||
handleDelete = (text) => {
|
||||
Modal.confirm({
|
||||
title: '删除确认',
|
||||
content: `确定要删除【${text['name']}】?`,
|
||||
onOk: () => {
|
||||
return http.delete('/api/exec/template/', {params: {id: text.id}})
|
||||
.then(() => {
|
||||
message.success('删除成功');
|
||||
store.fetchRecords()
|
||||
})
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
render() {
|
||||
console.debug(JSON.stringify(envStore.idMap));
|
||||
let data = store.records;
|
||||
if (store.f_name) {
|
||||
data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase()))
|
||||
}
|
||||
return (
|
||||
<Table rowKey="id" loading={store.isFetching} dataSource={data} columns={this.columns}/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ComTable
|
|
@ -0,0 +1,31 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm } from 'components';
|
||||
import ComTable from './Table';
|
||||
import Ext1Form from './Ext1Form';
|
||||
import Ext2Form from './Ext2Form';
|
||||
import AddSelect from './AddSelect';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="任务名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
</SearchForm.Item>
|
||||
<SearchForm.Item span={8}>
|
||||
<Button type="primary" icon="sync" onClick={store.fetchRecords}>刷新</Button>
|
||||
</SearchForm.Item>
|
||||
</SearchForm>
|
||||
<div style={{marginBottom: 16}}>
|
||||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</div>
|
||||
<ComTable/>
|
||||
{store.addVisible && <AddSelect />}
|
||||
{store.ext1Visible && <Ext1Form />}
|
||||
{store.ext2Visible && <Ext2Form />}
|
||||
</Card>
|
||||
)
|
||||
})
|
|
@ -0,0 +1,39 @@
|
|||
.steps {
|
||||
width: 520px;
|
||||
margin: 0 auto 30px;
|
||||
}
|
||||
|
||||
.delIcon {
|
||||
font-size: 24px;
|
||||
position: relative;
|
||||
top: 4px
|
||||
}
|
||||
|
||||
.deployBlock {
|
||||
height: 100px;
|
||||
margin-top: 63px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cardBlock {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
background-color: rgba(240, 242, 245, 1);
|
||||
padding: 50px 0;
|
||||
}
|
||||
|
||||
.cardTitle {
|
||||
margin-bottom: 12px;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
color: rgba(0, 0, 0, .85);
|
||||
}
|
||||
|
||||
.cardDesc {
|
||||
height: 64px;
|
||||
overflow: hidden;
|
||||
color: rgba(0, 0, 0, .65);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
import { observable } from "mobx";
|
||||
import http from 'libs/http';
|
||||
|
||||
class Store {
|
||||
@observable records = [];
|
||||
@observable record = {};
|
||||
@observable page = 0;
|
||||
@observable isFetching = false;
|
||||
@observable addVisible = false;
|
||||
@observable ext1Visible = false;
|
||||
@observable ext2Visible = false;
|
||||
|
||||
@observable f_name;
|
||||
|
||||
initRecord = () => ({
|
||||
git_type: 'branch',
|
||||
is_audit: false,
|
||||
versions: 10,
|
||||
host_ids: [undefined],
|
||||
filter_rule: {type: 'contain', data: ''}
|
||||
});
|
||||
|
||||
fetchRecords = () => {
|
||||
this.isFetching = true;
|
||||
http.get('/api/app/')
|
||||
.then(res => this.records = res)
|
||||
.finally(() => this.isFetching = false)
|
||||
};
|
||||
|
||||
showForm = (info) => {
|
||||
this.page = 0;
|
||||
if (info) {
|
||||
if (info.extend === '1') {
|
||||
this.ext1Visible = true
|
||||
} else {
|
||||
this.ext2Visible = true
|
||||
}
|
||||
this.record = info
|
||||
} else {
|
||||
this.addVisible = true;
|
||||
this.record = this.initRecord()
|
||||
}
|
||||
};
|
||||
|
||||
addHost = () => {
|
||||
this.record['host_ids'].push(undefined)
|
||||
};
|
||||
|
||||
editHost = (index, v) => {
|
||||
this.record['host_ids'][index] = v
|
||||
};
|
||||
|
||||
delHost = (index) => {
|
||||
this.record['host_ids'].splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
export default new Store()
|
|
@ -0,0 +1,7 @@
|
|||
import { makeRoute } from "../../libs/router";
|
||||
import app from './app';
|
||||
|
||||
|
||||
export default [
|
||||
makeRoute('/app', app),
|
||||
]
|
|
@ -8,6 +8,7 @@ import scheduleRoutes from './pages/schedule/routes';
|
|||
import monitorRoutes from './pages/monitor/routes';
|
||||
import alarmRoutes from './pages/alarm/routes';
|
||||
import configRoutes from './pages/config/routes';
|
||||
import deployRoutes from './pages/deploy/routes';
|
||||
|
||||
|
||||
export default [
|
||||
|
@ -19,4 +20,5 @@ export default [
|
|||
makeModuleRoute('/monitor', monitorRoutes),
|
||||
makeModuleRoute('/alarm', alarmRoutes),
|
||||
makeModuleRoute('/config', configRoutes),
|
||||
makeModuleRoute('/deploy', deployRoutes),
|
||||
]
|
Loading…
Reference in New Issue