Add contente providers modal with new UI
This commit is contained in:
parent
4160f837c1
commit
9c75d63171
|
@ -83,11 +83,6 @@ export class AppComponent implements OnInit {
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(this.layoutService.hasHeader.subscribe(hasHeader => {
|
this.subscriptions.push(this.layoutService.hasHeader.subscribe(hasHeader => {
|
||||||
this.hasHeader = hasHeader;
|
this.hasHeader = hasHeader;
|
||||||
if(!this.hasHeader) {
|
|
||||||
document.documentElement.style.setProperty('--header-height', '0');
|
|
||||||
} else {
|
|
||||||
document.documentElement.style.setProperty('--header-height', '65px');
|
|
||||||
}
|
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(this.layoutService.hasAdminMenu.subscribe(hasAdminMenu => {
|
this.subscriptions.push(this.layoutService.hasAdminMenu.subscribe(hasAdminMenu => {
|
||||||
|
@ -121,11 +116,9 @@ export class AppComponent implements OnInit {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(this.community) {
|
|
||||||
this.communityService.setCommunity(null);
|
this.communityService.setCommunity(null);
|
||||||
this.community = null;
|
this.community = null;
|
||||||
this.buildMenu();
|
this.buildMenu();
|
||||||
}
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a738d3bb49d1af38f7eaf3ce34d519c76f075e4a
|
Subproject commit de493c84923348f8289d4e507c04cfec80c30d69
|
|
@ -1,60 +1,59 @@
|
||||||
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid uk-margin-medium-bottom" uk-grid>
|
<div class="uk-section uk-flex uk-flex-center uk-flex uk-flex-middle">
|
||||||
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
|
<div class="uk-width-auto uk-margin-right">
|
||||||
placeholder="Search Content Providers"
|
<a uk-icon="icon: info; ratio: 1.3"></a>
|
||||||
[selected]="openaireSearchUtils.keyword" (closeEmitter)="onSearchClose()" (resetEmitter)="resetInput()"
|
<div *ngIf="community" class="uk-dropdown uk-padding-small uk-width-medium" uk-dropdown="mode: hover">
|
||||||
[bordered]="true" colorClass="uk-text-secondary"
|
If you cannot find a content provider relevant to your community, probably it is not OpenAIRE compliant.
|
||||||
class="uk-width-1-2@l uk-width-1-2@m uk-width-1-1"></div>
|
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>
|
</div>
|
||||||
|
</div>
|
||||||
<div id="manage-content-providers">
|
<div search-input class="uk-width-xlarge@l uk-width-large" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
|
||||||
<div *ngIf="openaireSearchUtils.status == errorCodes.LOADING" class="uk-position-large-top">
|
placeholder="Search Content Providers" [disabled]="loading"></div>
|
||||||
|
</div>
|
||||||
|
<div class="uk-section uk-section-small uk-position-relative">
|
||||||
|
<div *ngIf="openaireSearchUtils.status == errorCodes.LOADING" class="uk-position-center">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="openaireSearchUtils.status !== errorCodes.LOADING">
|
||||||
<div *ngIf="openaireSearchUtils.totalResults == 0"
|
<div *ngIf="openaireSearchUtils.totalResults == 0"
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||||
<div>
|
<div>No content providers found</div>
|
||||||
<div *ngIf="openaireSearchUtils.status == errorCodes.NONE">No OpenAIRE content providers available</div>
|
|
||||||
<div *ngIf="openaireSearchUtils.status == errorCodes.ERROR">An Error Occurred. No OpenAIRE content providers found</div>
|
|
||||||
<div *ngIf="openaireSearchUtils.status == errorCodes.NOT_AVAILABLE">Service temporarily unavailable. Please try again later.</div>
|
|
||||||
<div *ngIf="openaireSearchUtils.status == errorCodes.NOT_FOUND">No OpenAIRE content providers found</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<!-- <errorMessages [status]="[openaireSearchUtils.status]" [type]="'OpenAIRE content providers'"></errorMessages>-->
|
|
||||||
|
|
||||||
<ng-container *ngIf="openaireSearchUtils.totalResults > 0">
|
<ng-container *ngIf="openaireSearchUtils.totalResults > 0">
|
||||||
<no-load-paging [type]="'Content Providers'"
|
<no-load-paging [type]="'content Providers'"
|
||||||
[page]="openaireSearchUtils.page" [pageSize]="resultsPerPage" (pageChange)="goTo($event.value)"
|
[page]="openaireSearchUtils.page" [pageSize]="resultsPerPage" (pageChange)="goTo($event.value)"
|
||||||
[totalResults]="openaireSearchUtils.totalResults">
|
[totalResults]="openaireSearchUtils.totalResults">
|
||||||
</no-load-paging>
|
</no-load-paging>
|
||||||
|
<div class="uk-grid uk-child-width-1-1 uk-margin-top uk-margin-bottom" uk-grid>
|
||||||
<ul class="uk-list search-results uk-margin-medium-top uk-margin-medium-bottom">
|
<div *ngFor="let result of openaireContentProviders">
|
||||||
<li *ngFor="let result of openaireContentProviders" class="uk-animation-fade">
|
<div class="uk-card uk-card-default">
|
||||||
<div class="uk-card uk-card-default uk-card-hover uk-text-small uk-margin-bottom">
|
<div class="uk-card-body">
|
||||||
<div class="uk-grid uk-grid-divider uk-padding-small" uk-grid>
|
|
||||||
<div class="uk-width-expand@m uk-width-1-1">
|
|
||||||
<result-preview [properties]="properties" [showOrganizations]="true"
|
<result-preview [properties]="properties" [showOrganizations]="true"
|
||||||
[showSubjects]="true" [result]="getResultPreview(result)"
|
[showSubjects]="true" [result]="getResultPreview(result)"
|
||||||
[externalUrl]="contentProviderUrl">
|
[externalUrl]="contentProviderUrl">
|
||||||
</result-preview>
|
</result-preview>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-width-auto@m uk-width-1-1">
|
<div class="uk-card-footer uk-padding-remove-vertical">
|
||||||
<div class="uk-flex uk-flex-middle uk-flex-center uk-flex-column uk-height-1-1">
|
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
|
||||||
|
<div *ngIf="!getCommunityContentProvider(result)">
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
|
<a (click)="addContentProvider(result)" class="uk-button uk-button-link uk-flex uk-flex-middle">
|
||||||
<div [class.hide-element]="!getCommunityContentProvider(result)">
|
<icon name="add" [flex]="true"></icon>
|
||||||
<a (click)="removeContentProvider(result)" class="uk-button action uk-flex uk-flex-middle">
|
<span class="uk-margin-small-left">
|
||||||
<icon name="remove_circle_outline"></icon>
|
Add
|
||||||
<span class="uk-margin-small-left">Remove content provider</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [class.hide-element]="getCommunityContentProvider(result)">
|
|
||||||
<a (click)="addContentProvider(result)" class="uk-button action uk-flex uk-flex-middle"
|
|
||||||
uk-tooltip="title:<div class='uk-padding-small'><div class='uk-margin-bottom uk-text-bold'>Add new content provider </div><div>Newly added content providers will be linked to your community on the next run of our algorithms.</div></div>">
|
|
||||||
<div class="uk-text-success">
|
|
||||||
<icon name="add"></icon>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="uk-margin-small-left">Add content provider</span>
|
<div *ngIf="getCommunityContentProvider(result)">
|
||||||
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
|
<a (click)="removeContentProvider(result)"
|
||||||
|
class="uk-button uk-button-link uk-flex uk-flex-middle">
|
||||||
|
<icon name="remove" [flex]="true"></icon>
|
||||||
|
<span class="uk-margin-small-left">Remove</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,17 +61,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
</ul>
|
<div class="uk-margin-small-top">
|
||||||
|
<paging-no-load [currentPage]="openaireSearchUtils.page"
|
||||||
<!-- <div [class]="openaireSearchUtils.page > pagingLimit ? 'search-results' : ''"-->
|
[totalResults]="openaireSearchUtils.totalResults" [size]="resultsPerPage"
|
||||||
<!-- *ngIf="(openaireSearchUtils.page >= pagingLimit) && (openaireSearchUtils.totalResults > resultsPerPage*pagingLimit)">-->
|
(pageChange)="goTo($event)" customClasses="uk-flex-right@m uk-flex-center">
|
||||||
<!-- <p class="uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>-->
|
</paging-no-load>
|
||||||
<!-- </div>-->
|
</div>
|
||||||
|
|
||||||
<no-load-paging [type]="'Content Providers'"
|
|
||||||
[page]="openaireSearchUtils.page" [pageSize]="resultsPerPage" (pageChange)="goTo($event.value)"
|
|
||||||
[totalResults]="openaireSearchUtils.totalResults">
|
|
||||||
</no-load-paging>
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -16,20 +16,17 @@ import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/searc
|
||||||
import {Subscriber} from "rxjs";
|
import {Subscriber} from "rxjs";
|
||||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||||
import {ResultPreview} from "../../openaireLibrary/utils/result-preview/result-preview";
|
import {ResultPreview} from "../../openaireLibrary/utils/result-preview/result-preview";
|
||||||
|
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
|
||||||
declare var UIkit;
|
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'add-content-providers',
|
selector: 'add-content-providers',
|
||||||
templateUrl: './add-content-providers.component.html',
|
templateUrl: './add-content-providers.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AddContentProvidersComponent implements OnInit {
|
export class AddContentProvidersComponent implements OnInit {
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
public subResults: any;
|
public subResults: any;
|
||||||
|
@Input() public community: CommunityInfo;
|
||||||
private community: string = '';
|
|
||||||
|
|
||||||
public routerHelper: RouterHelper = new RouterHelper();
|
public routerHelper: RouterHelper = new RouterHelper();
|
||||||
public properties: EnvProperties = properties;
|
public properties: EnvProperties = properties;
|
||||||
public errorCodes: ErrorCodes;
|
public errorCodes: ErrorCodes;
|
||||||
|
@ -38,22 +35,18 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
@Input() communityContentProviders = [];
|
@Input() communityContentProviders = [];
|
||||||
public openaireContentProviders = [];
|
public openaireContentProviders = [];
|
||||||
public queryParameters: string = "";
|
public queryParameters: string = "";
|
||||||
|
|
||||||
// public pagingLimit: number = properties.pagingLimit;
|
|
||||||
public resultsPerPage: number = properties.resultsPerPage;
|
public resultsPerPage: number = properties.resultsPerPage;
|
||||||
|
|
||||||
filterForm: FormGroup;
|
filterForm: FormGroup;
|
||||||
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
|
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
|
||||||
|
public contentProviderUrl: string = "https://" + ((properties.environment == "beta" || properties.environment == "development") ? "beta." : "") + "explore.openaire.eu" + properties.searchLinkToDataProvider;
|
||||||
private contentProviderUrl: string = "https://" + ((properties.environment == "beta" || properties.environment == "development") ? "beta." : "") + "explore.openaire.eu" + properties.searchLinkToDataProvider;
|
|
||||||
public body: string = "Send from page";
|
public body: string = "Send from page";
|
||||||
|
|
||||||
@Output() toggleView: EventEmitter<any> = new EventEmitter();
|
@Output() toggleView: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private _router: Router,
|
constructor(private route: ActivatedRoute, private router: Router,
|
||||||
private _searchContentProvidersService: SearchDataprovidersService,
|
private searchDataprovidersService: SearchDataprovidersService,
|
||||||
private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
|
private manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
|
||||||
private _fb: FormBuilder) {
|
private fb: FormBuilder) {
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||||
}
|
}
|
||||||
|
@ -61,23 +54,14 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||||
|
|
||||||
this.community = params['community'];
|
|
||||||
// this.contentProviderUrl = "https://" + ((this.properties.environment == "beta" || this.properties.environment == "development") ? "beta." : "")
|
|
||||||
// + this.community + ".openaire.eu" + this.properties.searchLinkToDataProvider;
|
|
||||||
|
|
||||||
this._getOpenaireContentProviders("", 1, this.resultsPerPage);
|
this._getOpenaireContentProviders("", 1, this.resultsPerPage);
|
||||||
|
|
||||||
this.body = "[Please write your message here]";
|
this.body = "[Please write your message here]";
|
||||||
this.body = StringUtils.URIEncode(this.body);
|
this.body = StringUtils.URIEncode(this.body);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.openaireSearchUtils.keyword = "";
|
this.openaireSearchUtils.keyword = "";
|
||||||
|
this.filterForm = this.fb.group({
|
||||||
this.filterForm = this._fb.group({
|
|
||||||
keyword: [''],
|
keyword: [''],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.subscriptions.push(this.filterForm.get('keyword').valueChanges
|
this.subscriptions.push(this.filterForm.get('keyword').valueChanges
|
||||||
.pipe(debounceTime(1000), distinctUntilChanged())
|
.pipe(debounceTime(1000), distinctUntilChanged())
|
||||||
.subscribe(value => {
|
.subscribe(value => {
|
||||||
|
@ -98,68 +82,44 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public addContentProvider(contenProvider: SearchResult) {
|
get loading() {
|
||||||
if (!Session.isLoggedIn()) {
|
return this.openaireSearchUtils.status == this.errorCodes.LOADING
|
||||||
this._router.navigate(['/user-info'], {
|
|
||||||
queryParams: {
|
|
||||||
"errorCode": LoginErrorCodes.NOT_VALID,
|
|
||||||
"redirectUrl": this._router.url
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} else {
|
public addContentProvider(contenProvider: SearchResult) {
|
||||||
this.subscriptions.push(this._manageCommunityContentProvidersService.addContentProvider(this.properties, this.community, contenProvider).subscribe(
|
this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contenProvider).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.communityContentProviders.push(data);
|
this.communityContentProviders.push(data);
|
||||||
UIkit.notification('Content Provider successfully added!', {
|
NotificationHandler.rise('Content Provider successfully added!')
|
||||||
status: 'success',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
this.communityContentProvidersChanged.emit({
|
this.communityContentProvidersChanged.emit({
|
||||||
value: this.communityContentProviders,
|
value: this.communityContentProviders,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
err => {
|
error => {
|
||||||
this.handleError('An error has been occurred. Try again later!');
|
this.handleError('An error has been occurred. Try again later!', error);
|
||||||
console.error(err.status);
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public removeContentProvider(contentProvider) {
|
public removeContentProvider(contentProvider) {
|
||||||
if (!Session.isLoggedIn()) {
|
|
||||||
this._router.navigate(['/user-info'], {
|
|
||||||
queryParams: {
|
|
||||||
"errorCode": LoginErrorCodes.NOT_VALID,
|
|
||||||
"redirectUrl": this._router.url
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let communityContentProvider = this.getCommunityContentProvider(contentProvider);
|
let communityContentProvider = this.getCommunityContentProvider(contentProvider);
|
||||||
let contentProviderId: string = communityContentProvider['id'];
|
let contentProviderId: string = communityContentProvider['id'];
|
||||||
this.subscriptions.push(this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, contentProviderId).subscribe(
|
this.subscriptions.push(this.manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, contentProviderId).subscribe(
|
||||||
data => {
|
data => {
|
||||||
let index = this.communityContentProviders.indexOf(communityContentProvider);
|
let index = this.communityContentProviders.indexOf(communityContentProvider);
|
||||||
this.communityContentProviders.splice(index, 1);
|
this.communityContentProviders.splice(index, 1);
|
||||||
UIkit.notification('Content Provider successfully removed!', {
|
NotificationHandler.rise('Content Provider successfully removed!')
|
||||||
status: 'success',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
this.communityContentProvidersChanged.emit({
|
this.communityContentProvidersChanged.emit({
|
||||||
value: this.communityContentProviders,
|
value: this.communityContentProviders,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
err => {
|
error => {
|
||||||
this.handleError('An error has been occurred. Try again later!');
|
this.handleError('An error has been occurred. Try again later!', error);
|
||||||
console.error(err);
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public getCommunityContentProvider(contentProvider: any): string {
|
public getCommunityContentProvider(contentProvider: any): any {
|
||||||
let index: number = 0;
|
let index: number = 0;
|
||||||
for (let communityContentProvider of this.communityContentProviders) {
|
for (let communityContentProvider of this.communityContentProviders) {
|
||||||
if (communityContentProvider.openaireId == contentProvider.id) {
|
if (communityContentProvider.openaireId == contentProvider.id) {
|
||||||
|
@ -167,39 +127,14 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
return "";
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getResultPreview(result: SearchResult): ResultPreview {
|
public getResultPreview(result: SearchResult): ResultPreview {
|
||||||
return ResultPreview.searchResultConvert(result, "dataprovider");
|
return ResultPreview.searchResultConvert(result, "dataprovider");
|
||||||
}
|
}
|
||||||
|
|
||||||
// public inCommunity(contentProvider: any): any {
|
|
||||||
// for(let communityContentProvider of this.communityContentProviders) {
|
|
||||||
// if(communityContentProvider.openaireId == contentProvider.id) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(this.undo[contentProvider.id]) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
private _getOpenaireContentProviders(parameters: string, page: number, size: number) {
|
private _getOpenaireContentProviders(parameters: string, page: number, size: number) {
|
||||||
if (!Session.isLoggedIn()) {
|
|
||||||
this._router.navigate(['/user-info'], {
|
|
||||||
queryParams: {
|
|
||||||
"errorCode": LoginErrorCodes.NOT_VALID,
|
|
||||||
"redirectUrl": this._router.url
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// if (page > this.pagingLimit) {
|
|
||||||
// size = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.openaireSearchUtils.status == this.errorCodes.LOADING) {
|
if (this.openaireSearchUtils.status == this.errorCodes.LOADING) {
|
||||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||||
|
|
||||||
|
@ -209,52 +144,30 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
if (this.subResults) {
|
if (this.subResults) {
|
||||||
this.subResults.unsubscribe();
|
this.subResults.unsubscribe();
|
||||||
}
|
}
|
||||||
this.subResults = this._searchContentProvidersService.searchDataproviders(parameters, null, page, size, [], this.properties).subscribe(
|
this.subResults = this.searchDataprovidersService.searchDataproviders(parameters, null, page, size, [], this.properties).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.openaireSearchUtils.totalResults = data[0];
|
this.openaireSearchUtils.totalResults = data[0];
|
||||||
this.openaireContentProviders = data[1];
|
this.openaireContentProviders = data[1];
|
||||||
|
|
||||||
//this.searchPage.checkSelectedFilters(this.filters);
|
|
||||||
this.openaireSearchUtils.status = this.errorCodes.DONE;
|
this.openaireSearchUtils.status = this.errorCodes.DONE;
|
||||||
if (this.openaireSearchUtils.totalResults == 0) {
|
if (this.openaireSearchUtils.totalResults == 0) {
|
||||||
this.openaireSearchUtils.status = this.errorCodes.NONE;
|
this.openaireSearchUtils.status = this.errorCodes.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.openaireSearchUtils.status == this.errorCodes.DONE) {
|
|
||||||
// // Page out of limit!!!
|
|
||||||
// let totalPages: any = this.openaireSearchUtils.totalResults / (this.openaireSearchUtils.size);
|
|
||||||
// if (!(Number.isInteger(totalPages))) {
|
|
||||||
// totalPages = (parseInt(totalPages, 10) + 1);
|
|
||||||
// }
|
|
||||||
// if (totalPages < page) {
|
|
||||||
// this.openaireSearchUtils.totalResults = 0;
|
|
||||||
// this.openaireSearchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
err => {
|
error => {
|
||||||
console.error(err);
|
if (error.status == '404') {
|
||||||
//TODO check erros (service not available, bad request)
|
this.handleError('No OpenAIRE content providers found.', error);
|
||||||
if (err.status == '404') {
|
|
||||||
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND;
|
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND;
|
||||||
} else if (err.status == '500') {
|
} else if (error.status == '500') {
|
||||||
|
this.handleError('An Error Occurred. No OpenAIRE content providers found.', error);
|
||||||
this.openaireSearchUtils.status = this.errorCodes.ERROR;
|
this.openaireSearchUtils.status = this.errorCodes.ERROR;
|
||||||
} else {
|
} else {
|
||||||
|
this.handleError('Service temporarily unavailable. Please try again later.', error);
|
||||||
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
totalPages(): number {
|
|
||||||
let totalPages: any = this.openaireSearchUtils.totalResults / (this.resultsPerPage);
|
|
||||||
if (!(Number.isInteger(totalPages))) {
|
|
||||||
totalPages = (parseInt(totalPages, 10) + 1);
|
|
||||||
}
|
|
||||||
return totalPages;
|
|
||||||
}
|
|
||||||
|
|
||||||
keywordChanged(keyword) {
|
keywordChanged(keyword) {
|
||||||
this.openaireSearchUtils.keyword = keyword;
|
this.openaireSearchUtils.keyword = keyword;
|
||||||
|
@ -264,7 +177,6 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
|
|
||||||
buildQueryParameters() {
|
buildQueryParameters() {
|
||||||
this.queryParameters = "";
|
this.queryParameters = "";
|
||||||
|
|
||||||
if (this.openaireSearchUtils.keyword) {
|
if (this.openaireSearchUtils.keyword) {
|
||||||
this.queryParameters = "q=" + StringUtils.URIEncode(this.openaireSearchUtils.keyword);
|
this.queryParameters = "q=" + StringUtils.URIEncode(this.openaireSearchUtils.keyword);
|
||||||
}
|
}
|
||||||
|
@ -276,24 +188,8 @@ export class AddContentProvidersComponent implements OnInit {
|
||||||
this._getOpenaireContentProviders(this.queryParameters, page, this.resultsPerPage);
|
this._getOpenaireContentProviders(this.queryParameters, page, this.resultsPerPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
back() {
|
handleError(message: string, error = null) {
|
||||||
this.toggleView.emit(null);
|
console.error(error);
|
||||||
}
|
NotificationHandler.rise(message, 'danger');
|
||||||
|
|
||||||
public onSearchClose() {
|
|
||||||
this.openaireSearchUtils.keyword = this.filterForm.get('keyword').value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public resetInput() {
|
|
||||||
this.openaireSearchUtils.keyword = null;
|
|
||||||
this.searchInputComponent.reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
handleError(message: string) {
|
|
||||||
UIkit.notification(message, {
|
|
||||||
status: 'danger',
|
|
||||||
timeout: 6000,
|
|
||||||
pos: 'bottom-right'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
|
import {Component, ElementRef, Input, OnInit, ViewChild} from '@angular/core';
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
import {RemoveContentProvidersComponent} from './remove-content-providers.component';
|
import {RemoveContentProvidersComponent} from './remove-content-providers.component';
|
||||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
|
||||||
import {Title} from '@angular/platform-browser';
|
import {Title} from '@angular/platform-browser';
|
||||||
import {
|
import {
|
||||||
FullScreenModalComponent
|
FullScreenModalComponent
|
||||||
|
@ -17,26 +15,12 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'manage-content-providers',
|
selector: 'manage-content-providers',
|
||||||
template: `
|
template: `
|
||||||
<remove-content-providers (toggleView)="toggleAction()" [communityContentProviders]="communityContentProviders"
|
<remove-content-providers #removeContentProvidersComponent (addContentProviders)="openAddContentProviders()" [communityContentProviders]="communityContentProviders"
|
||||||
[loading]="showLoadingInRemove" [community]="community"
|
[loading]="showLoadingInRemove" [community]="community" [disableAdd]="add.loading"
|
||||||
(communityContentProvidersChanged)="communityContentProvidersChanged($event)" [toggle]="toggle">
|
(communityContentProvidersChanged)="communityContentProvidersChanged($event)">
|
||||||
</remove-content-providers>
|
</remove-content-providers>
|
||||||
<fs-modal #fsModal (cancelEmitter)="toggleAction()">
|
<fs-modal #fsModal>
|
||||||
<div actions class="uk-flex uk-flex-middle uk-height-1-1">
|
<add-content-providers #add [communityContentProviders]="communityContentProviders" [community]="community"
|
||||||
<span class="uk-button uk-text-secondary" uk-icon="icon: info; ratio: 1.3"></span>
|
|
||||||
<div *ngIf="community" uk-drop="mode: hover">
|
|
||||||
<div class="uk-card uk-card-body uk-card-default">
|
|
||||||
If you cannot find a content provider 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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<add-content-providers [communityContentProviders]="communityContentProviders"
|
|
||||||
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers>
|
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers>
|
||||||
</fs-modal>
|
</fs-modal>
|
||||||
`
|
`
|
||||||
|
@ -46,7 +30,6 @@ export class ManageContentProvidersComponent implements OnInit {
|
||||||
@Input() communityContentProviders = [];
|
@Input() communityContentProviders = [];
|
||||||
@ViewChild(RemoveContentProvidersComponent) removeContentProvidersComponent: RemoveContentProvidersComponent;
|
@ViewChild(RemoveContentProvidersComponent) removeContentProvidersComponent: RemoveContentProvidersComponent;
|
||||||
@ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent;
|
@ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent;
|
||||||
public toggle: boolean = false;
|
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
public showLoadingInRemove: boolean = true;
|
public showLoadingInRemove: boolean = true;
|
||||||
public body: string = "Send from page";
|
public body: string = "Send from page";
|
||||||
|
@ -67,9 +50,6 @@ export class ManageContentProvidersComponent implements OnInit {
|
||||||
this.body = StringUtils.URIEncode(this.body);
|
this.body = StringUtils.URIEncode(this.body);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this.fullscreen.title = "Search and Add Content Providers";
|
|
||||||
this.fullscreen.okButtonText = "Done";
|
|
||||||
this.fullscreen.okButton = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnDestroy() {
|
public ngOnDestroy() {
|
||||||
|
@ -80,19 +60,19 @@ export class ManageContentProvidersComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public toggleAction() {
|
public openAddContentProviders() {
|
||||||
HelperFunctions.scroll();
|
this.fullscreen.title = "Search and Add Content Providers";
|
||||||
this.toggle = !this.toggle;
|
this.fullscreen.okButtonText = "Done";
|
||||||
if (this.toggle) {
|
this.fullscreen.back = true;
|
||||||
|
this.fullscreen.okButton = true;
|
||||||
this.fullscreen.open();
|
this.fullscreen.open();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public communityContentProvidersChanged($event) {
|
public communityContentProvidersChanged($event) {
|
||||||
this.communityContentProviders = $event.value;
|
this.communityContentProviders = $event.value;
|
||||||
this.showLoadingInRemove = false;
|
this.showLoadingInRemove = false;
|
||||||
|
|
||||||
if (this.toggle) {
|
if (this.fullscreen.isOpen) {
|
||||||
this.removeContentProvidersComponent.applyFilters();
|
this.removeContentProvidersComponent.applyFilters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="addNew()"
|
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="addNew()"
|
||||||
[attr.uk-tooltip]="(toggle? 'cls: uk-invisible; ' : 'cls: uk-active; ') +
|
[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>'"
|
'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>'"
|
||||||
[disabled]="loading" [class.uk-disabled]="loading">
|
[disabled]="loading || disableAdd" [class.uk-disabled]="loading || disableAdd">
|
||||||
<icon name="add" [flex]="true"></icon>
|
<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 content provider</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
|
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
|
||||||
<div *ngIf="loading" class="uk-margin-large-top">
|
<div *ngIf="loading" class="uk-position-center">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!loading">
|
<div *ngIf="!loading">
|
||||||
|
@ -87,8 +87,8 @@
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
<a (click)="removeContentProvider(item)"
|
<a (click)="removeContentProvider(item)"
|
||||||
class="uk-button uk-button-link uk-flex uk-flex-middle">
|
class="uk-button uk-button-link uk-flex uk-flex-middle">
|
||||||
<icon name="delete" [flex]="true"></icon>
|
<icon name="remove" [flex]="true"></icon>
|
||||||
<span class="uk-margin-small-left">Delete</span>
|
<span class="uk-margin-small-left">Remove</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
||||||
public previewCommunityContentProviders = [];
|
public previewCommunityContentProviders = [];
|
||||||
public errorCodes: ErrorCodes;
|
public errorCodes: ErrorCodes;
|
||||||
@Input() public loading: boolean = true;
|
@Input() public loading: boolean = true;
|
||||||
|
@Input() public disableAdd: boolean = false;
|
||||||
@Input() public community: CommunityInfo;
|
@Input() public community: CommunityInfo;
|
||||||
@Input() public communityContentProviders = [];
|
@Input() public communityContentProviders = [];
|
||||||
@Output() communityContentProvidersChanged = new EventEmitter();
|
@Output() communityContentProvidersChanged = new EventEmitter();
|
||||||
|
@ -47,7 +48,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
||||||
filterForm: FormGroup;
|
filterForm: FormGroup;
|
||||||
private searchText: RegExp = new RegExp('');
|
private searchText: RegExp = new RegExp('');
|
||||||
public keyword: string = '';
|
public keyword: string = '';
|
||||||
@Output() toggleView: EventEmitter<any> = new EventEmitter();
|
@Output() addContentProviders: EventEmitter<void> = new EventEmitter();
|
||||||
@Input() public toggle: boolean = true;
|
@Input() public toggle: boolean = true;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private _router: Router,
|
constructor(private route: ActivatedRoute, private _router: Router,
|
||||||
|
@ -164,7 +165,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
addNew() {
|
addNew() {
|
||||||
this.toggleView.emit(null);
|
this.addContentProviders.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public applyFilters() {
|
public applyFilters() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 318b3cdf42922d8b04400bb010733b78fcf1fe1c
|
Subproject commit 319eff1cc355ffc4148cf20c4ba23e15fbc6a6f6
|
|
@ -1 +1 @@
|
||||||
Subproject commit 25f7f7dd34fae80d1e2e25935c2f2772c5800e70
|
Subproject commit 35bca0f68bf19337413167ecf770f1027902964f
|
Loading…
Reference in New Issue