修改docker默认时区为上海
修复了记住登录无效的问题 修复了ssh下载文件名称不正确的问题 授权凭证增加了密钥类型
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
// prod
|
||||
export const server = '';
|
||||
export const wsServer = '';
|
||||
export const server = '/';
|
||||
export const wsServer = '/';
|
||||
export const prefix = '';
|
||||
|
||||
// dev
|
||||
|
@ -41,13 +41,6 @@ class LoginForm extends Component {
|
||||
localStorage.setItem('X-Auth-Token', result['data']);
|
||||
// this.props.history.push();
|
||||
window.location.href = "/"
|
||||
|
||||
let r = await request.get('/info');
|
||||
if (r.code === 1) {
|
||||
this.props.updateUser(r.data);
|
||||
} else {
|
||||
message.error(r.message);
|
||||
}
|
||||
} catch (e) {
|
||||
message.error(e.message);
|
||||
} finally {
|
||||
|
@ -308,7 +308,6 @@ class Access extends Component {
|
||||
if (navigator.clipboard) {
|
||||
await navigator.clipboard.writeText(data);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@ -433,6 +432,10 @@ class Access extends Component {
|
||||
|
||||
let width = window.innerWidth;
|
||||
let height = window.innerHeight;
|
||||
let dpi = 96;
|
||||
if (protocol === 'ssh' || protocol === 'telnet') {
|
||||
dpi = dpi * 2;
|
||||
}
|
||||
|
||||
let token = getToken();
|
||||
|
||||
@ -440,6 +443,7 @@ class Access extends Component {
|
||||
'sessionId': sessionId,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'dpi': dpi,
|
||||
'X-Auth-Token': token
|
||||
};
|
||||
|
||||
@ -848,6 +852,7 @@ class Access extends Component {
|
||||
|
||||
<Affix style={{position: 'absolute', top: 50, right: 100}}>
|
||||
<Button
|
||||
shape="circle"
|
||||
icon={<CopyOutlined/>}
|
||||
onClick={() => {
|
||||
this.showClipboard();
|
||||
@ -861,6 +866,7 @@ class Access extends Component {
|
||||
this.state.protocol === 'ssh' || this.state.protocol === 'rdp' ?
|
||||
<Affix style={{position: 'absolute', top: 50, right: 50}}>
|
||||
<Button
|
||||
shape="circle"
|
||||
icon={<FolderOpenOutlined/>}
|
||||
onClick={() => {
|
||||
this.showFileSystem();
|
||||
|
@ -468,7 +468,7 @@ class Asset extends Component {
|
||||
|
||||
<Select mode="multiple"
|
||||
allowClear
|
||||
placeholder="请选择标签" onChange={this.handleTagsChange}
|
||||
placeholder="资产标签" onChange={this.handleTagsChange}
|
||||
style={{minWidth: 150}}>
|
||||
{this.state.tags.map(tag => {
|
||||
if (tag === '-') {
|
||||
|
@ -10,13 +10,13 @@ const {Option} = Select;
|
||||
|
||||
const protocolMapping = {
|
||||
'ssh': [
|
||||
{text: '自定义', value: 'custom'},
|
||||
{text: '密码', value: 'custom'},
|
||||
{text: '密钥', value: 'private-key'},
|
||||
{text: '授权凭证', value: 'credential'},
|
||||
{text: '私钥', value: 'private-key'}
|
||||
],
|
||||
'rdp': [{text: '自定义', value: 'custom'}, {text: '授权凭证', value: 'credential'}],
|
||||
'vnc': [{text: '自定义', value: 'custom'}, {text: '授权凭证', value: 'credential'}],
|
||||
'telnet': [{text: '自定义', value: 'custom'}, {text: '授权凭证', value: 'credential'}]
|
||||
'rdp': [{text: '密码', value: 'custom'}, {text: '授权凭证', value: 'credential'}],
|
||||
'vnc': [{text: '密码', value: 'custom'}, {text: '授权凭证', value: 'credential'}],
|
||||
'telnet': [{text: '密码', value: 'custom'}, {text: '授权凭证', value: 'credential'}]
|
||||
}
|
||||
|
||||
const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoading, credentials, tags, model}) {
|
||||
|
@ -6,9 +6,11 @@ import CredentialModal from "./CredentialModal";
|
||||
import request from "../../common/request";
|
||||
import {message} from "antd/es";
|
||||
import {
|
||||
DeleteOutlined, DeleteTwoTone,
|
||||
DeleteOutlined,
|
||||
DeleteTwoTone,
|
||||
EditTwoTone,
|
||||
ExclamationCircleOutlined,
|
||||
EyeTwoTone,
|
||||
PlusOutlined,
|
||||
SyncOutlined,
|
||||
UndoOutlined
|
||||
@ -18,7 +20,7 @@ import Logout from "../user/Logout";
|
||||
|
||||
const confirm = Modal.confirm;
|
||||
const {Search} = Input;
|
||||
const {Title, Text} = Typography;
|
||||
const {Title, Text, Paragraph} = Typography;
|
||||
const {Content} = Layout;
|
||||
const routes = [
|
||||
{
|
||||
@ -135,7 +137,8 @@ class Credential extends Component {
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
self.delete(id).then(r => {});
|
||||
self.delete(id).then(r => {
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -239,14 +242,27 @@ class Credential extends Component {
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
}, {
|
||||
title: '凭证类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
render: (type, record) => {
|
||||
|
||||
if (type === 'private-key') {
|
||||
return (
|
||||
<Text strong type="success">密钥</Text>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Text strong type="warning">密码</Text>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}, {
|
||||
title: '授权账户',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
}, {
|
||||
title: '授权密码',
|
||||
dataIndex: 'password',
|
||||
key: 'password',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@ -255,8 +271,12 @@ class Credential extends Component {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Button type="link" size='small' icon={<EditTwoTone/>} onClick={() => this.showModal('更新凭证', record)}>编辑</Button>
|
||||
<Button type="link" size='small' icon={<DeleteTwoTone />} onClick={() => this.showDeleteConfirm(record.id, record.name)}>删除</Button>
|
||||
<Button type="link" size='small' icon={<EyeTwoTone/>}
|
||||
onClick={() => this.showModal('查看凭证', record)}>查看</Button>
|
||||
<Button type="link" size='small' icon={<EditTwoTone/>}
|
||||
onClick={() => this.showModal('更新凭证', record)}>编辑</Button>
|
||||
<Button type="link" size='small' icon={<DeleteTwoTone/>}
|
||||
onClick={() => this.showDeleteConfirm(record.id, record.name)}>删除</Button>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
@ -388,6 +408,7 @@ class Credential extends Component {
|
||||
handleCancel={this.handleCancelModal}
|
||||
confirmLoading={this.state.modalConfirmLoading}
|
||||
model={this.state.model}
|
||||
footer={this.state.modalTitle.indexOf('查看') > -1 ? null : undefined}
|
||||
>
|
||||
|
||||
</CredentialModal>
|
||||
|
@ -1,7 +1,15 @@
|
||||
import React from 'react';
|
||||
import {Form, Input, Modal} from "antd/lib/index";
|
||||
import React, {useState} from 'react';
|
||||
import {Form, Input, Modal, Select} from "antd/lib/index";
|
||||
import {isEmpty} from "../../utils/utils";
|
||||
|
||||
const CredentialModal = ({title, visible, handleOk, handleCancel, confirmLoading,model}) => {
|
||||
const {TextArea} = Input;
|
||||
|
||||
const accountTypes = [
|
||||
{text: '密码', value: 'custom'},
|
||||
{text: '密钥', value: 'private-key'},
|
||||
];
|
||||
|
||||
const CredentialModal = ({title, visible, handleOk, handleCancel, confirmLoading, model}) => {
|
||||
|
||||
const [form] = Form.useForm();
|
||||
|
||||
@ -10,6 +18,29 @@ const CredentialModal = ({title, visible, handleOk, handleCancel, confirmLoading
|
||||
wrapperCol: {span: 14},
|
||||
};
|
||||
|
||||
if (model === null || model === undefined) {
|
||||
model = {}
|
||||
}
|
||||
|
||||
if (isEmpty(model.type)) {
|
||||
model.type = 'custom';
|
||||
}
|
||||
|
||||
for (let key in model) {
|
||||
if (model.hasOwnProperty(key)) {
|
||||
if (model[key] === '-') {
|
||||
model[key] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let [type, setType] = useState(model.type);
|
||||
|
||||
const handleAccountTypeChange = v => {
|
||||
setType(v);
|
||||
model.type = v;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
<Modal
|
||||
@ -43,13 +74,40 @@ const CredentialModal = ({title, visible, handleOk, handleCancel, confirmLoading
|
||||
<Input placeholder="请输入凭证名称"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="授权账户" name='username' rules={[{required: true, message: '请输入授权账户'}]}>
|
||||
<Input placeholder="输入授权账户"/>
|
||||
<Form.Item label="账户类型" name='type' rules={[{required: true, message: '请选择接账户类型'}]}>
|
||||
<Select onChange={handleAccountTypeChange}>
|
||||
{accountTypes.map(item => {
|
||||
return (<Select.Option key={item.value} value={item.value}>{item.text}</Select.Option>)
|
||||
})}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="授权密码" name='password' rules={[{required: true, message: '请输入授权密码',}]}>
|
||||
<Input placeholder="输入授权密码"/>
|
||||
</Form.Item>
|
||||
{
|
||||
type === 'private-key' ?
|
||||
<>
|
||||
<Form.Item label="授权账户" name='username'>
|
||||
<Input placeholder="输入授权账户"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="私钥" name='privateKey' rules={[{required: true, message: '请输入私钥'}]}>
|
||||
<TextArea rows={4}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="私钥密码" name='passphrase'>
|
||||
<TextArea rows={1}/>
|
||||
</Form.Item>
|
||||
</>
|
||||
:
|
||||
<>
|
||||
<Form.Item label="授权账户" name='username'>
|
||||
<Input placeholder="输入授权账户"/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="授权密码" name='password'>
|
||||
<Input placeholder="输入授权密码"/>
|
||||
</Form.Item>
|
||||
</>
|
||||
|
||||
}
|
||||
|
||||
</Form>
|
||||
</Modal>
|
||||
|
Reference in New Issue
Block a user