Merge "feat: update refresh tab data"

This commit is contained in:
Zuul 2024-05-06 09:58:50 +00:00 committed by Gerrit Code Review
commit 027898907f
2 changed files with 27 additions and 0 deletions

View File

@ -145,6 +145,11 @@ export default class BaseList extends React.Component {
return !!detail;
}
get inDetailAction() {
const { inAction } = this.props;
return !!inAction;
}
get detailName() {
if (!this.inDetailPage) {
return '';
@ -939,6 +944,9 @@ export default class BaseList extends React.Component {
handleRefresh = (force) => {
const { inAction, inSelect } = this;
if (this.inDetailPage && this.inDetailAction) {
return;
}
if (inAction || (inSelect && !force)) {
return;
}

View File

@ -346,6 +346,21 @@ export default class DetailBase extends React.Component {
const silence = !this.forceLoadingTabs.includes(this.tab.key);
this.refreshDetailByAction(silence);
}
this.setState({
inAction: false,
});
};
onClickAction = () => {
this.setState({
inAction: true,
});
};
onCancelAction = () => {
this.setState({
inAction: false,
});
};
init() {
@ -412,6 +427,7 @@ export default class DetailBase extends React.Component {
renderTabComponent(tabItem) {
const { component, key, render } = tabItem;
const { inAction } = this.state;
if (render) {
return render;
}
@ -421,6 +437,7 @@ export default class DetailBase extends React.Component {
detail={this.detailData}
detailName={`${this.name}-${this.id}`}
refreshDetail={this.refreshDetailByTab}
inAction={inAction}
/>
) : (
<span>{key}</span>
@ -467,6 +484,8 @@ export default class DetailBase extends React.Component {
item={this.getActionData()}
containerProps={{ isAdminPage: this.isAdminPage }}
isAdminPage={this.isAdminPage}
onClickAction={this.onClickAction}
onCancelAction={this.onCancelAction}
// firstActionClassName={styles['attach-btn']}
/>
);