mirror of https://github.com/openspug/spug
upgrade permissions
parent
615a3d1b46
commit
502557c95a
|
@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { Drawer, Descriptions, List, Button, Input, Select, DatePicker, Tag, message } from 'antd';
|
import { Drawer, Descriptions, List, Button, Input, Select, DatePicker, Tag, message } from 'antd';
|
||||||
import { EditOutlined, SaveOutlined, PlusOutlined, SyncOutlined } from '@ant-design/icons';
|
import { EditOutlined, SaveOutlined, PlusOutlined, SyncOutlined } from '@ant-design/icons';
|
||||||
|
import { AuthButton } from 'components';
|
||||||
import { http } from 'libs';
|
import { http } from 'libs';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
import lds from 'lodash';
|
import lds from 'lodash';
|
||||||
|
@ -136,7 +137,7 @@ export default observer(function () {
|
||||||
<Button key="1" type="link" loading={fetching} icon={<SyncOutlined/>} onClick={handleFetch}>同步</Button>,
|
<Button key="1" type="link" loading={fetching} icon={<SyncOutlined/>} onClick={handleFetch}>同步</Button>,
|
||||||
<Button key="2" type="link" loading={loading} icon={<SaveOutlined/>} onClick={handleSubmit}>保存</Button>
|
<Button key="2" type="link" loading={loading} icon={<SaveOutlined/>} onClick={handleSubmit}>保存</Button>
|
||||||
]) : (
|
]) : (
|
||||||
<Button type="link" icon={<EditOutlined/>} onClick={() => setEdit(true)}>编辑</Button>
|
<AuthButton auth="host.host.edit" type="link" icon={<EditOutlined/>} onClick={() => setEdit(true)}>编辑</AuthButton>
|
||||||
)}
|
)}
|
||||||
title={<span style={{fontWeight: 500}}>扩展信息</span>}>
|
title={<span style={{fontWeight: 500}}>扩展信息</span>}>
|
||||||
<Descriptions.Item label="实例ID">
|
<Descriptions.Item label="实例ID">
|
||||||
|
|
|
@ -12,9 +12,10 @@ import {
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
CopyOutlined,
|
CopyOutlined,
|
||||||
ScissorOutlined
|
ScissorOutlined,
|
||||||
|
LoadingOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { LoadingOutlined } from '@ant-design/icons';
|
import { AuthFragment } from 'components';
|
||||||
import { hasPermission, http } from 'libs';
|
import { hasPermission, http } from 'libs';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
import lds from 'lodash';
|
import lds from 'lodash';
|
||||||
|
@ -108,7 +109,7 @@ export default observer(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRightClick(v) {
|
function handleRightClick(v) {
|
||||||
if (hasPermission('host.group.edit')) {
|
if (hasPermission('admin')) {
|
||||||
store.group = v.node;
|
store.group = v.node;
|
||||||
setVisible(true)
|
setVisible(true)
|
||||||
}
|
}
|
||||||
|
@ -147,12 +148,14 @@ export default observer(function () {
|
||||||
<Card
|
<Card
|
||||||
title="分组列表"
|
title="分组列表"
|
||||||
loading={store.grpFetching}
|
loading={store.grpFetching}
|
||||||
extra={<Switch
|
extra={(
|
||||||
disabled={!hasPermission('host.group.edit')}
|
<AuthFragment auth="admin">
|
||||||
checked={draggable}
|
<Switch
|
||||||
onChange={setDraggable}
|
checked={draggable}
|
||||||
checkedChildren="排版"
|
onChange={setDraggable}
|
||||||
unCheckedChildren="浏览"/>}>
|
checkedChildren="排版"
|
||||||
|
unCheckedChildren="浏览"/>
|
||||||
|
</AuthFragment>)}>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
overlay={menus}
|
overlay={menus}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default observer(function () {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthDiv auth="host.host.view">
|
<AuthDiv auth="host.host.view">
|
||||||
<Breadcrumb extra={<AuthButton auth="host.host.console" type="primary" icon={<CodeOutlined/>} onClick={openTerminal}>Web 终端</AuthButton>}>
|
<Breadcrumb extra={<AuthButton auth="host.console.view" type="primary" icon={<CodeOutlined/>} onClick={openTerminal}>Web 终端</AuthButton>}>
|
||||||
<Breadcrumb.Item>首页</Breadcrumb.Item>
|
<Breadcrumb.Item>首页</Breadcrumb.Item>
|
||||||
<Breadcrumb.Item>主机管理</Breadcrumb.Item>
|
<Breadcrumb.Item>主机管理</Breadcrumb.Item>
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
HomeOutlined,
|
HomeOutlined,
|
||||||
UploadOutlined
|
UploadOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
|
import { AuthButton, Action } from 'components';
|
||||||
import { http, uniqueId, X_TOKEN } from 'libs';
|
import { http, uniqueId, X_TOKEN } from 'libs';
|
||||||
import lds from 'lodash';
|
import lds from 'lodash';
|
||||||
import styles from './index.module.less'
|
import styles from './index.module.less'
|
||||||
|
@ -62,18 +63,18 @@ class FileManager extends React.Component {
|
||||||
title: '属性',
|
title: '属性',
|
||||||
key: 'attr',
|
key: 'attr',
|
||||||
render: info => `${info.kind}${info.code}`,
|
render: info => `${info.kind}${info.code}`,
|
||||||
width: 120
|
width: 110
|
||||||
}, {
|
}, {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 80,
|
width: 100,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
render: info => info.kind === '-' ? (
|
render: info => info.kind === '-' ? (
|
||||||
<React.Fragment>
|
<Action>
|
||||||
<DownloadOutlined style={{color: '#1890ff'}} onClick={() => this.handleDownload(info.name)}/>
|
<Action.Button icon={<DownloadOutlined/>} onClick={() => this.handleDownload(info.name)}/>
|
||||||
<Divider type="vertical"/>
|
<Action.Button auth="host.console.del" danger icon={<DeleteOutlined/>}
|
||||||
<DeleteOutlined style={{color: 'red'}} onClick={() => this.handleDelete(info.name)}/>
|
onClick={() => this.handleDelete(info.name)}/>
|
||||||
</React.Fragment>
|
</Action>
|
||||||
) : null
|
) : null
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -210,8 +211,13 @@ class FileManager extends React.Component {
|
||||||
checkedChildren="开启"
|
checkedChildren="开启"
|
||||||
unCheckedChildren="关闭"
|
unCheckedChildren="关闭"
|
||||||
onChange={v => this.setState({showDot: v})}/>
|
onChange={v => this.setState({showDot: v})}/>
|
||||||
<Button style={{marginLeft: 10}} size="small" type="primary" icon={<UploadOutlined/>}
|
<AuthButton
|
||||||
onClick={this.handleUpload}>上传文件</Button>
|
auth="host.console.upload"
|
||||||
|
style={{marginLeft: 10}}
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
icon={<UploadOutlined/>}
|
||||||
|
onClick={this.handleUpload}>上传文件</AuthButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.state.uploading && (
|
{this.state.uploading && (
|
||||||
|
|
|
@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { Tabs, Tree, Button, Spin } from 'antd';
|
import { Tabs, Tree, Button, Spin } from 'antd';
|
||||||
import { FolderOutlined, FolderOpenOutlined, CloudServerOutlined } from '@ant-design/icons';
|
import { FolderOutlined, FolderOpenOutlined, CloudServerOutlined } from '@ant-design/icons';
|
||||||
import { NotFound } from 'components';
|
import { NotFound, AuthButton } from 'components';
|
||||||
import Terminal from './Terminal';
|
import Terminal from './Terminal';
|
||||||
import FileManager from './FileManager';
|
import FileManager from './FileManager';
|
||||||
import { http, hasPermission } from 'libs';
|
import { http, hasPermission } from 'libs';
|
||||||
|
@ -103,11 +103,13 @@ function WebSSH(props) {
|
||||||
type="editable-card"
|
type="editable-card"
|
||||||
onTabClick={key => setActiveId(key)}
|
onTabClick={key => setActiveId(key)}
|
||||||
onEdit={handleRemove}
|
onEdit={handleRemove}
|
||||||
tabBarExtraContent={<Button
|
tabBarExtraContent={<AuthButton
|
||||||
|
auth="host.console.list"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
disabled={!activeId}
|
||||||
style={{marginRight: 5}}
|
style={{marginRight: 5}}
|
||||||
onClick={() => setVisible(true)}
|
onClick={() => setVisible(true)}
|
||||||
icon={<FolderOpenOutlined/>}>文件管理器</Button>}>
|
icon={<FolderOpenOutlined/>}>文件管理器</AuthButton>}>
|
||||||
{hosts.map(item => (
|
{hosts.map(item => (
|
||||||
<Tabs.TabPane key={item.id} tab={item.title}>
|
<Tabs.TabPane key={item.id} tab={item.title}>
|
||||||
<Terminal id={item.id} activeId={activeId}/>
|
<Terminal id={item.id} activeId={activeId}/>
|
||||||
|
|
Loading…
Reference in New Issue