pull/330/head
vapao 2021-05-21 18:02:50 +08:00
parent 2def2cc504
commit 8bb828a4cb
9 changed files with 74 additions and 61 deletions

View File

@ -30,6 +30,7 @@ def merge_children(data, prefix, childes):
def filter_by_perm(data, result, ids):
for item in data:
if 'children' in item:
if item['key'] in ids:
result.append(item)
elif item['children']:

View File

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View File

@ -0,0 +1,16 @@
import React from 'react';
import styles from './index.module.less';
export default function NotFound() {
return (
<div className={styles.notFound}>
<div className={styles.imgBlock}>
<div className={styles.img}/>
</div>
<div>
<h1 className={styles.title}>404</h1>
<div className={styles.desc}>抱歉你访问的页面不存在</div>
</div>
</div>
)
}

View File

@ -15,6 +15,7 @@ import Action from './Action';
import TableCard from './TableCard';
import Breadcrumb from './Breadcrumb';
import AppSelector from './AppSelector';
import NotFound from './NotFound';
export {
StatisticsCard,
@ -29,4 +30,5 @@ export {
TableCard,
Breadcrumb,
AppSelector,
NotFound,
}

View File

@ -192,3 +192,41 @@
color: #888;
}
}
.notFound {
display: flex;
height: 80%;
align-items: center;
.imgBlock {
flex: 0 0 62.5%;
width: 62.5%;
zoom: 1;
padding-right: 88px;
.img {
float: right;
height: 360px;
width: 100%;
max-width: 430px;
background-size: contain;
background: url('./404.svg') no-repeat 50% 50%;
}
}
.title {
color: #434e59;
font-size: 72px;
font-weight: 600;
line-height: 72px;
margin-bottom: 24px;
}
.desc {
color: rgba(0, 0, 0, .45);
font-size: 20px;
line-height: 28px;
margin-bottom: 16px;
}
}

View File

@ -6,6 +6,7 @@
import React, { useState, useEffect } from 'react';
import { Switch, Route } from 'react-router-dom';
import { Layout } from 'antd';
import { NotFound } from 'components';
import Sider from './Sider';
import Header from './Header';
import Footer from './Footer'
@ -25,21 +26,6 @@ function initRoutes(Routes, routes) {
}
}
// 404
function NotFound() {
return (
<div className={styles.router}>
<div className={styles.imgBlock}>
<div className={styles.img}/>
</div>
<div>
<h1 className={styles.title}>404</h1>
<div className={styles.desc}>抱歉你访问的页面不存在</div>
</div>
</div>
)
}
export default function () {
const [collapsed, setCollapsed] = useState(false)
const [Routes, setRoutes] = useState([]);

View File

@ -98,43 +98,6 @@
}
}
.router {
display: flex;
height: 80%;
align-items: center;
.imgBlock {
flex: 0 0 62.5%;
width: 62.5%;
zoom: 1;
padding-right: 88px;
.img {
float: right;
height: 360px;
width: 100%;
max-width: 430px;
background-size: contain;
background: url('./404.svg') no-repeat 50% 50%;
}
}
.title {
color: #434e59;
font-size: 72px;
font-weight: 600;
line-height: 72px;
margin-bottom: 24px;
}
.desc {
color: rgba(0, 0, 0, .45);
font-size: 20px;
line-height: 28px;
margin-bottom: 16px;
}
}
.footer {
width: 100%;
padding: 20px;

View File

@ -7,9 +7,10 @@ import React, { useEffect, useState } from 'react';
import { observer } from 'mobx-react';
import { Tabs, Tree, Button, Spin } from 'antd';
import { FolderOutlined, FolderOpenOutlined, CloudServerOutlined } from '@ant-design/icons';
import { NotFound } from 'components';
import Terminal from './Terminal';
import FileManager from './FileManager';
import { http } from 'libs';
import { http, hasPermission } from 'libs';
import styles from './index.module.less';
import LogoSpugText from 'layout/logo-spug-txt.png';
import lds from 'lodash';
@ -78,7 +79,7 @@ function WebSSH(props) {
'/____// .___/ \\__,_/ \\__, / |__/|__/ \\___//_.___/ \\__/ \\___//_/ /_/ /_/ /_//_//_/ /_/ \\__,_//_/ \n' +
' /_/ /____/ \n'
return (
return hasPermission('host.console.view') ? (
<div className={styles.container}>
<div className={styles.sider}>
<div className={styles.logo}>
@ -117,6 +118,10 @@ function WebSSH(props) {
</div>
<FileManager id={activeId} visible={visible} onClose={() => setVisible(false)}/>
</div>
) : (
<div style={{height: '100vh'}}>
<NotFound/>
</div>
)
}

View File

@ -25,13 +25,15 @@ export default [{
{key: 'import', label: '批量导入'},
{key: 'edit', label: '编辑主机'},
{key: 'del', label: '删除主机'},
{key: 'console', label: 'Web终端'},
]
}, {
key: 'console',
label: 'Console',
label: 'Web终端',
perms: [
{key: 'manager', label: '文件管理器'},
{key: 'view', label: '使用Web终端'},
{key: 'list', label: '查看文件'},
{key: 'upload', label: '上传文件'},
{key: 'del', label: '删除文件'},
]
}]
}, {