Merge "fix: Fix refresh data in detail page after finishing action"
This commit is contained in:
commit
0feb52d99a
@ -16,7 +16,7 @@ import React from 'react';
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import Card from 'components/DetailCard';
|
import Card from 'components/DetailCard';
|
||||||
import { toJS } from 'mobx';
|
import { toJS } from 'mobx';
|
||||||
import { has, isEmpty } from 'lodash';
|
import { has } from 'lodash';
|
||||||
import { isAdminPage } from 'utils/index';
|
import { isAdminPage } from 'utils/index';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
@ -78,24 +78,23 @@ export default class BaseDetail extends React.Component {
|
|||||||
return isAdminPage(pathname);
|
return isAdminPage(pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get shouldFetchDetail() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
getUrl(path, adminStr) {
|
getUrl(path, adminStr) {
|
||||||
return this.isAdminPage ? `${path}${adminStr || '-admin'}` : path;
|
return this.isAdminPage ? `${path}${adminStr || '-admin'}` : path;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDetailData = () => {
|
|
||||||
const { detail } = this.props;
|
|
||||||
if (!detail || isEmpty(detail)) {
|
|
||||||
this.fetchData();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchData = (params) => {
|
fetchData = (params) => {
|
||||||
this.store
|
if (this.shouldFetchDetail && this.store.fetchDetail) {
|
||||||
.fetchDetail({
|
this.store
|
||||||
id: this.id,
|
.fetchDetail({
|
||||||
...params,
|
id: this.id,
|
||||||
})
|
...params,
|
||||||
.catch(this.catch);
|
})
|
||||||
|
.catch(this.catch);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
@ -85,6 +85,20 @@ export default class BaseList extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
if (this.isInDetailPage) {
|
||||||
|
const { detail: oldDetail } = prevProps;
|
||||||
|
const { detail: newDetail } = this.props;
|
||||||
|
if (
|
||||||
|
!isEmpty(oldDetail) &&
|
||||||
|
!isEmpty(newDetail) &&
|
||||||
|
!isEqual(oldDetail, newDetail)
|
||||||
|
) {
|
||||||
|
this.handleRefresh(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.unsubscribe && this.unsubscribe();
|
this.unsubscribe && this.unsubscribe();
|
||||||
this.disposer && this.disposer();
|
this.disposer && this.disposer();
|
||||||
|
@ -170,6 +170,11 @@ export default class DetailBase extends React.Component {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After the operation, the refreshed Tab needs to be forced to load
|
||||||
|
get forceLoadingTabs() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
handleDetailInfo = () => {
|
handleDetailInfo = () => {
|
||||||
const { collapsed } = this.state;
|
const { collapsed } = this.state;
|
||||||
this.setState(
|
this.setState(
|
||||||
@ -238,8 +243,8 @@ export default class DetailBase extends React.Component {
|
|||||||
this.fetchDataWithPolicy(true);
|
this.fetchDataWithPolicy(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
refreshDetailByAction = () => {
|
refreshDetailByAction = (silence) => {
|
||||||
this.fetchDataWithPolicy(true);
|
this.fetchDataWithPolicy(silence);
|
||||||
};
|
};
|
||||||
|
|
||||||
catch = (e) => {
|
catch = (e) => {
|
||||||
@ -276,7 +281,8 @@ export default class DetailBase extends React.Component {
|
|||||||
if (success && isDelete) {
|
if (success && isDelete) {
|
||||||
this.goBack();
|
this.goBack();
|
||||||
} else {
|
} else {
|
||||||
this.refreshDetailByAction();
|
const silence = !this.forceLoadingTabs.includes(this.tab.key);
|
||||||
|
this.refreshDetailByAction(silence);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,17 +14,12 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { IronicStore } from 'stores/ironic/ironic';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import SimpleTable from 'components/Tables/SimpleTable';
|
import SimpleTable from 'components/Tables/SimpleTable';
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new IronicStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const cards = [
|
const cards = [
|
||||||
this.baseInfoCard,
|
this.baseInfoCard,
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { FlavorStore } from 'stores/nova/flavor';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import {
|
import {
|
||||||
categoryHasIOPS,
|
categoryHasIOPS,
|
||||||
@ -30,10 +29,6 @@ import {
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new FlavorStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const { category, disk, usbType } = this.detailData;
|
const { category, disk, usbType } = this.detailData;
|
||||||
const isGPUType = isGpuCategory(category);
|
const isGPUType = isGpuCategory(category);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { toJS } from 'mobx';
|
import { toJS } from 'mobx';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { ImageStore } from 'stores/glance/image';
|
|
||||||
import { imageProperties, imageVisibility, imageOS } from 'resources/image';
|
import { imageProperties, imageVisibility, imageOS } from 'resources/image';
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import { isObject, isArray } from 'lodash';
|
import { isObject, isArray } from 'lodash';
|
||||||
@ -24,10 +23,6 @@ import { Link } from 'react-router-dom';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new ImageStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get isImageDetail() {
|
get isImageDetail() {
|
||||||
const { pathname } = this.props.location;
|
const { pathname } = this.props.location;
|
||||||
return pathname.indexOf('image') >= 0;
|
return pathname.indexOf('image') >= 0;
|
||||||
|
@ -34,7 +34,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return t('Manage host');
|
return t('Manage Metadata');
|
||||||
}
|
}
|
||||||
|
|
||||||
static get modalSize() {
|
static get modalSize() {
|
||||||
|
@ -13,16 +13,11 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { KeypairStore } from 'stores/nova/keypair';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new KeypairStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.keypairInfoCard];
|
return [this.keypairInfoCard];
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,12 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { MetadataStore } from 'stores/glance/metadata';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import styles from './styles.less';
|
import styles from './styles.less';
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new MetadataStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.baseInfoCard, this.resourceCard];
|
return [this.baseInfoCard, this.resourceCard];
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ export default class Edit extends ModalAction {
|
|||||||
return t('Edit metadata');
|
return t('Edit metadata');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get instanceName() {
|
||||||
|
return this.item.display_name;
|
||||||
|
}
|
||||||
|
|
||||||
static policy = 'modify_metadef_namespace';
|
static policy = 'modify_metadef_namespace';
|
||||||
|
|
||||||
static allowed = () => Promise.resolve(true);
|
static allowed = () => Promise.resolve(true);
|
||||||
|
@ -15,15 +15,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import { NeutronAgentStore } from 'stores/neutron/agent';
|
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new NeutronAgentStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.baseCard];
|
return [this.baseCard];
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ import { rollbackTip } from 'resources/stack';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
fetchData = () => Promise.resolve(true);
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.startCard, this.outputCard];
|
return [this.startCard, this.outputCard];
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,10 @@ export default class InstanceDetail extends Base {
|
|||||||
this.store = new ProjectStore();
|
this.store = new ProjectStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get forceLoadingTabs() {
|
||||||
|
return ['quota'];
|
||||||
|
}
|
||||||
|
|
||||||
get detailInfos() {
|
get detailInfos() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -68,10 +68,6 @@ class CreateForm extends ModalAction {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
get listUrl() {
|
|
||||||
return this.getUrl('/identity/project');
|
|
||||||
}
|
|
||||||
|
|
||||||
get domainList() {
|
get domainList() {
|
||||||
const {
|
const {
|
||||||
rootStore: { baseDomains },
|
rootStore: { baseDomains },
|
||||||
|
@ -52,10 +52,6 @@ class EditForm extends ModalAction {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
get listUrl() {
|
|
||||||
return this.getUrl('/identity/project');
|
|
||||||
}
|
|
||||||
|
|
||||||
checkName = (rule, value) => {
|
checkName = (rule, value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return Promise.reject(t('Please input'));
|
return Promise.reject(t('Please input'));
|
||||||
|
@ -56,10 +56,6 @@ class EditForm extends ModalAction {
|
|||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
get listUrl() {
|
|
||||||
return this.getUrl('/identity/user');
|
|
||||||
}
|
|
||||||
|
|
||||||
get domainList() {
|
get domainList() {
|
||||||
return (this.userGroupStore.list.data || []).map((it) => ({
|
return (this.userGroupStore.list.data || []).map((it) => ({
|
||||||
label: it.name,
|
label: it.name,
|
||||||
|
@ -92,10 +92,6 @@ class CreateForm extends ModalAction {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
get listUrl() {
|
|
||||||
return '/identity/user-group-admin';
|
|
||||||
}
|
|
||||||
|
|
||||||
get domainList() {
|
get domainList() {
|
||||||
const { domains } = this.domainStore;
|
const { domains } = this.domainStore;
|
||||||
return (domains || []).map((it) => ({
|
return (domains || []).map((it) => ({
|
||||||
|
@ -28,6 +28,10 @@ export default class BaseDetail extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get shouldFetchDetail() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.store = globalListenerStore;
|
this.store = globalListenerStore;
|
||||||
this.healthmonitorStore = new HealthMonitorStore();
|
this.healthmonitorStore = new HealthMonitorStore();
|
||||||
|
@ -18,8 +18,6 @@ import Base from 'containers/BaseDetail';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
fetchData = () => {};
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const cards = [this.baseInfoCard];
|
const cards = [this.baseInfoCard];
|
||||||
return cards;
|
return cards;
|
||||||
|
@ -18,8 +18,6 @@ import Base from 'containers/BaseDetail';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
fetchData = () => Promise.resolve(true);
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [...this.BandwidthCard, this.DSCPMarkingCard];
|
return [...this.BandwidthCard, this.DSCPMarkingCard];
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,11 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { RouterStore } from 'stores/neutron/router';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new RouterStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const cards = [this.aZoneCard];
|
const cards = [this.aZoneCard];
|
||||||
return cards;
|
return cards;
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { PortStore } from 'stores/neutron/port';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import { bindingTypes } from 'resources/port';
|
import { bindingTypes } from 'resources/port';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
@ -22,10 +21,6 @@ import { isEmpty } from 'lodash';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new PortStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const cards = [this.portInfo];
|
const cards = [this.portInfo];
|
||||||
const {
|
const {
|
||||||
|
@ -21,8 +21,6 @@ import { bindingTypes } from 'resources/port';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
componentDidMount() {}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.baseInfoCard];
|
return [this.baseInfoCard];
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ import { Link } from 'react-router-dom';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
fetchData = () => Promise.resolve(true);
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const cards = [this.volumeCard];
|
const cards = [this.volumeCard];
|
||||||
return cards;
|
return cards;
|
||||||
|
@ -20,8 +20,6 @@ import Base from 'containers/BaseDetail';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
fetchData = () => Promise.resolve(true);
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.volumeCard];
|
return [this.volumeCard];
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ import Base from 'containers/BaseDetail';
|
|||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
fetchData = () => Promise.resolve(true);
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
const cards = [this.attachmentsCard];
|
const cards = [this.attachmentsCard];
|
||||||
if (this.detailData.volume_image_metadata) {
|
if (this.detailData.volume_image_metadata) {
|
||||||
|
@ -13,17 +13,12 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { VolumeTypeStore } from 'stores/cinder/volume-type';
|
|
||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import { controls } from 'resources/volume-type';
|
import { controls } from 'resources/volume-type';
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
export default class BaseDetail extends Base {
|
export default class BaseDetail extends Base {
|
||||||
init() {
|
|
||||||
this.store = new VolumeTypeStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
return [this.encryptionInfo];
|
return [this.encryptionInfo];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user