[develop | DONE | FIXED ]connect admin: ad delay in update css and purge browser cache to avoid browser blocking requests

This commit is contained in:
argirok 2024-11-04 10:23:10 +02:00
parent 400cda2022
commit 3c8540db4c
1 changed files with 20 additions and 12 deletions

View File

@ -26,8 +26,10 @@ declare var UIkit;
</div>
<div class="uk-margin-medium-top">
<div>Purge ICM cache for all communities</div>
<button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-top" [class.uk-disabled]="savingChanges"> Purge Browser Cache</button>
<button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-top"
[class.uk-disabled]="savingChanges || !properties.deleteBrowserCacheUrl"> Purge Browser Cache</button>
<hr>
</div>
<div class="uk-margin-medium-top">
@ -81,7 +83,7 @@ export class ConnectAdminCustomizationComponent implements OnInit {
this.savingChanges = true;
let connectCssIsSaved = false;
let defaultCssIsSaved = false;
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(layouts => {
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(async layouts => {
this.totalLayouts = layouts ? layouts.length : 0;
for(let layout of layouts){
@ -95,6 +97,8 @@ export class ConnectAdminCustomizationComponent implements OnInit {
}else {
this.callSaveAndCreate(layout, "community");
}
await new Promise((resolve) => setTimeout(resolve, 100));
}
if(!connectCssIsSaved){
this.totalLayouts++;
@ -129,16 +133,20 @@ export class ConnectAdminCustomizationComponent implements OnInit {
}
purgeBrowserCache() {
this.savingChanges = true;
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
communities => {
communities.forEach(community => {
this._clearCacheService.purgeBrowserCache("Layout added/ updated", community.communityId);
});
this.savingChanges = false;
}
));
this._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
if(properties.deleteBrowserCacheUrl) {
this.savingChanges = true;
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
async communities => {
for (const community1 of communities) {
this._clearCacheService.purgeBrowserCache("Layout added/ updated", community1.communityId);
await new Promise((resolve) => setTimeout(resolve, 100));
}
this.savingChanges = false;
}
));
this._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
}
}
deleteLayout(){