Finish UI of Content Providers and their Criteria. Fix search width in subjects
This commit is contained in:
parent
eaebaded60
commit
7c9d0936b3
|
@ -15,6 +15,7 @@ import {ConnectHelper} from './openaireLibrary/connect/connectHelper';
|
|||
import {ConfigurationService} from './openaireLibrary/utils/configuration/configuration.service';
|
||||
import {StringUtils} from "./openaireLibrary/utils/string-utils.class";
|
||||
import {OpenaireEntities} from "./openaireLibrary/utils/properties/searchFields";
|
||||
import {mining} from "./openaireLibrary/utils/icons/icons";
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
@ -215,7 +216,7 @@ export class AppComponent implements OnInit {
|
|||
this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/" + this.community.communityId + "/admin-tools/pages", false, [], [], {}, {name: 'description'}, null, null, "/" + this.community.communityId + "/admin-tools"));
|
||||
this.sideBarItems.push(new MenuItem("customization", "Customization", "", "/" + this.community.communityId + "/customize-layout", false, [], [], {}, {name: 'brush'}));
|
||||
if (this.community.type === 'ri') {
|
||||
this.sideBarItems.push(new MenuItem("mining", "Mining", "", "/" + this.community.communityId + "/mining/manage-profiles", false, [], [], {}, {name: 'architecture'}, null, null, "/" + this.community.communityId + "/mining"));
|
||||
this.sideBarItems.push(new MenuItem("mining", "Mining", "", "/" + this.community.communityId + "/mining/manage-profiles", false, [], [], {}, {svg: mining.data}, null, null, "/" + this.community.communityId + "/mining"));
|
||||
}
|
||||
this.specialSideBarMenuItem = new MenuItem("back", "Manage communities", "", "/", false, [], null, {}, {name: 'search', class: 'uk-text-secondary'});
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import {IsCommunity} from './openaireLibrary/connect/communityGuard/isCommunity.
|
|||
import {AdminErrorPageComponent} from './pages/error/errorPage.component';
|
||||
import {ErrorModule} from './openaireLibrary/error/error.module';
|
||||
import {TitleCasePipe} from '@angular/common';
|
||||
import {CommunityService} from './openaireLibrary/connect/community/community.service';
|
||||
import {SubscribeService} from './openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {ConnectRIGuard} from './openaireLibrary/connect/communityGuard/connectRIGuard.guard';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e61d4495aee212f7e991f0ad9c54c0429cf01757
|
||||
Subproject commit f08c63d3849e966bcfe916f0ca48788e0b401306
|
|
@ -40,8 +40,8 @@
|
|||
<div class="uk-card uk-card-default">
|
||||
<div class="uk-card-body">
|
||||
<div class="uk-flex uk-flex-middle uk-flex-column">
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<img class="uk-height-xsmall uk-blend-multiply" [src]="affiliation.logo_url | urlPrefix">
|
||||
<div class="uk-flex uk-flex-center uk-height-xsmall">
|
||||
<img class="uk-height-max-xsmall uk-blend-multiply" [src]="affiliation.logo_url | urlPrefix">
|
||||
</div>
|
||||
<h5>{{affiliation.name}}</h5>
|
||||
<div class="uk-text-truncate uk-text-small">
|
||||
|
@ -87,7 +87,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid" (alertOutput)="editAffiliation()">
|
||||
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid" (alertOutput)="editAffiliation()" classTitle="uk-background-primary uk-light">
|
||||
<form *ngIf="affiliationFb" [formGroup]="affiliationFb">
|
||||
<div class="uk-grid uk-child-width-1-1" uk-grid>
|
||||
<div input placeholder="Name" [formInput]="affiliationFb.get('name')"></div>
|
||||
|
@ -96,5 +96,5 @@
|
|||
</div>
|
||||
</form>
|
||||
</modal-alert>
|
||||
<modal-alert #removeAffiliationModal [overflowBody]="false" (alertOutput)="removeAffiliation()">
|
||||
<modal-alert #removeAffiliationModal [overflowBody]="false" (alertOutput)="removeAffiliation()" classTitle="uk-background-primary uk-light">
|
||||
</modal-alert>
|
||||
|
|
|
@ -15,6 +15,7 @@ import {Subscription} from "rxjs";
|
|||
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
|
||||
@Component({
|
||||
selector: 'affiliations',
|
||||
|
@ -67,8 +68,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
|
|||
|
||||
getAffiliations() {
|
||||
this.loading = true;
|
||||
this.affiliationService.initAffiliations(this.community.communityId);
|
||||
this.affiliationService.affiliations.subscribe(
|
||||
this.affiliationService.getAffiliations(this.community.communityId).subscribe(
|
||||
affiliations => {
|
||||
this.affiliations = affiliations;
|
||||
this.loading = false;
|
||||
|
@ -133,6 +133,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
public updatePage(event) {
|
||||
HelperFunctions.scroll();
|
||||
this.page = event.value;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.mo
|
|||
import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module";
|
||||
import {CommunityInfoModule} from "../community-info/community-info.module";
|
||||
import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module";
|
||||
import {IconsService} from "../../openaireLibrary/utils/icons/icons.service";
|
||||
import {add, edit, preview, remove} from "../../openaireLibrary/utils/icons/icons";
|
||||
import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module";
|
||||
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
|
||||
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
|
||||
|
@ -38,8 +36,4 @@ import {PagingModule} from "../../openaireLibrary/utils/paging.module";
|
|||
})
|
||||
|
||||
export class AffiliationsModule {
|
||||
|
||||
constructor(private iconsService: IconsService) {
|
||||
this.iconsService.registerIcons([add, preview, remove])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import {ConnectCommunityGuard} from "../../openaireLibrary/connect/communityGuar
|
|||
{path: 'organizations', loadChildren: () => import('../affiliations/affiliations.module').then(m => m.AffiliationsModule)},
|
||||
{path: 'projects', loadChildren: () => import('../projects/communityProjects.module').then(m => m.CommunityProjectsModule)},
|
||||
{path: 'content-providers', loadChildren: () => import('../content-providers/communityContentProviders.module').then(m => m.CommunityContentProvidersModule)},
|
||||
{path: 'content-providers/:provider', loadChildren: () => import('../content-providers/criteria/criteria.module').then(m => m.CriteriaModule)},
|
||||
{path: 'zenodo-communities', loadChildren: () => import('../zenodo-communities/zenodo-communities.module').then(m => m.ZenodoCommunitiesModule)},
|
||||
{path: 'subjects', canActivateChild: [ConnectCommunityGuard], loadChildren: () => import('../subjects/subjects-edit-form/subjects-edit-form.module').then(m => m.SubjectsEditFormModule)},
|
||||
])
|
||||
|
|
|
@ -2,17 +2,18 @@ import {Component, Input, OnInit} from '@angular/core';
|
|||
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
||||
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
|
||||
|
||||
@Component({
|
||||
selector: 'community-info',
|
||||
template: `
|
||||
<ul *ngIf="community" class="uk-tab customTabs admin uk-flex uk-flex-center uk-flex-left@m" uk-tab>
|
||||
<li [class.uk-active]="tab === 'profile'"><a routerLink="../profile"><span class="title">Profile</span></a></li>
|
||||
<li [class.uk-active]="tab === 'organizations'"><a routerLink="../organizations"><span class="title">Organizations</span></a></li>
|
||||
<li [class.uk-active]="tab === 'projects'"><a routerLink="../projects"><span class="title">Projects</span></a></li>
|
||||
<li [class.uk-active]="tab === 'content-providers'"><a routerLink="../content-providers"><span class="title">Content Providers</span></a></li>
|
||||
<li *ngIf="community.type !='ri'" [class.uk-active]="tab === 'subjects'"><a routerLink="../subjects"><span class="title">Subjects</span></a></li>
|
||||
<li [class.uk-active]="tab === 'zenodo-communities'"><a routerLink="../zenodo-communities"><span class="title">Zenodo Communities</span></a></li>
|
||||
<ul *ngIf="community" class="uk-tab uk-flex uk-flex-center uk-flex-left@m" uk-tab>
|
||||
<li [class.uk-active]="tab === 'profile'"><a routerLink="../profile">Profile</a></li>
|
||||
<li [class.uk-active]="tab === 'organizations'"><a routerLink="../organizations">Organizations</a></li>
|
||||
<li [class.uk-active]="tab === 'projects'"><a routerLink="../projects">{{openAIREEntities.PROJECTS}}</a></li>
|
||||
<li [class.uk-active]="tab === 'content-providers'"><a routerLink="../content-providers">{{openAIREEntities.DATASOURCES}}</a></li>
|
||||
<li *ngIf="community.type !='ri'" [class.uk-active]="tab === 'subjects'"><a routerLink="../subjects">Subjects</a></li>
|
||||
<li [class.uk-active]="tab === 'zenodo-communities'"><a routerLink="../zenodo-communities">Zenodo Communities</a></li>
|
||||
</ul>
|
||||
`
|
||||
})
|
||||
|
@ -22,6 +23,7 @@ export class CommunityInfoComponent implements OnInit {
|
|||
@Input()
|
||||
public tab: "profile"| "organizations" | "projects" | "content-providers" | "subjects" | "zenodo-communities" = 'profile';
|
||||
public community: CommunityInfo;
|
||||
public openAIREEntities = OpenaireEntities;
|
||||
private sub;
|
||||
|
||||
constructor(private communityService: CommunityService) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<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 content provider relevant to your community, probably it is not OpenAIRE compliant.
|
||||
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"
|
||||
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div search-input class="uk-width-xlarge@l uk-width-large" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
|
||||
placeholder="Search Content Providers" [disabled]="loading"></div>
|
||||
[placeholder]="'Search ' + openAIREEntities.DATASOURCES" [disabled]="loading"></div>
|
||||
</div>
|
||||
<div class="uk-section uk-section-small uk-position-relative">
|
||||
<div *ngIf="openaireSearchUtils.status == errorCodes.LOADING" class="uk-position-center">
|
||||
|
@ -20,10 +20,10 @@
|
|||
<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 content providers found</div>
|
||||
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCE}}</span> found</div>
|
||||
</div>
|
||||
<ng-container *ngIf="openaireSearchUtils.totalResults > 0">
|
||||
<no-load-paging [type]="'content Providers'"
|
||||
<no-load-paging [type]="openaireContentProviders.length === 1?openAIREEntities.DATASOURCE:openAIREEntities.DATASOURCES"
|
||||
[page]="openaireSearchUtils.page" [pageSize]="resultsPerPage" (pageChange)="goTo($event.value)"
|
||||
[totalResults]="openaireSearchUtils.totalResults">
|
||||
</no-load-paging>
|
||||
|
|
|
@ -18,6 +18,9 @@ import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
|||
import {ResultPreview} from "../../openaireLibrary/utils/result-preview/result-preview";
|
||||
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
import {ContentProvider} from "../../openaireLibrary/utils/entities/contentProvider";
|
||||
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
|
||||
@Component({
|
||||
selector: 'add-content-providers',
|
||||
|
@ -32,8 +35,9 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
public errorCodes: ErrorCodes;
|
||||
public openaireSearchUtils: SearchUtilsClass = new SearchUtilsClass();
|
||||
@Output() communityContentProvidersChanged = new EventEmitter();
|
||||
@Input() communityContentProviders = [];
|
||||
public openaireContentProviders = [];
|
||||
@Input() communityContentProviders: ContentProvider[] = [];
|
||||
public openaireContentProviders: SearchResult[] = [];
|
||||
public openAIREEntities = OpenaireEntities;
|
||||
public queryParameters: string = "";
|
||||
public resultsPerPage: number = properties.resultsPerPage;
|
||||
filterForm: FormGroup;
|
||||
|
@ -183,6 +187,7 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
}
|
||||
|
||||
goTo(page: number = 1) {
|
||||
HelperFunctions.scroll();
|
||||
this.openaireSearchUtils.page = page;
|
||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||
this._getOpenaireContentProviders(this.queryParameters, page, this.resultsPerPage);
|
||||
|
|
|
@ -17,15 +17,18 @@ import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-loa
|
|||
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
|
||||
import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module";
|
||||
import {IconsService} from "../../openaireLibrary/utils/icons/icons.service";
|
||||
import {add, arrow_left, close, edit, filters, remove_circle_outline} from "../../openaireLibrary/utils/icons/icons";
|
||||
import {filters} from "../../openaireLibrary/utils/icons/icons";
|
||||
import {FullScreenModalModule} from "../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module";
|
||||
import {ResultPreviewModule} from "../../openaireLibrary/utils/result-preview/result-preview.module";
|
||||
import {SearchDataprovidersServiceModule} from "../../openaireLibrary/connect/contentProviders/searchDataprovidersService.module";
|
||||
import {
|
||||
SearchDataprovidersServiceModule
|
||||
} from "../../openaireLibrary/connect/contentProviders/searchDataprovidersService.module";
|
||||
import {ManageContentProvidersComponent} from "./manage-content-providers.component";
|
||||
import {RemoveContentProvidersComponent} from "./remove-content-providers.component";
|
||||
import {AddContentProvidersComponent} from "./add-content-providers.component";
|
||||
import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service";
|
||||
import {SearchDataprovidersService} from "../../openaireLibrary/services/searchDataproviders.service";
|
||||
import {CriteriaModule} from "./criteria/criteria.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -47,7 +50,7 @@ import {SearchDataprovidersService} from "../../openaireLibrary/services/searchD
|
|||
path: '', component: ManageContentProvidersComponent
|
||||
}
|
||||
]),
|
||||
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule
|
||||
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule
|
||||
],
|
||||
declarations: [
|
||||
ManageContentProvidersComponent,
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {CriteriaComponent} from './criteria.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{path: '', component: CriteriaComponent}
|
||||
])
|
||||
]
|
||||
})
|
||||
export class CriteriaRoutingModule {
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
.criterion {
|
||||
border: rgba(26,26,26,0.5) solid 1px;
|
||||
border-radius: 4px;
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
}
|
|
@ -1,54 +1,34 @@
|
|||
<div page-content>
|
||||
<div header>
|
||||
<div class="uk-margin-top">
|
||||
<a routerLink="../" class="uk-text-secondary uk-text-uppercase uk-text-bold uk-text-small">
|
||||
<span class="uk-icon-button uk-icon small uk-button-secondary">
|
||||
<icon name="arrow_left"></icon>
|
||||
</span>
|
||||
<span class="space">
|
||||
Go back to Content Providers
|
||||
</span>
|
||||
<div class="uk-section uk-position-relative" style="min-height: 60vh">
|
||||
<div *ngIf="loading" class="uk-position-center">
|
||||
<loading></loading>
|
||||
</div>
|
||||
<ng-container *ngIf="!loading">
|
||||
<div class="uk-flex uk-flex-center uk-margin-medium-bottom">
|
||||
<a (click)="addCriteria()" class="uk-flex uk-flex-middle uk-button uk-button-primary"
|
||||
uk-tooltip="<div>Add filter to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span class="uk-margin-small-left">Add filter</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div inner>
|
||||
<div class="uk-card-header">
|
||||
<div class="uk-flex uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-grid" uk-grid>
|
||||
<div>
|
||||
<div class="uk-text-small uk-text-muted">Filters for</div>
|
||||
<div>
|
||||
<span *ngIf="dataProvider" class="uk-text-bold">{{dataProvider.officialname}}</span>
|
||||
<span *ngIf="dirty"> (unsaved changes)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" uk-flex uk-flex-right">
|
||||
<button (click)="reset()" [disabled]="loading || !dirty"
|
||||
class="uk-button uk-button-secondary outlined uk-margin-small-right">Reset
|
||||
</button>
|
||||
<button (click)="save()" class="uk-button uk-button-secondary uk-margin-small-right"
|
||||
[disabled]="loading || !dirty || selectionCriteria.invalid ">Save
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="criteria.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||
<div *ngIf="dataProvider">No filters for {{dataProvider.officialname}}.</div>
|
||||
<div>If no filters are specified, all research results of this content provider will be included in your
|
||||
community.
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-card uk-card-default uk-position-relative" style="min-height: 60vh">
|
||||
<div *ngIf="!loading" class="uk-padding-large uk-padding-remove-bottom uk-overflow-auto"
|
||||
style="max-height: 60vh;">
|
||||
<div *ngIf="criteria.length == 0" class="uk-padding-large uk-text-center uk-text-bold">
|
||||
<div *ngIf="dataProvider">No filters for {{dataProvider.officialname}}.</div>
|
||||
<div>If no filters are specified, all research results of this content provider will be included in your
|
||||
community.
|
||||
</div>
|
||||
</div>
|
||||
<form *ngIf="criteria.length > 0" [formGroup]="selectionCriteria">
|
||||
<div formArrayName="criteria" class="uk-margin-bottom">
|
||||
<no-load-paging (pageChange)="page = $event.value" [page]="page" [totalResults]="criteria.length" [pageSize]="pageSize" [type]="'filter' + (criteria.length > 1?'s':'')">
|
||||
</no-load-paging>
|
||||
<div class="uk-margin-top" *ngFor="let criterion of currentPage; let i=index" [formGroupName]="getIndex(i).toString()">
|
||||
<h6 class="uk-text-bold uk-form-label uk-margin-small-bottom">Filter {{getIndex(i) + 1}}</h6>
|
||||
<div class="uk-padding criterion" formArrayName="constraint">
|
||||
<div class="uk-flex uk-flex-middle uk-grid-small uk-margin-small-bottom uk-visible@l" uk-grid>
|
||||
<div style="width: 50px"></div>
|
||||
<form *ngIf="criteria.length > 0" [formGroup]="selectionCriteria">
|
||||
<div formArrayName="criteria" class="uk-margin-bottom">
|
||||
<no-load-paging (pageChange)="updatePage($event)" [page]="page" [totalResults]="criteria.length"
|
||||
[pageSize]="pageSize" [type]="'filter' + (criteria.length > 1?'s':'')">
|
||||
</no-load-paging>
|
||||
<ul class="uk-list uk-list-xlarge uk-margin-top uk-margin-bottom">
|
||||
<li *ngFor="let criterion of currentPage; let i=index">
|
||||
<div [formGroupName]="getIndex(i).toString()" class="uk-flex">
|
||||
<h3 class="uk-padding uk-margin-remove-bottom uk-margin-top">
|
||||
{{getIndex(i) + 1}}
|
||||
</h3>
|
||||
<div class="uk-width-expand uk-padding-small criterion" formArrayName="constraint">
|
||||
<div class="uk-flex-middle uk-grid uk-margin-small-bottom uk-visible@l" uk-grid>
|
||||
<div class="uk-width-1-4">
|
||||
<label class="uk-text-uppercase uk-text-bold">Field</label>
|
||||
</div>
|
||||
|
@ -64,25 +44,22 @@
|
|||
</div>
|
||||
<div *ngFor="let constraint of getConstraint(getIndex(i)).controls; let j=index" [formGroupName]="j.toString()"
|
||||
class="uk-margin-bottom uk-hidden@l">
|
||||
<div class="uk-flex uk-flex-middle uk-grid-small uk-margin-medium-bottom" uk-grid>
|
||||
<div class="uk-flex uk-flex-center uk-width-1-1">
|
||||
<span *ngIf="j > 0">AND</span>
|
||||
</div>
|
||||
<div class="uk-flex-middle uk-grid-small uk-margin-medium-bottom" uk-grid>
|
||||
<div class="uk-flex uk-flex-right uk-width-1-1">
|
||||
<a class="uk-link-heading" (click)="removeConstraint(getIndex(i), j)">
|
||||
<icon name="close"
|
||||
<a class="uk-close" (click)="removeConstraint(getIndex(i), j)">
|
||||
<icon name="close" ratio="1.5" [flex]="true"
|
||||
[attr.uk-tooltip]="(getConstraint(getIndex(i)).length === 1?'By removing this constraint, the filter will be removed too':null)"></icon>
|
||||
</a>
|
||||
</div>
|
||||
<div class="uk-width-1-1" dashboard-input type="select" placeholder="Select a field"
|
||||
<div class="uk-width-1-1" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
|
||||
[options]="fields" [formInput]="constraint.get('field')">
|
||||
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Field:</label>
|
||||
</div>
|
||||
<div class="uk-width-1-1" dashboard-input type="select" placeholder="Select an operator"
|
||||
<div class="uk-width-1-1" input type="select" inputClass="border-bottom"
|
||||
[options]="verbs" [formInput]="constraint.get('verb')">
|
||||
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label>
|
||||
</div>
|
||||
<div class="uk-width-1-1" dashboard-input placeholder="Write a term"
|
||||
<div class="uk-width-1-1" input [placeholder]="{static: true, label: 'Type a keyword'}"
|
||||
[formInput]="constraint.get('value')">
|
||||
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Term:</label>
|
||||
</div>
|
||||
|
@ -92,7 +69,7 @@
|
|||
<div class="uk-width-expand">
|
||||
<mat-slide-toggle [checked]="constraint.get('verb_suffix').value === ''"
|
||||
[attr.uk-tooltip]="(constraint.get('verb_suffix').value === ''?('Only \'\'' + constraint.get('value').value + '\'\' matches'):
|
||||
('Both \'\'' + constraint.get('value').value.toUpperCase() + '\'\' and \'\'' + constraint.get('value').value.toLowerCase() + '\'\' match'))"
|
||||
('Both \'\'' + constraint.get('value').value.toUpperCase() + '\'\' and \'\'' + constraint.get('value').value.toLowerCase() + '\'\' match'))"
|
||||
(change)="caseSensitive($event, constraint)"></mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -101,70 +78,43 @@
|
|||
</div>
|
||||
<div *ngFor="let constraint of getConstraint(getIndex(i)).controls; let j=index"
|
||||
[formGroupName]="j.toString()" class="uk-margin-bottom uk-visible@l">
|
||||
<div class="uk-flex uk-flex-middle uk-grid-small" uk-grid>
|
||||
<div class="uk-flex uk-flex-center" style="width: 50px">
|
||||
<span *ngIf="j > 0">AND</span>
|
||||
</div>
|
||||
<div class="uk-width-1-4" dashboard-input type="select" placeholder="Select a field"
|
||||
<div class="uk-flex uk-flex-middle uk-grid" uk-grid>
|
||||
<div class="uk-width-1-4" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
|
||||
[options]="fields" [formInput]="constraint.get('field')"></div>
|
||||
<div class="uk-width-1-4" dashboard-input type="select" placeholder="Select an operator"
|
||||
<div class="uk-width-1-4" input type="select" inputClass="border-bottom"
|
||||
[options]="verbs" [formInput]="constraint.get('verb')"></div>
|
||||
<div class="uk-width-1-4" dashboard-input placeholder="Write a term"
|
||||
<div class="uk-width-1-4" input [placeholder]="{static: true, label: 'Type a keyword'}"
|
||||
[formInput]="constraint.get('value')"></div>
|
||||
<div class="uk-width-expand">
|
||||
<mat-slide-toggle [checked]="constraint.get('verb_suffix').value === ''" class="uk-margin-left"
|
||||
[attr.uk-tooltip]="(constraint.get('verb_suffix').value === ''?('Only \'\'' + constraint.get('value').value + '\'\' matches'):
|
||||
('Both \'\'' + constraint.get('value').value.toUpperCase() + '\'\' and \'\'' + constraint.get('value').value.toLowerCase() + '\'\' match'))"
|
||||
('Both \'\'' + constraint.get('value').value.toUpperCase() + '\'\' and \'\'' + constraint.get('value').value.toLowerCase() + '\'\' match'))"
|
||||
(change)="caseSensitive($event, constraint)"></mat-slide-toggle>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<a class="uk-link-heading" (click)="removeConstraint(getIndex(i), j)">
|
||||
<icon name="close"
|
||||
<a class="uk-close" (click)="removeConstraint(getIndex(i), j)">
|
||||
<icon name="close" ratio="1.5" [flex]="true"
|
||||
[attr.uk-tooltip]="(getConstraint(getIndex(i)).length === 1?'By removing this constraint, the filter will be removed too':null)"></icon>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-margin-top uk-width-1-1 uk-flex uk-flex-center uk-hidden@l">
|
||||
<a (click)="addConstraint(getIndex(i))" class="uk-flex uk-flex-middle uk-text-uppercase">
|
||||
<button class="large uk-icon-button uk-button-secondary">
|
||||
<icon name="add"></icon>
|
||||
</button>
|
||||
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">
|
||||
Add Constraint
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle uk-grid-small uk-visible@l" uk-grid>
|
||||
<div style="width: 50px"></div>
|
||||
<a (click)="addConstraint(getIndex(i))" class="uk-flex uk-flex-middle uk-text-uppercase">
|
||||
<button class="large uk-icon-button uk-button-secondary">
|
||||
<icon name="add"></icon>
|
||||
</button>
|
||||
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">
|
||||
Add Constraint
|
||||
</button>
|
||||
<div class="uk-margin-top uk-width-1-1 uk-flex uk-flex-center uk-flex-left@l">
|
||||
<a (click)="addConstraint(getIndex(i))" class="uk-flex uk-flex-middle uk-button uk-button-link">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span class="uk-margin-small-left">Add Constraint</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="uk-flex uk-flex-center uk-margin-large-bottom">
|
||||
<a (click)="addCriteria()" class="uk-flex uk-flex-middle uk-text-uppercase"
|
||||
uk-tooltip="<div class='uk-padding-small'>Add filter to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>">
|
||||
<button class="large uk-icon-button uk-button-secondary">
|
||||
<icon name="add"></icon>
|
||||
</button>
|
||||
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">
|
||||
Add filter
|
||||
</button>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="uk-margin-small-top">
|
||||
<paging-no-load [currentPage]="page" [totalResults]="criteria.length" [size]="pageSize"
|
||||
(pageChange)="updatePage($event)" customClasses="uk-flex-right@m uk-flex-center">
|
||||
</paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="loading" class="uk-position-center">
|
||||
<loading></loading>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
@import (reference) "~src/assets/openaire-theme/less/_import-variables.less";
|
||||
|
||||
.criterion {
|
||||
border: @global-border solid @global-border-width;
|
||||
border-radius: @global-border-radius;
|
||||
max-height: 400px;
|
||||
overflow: auto;
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {SearchCommunityDataprovidersService} from '../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
|
||||
import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core';
|
||||
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
|
||||
import {
|
||||
Constraint,
|
||||
|
@ -10,25 +8,21 @@ import {
|
|||
} from '../../../openaireLibrary/utils/entities/contentProvider';
|
||||
import {AbstractControl, FormArray, FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||
import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {Subscription} from "rxjs";
|
||||
import {Option} from "../../../openaireLibrary/sharedComponents/input/input.component";
|
||||
import {MatSlideToggleChange} from "@angular/material/slide-toggle";
|
||||
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {CriteriaUtils} from "../criteria-utils";
|
||||
|
||||
declare var UIkit;
|
||||
import {NotificationHandler} from "../../../openaireLibrary/utils/notification-handler";
|
||||
|
||||
@Component({
|
||||
selector: 'criteria',
|
||||
templateUrl: './criteria.component.html',
|
||||
styleUrls: ['criteria.component.css'],
|
||||
templateUrl: 'criteria.component.html',
|
||||
styleUrls: ['criteria.component.less']
|
||||
})
|
||||
export class CriteriaComponent implements OnInit, OnDestroy {
|
||||
public community: string = '';
|
||||
public openaireId: string = '';
|
||||
public dataProvider: ContentProvider = null;
|
||||
export class CriteriaComponent implements OnInit {
|
||||
@Input()
|
||||
public dataProvider: ContentProvider;
|
||||
public selectionCriteria: FormGroup;
|
||||
public properties: EnvProperties = properties;
|
||||
public fields: Option[] = CriteriaUtils.fields;
|
||||
|
@ -37,51 +31,15 @@ export class CriteriaComponent implements OnInit, OnDestroy {
|
|||
/** Paging */
|
||||
public page: number = 1;
|
||||
public pageSize: number = 5;
|
||||
private subs: any[] = [];
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router,
|
||||
private title: Title,
|
||||
private searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
|
||||
private manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
|
||||
constructor(private manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private fb: FormBuilder) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subs.push(this.route.params.subscribe(params => {
|
||||
this.community = params['community'];
|
||||
this.route.params.subscribe(params => {
|
||||
if (params['provider']) {
|
||||
this.openaireId = params['provider'];
|
||||
}
|
||||
this.searchCommunityDataprovidersService.searchDataproviders(this.properties, this.community).subscribe(dataProviders => {
|
||||
dataProviders.forEach(dataProvider => {
|
||||
if (dataProvider.openaireId == this.openaireId) {
|
||||
this.dataProvider = dataProvider;
|
||||
this.title.setTitle(this.community.toUpperCase() + ' | Criteria for ' + this.dataProvider.officialname);
|
||||
}
|
||||
});
|
||||
if (!this.dataProvider) {
|
||||
this.navigateToError();
|
||||
} else {
|
||||
this.reset();
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
this.subs.forEach(subscription => {
|
||||
if (subscription instanceof Subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private navigateToError() {
|
||||
this.router.navigate(['/error'], {queryParams: {'page': this.properties.baseLink + this.router.url}});
|
||||
this.reset();
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
@ -110,6 +68,10 @@ export class CriteriaComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
get disabled() {
|
||||
return this.loading || !this.dirty || this.selectionCriteria.invalid;
|
||||
}
|
||||
|
||||
get currentPage(): AbstractControl[] {
|
||||
if (this.criteria) {
|
||||
return this.criteria.controls.slice((this.page - 1) * this.pageSize, this.page * this.pageSize);
|
||||
|
@ -162,8 +124,8 @@ export class CriteriaComponent implements OnInit, OnDestroy {
|
|||
constraintArray.removeAt(j);
|
||||
if (constraintArray.length === 0) {
|
||||
this.criteria.removeAt(i);
|
||||
if (this.currentPage.length === 0) {
|
||||
this.page = 1;
|
||||
while(this.currentPage.length === 0 && this.page > 0) {
|
||||
this.page--;
|
||||
}
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
|
@ -192,34 +154,31 @@ export class CriteriaComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
save() {
|
||||
save(callback: Function = null) {
|
||||
if (this.selectionCriteria.valid) {
|
||||
this.loading = true;
|
||||
this.dataProvider.selectioncriteria = this.parseForm(this.selectionCriteria.value);
|
||||
this.manageCommunityContentProvidersService.saveContentProvider(this.properties, this.dataProvider).subscribe(() => {
|
||||
this.reset();
|
||||
if(callback) {
|
||||
callback();
|
||||
}
|
||||
this.loading = false;
|
||||
UIkit.notification('Filters has been <b>successfully updated</b>', {
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
NotificationHandler.rise('Filters have been <b>successfully updated</b>');
|
||||
}, error => {
|
||||
UIkit.notification('An error has been occurred. Try again later!', {
|
||||
status: 'danger',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
this.loading = false;
|
||||
this.handeError('An error has been occurred. Try again later!', error);
|
||||
});
|
||||
} else {
|
||||
UIkit.notification('An error has been occurred. Try again later!', {
|
||||
status: 'danger',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
this.handeError('An error has been occurred. Try again later!');
|
||||
}
|
||||
}
|
||||
|
||||
handeError(message, error = null) {
|
||||
console.error(error);
|
||||
NotificationHandler.rise(message, 'danger');
|
||||
}
|
||||
|
||||
caseSensitive(event: MatSlideToggleChange, constraint: AbstractControl) {
|
||||
if(event.checked) {
|
||||
constraint.get('verb_suffix').setValue('');
|
||||
|
@ -254,4 +213,9 @@ export class CriteriaComponent implements OnInit, OnDestroy {
|
|||
})
|
||||
return selectionCriteria;
|
||||
}
|
||||
|
||||
public updatePage(event) {
|
||||
this.page = event.value;
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {CriteriaComponent} from './criteria.component';
|
||||
import {CriteriaRoutingModule} from './criteria-routing.module';
|
||||
import {SearchCommunityDataprovidersService} from '../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
|
||||
import {
|
||||
SearchCommunityDataprovidersService
|
||||
} from '../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service';
|
||||
import {PageContentModule} from "../../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module";
|
||||
import {IconsModule} from "../../../openaireLibrary/utils/icons/icons.module";
|
||||
import {IconsService} from "../../../openaireLibrary/utils/icons/icons.service";
|
||||
import {add, arrow_left, close} from "../../../openaireLibrary/utils/icons/icons";
|
||||
import {LoadingModule} from "../../../openaireLibrary/utils/loading/loading.module";
|
||||
import {InputModule} from "../../../openaireLibrary/sharedComponents/input/input.module";
|
||||
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
|
||||
import {ScrollingModule} from "@angular/cdk/scrolling";
|
||||
import {NoLoadPaging} from "../../../openaireLibrary/searchPages/searchUtils/no-load-paging.module";
|
||||
import {PagingModule} from "../../../openaireLibrary/utils/paging.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
CriteriaRoutingModule,
|
||||
RouterModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
|
@ -30,6 +29,7 @@ import {NoLoadPaging} from "../../../openaireLibrary/searchPages/searchUtils/no-
|
|||
MatSlideToggleModule,
|
||||
ScrollingModule,
|
||||
NoLoadPaging,
|
||||
PagingModule,
|
||||
],
|
||||
declarations: [
|
||||
CriteriaComponent
|
||||
|
@ -41,8 +41,4 @@ import {NoLoadPaging} from "../../../openaireLibrary/searchPages/searchUtils/no-
|
|||
exports: [CriteriaComponent]
|
||||
})
|
||||
|
||||
export class CriteriaModule {
|
||||
constructor(private iconsService: IconsService) {
|
||||
this.iconsService.registerIcons([arrow_left, add, close])
|
||||
}
|
||||
}
|
||||
export class CriteriaModule {}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {Router} from "@angular/router";
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {RemoveContentProvidersComponent} from './remove-content-providers.component';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {
|
||||
|
@ -11,41 +10,53 @@ import {properties} from "../../../environments/environment";
|
|||
import {Subscriber} from "rxjs";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
|
||||
import {ContentProvider} from "../../openaireLibrary/utils/entities/contentProvider";
|
||||
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
|
||||
import {CriteriaComponent} from "./criteria/criteria.component";
|
||||
|
||||
@Component({
|
||||
selector: 'manage-content-providers',
|
||||
template: `
|
||||
<remove-content-providers #removeContentProvidersComponent (addContentProviders)="openAddContentProviders()" [communityContentProviders]="communityContentProviders"
|
||||
<remove-content-providers #removeContentProviders (addContentProviders)="openAddContentProviders()"
|
||||
[communityContentProviders]="communityContentProviders"
|
||||
[loading]="showLoadingInRemove" [community]="community" [disableAdd]="add.loading"
|
||||
(editCriteria)="openCriteria($event)"
|
||||
(communityContentProvidersChanged)="communityContentProvidersChanged($event)">
|
||||
</remove-content-providers>
|
||||
<fs-modal #fsModal>
|
||||
<fs-modal #addContentProvidersModal>
|
||||
<add-content-providers #add [communityContentProviders]="communityContentProviders" [community]="community"
|
||||
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers>
|
||||
</fs-modal>
|
||||
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset()" [okButtonDisabled]="criteria && criteria.disabled">
|
||||
<div class="uk-container">
|
||||
<criteria #criteria *ngIf="contentProvider" [dataProvider]="contentProvider"></criteria>
|
||||
</div>
|
||||
</fs-modal>
|
||||
`
|
||||
})
|
||||
|
||||
export class ManageContentProvidersComponent implements OnInit {
|
||||
@Input() communityContentProviders = [];
|
||||
communityContentProviders: ContentProvider[] = [];
|
||||
@ViewChild(RemoveContentProvidersComponent) removeContentProvidersComponent: RemoveContentProvidersComponent;
|
||||
@ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent;
|
||||
@ViewChild('criteria') criteria: CriteriaComponent;
|
||||
@ViewChild('addContentProvidersModal', { static: true }) addContentProvidersModal: FullScreenModalComponent;
|
||||
@ViewChild('filtersModal', { static: true }) filtersModal: FullScreenModalComponent;
|
||||
private subscriptions: any[] = [];
|
||||
public showLoadingInRemove: boolean = true;
|
||||
public body: string = "Send from page";
|
||||
public properties: EnvProperties = properties;
|
||||
public community: CommunityInfo;
|
||||
public contentProvider: ContentProvider;
|
||||
|
||||
constructor(private element: ElementRef,
|
||||
private title: Title,
|
||||
private communityService: CommunityService, private _router: Router) {
|
||||
constructor(private title: Title,
|
||||
private communityService: CommunityService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
|
||||
this.community = community;
|
||||
if (this.community) {
|
||||
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Content Providers');
|
||||
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | ' + OpenaireEntities.DATASOURCES);
|
||||
this.body = "[Please write your message here]";
|
||||
this.body = StringUtils.URIEncode(this.body);
|
||||
}
|
||||
|
@ -61,18 +72,34 @@ export class ManageContentProvidersComponent implements OnInit {
|
|||
}
|
||||
|
||||
public openAddContentProviders() {
|
||||
this.fullscreen.title = "Search and Add Content Providers";
|
||||
this.fullscreen.okButtonText = "Done";
|
||||
this.fullscreen.back = true;
|
||||
this.fullscreen.okButton = true;
|
||||
this.fullscreen.open();
|
||||
this.addContentProvidersModal.title = "Search and Add " + OpenaireEntities.DATASOURCES;
|
||||
this.addContentProvidersModal.okButtonText = "Done";
|
||||
this.addContentProvidersModal.back = true;
|
||||
this.addContentProvidersModal.okButton = true;
|
||||
this.addContentProvidersModal.open();
|
||||
}
|
||||
|
||||
public openCriteria(contentProvider: ContentProvider) {
|
||||
this.contentProvider = contentProvider;
|
||||
this.filtersModal.title = 'Filters';
|
||||
this.filtersModal.okButtonText = "Save";
|
||||
this.filtersModal.back = true;
|
||||
this.filtersModal.okButton = true;
|
||||
this.filtersModal.open();
|
||||
}
|
||||
|
||||
public saveCriteria() {
|
||||
let callback: Function = () => {
|
||||
this.removeContentProvidersComponent.getCommunityContentProviders();
|
||||
}
|
||||
this.removeContentProvidersComponent.loading = true;
|
||||
this.criteria.save(callback);
|
||||
}
|
||||
|
||||
public communityContentProvidersChanged($event) {
|
||||
this.communityContentProviders = $event.value;
|
||||
this.showLoadingInRemove = false;
|
||||
|
||||
if (this.fullscreen.isOpen) {
|
||||
if (this.addContentProvidersModal.isOpen) {
|
||||
this.removeContentProvidersComponent.applyFilters();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div header>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
|
||||
<div>
|
||||
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Content Providers
|
||||
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage <span class="uk-text-capitalize">{{openAIREEntities.DATASOURCES}}</span>
|
||||
</div>
|
||||
<h1 class="uk-h4 uk-margin-remove">{{community.shortTitle}}</h1>
|
||||
</div>
|
||||
|
@ -12,15 +12,14 @@
|
|||
<div inner>
|
||||
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-middle uk-grid uk-margin-top" uk-grid>
|
||||
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
|
||||
placeholder="Search Content Providers" [disabled]="loading"
|
||||
[placeholder]="'Search ' + openAIREEntities.DATASOURCES" [disabled]="loading"
|
||||
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
|
||||
<div>
|
||||
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="addNew()"
|
||||
[attr.uk-tooltip]="(toggle? 'cls: uk-invisible; ' : 'cls: uk-active; ') +
|
||||
'title: <div><div class=\'uk-margin-bottom uk-text-bold\'> Search and add more Content Providers</div><div>The research results collected from the content providers specified here will be automatically linked to your community dashboard.</div></div>'"
|
||||
[attr.uk-tooltip]="'<div><div class=\'uk-margin-bottom uk-text-bold\'> Search and add more <span class=\'uk-text-lowercase\'>' + openAIREEntities.DATASOURCES + '<span></span></div><div>The research results collected from the <span class=\'uk-text-lowercase\'>' + openAIREEntities.DATASOURCES + '</span> specified here will be automatically linked to your community dashboard.</div></div>'"
|
||||
[disabled]="loading || disableAdd" [class.uk-disabled]="loading || disableAdd">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">New content provider</span>
|
||||
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">New {{openAIREEntities.DATASOURCE}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -31,10 +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 content providers found</div>
|
||||
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}}</span> found</div>
|
||||
</div>
|
||||
<div *ngIf="previewCommunityContentProviders.length > 0">
|
||||
<no-load-paging [type]="'content providers'"
|
||||
<no-load-paging [type]="previewCommunityContentProviders.length === 1?openAIREEntities.DATASOURCE:openAIREEntities.DATASOURCES"
|
||||
(pageChange)="updatePage($event)"
|
||||
[page]="page" [pageSize]="resultsPerPage"
|
||||
[totalResults]="previewCommunityContentProviders.length">
|
||||
|
@ -62,7 +61,7 @@
|
|||
<div class="uk-text-meta uk-margin-small-bottom">Filters</div>
|
||||
<div [innerHTML]="getFiltersAsText(item.selectioncriteria.criteria)"></div>
|
||||
<div *ngIf="item.selectioncriteria.criteria.length > 3" class="uk-margin-small-top">
|
||||
<a class="uk-link view-more-less-link" [routerLink]="'./' + item.openaireId">View all {{item.selectioncriteria.criteria.length}} filters</a>
|
||||
<a class="uk-link view-more-less-link" (click)="openCriteria(item)">View all {{item.selectioncriteria.criteria.length}} filters</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -70,7 +69,7 @@
|
|||
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
|
||||
<div>
|
||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||
<a (click)="goToCriteria(item.openaireId)" class="uk-button uk-button-link uk-flex uk-flex-middle">
|
||||
<a (click)="openCriteria(item)" class="uk-button uk-button-link uk-flex uk-flex-middle">
|
||||
<icon name="filters" [flex]="true"></icon>
|
||||
<span *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-left"
|
||||
uk-tooltip="<div>Edit filters to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>">
|
||||
|
@ -108,4 +107,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="confirmedDeleteContentProvider()"></modal-alert>
|
||||
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="confirmedDeleteContentProvider()" classTitle="uk-background-primary uk-light"></modal-alert>
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
SearchCommunityDataprovidersService
|
||||
} from '../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
|
||||
import {RouterHelper} from '../../openaireLibrary/utils/routerHelper.class';
|
||||
import {Criteria} from '../../openaireLibrary/utils/entities/contentProvider';
|
||||
import {ContentProvider, Criteria} from '../../openaireLibrary/utils/entities/contentProvider';
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/search-input/search-input.component";
|
||||
import {FormBuilder, FormGroup} from "@angular/forms";
|
||||
|
@ -17,6 +17,8 @@ import {CriteriaUtils} from "./criteria-utils";
|
|||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
|
||||
import {AlertModal} from "../../openaireLibrary/utils/modal/alert";
|
||||
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
|
||||
@Component({
|
||||
selector: 'remove-content-providers',
|
||||
|
@ -25,12 +27,13 @@ import {AlertModal} from "../../openaireLibrary/utils/modal/alert";
|
|||
export class RemoveContentProvidersComponent implements OnInit {
|
||||
public routerHelper: RouterHelper = new RouterHelper();
|
||||
public contentProviderUrl = "https://" + ((properties.environment == "beta" || properties.environment == "development") ? "beta." : "") + "explore.openaire.eu" + properties.searchLinkToDataProvider;
|
||||
public previewCommunityContentProviders = [];
|
||||
public previewCommunityContentProviders: ContentProvider[] = [];
|
||||
public errorCodes: ErrorCodes;
|
||||
public openAIREEntities = OpenaireEntities;
|
||||
@Input() public loading: boolean = true;
|
||||
@Input() public disableAdd: boolean = false;
|
||||
@Input() public community: CommunityInfo;
|
||||
@Input() public communityContentProviders = [];
|
||||
@Input() public communityContentProviders: ContentProvider[] = [];
|
||||
@Output() communityContentProvidersChanged = new EventEmitter();
|
||||
private properties: EnvProperties = properties;
|
||||
private subscriptions: any[] = [];
|
||||
|
@ -49,7 +52,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
private searchText: RegExp = new RegExp('');
|
||||
public keyword: string = '';
|
||||
@Output() addContentProviders: EventEmitter<void> = new EventEmitter();
|
||||
@Input() public toggle: boolean = true;
|
||||
@Output() editCriteria: EventEmitter<ContentProvider> = new EventEmitter<ContentProvider>();
|
||||
|
||||
constructor(private route: ActivatedRoute, private _router: Router,
|
||||
private _fb: FormBuilder,
|
||||
|
@ -100,7 +103,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider);
|
||||
this.communityContentProviders.splice(index, 1);
|
||||
this.applyFilters();
|
||||
this.handleSuccess('Content Provider successfully removed!')
|
||||
this.handleSuccess(this.openAIREEntities.DATASOURCE + ' successfully removed!')
|
||||
this.communityContentProvidersChanged.emit({
|
||||
value: this.communityContentProviders,
|
||||
});
|
||||
|
@ -114,7 +117,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
|
||||
public removeContentProvider(communityContentProvider: any) {
|
||||
this.selectedCommunityContentProvider = communityContentProvider;
|
||||
this.deleteModal.alertTitle = "Remove content provider";
|
||||
this.deleteModal.alertTitle = "Remove " + this.openAIREEntities.DATASOURCE;
|
||||
let title = "";
|
||||
if (communityContentProvider.name) {
|
||||
title = communityContentProvider.name;
|
||||
|
@ -128,7 +131,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
if (communityContentProvider.name && communityContentProvider.acronym) {
|
||||
title += ")";
|
||||
}
|
||||
this.deleteModal.message = "Content Provider";
|
||||
this.deleteModal.message = this.openAIREEntities.DATASOURCE;
|
||||
if (title) {
|
||||
this.deleteModal.message += " '" + title + "' ";
|
||||
}
|
||||
|
@ -140,6 +143,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
|
||||
public getCommunityContentProviders() {
|
||||
this.communityContentProviders = [];
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this._searchCommunityContentProvidersService.searchDataproviders(this.properties, this.community.communityId).subscribe(
|
||||
data => {
|
||||
this.communityContentProviders = data;
|
||||
|
@ -157,10 +161,11 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
}
|
||||
|
||||
public updatePage($event) {
|
||||
HelperFunctions.scroll();
|
||||
this.page = $event.value;
|
||||
}
|
||||
|
||||
get currentPage(): any[] {
|
||||
get currentPage(): ContentProvider[] {
|
||||
return this.previewCommunityContentProviders.slice((this.page - 1)*this.resultsPerPage, this.page*this.resultsPerPage);
|
||||
}
|
||||
|
||||
|
@ -190,13 +195,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
NotificationHandler.rise(message, 'danger');
|
||||
}
|
||||
|
||||
goToCriteria(openaireId: string) {
|
||||
this._router.navigate([openaireId], {
|
||||
queryParams: {
|
||||
// community: this.portal,
|
||||
// provider: openaireId
|
||||
},
|
||||
relativeTo: this.route
|
||||
})
|
||||
openCriteria(contentProvider: ContentProvider) {
|
||||
this.editCriteria.emit(contentProvider);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import {Subscription} from "rxjs";
|
|||
template: `
|
||||
<div page-content>
|
||||
<div inner>
|
||||
<div class="mining">
|
||||
<div class="mining uk-section">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -10,26 +10,23 @@
|
|||
<community-info tab="subjects"></community-info>
|
||||
</div>
|
||||
<div inner>
|
||||
<div class="uk-grid uk-margin-top" uk-grid>
|
||||
<div class="uk-width-1-2@m"></div>
|
||||
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle uk-flex-right@m uk-flex-center uk-margin-remove-left" uk-grid>
|
||||
<div [disabled]="showLoading" search-input class="uk-width-expand@l uk-width-1-1"
|
||||
[searchControl]="filterForm" [expandable]="true" placeholder="Search Subjects" searchInputClass="outer">
|
||||
</div>
|
||||
<!-- <a *ngIf="!subjectsEnabled" (click)="enablePage()" class="uk-link-heading uk-text-small uk-text-uppercase"
|
||||
uk-tooltip="title:<div class='uk-padding-small'>This information will be visible in <b>Subjects page</b> of Research Community Dashboard, which is <b>disabled</b>. <br> Click to enable id.</div>">
|
||||
<span class="uk-text-secondary"><icon name="check_circle_outlined"></icon></span>
|
||||
Enable page
|
||||
</a>-->
|
||||
<div>
|
||||
<button class="uk-button uk-button-default uk-flex uk-flex-middle"
|
||||
[disabled]="showLoading" [class.uk-disabled]="showLoading"
|
||||
(click)="newSubject()"
|
||||
uk-tooltip="title:<div><div class='uk-margin-small-bottom uk-text-bold'>Add new subjects</div> All the research results associated to the subjects specified here will be automatically linked to the community dashboard in the next run of OpenAIRE workflows.</div>">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span class="uk-margin-small-left">New Subject</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-middle uk-grid uk-margin-top" uk-grid>
|
||||
<div [disabled]="showLoading" search-input class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"
|
||||
[searchControl]="filterForm" [expandable]="true" placeholder="Search Subjects" searchInputClass="outer">
|
||||
</div>
|
||||
<!-- <a *ngIf="!subjectsEnabled" (click)="enablePage()" class="uk-link-heading uk-text-small uk-text-uppercase"
|
||||
uk-tooltip="title:<div class='uk-padding-small'>This information will be visible in <b>Subjects page</b> of Research Community Dashboard, which is <b>disabled</b>. <br> Click to enable id.</div>">
|
||||
<span class="uk-text-secondary"><icon name="check_circle_outlined"></icon></span>
|
||||
Enable page
|
||||
</a>-->
|
||||
<div>
|
||||
<button class="uk-button uk-button-default uk-flex uk-flex-middle"
|
||||
[disabled]="showLoading" [class.uk-disabled]="showLoading"
|
||||
(click)="newSubject()"
|
||||
uk-tooltip="title:<div><div class='uk-margin-small-bottom uk-text-bold'>Add new subjects</div> All the research results associated to the subjects specified here will be automatically linked to the community dashboard in the next run of OpenAIRE workflows.</div>">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
<span class="uk-margin-small-left">New Subject</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
|
||||
|
@ -80,6 +77,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-margin-small-top">
|
||||
<paging-no-load [currentPage]="page" [totalResults]="community.subjects.length" [size]="size"
|
||||
(pageChange)="updatePage($event)" customClasses="uk-flex-right@m uk-flex-center">
|
||||
</paging-no-load>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -9,8 +9,6 @@ import {SubjectsService} from '../subjects.service';
|
|||
import {SubjectsEditFormRoutingModule} from './subjects-edit-form-routing.module';
|
||||
import {PageContentModule} from '../../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module';
|
||||
import {IconsModule} from '../../../openaireLibrary/utils/icons/icons.module';
|
||||
import {IconsService} from '../../../openaireLibrary/utils/icons/icons.service';
|
||||
import {add, check_circle_outlined, close, edit, remove} from '../../../openaireLibrary/utils/icons/icons';
|
||||
import {AlertModalModule} from '../../../openaireLibrary/utils/modal/alertModal.module';
|
||||
import {NoLoadPaging} from '../../../openaireLibrary/searchPages/searchUtils/no-load-paging.module';
|
||||
import {LoadingModule} from '../../../openaireLibrary/utils/loading/loading.module';
|
||||
|
@ -18,10 +16,11 @@ import {InputModule} from '../../../openaireLibrary/sharedComponents/input/input
|
|||
import {CommunityInfoModule} from '../../community-info/community-info.module';
|
||||
import {SearchInputModule} from '../../../openaireLibrary/sharedComponents/search-input/search-input.module';
|
||||
import {FullScreenModalModule} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module';
|
||||
import {PagingModule} from "../../../openaireLibrary/utils/paging.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule, PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule, CommunityInfoModule, SearchInputModule, FullScreenModalModule
|
||||
SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule, PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule, CommunityInfoModule, SearchInputModule, FullScreenModalModule, PagingModule
|
||||
],
|
||||
declarations: [
|
||||
SubjectsEditFormComponent
|
||||
|
@ -33,8 +32,4 @@ import {FullScreenModalModule} from 'src/app/openaireLibrary/utils/modal/full-sc
|
|||
SubjectsEditFormComponent
|
||||
]
|
||||
})
|
||||
export class SubjectsEditFormModule {
|
||||
constructor(private iconsService: IconsService) {
|
||||
this.iconsService.registerIcons([add, edit, remove, close])
|
||||
}
|
||||
}
|
||||
export class SubjectsEditFormModule {}
|
||||
|
|
|
@ -90,8 +90,8 @@ declare var UIkit;
|
|||
<div class="uk-card uk-card-default uk-margin-bottom">
|
||||
<div class="uk-card-body">
|
||||
<div class="uk-flex uk-flex-middle uk-flex-column">
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<img class="uk-height-xsmall uk-blend-multiply" [src]="affiliation.value.logo_url | urlPrefix">
|
||||
<div class="uk-flex uk-flex-center uk-height-xsmall">
|
||||
<img class="uk-height-max-xsmall uk-blend-multiply" [src]="affiliation.value.logo_url | urlPrefix">
|
||||
</div>
|
||||
<h5>{{affiliation.value.name}}</h5>
|
||||
<div class="uk-text-truncate uk-text-small">
|
||||
|
@ -148,7 +148,7 @@ declare var UIkit;
|
|||
if you have any inquiries.
|
||||
</div>
|
||||
</modal-alert>
|
||||
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid"
|
||||
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid" classTitle="uk-background-primary uk-light"
|
||||
(alertOutput)="editAffiliation()">
|
||||
<form *ngIf="affiliationFb" [formGroup]="affiliationFb">
|
||||
<div class="uk-grid uk-child-width-1-1" uk-grid>
|
||||
|
@ -161,9 +161,9 @@ declare var UIkit;
|
|||
</div>
|
||||
</form>
|
||||
</modal-alert>
|
||||
<modal-alert #removeAffiliationModal [overflowBody]="false" (alertOutput)="removeAffiliation()">
|
||||
<modal-alert #removeAffiliationModal [overflowBody]="false" (alertOutput)="removeAffiliation()" classTitle="uk-background-primary uk-light">
|
||||
</modal-alert>
|
||||
<modal-alert #enableCuratorsModal [overflowBody]="false" (alertOutput)="enableCurators()">
|
||||
<modal-alert #enableCuratorsModal [overflowBody]="false" (alertOutput)="enableCurators()" classTitle="uk-background-primary uk-light">
|
||||
Your personal information has been successfully saved.<br><br>
|
||||
This information will be visible in <span class="uk-text-bold">Curators page</span> of Research Community
|
||||
Dashboard, which is <span class="uk-text-bold">disabled</span>.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 35bca0f68bf19337413167ecf770f1027902964f
|
||||
Subproject commit 8f8b85e69d5c505ed59b12b8b70348096f339775
|
Loading…
Reference in New Issue