-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading spinner no longer appear whan saving a resource #9034
Comments
Investigation: However I don't see an implementation causing a regression that hides the loading spinner on click Anyway, in this case, I believe the code needs to tweaked to address this specific scenario of showing spinner on save progress. @tdipisa Kindly let me know your thoughts. Thanks! |
Yes,
It would be better, yes. Please provide an estimate in pts for both. |
@dsuren1 3pts are too much now. Let's concentrate on fixing the regression by restoring the spinner. Then we can open an issue for the other point. |
Hi @dsuren1 . Anyway it is present and I verified that fixing the style you linked like this:
|
Sorry, diff --git a/web/client/components/resources/modals/Save.jsx b/web/client/components/resources/modals/Save.jsx
index 76ac8d227..986796a45 100644
--- a/web/client/components/resources/modals/Save.jsx
+++ b/web/client/components/resources/modals/Save.jsx
@@ -127,6 +127,13 @@ class SaveModal extends React.Component {
dialogClassName: '',
detailsComponent: require('./enhancers/handleDetails').default((DetailsComp))
};
+
+ componentDidUpdate(prevProps) {
+ if (this.props.errors && this.props.errors.length > 0 && this.props.errors !== prevProps.errors && this.state?.loading) {
+ this.setState({loading: false});
+ }
+ }
+
onCloseMapPropertiesModal = () => {
this.props.onClose();
}
@@ -144,7 +151,7 @@ class SaveModal extends React.Component {
return (<Portal key="saveDialog">
<ResizableModal
- loading={this.props.loading}
+ loading={this.props.loading || this.state?.loading}
title={<Message msgId={this.props.title}/>}
show={this.props.show}
clickOutEnabled={this.props.clickOutEnabled}
@@ -157,8 +164,11 @@ class SaveModal extends React.Component {
disabled: this.props.resource.loading
}, {
text: <span><Message msgId={this.props.saveButtonLabel}/></span>,
- onClick: () => { this.onSave(); },
- disabled: !this.isValidForm() || this.props.loading || !this.props.canSave
+ onClick: () => {
+ this.setState({loading: true});
+ this.onSave();
+ },
+ disabled: !this.isValidForm() || this.props.loading || this.state.loading || !this.props.canSave
}]}
showClose={!this.props.resource.loading}
onClose={this.onCloseMapPropertiesModal}>
diff --git a/web/client/themes/default/less/loaders.less b/web/client/themes/default/less/loaders.less
index 8f048681c..ce500a01b 100644
--- a/web/client/themes/default/less/loaders.less
+++ b/web/client/themes/default/less/loaders.less
@@ -56,7 +56,7 @@
}
.mapstore-inline-loader {
margin: @padding-left-square-md;
- .mapstore-circle-loader-with-css-variables(@icon-size-md/10, @icon-size-md, @theme-vars[loader-primary-color], @theme-vars[loader-primary-fade-color]);
+ .mapstore-circle-loader-with-css-variables(calc( @icon-size-md / 10), @icon-size-md, @theme-vars[loader-primary-color], @theme-vars[loader-primary-fade-color]);
}
} This was showing the loader. Effectively the logic doesn't exist. This was a workaround that I forgot to delete while checking. So summarizing, In fact the loading flag is passed, but only to show the details loading. I should try to handle this in the Save modal as much as possible, so we can avoid to handle the loading state for every resource in a lot use cases, for each resource and save tool. Even if not perfect, I provided here a sort of solution that fixes it in most of the cases. diff --git a/web/client/components/resources/modals/Save.jsx b/web/client/components/resources/modals/Save.jsx
index 76ac8d227..a5cc4bb8a 100644
--- a/web/client/components/resources/modals/Save.jsx
+++ b/web/client/components/resources/modals/Save.jsx
@@ -127,6 +127,13 @@ class SaveModal extends React.Component {
dialogClassName: '',
detailsComponent: require('./enhancers/handleDetails').default((DetailsComp))
};
+
+ componentDidUpdate(prevProps) {
+ if (this.props.errors && this.props.errors.length > 0 && this.props.errors !== prevProps.errors && this.state?.loading) {
+ this.setState({loading: false});
+ }
+ }
+
onCloseMapPropertiesModal = () => {
this.props.onClose();
}
@@ -144,7 +151,7 @@ class SaveModal extends React.Component {
return (<Portal key="saveDialog">
<ResizableModal
- loading={this.props.loading}
+ loading={this.props.loading || this.state?.loading}
title={<Message msgId={this.props.title}/>}
show={this.props.show}
clickOutEnabled={this.props.clickOutEnabled}
@@ -157,7 +164,10 @@ class SaveModal extends React.Component {
disabled: this.props.resource.loading
}, {
text: <span><Message msgId={this.props.saveButtonLabel}/></span>,
- onClick: () => { this.onSave(); },
+ onClick: () => {
+ this.setState({loading: true});
+ this.onSave();
+ },
disabled: !this.isValidForm() || this.props.loading || !this.props.canSave
}]}
showClose={!this.props.resource.loading}
diff --git a/web/client/themes/default/less/loaders.less b/web/client/themes/default/less/loaders.less
index 8f048681c..ce500a01b 100644
--- a/web/client/themes/default/less/loaders.less
+++ b/web/client/themes/default/less/loaders.less
@@ -56,7 +56,7 @@
}
.mapstore-inline-loader {
margin: @padding-left-square-md;
- .mapstore-circle-loader-with-css-variables(@icon-size-md/10, @icon-size-md, @theme-vars[loader-primary-color], @theme-vars[loader-primary-fade-color]);
+ .mapstore-circle-loader-with-css-variables(calc( @icon-size-md / 10), @icon-size-md, @theme-vars[loader-primary-color], @the
me-vars[loader-primary-fade-color]);
}
} |
I agree @offtherailz |
…source (geosolutions-it#9044) (cherry picked from commit 278daab)
Description
When saving a resource (no matter if it is a map, dashboard or geostory) the loading spinner no longer appear. This is a regression. To check possibly what introduced it.
How to reproduce
Expected Result
The loading spinner should appear on bottom-left of the edit properties panel (also from home page).
Current Result
The loading spinner doesn't appear.
Browser info
(use this site: https://www.whatsmybrowser.org/ for non expert users)Other useful information
The text was updated successfully, but these errors were encountered: