[Library & Connect Admin | new-theme]: edit-community.component.ts & portals.component.ts & pages.component.ts & page-help-content-form.component.ts & page-help-contents.component.ts & entities.component.ts & divIds.component.ts & class-help-content-form.component.ts & class-help-contents.component.ts: On save/update/delete/toggle community/page/entity/divId/helptext/divHelptext , call clearCache() to immediately get changes in the dashboards.

This commit is contained in:
Konstantina Galouni 2022-07-12 16:50:56 +03:00
parent ea95219728
commit 85a7030929
8 changed files with 46 additions and 8 deletions

View File

@ -13,6 +13,7 @@ import {AlertModal} from "../../utils/modal/alert";
import {Option} from "../../sharedComponents/input/input.component"; import {Option} from "../../sharedComponents/input/input.component";
import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component"; import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component";
import {Title} from "@angular/platform-browser"; import {Title} from "@angular/platform-browser";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -45,7 +46,8 @@ export class DivIdsComponent implements OnInit {
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router,
private title: Title, private title: Title,
private _helpContentService: HelpContentService, private _fb: FormBuilder) { private _helpContentService: HelpContentService, private _fb: FormBuilder,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -149,6 +151,7 @@ export class DivIdsComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("Class ids deleted");
}, },
error => this.handleUpdateError('System error deleting the selected classes', error) error => this.handleUpdateError('System error deleting the selected classes', error)
)); ));
@ -204,6 +207,7 @@ export class DivIdsComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("Class id saved");
}, },
error => this.handleUpdateError("System error creating class", error) error => this.handleUpdateError("System error creating class", error)
)); ));
@ -217,6 +221,7 @@ export class DivIdsComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("Class id updated");
}, },
error => this.handleUpdateError("System error updating class", error) error => this.handleUpdateError("System error updating class", error)
)); ));

View File

@ -12,6 +12,7 @@ import {Subscriber, Subscription, zip} from 'rxjs';
import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {DivHelpContent} from '../../utils/entities/adminTool/div-help-content'; import {DivHelpContent} from '../../utils/entities/adminTool/div-help-content';
import {NotificationHandler} from "../../utils/notification-handler"; import {NotificationHandler} from "../../utils/notification-handler";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -33,7 +34,8 @@ export class ClassContentFormComponent implements OnInit {
public pageHelpContent: DivHelpContent; public pageHelpContent: DivHelpContent;
public stickyPageHeader: boolean = false; public stickyPageHeader: boolean = false;
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService) { constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder,
private _helpContentService: HelpContentService, private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -154,6 +156,7 @@ export class ClassContentFormComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("Class help text saved or updated");
}, },
err => this.handleUpdateError('System error saving page content', err) err => this.handleUpdateError('System error saving page content', err)
)); ));

View File

@ -14,6 +14,7 @@ import {properties} from '../../../../environments/environment';
import {DomSanitizer} from '@angular/platform-browser'; import {DomSanitizer} from '@angular/platform-browser';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {CheckDivHelpContent, DivHelpContent} from '../../utils/entities/adminTool/div-help-content'; import {CheckDivHelpContent, DivHelpContent} from '../../utils/entities/adminTool/div-help-content';
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -44,7 +45,9 @@ export class ClassHelpContentsComponent implements OnInit {
private subscriptions: any[] = []; private subscriptions: any[] = [];
public stickyPageHeader: boolean = false; public stickyPageHeader: boolean = false;
constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router,
private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -159,6 +162,7 @@ export class ClassHelpContentsComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("Class text texts deleted");
}, },
error => this.handleUpdateError('System error deleting the selected page content(s)', error) error => this.handleUpdateError('System error deleting the selected page content(s)', error)
)); ));
@ -205,6 +209,7 @@ export class ClassHelpContentsComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("class help text's status changed");
}, },
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
)); ));

View File

@ -18,6 +18,7 @@ import {CommunitiesService} from "../../connect/communities/communities.service"
import {CommunityService} from "../../connect/community/community.service"; import {CommunityService} from "../../connect/community/community.service";
import {CommunityInfo} from "../../connect/community/communityInfo"; import {CommunityInfo} from "../../connect/community/communityInfo";
import {Stakeholder, StakeholderInfo} from "../../monitor/entities/stakeholder"; import {Stakeholder, StakeholderInfo} from "../../monitor/entities/stakeholder";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -63,7 +64,8 @@ export class EntitiesComponent implements OnInit {
private _helpContentService: HelpContentService, private _helpContentService: HelpContentService,
private userManagementService: UserManagementService, private _fb: FormBuilder, private userManagementService: UserManagementService, private _fb: FormBuilder,
private communityService: CommunityService, private communityService: CommunityService,
private stakeholderService: StakeholderService) { private stakeholderService: StakeholderService,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -206,6 +208,7 @@ export class EntitiesComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("entities deleted");
}, },
error => this.handleUpdateError('System error deleting the selected entities', error) error => this.handleUpdateError('System error deleting the selected entities', error)
); );
@ -250,6 +253,7 @@ export class EntitiesComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("entity updated");
}, },
error => this.handleUpdateError('System error updating entity', error) error => this.handleUpdateError('System error updating entity', error)
); );
@ -262,6 +266,7 @@ export class EntitiesComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("entity saved");
}, },
error => this.handleUpdateError('System error creating entity', error) error => this.handleUpdateError('System error creating entity', error)
); );
@ -357,6 +362,7 @@ export class EntitiesComponent implements OnInit {
this.checkboxes[i].entity.isEnabled = this.toggleStatus; this.checkboxes[i].entity.isEnabled = this.toggleStatus;
} }
this.applyCheck(false); this.applyCheck(false);
this._clearCacheService.clearCache("entity's status changed");
}, },
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error) error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)
); );

