[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 <add-content-providers> 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 <fs-modal> renamed hash to #fsModalProjects and in <add-projects> renamed hash to #addProjects.
9. remove-projects.component.ts: Removed old Session.isLoggedIn() checks.
This commit is contained in:
Konstantina Galouni 2022-07-11 18:48:24 +03:00
parent b429819cb6
commit b7751d297b
13 changed files with 171 additions and 164 deletions

View File

@ -29,7 +29,7 @@
<div *ngIf="!loading">
<div *ngIf="affiliations.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No organizations found</div>
<div>No organizations for {{community.shortTitle}}</div>
</div>
<div *ngIf="affiliations.length > 0">
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="affiliations.length"

View File

@ -1,13 +1,8 @@
<div class="uk-section uk-flex uk-flex-center uk-flex uk-flex-middle">
<div class="uk-width-auto uk-margin-right">
<a uk-icon="icon: info; ratio: 1.3"></a>
<div *ngIf="community" class="uk-dropdown uk-padding-small uk-width-medium" uk-dropdown="mode: hover">
If you cannot find a <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCE}}</span> relevant to your community, probably it is not OpenAIRE compliant.
Feel free to contact us
(<a
[href]="'mailto:' + properties.feedbackmailForMissingEntities +'?Subject=[OpenAIRE Connect - '+ community.shortTitle + '] report missing Funder' + '&body=' + body"
target="_top">{{properties.feedbackmailForMissingEntities}}</a>)
to let us know and we'll try to get the provider on board!
<div *ngIf="community" class="uk-dropdown uk-padding-small uk-width-medium" uk-dropdown="mode: hover"
[innerHTML]="infoMessage">
</div>
</div>
<div search-input class="uk-width-xlarge@l uk-width-large" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
@ -19,8 +14,9 @@
</div>
<div *ngIf="openaireSearchUtils.status !== errorCodes.LOADING">
<div *ngIf="openaireSearchUtils.totalResults == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCE}}</span> found</div>
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom">
<div class="uk-text-bold">No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}}</span> found</div>
<div class="uk-margin-small-top" [innerHTML]="infoMessage"></div>
</div>
<ng-container *ngIf="openaireSearchUtils.totalResults > 0">
<no-load-paging [type]="openaireContentProviders.length === 1?openAIREEntities.DATASOURCE:openAIREEntities.DATASOURCES"

View File

