mirror of https://github.com/openspug/spug
U web update
parent
e7d911393a
commit
21eb3f27d3
|
@ -0,0 +1,12 @@
|
|||
import React from 'react';
|
||||
import {Card} from 'antd';
|
||||
import { hasPermission } from 'libs';
|
||||
|
||||
|
||||
export default function AuthCard(props) {
|
||||
let disabled = props.disabled === undefined ? false : props.disabled;
|
||||
if (props.auth && !hasPermission(props.auth)) {
|
||||
disabled = true;
|
||||
}
|
||||
return disabled ? null : <Card {...props}>{props.children}</Card>
|
||||
}
|
|
@ -3,6 +3,7 @@ import SearchForm from './SearchForm';
|
|||
import LinkButton from './LinkButton';
|
||||
import AuthButton from './AuthButton';
|
||||
import AuthLink from './AuthLink';
|
||||
import AuthCard from './AuthCard';
|
||||
import AuthDiv from './AuthDiv';
|
||||
import ACEditor from './ACEditor';
|
||||
|
||||
|
@ -12,6 +13,7 @@ export {
|
|||
LinkButton,
|
||||
AuthButton,
|
||||
AuthLink,
|
||||
AuthCard,
|
||||
AuthDiv,
|
||||
ACEditor,
|
||||
}
|
|
@ -30,10 +30,10 @@ export default [
|
|||
]
|
||||
},
|
||||
{
|
||||
icon: 'setting', title: '系统管理', child: [
|
||||
{title: '账户管理', path: '/system/account'},
|
||||
{title: '角色管理', path: '/system/role'},
|
||||
{title: '系统设置', path: '/system/setting'},
|
||||
icon: 'setting', title: '系统管理', auth: "system.account.view|system.role.view|system.setting.view", child: [
|
||||
{title: '账户管理', auth: 'system.account.view', path: '/system/account'},
|
||||
{title: '角色管理', auth: 'system.role.view', path: '/system/role'},
|
||||
{title: '系统设置', auth: 'system.setting.view', path: '/system/setting'},
|
||||
]
|
||||
},
|
||||
]
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm } from 'components';
|
||||
import { SearchForm, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="alarm.alarm.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="任务名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -17,6 +17,6 @@ export default observer(function () {
|
|||
</SearchForm.Item>
|
||||
</SearchForm>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="alarm.contact.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="姓名">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -20,6 +20,6 @@ export default observer(function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="alarm.group.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="组名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -20,6 +20,6 @@ export default observer(function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import ComForm from './Form';
|
||||
import Rel from './Rel';
|
||||
|
@ -9,7 +9,7 @@ import store from './store';
|
|||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="config.app.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="应用名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -24,6 +24,6 @@ export default observer(function () {
|
|||
<ComTable/>
|
||||
{store.formVisible && <ComForm/>}
|
||||
{store.relVisible && <Rel />}
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="config.env.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="环境名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -20,6 +20,6 @@ export default observer(function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<Card auth="config.src.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="服务名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import ComForm from './Form';
|
||||
import Ext1Form from './Ext1Form';
|
||||
|
@ -11,7 +11,7 @@ import store from './store';
|
|||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="deploy.app.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="应用名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -28,6 +28,6 @@ export default observer(function () {
|
|||
{store.addVisible && <AddSelect />}
|
||||
{store.ext1Visible && <Ext1Form />}
|
||||
{store.ext2Visible && <Ext2Form />}
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import SelectApp from './SelectApp';
|
||||
import Ext1Form from './Ext1Form';
|
||||
import Ext2Form from './Ext2Form';
|
||||
|
@ -11,7 +11,7 @@ import store from './store';
|
|||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="deploy.request.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="应用名称">
|
||||
<Input allowClear onChange={e => store.f_app_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -31,6 +31,6 @@ export default observer(function () {
|
|||
{store.ext1Visible && <Ext1Form/>}
|
||||
{store.ext2Visible && <Ext2Form/>}
|
||||
{store.approveVisible && <Approve/>}
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Form, Button, Tag } from 'antd';
|
||||
import { ACEditor } from 'components';
|
||||
import { ACEditor, AuthCard } from 'components';
|
||||
import HostSelector from './HostSelector';
|
||||
import TemplateSelector from './TemplateSelector';
|
||||
import ExecConsole from './ExecConsole';
|
||||
|
@ -29,7 +29,7 @@ class TaskIndex extends React.Component {
|
|||
render() {
|
||||
const {body, token} = this.state;
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="exec.task.do">
|
||||
<Form>
|
||||
<Form.Item label="执行主机">
|
||||
{store.hosts.map(item => (
|
||||
|
@ -48,7 +48,7 @@ class TaskIndex extends React.Component {
|
|||
{store.showHost && <HostSelector onCancel={store.switchHost} onOk={hosts => store.hosts = hosts}/>}
|
||||
{store.showTemplate && <TemplateSelector onCancel={store.switchTemplate} onOk={body => this.setState({body})}/>}
|
||||
{store.showConsole && <ExecConsole token={token} onCancel={store.switchConsole}/>}
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Select, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="exec.template.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="模板类型">
|
||||
<Select allowClear onChange={v => store.f_type = v} placeholder="请选择">
|
||||
|
@ -27,6 +27,6 @@ export default observer(function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Row, Col } from 'antd';
|
||||
import { AuthDiv } from 'components';
|
||||
import StatisticsCard from './StatisticCard';
|
||||
import AlarmTrend from './AlarmTrend';
|
||||
import RequestTop from './RequestTop';
|
||||
|
@ -8,7 +9,7 @@ import DeployPie from './DeployPie';
|
|||
class HomeIndex extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<AuthDiv auth="home.home.view">
|
||||
<StatisticsCard/>
|
||||
<AlarmTrend/>
|
||||
<Row style={{marginTop: 20}}>
|
||||
|
@ -19,7 +20,7 @@ class HomeIndex extends React.Component {
|
|||
<DeployPie/>
|
||||
</Col>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
</AuthDiv>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button, Select } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="host.host.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="主机类别">
|
||||
<Select allowClear placeholder="请选择" value={store.f_zone} onChange={v => store.f_zone = v}>
|
||||
|
@ -27,6 +27,6 @@ export default observer(function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -47,7 +47,7 @@ class LoginIndex extends React.Component {
|
|||
if (history.location.state && history.location.state['from']) {
|
||||
history.push(history.location.state['from'])
|
||||
} else {
|
||||
history.push('/home')
|
||||
history.push('/welcome')
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import { Card, Input, Select, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="monitor.monitor.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="任务名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -28,6 +28,6 @@ export default function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Select, Button } from 'antd';
|
||||
import { SearchForm, AuthDiv } from 'components';
|
||||
import { SearchForm, AuthDiv, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="schedule.schedule.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={6} title="状态">
|
||||
<Select allowClear onChange={v => store.f_status = v} placeholder="请选择">
|
||||
|
@ -37,6 +37,6 @@ export default observer(function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</AuthDiv>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,12 +1,12 @@
|
|||
import React from 'react';
|
||||
import { Card, Input, Select, Button } from 'antd';
|
||||
import { SearchForm } from 'components';
|
||||
import { SearchForm, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import store from './store';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="system.account.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="账户名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -25,6 +25,6 @@ export default function () {
|
|||
<Button type="primary" icon="plus" onClick={() => store.showForm()}>新建</Button>
|
||||
</div>
|
||||
<ComTable/>
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Card, Input, Button } from 'antd';
|
||||
import { SearchForm } from 'components';
|
||||
import { SearchForm, AuthCard } from 'components';
|
||||
import ComTable from './Table';
|
||||
import ComForm from './Form';
|
||||
import PagePerm from './PagePerm';
|
||||
|
@ -10,7 +10,7 @@ import store from './store';
|
|||
|
||||
export default observer(function () {
|
||||
return (
|
||||
<Card>
|
||||
<AuthCard auth="system.role.view">
|
||||
<SearchForm>
|
||||
<SearchForm.Item span={8} title="角色名称">
|
||||
<Input allowClear onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
|
||||
|
@ -26,6 +26,6 @@ export default observer(function () {
|
|||
{store.formVisible && <ComForm/>}
|
||||
{store.pagePermVisible && <PagePerm/>}
|
||||
{store.deployPermVisible && <DeployPerm/>}
|
||||
</Card>
|
||||
</AuthCard>
|
||||
)
|
||||
})
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Menu } from 'antd';
|
||||
import {AuthDiv} from 'components';
|
||||
import BasicSetting from './BasicSetting';
|
||||
import AlarmSetting from './AlarmSetting';
|
||||
import MailServer from './MailServer';
|
||||
|
@ -23,7 +24,7 @@ class Index extends React.Component {
|
|||
render() {
|
||||
const {selectedKeys} = this.state;
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<AuthDiv auth="system.setting.view" className={styles.container}>
|
||||
<div className={styles.left}>
|
||||
<Menu
|
||||
mode="inline"
|
||||
|
@ -42,7 +43,7 @@ class Index extends React.Component {
|
|||
{selectedKeys[0] === 'alarm' && <AlarmSetting />}
|
||||
{selectedKeys[0] === 'service' && <OpenService />}
|
||||
</div>
|
||||
</div>
|
||||
</AuthDiv>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import React from 'react';
|
||||
import {Card } from 'antd';
|
||||
|
||||
export default function (props) {
|
||||
return (
|
||||
<Card>
|
||||
<div>{localStorage.getItem('nickname')}, 欢迎你</div>
|
||||
</Card>
|
||||
)
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import { makeRoute } from 'libs/router';
|
||||
import Index from './index';
|
||||
|
||||
export default [
|
||||
makeRoute('', Index),
|
||||
]
|
|
@ -1,5 +1,6 @@
|
|||
import { makeModuleRoute } from "./libs/router";
|
||||
|
||||
import welcomeRoues from './pages/welcome/routes';
|
||||
import homeRoutes from './pages/home/routes';
|
||||
import hostRoutes from './pages/host/routes';
|
||||
import systemRoutes from './pages/system/routes';
|
||||
|
@ -12,6 +13,7 @@ import deployRoutes from './pages/deploy/routes';
|
|||
|
||||
|
||||
export default [
|
||||
makeModuleRoute('/welcome', welcomeRoues),
|
||||
makeModuleRoute('/home', homeRoutes),
|
||||
makeModuleRoute('/host', hostRoutes),
|
||||
makeModuleRoute('/system', systemRoutes),
|
||||
|
|
Loading…
Reference in New Issue