[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 de28e80413
commit 92b5d7bb33
15 changed files with 66 additions and 28 deletions

@ -1 +1 @@
Subproject commit f8f606ada7d1db53a2ee3566ac601abf640a2187 Subproject commit 27d7c7c118a363c2db3deb8ee13ff8801ebed3a8

View File

@ -16,6 +16,7 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler"; import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
@Component({ @Component({
selector: 'affiliations', selector: 'affiliations',
@ -41,7 +42,8 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
private fb: FormBuilder, private fb: FormBuilder,
private communityService: CommunityService, private communityService: CommunityService,
private affiliationService: AffiliationService, private affiliationService: AffiliationService,
private helpContentService: HelpContentService) { private helpContentService: HelpContentService,
private _clearCacheService: ClearCacheService) {
} }
@ -147,6 +149,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
} else { } else {
this.affiliations[this.index] = affiliation; this.affiliations[this.index] = affiliation;
} }
this._clearCacheService.purgeBrowserCache("Organization added/ updated", this.community.communityId);
if (affiliation.id) { if (affiliation.id) {
this.handleUpdateSuccess('Your organization has been updated successfully!'); this.handleUpdateSuccess('Your organization has been updated successfully!');
} else { } else {
@ -167,6 +170,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
if (this.currentPage.length === 0) { if (this.currentPage.length === 0) {
this.page = 1; this.page = 1;
} }
this._clearCacheService.purgeBrowserCache("Organization deleted", this.community.communityId);
this.handleUpdateSuccess('Organization has been deleted'); this.handleUpdateSuccess('Organization has been deleted');
}, },
error => { error => {
@ -193,6 +197,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
enableAffiliations() { enableAffiliations() {
this.helpContentService.togglePages(this.community.communityId, [this.organizationsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => { this.helpContentService.togglePages(this.community.communityId, [this.organizationsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.organizationsPage.isEnabled = true; this.organizationsPage.isEnabled = true;
this._clearCacheService.purgeBrowserCache("Organizations Page enabled", this.community.communityId);
NotificationHandler.rise('Organizations Page has been <b>enabled successfully</b>'); NotificationHandler.rise('Organizations Page has been <b>enabled successfully</b>');
}, error => { }, error => {
this.handleUpdateError('An error has been occurred. Try again later!'); this.handleUpdateError('An error has been occurred. Try again later!');

View File

@ -214,6 +214,7 @@ export class EditCommunityComponent {
this.subscriptions.push(this.communityService.updateCommunity( this.subscriptions.push(this.communityService.updateCommunity(
this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => { this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCache("Community saved"); this._clearCacheService.clearCache("Community saved");
this._clearCacheService.purgeBrowserCache("Community saved", this.community.communityId);
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => { this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully created</b>'); NotificationHandler.rise(community.shortTitle + ' has been <b>successfully created</b>');
callback(community); callback(community);
@ -227,6 +228,7 @@ export class EditCommunityComponent {
} else { } else {
this.subscriptions.push(this.communityService.updateCommunity(this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => { this.subscriptions.push(this.communityService.updateCommunity(this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCache("Community updated"); this._clearCacheService.clearCache("Community updated");
this._clearCacheService.purgeBrowserCache("Community updated", this.community.communityId);
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => { this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>'); NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>');
callback(community); callback(community);

View File

@ -3,6 +3,9 @@ import {Subscription} from 'rxjs';
import {CustomizationService} from "../../openaireLibrary/services/customization.service"; import {CustomizationService} from "../../openaireLibrary/services/customization.service";
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {Layout} from "../../openaireLibrary/connect/community/CustomizationOptions"; import {Layout} from "../../openaireLibrary/connect/community/CustomizationOptions";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
declare var UIkit; declare var UIkit;
@Component({ @Component({
@ -27,6 +30,7 @@ declare var UIkit;
Press the following button to update the timestamp in the saved layouts and recreate the css files. Press the following button to update the timestamp in the saved layouts and recreate the css files.
</div> </div>
<button (click)="updateCss()" class="uk-button uk-button-danger" [class.uk-disabled]="savingChanges"> Update CSS</button> <button (click)="updateCss()" class="uk-button uk-button-danger" [class.uk-disabled]="savingChanges"> Update CSS</button>
<button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-left" [class.uk-disabled]="savingChanges"> Purge Browser Cache</button>
<ng-container *ngIf="properties.domain != 'production'"> <ng-container *ngIf="properties.domain != 'production'">
<hr> <hr>
<div class="uk-alert uk-alert-danger uk-margin-top "> <div class="uk-alert uk-alert-danger uk-margin-top ">
@ -49,7 +53,8 @@ export class ConnectAdminCustomizationComponent implements OnInit {
community; community;
properties = properties; properties = properties;
constructor( private customizationService: CustomizationService) { constructor( private customizationService: CustomizationService, private _clearCacheService: ClearCacheService,
private communitiesService: CommunitiesService) {
} }
ngOnInit() { ngOnInit() {
@ -113,4 +118,15 @@ export class ConnectAdminCustomizationComponent implements OnInit {
})); }));
} }
} }
purgeBrowserCache() {
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._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
}
} }

View File

@ -7,12 +7,13 @@ import {ConnectAdminCustomizationRoutingModule} from "./connect-admin-customizat
import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module"; import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module";
import {CustomizationService} from "../../openaireLibrary/services/customization.service"; import {CustomizationService} from "../../openaireLibrary/services/customization.service";
import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.module"; import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.module";
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule, AdminTabsModule, ConnectAdminCustomizationRoutingModule, PageContentModule, InputModule CommonModule, RouterModule, AdminTabsModule, ConnectAdminCustomizationRoutingModule, PageContentModule, InputModule
], ],
providers: [CustomizationService], providers: [CustomizationService, CommunitiesService],
declarations: [ConnectAdminCustomizationComponent], declarations: [ConnectAdminCustomizationComponent],
exports: [ConnectAdminCustomizationComponent] exports: [ConnectAdminCustomizationComponent]
}) })

View File

@ -1,4 +1,4 @@
import {Component, OnInit, Input, Output, EventEmitter, ViewChild} from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {SearchResult} from '../../openaireLibrary/utils/entities/searchResult'; import {SearchResult} from '../../openaireLibrary/utils/entities/searchResult';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
@ -8,8 +8,6 @@ import {SearchDataprovidersService} from '../../openaireLibrary/services/searchD
import {RouterHelper} from '../../openaireLibrary/utils/routerHelper.class'; import {RouterHelper} from '../../openaireLibrary/utils/routerHelper.class';
import {StringUtils} from '../../openaireLibrary/utils/string-utils.class'; import {StringUtils} from '../../openaireLibrary/utils/string-utils.class';
import {ManageCommunityContentProvidersService} from '../../services/manageContentProviders.service'; import {ManageCommunityContentProvidersService} from '../../services/manageContentProviders.service';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {FormBuilder, FormGroup} from "@angular/forms"; import {FormBuilder, FormGroup} from "@angular/forms";
import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/search-input/search-input.component"; import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/search-input/search-input.component";
@ -20,7 +18,7 @@ import {NotificationHandler} from "../../openaireLibrary/utils/notification-hand
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {ContentProvider} from "../../openaireLibrary/utils/entities/contentProvider"; import {ContentProvider} from "../../openaireLibrary/utils/entities/contentProvider";
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
@Component({ @Component({
selector: 'add-content-providers', selector: 'add-content-providers',
@ -50,6 +48,7 @@ export class AddContentProvidersComponent implements OnInit {
constructor(private route: ActivatedRoute, private router: Router, constructor(private route: ActivatedRoute, private router: Router,
private searchDataprovidersService: SearchDataprovidersService, private searchDataprovidersService: SearchDataprovidersService,
private manageCommunityContentProvidersService: ManageCommunityContentProvidersService, private manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
private _clearCacheService: ClearCacheService,
private fb: FormBuilder) { private fb: FormBuilder) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.openaireSearchUtils.status = this.errorCodes.LOADING; this.openaireSearchUtils.status = this.errorCodes.LOADING;
@ -107,7 +106,8 @@ export class AddContentProvidersComponent implements OnInit {
this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contentProvider).subscribe( this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contentProvider).subscribe(
data => { data => {
this.communityContentProviders.push(data); this.communityContentProviders.push(data);
NotificationHandler.rise('Content Provider successfully added!') this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" added", this.community.communityId);
NotificationHandler.rise(this.openAIREEntities.DATASOURCE+' successfully added!')
this.communityContentProvidersChanged.emit({ this.communityContentProvidersChanged.emit({
value: this.communityContentProviders, value: this.communityContentProviders,
}); });
@ -125,7 +125,8 @@ export class AddContentProvidersComponent implements OnInit {
data => { data => {
let index = this.communityContentProviders.indexOf(communityContentProvider); let index = this.communityContentProviders.indexOf(communityContentProvider);
this.communityContentProviders.splice(index, 1); this.communityContentProviders.splice(index, 1);
NotificationHandler.rise('Content Provider successfully removed!') this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" removed", this.community.communityId);
NotificationHandler.rise(this.openAIREEntities.DATASOURCE+' successfully removed!')
this.communityContentProvidersChanged.emit({ this.communityContentProvidersChanged.emit({
value: this.communityContentProviders, value: this.communityContentProviders,
}); });

View File

@ -5,9 +5,7 @@ import {Subscriber} from 'rxjs';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ManageCommunityContentProvidersService} from '../../services/manageContentProviders.service'; import {ManageCommunityContentProvidersService} from '../../services/manageContentProviders.service';
import { import {SearchCommunityDataprovidersService} from '../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
SearchCommunityDataprovidersService
} from '../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
import {RouterHelper} from '../../openaireLibrary/utils/routerHelper.class'; import {RouterHelper} from '../../openaireLibrary/utils/routerHelper.class';
import {ContentProvider, Criteria} from '../../openaireLibrary/utils/entities/contentProvider'; import {ContentProvider, Criteria} from '../../openaireLibrary/utils/entities/contentProvider';
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
@ -19,6 +17,7 @@ import {NotificationHandler} from "../../openaireLibrary/utils/notification-hand
import {AlertModal} from "../../openaireLibrary/utils/modal/alert"; import {AlertModal} from "../../openaireLibrary/utils/modal/alert";
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
@Component({ @Component({
selector: 'remove-content-providers', selector: 'remove-content-providers',
@ -55,7 +54,8 @@ export class RemoveContentProvidersComponent implements OnInit {
constructor(private route: ActivatedRoute, private _router: Router, constructor(private route: ActivatedRoute, private _router: Router,
private _fb: FormBuilder, private _fb: FormBuilder,
private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService, private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
private _searchCommunityContentProvidersService: SearchCommunityDataprovidersService) { private _searchCommunityContentProvidersService: SearchCommunityDataprovidersService,
private _clearCacheService: ClearCacheService) {
} }
ngOnInit() { ngOnInit() {
@ -101,6 +101,7 @@ export class RemoveContentProvidersComponent implements OnInit {
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider); let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider);
this.communityContentProviders.splice(index, 1); this.communityContentProviders.splice(index, 1);
this.applyFilters(); this.applyFilters();
this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" removed", this.community.communityId);
this.handleSuccess(this.openAIREEntities.DATASOURCE + ' successfully removed!') this.handleSuccess(this.openAIREEntities.DATASOURCE + ' successfully removed!')
this.communityContentProvidersChanged.emit({ this.communityContentProvidersChanged.emit({
value: this.communityContentProviders, value: this.communityContentProviders,

View File

@ -7,15 +7,13 @@ import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class'; import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {DomSanitizer, Title} from '@angular/platform-browser'; import {DomSanitizer, Title} from '@angular/platform-browser';
import {CustomizationOptions, Layout} from '../../openaireLibrary/connect/community/CustomizationOptions'; import {CustomizationOptions, Layout} from '../../openaireLibrary/connect/community/CustomizationOptions';
import {StringUtils} from '../../openaireLibrary/utils/string-utils.class';
import {CustomizationService} from '../../openaireLibrary/services/customization.service'; import {CustomizationService} from '../../openaireLibrary/services/customization.service';
import {properties} from '../../../environments/environment'; import {properties} from '../../../environments/environment';
import {UtilitiesService} from '../../openaireLibrary/services/utilities.service'; import {UtilitiesService} from '../../openaireLibrary/services/utilities.service';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
import {FullScreenModalComponent} from "../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component";
import {UserManagementService} from "../../openaireLibrary/services/user-management.service"; import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
import {MenuItem} from "../../openaireLibrary/sharedComponents/menu";
import {AlertModal} from "../../openaireLibrary/utils/modal/alert"; import {AlertModal} from "../../openaireLibrary/utils/modal/alert";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -103,7 +101,8 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private layoutService: CustomizationService, private layoutService: CustomizationService,
private utilsService: UtilitiesService, private utilsService: UtilitiesService,
private userManagementService: UserManagementService) { private userManagementService: UserManagementService,
private _clearCacheService: ClearCacheService) {
} }
ngOnDestroy() { ngOnDestroy() {
@ -175,6 +174,7 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
this.publishedLayout.date = new Date(); this.publishedLayout.date = new Date();
this.subscriptions.push(this.layoutService.saveLayout(this.properties, this.communityId, this.publishedLayout).subscribe(layout => { this.subscriptions.push(this.layoutService.saveLayout(this.properties, this.communityId, this.publishedLayout).subscribe(layout => {
this.publishedLayout._id = layout._id; this.publishedLayout._id = layout._id;
this._clearCacheService.purgeBrowserCache("Layout added/ updated", this.communityId);
this.subscriptions.push(this.layoutService.createCSS(this.communityId,this.properties.connectPortalUrl, this.publishedLayout.date.valueOf(), this.publishedLayout.layoutOptions).subscribe(data => { this.subscriptions.push(this.layoutService.createCSS(this.communityId,this.properties.connectPortalUrl, this.publishedLayout.date.valueOf(), this.publishedLayout.layoutOptions).subscribe(data => {
console.log(data) console.log(data)

View File

@ -18,7 +18,7 @@ import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/searc
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields"; import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
import {Filter, Value} from "../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class"; import {Filter, Value} from "../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -58,6 +58,7 @@ export class AddProjectsComponent implements OnInit {
constructor(private route: ActivatedRoute, private _router: Router, private _searchProjectsService: SearchProjectsService, constructor(private route: ActivatedRoute, private _router: Router, private _searchProjectsService: SearchProjectsService,
private _manageCommunityProjectsService: ManageCommunityProjectsService, private _manageCommunityProjectsService: ManageCommunityProjectsService,
private _clearCacheService: ClearCacheService,
private _fb: FormBuilder) { private _fb: FormBuilder) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.openaireSearchUtils.status = this.errorCodes.LOADING; this.openaireSearchUtils.status = this.errorCodes.LOADING;
@ -121,7 +122,8 @@ export class AddProjectsComponent implements OnInit {
this.subscriptions.push(this._manageCommunityProjectsService.addProject(this.properties, this.community.communityId, project).subscribe( this.subscriptions.push(this._manageCommunityProjectsService.addProject(this.properties, this.community.communityId, project).subscribe(
data => { data => {
this.communityProjects.push(data); this.communityProjects.push(data);
UIkit.notification('Project successfully added!', { this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" added", this.community.communityId);
UIkit.notification(this.openaireEntities.PROJECT+' successfully added!', {
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
@ -144,7 +146,8 @@ export class AddProjectsComponent implements OnInit {
data => { data => {
let index = this.communityProjects.indexOf(communityProject); let index = this.communityProjects.indexOf(communityProject);
this.communityProjects.splice(index, 1); this.communityProjects.splice(index, 1);
UIkit.notification('Project successfully removed!', { this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" removed", this.community.communityId);
UIkit.notification(this.openaireEntities.PROJECT+' successfully removed!', {
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'

View File

@ -18,6 +18,7 @@ import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFie
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler"; import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
@Component({ @Component({
selector: 'remove-projects', selector: 'remove-projects',
@ -70,7 +71,8 @@ export class RemoveProjectsComponent implements OnInit {
private _fb: FormBuilder, private _fb: FormBuilder,
private communityService: CommunityService, private communityService: CommunityService,
private _manageCommunityProjectsService: ManageCommunityProjectsService, private _manageCommunityProjectsService: ManageCommunityProjectsService,
private _searchCommunityProjectsService: SearchCommunityProjectsService) { private _searchCommunityProjectsService: SearchCommunityProjectsService,
private _clearCacheService: ClearCacheService) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.communitySearchUtils.status = this.errorCodes.LOADING; this.communitySearchUtils.status = this.errorCodes.LOADING;
} }
@ -136,6 +138,7 @@ export class RemoveProjectsComponent implements OnInit {
let index = this.communityProjects.indexOf(this.selectedCommunityProject); let index = this.communityProjects.indexOf(this.selectedCommunityProject);
this.communityProjects.splice(index, 1); this.communityProjects.splice(index, 1);
this.applyFilters(); this.applyFilters();
this._clearCacheService.purgeBrowserCache(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
NotificationHandler.rise(OpenaireEntities.PROJECT+' successfully removed!'); NotificationHandler.rise(OpenaireEntities.PROJECT+' successfully removed!');
this.communityProjectsChanged.emit({ this.communityProjectsChanged.emit({
value: this.communityProjects, value: this.communityProjects,

View File

@ -4,18 +4,16 @@ import {ActivatedRoute, Router} from '@angular/router';
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service'; import {CommunityService} from '../../../openaireLibrary/connect/community/community.service';
import {SubjectsService} from '../subjects.service'; import {SubjectsService} from '../subjects.service';
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import {Title} from '@angular/platform-browser'; import {Title} from '@angular/platform-browser';
import {properties} from '../../../../environments/environment'; import {properties} from '../../../../environments/environment';
import {AlertModal} from '../../../openaireLibrary/utils/modal/alert'; import {AlertModal} from '../../../openaireLibrary/utils/modal/alert';
import {SearchInputComponent} from '../../../openaireLibrary/sharedComponents/search-input/search-input.component'; import {SearchInputComponent} from '../../../openaireLibrary/sharedComponents/search-input/search-input.component';
import {Subscription, zip} from 'rxjs'; import {Subscription} from 'rxjs';
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
import {concat} from 'rxjs/operators';
import {FullScreenModalComponent} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component'; import {FullScreenModalComponent} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component';
import {HelperFunctions} from 'src/app/openaireLibrary/utils/HelperFunctions.class'; import {HelperFunctions} from 'src/app/openaireLibrary/utils/HelperFunctions.class';
import {NotificationHandler} from "../../../openaireLibrary/utils/notification-handler"; import {NotificationHandler} from "../../../openaireLibrary/utils/notification-handler";
import {ClearCacheService} from "../../../openaireLibrary/services/clear-cache.service";
@Component({ @Component({
selector: 'subjects-edit-form', selector: 'subjects-edit-form',
@ -53,6 +51,7 @@ export class SubjectsEditFormComponent implements OnInit {
// private _helpContentService: HelpContentService, // private _helpContentService: HelpContentService,
private _communityService: CommunityService, private _communityService: CommunityService,
private _subjectsService: SubjectsService, private _subjectsService: SubjectsService,
private _clearCacheService: ClearCacheService
) { ) {
} }
@ -196,6 +195,7 @@ export class SubjectsEditFormComponent implements OnInit {
this.community.subjects = this.originalSubjects.filter(subject => { this.community.subjects = this.originalSubjects.filter(subject => {
return !this.filterForm.value || subject.toLowerCase().indexOf(this.filterForm.value.toLowerCase()) != -1 return !this.filterForm.value || subject.toLowerCase().indexOf(this.filterForm.value.toLowerCase()) != -1
}).sort(); }).sort();
this._clearCacheService.purgeBrowserCache("Subject "+message, this.communityId);
NotificationHandler.rise('Subject successfully ' + message + '!') NotificationHandler.rise('Subject successfully ' + message + '!')
this.showLoading = false; this.showLoading = false;
} }

View File

@ -16,6 +16,7 @@ import {Page} from "../../../domain/page";
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {StringUtils} from "../../../openaireLibrary/utils/string-utils.class"; import {StringUtils} from "../../../openaireLibrary/utils/string-utils.class";
import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo";
import {ClearCacheService} from "../../../openaireLibrary/services/clear-cache.service";
declare var UIkit; declare var UIkit;
@ -207,7 +208,8 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
private utilitiesService: UtilitiesService, private utilitiesService: UtilitiesService,
private helpContentService: HelpContentService, private helpContentService: HelpContentService,
private communityService: CommunityService, private communityService: CommunityService,
private userManagementService: UserManagementService) { private userManagementService: UserManagementService,
private _clearCacheService: ClearCacheService) {
} }
@ -303,6 +305,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
saveCurator() { saveCurator() {
this.curatorService.updateCurator(this.properties, this.curatorFb.value).subscribe((curator) => { this.curatorService.updateCurator(this.properties, this.curatorFb.value).subscribe((curator) => {
if (curator) { if (curator) {
this._clearCacheService.purgeBrowserCache("Curator added/ updated", this.community.communityId);
UIkit.notification('Your data has been <b>saved successfully</b>', { UIkit.notification('Your data has been <b>saved successfully</b>', {
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
@ -475,6 +478,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
enableCurators() { enableCurators() {
this.helpContentService.togglePages(this.community.communityId, [this.curatorsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => { this.helpContentService.togglePages(this.community.communityId, [this.curatorsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.curatorsPage.isEnabled = true; this.curatorsPage.isEnabled = true;
this._clearCacheService.purgeBrowserCache("Curators page enabled", this.community.communityId);
UIkit.notification('Curators Page has been <b>enabled successfully</b>', { UIkit.notification('Curators Page has been <b>enabled successfully</b>', {
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,

@ -1 +1 @@
Subproject commit adf1b6d5f5e8fb1568615b0fc596a0f39beab3e6 Subproject commit 14655ae3aa7a50162ef218428a0ccdee35c1aa7b

View File

@ -46,6 +46,7 @@ export let properties: EnvProperties = {
feedbackmailForMissingEntities: "feedback@openaire.eu", feedbackmailForMissingEntities: "feedback@openaire.eu",
cacheUrl: "https://demo.openaire.eu/cache/get?url=", cacheUrl: "https://demo.openaire.eu/cache/get?url=",
deleteCacheUrl: 'https://demo.openaire.eu/cache/clear', deleteCacheUrl: 'https://demo.openaire.eu/cache/clear',
deleteBrowserCacheUrl: 'https://beta.{pid}.openaire.eu/purge/',
adminToolsAPIURL: "https://beta.services.openaire.eu/uoa-admin-tools/", adminToolsAPIURL: "https://beta.services.openaire.eu/uoa-admin-tools/",
adminToolsCommunity: "openaire", adminToolsCommunity: "openaire",
communityAPI: "https://beta.services.openaire.eu/openaire/community/", communityAPI: "https://beta.services.openaire.eu/openaire/community/",

View File

@ -51,6 +51,7 @@ export let properties: EnvProperties = {
feedbackmailForMissingEntities: 'feedback@openaire.eu', feedbackmailForMissingEntities: 'feedback@openaire.eu',
cacheUrl: 'http://scoobydoo.di.uoa.gr:3000/get?url=', cacheUrl: 'http://scoobydoo.di.uoa.gr:3000/get?url=',
deleteCacheUrl: 'http://duffy.di.uoa.gr:3000/clear', deleteCacheUrl: 'http://duffy.di.uoa.gr:3000/clear',
deleteBrowserCacheUrl: 'https://beta.{pid}.openaire.eu/purge/',
adminToolsAPIURL: 'http://duffy.di.uoa.gr:8080/uoa-admin-tools/', adminToolsAPIURL: 'http://duffy.di.uoa.gr:8080/uoa-admin-tools/',
adminToolsCommunity: 'openaire', adminToolsCommunity: 'openaire',
communityAPI: 'https://dev-openaire.d4science.org/openaire/community/', communityAPI: 'https://dev-openaire.d4science.org/openaire/community/',