Skip to content

Commit

Permalink
[#54]Remove the create button in node page when the user is operator
Browse files Browse the repository at this point in the history
Signed-off-by: fengyang_sy <fengyang.09186@h3c.com>
  • Loading branch information
fengyangsy committed Nov 19, 2019
1 parent 7295c24 commit df01004
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/dashboard/src/pages/Operator/Node/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import moment from 'moment';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import StandardTable from '@/components/StandardTable';
import styles from '../styles.less';
import { getAuthority } from '@/utils/authority';

const FormItem = Form.Item;
const { Option } = Select;
Expand Down Expand Up @@ -350,6 +351,8 @@ class Node extends PureComponent {
render() {
const { selectedRows, registerUserFormVisible, targetNodeId } = this.state;

const userRole = getAuthority()[0];

const {
node: { nodes, pagination },
loadingNodes,
Expand Down Expand Up @@ -485,9 +488,12 @@ class Node extends PureComponent {
<Card bordered={false}>
<div className={styles.tableList}>
<div className={styles.tableListOperator}>
<Button icon="plus" type="primary" onClick={() => router.push('/operator/node/new')}>
<FormattedMessage id="form.button.new" defaultMessage="New" />
</Button>
{
userRole !== 'operator' &&
<Button icon="plus" type="primary" onClick={() => router.push('/operator/node/new')}>
<FormattedMessage id="form.button.new" defaultMessage="New" />
</Button>
}
</div>
<StandardTable
selectedRows={selectedRows}
Expand Down

0 comments on commit df01004

Please sign in to comment.