View File

@ -8,6 +8,7 @@ import {properties} from '../../../../environments/environment';
import {Subscriber, Subscription, zip} from 'rxjs'; import {Subscriber, Subscription, zip} from 'rxjs';
import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content'; import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content';
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -30,7 +31,8 @@ export class PageContentFormComponent implements OnInit {
public pageHelpContent: PageHelpContent; public pageHelpContent: PageHelpContent;
public stickyPageHeader: boolean = false; public stickyPageHeader: boolean = false;
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService) { constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder,
private _helpContentService: HelpContentService, private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -228,6 +230,7 @@ export class PageContentFormComponent implements OnInit {
}); });
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route}); this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("page help content saved");
}, },
err => this.handleUpdateError('System error saving page content', err) err => this.handleUpdateError('System error saving page content', err)
)); ));

View File

@ -17,6 +17,7 @@ import {Subscriber} from 'rxjs';
import {properties} from '../../../../environments/environment'; import {properties} from '../../../../environments/environment';
import {DomSanitizer} from '@angular/platform-browser'; import {DomSanitizer} from '@angular/platform-browser';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -48,7 +49,9 @@ export class PageHelpContentsComponent implements OnInit {
public stickyPageHeader: boolean = false; public stickyPageHeader: boolean = false;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router,
private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -170,6 +173,7 @@ export class PageHelpContentsComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("Help texts deleted");
}, },
error => this.handleUpdateError('System error deleting the selected page content(s)', error) error => this.handleUpdateError('System error deleting the selected page content(s)', error)
)); ));
@ -218,6 +222,7 @@ export class PageHelpContentsComponent implements OnInit {
}); });
this.countPageHelpContents(); this.countPageHelpContents();
this.applyCheck(false); this.applyCheck(false);
this._clearCacheService.clearCache("Help text's status changed");
}, },
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
)); ));

View File

@ -20,6 +20,7 @@ import {StakeholderService} from '../../monitor/services/stakeholder.service';
import {CommunityInfo} from "../../connect/community/communityInfo"; import {CommunityInfo} from "../../connect/community/communityInfo";
import {Stakeholder} from "../../monitor/entities/stakeholder"; import {Stakeholder} from "../../monitor/entities/stakeholder";
import {CommunityService} from "../../connect/community/community.service"; import {CommunityService} from "../../connect/community/community.service";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -76,7 +77,8 @@ export class PagesComponent implements OnInit {
private _router: Router, private _helpContentService: HelpContentService, private _router: Router, private _helpContentService: HelpContentService,
private userManagementService: UserManagementService, private _fb: FormBuilder, private userManagementService: UserManagementService, private _fb: FormBuilder,
private communityService: CommunityService, private communityService: CommunityService,
private stakeholderService: StakeholderService) { private stakeholderService: StakeholderService,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -253,6 +255,7 @@ export class PagesComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("Pages deleted");
}, },
error => this.handleUpdateError('System error deleting the selected pages', error) error => this.handleUpdateError('System error deleting the selected pages', error)
)); ));
@ -323,6 +326,7 @@ export class PagesComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("Page saved");
}, },
error => this.handleUpdateError('System error creating page', error) error => this.handleUpdateError('System error creating page', error)
)); ));
@ -336,6 +340,7 @@ export class PagesComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("Page updated");
}, },
error => this.handleUpdateError('System error updating page', error) error => this.handleUpdateError('System error updating page', error)
)); ));
@ -425,6 +430,7 @@ export class PagesComponent implements OnInit {
this.checkboxes[i].page.isEnabled = status; this.checkboxes[i].page.isEnabled = status;
} }
this.applyCheck(false); this.applyCheck(false);
this._clearCacheService.clearCache("Page's status changed");
}, },
error => this.handleUpdateError('System error changing the status of the selected page(s)', error) error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
)); ));

View File

@ -14,6 +14,7 @@ import {properties} from "../../../../environments/environment";
import {AlertModal} from "../../utils/modal/alert"; import {AlertModal} from "../../utils/modal/alert";
import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component"; import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component";
import {Title} from "@angular/platform-browser"; import {Title} from "@angular/platform-browser";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -47,7 +48,8 @@ export class PortalsComponent implements OnInit {
constructor(private element: ElementRef, private route: ActivatedRoute, constructor(private element: ElementRef, private route: ActivatedRoute,
private title: Title, private title: Title,
private _router: Router, private _helpContentService: HelpContentService, private _fb: FormBuilder) { private _router: Router, private _helpContentService: HelpContentService, private _fb: FormBuilder,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -145,6 +147,7 @@ export class PortalsComponent implements OnInit {
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.showLoading = false; this.showLoading = false;
this._clearCacheService.clearCache("Portals deleted");
}, },
error => this.handleUpdateError('System error deleting the selected communities', error) error => this.handleUpdateError('System error deleting the selected communities', error)
)); ));
@ -200,6 +203,7 @@ export class PortalsComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("Portal updated");
}, },
error => this.handleUpdateError('System error updating portal', error) error => this.handleUpdateError('System error updating portal', error)
)); ));
@ -213,6 +217,7 @@ export class PortalsComponent implements OnInit {
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this._clearCacheService.clearCache("Portal saved");
}, },
error => this.handleUpdateError('System error creating portal', error) error => this.handleUpdateError('System error creating portal', error)
)); ));