[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 {
|
export class ConnectAdminCustomizationComponent implements OnInit {
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
savingChanges = false;
|
savingChanges = false;
|
||||||
|
cssCreated: number = 0;
|
||||||
|
totalLayouts: number = 0;
|
||||||
community;
|
community;
|
||||||
properties = properties;
|
properties = properties;
|
||||||
|
|
||||||
|
@ -66,6 +68,7 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
||||||
let defaultCssIsSaved = false;
|
let defaultCssIsSaved = false;
|
||||||
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(layouts => {
|
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(layouts => {
|
||||||
|
|
||||||
|
this.totalLayouts = layouts ? layouts.length : 0;
|
||||||
for(let layout of layouts){
|
for(let layout of layouts){
|
||||||
layout.date = date;
|
layout.date = date;
|
||||||
if(layout.portalPid == 'connect'){
|
if(layout.portalPid == 'connect'){
|
||||||
|
@ -79,11 +82,13 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!connectCssIsSaved){
|
if(!connectCssIsSaved){
|
||||||
|
this.totalLayouts++;
|
||||||
let layout = new Layout("connect", null);
|
let layout = new Layout("connect", null);
|
||||||
layout.date = date;
|
layout.date = date;
|
||||||
this.callSaveAndCreate(layout, "connect")
|
this.callSaveAndCreate(layout, "connect")
|
||||||
}
|
}
|
||||||
if(!defaultCssIsSaved){
|
if(!defaultCssIsSaved){
|
||||||
|
this.totalLayouts++;
|
||||||
let layout = new Layout("default", null);
|
let layout = new Layout("default", null);
|
||||||
layout.date = date;
|
layout.date = date;
|
||||||
this.callSaveAndCreate(layout, "connect")
|
this.callSaveAndCreate(layout, "connect")
|
||||||
|
@ -100,16 +105,22 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
||||||
pos: 'bottom-right'
|
pos: 'bottom-right'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.cssCreated++;
|
||||||
|
if(this.cssCreated == this.totalLayouts) {
|
||||||
|
this.savingChanges = false;
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
purgeBrowserCache() {
|
purgeBrowserCache() {
|
||||||
|
this.savingChanges = true;
|
||||||
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
|
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
|
||||||
communities => {
|
communities => {
|
||||||
communities.forEach(community => {
|
communities.forEach(community => {
|
||||||
this._clearCacheService.purgeBrowserCache("Layout added/ updated", community.communityId);
|
this._clearCacheService.purgeBrowserCache("Layout added/ updated", community.communityId);
|
||||||
});
|
});
|
||||||
|
this.savingChanges = false;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
this._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
|
this._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
|
||||||
|
|
Loading…
Reference in New Issue