diff --git a/spug_api/apps/host/group.py b/spug_api/apps/host/group.py index 7f63065..90dfd65 100644 --- a/spug_api/apps/host/group.py +++ b/spug_api/apps/host/group.py @@ -30,10 +30,11 @@ def merge_children(data, prefix, childes): def filter_by_perm(data, result, ids): for item in data: - if item['key'] in ids: - result.append(item) - elif item['children']: - filter_by_perm(item['children'], result, ids) + if 'children' in item: + if item['key'] in ids: + result.append(item) + elif item['children']: + filter_by_perm(item['children'], result, ids) class GroupView(View): diff --git a/spug_web/src/layout/404.svg b/spug_web/src/components/404.svg similarity index 100% rename from spug_web/src/layout/404.svg rename to spug_web/src/components/404.svg diff --git a/spug_web/src/components/NotFound.js b/spug_web/src/components/NotFound.js new file mode 100644 index 0000000..6eca517 --- /dev/null +++ b/spug_web/src/components/NotFound.js @@ -0,0 +1,16 @@ +import React from 'react'; +import styles from './index.module.less'; + +export default function NotFound() { + return ( +
+
+
+
+
+

404

+
抱歉,你访问的页面不存在
+
+
+ ) +} \ No newline at end of file diff --git a/spug_web/src/components/index.js b/spug_web/src/components/index.js index 02ab8d0..e140894 100644 --- a/spug_web/src/components/index.js +++ b/spug_web/src/components/index.js @@ -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, } diff --git a/spug_web/src/components/index.module.less b/spug_web/src/components/index.module.less index fde7904..7a6d9d2 100644 --- a/spug_web/src/components/index.module.less +++ b/spug_web/src/components/index.module.less @@ -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; + } +} \ No newline at end of file diff --git a/spug_web/src/layout/index.js b/spug_web/src/layout/index.js index 2742951..58be5a1 100644 --- a/spug_web/src/layout/index.js +++ b/spug_web/src/layout/index.js @@ -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 ( -
-
-
-
-
-

404

-
抱歉,你访问的页面不存在
-
-
- ) -} - export default function () { const [collapsed, setCollapsed] = useState(false) const [Routes, setRoutes] = useState([]); diff --git a/spug_web/src/layout/layout.module.less b/spug_web/src/layout/layout.module.less index ddda3af..0b5c5c4 100644 --- a/spug_web/src/layout/layout.module.less +++ b/spug_web/src/layout/layout.module.less @@ -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; diff --git a/spug_web/src/pages/ssh/index.js b/spug_web/src/pages/ssh/index.js index acfcc36..522811b 100644 --- a/spug_web/src/pages/ssh/index.js +++ b/spug_web/src/pages/ssh/index.js @@ -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') ? (
@@ -117,6 +118,10 @@ function WebSSH(props) {
setVisible(false)}/>
+ ) : ( +
+ +
) } diff --git a/spug_web/src/pages/system/role/codes.js b/spug_web/src/pages/system/role/codes.js index a6bf0fa..6eb0668 100644 --- a/spug_web/src/pages/system/role/codes.js +++ b/spug_web/src/pages/system/role/codes.js @@ -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: '删除文件'}, ] }] }, {