Merge "fix: Fix for credential download & show"
This commit is contained in:
commit
8622cb97eb
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Checkbox } from 'antd';
|
import { Checkbox, Row, Col } from 'antd';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
export default class index extends Component {
|
export default class index extends Component {
|
||||||
@ -57,12 +57,22 @@ export default class index extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className, options } = this.props;
|
const { className, options, span } = this.props;
|
||||||
const values = this.getValues();
|
const values = this.getValues();
|
||||||
const conf = {
|
const conf = {
|
||||||
className,
|
className,
|
||||||
onChange: this.onChange,
|
onChange: this.onChange,
|
||||||
};
|
};
|
||||||
return <Checkbox.Group {...conf} options={options} value={values} />;
|
return (
|
||||||
|
<Checkbox.Group {...conf} value={values} style={{ width: '100%' }}>
|
||||||
|
<Row>
|
||||||
|
{options.map((opt) => (
|
||||||
|
<Col span={span} key={opt.value}>
|
||||||
|
<Checkbox value={opt.value}>{opt.label}</Checkbox>
|
||||||
|
</Col>
|
||||||
|
))}
|
||||||
|
</Row>
|
||||||
|
</Checkbox.Group>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"Add network": "Add network",
|
"Add network": "Add network",
|
||||||
"Additional routes announced to the instance, one entry per line(e.g. 192.168.200.0/24,10.56.1.254)": "Additional routes announced to the instance, one entry per line(e.g. 192.168.200.0/24,10.56.1.254)",
|
"Additional routes announced to the instance, one entry per line(e.g. 192.168.200.0/24,10.56.1.254)": "Additional routes announced to the instance, one entry per line(e.g. 192.168.200.0/24,10.56.1.254)",
|
||||||
"Additional routes announced to the instance, one entry per line(e.g. {ip})": "Additional routes announced to the instance, one entry per line(e.g. {ip})",
|
"Additional routes announced to the instance, one entry per line(e.g. {ip})": "Additional routes announced to the instance, one entry per line(e.g. {ip})",
|
||||||
|
"Admin": "Admin",
|
||||||
"Admin State": "Admin State",
|
"Admin State": "Admin State",
|
||||||
"Admin Status": "Admin Status",
|
"Admin Status": "Admin Status",
|
||||||
"Administrator": "Administrator",
|
"Administrator": "Administrator",
|
||||||
@ -1284,6 +1285,7 @@
|
|||||||
"Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ": "Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ",
|
"Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ": "Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ",
|
||||||
"Ramdisk ID": "Ramdisk ID",
|
"Ramdisk ID": "Ramdisk ID",
|
||||||
"Ramdisk Image": "Ramdisk Image",
|
"Ramdisk Image": "Ramdisk Image",
|
||||||
|
"Reader": "Reader",
|
||||||
"Real Name": "Real Name",
|
"Real Name": "Real Name",
|
||||||
"Reason": "Reason",
|
"Reason": "Reason",
|
||||||
"Reason: ": "Reason: ",
|
"Reason: ": "Reason: ",
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
"Add network": "添加网络",
|
"Add network": "添加网络",
|
||||||
"Additional routes announced to the instance, one entry per line(e.g. 192.168.200.0/24,10.56.1.254)": "云主机额外路由,每行一条(例如: 192.168.200.0/24,10.56.1.254)",
|
"Additional routes announced to the instance, one entry per line(e.g. 192.168.200.0/24,10.56.1.254)": "云主机额外路由,每行一条(例如: 192.168.200.0/24,10.56.1.254)",
|
||||||
"Additional routes announced to the instance, one entry per line(e.g. {ip})": "云主机额外路由,每行一条(例如: {ip})",
|
"Additional routes announced to the instance, one entry per line(e.g. {ip})": "云主机额外路由,每行一条(例如: {ip})",
|
||||||
|
"Admin": "管理员",
|
||||||
"Admin State": "管理状态",
|
"Admin State": "管理状态",
|
||||||
"Admin Status": "管理状态",
|
"Admin Status": "管理状态",
|
||||||
"Administrator": "管理平台",
|
"Administrator": "管理平台",
|
||||||
@ -1284,6 +1285,7 @@
|
|||||||
"Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ": "内存是 { ram }MB,NUMA节点的内存是{ totalRam }MB,需要一致。",
|
"Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ": "内存是 { ram }MB,NUMA节点的内存是{ totalRam }MB,需要一致。",
|
||||||
"Ramdisk ID": "内存盘ID",
|
"Ramdisk ID": "内存盘ID",
|
||||||
"Ramdisk Image": "Ramdisk镜像",
|
"Ramdisk Image": "Ramdisk镜像",
|
||||||
|
"Reader": "只读",
|
||||||
"Real Name": "真实姓名",
|
"Real Name": "真实姓名",
|
||||||
"Reason": "原因",
|
"Reason": "原因",
|
||||||
"Reason: ": "原因:",
|
"Reason: ": "原因:",
|
||||||
|
@ -19,18 +19,30 @@ import moment from 'moment';
|
|||||||
import globalRootStore from 'stores/root';
|
import globalRootStore from 'stores/root';
|
||||||
import { toJS } from 'mobx';
|
import { toJS } from 'mobx';
|
||||||
import FileSaver from 'file-saver';
|
import FileSaver from 'file-saver';
|
||||||
|
import rolePermission from 'resources/role';
|
||||||
|
|
||||||
@inject('rootStore')
|
export class Create extends ModalAction {
|
||||||
@observer
|
|
||||||
export default class Create extends ModalAction {
|
|
||||||
static id = 'create-application_credentials';
|
static id = 'create-application_credentials';
|
||||||
|
|
||||||
static title = t('Create Application Credentials');
|
static title = t('Create Application Credentials');
|
||||||
|
|
||||||
|
|
||||||
|
static get modalSize() {
|
||||||
|
return 'middle';
|
||||||
|
}
|
||||||
|
|
||||||
|
getModalSize() {
|
||||||
|
return 'middle';
|
||||||
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return t('Create Application Credentials');
|
return t('Create Application Credentials');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get rolePermissions() {
|
||||||
|
return rolePermission;
|
||||||
|
}
|
||||||
|
|
||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
if (values.expires_at) {
|
if (values.expires_at) {
|
||||||
values.expires_at = values.expires_at.clone().endOf('day');
|
values.expires_at = values.expires_at.clone().endOf('day');
|
||||||
@ -61,7 +73,10 @@ export default class Create extends ModalAction {
|
|||||||
// const baseRoles = toJS(globalRootStore.baseRoles);
|
// const baseRoles = toJS(globalRootStore.baseRoles);
|
||||||
const roles = toJS(globalRootStore.roles);
|
const roles = toJS(globalRootStore.roles);
|
||||||
|
|
||||||
return roles.map((i) => ({ label: i.name, value: i.id }));
|
return roles.map((i) => ({
|
||||||
|
label: this.rolePermissions[i.name] || i.name,
|
||||||
|
value: i.id,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
get formItems() {
|
get formItems() {
|
||||||
@ -86,6 +101,7 @@ export default class Create extends ModalAction {
|
|||||||
label: t('Roles'),
|
label: t('Roles'),
|
||||||
type: 'check-group',
|
type: 'check-group',
|
||||||
options: this.roleOptions,
|
options: this.roleOptions,
|
||||||
|
span: 12,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'description',
|
name: 'description',
|
||||||
@ -96,3 +112,5 @@ export default class Create extends ModalAction {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default inject('rootStore')(observer(Create))
|
@ -14,16 +14,14 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import { Popover, Row, Col } from 'antd';
|
import { Row, Col } from 'antd';
|
||||||
import { SearchOutlined } from '@ant-design/icons';
|
|
||||||
import Base from 'containers/List';
|
import Base from 'containers/List';
|
||||||
import { CredentialStore } from 'stores/keystone/credential';
|
import { CredentialStore } from 'stores/keystone/credential';
|
||||||
import globalRootStore from 'stores/root';
|
import globalRootStore from 'stores/root';
|
||||||
|
import rolePermission from 'resources/role';
|
||||||
import { actionConfigs, detailConfigs } from './actions';
|
import { actionConfigs, detailConfigs } from './actions';
|
||||||
|
|
||||||
@inject('rootStore')
|
export class Credentials extends Base {
|
||||||
@observer
|
|
||||||
export default class Credentials extends Base {
|
|
||||||
init() {
|
init() {
|
||||||
this.store = new CredentialStore();
|
this.store = new CredentialStore();
|
||||||
this.downloadStore = new CredentialStore();
|
this.downloadStore = new CredentialStore();
|
||||||
@ -43,6 +41,10 @@ export default class Credentials extends Base {
|
|||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
get rolePermissions() {
|
||||||
|
return rolePermission;
|
||||||
|
}
|
||||||
|
|
||||||
get isFilterByBackend() {
|
get isFilterByBackend() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -91,23 +93,17 @@ export default class Credentials extends Base {
|
|||||||
{
|
{
|
||||||
title: t('Roles'),
|
title: t('Roles'),
|
||||||
dataIndex: 'roles',
|
dataIndex: 'roles',
|
||||||
render: (roles) => {
|
render: (roles) => (
|
||||||
const content = (
|
<Row gutter={[8]} style={{ maxWidth: 300 }}>
|
||||||
<Row gutter={[8]} style={{ maxWidth: 200 }}>
|
{roles.map((i) => (
|
||||||
{roles.map((i) => (
|
<Col span={24} key={i.id}>
|
||||||
<Col span={24} key={i.id}>
|
{this.rolePermissions[i.name] || i.name}
|
||||||
{i.name}
|
</Col>
|
||||||
</Col>
|
))}
|
||||||
))}
|
</Row>
|
||||||
</Row>
|
),
|
||||||
);
|
stringify: (values) =>
|
||||||
return (
|
values.map((i) => this.rolePermissions[i.name] || i.name).join('\n'),
|
||||||
<Popover content={content}>
|
|
||||||
<SearchOutlined />
|
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
isHideable: true,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
return ret;
|
return ret;
|
||||||
@ -123,3 +119,5 @@ export default class Credentials extends Base {
|
|||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default inject('rootStore')(observer(Credentials))
|
@ -18,6 +18,9 @@ const rolePermission = {
|
|||||||
project_member: t('Project Member'),
|
project_member: t('Project Member'),
|
||||||
system_admin: t('System Admin'),
|
system_admin: t('System Admin'),
|
||||||
system_reader: t('System Reader'),
|
system_reader: t('System Reader'),
|
||||||
|
admin: t('Admin'),
|
||||||
|
reader: t('Reader'),
|
||||||
|
member: t('Member'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default rolePermission;
|
export default rolePermission;
|
||||||
|
Loading…
Reference in New Issue
Block a user