diff --git a/src/components/FormItem/MemberAllocator/index.jsx b/src/components/FormItem/MemberAllocator/index.jsx index 07fc78c5..cb210332 100644 --- a/src/components/FormItem/MemberAllocator/index.jsx +++ b/src/components/FormItem/MemberAllocator/index.jsx @@ -17,9 +17,7 @@ import { Form, Button, Row, Col, Select } from 'antd'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import SelectTable from 'components/FormItem/SelectTable'; import { ipValidate } from 'utils/validate'; -import { isAdminPage } from 'utils/index'; import { Address4, Address6 } from 'ip-address'; -import { getLinkRender } from 'utils/route-map'; import Item from './Item'; const { isIPv4, isIpv6 } = ipValidate; @@ -40,13 +38,6 @@ const MemberAllocator = ({ componentProps, formItemProps }) => { onChange && onChange(data); }; - function getLink(routerName, item) { - const { pathname } = window.location; - const key = isAdminPage(pathname) ? `${routerName}Admin` : routerName; - const { id } = item; - return getLinkRender({ key, params: { id }, value: id }); - } - let addOuter = () => {}; return ( @@ -69,12 +60,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => { { title: t('ID/Name'), dataIndex: 'name', - render: (n, record) => ( -
-
{getLink('portDetail', record)}
-
{n || '-'}
-
- ), + routeName: 'portDetail', }, { title: t('Binding Instance'), diff --git a/src/locales/en.json b/src/locales/en.json index 321c9367..abcd5971 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -403,7 +403,7 @@ "Configuration": "Configuration", "Configuration Detail": "Configuration Detail", "Configuration Group": "Configuration Group", - "Configuration Group Name": "Configuration Group Name", + "Configuration Group ID/Name": "Configuration Group ID/Name", "Configuration Groups": "Configuration Groups", "Configuration Update": "Configuration Update", "Configured Disk (GiB)": "Configured Disk (GiB)", @@ -1700,7 +1700,6 @@ "Phone": "Phone", "Physical CPU Usage": "Physical CPU Usage", "Physical Network": "Physical Network", - "Specify Physical Node": "Specify Physical Node", "Physical Node": "Physical Node", "Physical Nodes": "Physical Nodes", "Physical Storage Usage": "Physical Storage Usage", @@ -2168,6 +2167,7 @@ "Spawning": "Spawning", "Spec": "Spec", "Specification": "Specification", + "Specify Physical Node": "Specify Physical Node", "Specify mount point.": "Specify mount point.", "Specify whether future replicated instances will be created on the same hypervisor (affinity) or on different hypervisors (anti-affinity). This value is ignored if the instance to be launched is a replica.": "Specify whether future replicated instances will be created on the same hypervisor (affinity) or on different hypervisors (anti-affinity). This value is ignored if the instance to be launched is a replica.", "Specs": "Specs", diff --git a/src/locales/zh.json b/src/locales/zh.json index b17650d0..c163889e 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -403,7 +403,7 @@ "Configuration": "配置", "Configuration Detail": "配置详情", "Configuration Group": "配置组", - "Configuration Group Name": "配置组名称", + "Configuration Group ID/Name": "配置组ID/名称", "Configuration Groups": "配置组", "Configuration Update": "配置变更", "Configured Disk (GiB)": "已分配磁盘(GiB)", @@ -1700,7 +1700,6 @@ "Phone": "手机", "Physical CPU Usage": "物理CPU使用量", "Physical Network": "物理网络", - "Specify Physical Node": "指定物理节点", "Physical Node": "物理节点", "Physical Nodes": "物理节点", "Physical Storage Usage": "物理存储使用量", @@ -2168,6 +2167,7 @@ "Spawning": "孵化中", "Spec": "规格", "Specification": "规格", + "Specify Physical Node": "指定物理节点", "Specify mount point.": "指定挂载点", "Specify whether future replicated instances will be created on the same hypervisor (affinity) or on different hypervisors (anti-affinity). This value is ignored if the instance to be launched is a replica.": "指定未来的复制实例是在相同的管理程序(亲和)上创建还是在不同的管理程序(反亲和)上创建。如果要启动的实例是副本,则忽略此值。", "Specs": "规格", diff --git a/src/pages/compute/containers/Instance/actions/CreateSnapshot.jsx b/src/pages/compute/containers/Instance/actions/CreateSnapshot.jsx index 9309a750..f8750823 100644 --- a/src/pages/compute/containers/Instance/actions/CreateSnapshot.jsx +++ b/src/pages/compute/containers/Instance/actions/CreateSnapshot.jsx @@ -25,6 +25,7 @@ import { import { InstanceVolumeStore } from 'stores/nova/instance-volume'; import globalVolumeTypeStore from 'stores/cinder/volume-type'; import globalProjectStore from 'stores/keystone/project'; +import { idNameColumn } from 'utils/table'; export const getWishes = () => { const { volumesForSnapshot = [] } = globalServerStore; @@ -203,19 +204,7 @@ export class CreateSnapshot extends ModalAction { } const { volumes = [] } = this.state; const columns = [ - { - dataIndex: 'id', - title: t('ID/Name'), - render: (value, record) => { - const { name } = record; - return ( - <> -
{value}
-
{name || '-'}
- - ); - }, - }, + idNameColumn, { dataIndex: 'size', title: t('Size'), diff --git a/src/pages/database/containers/Backups/index.jsx b/src/pages/database/containers/Backups/index.jsx index d8d2b0aa..daa0feaa 100644 --- a/src/pages/database/containers/Backups/index.jsx +++ b/src/pages/database/containers/Backups/index.jsx @@ -46,7 +46,7 @@ export class Backups extends Base { getColumns = () => [ { - title: t('Name'), + title: t('ID/Name'), dataIndex: 'name', routeName: this.getRouteName('databaseBackupDetail'), }, diff --git a/src/pages/database/containers/Configurations/index.jsx b/src/pages/database/containers/Configurations/index.jsx index 604cb6aa..5f587902 100644 --- a/src/pages/database/containers/Configurations/index.jsx +++ b/src/pages/database/containers/Configurations/index.jsx @@ -46,7 +46,7 @@ export class Configurations extends Base { getColumns = () => [ { - title: t('Configuration Group Name'), + title: t('Configuration Group ID/Name'), dataIndex: 'name', routeName: this.getRouteName('configurationsDetail'), }, diff --git a/src/pages/network/containers/VPN/EndpointGroup/index.jsx b/src/pages/network/containers/VPN/EndpointGroup/index.jsx index b8034da5..cd0fcccf 100644 --- a/src/pages/network/containers/VPN/EndpointGroup/index.jsx +++ b/src/pages/network/containers/VPN/EndpointGroup/index.jsx @@ -19,6 +19,7 @@ import { VpnEndPointGroupStore } from 'stores/neutron/vpn-endpoint-group'; import { Col, Popover, Row, Spin } from 'antd'; import { FileTextOutlined } from '@ant-design/icons'; import { SubnetStore } from 'stores/neutron/subnet'; +import { idNameColumn } from 'utils/table'; import { actionConfigs, adminConfigs } from './actions'; export class EndpointGroup extends Base { @@ -64,16 +65,7 @@ export class EndpointGroup extends Base { } getColumns = () => [ - { - title: t('ID/Name'), - dataIndex: 'name', - render: (name, record) => ( -
-
{record.id}
-
{name}
-
- ), - }, + idNameColumn, { title: t('Project ID/Name'), dataIndex: 'project_name', diff --git a/src/pages/network/containers/VPN/IKEPolicy/index.jsx b/src/pages/network/containers/VPN/IKEPolicy/index.jsx index 76236aee..759805e4 100644 --- a/src/pages/network/containers/VPN/IKEPolicy/index.jsx +++ b/src/pages/network/containers/VPN/IKEPolicy/index.jsx @@ -22,6 +22,7 @@ import { ikePolicyIKEVersionOptions, pfsOptions, } from 'resources/neutron/vpn'; +import { idNameColumn } from 'utils/table'; import { actionConfigs, adminConfigs } from './actions'; export class IKEPolicy extends Base { @@ -63,16 +64,7 @@ export class IKEPolicy extends Base { } getColumns = () => [ - { - title: t('ID/Name'), - dataIndex: 'name', - render: (name, record) => ( -
-
{record.id}
-
{name}
-
- ), - }, + idNameColumn, { title: t('Project ID/Name'), dataIndex: 'project_name', diff --git a/src/pages/network/containers/VPN/IPsecPolicy/index.jsx b/src/pages/network/containers/VPN/IPsecPolicy/index.jsx index ebf3548a..7edcf3e0 100644 --- a/src/pages/network/containers/VPN/IPsecPolicy/index.jsx +++ b/src/pages/network/containers/VPN/IPsecPolicy/index.jsx @@ -23,6 +23,7 @@ import { ipsecPolicyTransformProtocolOptions, pfsOptions, } from 'resources/neutron/vpn'; +import { idNameColumn } from 'utils/table'; import { actionConfigs, adminConfigs } from './actions'; export class IPsecPolicy extends Base { @@ -64,16 +65,7 @@ export class IPsecPolicy extends Base { } getColumns = () => [ - { - title: t('ID/Name'), - dataIndex: 'name', - render: (name, record) => ( -
-
{record.id}
-
{name}
-
- ), - }, + idNameColumn, { title: t('Project ID/Name'), dataIndex: 'project_name', diff --git a/src/pages/network/containers/VPN/VPNGateway/index.jsx b/src/pages/network/containers/VPN/VPNGateway/index.jsx index e5f9831d..39e16216 100644 --- a/src/pages/network/containers/VPN/VPNGateway/index.jsx +++ b/src/pages/network/containers/VPN/VPNGateway/index.jsx @@ -16,7 +16,7 @@ import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; import { VpnServicesStore } from 'stores/neutron/vpn-service'; import { vpnStatus, vpnStatusOptions } from 'resources/neutron/vpn'; -import React from 'react'; +import { idNameColumn } from 'utils/table'; import { actionConfigs, adminConfigs } from './actions'; export class VPNGateway extends Base { @@ -58,16 +58,7 @@ export class VPNGateway extends Base { } getColumns = () => [ - { - title: t('ID/Name'), - dataIndex: 'name', - render: (name, record) => ( -
-
{record.id}
-
{name}
-
- ), - }, + idNameColumn, { title: t('Project ID/Name'), dataIndex: 'project_name', diff --git a/src/resources/cinder/volume.jsx b/src/resources/cinder/volume.jsx index d05d1bcc..36d1d7f1 100644 --- a/src/resources/cinder/volume.jsx +++ b/src/resources/cinder/volume.jsx @@ -18,6 +18,7 @@ import { renderFilterMap } from 'utils/index'; import globalProjectStore from 'stores/keystone/project'; import globalVolumeStore from 'stores/cinder/volume'; import { isEmpty } from 'lodash'; +import { idNameColumn } from 'utils/table'; export const volumeStatus = { available: t('Available'), @@ -144,16 +145,7 @@ export const multiTip = t( ); export const volumeColumns = [ - { - title: t('ID/Name'), - dataIndex: 'name', - render: (value, record) => ( - <> -

{record.id}

- {value || '-'} - - ), - }, + idNameColumn, { title: t('Type'), dataIndex: 'volume_type', diff --git a/src/resources/neutron/port.jsx b/src/resources/neutron/port.jsx index d5a5dbf6..52a5c08d 100644 --- a/src/resources/neutron/port.jsx +++ b/src/resources/neutron/port.jsx @@ -15,6 +15,7 @@ import React from 'react'; import { ipValidate } from 'utils/validate'; import { getOptions } from 'utils/index'; +import { idNameColumn } from 'utils/table'; const { isIPv4 } = ipValidate; @@ -230,17 +231,7 @@ export function getPortFormItem(withResourceNameAndStatusFilter = true) { } export const portColumns = [ - { - title: t('ID/Name'), - dataIndex: 'name', - sorter: false, - render: (value, record) => ( -
-
{record.id}
-
{value || '-'}
-
- ), - }, + idNameColumn, { title: t('Owned Network'), dataIndex: 'network_name',