From b7751d297b016020da1259b8b0b919f8d0b10b6d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 11 Jul 2022 18:48:24 +0300 Subject: [PATCH] [Connect Admin | new-theme]: Updated messages when no results in affiliations, data sources, projects, subjects, zenodo communities | [Bug fix] In add projects, show selected filter if exists (even when no results). 1. affiliations.component.html: Updated "no organizations found" message to "no organizations for {{community}}". 2. add-content-providers.component.html: When no data sources, show info message for missing data sources too. 3. add-content-providers.component.ts: Created get method infoMessage() to return info message for missing data sources. 4. manage-content-providers.component.ts: In renamed hash to #addContentProvidersModal. 5. remove-content-providers.component.html & remove-projects.component.html & subjects-edit-form.component.html & manage-zenodo-communities.component.html: Show proper messages if no results at all or if filters return no results. 6. add-projects.component.ts: Created get method infoMessage() to return info message for missing projects | Added field selectedFunder and in getSelectedValues() return selectedFunder if no values from search query. 7. add-projects.component.html: When no projects, show info message for missing funders too | Do not show filters column when no results | Show selectedFunder in selected filters. 8. manage-projects.component.ts: In renamed hash to #fsModalProjects and in renamed hash to #addProjects. 9. remove-projects.component.ts: Removed old Session.isLoggedIn() checks. --- .../affiliations/affiliations.component.html | 2 +- .../add-content-providers.component.html | 14 +- .../add-content-providers.component.ts | 17 +- .../manage-content-providers.component.ts | 4 +- .../remove-content-providers.component.html | 5 +- .../projects/add-projects.component.html | 32 ++- .../pages/projects/add-projects.component.ts | 47 +++-- .../projects/manage-projects.component.ts | 10 +- .../projects/remove-projects.component.html | 5 +- .../projects/remove-projects.component.ts | 187 ++++++++---------- .../subjects-edit-form.component.html | 5 +- .../manage-zenodo-communities.component.html | 5 +- src/assets/openaire-theme | 2 +- 13 files changed, 171 insertions(+), 164 deletions(-) diff --git a/src/app/pages/affiliations/affiliations.component.html b/src/app/pages/affiliations/affiliations.component.html index 0360d8f..de3e6bb 100644 --- a/src/app/pages/affiliations/affiliations.component.html +++ b/src/app/pages/affiliations/affiliations.component.html @@ -29,7 +29,7 @@
-
No organizations found
+
No organizations for {{community.shortTitle}}
-
- If you cannot find a {{openAIREEntities.DATASOURCE}} relevant to your community, probably it is not OpenAIRE compliant. - Feel free to contact us - ({{properties.feedbackmailForMissingEntities}}) - to let us know and we'll try to get the provider on board! +
-
No {{openAIREEntities.DATASOURCE}} found
+ class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom"> +
No {{openAIREEntities.DATASOURCES}} found
+
" + + "If you cannot find a "+OpenaireEntities.DATASOURCE.toLowerCase()+" relevant to your "+OpenaireEntities.COMMUNITY.toLowerCase()+", probably it is not OpenAIRE compliant." + + "
" + + "Feel free to contact us " + + "("+properties.feedbackmailForMissingEntities+") " + + "to let us know and we'll try to get the "+OpenaireEntities.DATASOURCE.toLowerCase()+" on board!" + + "
" + + "
" + } - public addContentProvider(contenProvider: SearchResult) { - this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contenProvider).subscribe( + public addContentProvider(contentProvider: SearchResult) { + this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contentProvider).subscribe( data => { this.communityContentProviders.push(data); NotificationHandler.rise('Content Provider successfully added!') diff --git a/src/app/pages/content-providers/manage-content-providers.component.ts b/src/app/pages/content-providers/manage-content-providers.component.ts index d86a0d8..b39ac92 100644 --- a/src/app/pages/content-providers/manage-content-providers.component.ts +++ b/src/app/pages/content-providers/manage-content-providers.component.ts @@ -19,12 +19,12 @@ import {CriteriaComponent} from "./criteria/criteria.component"; template: ` - diff --git a/src/app/pages/content-providers/remove-content-providers.component.html b/src/app/pages/content-providers/remove-content-providers.component.html index 9f5f7ef..1fd2e83 100644 --- a/src/app/pages/content-providers/remove-content-providers.component.html +++ b/src/app/pages/content-providers/remove-content-providers.component.html @@ -30,7 +30,10 @@
-
No {{openAIREEntities.DATASOURCES}} found
+
No {{openAIREEntities.DATASOURCES}} + for {{community.shortTitle}} + found +
    - - + +
  • - - {{funders.title}}: - {{value.name=='true'?'Yes':'No'}} + + {{selectedFunder.name}} - - {{value.name}} -
  • -
    -
    + +
