diff --git a/src/client/client/request.js b/src/client/client/request.js
index 62c7da08..b28c056c 100644
--- a/src/client/client/request.js
+++ b/src/client/client/request.js
@@ -29,7 +29,7 @@ export class HttpRequest {
}
gotoLoginPage(path) {
- const globalRootStore = require('stores/root').defaullt;
+ const globalRootStore = require('stores/root').default;
globalRootStore.gotoLoginPage(path);
}
diff --git a/src/containers/List/index.jsx b/src/containers/List/index.jsx
index da7d8e51..8ce18f24 100644
--- a/src/containers/List/index.jsx
+++ b/src/containers/List/index.jsx
@@ -619,6 +619,10 @@ export default class BaseList extends React.Component {
}
}
+ getColumns() {
+ return [];
+ }
+
fetchListWithTry = async (func) => {
try {
func && (await func());
@@ -722,8 +726,6 @@ export default class BaseList extends React.Component {
getFilteredValue = (dataIndex) => this.list.filters[dataIndex];
- getColumns = () => [];
-
checkIsProjectFilter = (item) => item.name === this.projectFilterKey;
getSearchFilters = () => {
diff --git a/src/core/index.jsx b/src/core/index.jsx
index f1b90f10..93b3c52a 100644
--- a/src/core/index.jsx
+++ b/src/core/index.jsx
@@ -44,13 +44,14 @@ const render = (component) => {
};
const getUser = async (callback) => {
- if (window.location.pathname.indexOf('/login') < 0) {
+ const currentPath = window.location.pathname;
+ if (currentPath.indexOf('/login') < 0) {
try {
await store.getUserProfileAndPolicy();
} catch (e) {
// eslint-disable-next-line no-console
console.log(e);
- store.gotoLoginPage();
+ store.gotoLoginPage(currentPath);
} finally {
callback && callback();
}
diff --git a/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx b/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx
index 5cb7e0fb..4b2f0ca9 100644
--- a/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx
+++ b/src/pages/compute/containers/Instance/Detail/BaseDetail/index.jsx
@@ -224,6 +224,10 @@ export class BaseDetail extends Base {
return infos;
}
+ get volumeActions() {
+ return { firstAction: AttachVolume };
+ }
+
fetchVolumes = async () => {
const params = {
serverId: this.id,
@@ -280,6 +284,16 @@ export class BaseDetail extends Base {
return {interfaceItem}
;
}
+ renderImageType(osDistro) {
+ return (
+
+ );
+ }
+
renderVmRow() {
const item = toJS(this.detailData.itemInList) || {};
const { status } = this.detailData;
@@ -291,11 +305,7 @@ export class BaseDetail extends Base {
-
+ {this.renderImageType(image_os_distro)}
{image_name}
@@ -370,7 +380,7 @@ export class BaseDetail extends Base {
{/*
{t('Attach volume')} */}
{item.name}
- {filterData.length !== 1 && !this.isAdminPage ? (
+ {filterData.length !== 1 && this.showActions ? (
- {!this.isAdminPage && port_security_enabled && (
+ {this.showActions && port_security_enabled && (
{
const net = {
uuid: it.value.network,
diff --git a/src/pages/compute/containers/Instance/index.jsx b/src/pages/compute/containers/Instance/index.jsx
index eccb26cd..435866c6 100644
--- a/src/pages/compute/containers/Instance/index.jsx
+++ b/src/pages/compute/containers/Instance/index.jsx
@@ -126,7 +126,7 @@ export class Instance extends Base {
};
}
- getColumns = () => {
+ getColumns() {
const columns = [
{
title: t('ID/Name'),
@@ -227,7 +227,7 @@ export class Instance extends Base {
return columns.filter((it) => it.dataIndex !== 'host');
}
return columns;
- };
+ }
get actionConfigs() {
const { batchActions } = this;
diff --git a/src/pages/network/containers/FloatingIp/index.jsx b/src/pages/network/containers/FloatingIp/index.jsx
index 5cb4ef8b..52f510e3 100644
--- a/src/pages/network/containers/FloatingIp/index.jsx
+++ b/src/pages/network/containers/FloatingIp/index.jsx
@@ -24,9 +24,7 @@ import { FileTextOutlined } from '@ant-design/icons';
import styles from './styles.less';
import actionConfigs from './actions';
-@inject('rootStore')
-@observer
-export default class FloatingIps extends Base {
+export class FloatingIps extends Base {
init() {
this.store = new FloatingIpStore();
this.downloadStore = new FloatingIpStore();
@@ -114,100 +112,102 @@ export default class FloatingIps extends Base {
return true;
}
- getColumns = () => [
- {
- title: t('ID/Floating IP'),
- dataIndex: 'floating_ip_address',
- isName: true,
- linkPrefix: `/network/${this.getUrl('floatingip')}/detail`,
- },
- {
- title: t('QoS Policy'),
- dataIndex: 'qos_policy_id',
- render: (value) => (
-
- {value}
-
- ),
- },
- {
- title: t('Project ID/Name'),
- dataIndex: 'project_name',
- hidden: !this.isAdminPage,
- sortKey: 'project_id',
- },
- {
- title: t('Description'),
- dataIndex: 'description',
- render: (value) => value || '-',
- isHideable: true,
- sorter: false,
- },
- {
- title: t('Associated Resource'),
- dataIndex: 'resource_name',
- render: (resource_name, record) => {
- if (
- !resource_name &&
- record.port_forwardings &&
- record.port_forwardings.length !== 0
- ) {
- return (
- <>
- {t('{number} port forwarding rules', {
- number: record.port_forwardings.length,
- })}
-
-
- {record.port_forwardings
- .sort((a, b) => a.external_port - b.external_port)
- .map((i, idx) => (
-
- {`${record.floating_ip_address}:${i.external_port} => ${i.internal_ip_address}:${i.internal_port}`}
-
- ))}
-
- }
- title={t('Port Forwarding')}
- destroyTooltipOnHide
- >
-
-
- >
- );
- }
- return resource_name || '';
+ getColumns() {
+ return [
+ {
+ title: t('ID/Floating IP'),
+ dataIndex: 'floating_ip_address',
+ isName: true,
+ linkPrefix: `/network/${this.getUrl('floatingip')}/detail`,
},
- stringify: (resource_name, record) => {
- if (!resource_name && record.port_forwardings.length !== 0) {
- const ret = record.port_forwardings
- .sort((a, b) => a.external_port - b.external_port)
- .map(
- (i) =>
- `${record.floating_ip_address}:${i.external_port} => ${i.internal_ip_address}:${i.internal_port}`
+ {
+ title: t('QoS Policy'),
+ dataIndex: 'qos_policy_id',
+ render: (value) => (
+
+ {value}
+
+ ),
+ },
+ {
+ title: t('Project ID/Name'),
+ dataIndex: 'project_name',
+ hidden: !this.isAdminPage,
+ sortKey: 'project_id',
+ },
+ {
+ title: t('Description'),
+ dataIndex: 'description',
+ render: (value) => value || '-',
+ isHideable: true,
+ sorter: false,
+ },
+ {
+ title: t('Associated Resource'),
+ dataIndex: 'resource_name',
+ render: (resource_name, record) => {
+ if (
+ !resource_name &&
+ record.port_forwardings &&
+ record.port_forwardings.length !== 0
+ ) {
+ return (
+ <>
+ {t('{number} port forwarding rules', {
+ number: record.port_forwardings.length,
+ })}
+
+
+ {record.port_forwardings
+ .sort((a, b) => a.external_port - b.external_port)
+ .map((i, idx) => (
+
+ {`${record.floating_ip_address}:${i.external_port} => ${i.internal_ip_address}:${i.internal_port}`}
+
+ ))}
+
+ }
+ title={t('Port Forwarding')}
+ destroyTooltipOnHide
+ >
+
+
+ >
);
- return ret.join('\n');
- }
- return resource_name;
+ }
+ return resource_name || '';
+ },
+ stringify: (resource_name, record) => {
+ if (!resource_name && record.port_forwardings.length !== 0) {
+ const ret = record.port_forwardings
+ .sort((a, b) => a.external_port - b.external_port)
+ .map(
+ (i) =>
+ `${record.floating_ip_address}:${i.external_port} => ${i.internal_ip_address}:${i.internal_port}`
+ );
+ return ret.join('\n');
+ }
+ return resource_name;
+ },
+ isHideable: true,
+ sorter: false,
},
- isHideable: true,
- sorter: false,
- },
- {
- title: t('Status'),
- dataIndex: 'status',
- render: (value) => floatingIpStatus[value] || '-',
- },
- {
- title: t('Created At'),
- dataIndex: 'created_at',
- valueRender: 'toLocalTime',
- isHideable: true,
- sorter: false,
- },
- ];
+ {
+ title: t('Status'),
+ dataIndex: 'status',
+ render: (value) => floatingIpStatus[value] || '-',
+ },
+ {
+ title: t('Created At'),
+ dataIndex: 'created_at',
+ valueRender: 'toLocalTime',
+ isHideable: true,
+ sorter: false,
+ },
+ ];
+ }
get searchFilters() {
const filters = [
@@ -227,3 +227,5 @@ export default class FloatingIps extends Base {
return filters;
}
}
+
+export default inject('rootStore')(observer(FloatingIps));
diff --git a/src/pages/network/containers/VirtualAdapter/index.jsx b/src/pages/network/containers/VirtualAdapter/index.jsx
index f0ca292b..3408f7cb 100644
--- a/src/pages/network/containers/VirtualAdapter/index.jsx
+++ b/src/pages/network/containers/VirtualAdapter/index.jsx
@@ -21,9 +21,7 @@ import { portStatus } from 'resources/port';
import { emptyActionConfig } from 'utils/constants';
import actionConfigs from './actions';
-@inject('rootStore')
-@observer
-export default class VirtualAdapter extends Base {
+export class VirtualAdapter extends Base {
init() {
this.store = new VirtualAdapterStore();
this.downloadStore = new VirtualAdapterStore();
@@ -262,3 +260,5 @@ export default class VirtualAdapter extends Base {
return ret;
}
}
+
+export default inject('rootStore')(observer(VirtualAdapter));