@ -89,9 +89,22 @@ export class AddContentProvidersComponent implements OnInit {
get loading() {
return this.openaireSearchUtils.status == this.errorCodes.LOADING
}
get infoMessage(): string {
return "<div>" +
"If you cannot find a "+OpenaireEntities.DATASOURCE.toLowerCase()+" relevant to your "+OpenaireEntities.COMMUNITY.toLowerCase()+", probably it is not OpenAIRE compliant." +
"<div>" +
"Feel free to contact us " +
"(<a href=\"mailto: "+ properties.feedbackmailForMissingEntities +
"?Subject=[OpenAIRE Connect - "+ this.community.shortTitle + "] report missing "+OpenaireEntities.DATASOURCE + "&body=" + this.body + "\" " +
"target=\"_top\">"+properties.feedbackmailForMissingEntities+"</a>) " +
"to let us know and we'll try to get the "+OpenaireEntities.DATASOURCE.toLowerCase()+" on board!" +
"</div>" +
"</div>"
}
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!')

View File

@ -19,12 +19,12 @@ import {CriteriaComponent} from "./criteria/criteria.component";
template: `
<remove-content-providers #removeContentProviders (addContentProviders)="openAddContentProviders()"
[communityContentProviders]="communityContentProviders"
[loading]="showLoadingInRemove" [community]="community" [disableAdd]="add.loading"
[loading]="showLoadingInRemove" [community]="community" [disableAdd]="addContentProviders.loading"
(editCriteria)="openCriteria($event)"
(communityContentProvidersChanged)="communityContentProvidersChanged($event)">
</remove-content-providers>
<fs-modal #addContentProvidersModal>
<add-content-providers #add [communityContentProviders]="communityContentProviders" [community]="community"
<add-content-providers #addContentProviders [communityContentProviders]="communityContentProviders" [community]="community"
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers>
</fs-modal>
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset()" [okButtonDisabled]="criteria && criteria.disabled">

View File

@ -30,7 +30,10 @@
<div *ngIf="!loading">
<div *ngIf="previewCommunityContentProviders.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}}</span> found</div>
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}} </span>
<span *ngIf="communityContentProviders.length == 0; else: notFound">for {{community.shortTitle}}</span>
<ng-template #notFound>found</ng-template>
</div>
</div>
<div *ngIf="previewCommunityContentProviders.length > 0">
<no-load-paging [type]="previewCommunityContentProviders.length === 1?openAIREEntities.DATASOURCE:openAIREEntities.DATASOURCES"

View File

@ -4,25 +4,20 @@
<div [class.uk-invisible]="list.children.length === 0" class="uk-position-relative">
<div class="uk-slider-container" style="height: 40px">
<ul #list class="uk-slider-items uk-grid uk-grid-small uk-margin-small-right uk-flex-nowrap">
<ng-container *ngIf="funders && funders.countSelectedValues > 0">
<ng-container *ngFor="let value of getSelectedValues(funders); let i = index; let end = last; ">
<!-- <ng-container *ngIf="funders && funders.countSelectedValues > 0">-->
<!-- <ng-container *ngFor="let value of getSelectedValues(funders); let i = index; let end = last; ">-->
<li>
<span class="uk-label uk-label-primary uk-flex uk-flex-middle">
<span
class="uk-margin-small-right uk-width-expand uk-text-truncate">
<span *ngIf="funders.type && funders.type == 'boolean' else noboolean">{{funders.title}}:
{{value.name=='true'?'Yes':'No'}}
<span class="uk-margin-small-right uk-width-expand uk-text-truncate">
{{selectedFunder.name}}
</span>
<ng-template #noboolean>
{{value.name}}
</ng-template></span>
<button class="uk-close uk-icon" [class.uk-disabled]="disabled" [disabled]="disabled" (click)="removeFilter(value, funders)">
<icon name="close" flex="true" ratio="0.7"></icon>
</button>
</span>
</li>
</ng-container>
</ng-container>
<!-- </ng-container>-->
<!-- </ng-container>-->
</ul>
</div>
<div class="">
@ -67,12 +62,8 @@
<div class="uk-section uk-flex uk-flex-center uk-flex uk-flex-middle">
<div class="uk-width-auto uk-margin-right">
<a uk-icon="icon: info; ratio: 1.3"></a>
<div *ngIf="community" class="uk-dropdown uk-padding-small uk-width-medium" uk-dropdown="mode: hover">
If you cannot find a funder that is relevant for your community, please contact us
(<a
[href]="'mailto:' + properties.feedbackmailForMissingEntities +'?Subject=[OpenAIRE Connect - '+ community.shortTitle + '] report missing Funder' + '&body=' + body"
target="_top">{{properties.feedbackmailForMissingEntities}}</a>)
and we will try to get the funder on board!
<div *ngIf="community" class="uk-dropdown uk-padding-small uk-width-medium" uk-dropdown="mode: hover"
[innerHTML]="infoMessage">
</div>
</div>
<div search-input class="uk-width-xlarge@l uk-width-large" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
@ -81,7 +72,7 @@
<div class="uk-section uk-section-small uk-position-relative">
<div class="uk-grid" uk-grid>
<div class="uk-width-1-4@m search-filters uk-visible@m">
<div *ngIf="openaireSearchUtils.status != errorCodes.NONE" class="uk-width-1-4@m search-filters uk-visible@m">
<ng-container *ngTemplateOutlet="filters_column; context: {}"></ng-container>
</div>
<div class="uk-width-expand@m uk-with-1-1@s">
@ -94,8 +85,9 @@
</div>
<div *ngIf="openaireSearchUtils.status !== errorCodes.LOADING">
<div *ngIf="openaireSearchUtils.totalResults == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No {{openaireEntities.PROJECTS | lowercase}} found</div>
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom">
<div class="uk-text-bold">No {{openaireEntities.PROJECTS | lowercase}} found</div>
<div class="uk-margin-small-top" [innerHTML]="infoMessage"></div>
</div>
<ng-container *ngIf="openaireSearchUtils.totalResults > 0">
<no-load-paging [type]="openaireEntities.PROJECTS"

View File

@ -45,6 +45,7 @@ export class AddProjectsComponent implements OnInit {
// public pagingLimit: number = properties.pagingLimit;
public resultsPerPage: number = properties.resultsPerPage;
public selectedFunderId: string = "";
public selectedFunder: Value = null;
filterForm: FormGroup;
funders: Filter = null;
@ -106,6 +107,16 @@ export class AddProjectsComponent implements OnInit {
return this.openaireSearchUtils.status == this.errorCodes.LOADING || this.openaireSearchUtils.refineStatus == this.errorCodes.LOADING;
}
get infoMessage(): string {
return "<div>" +
"If you cannot find a funder that is relevant for your "+OpenaireEntities.COMMUNITY.toLowerCase()+", please contact us " +
"(<a href=\"mailto:" + properties.feedbackmailForMissingEntities +
"?Subject=[OpenAIRE Connect - "+ this.community.shortTitle + "] report missing Funder" + "&body=" + this.body + "\" " +
"target=\"_top\">"+properties.feedbackmailForMissingEntities+"</a>) " +
"and we will try to get the funder on board!" +
"</div>";
}
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);

View File

@ -17,11 +17,11 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
selector: 'manage-projects',
template: `
<remove-projects #removeProjectsComponent (addProjects)="openAddProjects()" [communityProjects]="communityProjects"
[loading]="showLoadingInRemove" [community]="community" [disableAdd]="add.loading"
[loading]="showLoadingInRemove" [community]="community" [disableAdd]="addProjects.loading"
(communityProjectsChanged)="communityProjectsChanged($event)">
</remove-projects>
<fs-modal #fsModal>
<add-projects #add [communityProjects]="communityProjects" [community]="community"
<fs-modal #fsModalProjects>
<add-projects #addProjects [communityProjects]="communityProjects" [community]="community"
(communityProjectsChanged)="communityProjectsChanged($event)"></add-projects>
</fs-modal>
`
@ -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;

View File

@ -78,7 +78,10 @@
<div class="uk-margin-medium-bottom">
<div *ngIf="previewCommunityProjects.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No {{openaireEntiites.PROJECTS | lowercase}} for {{community.shortTitle}}</div>
<div>No {{openaireEntiites.PROJECTS | lowercase}}
<span *ngIf="communityProjects.length == 0; else: notFound">for {{community.shortTitle}}</span>
<ng-template #notFound>found</ng-template>
</div>
</div>
<div *ngIf="previewCommunityProjects.length > 0"
class="uk-grid uk-grid-large uk-child-width-1-1 uk-child-width-1-2@m uk-margin-bottom" uk-grid uk-height-match="target: .uk-card-body">

View File

@ -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 += " <b>" + title + "</b> ";
}
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 += " <b>" + title + "</b> ";
}
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 {

View File

@ -36,7 +36,10 @@
<div *ngIf="!showLoading">
<div *ngIf="community.subjects.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No subjects found</div>
<div>No subjects
<span *ngIf="originalSubjects.length == 0; else: notFound">for {{community.shortTitle}}</span>
<ng-template #notFound>found</ng-template>
</div>
</div>
<div *ngIf="community.subjects.length > 0">
<no-load-paging *ngIf="community.subjects.length > 0" [type]="'Subjects'"

View File

@ -32,7 +32,10 @@
<div *ngIf="searchUtils.status !== errorCodes.LOADING">
<div *ngIf="previewCommunities.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No zenodo communities found</div>
<div>No zenodo communities
<span *ngIf="selectedCommunities.length == 0; else: notFound">for {{community.shortTitle}}</span>
<ng-template #notFound>found</ng-template>
</div>
</div>
<div *ngIf="previewCommunities.length > 0">
<no-load-paging [type]="'content providers'"

@ -1 +1 @@
Subproject commit 32040ce807ad4945e7682b39a3fbc6faecf2f619
Subproject commit c80b7371801d42611c611707ca933c1c83c3c672