@@ -67,12 +62,8 @@
-
- If you cannot find a funder that is relevant for your community, please contact us - ({{properties.feedbackmailForMissingEntities}}) - and we will try to get the funder on board! +
-
+
@@ -94,8 +85,9 @@
-
No {{openaireEntities.PROJECTS | lowercase}} found
+ class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom"> +
No {{openaireEntities.PROJECTS | lowercase}} found
+
" + + "If you cannot find a funder that is relevant for your "+OpenaireEntities.COMMUNITY.toLowerCase()+", please contact us " + + "("+properties.feedbackmailForMissingEntities+") " + + "and we will try to get the funder on board!" + + "
"; + } + public addProject(project: SearchResult) { this.subscriptions.push(this._manageCommunityProjectsService.addProject(this.properties, this.community.communityId, project).subscribe( data => { @@ -287,16 +298,22 @@ export class AddProjectsComponent implements OnInit { getSelectedValues(filter): any { var selected = []; - this.selectedFunderId = ""; - if (filter.countSelectedValues > 0) { - for (var i = 0; i < filter.values.length; i++) { - if (filter.values[i].selected) { - selected.push(filter.values[i]); - this.selectedFunderId = filter.values[i].id; + if(filter.values.length == 0 && this.selectedFunderId) { + return [this.selectedFunder]; + } else { + this.selectedFunderId = ""; + this.selectedFunder = null; + if (filter.countSelectedValues > 0) { + for (var i = 0; i < filter.values.length; i++) { + if (filter.values[i].selected) { + selected.push(filter.values[i]); + this.selectedFunderId = filter.values[i].id; + this.selectedFunder = filter.values[i]; + } } } + return selected; } - return selected; } clearFilters() { @@ -310,12 +327,16 @@ export class AddProjectsComponent implements OnInit { public removeFilter(value: Value, filter: Filter) { this.selectedFunderId = ""; - filter.countSelectedValues--; - if (value.selected == true) { - value.selected = false; - } - if (filter.filterType == "radio") { - filter.radioValue = ""; + this.selectedFunder = null; + + if(value) { + filter.countSelectedValues--; + if (value.selected == true) { + value.selected = false; + } + if (filter.filterType == "radio") { + filter.radioValue = ""; + } } this.buildQueryParameters(); this.goTo(1); diff --git a/src/app/pages/projects/manage-projects.component.ts b/src/app/pages/projects/manage-projects.component.ts index 166ccc8..e3247c4 100644 --- a/src/app/pages/projects/manage-projects.component.ts +++ b/src/app/pages/projects/manage-projects.component.ts @@ -17,11 +17,11 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit selector: 'manage-projects', template: ` - - + ` @@ -30,7 +30,7 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit export class ManageProjectsComponent implements OnInit { @Input() communityProjects = []; @ViewChild(RemoveProjectsComponent) removeProjectsComponent: RemoveProjectsComponent; - @ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent; + @ViewChild('fsModalProjects', { static: true }) fullscreen: FullScreenModalComponent; private subscriptions: any[] = []; public showLoadingInRemove: boolean = true; @@ -64,7 +64,7 @@ export class ManageProjectsComponent implements OnInit { } public openAddProjects() { - this.fullscreen.title = "Search and Add "+OpenaireEntities.PROJECTS; + this.fullscreen.title = "Search and Add " + OpenaireEntities.PROJECTS; this.fullscreen.okButtonText = "Done"; this.fullscreen.back = true; this.fullscreen.okButton = true; diff --git a/src/app/pages/projects/remove-projects.component.html b/src/app/pages/projects/remove-projects.component.html index 01d649c..fc2f0af 100644 --- a/src/app/pages/projects/remove-projects.component.html +++ b/src/app/pages/projects/remove-projects.component.html @@ -78,7 +78,10 @@
-
No {{openaireEntiites.PROJECTS | lowercase}} for {{community.shortTitle}}
+
No {{openaireEntiites.PROJECTS | lowercase}} + for {{community.shortTitle}} + found +
diff --git a/src/app/pages/projects/remove-projects.component.ts b/src/app/pages/projects/remove-projects.component.ts index 6a3b525..90d06b9 100644 --- a/src/app/pages/projects/remove-projects.component.ts +++ b/src/app/pages/projects/remove-projects.component.ts @@ -152,126 +152,99 @@ export class RemoveProjectsComponent implements OnInit { } public confirmedDeleteProject(data: any) { - if (!Session.isLoggedIn()) { - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url - } - }); - } else { - this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.id).subscribe( - data => { - let index = this.communityProjects.indexOf(this.selectedCommunityProject); - this.communityProjects.splice(index, 1); + this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.id).subscribe( + data => { + let index = this.communityProjects.indexOf(this.selectedCommunityProject); + this.communityProjects.splice(index, 1); - this.applyFilters(); + this.applyFilters(); - UIkit.notification(OpenaireEntities.PROJECT+' successfully removed!', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + UIkit.notification(OpenaireEntities.PROJECT+' successfully removed!', { + status: 'success', + timeout: 6000, + pos: 'bottom-right' + }); - this.communityProjectsChanged.emit({ - value: this.communityProjects, - }); + this.communityProjectsChanged.emit({ + value: this.communityProjects, + }); - this.communitySearchUtils.totalResults--; - this.communitySearchUtils.page = 1; - }, - err => { - this.handleError('An error has been occurred. Try again later!'); - console.error(err); - } - )); - } + this.communitySearchUtils.totalResults--; + this.communitySearchUtils.page = 1; + }, + err => { + this.handleError('An error has been occurred. Try again later!'); + console.error(err); + } + )); } public removeProject(communityProject: any) { - if (!Session.isLoggedIn()) { - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url - } - }); - } else { - this.selectedCommunityProject = communityProject; - this.alertModalDeleteCommunity.cancelButton = true; - this.alertModalDeleteCommunity.okButton = true; - this.alertModalDeleteCommunity.alertTitle = "Remove "+OpenaireEntities.PROJECT; - let title = ""; - if (communityProject.name) { - title = communityProject.name; - } - if (communityProject.name && communityProject.acronym) { - title += " ("; - } - if (communityProject.acronym) { - title += communityProject.acronym; - } - if (communityProject.name && communityProject.acronym) { - title += ")"; - } - this.alertModalDeleteCommunity.message = OpenaireEntities.PROJECT; - if (title) { - this.alertModalDeleteCommunity.message += " " + title + " "; - } - this.alertModalDeleteCommunity.message += "will be removed from your "+OpenaireEntities.COMMUNITY.toLowerCase()+". Are you sure?"; - this.alertModalDeleteCommunity.okButtonText = "Yes"; - this.alertModalDeleteCommunity.open(); + this.selectedCommunityProject = communityProject; + this.alertModalDeleteCommunity.cancelButton = true; + this.alertModalDeleteCommunity.okButton = true; + this.alertModalDeleteCommunity.alertTitle = "Remove "+OpenaireEntities.PROJECT; + let title = ""; + if (communityProject.name) { + title = communityProject.name; } + if (communityProject.name && communityProject.acronym) { + title += " ("; + } + if (communityProject.acronym) { + title += communityProject.acronym; + } + if (communityProject.name && communityProject.acronym) { + title += ")"; + } + this.alertModalDeleteCommunity.message = OpenaireEntities.PROJECT; + if (title) { + this.alertModalDeleteCommunity.message += " " + title + " "; + } + this.alertModalDeleteCommunity.message += "will be removed from your "+OpenaireEntities.COMMUNITY.toLowerCase()+". Are you sure?"; + this.alertModalDeleteCommunity.okButtonText = "Yes"; + this.alertModalDeleteCommunity.open(); } public _getCommunityProjects() { - if (!Session.isLoggedIn()) { - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url + this.communitySearchUtils.status = this.errorCodes.LOADING; + this.communityProjects = []; + this.communitySearchUtils.totalResults = 0; + this.communitySearchUtils.page = 1; + this.communitySearchUtils.keyword = ""; + + this.subscriptions.push(this._searchCommunityProjectsService.searchProjects(this.properties, this.community.communityId).subscribe( + data => { + this.communityProjects = data; + this.previewCommunityProjects = this.communityProjects; + this.sort(); + + this.communitySearchUtils.totalResults = data.length; + this.communitySearchUtils.status = this.errorCodes.DONE; + + this.communityProjectsChanged.emit({ + value: this.communityProjects, + }); + + this.createFunderFilter(); + + this.loading = false; + }, + err => { + console.error(err); + //TODO check erros (service not available, bad request) + + if (err.status == '404') { + this.communitySearchUtils.status = this.errorCodes.NOT_FOUND; + } else if (err.status == '500') { + this.communitySearchUtils.status = this.errorCodes.ERROR; + } else { + this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE; } - }); - } else { - this.communitySearchUtils.status = this.errorCodes.LOADING; - this.communityProjects = []; - this.communitySearchUtils.totalResults = 0; - this.communitySearchUtils.page = 1; - this.communitySearchUtils.keyword = ""; - this.subscriptions.push(this._searchCommunityProjectsService.searchProjects(this.properties, this.community.communityId).subscribe( - data => { - this.communityProjects = data; - this.previewCommunityProjects = this.communityProjects; - this.sort(); - - this.communitySearchUtils.totalResults = data.length; - this.communitySearchUtils.status = this.errorCodes.DONE; - - this.communityProjectsChanged.emit({ - value: this.communityProjects, - }); - - this.createFunderFilter(); - - this.loading = false; - }, - err => { - console.error(err); - //TODO check erros (service not available, bad request) - - if (err.status == '404') { - this.communitySearchUtils.status = this.errorCodes.NOT_FOUND; - } else if (err.status == '500') { - this.communitySearchUtils.status = this.errorCodes.ERROR; - } else { - this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE; - } - - this.loading = false; - } - )); - } + this.loading = false; + } + )); } public createFunderFilter(): void { diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html index a9b4205..a989628 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html @@ -36,7 +36,10 @@
-
No subjects found
+
No subjects + for {{community.shortTitle}} + found +
-
No zenodo communities found
+
No zenodo communities + for {{community.shortTitle}} + found +