[Connect Admin | develop]: connect-admin-customization.component.ts: [Bug fix] Set savingChanges to false when all css are updated and set it to true when purging caches.
This commit is contained in:
parent
698174e302
commit
2c9e3e304d
|
@ -42,6 +42,8 @@ declare var UIkit;
|
|||
export class ConnectAdminCustomizationComponent implements OnInit {
|
||||
private subscriptions: any[] = [];
|
||||
savingChanges = false;
|
||||
cssCreated: number = 0;
|
||||
totalLayouts: number = 0;
|
||||
community;
|
||||
properties = properties;
|
||||
|
||||
|
@ -66,6 +68,7 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
|||
let defaultCssIsSaved = false;
|
||||
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(layouts => {
|
||||
|
||||
this.totalLayouts = layouts ? layouts.length : 0;
|
||||
for(let layout of layouts){
|
||||
layout.date = date;
|
||||
if(layout.portalPid == 'connect'){
|
||||
|
@ -79,11 +82,13 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
if(!connectCssIsSaved){
|
||||
this.totalLayouts++;
|
||||
let layout = new Layout("connect", null);
|
||||
layout.date = date;
|
||||
this.callSaveAndCreate(layout, "connect")
|
||||
}
|
||||
if(!defaultCssIsSaved){
|
||||
this.totalLayouts++;
|
||||
let layout = new Layout("default", null);
|
||||
layout.date = date;
|
||||
this.callSaveAndCreate(layout, "connect")
|
||||
|
@ -100,16 +105,22 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
|||
pos: 'bottom-right'
|
||||
});
|
||||
|
||||
this.cssCreated++;
|
||||
if(this.cssCreated == this.totalLayouts) {
|
||||
this.savingChanges = false;
|
||||
}
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
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");
|
||||
|
|
Loading…
Reference in New Issue