[Connect Admin | Library | new-theme]: Added call to purge browser cache when updating content of community.

1. env-properties.ts & environments/: Added property "deleteBrowserCacheUrl".
2. clear-cache.service.ts: Added method "purgeBrowserCache()" to purge browser cache for a specific community.
3. entities.component.ts & menu.component.ts & pages.component.ts & affiliations.component.ts & edit-community.component.ts add-content-providers.component.ts & remove-content-providers.component.ts & add-projects.component.ts & remove-projects.component.ts & subjects-edit-form.component.ts & personal-info.component.ts & customization.component.ts: Call "_clearCacheService.purgeBrowserCache()" when adding/updating/deleting content of a specific community.
4. connect-admin-customization.module.ts: Added CommunitiesService in providers.
5. connect-admin-customization.component.ts: Added button to purge browser cache for all communities and connect.
This commit is contained in:
Konstantina Galouni 2022-08-11 12:58:20 +03:00
parent ac70b8c260
commit 27d7c7c118
5 changed files with 25 additions and 0 deletions

View File

@ -203,6 +203,7 @@ export class EntitiesComponent implements OnInit {
NotificationHandler.rise('Entities have been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("entities deleted");
this._clearCacheService.purgeBrowserCache("entities deleted", this.portal);
},
error => this.handleUpdateError('System error deleting the selected entities', error)
);
@ -244,6 +245,7 @@ export class EntitiesComponent implements OnInit {
this.entityUpdatedSuccessfully(entity);
NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("entity updated");
this._clearCacheService.purgeBrowserCache("entity updated", this.portal);
},
error => this.handleUpdateError('System error updating entity', error)
);
@ -253,6 +255,7 @@ export class EntitiesComponent implements OnInit {
this.entitySavedSuccessfully(entity);
NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("entity saved");
this._clearCacheService.purgeBrowserCache("entity saved", this.portal)
},
error => this.handleUpdateError('System error creating entity', error)
);
@ -343,6 +346,7 @@ export class EntitiesComponent implements OnInit {
}
this.applyCheck(false);
this._clearCacheService.clearCache("entity's status changed");
this._clearCacheService.purgeBrowserCache("entity's status changed", this.portal);
},
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)
);

View File

@ -265,6 +265,7 @@ export class MenuComponent implements OnInit {
NotificationHandler.rise("Menu item have been <b>successfully deleted</b>");
this.showLoading = false;
this._clearCacheService.clearCache("Menu item deleted");
this._clearCacheService.purgeBrowserCache("Menu item deleted", this.portal);
},
error => this.handleError("Server error deleting menu item", error)
)
@ -306,6 +307,7 @@ export class MenuComponent implements OnInit {
this.menuItemSavedSuccessfully(menuItem, true);
NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("Menu item saved");
this._clearCacheService.purgeBrowserCache("Menu item saved", this.portal);
},
error => this.handleError("System error creating menu item", error)
)
@ -317,6 +319,7 @@ export class MenuComponent implements OnInit {
this.menuItemSavedSuccessfully(menuItem, false);
NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("Menu item updated");
this._clearCacheService.purgeBrowserCache("Menu item updated", this.portal);
},
error => this.handleError("System error updating menu item", error)
)
@ -383,6 +386,7 @@ export class MenuComponent implements OnInit {
this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => {
HelperFunctions.swap(this.featuredMenuItems, index, newIndex);
this._clearCacheService.clearCache("Menu items reordered");
this._clearCacheService.purgeBrowserCache("Menu items reordered", this.portal);
}, error => {
this.handleError("System error reordering menu items", error);
});
@ -395,6 +399,7 @@ export class MenuComponent implements OnInit {
this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => {
HelperFunctions.swap(children && children.length ? children : this.normalMenuItems, index, newIndex);
this._clearCacheService.clearCache("Menu items reordered");
this._clearCacheService.purgeBrowserCache("Menu items reordered", this.portal);
}, error => {
this.handleError("System error reordering menu items", error);
});
@ -410,6 +415,7 @@ export class MenuComponent implements OnInit {
this.showNormalMenu = status;
}
this._clearCacheService.clearCache("Menu toggled");
this._clearCacheService.purgeBrowserCache("Menu toggled", this.portal);
}, error => {
this.handleError("System error toggling menu", error);
})

View File

@ -250,6 +250,7 @@ export class PagesComponent implements OnInit {
NotificationHandler.rise('Pages have been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Pages deleted");
this._clearCacheService.purgeBrowserCache("Pages deleted", this.portal);
},
error => this.handleUpdateError('System error deleting the selected pages', error)
));
@ -317,6 +318,7 @@ export class PagesComponent implements OnInit {
this.pageSavedSuccessfully(page, true);
NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("Page saved");
this._clearCacheService.purgeBrowserCache("Page saved", this.portal);
},
error => this.handleUpdateError('System error creating page', error)
));
@ -326,6 +328,7 @@ export class PagesComponent implements OnInit {
this.pageSavedSuccessfully(page, false);
NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("Page updated");
this._clearCacheService.purgeBrowserCache("Page updated", this.portal);
},
error => this.handleUpdateError('System error updating page', error)
));
@ -410,6 +413,7 @@ export class PagesComponent implements OnInit {
}
this.applyCheck(false);
this._clearCacheService.clearCache("Page's status changed");
this._clearCacheService.purgeBrowserCache("Page's status changed", this.portal);
},
error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
));

View File

@ -17,4 +17,14 @@ export class ClearCacheService {
);
}
}
purgeBrowserCache(message: string = null, pid: string) {
if(properties.deleteBrowserCacheUrl) {
let url = properties.deleteBrowserCacheUrl.replace("{pid}", pid);
this.http.get(url).subscribe(
res => console.log((message ? message + ": " : "") + "Browser Cache purged!"),
err => console.log((message ? message + ": " : "") + "Browser Cache could not be purged ", err)
);
}
}
}

View File

@ -69,6 +69,7 @@ export interface EnvProperties {
feedbackmailForMissingEntities?: string;
cacheUrl?: string;
deleteCacheUrl?: string;
deleteBrowserCacheUrl?: string;
monitorServiceAPIURL?: string;
adminToolsAPIURL?: string;
adminToolsCommunity?: string;