mirror of https://github.com/openspug/spug
fix issue
parent
ac8437266d
commit
1539512e5c
|
@ -111,5 +111,7 @@ class GroupView(View):
|
||||||
return json_response(error='请移除子分组后再尝试删除')
|
return json_response(error='请移除子分组后再尝试删除')
|
||||||
if group.hosts.exists():
|
if group.hosts.exists():
|
||||||
return json_response(error='请移除分组下的主机后再尝试删除')
|
return json_response(error='请移除分组下的主机后再尝试删除')
|
||||||
|
if Group.objects.exclude(pk=form.id).exists():
|
||||||
|
return json_response(error='请至少保留一个分组')
|
||||||
group.delete()
|
group.delete()
|
||||||
return json_response(error=error)
|
return json_response(error=error)
|
||||||
|
|
|
@ -145,7 +145,7 @@ export default observer(function () {
|
||||||
<Form.Item name="desc" label="备注信息">
|
<Form.Item name="desc" label="备注信息">
|
||||||
<Input.TextArea placeholder="请输入主机备注信息"/>
|
<Input.TextArea placeholder="请输入主机备注信息"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item wrapperCol={{span: 14, offset: 6}}>
|
<Form.Item wrapperCol={{span: 17, offset: 5}}>
|
||||||
<Alert showIcon type="info" message="首次验证时需要输入登录用户名对应的密码,该密码会用于配置密钥连接,不会存储该密码。" />
|
<Alert showIcon type="info" message="首次验证时需要输入登录用户名对应的密码,该密码会用于配置密钥连接,不会存储该密码。" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { Input, Card, Tree, Dropdown, Menu, Switch, message } from 'antd';
|
import { Input, Card, Tree, Dropdown, Menu, Switch, Tooltip, message } from 'antd';
|
||||||
import {
|
import {
|
||||||
FolderOutlined,
|
FolderOutlined,
|
||||||
FolderAddOutlined,
|
FolderAddOutlined,
|
||||||
|
@ -13,7 +13,8 @@ import {
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
CopyOutlined,
|
CopyOutlined,
|
||||||
ScissorOutlined,
|
ScissorOutlined,
|
||||||
LoadingOutlined
|
LoadingOutlined,
|
||||||
|
QuestionCircleOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { AuthFragment } from 'components';
|
import { AuthFragment } from 'components';
|
||||||
import { hasPermission, http } from 'libs';
|
import { hasPermission, http } from 'libs';
|
||||||
|
@ -155,6 +156,7 @@ export default observer(function () {
|
||||||
onChange={setDraggable}
|
onChange={setDraggable}
|
||||||
checkedChildren="排版"
|
checkedChildren="排版"
|
||||||
unCheckedChildren="浏览"/>
|
unCheckedChildren="浏览"/>
|
||||||
|
<Tooltip title="右键点击分组进行编辑,开启排版模式后可通过拖拽分组进行快速排序。"><QuestionCircleOutlined style={{marginLeft: 8, color: '#999'}}/></Tooltip>
|
||||||
</AuthFragment>)}>
|
</AuthFragment>)}>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
overlay={menus}
|
overlay={menus}
|
||||||
|
@ -163,6 +165,7 @@ export default observer(function () {
|
||||||
onVisibleChange={v => v || setVisible(v)}>
|
onVisibleChange={v => v || setVisible(v)}>
|
||||||
<Tree.DirectoryTree
|
<Tree.DirectoryTree
|
||||||
autoExpandParent
|
autoExpandParent
|
||||||
|
expandAction="doubleClick"
|
||||||
draggable={draggable}
|
draggable={draggable}
|
||||||
treeData={store.treeData}
|
treeData={store.treeData}
|
||||||
titleRender={treeRender}
|
titleRender={treeRender}
|
||||||
|
@ -174,6 +177,9 @@ export default observer(function () {
|
||||||
onRightClick={handleRightClick}
|
onRightClick={handleRightClick}
|
||||||
/>
|
/>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
{store.records && store.treeData.length === 0 && (
|
||||||
|
<div style={{color: '#999'}}>你还没有可访问的主机分组,请联系管理员分配主机权限。</div>
|
||||||
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Store {
|
||||||
|
|
||||||
@computed get dataSource() {
|
@computed get dataSource() {
|
||||||
let records = [];
|
let records = [];
|
||||||
if (this.group.all_host_ids) records = this.records.filter(x => this.group.all_host_ids.includes(x.id));
|
if (this.group.all_host_ids) records = this.records ? this.records.filter(x => this.group.all_host_ids.includes(x.id)) : [];
|
||||||
if (this.f_name) records = records.filter(x => x.name.toLowerCase().includes(this.f_name.toLowerCase()));
|
if (this.f_name) records = records.filter(x => x.name.toLowerCase().includes(this.f_name.toLowerCase()));
|
||||||
if (this.f_host) records = records.filter(x => x.hostname.toLowerCase().includes(this.f_host.toLowerCase()));
|
if (this.f_host) records = records.filter(x => x.hostname.toLowerCase().includes(this.f_host.toLowerCase()));
|
||||||
return records
|
return records
|
||||||
|
@ -67,7 +67,7 @@ class Store {
|
||||||
.then(http.spread((res1, res2) => {
|
.then(http.spread((res1, res2) => {
|
||||||
this.records = res1;
|
this.records = res1;
|
||||||
this.records.map(item => this.idMap[item.id] = item);
|
this.records.map(item => this.idMap[item.id] = item);
|
||||||
this.group = res2.treeData[0];
|
this.group = res2.treeData[0] || {};
|
||||||
this.groups = res2.groups;
|
this.groups = res2.groups;
|
||||||
this._makeCounter();
|
this._makeCounter();
|
||||||
this.refreshCounter(res2.treeData)
|
this.refreshCounter(res2.treeData)
|
||||||
|
|
Loading…
Reference in New Issue