Merge pull request #4973 from GabrielInTheWorld/fixSpinner
Improves the spinner
This commit is contained in:
commit
a193cc1e3f
@ -199,7 +199,7 @@ export class AppComponent {
|
|||||||
*/
|
*/
|
||||||
private checkConnectionProgress(): void {
|
private checkConnectionProgress(): void {
|
||||||
if ((this.user || this.operator.isAnonymous) && this.isStable) {
|
if ((this.user || this.operator.isAnonymous) && this.isStable) {
|
||||||
this.overlayService.setSpinner(false, null, true);
|
this.overlayService.setSpinner(false, null, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,7 @@ export class OverlayService {
|
|||||||
/**
|
/**
|
||||||
* Boolean, whether appearing of the spinner should be prevented next time.
|
* Boolean, whether appearing of the spinner should be prevented next time.
|
||||||
*/
|
*/
|
||||||
private preventAppearingSpinner: boolean;
|
private preventAppearingSpinner = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Boolean to indicate, if the spinner has already appeared.
|
|
||||||
*/
|
|
||||||
private spinnerHasAppeared = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -48,12 +43,9 @@ export class OverlayService {
|
|||||||
* @param text optional. If the spinner should show a message.
|
* @param text optional. If the spinner should show a message.
|
||||||
* @param preventAppearing optional. Wether to prevent showing the spinner the next time.
|
* @param preventAppearing optional. Wether to prevent showing the spinner the next time.
|
||||||
*/
|
*/
|
||||||
public setSpinner(isVisible: boolean, text?: string, preventAppearing?: boolean): void {
|
public setSpinner(isVisible: boolean, text?: string, forceAppearing?: boolean, preventAppearing?: boolean): void {
|
||||||
if (!(this.preventAppearingSpinner && !this.spinnerHasAppeared && isVisible)) {
|
if (!this.preventAppearingSpinner || forceAppearing) {
|
||||||
setTimeout(() => this.spinner.next({ isVisible, text }));
|
setTimeout(() => this.spinner.next({ isVisible, text }));
|
||||||
if (isVisible) {
|
|
||||||
this.spinnerHasAppeared = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.preventAppearingSpinner = preventAppearing;
|
this.preventAppearingSpinner = preventAppearing;
|
||||||
}
|
}
|
||||||
@ -93,7 +85,6 @@ export class OverlayService {
|
|||||||
* and still stays at the website.
|
* and still stays at the website.
|
||||||
*/
|
*/
|
||||||
public logout(): void {
|
public logout(): void {
|
||||||
this.spinnerHasAppeared = false;
|
|
||||||
this.preventAppearingSpinner = false;
|
this.preventAppearingSpinner = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ export class MotionMultiselectService {
|
|||||||
`\n${i} ` +
|
`\n${i} ` +
|
||||||
this.translate.instant('of') +
|
this.translate.instant('of') +
|
||||||
` ${motions.length}`;
|
` ${motions.length}`;
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.repo.delete(motion);
|
await this.repo.delete(motion);
|
||||||
}
|
}
|
||||||
this.overlayService.setSpinner(false);
|
this.overlayService.setSpinner(false);
|
||||||
@ -119,7 +119,7 @@ export class MotionMultiselectService {
|
|||||||
const selectedChoice = await this.choiceService.open(title, choices);
|
const selectedChoice = await this.choiceService.open(title, choices);
|
||||||
if (selectedChoice) {
|
if (selectedChoice) {
|
||||||
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.repo.setMultiState(motions, selectedChoice.items as number);
|
await this.repo.setMultiState(motions, selectedChoice.items as number);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -152,7 +152,7 @@ export class MotionMultiselectService {
|
|||||||
recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number)
|
recommendation: selectedChoice.action ? 0 : (selectedChoice.items as number)
|
||||||
}));
|
}));
|
||||||
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation/', {
|
await this.httpService.post('/rest/motions/motion/manage_multiple_recommendation/', {
|
||||||
motions: requestData
|
motions: requestData
|
||||||
});
|
});
|
||||||
@ -181,13 +181,8 @@ export class MotionMultiselectService {
|
|||||||
);
|
);
|
||||||
if (selectedChoice) {
|
if (selectedChoice) {
|
||||||
const message = this.translate.instant(this.messageForSpinner);
|
const message = this.translate.instant(this.messageForSpinner);
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.repo.setMultiCategory(motions, selectedChoice.items as number);
|
await this.repo.setMultiCategory(motions, selectedChoice.items as number);
|
||||||
// .catch(error => {
|
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
// throw error;
|
|
||||||
// });
|
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +208,6 @@ export class MotionMultiselectService {
|
|||||||
submitters: submitterIds
|
submitters: submitterIds
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
|
|
||||||
} else if (selectedChoice.action === choices[1]) {
|
} else if (selectedChoice.action === choices[1]) {
|
||||||
requestData = motions.map(motion => {
|
requestData = motions.map(motion => {
|
||||||
const submitterIdsToRemove = selectedChoice.items as number[];
|
const submitterIdsToRemove = selectedChoice.items as number[];
|
||||||
@ -226,9 +220,8 @@ export class MotionMultiselectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
|
await this.httpService.post('/rest/motions/motion/manage_multiple_submitters/', { motions: requestData });
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +249,6 @@ export class MotionMultiselectService {
|
|||||||
tags: tagIds
|
tags: tagIds
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
|
|
||||||
} else if (selectedChoice.action === choices[1]) {
|
} else if (selectedChoice.action === choices[1]) {
|
||||||
requestData = motions.map(motion => {
|
requestData = motions.map(motion => {
|
||||||
const tagIdsToRemove = selectedChoice.items as number[];
|
const tagIdsToRemove = selectedChoice.items as number[];
|
||||||
@ -266,7 +258,6 @@ export class MotionMultiselectService {
|
|||||||
tags: tagIds
|
tags: tagIds
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
|
|
||||||
} else if (selectedChoice.action === choices[2]) {
|
} else if (selectedChoice.action === choices[2]) {
|
||||||
requestData = motions.map(motion => {
|
requestData = motions.map(motion => {
|
||||||
return {
|
return {
|
||||||
@ -277,9 +268,8 @@ export class MotionMultiselectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
const message = `${motions.length} ` + this.translate.instant(this.messageForSpinner);
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
|
await this.httpService.post('/rest/motions/motion/manage_multiple_tags/', { motions: requestData });
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,14 +290,9 @@ export class MotionMultiselectService {
|
|||||||
);
|
);
|
||||||
if (selectedChoice) {
|
if (selectedChoice) {
|
||||||
const message = this.translate.instant(this.messageForSpinner);
|
const message = this.translate.instant(this.messageForSpinner);
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
const blockId = selectedChoice.action ? null : (selectedChoice.items as number);
|
const blockId = selectedChoice.action ? null : (selectedChoice.items as number);
|
||||||
await this.repo.setMultiMotionBlock(motions, blockId);
|
await this.repo.setMultiMotionBlock(motions, blockId);
|
||||||
// .catch(error => {
|
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
// throw error;
|
|
||||||
// });
|
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,9 +355,8 @@ export class MotionMultiselectService {
|
|||||||
if (selectedChoice && motions.length) {
|
if (selectedChoice && motions.length) {
|
||||||
const message = this.translate.instant(`I have ${motions.length} favorite motions. Please wait ...`);
|
const message = this.translate.instant(`I have ${motions.length} favorite motions. Please wait ...`);
|
||||||
const star = (selectedChoice.items as number) === choices[0].id;
|
const star = (selectedChoice.items as number) === choices[0].id;
|
||||||
this.overlayService.setSpinner(true, message);
|
this.overlayService.setSpinner(true, message, true);
|
||||||
await this.personalNoteService.bulkSetStar(motions, star);
|
await this.personalNoteService.bulkSetStar(motions, star);
|
||||||
// this.overlayService.setSpinner(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user