diff --git a/spug_web/src/components/AuthDiv.js b/spug_web/src/components/AuthDiv.js
index 55e7edc..d2ba2fe 100644
--- a/spug_web/src/components/AuthDiv.js
+++ b/spug_web/src/components/AuthDiv.js
@@ -3,6 +3,9 @@ import { hasPermission } from "../libs";
export default function AuthDiv(props) {
- const disabled = props.auth && !hasPermission(props.auth);
+ let disabled = props.disabled === undefined ? false : props.disabled;
+ if (props.auth && !hasPermission(props.auth)) {
+ disabled = true;
+ }
return disabled ? null :
{props.children}
}
\ No newline at end of file
diff --git a/spug_web/src/components/AuthLink.js b/spug_web/src/components/AuthLink.js
new file mode 100644
index 0000000..2d1b50c
--- /dev/null
+++ b/spug_web/src/components/AuthLink.js
@@ -0,0 +1,12 @@
+import React from 'react';
+import {Link} from 'react-router-dom';
+import { hasPermission } from 'libs';
+
+
+export default function AuthLink(props) {
+ let disabled = props.disabled;
+ if (props.auth && !hasPermission(props.auth)) {
+ disabled = true;
+ }
+ return {props.children}
+}
\ No newline at end of file
diff --git a/spug_web/src/components/index.js b/spug_web/src/components/index.js
index 48f5856..de26fda 100644
--- a/spug_web/src/components/index.js
+++ b/spug_web/src/components/index.js
@@ -2,6 +2,7 @@ import StatisticsCard from './StatisticsCard';
import SearchForm from './SearchForm';
import LinkButton from './LinkButton';
import AuthButton from './AuthButton';
+import AuthLink from './AuthLink';
import AuthDiv from './AuthDiv';
import ACEditor from './ACEditor';
@@ -10,6 +11,7 @@ export {
SearchForm,
LinkButton,
AuthButton,
+ AuthLink,
AuthDiv,
ACEditor,
}
\ No newline at end of file
diff --git a/spug_web/src/menus.js b/spug_web/src/menus.js
index c433c11..9fc7454 100644
--- a/spug_web/src/menus.js
+++ b/spug_web/src/menus.js
@@ -2,23 +2,23 @@ export default [
{icon: 'desktop', title: '工作台', path: '/home'},
{icon: 'cloud-server', title: '主机管理', auth: 'host.host.view', path: '/host'},
{
- icon: 'code', title: '批量执行', child: [
- {title: '执行任务', path: '/exec/task'},
- {title: '模板管理', path: '/exec/template'},
+ icon: 'code', title: '批量执行', auth: 'exec.task.do|exec.template.view', child: [
+ {title: '执行任务', auth: 'exec.task.do', path: '/exec/task'},
+ {title: '模板管理', auth: 'exec.template.view', path: '/exec/template'},
]
},
{
- icon: 'flag', title: '应用发布', child: [
- {title: '应用管理', path: '/deploy/app'},
- {title: '发布申请', path: '/deploy/request'},
+ icon: 'flag', title: '应用发布', auth: 'deploy.app.view|deploy.request.view', child: [
+ {title: '应用管理', auth: 'deploy.app.view', path: '/deploy/app'},
+ {title: '发布申请', auth: 'deploy.request.view', path: '/deploy/request'},
]
},
- {icon: 'schedule', title: '任务计划', path: '/schedule'},
+ {icon: 'schedule', title: '任务计划', auth: 'schedule.schedule.view', path: '/schedule'},
{
- icon: 'deployment-unit', title: '配置中心', child: [
- {title: '环境管理', path: '/config/environment'},
- {title: '服务配置', path: '/config/service'},
- {title: '应用配置', path: '/config/app'},
+ icon: 'deployment-unit', title: '配置中心', auth: 'config.env.view|config.src.view|config.app.view', child: [
+ {title: '环境管理', auth: 'config.env.view', path: '/config/environment'},
+ {title: '服务配置', auth: 'config.src.view', path: '/config/service'},
+ {title: '应用配置', auth: 'config.app.view', path: '/config/app'},
]
},
{icon: 'monitor', title: '监控中心', path: '/monitor'},
diff --git a/spug_web/src/pages/config/app/Rel.js b/spug_web/src/pages/config/app/Rel.js
index 773faa0..6aa9986 100644
--- a/spug_web/src/pages/config/app/Rel.js
+++ b/spug_web/src/pages/config/app/Rel.js
@@ -1,7 +1,7 @@
import React from 'react';
import {observer} from 'mobx-react';
import {Modal, Form, Transfer, message, Tabs, Alert} from 'antd';
-import http from 'libs/http';
+import { http, hasPermission } from 'libs';
import serviceStore from '../service/store';
import store from './store';
@@ -51,6 +51,7 @@ class Rel extends React.Component {
title="配置依赖关系"
onCancel={() => store.relVisible = false}
confirmLoading={this.state.loading}
+ footer={hasPermission('config.app.edit_config') ? undefined : null}
onOk={this.handleSubmit}>
(
- store.showForm(info)}>编辑
+ store.showForm(info)}>编辑
- this.handleDelete(info)}>删除
+ this.handleDelete(info)}>删除
- store.showRel(info)}>依赖
+ store.showRel(info)}>依赖
- 配置
+ 配置
)
}];
diff --git a/spug_web/src/pages/config/app/index.js b/spug_web/src/pages/config/app/index.js
index f587e37..1c0f302 100644
--- a/spug_web/src/pages/config/app/index.js
+++ b/spug_web/src/pages/config/app/index.js
@@ -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, AuthDiv } from 'components';
import ComTable from './Table';
import ComForm from './Form';
import Rel from './Rel';
@@ -18,9 +18,9 @@ export default observer(function () {
-
+
{store.formVisible && }
{store.relVisible && }
diff --git a/spug_web/src/pages/config/setting/JSONView.js b/spug_web/src/pages/config/setting/JSONView.js
index f207530..407f730 100644
--- a/spug_web/src/pages/config/setting/JSONView.js
+++ b/spug_web/src/pages/config/setting/JSONView.js
@@ -1,9 +1,10 @@
import React from 'react';
import { observer } from 'mobx-react';
-import { Button, message} from 'antd';
+import { Button, message } from 'antd';
import Editor from 'react-ace';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-tomorrow';
+import { AuthButton } from 'components';
import { http } from 'libs';
import store from './store';
@@ -60,12 +61,13 @@ class JSONView extends React.Component {
style={{fontSize: 14}}
value={body}
onChange={v => this.setState({body: v})}/>
- {readOnly && }
+ onClick={() => this.setState({readOnly: false})}>编辑}
{readOnly || }
+ onBack={() => history.goBack()}/>
+
+
+
+
+
+
+
+
+ }>
+ {lds.get(store.outputs, 'local.data')}
- ))}
-
-
+
+
+ }>
+ {store.request.targets.map((item, index) => (
+
+ {item.title}
+
+
+
+
+
+
+ }>
+ {lds.get(store.outputs, `${item.id}.data`)}
+
+ ))}
+
+
+
)
}
}
diff --git a/spug_web/src/pages/deploy/do/Ext2Index.js b/spug_web/src/pages/deploy/do/Ext2Index.js
index c685e11..d51d55c 100644
--- a/spug_web/src/pages/deploy/do/Ext2Index.js
+++ b/spug_web/src/pages/deploy/do/Ext2Index.js
@@ -2,6 +2,7 @@ import React from 'react';
import { observer } from 'mobx-react';
import { Steps, Collapse, PageHeader, Spin, Tag, Button, Icon } from 'antd';
import http from 'libs/http';
+import { AuthDiv } from 'components';
import history from 'libs/history';
import styles from './index.module.css';
import store from './store';
@@ -87,53 +88,55 @@ class Ext1Index extends React.Component {
render() {
const {app_name, env_name, status, server_actions, host_actions} = store.request;
return (
-
- 发布}
- onBack={() => history.goBack()}/>
-
-
-
-
- {server_actions.map((item, index) => (
-
- ))}
- }>
- {lds.get(store.outputs, 'local.data')}
-
-
-
- {host_actions.length > 0 && (
- }>
- {store.request.targets.map((item, index) => (
-
- {item.title}
-
-
- {host_actions.map((action, index) => (
-
- ))}
-
- }>
- {lds.get(store.outputs, `${item.id}.data`)}
-
- ))}
+
+
+ 发布}
+ onBack={() => history.goBack()}/>
+
+
+
+
+ {server_actions.map((item, index) => (
+
+ ))}
+ }>
+ {lds.get(store.outputs, 'local.data')}
+
- )}
- {host_actions.length === 0 && this.state.fetching === false && (
- 无目标主机动作
- )}
-
+
+ {host_actions.length > 0 && (
+ }>
+ {store.request.targets.map((item, index) => (
+
+ {item.title}
+
+
+ {host_actions.map((action, index) => (
+
+ ))}
+
+ }>
+ {lds.get(store.outputs, `${item.id}.data`)}
+
+ ))}
+
+ )}
+ {host_actions.length === 0 && this.state.fetching === false && (
+ 无目标主机动作
+ )}
+
+
)
}
}
diff --git a/spug_web/src/pages/deploy/request/Table.js b/spug_web/src/pages/deploy/request/Table.js
index da58beb..5b4b742 100644
--- a/spug_web/src/pages/deploy/request/Table.js
+++ b/spug_web/src/pages/deploy/request/Table.js
@@ -1,10 +1,9 @@
import React from 'react';
-import { Link } from 'react-router-dom';
import { observer } from 'mobx-react';
import { Table, Divider, Modal, Icon, Popover, Tag, message } from 'antd';
import http from 'libs/http';
import store from './store';
-import { LinkButton } from "components";
+import { LinkButton, AuthLink } from "components";
@observer
class ComTable extends React.Component {
@@ -81,37 +80,39 @@ class ComTable extends React.Component {
switch (info.status) {
case '-3':
return
- 发布
+ 发布
this.handleRollback(info)}>回滚
;
case '3':
return this.handleRollback(info)}>回滚;
case '-1':
return
- store.showForm(info)}>编辑
+ store.showForm(info)}>编辑
- this.handleDelete(info)}>删除
+ this.handleDelete(info)}>删除
;
case '0':
return
- store.showApprove(info)}>审核
+ store.showApprove(info)}>审核
- store.showForm(info)}>编辑
+ store.showForm(info)}>编辑
- this.handleDelete(info)}>删除
+ this.handleDelete(info)}>删除
;
case '1':
return
- 发布
+ 发布
- this.handleDelete(info)}>删除
+ this.handleDelete(info)}>删除
;
default:
return null
diff --git a/spug_web/src/pages/deploy/request/index.js b/spug_web/src/pages/deploy/request/index.js
index cd11aac..2925f7a 100644
--- a/spug_web/src/pages/deploy/request/index.js
+++ b/spug_web/src/pages/deploy/request/index.js
@@ -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, AuthDiv } from 'components';
import SelectApp from './SelectApp';
import Ext1Form from './Ext1Form';
import Ext2Form from './Ext2Form';
@@ -23,9 +23,9 @@ export default observer(function () {
刷新
-
+
store.addVisible = true}>新建发布申请
-
+
{store.addVisible && }
{store.ext1Visible && }
diff --git a/spug_web/src/pages/exec/template/Table.js b/spug_web/src/pages/exec/template/Table.js
index 99fda65..386796e 100644
--- a/spug_web/src/pages/exec/template/Table.js
+++ b/spug_web/src/pages/exec/template/Table.js
@@ -13,11 +13,6 @@ class ComTable extends React.Component {
}
columns = [{
- title: '序号',
- key: 'series',
- render: (_, __, index) => index + 1,
- width: 80,
- }, {
title: '模版名称',
dataIndex: 'name',
}, {
@@ -35,9 +30,9 @@ class ComTable extends React.Component {
title: '操作',
render: info => (
- store.showForm(info)}>编辑
+ store.showForm(info)}>编辑
- this.handleDelete(info)}>删除
+ this.handleDelete(info)}>删除
)
}];
diff --git a/spug_web/src/pages/exec/template/index.js b/spug_web/src/pages/exec/template/index.js
index 78fbfd7..a7ac594 100644
--- a/spug_web/src/pages/exec/template/index.js
+++ b/spug_web/src/pages/exec/template/index.js
@@ -1,7 +1,7 @@
import React from 'react';
import { observer } from 'mobx-react';
import { Card, Input, Select, Button } from 'antd';
-import { SearchForm } from 'components';
+import { SearchForm, AuthDiv } from 'components';
import ComTable from './Table';
import store from './store';
@@ -23,9 +23,9 @@ export default observer(function () {
刷新
-
+
)
diff --git a/spug_web/src/pages/schedule/Table.js b/spug_web/src/pages/schedule/Table.js
index 73ad2c7..a26b0fc 100644
--- a/spug_web/src/pages/schedule/Table.js
+++ b/spug_web/src/pages/schedule/Table.js
@@ -19,11 +19,11 @@ class ComTable extends React.Component {
moreMenus = (info) => (
);
@@ -67,7 +67,7 @@ class ComTable extends React.Component {
store.showInfo(info)}>详情
- store.showForm(info)}>编辑
+ store.showForm(info)}>编辑
this.moreMenus(info)} trigger={['click']}>
diff --git a/spug_web/src/pages/schedule/index.js b/spug_web/src/pages/schedule/index.js
index abcfc43..66269e2 100644
--- a/spug_web/src/pages/schedule/index.js
+++ b/spug_web/src/pages/schedule/index.js
@@ -1,7 +1,7 @@
import React from 'react';
import { observer } from 'mobx-react';
import { Card, Input, Select, Button } from 'antd';
-import { SearchForm } from 'components';
+import { SearchForm, AuthDiv } from 'components';
import ComTable from './Table';
import store from './store';
@@ -33,9 +33,9 @@ export default observer(function () {
刷新
-
+
)
diff --git a/spug_web/src/pages/system/role/codes.js b/spug_web/src/pages/system/role/codes.js
index 196c1e0..e10b413 100644
--- a/spug_web/src/pages/system/role/codes.js
+++ b/spug_web/src/pages/system/role/codes.js
@@ -51,6 +51,7 @@ export default [{
{key: 'add', label: '新建申请'},
{key: 'edit', label: '编辑申请'},
{key: 'del', label: '删除申请'},
+ {key: 'approve', label: '审核申请'},
{key: 'do', label: '执行发布'}
]
}]
@@ -80,7 +81,7 @@ export default [{
{key: 'del', label: '删除环境'}
]
}, {
- key: 'service',
+ key: 'src',
label: '服务管理',
perms: [
{key: 'view', label: '查看服务'},