[plugins-functionality | DONE | CHANGED ] Change the way the cache is cleared
This commit is contained in:
parent
750b279ed3
commit
9044ed174f
|
@ -143,7 +143,7 @@ export class DivIdsComponent implements OnInit {
|
|||
this.deleteDivIdsFromArray(this.selectedDivIds);
|
||||
NotificationHandler.rise('Classes have been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Class ids deleted");
|
||||
//this._clearCacheService.clearCache("Class ids deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected classes', error)
|
||||
));
|
||||
|
@ -195,7 +195,7 @@ export class DivIdsComponent implements OnInit {
|
|||
divId => {
|
||||
this.divIdSavedSuccessfully(divId);
|
||||
NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully created</b>');
|
||||
this._clearCacheService.clearCache("Class id saved");
|
||||
//this._clearCacheService.clearCache("Class id saved");
|
||||
},
|
||||
error => this.handleUpdateError("System error creating class", error)
|
||||
));
|
||||
|
@ -204,7 +204,7 @@ export class DivIdsComponent implements OnInit {
|
|||
divId => {
|
||||
this.divIdUpdatedSuccessfully(divId);
|
||||
NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully updated</b>');
|
||||
this._clearCacheService.clearCache("Class id updated");
|
||||
//this._clearCacheService.clearCache("Class id updated");
|
||||
},
|
||||
error => this.handleUpdateError("System error updating class", error)
|
||||
));
|
||||
|
|
|
@ -166,7 +166,7 @@ export class ClassContentFormComponent implements OnInit {
|
|||
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
|
||||
NotificationHandler.rise('Page content has been <b>successfully updated</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Class help text saved or updated");
|
||||
this._clearCacheService.clearCacheInRoute("Class help text saved or updated",this.portal, this.page.route);
|
||||
},
|
||||
err => this.handleUpdateError('System error saving page content', err)
|
||||
));
|
||||
|
|
|
@ -155,7 +155,7 @@ export class ClassHelpContentsComponent implements OnInit {
|
|||
this.deletePageHelpContentsFromArray(this.selectedPageContents);
|
||||
NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Class text texts deleted");
|
||||
this._clearCacheService.clearCacheInRoute("Class text texts deleted",this.portal, this.page.route);
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected page content(s)', error)
|
||||
));
|
||||
|
@ -198,7 +198,7 @@ export class ClassHelpContentsComponent implements OnInit {
|
|||
this.countClassHelpContents();
|
||||
this.applyCheck(false);
|
||||
NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>');
|
||||
this._clearCacheService.clearCache("class help text's status changed");
|
||||
this._clearCacheService.clearCacheInRoute("class help text's status changed",this.portal, this.page.route);
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||
));
|
||||
|
|
|
@ -202,8 +202,8 @@ export class EntitiesComponent implements OnInit {
|
|||
this.deleteEntitiesFromArray(this.selectedEntities);
|
||||
NotificationHandler.rise('Entities have been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("entities deleted");
|
||||
this._clearCacheService.purgeBrowserCache("entities deleted", this.portal);
|
||||
// this._clearCacheService.clearCache("entities deleted");
|
||||
// this._clearCacheService.purgeBrowserCache("entities deleted", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected entities', error)
|
||||
);
|
||||
|
@ -244,8 +244,8 @@ export class EntitiesComponent implements OnInit {
|
|||
entity => {
|
||||
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);
|
||||
// this._clearCacheService.clearCache("entity updated");
|
||||
// this._clearCacheService.purgeBrowserCache("entity updated", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error updating entity', error)
|
||||
);
|
||||
|
@ -254,8 +254,8 @@ export class EntitiesComponent implements OnInit {
|
|||
entity => {
|
||||
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)
|
||||
// this._clearCacheService.clearCache("entity saved");
|
||||
// this._clearCacheService.purgeBrowserCache("entity saved", this.portal)
|
||||
},
|
||||
error => this.handleUpdateError('System error creating entity', error)
|
||||
);
|
||||
|
@ -345,7 +345,7 @@ export class EntitiesComponent implements OnInit {
|
|||
this.checkboxes[i].entity.isEnabled = this.toggleStatus;
|
||||
}
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("entity's status changed");
|
||||
this._clearCacheService.clearCacheInRoute("entity's status changed", this.portal, "/");
|
||||
this._clearCacheService.purgeBrowserCache("entity's status changed", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)
|
||||
|
|
|
@ -199,7 +199,7 @@ export class PageContentFormComponent implements OnInit {
|
|||
NotificationHandler.rise('Page content has been <b>successfully ' + (this.pageContentId ? 'updated' : 'created') + '</b>');
|
||||
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("page help content saved");
|
||||
this._clearCacheService.clearCacheInRoute("page help content saved",this.portal, this.page.route);
|
||||
},
|
||||
err => this.handleUpdateError('System error saving page content', err)
|
||||
));
|
||||
|
|
|
@ -165,7 +165,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.deletePageHelpContentsFromArray(this.selectedPageContents);
|
||||
NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Help texts deleted");
|
||||
this._clearCacheService.clearCacheInRoute("Help texts deleted",this.portal, this.page.route);
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected page content(s)', error)
|
||||
));
|
||||
|
@ -210,7 +210,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>');
|
||||
this.countPageHelpContents();
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("Help text's status changed");
|
||||
this._clearCacheService.clearCacheInRoute("Help text's status changed",this.portal, this.page.route);
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||
));
|
||||
|
|
|
@ -271,8 +271,8 @@ export class MenuComponent implements OnInit {
|
|||
this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild);
|
||||
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);
|
||||
this._clearCacheService.clearCacheInRoute("Menu item deleted",this.portal, "/");
|
||||
|
||||
},
|
||||
error => this.handleError("Server error deleting menu item", error)
|
||||
)
|
||||
|
@ -313,8 +313,7 @@ export class MenuComponent implements OnInit {
|
|||
menuItem => {
|
||||
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);
|
||||
this._clearCacheService.clearCacheInRoute("Menu item saved",this.portal, "/");
|
||||
},
|
||||
error => this.handleError("System error creating menu item", error)
|
||||
)
|
||||
|
@ -325,8 +324,7 @@ export class MenuComponent implements OnInit {
|
|||
menuItem => {
|
||||
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);
|
||||
this._clearCacheService.clearCacheInRoute("Menu item updated",this.portal, "/");
|
||||
},
|
||||
error => this.handleError("System error updating menu item", error)
|
||||
)
|
||||
|
@ -392,8 +390,7 @@ export class MenuComponent implements OnInit {
|
|||
HelperFunctions.swap(temp, index, newIndex);
|
||||
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);
|
||||
this._clearCacheService.clearCacheInRoute("Menu items reordered",this.portal, "/");
|
||||
}, error => {
|
||||
this.handleError("System error reordering menu items", error);
|
||||
});
|
||||
|
@ -405,8 +402,7 @@ export class MenuComponent implements OnInit {
|
|||
HelperFunctions.swap(temp, index, newIndex);
|
||||
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);
|
||||
this._clearCacheService.clearCacheInRoute("Menu items reordered",this.portal, "/");
|
||||
}, error => {
|
||||
this.handleError("System error reordering menu items", error);
|
||||
});
|
||||
|
@ -421,8 +417,7 @@ export class MenuComponent implements OnInit {
|
|||
} else {
|
||||
this.showNormalMenu = status;
|
||||
}
|
||||
this._clearCacheService.clearCache("Menu toggled");
|
||||
this._clearCacheService.purgeBrowserCache("Menu toggled", this.portal);
|
||||
this._clearCacheService.clearCacheInRoute("Menu toggled",this.portal, "/");
|
||||
NotificationHandler.rise("Menu has been <b>successfully toggled to be "+(status?"visible":"hidden")+"</b>");
|
||||
}, error => {
|
||||
this.handleError("System error toggling menu", error);
|
||||
|
@ -434,8 +429,7 @@ export class MenuComponent implements OnInit {
|
|||
this.subscriptions.push(
|
||||
this._helpContentService.alignMenu(MenuAlignment[alignment], this.portal).subscribe(() => {
|
||||
this.featuredAlignment = alignment;
|
||||
this._clearCacheService.clearCache("Menu aligned");
|
||||
this._clearCacheService.purgeBrowserCache("Menu aligned", this.portal);
|
||||
this._clearCacheService.clearCacheInRoute("Menu aligned",this.portal, "/");
|
||||
NotificationHandler.rise("Menu has been <b>successfully "+alignment.toLowerCase()+" aligned</b>");
|
||||
}, error => {
|
||||
this.handleError("System error aligning menu to the "+alignment.toLowerCase(), error);
|
||||
|
|
|
@ -252,8 +252,8 @@ export class PagesComponent implements OnInit {
|
|||
this.deletePagesFromArray(this.selectedPages);
|
||||
NotificationHandler.rise('Pages have been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Pages deleted");
|
||||
this._clearCacheService.purgeBrowserCache("Pages deleted", this.portal);
|
||||
// this._clearCacheService.clearCache("Pages deleted");
|
||||
// this._clearCacheService.purgeBrowserCache("Pages deleted", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected pages', error)
|
||||
));
|
||||
|
@ -320,8 +320,8 @@ export class PagesComponent implements OnInit {
|
|||
page => {
|
||||
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);
|
||||
// this._clearCacheService.clearCache("Page saved");
|
||||
// this._clearCacheService.purgeBrowserCache("Page saved", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error creating page', error)
|
||||
));
|
||||
|
@ -330,8 +330,8 @@ export class PagesComponent implements OnInit {
|
|||
page => {
|
||||
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);
|
||||
// this._clearCacheService.clearCache("Page updated");
|
||||
// this._clearCacheService.purgeBrowserCache("Page updated", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error updating page', error)
|
||||
));
|
||||
|
@ -415,7 +415,7 @@ export class PagesComponent implements OnInit {
|
|||
this.checkboxes[i].page.isEnabled = status;
|
||||
}
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("Page's status changed");
|
||||
this._clearCacheService.clearCacheInRoute("Page's status changed",this.portal, "/");
|
||||
this._clearCacheService.purgeBrowserCache("Page's status changed", this.portal);
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
|
||||
|
|
|
@ -36,7 +36,7 @@ import {PluginEditEvent} from "../utils/base-plugin.form.component";
|
|||
})
|
||||
export class PluginsFormComponent implements OnInit {
|
||||
private selectedId: string;
|
||||
public pluginsByPlacement: Map<string,{plugin:Plugin, template:PluginTemplate}[]> = new Map();
|
||||
public pluginsByPlacement: Map<string,{plugin:Plugin, template:PluginTemplate, openPreview:boolean}[]> = new Map();
|
||||
public plugins: Plugin[] = [];
|
||||
public pluginTemplates: PluginTemplate[] = [];
|
||||
public selectedTemplate: PluginTemplate = null;
|
||||
|
@ -65,6 +65,7 @@ export class PluginsFormComponent implements OnInit {
|
|||
public templateCode:string = null;
|
||||
public template;
|
||||
public selectedPlacementView = "all";
|
||||
public sinlgePlacementAvailable = false;
|
||||
communityInfo:CommunityInfo = null;
|
||||
editSubmenuOpen = false;
|
||||
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router,
|
||||
|
@ -158,13 +159,21 @@ export class PluginsFormComponent implements OnInit {
|
|||
this.plugins.push(plugin);
|
||||
}
|
||||
plugin.object = PluginUtils.initializeObjectAndCompare(_.code,plugin.object)
|
||||
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _ });
|
||||
this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _ , openPreview:false});
|
||||
});
|
||||
let availablePlacements = [];
|
||||
for(let placement of this.pluginUtils.placementsOptions){
|
||||
if(this.pluginsByPlacement.get(placement.value).length > 0){
|
||||
availablePlacements.push(placement.value);
|
||||
}
|
||||
this.pluginsByPlacement.get(placement.value).sort(function (a, b) {
|
||||
return a.plugin.order - b.plugin.order;
|
||||
})
|
||||
}
|
||||
if(availablePlacements.length == 1){
|
||||
this.selectedPlacementView == availablePlacements[0];
|
||||
this.sinlgePlacementAvailable = true
|
||||
}
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => this.handleError('System error retrieving plugins', error)));
|
||||
|
@ -250,7 +259,7 @@ export class PluginsFormComponent implements OnInit {
|
|||
this.savePlugin(plugin,update, this.index)
|
||||
}
|
||||
public savePlugin(plugin, update, index){
|
||||
this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
this.subscriptions.push(this._pluginsService.savePlugin(plugin, this.properties.adminToolsAPIURL,this.selectedCommunityPid ).subscribe(
|
||||
saved => {
|
||||
this.savedSuccessfully(saved, update, index);
|
||||
this.editView = false;
|
||||
|
@ -408,7 +417,7 @@ export class PluginsFormComponent implements OnInit {
|
|||
if(plugin._id) {
|
||||
this.subscriptions.push(this._pluginsService.updatePluginOrder(plugin, this.properties.adminToolsAPIURL, up ? -1 : 1, this.selectedCommunityPid).subscribe(
|
||||
saved => {
|
||||
this.pluginsByPlacement.get(placement)[index].plugin = saved;
|
||||
this.pluginsByPlacement.get(placement)[index].plugin = saved;
|
||||
},
|
||||
error => this.handleUpdateError("System error creating template", error)
|
||||
));
|
||||
|
|
|
@ -266,6 +266,7 @@ export class PluginsComponent implements OnInit {
|
|||
this.selectTemplateView = false;
|
||||
this.selectedTemplate = null;
|
||||
this.selectedPlugin = null;
|
||||
this.clearCache();
|
||||
},
|
||||
error => this.handleUpdateError("System error creating template", error)
|
||||
));
|
||||
|
@ -378,8 +379,7 @@ export class PluginsComponent implements OnInit {
|
|||
() => {
|
||||
|
||||
this.pluginsByPlacement.get(placement)[i].plugin.active = status;
|
||||
this._clearCacheService.clearCache("Plugin's status changed");
|
||||
this._clearCacheService.purgeBrowserCache("Plugin's status changed", this.portal);
|
||||
this.clearCache();
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of Plugin', error)
|
||||
));
|
||||
|
@ -418,6 +418,7 @@ export class PluginsComponent implements OnInit {
|
|||
this.subscriptions.push(this._pluginsService.updatePluginOrder(plugin, this.properties.adminToolsAPIURL, up ? -1 : 1, this.selectedCommunityPid).subscribe(
|
||||
saved => {
|
||||
this.pluginsByPlacement.get(placement)[index].plugin = saved;
|
||||
this.clearCache();
|
||||
},
|
||||
error => this.handleUpdateError("System error creating template", error)
|
||||
));
|
||||
|
@ -426,5 +427,10 @@ export class PluginsComponent implements OnInit {
|
|||
plugin.order = plugin.order + (up ? -1 : 1)
|
||||
this.savePlugin(plugin, true, index);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
clearCache(){
|
||||
this._clearCacheService.clearCacheInRoute(null, this.selectedCommunityPid, this.getPageById(this.selectedPageId).route)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ export class PluginTemplatesComponent implements OnInit {
|
|||
this.deleteFromArray(this.selectedTemplate);
|
||||
NotificationHandler.rise('Template have been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Template id deleted");
|
||||
// this._clearCacheService.clearCache("Template id deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected Template', error)
|
||||
));
|
||||
|
@ -231,7 +231,7 @@ export class PluginTemplatesComponent implements OnInit {
|
|||
saved => {
|
||||
this.savedSuccessfully(saved, true);
|
||||
|
||||
this._clearCacheService.clearCache("Template updates");
|
||||
// this._clearCacheService.clearCache("Template updates");
|
||||
},
|
||||
error => this.handleUpdateError("System error creating template", error)
|
||||
));
|
||||
|
@ -257,7 +257,7 @@ export class PluginTemplatesComponent implements OnInit {
|
|||
this.selectedTemplate = saved;
|
||||
this.savedSuccessfully(saved, update);
|
||||
NotificationHandler.rise('Template <b>' + saved.name + '</b> has been <b>successfully' + (update ? ' updated ' : ' created ') + '</b>');
|
||||
this._clearCacheService.clearCache("Template id saved");
|
||||
// this._clearCacheService.clearCache("Template id saved");
|
||||
},
|
||||
error => this.handleUpdateError("System error creating template", error)
|
||||
));
|
||||
|
|
|
@ -137,7 +137,7 @@ export class PortalsComponent implements OnInit {
|
|||
this.deletePortalsFromArray(this.selectedPortals);
|
||||
NotificationHandler.rise('Portals have been <b>successfully deleted</b>');
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("Portals deleted");
|
||||
// this._clearCacheService.clearCache("Portals deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected communities', error)
|
||||
));
|
||||
|
@ -188,7 +188,7 @@ export class PortalsComponent implements OnInit {
|
|||
portal => {
|
||||
this.portalUpdatedSuccessfully(portal);
|
||||
NotificationHandler.rise('Portal <b>' + portal.name + '</b> has been <b>successfully updated</b>');
|
||||
this._clearCacheService.clearCache("Portal updated");
|
||||
//this._clearCacheService.clearCache("Portal updated");
|
||||
},
|
||||
error => this.handleUpdateError('System error updating portal', error)
|
||||
));
|
||||
|
@ -198,7 +198,7 @@ export class PortalsComponent implements OnInit {
|
|||
portal => {
|
||||
this.portalSavedSuccessfully(portal);
|
||||
NotificationHandler.rise('Portal <b>' + portal.name + '</b> has been <b>successfully created</b>');
|
||||
this._clearCacheService.clearCache("Portal saved");
|
||||
//this._clearCacheService.clearCache("Portal saved");
|
||||
},
|
||||
error => this.handleUpdateError('System error creating portal', error)
|
||||
));
|
||||
|
|
|
@ -224,7 +224,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
}
|
||||
this.filterActiveBySearch(this.filterForm.value.active);
|
||||
this.userManagementService.updateUserInfo();
|
||||
this.clearCacheService.clearCache(this.role + 's of ' + this.id + ' have been updated');
|
||||
this.clearCacheService.clearCacheInRoute(this.role + 's of ' + this.id + ' have been updated',this.id, "/");
|
||||
this.clearCacheService.clearCacheInRoute(this.role + 's of ' + this.id + ' have been updated',this.id, "/curators");
|
||||
NotificationHandler.rise(this.selectedUser + ' <b>is no longer</b> ' + this.role + ' of ' + this.name + ' Dashboard');
|
||||
this.loadActive = false;
|
||||
}, error => {
|
||||
|
|
|
@ -211,7 +211,7 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
|||
public verifyManager() {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this.userRegistryService.verify(this.verification.id, this.code.value).subscribe(() => {
|
||||
this.clearCacheService.clearCache('Managers updated');
|
||||
// this.clearCacheService.clearCache('Managers updated');
|
||||
this.managerModal.cancel();
|
||||
this.error = null;
|
||||
this.userManagementService.updateUserInfo(() => {
|
||||
|
@ -255,7 +255,7 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
|
|||
this.loading = true;
|
||||
if (!this.isMember) {
|
||||
this.subscriptions.push(this.userRegistryService.verify(this.verification.id, this.code.value, "member").subscribe(() => {
|
||||
this.clearCacheService.clearCache('Members updated');
|
||||
// this.clearCacheService.clearCache('Members updated');
|
||||
this.loading = false;
|
||||
this.error = null;
|
||||
this.isMember = true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Injectable} from "@angular/core";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {HttpClient, HttpHeaders} from "@angular/common/http";
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {CustomOptions} from "./servicesUtils/customOptions.class";
|
||||
|
||||
|
@ -10,14 +10,34 @@ export class ClearCacheService {
|
|||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
clearCache(message: string = null) {
|
||||
|
||||
clearCache(message: string = null, url:string = null) {
|
||||
if(properties.deleteCacheUrl) {
|
||||
this.http.get(properties.deleteCacheUrl).subscribe(
|
||||
this.http.get(properties.deleteCacheUrl + (url?'?url='+url:'')).subscribe(
|
||||
res => console.log((message ? message + ": " : "") + "Cache cleared!"),
|
||||
err => console.log((message ? message + ": " : "") + "Cache could not be cleared ", err)
|
||||
);
|
||||
}
|
||||
}
|
||||
clearCacheInRoute(message: string = null, pid:string, route:string = "/") {
|
||||
let domain = "";
|
||||
if(properties.environment == 'production' || properties.environment == 'beta') {
|
||||
domain = 'https://' + (properties.environment == 'production' ? '' : 'beta.') + pid + '.openaire.eu';
|
||||
}
|
||||
domain = properties.connectPortalUrl;
|
||||
this.http.get(domain + route + '?forceCacheReload=true',
|
||||
{
|
||||
headers: new HttpHeaders({
|
||||
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
||||
'Pragma': 'no-cache',
|
||||
'Expires': '0',
|
||||
})
|
||||
}).subscribe(
|
||||
res => console.log((message ? message + ": " : "") + "Cache cleared!"),
|
||||
err => console.log((message ? message + ": " : "") + "Cache could not be cleared ", err)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
purgeBrowserCache(message: string = null, pid: string) {
|
||||
if(properties.deleteBrowserCacheUrl) {
|
||||
|
|
Loading…
Reference in New Issue