Merge remote-tracking branch 'origin/master' into new-theme

This commit is contained in:
Konstantinos Triantafyllou 2022-01-11 13:15:13 +02:00
commit 963c088bef
20 changed files with 895 additions and 541 deletions

View File

@ -4,20 +4,20 @@
<div *ngIf="!showLoading" class="uk-grid" uk-grid> <div *ngIf="!showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1"> <div class="uk-width-1-1">
<ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill uk-flex uk-flex-middle"> <ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill uk-flex uk-flex-middle">
<li *ngFor="let item of rootMenuItems; let i=index" [class.uk-active]="activeRootMenu==item['_id']" class="uk-visible-toggle uk-position-relative uk-padding-remove-horizontal"> <li *ngFor="let item of rootMenuItems; let i=index" [class.uk-active]="activeRootMenuId==item['_id']" class="uk-visible-toggle uk-position-relative uk-padding-remove-horizontal">
<span> <span>
<a (click)="filterForm.get('status').setValue('resources'); activeRootMenu=item['_id']"> <a (click)="changeActiveRootMenuItem(item)">
<span class="title">{{item.title}}</span> <span class="title">{{item.title}}</span>
</a> </a>
<span class="uk-invisible-hover uk-position-center-right color"> <span class="uk-invisible-hover uk-position-center-right color z-index-2">
<span class="clickable" uk-icon="more-vertical"></span> <span class="clickable" uk-icon="more-vertical"></span>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 10; delay-hide: 0; flip: false"> <div #element uk-dropdown="mode: click; pos: bottom-right; offset: 10; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav"> <ul class="uk-nav uk-dropdown-nav">
<li (click)="editRootMenu()"> <li (click)="editMenuItem(item, false)">
<a>Edit</a> <a>Edit</a>
</li> </li>
<hr class="uk-nav-divider"> <hr class="uk-nav-divider">
<li (click)="deleteRootMenu()"> <li (click)="confirmDeleteMenuItem(item._id, false)">
<a>Delete</a> <a>Delete</a>
</li> </li>
</ul> </ul>
@ -25,12 +25,12 @@
</span> </span>
</span> </span>
</li> </li>
<li (click)="newRootMenu()" class="uk-visible-toggle"> <li (click)="newMenuItem(false)" class="uk-visible-toggle">
<span class="clickable"> <span class="clickable">
<span class="uk-icon-button small portal-icon-button"> <span class="uk-icon-button small portal-icon-button">
<icon name="add"></icon> <icon name="add"></icon>
</span> </span>
<span class="space uk-hidden-hover"> <span class="space" [class.uk-hidden-hover]="rootMenuItems.length != 0">
Create new root menu Create new root menu
</span> </span>
</span> </span>
@ -44,7 +44,7 @@
[bordered]="true" colorClass="uk-text-secondary" [bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div> class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div> <div>
<a (click)="newMenuItem()" class="uk-flex uk-flex-middle uk-text-uppercase"> <a (click)="newMenuItem(true)" class="uk-flex uk-flex-middle uk-text-uppercase">
<button class="large uk-icon-button uk-button-secondary"> <button class="large uk-icon-button uk-button-secondary">
<icon name="add"></icon> <icon name="add"></icon>
</button> </button>
@ -54,60 +54,36 @@
</a> </a>
</div> </div>
</div> </div>
<!-- Not currently working -->
<div *ngIf="!showLoading && checkboxes.length > 0" class="uk-padding
uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom uk-display-inline"
[attr.uk-tooltip]="getSelectedMenuItems().length == 0 ? 'pos:left; cls: uk-active' : null"
title="Select at least one menu item">
<input id="checkAll" type="checkbox" (click)="selectAll()" [ngModel]="getSelectedMenuItems().length == checkboxes.length"/>
<span *ngIf="getSelectedMenuItems().length > 0" class="uk-margin-left uk-text-muted"> {{getSelectedMenuItems().length}} menu items selected </span>
<a class="uk-margin-left">Actions</a>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedMenuItems().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one page">
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedMenuItems().length == 0 ? 'uk-disabled' : ''"
(click)="toggleMenuItems(true,getSelectedMenuItems())"><i></i> Enable
</a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedMenuItems().length == 0 ? 'uk-disabled' : ''"
(click)="toggleMenuItems(false,getSelectedMenuItems())"><i></i> Disable
</a>
</li>
<li *ngIf="isPortalAdministrator"><a [class]="getSelectedMenuItems().length == 0 ? 'uk-disabled' : ''"
(click)="confirmDeleteSelectedMenuItems()"><i></i> Delete </a></li>
</ul>
</div>
</div>
</div> </div>
<div inner> <div inner>
<div *ngIf="showLoading" class="uk-position-center"> <div *ngIf="showLoading" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
<div *ngIf="!showLoading"> <div *ngIf="!showLoading">
<ul *ngIf='activeRootMenu' class="uk-list submenu-items"> <ul *ngIf='activeRootMenuId' class="uk-list submenu-items">
<li *ngFor="let child of getActiveRootItem(activeRootMenu).items" class="uk-card uk-card-default uk-margin-bottom"> <li *ngFor="let child of childrenMenuItems" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid> <div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5"> <div class="uk-width-4-5">
<div class="uk-grid uk-flex uk-flex-middle"> <div class="uk-grid uk-flex uk-flex-middle">
<div>
<input type="checkbox" id="" class="checkBox" name="" value="">
</div>
<div class="uk-width-expand uk-margin-medium-bottom"> <div class="uk-width-expand uk-margin-medium-bottom">
{{child.title}} {{child.title}}
</div> </div>
<div class="uk-grid uk-width-1-1 uk-margin-left"> <div *ngIf="child.url && child.type == 'external'" class="uk-grid uk-width-1-1 uk-margin-left">
Additional info <span class="title uk-padding-remove">URL: </span><a href="{{child.url}}" target="_blank" class="uk-padding-remove uk-margin-left">{{child.url}}</a>
</div>
<div *ngIf="child.route && child.type == 'internal'" class="uk-grid uk-width-1-1 uk-margin-left">
<span class="title uk-padding-remove">Route: </span><span class="uk-padding-remove uk-margin-left">{{child.route}}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="uk-width-1-5"> <div class="uk-width-1-5">
<div class="uk-flex uk-flex-center"> <div class="uk-flex uk-flex-center">
<div href="#" class="actions"> <div href="#" class="actions">
<div class="uk-button action uk-margin-top uk-flex uk-flex-middle" (click)="editMenuItem()"> <div class="uk-button action uk-margin-top uk-flex uk-flex-middle" (click)="editMenuItem(child, true)">
<i uk-icon="pencil" class="clickable uk-icon"></i> <i uk-icon="pencil" class="clickable uk-icon"></i>
<span class="uk-margin-small-left"> Edit</span> <span class="uk-margin-small-left"> Edit</span>
</div> </div>
<div class="uk-button action uk-margin-top uk-flex uk-flex-middle" (click)="deleteMenuItem()"> <div class="uk-button action uk-margin-top uk-flex uk-flex-middle" (click)="confirmDeleteMenuItem(child._id, true)">
<i uk-icon="trash" class="clickable uk-icon"></i> <i uk-icon="trash" class="clickable uk-icon"></i>
<span class="uk-margin-small-left"> Delete</span> <span class="uk-margin-small-left"> Delete</span>
</div> </div>
@ -117,15 +93,20 @@
</div> </div>
</li> </li>
</ul> </ul>
<div *ngIf="childrenMenuItems.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No menu items found</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<modal-alert #editModal [okDisabled]="menuItemForm && (menuItemForm.invalid || !menuItemForm.dirty)"> <modal-alert #editModal (alertOutput)="menuItemSaveConfirmed($event)"
[okDisabled]="menuItemForm && (menuItemForm.invalid || !menuItemForm.dirty)">
<form *ngIf="menuItemForm" [formGroup]="menuItemForm" class="uk grid uk-child-width-1-1" uk-grid> <form *ngIf="menuItemForm" [formGroup]="menuItemForm" class="uk grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="menuItemForm.get('title')" type="text" label="Name" placeholder="Write a name"></div> <div dashboard-input [formInput]="menuItemForm.get('title')" type="text" label="Name" placeholder="Write a name"></div>
<div dashboard-input [formInput]="menuItemForm.get('type')" type="select" label="Type" placeholder="Choose a type" [options]="typeOptions"></div> <div dashboard-input [formInput]="menuItemForm.get('type')" type="select" label="Type" placeholder="Choose a type" [options]="getTypeOptions()"></div>
<!-- Workflow for EXTERNAL --> <!-- Workflow for EXTERNAL -->
<div dashboard-input *ngIf="menuItemForm.get('type').value === 'external'" [formInput]="menuItemForm.get('url')" type="URL" label="URL" placeholder="Write a URL"></div> <div dashboard-input *ngIf="menuItemForm.get('type').value === 'external'" [formInput]="menuItemForm.get('url')" type="URL" label="URL *" placeholder="Write a URL"></div>
<!-- Workflow for INTERNAL --> <!-- Workflow for INTERNAL -->
<div *ngIf="menuItemForm.get('type').value === 'internal'"> <div *ngIf="menuItemForm.get('type').value === 'internal'">
<div class="uk-text-center">Select one of the pages</div> <div class="uk-text-center">Select one of the pages</div>
@ -137,20 +118,22 @@
<button (click)="newPageWindow()" class="uk-close uk-icon uk-float-right" uk-close></button> <button (click)="newPageWindow()" class="uk-close uk-icon uk-float-right" uk-close></button>
<h6 class="uk-text-bold uk-margin-remove-top">Create New Page</h6> <h6 class="uk-text-bold uk-margin-remove-top">Create New Page</h6>
</div> </div>
<form *ngIf="menuItemForm" [formGroup]="menuItemForm" class="uk grid uk-child-width-1-1" uk-grid> <form *ngIf="pageForm" [formGroup]="pageForm" class="uk grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="menuItemForm.get('title')" type="text" label="Name" placeholder="Write a name"></div> <div dashboard-input [formInput]="pageForm.get('name')" type="text" label="Name" placeholder="Write a name"></div>
<div dashboard-input [formInput]="menuItemForm.get('title')" type="text" label="Route" placeholder="Write a route"></div> <div dashboard-input [formInput]="pageForm.get('route')" type="text" label="Route" placeholder="Write a route"></div>
<div> <!-- <div>
<div class="uk-text-bold uk-form-label uk-margin-small-bottom">Enable/disable</div> <div class="uk-text-bold uk-form-label uk-margin-small-bottom">Enable/disable</div>
<mat-slide-toggle <mat-slide-toggle [checked]="pageForm.get('isEnabled')"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable a page to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If the page is disabled, a message 'Can't find that page' will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.</div></div>"> uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable a page to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If the page is disabled, a message 'Can't find that page' will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.</div></div>">
</mat-slide-toggle> </mat-slide-toggle>
</div> </div> -->
<div class="uk-flex uk-flex-right"> <div class="uk-flex uk-flex-right">
<button class="uk-button uk-button-default">Create Page</button> <button class="uk-button uk-button-default" (click)="createPage()">Create Page</button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</form> </form>
</modal-alert> </modal-alert>
<modal-alert #deleteModal (alertOutput)="confirmedDeleteMenuItem($event)"></modal-alert>

View File

@ -6,55 +6,69 @@ import {Portal} from '../../utils/entities/adminTool/portal';
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {Session} from '../../login/utils/helper.class'; import {Session} from '../../login/utils/helper.class';
import {UserManagementService} from '../../services/user-management.service'; import {UserManagementService} from '../../services/user-management.service';
import {Subscriber} from "rxjs"; import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
import {Title} from "@angular/platform-browser"; import {Title} from "@angular/platform-browser";
import {AlertModal} from '../../utils/modal/alert'; import {AlertModal} from '../../utils/modal/alert';
import {CheckMenuItem, MenuItem} from '../../sharedComponents/menu'; import {MenuItem} from '../../sharedComponents/menu';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {Page} from '../../utils/entities/adminTool/page';
import {Option} from '../../sharedComponents/input/input.component';
declare var UIkit;
@Component({ @Component({
selector: 'menuSelector', selector: 'menuSelector',
templateUrl: './menu.component.html', templateUrl: './menu.component.html',
styles: [`
.z-index-2 {
z-index: 2;
}
`]
}) })
export class MenuComponent implements OnInit { export class MenuComponent implements OnInit {
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
@ViewChild('editModal') editModal: AlertModal; @ViewChild('editModal') editModal: AlertModal;
@ViewChild('deleteModal') deleteModal: AlertModal; @ViewChild('deleteModal') deleteModal: AlertModal;
private selectedMenuItems: string[] = [];
public checkboxes: CheckMenuItem[] = []; public activeRootMenuId: string;
public activeRootMenu: MenuItem;
// public menuItems: MenuItem[] = []; public childrenMenuItems: MenuItem[] = [];
private index: number;
// public rootMenuForm: FormGroup;
public activeRootMenu: string;
public menuItemForm: FormGroup; public menuItemForm: FormGroup;
public pageForm: FormGroup;
public rootMenuItems = []; public rootMenuItems = [];
public menuItems = []; public menuItems = [];
public allPages = []; public allPages = [];
public keyword = ''; public selectedMenuItem: string;
public isChild: boolean = false;
public communities: Portal[] = []; public communities: Portal[] = [];
public portal: string; public portal: string;
public properties: EnvProperties = properties;
public newPageWindowOpen: boolean = false; public newPageWindowOpen: boolean = false;
public showLoading = true; public showLoading = true;
public isPortalAdministrator = null; public isPortalAdministrator = null;
public filterForm: FormGroup; public filterForm: FormGroup;
public typeOptions = [ public typeOptions: Option[] = [
{label: 'Internal Link', value: 'internal'}, {label: 'Internal Link', value: 'internal'},
{label: 'External Link', value: 'external'} {label: 'External Link', value: 'external'},
] ]
public selectedKeyword: string; public rootOnlyTypeOptions: Option[] = [
{label: 'No Action', value: 'noAction'}
]
public keyword: string = '';
public selectedKeyword: string = '';
private searchText: string = '';
public properties: EnvProperties = properties;
private subscriptions: any[] = []; private subscriptions: any[] = [];
private typeSub: Subscription = null;
constructor(private element: ElementRef, private route: ActivatedRoute, constructor(private element: ElementRef, private route: ActivatedRoute,
private _router: Router, private title: Title, private _router: Router, private title: Title,
@ -65,8 +79,11 @@ export class MenuComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.filterForm = this._fb.group({ this.filterForm = this._fb.group({
keyword: [''], keyword: [''],
status: ['resources', Validators.required]
}); });
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => {
this.searchText = value.toLowerCase();
this.applyFilters();
}));
this.userManagementService.getUserInfo().subscribe(user => { this.userManagementService.getUserInfo().subscribe(user => {
this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
if (this.route.snapshot.data.portal) { if (this.route.snapshot.data.portal) {
@ -91,17 +108,23 @@ export class MenuComponent implements OnInit {
value(); value();
} }
}); });
this.destroyTypeSubscription();
} }
destroyTypeSubscription() {
if(this.typeSub instanceof Subscriber) {
this.typeSub.unsubscribe();
}
}
getMenuItems() { getMenuItems() {
this.subscriptions.push( this.subscriptions.push(
this._helpContentService.getMenuItems(this.portal).subscribe( this._helpContentService.getMenuItems(this.portal).subscribe(
data => { data => {
console.log(data);
this.rootMenuItems = data; this.rootMenuItems = data;
if(data && data.length > 0) { if(data && data.length > 0) {
this.activeRootMenu = data[0]['_id']; // this.activeRootMenuId = data[0]['_id'];
console.log(this.activeRootMenu); this.changeActiveRootMenuItem(data[0]);
} }
}, },
err => console.error("Server error fetching menu items: ", err) err => console.error("Server error fetching menu items: ", err)
@ -109,10 +132,25 @@ export class MenuComponent implements OnInit {
); );
} }
getTypeOptions() {
if(this.isChild) {
return this.typeOptions;
} else {
return this.typeOptions.concat(this.rootOnlyTypeOptions);
}
}
getActiveRootItem(id: string): MenuItem { getActiveRootItem(id: string): MenuItem {
return this.rootMenuItems.find(element => element['_id'] == id); return this.rootMenuItems.find(element => element['_id'] == id);
} }
changeActiveRootMenuItem(item: MenuItem) {
this.activeRootMenuId = item['_id']
this.activeRootMenu = item;
this.childrenMenuItems = item.items;
this.applyFilters();
}
getPages() { getPages() {
this.subscriptions.push( this.subscriptions.push(
this._helpContentService.getAllPages(this.properties.adminToolsAPIURL,this.portal).subscribe( this._helpContentService.getAllPages(this.properties.adminToolsAPIURL,this.portal).subscribe(
@ -130,82 +168,137 @@ export class MenuComponent implements OnInit {
); );
} }
public newRootMenu() { public newPageWindow() {
this.newPageWindowOpen = !this.newPageWindowOpen;
this.pageForm = this._fb.group({
_id: this._fb.control(null),
route: this._fb.control('', Validators.required),
name: this._fb.control('', Validators.required),
isEnabled: this._fb.control(true),
portalType: this._fb.control(this.properties.adminToolsPortalType, Validators.required),
portalPid: this._fb.control(this.portal),
top: this._fb.control(true),
bottom: this._fb.control(false),
left: this._fb.control(false),
right: this._fb.control(false),
type: this._fb.control('html', Validators.required),
entities: this._fb.control([''])
});
}
public createPage() {
if(!this.pageForm.value.route.startsWith('/')) {
this.pageForm.value.route = '/'.concat(this.pageForm.value.route);
}
this.showLoading = true;
this.subscriptions.push(
this._helpContentService.savePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe(
page => {
this.allPages.push({value: page.route, label: page.name});
UIkit.notification('Page <b>' + page.name + '</b> has been <b>successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
this.newPageWindowOpen = !this.newPageWindowOpen;
this.menuItemForm.get('route').setValue(page.route);
}
)
);
}
addValidatorForUrlOrRoute() {
this.destroyTypeSubscription();
this.typeSub = this.menuItemForm.get('type').valueChanges.subscribe(value => {
setTimeout(() => {
// console.log(value);
if(value === "internal") {
this.menuItemForm.controls['route'].setValidators([Validators.required]);
this.menuItemForm.controls['route'].updateValueAndValidity();
} else if(value === "external") {
this.menuItemForm.controls['url'].setValidators([Validators.required]);
this.menuItemForm.controls['url'].updateValueAndValidity();
}
}, 0);
});
}
public newMenuItem(isChild: boolean = false) {
this.menuItemForm = this._fb.group({ this.menuItemForm = this._fb.group({
id: this._fb.control(""), _id: this._fb.control(""),
title: this._fb.control("",Validators.required), title: this._fb.control("",Validators.required),
type: this._fb.control(""), type: this._fb.control("",Validators.required),
route: this._fb.control(""), route: this._fb.control(""),
url: this._fb.control(""), url: this._fb.control(""),
isEnabled: this._fb.control(""), isEnabled: this._fb.control(""),
parentItemId: this._fb.control(isChild ? this.activeRootMenuId : null)
}); });
this.menuItemsModalOpen('Create Root Menu', 'Save Changes'); this.isChild = isChild;
this.addValidatorForUrlOrRoute();
this.menuItemsModalOpen('Create Menu Item', 'Create');
} }
public editRootMenu() { public editMenuItem(menuItem: MenuItem, isChild: boolean = false) {
this.menuItemForm = this._fb.group({ this.menuItemForm = this._fb.group({
id: this._fb.control("id"), _id: this._fb.control(menuItem['_id']),
title: this._fb.control("Resources",Validators.required), title: this._fb.control(menuItem.title,Validators.required),
type: this._fb.control("",Validators.required), type: this._fb.control(menuItem['type'],Validators.required),
route: this._fb.control("noNeed"), route: this._fb.control(menuItem.route),
url: this._fb.control("noNeed"), url: this._fb.control(menuItem.url),
isEnabled: this._fb.control("enabled",Validators.required), parentItemId: this._fb.control(menuItem['parentItemId'])
}); });
this.menuItemsModalOpen('Edit Root Menu', 'Save Changes'); this.isChild = isChild;
if(this.isChild) {
this.index = this.getActiveRootItem(this.activeRootMenuId).items.findIndex(value => value._id === menuItem['_id']);
} else {
this.index = this.rootMenuItems.findIndex(value => value._id === menuItem['_id']);
}
this.addValidatorForUrlOrRoute();
this.menuItemsModalOpen('Edit Menu Item', 'Save Changes');
} }
public deleteRootMenu() { public confirmDeleteMenuItem(id: string, isChild: boolean = false) {
console.log('Delete root menu'); this.selectedMenuItem = id;
this.isChild = isChild;
this.confirmModalOpen();
} }
public getSelectedMenuItems(): string[] {
return this.checkboxes.filter(menuItem => menuItem.checked == true).map(checkedMenuItem => checkedMenuItem.menuItem).map(res => res.id);
}
public confirmDeleteSelectedMenuItems() {
this.selectedMenuItems = this.getSelectedMenuItems();
this.confirmModalOpen();
}
private confirmModalOpen() { private confirmModalOpen() {
this.deleteModal.cancelButton = true; this.deleteModal.cancelButton = true;
this.deleteModal.okButton = true; this.deleteModal.okButton = true;
this.deleteModal.alertTitle = 'Delete Confirmation'; this.deleteModal.alertTitle = 'Delete Confirmation';
this.deleteModal.message = 'Are you sure you want to delete the selected menu item(s)?'; this.deleteModal.message = 'Are you sure you want to delete this menu item?';
this.deleteModal.okButtonText = 'Yes'; this.deleteModal.okButtonText = 'Yes';
this.deleteModal.open(); this.deleteModal.open();
} }
public newMenuItem() { public confirmedDeleteMenuItem(data: any, isChild: boolean = false) {
this.menuItemForm = this._fb.group({ this.showLoading = true;
id: this._fb.control(""), this.subscriptions.push(
title: this._fb.control("",Validators.required), this._helpContentService.deleteMenuItem(this.selectedMenuItem, this.portal).subscribe(
type: this._fb.control("",Validators.required), _ => {
route: this._fb.control(""), this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild);
url: this._fb.control(""), UIkit.notification('Menu item have been <b>successfully deleted</b>', {
isEnabled: this._fb.control("",Validators.required), status: 'success',
}); timeout: 6000,
this.menuItemsModalOpen('Create Menu Item', 'Save Changes'); pos: 'bottom-right'
} });
this.showLoading = false;
public editMenuItem() { }
this.menuItemForm = this._fb.group({ )
id: this._fb.control("id"), )
title: this._fb.control("HardcodedName",Validators.required),
type: this._fb.control("internal",Validators.required),
route: this._fb.control("routeAlex"),
url: this._fb.control("urlAlex"),
isEnabled: this._fb.control("enabled",Validators.required),
});
this.menuItemsModalOpen('Edit Menu Item', 'Save Changes');
} }
public deleteMenuItem() { private deleteMenuItemFromArray(id: string, isChild: boolean = false) {
console.log('Delete menu item'); if(isChild) {
} let i = this.getActiveRootItem(this.activeRootMenuId).items.findIndex(_ => _._id == id);
this.getActiveRootItem(this.activeRootMenuId).items.splice(i, 1);
public newPageWindow() { } else {
this.newPageWindowOpen = !this.newPageWindowOpen; let i = this.rootMenuItems.findIndex(_ => _._id == id);
this.rootMenuItems.splice(i, 1);
this.changeActiveRootMenuItem(this.rootMenuItems[0]);
}
this.applyFilters();
} }
private menuItemsModalOpen(title: string, yesBtn: string) { private menuItemsModalOpen(title: string, yesBtn: string) {
@ -217,8 +310,58 @@ export class MenuComponent implements OnInit {
this.editModal.open(); this.editModal.open();
} }
public toggleMenuItems(status: boolean, ids: string[]) { public menuItemSaveConfirmed(data: any) {
this.destroyTypeSubscription();
this.showLoading = true;
if(!this.menuItemForm.value._id) {
this.subscriptions.push(
this._helpContentService.saveMenuItem(<MenuItem>this.menuItemForm.value, this.portal).subscribe(
menuItem => {
this.menuItemSavedSuccessfully(menuItem, true);
UIkit.notification('Menu item <b>' + menuItem.title + '</b> has been <b>successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
}
)
)
} else {
this.subscriptions.push(
this._helpContentService.updateMenuItem(<MenuItem>this.menuItemForm.value, this.portal).subscribe(
menuItem => {
this.menuItemSavedSuccessfully(menuItem, false);
UIkit.notification('Menu item <b>' + menuItem.title + '</b> has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
}
)
)
}
}
public menuItemSavedSuccessfully(menuItem: MenuItem, isNew: boolean) {
if(isNew) {
if(this.isChild) {
this.getActiveRootItem(this.activeRootMenuId).items.push(menuItem);
} else {
this.rootMenuItems.push(menuItem);
}
} else {
if(this.isChild) {
this.getActiveRootItem(this.activeRootMenuId).items[this.index] = menuItem;
} else {
this.rootMenuItems[this.index] = menuItem;
}
}
this.applyFilters();
this.showLoading = false;
}
public applyFilters() {
this.childrenMenuItems = this.activeRootMenu.items.filter(item => item.title.toLowerCase().includes(this.searchText));
} }
public onSearchClose() { public onSearchClose() {
@ -229,11 +372,4 @@ export class MenuComponent implements OnInit {
this.selectedKeyword = null; this.selectedKeyword = null;
this.searchInputComponent.reset(); this.searchInputComponent.reset();
} }
selectAll() {
let checked = this.getSelectedMenuItems().length != this.checkboxes.length;
for (let check of this.checkboxes) {
check.checked = checked;
}
}
} }

View File

@ -80,7 +80,7 @@
<span class="title">Portal type: </span>{{check.page.portalType}} <span class="title">Portal type: </span>{{check.page.portalType}}
</div> </div>
</div> </div>
<div *ngIf="isPortalAdministrator" class="uk-width-1-4"> <div *ngIf="isPortalAdministrator || (check.page.portalType == properties.adminToolsPortalType && check.page.portalPid == portal)" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Actions</div> <div class="title uk-margin-medium-bottom">Actions</div>
<div class="actions" href="#"> <div class="actions" href="#">
<i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i> <i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i>
@ -136,39 +136,42 @@
type="text" placeholder="Write a name" type="text" placeholder="Write a name"
label="Page Name"> label="Page Name">
</div> </div>
<div dashboard-input [formInput]="pageForm.get('type')" <ng-template [ngIf]="isPortalAdministrator">
type="select" placeholder="Choose a page Type" <div dashboard-input [formInput]="pageForm.get('type')"
label="Type" [options]="typeOptions"> type="select" placeholder="Choose a page Type"
</div> label="Type" [options]="typeOptions">
<div dashboard-input [formInput]="pageForm.get('entities')" placeholder="Add an entity" </div>
type="chips" [options]="allEntities" label="Entities"> <div dashboard-input [formInput]="pageForm.get('entities')" placeholder="Add an entity"
</div> type="chips" [options]="allEntities" label="Entities">
<div dashboard-input type="select" label="Portal Type" placeholder="Choose a type" </div>
[formInput]="pageForm.get('portalType')" [options]="portalUtils.portalTypes"></div> <div dashboard-input type="select" label="Portal Type" placeholder="Choose a type"
<div class="form-group"> [formInput]="pageForm.get('portalType')" [options]="portalUtils.portalTypes">
<div class="uk-form-label uk-text-bold uk-margin-small-bottom"> Select if this page have helptext at:</div> </div>
<div class="uk-grid uk-grid-small uk-child-width-1-4" uk-grid> <div class="form-group">
<div dashboard-input [formInput]="pageForm.get('top')" <div class="uk-form-label uk-text-bold uk-margin-small-bottom"> Select if this page have helptext at:</div>
type="checkbox" <div class="uk-grid uk-grid-small uk-child-width-1-4" uk-grid>
label="Top"> <div dashboard-input [formInput]="pageForm.get('top')"
</div> type="checkbox"
<div dashboard-input [formInput]="pageForm.get('right')" label="Top">
type="checkbox" </div>
label="Right"> <div dashboard-input [formInput]="pageForm.get('right')"
</div> type="checkbox"
<div dashboard-input [formInput]="pageForm.get('bottom')" label="Right">
type="checkbox" </div>
label="Bottom"> <div dashboard-input [formInput]="pageForm.get('bottom')"
</div> type="checkbox"
<div dashboard-input [formInput]="pageForm.get('left')" label="Bottom">
type="checkbox" </div>
label="Left"> <div dashboard-input [formInput]="pageForm.get('left')"
</div> type="checkbox"
</div> label="Left">
<label class="uk-text-danger"> </div>
By disabling a position, all contents in this position will be deleted. </div>
</label> <label class="uk-text-danger">
</div> By disabling a position, all contents in this position will be deleted.
</label>
</div>
</ng-template>
</form> </form>
</modal-alert> </modal-alert>

View File

@ -246,6 +246,7 @@ export class PagesComponent implements OnInit {
name: this._fb.control(page.name, Validators.required), name: this._fb.control(page.name, Validators.required),
isEnabled: this._fb.control(page.isEnabled), isEnabled: this._fb.control(page.isEnabled),
portalType: this._fb.control(page.portalType, Validators.required), portalType: this._fb.control(page.portalType, Validators.required),
portalPid: this._fb.control(page.portalPid),
top: this._fb.control(page.top), top: this._fb.control(page.top),
bottom: this._fb.control(page.bottom), bottom: this._fb.control(page.bottom),
left: this._fb.control(page.left), left: this._fb.control(page.left),
@ -271,6 +272,7 @@ export class PagesComponent implements OnInit {
name: this._fb.control('', Validators.required), name: this._fb.control('', Validators.required),
isEnabled: this._fb.control(true), isEnabled: this._fb.control(true),
portalType: this._fb.control('', Validators.required), portalType: this._fb.control('', Validators.required),
portalPid: this._fb.control(null),
top: this._fb.control(true), top: this._fb.control(true),
bottom: this._fb.control(true), bottom: this._fb.control(true),
left: this._fb.control(true), left: this._fb.control(true),

View File

@ -34,8 +34,8 @@ export class SideBarComponent implements OnInit {
isTheActiveMenuItem(item: MenuItem, subItem: MenuItem = null): boolean { isTheActiveMenuItem(item: MenuItem, subItem: MenuItem = null): boolean {
if (this.activeItem || this.activeSubItem) { if (this.activeItem || this.activeSubItem) {
return (!subItem && this.activeItem === item.id) || return (!subItem && this.activeItem === item._id) ||
(subItem && this.activeItem === item.id && this.activeSubItem === subItem.id); (subItem && this.activeItem === item._id && this.activeSubItem === subItem._id);
} else { } else {
if (subItem) { if (subItem) {
return MenuItem.isTheActiveMenu(subItem, this.router.url.split('?')[0]) || MenuItem.isTheActiveMenu(subItem, this.router.url.split('#')[0]); return MenuItem.isTheActiveMenu(subItem, this.router.url.split('?')[0]) || MenuItem.isTheActiveMenu(subItem, this.router.url.split('#')[0]);

View File

@ -1,44 +1,33 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview"; import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
@Component({ @Component({
selector: 'availableOn', selector: 'availableOn',
template: ` template: `
<div class="download-from uk-height-max-large uk-overflow-auto uk-margin-small-bottom"> <div *ngIf="availableOn" class="download-from uk-height-max-large uk-overflow-auto uk-margin-small-bottom">
<div *ngFor="let available of availableOn.slice(0, showNum) let i=index" <div *ngFor="let instance of availableOn.slice(0, showNum) let i=index"
class="uk-flex uk-flex-top" class="uk-flex uk-flex-top"
[title]="available.bestAccessMode ? available.bestAccessMode : 'Not available'"> [title]="instance.accessRight ? instance.accessRight : 'Not available'">
<span class="uk-margin-small-right"> <span class="uk-margin-small-right">
<img [src]="available.icon" loading="lazy" [alt]="available.bestAccessMode" style="width:20px; height:20px"> <img [src]="instance.accessRightIcon" loading="lazy" [alt]="instance.accessRight" style="width:20px; height:20px">
</span> </span>
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical"> <div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
<span *ngIf="available.downloadUrl.length > 1" class="title"> <a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank"
<span>{{available.downloadName}}</span>
<a *ngFor="let url of available.downloadUrl; let i=index;"
[href]="url" target="_blank">
[{{(i + 1) | number}}]
</a>
</span>
<a *ngIf="available.downloadUrl.length === 1" [href]="available.downloadUrl[0]" target="_blank"
class="title"> class="title">
{{available.downloadName}} {{instance.downloadNames.join("; ")}}
<span class="custom-external custom-icon space"></span> <span class="custom-external custom-icon space"></span>
</a> </a>
<span *ngIf="!available.downloadUrl || available.downloadUrl.length === 0" class="title"> <div *ngIf="instance.types?.length > 0 || instance.years?.length > 0">
{{available.downloadName}} <span *ngIf="instance.types?.length > 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}</span>
</span> <span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span>
<div *ngIf="removeUnknown(available.type) || available.year"> <span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span>
<span *ngIf="removeUnknown(available.type)" class="uk-text-capitalize">{{available.type}}</span>
<span *ngIf="removeUnknown(available.type) && available.year"> . </span>
<span *ngIf="available.year">{{available.year}}</span>
</div> </div>
<div *ngIf="available.collectedName"> <div *ngIf="instance.collectedNamesAndIds?.size > 0">
<span>Provider: </span> <span>Providers: </span>
<a *ngIf="available.collectedId" [routerLink]="dataProviderUrl" <a *ngFor="let collectedName of instance.collectedNamesAndIds.keys(); let i=index" [routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: available.collectedId}"> [queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}">
{{available.collectedName}} {{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
</a> </a>
</div> </div>
</div> </div>

View File

@ -158,31 +158,23 @@ export class ParsingFunctions {
hostedBy_collectedFrom = []; hostedBy_collectedFrom = [];
} }
let available: HostedByCollectedFrom = { let available: HostedByCollectedFrom = {
downloadName: "", downloadNames: [],
downloadUrl: null, downloadUrl: "",
collectedName: "", collectedNamesAndIds: null,
collectedId: "", accessRight: "",
accessMode: null, types: [],
bestAccessMode: null, years: [],
type: "", accessRightIcon: ""
year: "",
icon: ""
}; };
if (journal && journal.journal) {
available.downloadName = publisher + "/ " + journal['journal'];
} else {
available.downloadName = publisher;
}
let url = properties.doiURL + identifiers.get("doi")[0];
available.downloadUrl = new Array<string>();
available.accessMode = new Array<string>();
available.downloadUrl.push(url);
available.icon = this.unknown; if (journal && journal.journal) {
available.downloadNames.push(publisher + "/ " + journal['journal']);
} else {
available.downloadNames.push(publisher);
}
available.downloadUrl = properties.doiURL + identifiers.get("doi")[0];;
available.accessRightIcon = this.unknown;
/* /*
if(title != undefined && title['url'] == "") { if(title != undefined && title['url'] == "") {
title['url'] = url; title['url'] = url;
@ -253,116 +245,105 @@ export class ParsingFunctions {
mapStructure.get(key)['accessMode'].push(""); mapStructure.get(key)['accessMode'].push("");
} }
} }
parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[], parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
instance: any, data: any, url: string, counter: number/*, instance: any, url: string, globalAccessRight: string) {
title: { "name": string, "url": string, "accessMode": string}*/, accessMode: string): number { if(!url) {
let available: HostedByCollectedFrom = { return;
"downloadName": "",
"downloadUrl": null,
"collectedName": "",
"collectedId": "",
"accessMode": null,
"bestAccessMode": null,
"type": "",
"year": "",
"icon": ""
};
if (instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
available.downloadName = instance['hostedby'].name;
} else {
// if (data != null && data.hasOwnProperty("source")) {
// let downloadName: string;
// if (Array.isArray(data.source)) {
//
// if (counter == data.source.length) {
// counter--;
// }
// downloadName = data['source'][counter];
// } else {
// downloadName = data['source'];
// }
// if (downloadName) {
// counter++;
// available.downloadName = downloadName;
// }
// }
//
// }
//
// if(!available.downloadName) {
available.downloadName = url.substring(0, 30) + '...'; // substring(from, to);
} }
if (available.downloadName) { let available: HostedByCollectedFrom = {
if (instance.hasOwnProperty("collectedfrom")) { "downloadNames": [],
available.collectedId = instance['collectedfrom'].id; "downloadUrl": null,
available.collectedName = instance['collectedfrom'].name; "collectedNamesAndIds": new Map(),
} "accessRight": null,
"accessRightIcon": "",
if (instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { "types": [],
available.type = instance['instancetype'].classname; "years": []
} };
if (instance.hasOwnProperty("dateofacceptance")) { if (instance.hasOwnProperty("hostedby")) {
var date: string = (instance.dateofacceptance) + ""; // transform to string in case it is an integer let downloadNames: Set<string> = new Set();
available.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1;
} for (let i = 0; i < length; i++) {
let hostedBy = Array.isArray(instance['hostedby']) ? instance['hostedby'][i] : instance['hostedby'];
available.accessMode = new Array<string>(); if (hostedBy.name && hostedBy.name != "other resources" && hostedBy.name != "Unknown Repository") {
available.downloadUrl = new Array<string>(); downloadNames.add(hostedBy.name);
available['downloadUrl'].push(url);
if(url.includes("doi.org/")) {
this.instanceWithDoiExists = true;
}
if (instance.hasOwnProperty("accessright")) {
if (url) {
available['accessMode'].push(instance['accessright'].classname);
} }
}
if (this.changeBestAccessMode(available.bestAccessMode, instance['accessright'])) { available.downloadNames = Array.from(downloadNames);
available.bestAccessMode = instance['accessright'].classname;
/* if (available.downloadNames.length == 0) {
if(title != undefined) { available.downloadNames.push(url.substring(0, 30) + '...'); // substring(from, to);
if(this.changeBestAccessMode(title['accessMode'], instance['accessright'])) { }
title['accessMode'] = instance['accessright'].classid; }
title['url'] = url;
} if (instance.hasOwnProperty("collectedfrom")) {
} let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
*/ for (let i = 0; i < length; i++) {
if (this.changeBestAccessMode(accessMode, instance['accessright'])) { let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
accessMode = instance['accessright'].classname; if(collectedFrom.name && collectedFrom.id) {
available.collectedNamesAndIds.set(collectedFrom.name, collectedFrom.id);
}
}
}
if (instance.hasOwnProperty("instancetype")) {
let types: Set<string> = new Set();
let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
for (let i = 0; i < length; i++) {
let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype'];
if(instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") {
types.add(instanceType.classname);
}
}
available.types = Array.from(types);
}
if (instance.hasOwnProperty("dateofacceptance")) {
let years: Set<string> = new Set();
let length = Array.isArray(instance['dateofacceptance']) ? instance['dateofacceptance'].length : 1;
for (let i = 0; i < length; i++) {
let dateOfAcceptance = Array.isArray(instance['dateofacceptance']) ? instance['dateofacceptance'][i] : instance['dateofacceptance'];
let date: string = (dateOfAcceptance) + ""; // transform to string in case it is an integer
years.add((date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date);
}
available.years = Array.from(years);
}
available['downloadUrl'] = url;
if(url.includes("doi.org/")) {
this.instanceWithDoiExists = true;
}
if (instance.hasOwnProperty("accessright")) {
let length = Array.isArray(instance['accessright']) ? instance['accessright'].length : 1;
for (let i = 0; i < length; i++) {
let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
if (this.changeBestAccessMode(available.accessRight, accessRight)) {
available.accessRight = accessRight.classname;
if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
globalAccessRight = accessRight.classname;
} }
} }
/*
if(title != undefined) {
if(!title['url']) {
title['url'] = url;
}
}
*/
} else if (url) {
available['accessMode'].push("");
} }
if (available.bestAccessMode) {
if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) {
available.icon = this.open;
} else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) {
available.icon = this.unknown;
} else {
available.icon = this.closed;
}
} else {
available.icon = this.unknown;
}
hostedBy_collectedFrom.push(available);
} }
return counter; if (available.accessRight) {
if (available.accessRight.toLowerCase().indexOf('open') !== -1) {
available.accessRightIcon = this.open;
} else if (available.accessRight.toLowerCase().indexOf('not available') !== -1) {
available.accessRightIcon = this.unknown;
} else {
available.accessRightIcon = this.closed;
}
} else {
available.accessRightIcon = this.unknown;
}
hostedBy_collectedFrom.push(available);
} }
// publication & dataset landing : for downloadFrom and publishedIn // publication & dataset landing : for downloadFrom and publishedIn
@ -444,7 +425,69 @@ export class ParsingFunctions {
similarResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "similarity")); similarResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "similarity"));
return similarResearchResults; return similarResearchResults;
} }
parseResults(researchResults: RelationResult[], relation, provenanceAction: string): RelationResult[] {
if (researchResults == undefined) {
researchResults = [];
}
let researchResult: RelationResult = {
name: "",
id: "",
date: "",
percentage: null,
percentageName: null,
class: "",
provenanceAction: provenanceAction,
relationName: ""
};
researchResult.relationName = relation.to.class;
if(relation['resulttype']) {
if (relation['resulttype'].classname == "publication") {
researchResult['class'] = "publication";
} else if (relation['resulttype'].classname == "dataset") {
researchResult['class'] = "dataset";
} else if (relation['resulttype'].classname == "software") {
researchResult['class'] = "software";
} else if (relation['resulttype'].classname == "other") {
researchResult['class'] = "other";
}
}
researchResult['id'] = relation['to'].content;
let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : (relation['title']?relation['title'].content:null);
researchResult['name'] = titleName;
if(!researchResult['name']) {
researchResult['name'] = "[no title available]";
}
if (relation.hasOwnProperty("dateofacceptance")) {
var date: string = ((Array.isArray(relation.dateofacceptance)) ? (relation.dateofacceptance[0]) : (relation.dateofacceptance)) + ""; // transform to string in case it is an integer
researchResult['date'] = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
}
//researchResult['date'] = relation.dateofacceptance.substring(0,4);;
let percentageName: string;
if(relation.trust) {
percentageName = "trust";
} else if(relation.similarity) {
percentageName = "similarity";
}
if(percentageName) {
researchResult['percentage'] = Math.round(relation[percentageName] * 100);
researchResult['percentageName'] = percentageName;
}
researchResults.push(researchResult);
return researchResults;
}
parseResearchResults(researchResults: RelationResult[], relation: any, percentageName: string = "trust"): RelationResult[] {
if (researchResults == undefined) {
researchResults = [];
}
researchResults.push(this.parseRelatedOrSimilarResearchResult(relation, percentageName));
return researchResults;
}
// publication & dataset & software & orp landing : for relatedResearchResults and similarResearchResults // publication & dataset & software & orp landing : for relatedResearchResults and similarResearchResults
parseRelatedOrSimilarResearchResult(relation: any, percentageName: string, provenanceAction: string = null): RelationResult { parseRelatedOrSimilarResearchResult(relation: any, percentageName: string, provenanceAction: string = null): RelationResult {
let researchResult: RelationResult = { let researchResult: RelationResult = {

View File

@ -121,7 +121,7 @@ export class DeletedByInferenceService {
} }
if(instance.hasOwnProperty("hostedby")) { if(instance.hasOwnProperty("hostedby")) {
counter = this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, _result['oaf:result'], url, counter, result.accessMode); this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, url, result.accessMode);
} }
} }
} }

View File

@ -28,7 +28,7 @@
<div class="uk-margin-bottom"> <div class="uk-margin-bottom">
<span *ngIf="resultLandingInfo.accessMode <span *ngIf="resultLandingInfo.accessMode
&& resultLandingInfo.accessMode.toLowerCase() !== 'not available'" && resultLandingInfo.accessMode.toLowerCase() !== 'not available'"
[class]="'uk-label custom-label label-'+ accessClass(resultLandingInfo.accessMode)" [class]="'uk-label custom-label uk-text-truncate label-'+ accessClass(resultLandingInfo.accessMode)"
title="Access Mode">{{resultLandingInfo.accessMode}} title="Access Mode">{{resultLandingInfo.accessMode}}
</span>{{" "}} </span>{{" "}}
<span *ngIf="resultLandingInfo.languages && <span *ngIf="resultLandingInfo.languages &&
@ -146,7 +146,7 @@
</metrics> </metrics>
</div> </div>
<div *ngIf="hasAltMetrics"> <div *ngIf="hasAltMetrics">
<altmetrics *ngIf="hasAltMetrics" id="{{resultLandingInfo.identifiers.get('doi')[0]}}" type="doi"> <altmetrics *ngIf="hasAltMetrics" id="{{resultLandingInfo.identifiers?.get('doi')[0]}}" type="doi">
</altmetrics> </altmetrics>
</div> </div>
</div> </div>
@ -291,108 +291,185 @@
<!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>--> <!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>-->
</div> </div>
</ng-template> </ng-template>
<ng-template #supplementary_tab> <!-- <ng-template #supplementary_tab>-->
<div class="uk-grid uk-margin-remove"> <!-- <div class="uk-grid uk-margin-remove">-->
<div class="uk-width-expand uk-padding"> <!-- <div class="uk-width-expand uk-padding">-->
<div <!-- <div-->
*ngIf="resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0" <!-- *ngIf="resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0"-->
class="uk-margin-bottom"> <!-- class="uk-margin-bottom">-->
<h6>Supplementary Outcomes</h6> <!-- <h6>Supplementary Outcomes</h6>-->
<no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize" <!-- <no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize"-->
[type]="'research outcomes'" <!-- [type]="'research outcomes'"-->
(pageChange)="updateSupplementaryPage($event)" <!-- (pageChange)="updateSupplementaryPage($event)"-->
[page]="supplementaryPage" [pageSize]="pageSize" <!-- [page]="supplementaryPage" [pageSize]="pageSize"-->
[totalResults]="resultLandingInfo.supplementaryResearchResults.length"> <!-- [totalResults]="resultLandingInfo.supplementaryResearchResults.length">-->
</no-load-paging> <!-- </no-load-paging>-->
<ul class="uk-list uk-list-divider uk-margin"> <!-- <ul class="uk-list uk-list-divider uk-margin">-->
<li *ngFor="let item of resultLandingInfo.supplementaryResearchResults.slice((supplementaryPage-1)*pageSize, supplementaryPage*pageSize)"> <!-- <li *ngFor="let item of resultLandingInfo.supplementaryResearchResults.slice((supplementaryPage-1)*pageSize, supplementaryPage*pageSize)">-->
<result-preview [modal]="relationModal" [properties]="properties" <!-- <result-preview [modal]="relationModal" [properties]="properties"-->
[result]="getResultPreview(item)"></result-preview> <!-- [result]="getResultPreview(item)"></result-preview>-->
</li> <!-- </li>-->
</ul> <!-- </ul>-->
<no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize" <!-- <no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize"-->
[type]="'research outcomes'" <!-- [type]="'research outcomes'"-->
(pageChange)="updateSupplementaryPage($event)" <!-- (pageChange)="updateSupplementaryPage($event)"-->
[page]="supplementaryPage" [pageSize]="pageSize" <!-- [page]="supplementaryPage" [pageSize]="pageSize"-->
[totalResults]="resultLandingInfo.supplementaryResearchResults.length"> <!-- [totalResults]="resultLandingInfo.supplementaryResearchResults.length">-->
</no-load-paging> <!-- </no-load-paging>-->
</div> <!-- </div>-->
<div <!-- <div-->
*ngIf="resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0"> <!-- *ngIf="resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0">-->
<h6>Outcomes Supplemented by this {{getTypeName()}}</h6> <!-- <h6>Outcomes Supplemented by this {{getTypeName()}}</h6>-->
<no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize" <!-- <no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize"-->
[type]="'research outcomes'" <!-- [type]="'research outcomes'"-->
(pageChange)="updateSupplementedByPage($event)" <!-- (pageChange)="updateSupplementedByPage($event)"-->
[page]="supplementedByPage" [pageSize]="pageSize" <!-- [page]="supplementedByPage" [pageSize]="pageSize"-->
[totalResults]="resultLandingInfo.supplementedByResearchResults.length"> <!-- [totalResults]="resultLandingInfo.supplementedByResearchResults.length">-->
</no-load-paging> <!-- </no-load-paging>-->
<ul class="uk-list uk-list-divider uk-margin"> <!-- <ul class="uk-list uk-list-divider uk-margin">-->
<li *ngFor="let item of resultLandingInfo.supplementedByResearchResults.slice((supplementedByPage-1)*pageSize, supplementedByPage*pageSize)"> <!-- <li *ngFor="let item of resultLandingInfo.supplementedByResearchResults.slice((supplementedByPage-1)*pageSize, supplementedByPage*pageSize)">-->
<result-preview [modal]="relationModal" [properties]="properties" <!-- <result-preview [modal]="relationModal" [properties]="properties"-->
[result]="getResultPreview(item)"></result-preview> <!-- [result]="getResultPreview(item)"></result-preview>-->
</li> <!-- </li>-->
</ul> <!-- </ul>-->
<no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize" <!-- <no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize"-->
[type]="'research outcomes'" <!-- [type]="'research outcomes'"-->
(pageChange)="updateSupplementedByPage($event)" <!-- (pageChange)="updateSupplementedByPage($event)"-->
[page]="supplementedByPage" [pageSize]="pageSize" <!-- [page]="supplementedByPage" [pageSize]="pageSize"-->
[totalResults]="resultLandingInfo.supplementedByResearchResults.length"> <!-- [totalResults]="resultLandingInfo.supplementedByResearchResults.length">-->
</no-load-paging> <!-- </no-load-paging>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>--> <!-- &lt;!&ndash;<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>&ndash;&gt;-->
<!-- </div>-->
<!-- </ng-template>-->
<ng-template #relation_in_tab let-researchResults="researchResults" let-header="header" let-relatedClassFilters="relatedClassFilters">
<div
*ngIf="researchResults && researchResults.length > 0"
class="uk-margin-bottom">
<h6 *ngIf="header">{{header}}</h6>
<mat-form-field *ngIf="relatedClassFilters?.size > 1" class="matSelectionFormField">
<mat-label>Filter by relation:</mat-label>
<mat-select [(ngModel)]="relatedClassSelected" (ngModelChange)="relatedClassChanged()"
[disableOptionCentering]="true"
panelClass="matSelectionPanel"
class="uk-text-bold matSelection">
<mat-option [value]="">All relations</mat-option>
<mat-option *ngFor="let relatedClass of relatedClassFilters" [value]="relatedClass">{{relatedClass}}</mat-option>
</mat-select>
</mat-form-field>
<!-- <div class="uk-margin-right uk-padding">-->
<!-- <span *ngFor="let relatedClass of relatedClassFilters">-->
<!-- <span [class]="'uk-margin-small-bottom uk-margin-small-right uk-label '+getRelatedClass(relatedClass)"-->
<!-- (click)="relatedClassChanged(relatedClass)" style="cursor:pointer;">-->
<!-- <a>-->
<!-- {{relatedClass}}-->
<!-- </a>-->
<!-- </span>-->
<!-- </span>-->
<!-- </div>-->
<no-load-paging
[type]="'research outcomes'"
(pageChange)="updateRelatedPage($event)"
[page]="relatedPage" [pageSize]="pageSize"
[totalResults]="researchResults.length">
</no-load-paging>
<ul class="uk-list uk-list-divider uk-margin">
<li *ngFor="let item of researchResults.slice((relatedPage-1)*pageSize, relatedPage*pageSize)">
<result-preview [modal]="relationModal" [properties]="properties"
[result]="getResultPreview(item)"></result-preview>
</li>
</ul>
<no-load-paging *ngIf="researchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateRelatedPage($event)"
[page]="relatedPage" [pageSize]="pageSize"
[totalResults]="researchResults.length">
</no-load-paging>
</div> </div>
</ng-template> </ng-template>
<ng-template #related_tab>
<!-- <ng-template #related_tab>-->
<!-- <div class="uk-grid uk-margin-remove">-->
<!-- <div class="uk-width-expand uk-padding">-->
<!-- <div-->
<!-- *ngIf="resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0"-->
<!-- class="uk-margin-bottom">-->
<!-- <h6>Related research</h6>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.relatedResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateRelatedPage($event)"-->
<!-- [page]="relatedPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.relatedResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- <ul class="uk-list uk-list-divider uk-margin">-->
<!-- <li *ngFor="let item of resultLandingInfo.relatedResearchResults.slice((relatedPage-1)*pageSize, relatedPage*pageSize)">-->
<!-- <result-preview [modal]="relationModal" [properties]="properties"-->
<!-- [result]="getResultPreview(item)"></result-preview>-->
<!-- </li>-->
<!-- </ul>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.relatedResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateRelatedPage($event)"-->
<!-- [page]="relatedPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.relatedResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- </div>-->
<!-- <div-->
<!-- *ngIf="resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0">-->
<!-- <h6>Similar Outcomes</h6>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.similarResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateSimilarPage($event)"-->
<!-- [page]="similarPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.similarResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- <ul class="uk-list uk-list-divider uk-margin">-->
<!-- <li *ngFor="let item of resultLandingInfo.similarResearchResults.slice((similarPage-1)*pageSize, similarPage*pageSize)">-->
<!-- <result-preview [modal]="relationModal" [properties]="properties"-->
<!-- [result]="getResultPreview(item)"></result-preview>-->
<!-- </li>-->
<!-- </ul>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.similarResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateSimilarPage($event)"-->
<!-- [page]="similarPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.similarResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- </div>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.parentResearchResults, header: 'Parent'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.childrenResearchResults, header: 'Children'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.reviewedByResearchResults, header: 'Reviewed by'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.reviewerResearchResults, header: 'Reviewer'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.referencedByResearchResults, header: 'Referenced by'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.refererResearchResults, header: 'Referer'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.identicalResearchResults, header: 'Identical'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.continuatorResearchResults, header: 'Continuator'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.continuedByResearchResults, header: 'Continued by'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.documentaryResearchResults, header: 'Documentary'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.documentedByResearchResults, header: 'Documented by'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.compilerResearchResults, header: 'Compiler'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.compiledByResearchResults, header: 'Compiled by'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.newerResearchResults, header: 'Newer'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.previousResearchResults, header: 'Previous'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.versionedByResearchResults, header: 'Versioned by'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.isVersionResearchResults, header: 'Is version of'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.derivedResearchResults, header: 'Derived'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.sourceResearchResults, header: 'Source'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.originalResearchResults, header: 'Original'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.variantResearchResults, header: 'Variant'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.obsoleteResearchResults, header: 'Obsolete'}"></ng-container>-->
<!-- <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: resultLandingInfo.obsoletedByResearchResults, header: 'Obsoleted by'}"></ng-container>-->
<!-- </div>-->
<!-- &lt;!&ndash;<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>&ndash;&gt;-->
<!-- </div>-->
<!-- </ng-template>-->
<ng-template #all_related_tab>
<div class="uk-grid uk-margin-remove"> <div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding"> <div class="uk-width-expand uk-padding">
<div <ng-container *ngTemplateOutlet="relation_in_tab; context: { researchResults: filteredRelatedResults, header: '', relatedClassFilters: resultLandingInfo.relatedClassFilters}"></ng-container>
*ngIf="resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0"
class="uk-margin-bottom">
<h6>Related research</h6>
<no-load-paging *ngIf="resultLandingInfo.relatedResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateRelatedPage($event)"
[page]="relatedPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.relatedResearchResults.length">
</no-load-paging>
<ul class="uk-list uk-list-divider uk-margin">
<li *ngFor="let item of resultLandingInfo.relatedResearchResults.slice((relatedPage-1)*pageSize, relatedPage*pageSize)">
<result-preview [modal]="relationModal" [properties]="properties"
[result]="getResultPreview(item)"></result-preview>
</li>
</ul>
<no-load-paging *ngIf="resultLandingInfo.relatedResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateRelatedPage($event)"
[page]="relatedPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.relatedResearchResults.length">
</no-load-paging>
</div>
<div
*ngIf="resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0">
<h6>Similar Outcomes</h6>
<no-load-paging *ngIf="resultLandingInfo.similarResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateSimilarPage($event)"
[page]="similarPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.similarResearchResults.length">
</no-load-paging>
<ul class="uk-list uk-list-divider uk-margin">
<li *ngFor="let item of resultLandingInfo.similarResearchResults.slice((similarPage-1)*pageSize, similarPage*pageSize)">
<result-preview [modal]="relationModal" [properties]="properties"
[result]="getResultPreview(item)"></result-preview>
</li>
</ul>
<no-load-paging *ngIf="resultLandingInfo.similarResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateSimilarPage($event)"
[page]="similarPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.similarResearchResults.length">
</no-load-paging>
</div>
</div> </div>
<!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>-->
</div> </div>
</ng-template> </ng-template>
<ng-template #bioentities_tab> <ng-template #bioentities_tab>
@ -476,18 +553,36 @@
<ng-container *ngTemplateOutlet="references_tab;"></ng-container> <ng-container *ngTemplateOutlet="references_tab;"></ng-container>
</my-tab> </my-tab>
<!-- [class]="(activeTab === 'supplementary')?'uk-active':''"--> <!-- [class]="(activeTab === 'supplementary')?'uk-active':''"-->
<my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) || <!-- <my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) ||-->
(resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)" <!-- (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)"-->
[tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'" <!-- [tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'"-->
[tabNumber]="supplementaryResults"> <!-- [tabNumber]="supplementaryResults">-->
<ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container> <!-- <ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container>-->
</my-tab> <!-- </my-tab>-->
<!-- [class]="(activeTab === 'related')?'uk-active':''"--> <!--&lt;!&ndash; [class]="(activeTab === 'related')?'uk-active':''"&ndash;&gt;-->
<my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||
(resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)" <!-- <my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||-->
[tabTitle]="'Related research'" [tabId]="'related'" <!-- (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0) ||-->
[tabNumber]="relatedResultsNum"> <!-- resultLandingInfo.parentResearchResults?.length > 0 || resultLandingInfo.childrenResearchResults?.length > 0 ||-->
<ng-container *ngTemplateOutlet="related_tab;"></ng-container> <!-- resultLandingInfo.reviewedByResearchResults?.length > 0 || resultLandingInfo.reviewerResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.referencedByResearchResults?.length > 0 || resultLandingInfo.refererResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.identicalResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.continuatorResearchResults?.length > 0 || resultLandingInfo.continuedByResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.documentaryResearchResults?.length > 0 || resultLandingInfo.documentedByResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.compilerResearchResults?.length > 0 || resultLandingInfo.compiledByResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.newerResearchResults?.length > 0 || resultLandingInfo.previousResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.versionedByResearchResults?.length > 0 || resultLandingInfo.isVersionResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.derivedResearchResults?.length > 0 || resultLandingInfo.sourceResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.originalResearchResults?.length > 0 || resultLandingInfo.variantResearchResults?.length > 0 ||-->
<!-- resultLandingInfo.obsoleteResearchResults?.length > 0 || resultLandingInfo.obsoletedByResearchResults?.length > 0"-->
<!-- [tabTitle]="'Related research'" [tabId]="'related'"-->
<!-- [tabNumber]="relatedResultsNum">-->
<!-- <ng-container *ngTemplateOutlet="related_tab;"></ng-container>-->
<!-- </my-tab>-->
<my-tab *ngIf="resultLandingInfo.relatedResults?.length > 0"
[tabTitle]="'Related research'" [tabId]="'all_related'"
[tabNumber]="resultLandingInfo.relatedResults.length">
<ng-container *ngTemplateOutlet="all_related_tab;"></ng-container>
</my-tab> </my-tab>
<!-- [class]="(activeTab === 'bioentities')?'uk-active':''"--> <!-- [class]="(activeTab === 'bioentities')?'uk-active':''"-->
<my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0" <my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0"
@ -514,18 +609,23 @@
<ng-container *ngTemplateOutlet="references_tab;"></ng-container> <ng-container *ngTemplateOutlet="references_tab;"></ng-container>
</my-tab> </my-tab>
<!-- [class]="(activeTab === 'supplementary')?'uk-active':''"--> <!-- [class]="(activeTab === 'supplementary')?'uk-active':''"-->
<my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) || <!-- <my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) ||-->
(resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)" <!-- (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)"-->
[tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'" <!-- [tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'"-->
[tabNumber]="supplementaryResults"> <!-- [tabNumber]="supplementaryResults">-->
<ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container> <!-- <ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container>-->
</my-tab> <!-- </my-tab>-->
<!-- [class]="(activeTab === 'related')?'uk-active':''"--> <!-- &lt;!&ndash; [class]="(activeTab === 'related')?'uk-active':''"&ndash;&gt;-->
<my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) || <!-- <my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||-->
(resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)" <!-- (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)"-->
[tabTitle]="'Related research'" [tabId]="'related'" <!-- [tabTitle]="'Related research'" [tabId]="'related'"-->
[tabNumber]="relatedResultsNum"> <!-- [tabNumber]="relatedResultsNum">-->
<ng-container *ngTemplateOutlet="related_tab;"></ng-container> <!-- <ng-container *ngTemplateOutlet="related_tab;"></ng-container>-->
<!-- </my-tab>-->
<my-tab *ngIf="resultLandingInfo.relatedResults?.length > 0"
[tabTitle]="'Related research'" [tabId]="'all_related'"
[tabNumber]="resultLandingInfo.relatedResults.length">
<ng-container *ngTemplateOutlet="all_related_tab;"></ng-container>
</my-tab> </my-tab>
<!-- [class]="(activeTab === 'bioentities')?'uk-active':''"--> <!-- [class]="(activeTab === 'bioentities')?'uk-active':''"-->
<my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0" <my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0"

View File

@ -116,6 +116,9 @@ export class ResultLandingComponent {
@ViewChild("annotation") annotation: AnnotationComponent; @ViewChild("annotation") annotation: AnnotationComponent;
public contextsWithLink: any; public contextsWithLink: any;
public relatedClassSelected: string = "";
public filteredRelatedResults: RelationResult[];
constructor(private _resultLandingService: ResultLandingService, constructor(private _resultLandingService: ResultLandingService,
private _vocabulariesService: ISVocabulariesService, private _vocabulariesService: ISVocabulariesService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
@ -317,12 +320,14 @@ export class ResultLandingComponent {
this.activeTab = 'summary'; this.activeTab = 'summary';
} else if (this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) { } else if (this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) {
this.activeTab = 'references'; this.activeTab = 'references';
} else if ((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) || // } else if ((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
(this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) { // (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
this.activeTab = 'supplementary'; // this.activeTab = 'supplementary';
} else if ((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) || // } else if ((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
(this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) { // (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
this.activeTab = 'related'; // this.activeTab = 'related';
} else if (this.resultLandingInfo.relatedResults && this.resultLandingInfo.relatedResults.length > 0) {
this.activeTab = "all_related";
} else if (this.resultLandingInfo.bioentities && this.bioentitiesNum > 0) { } else if (this.resultLandingInfo.bioentities && this.bioentitiesNum > 0) {
this.activeTab = 'bioentities'; this.activeTab = 'bioentities';
} else if(this.enermapsId && this.properties.enermapsURL) { } else if(this.enermapsId && this.properties.enermapsURL) {
@ -358,6 +363,7 @@ export class ResultLandingComponent {
return; return;
} }
this.resultLandingInfo = null; this.resultLandingInfo = null;
this.hasAltMetrics = false;
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe( this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => { data => {
this.resultLandingInfo = data; this.resultLandingInfo = data;
@ -416,6 +422,10 @@ export class ResultLandingComponent {
if(this.communityId && this.communityId == "enermaps" && properties.enermapsURL){ if(this.communityId && this.communityId == "enermaps" && properties.enermapsURL){
this.enermapsId = ParsingFunctions.getEnermapsConceptId(this.resultLandingInfo.contexts); this.enermapsId = ParsingFunctions.getEnermapsConceptId(this.resultLandingInfo.contexts);
} }
this.relatedClassSelected = "";
this.filteredRelatedResults = this.resultLandingInfo.relatedResults;
this.showLoading = false; this.showLoading = false;
this.setActiveTab(); this.setActiveTab();
}, },
@ -578,7 +588,7 @@ export class ResultLandingComponent {
} }
public getResultPreview(result: RelationResult): ResultPreview { public getResultPreview(result: RelationResult): ResultPreview {
return ResultPreview.relationResultConvert(result, this.relation); return ResultPreview.relationResultConvert(result);
} }
updateUrlWithType(pid) { updateUrlWithType(pid) {
@ -674,10 +684,11 @@ export class ResultLandingComponent {
|| (resultLandingInfo.organizations && resultLandingInfo.organizations.length > 0) || (resultLandingInfo.organizations && resultLandingInfo.organizations.length > 0)
|| resultLandingInfo.bioentities || (resultLandingInfo.references && resultLandingInfo.references.length > 0) || resultLandingInfo.bioentities || (resultLandingInfo.references && resultLandingInfo.references.length > 0)
|| (resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) // || (resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0)
|| (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0) // || (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)
|| (resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) // || (resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0)
|| (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0) // || (resultLandingInfo.supplementedByResearchResults &&
|| (resultLandingInfo.relatedResults && resultLandingInfo.relatedResults.length > 0)
) )
); );
// console.log("rich content " + allow) // console.log("rich content " + allow)
@ -689,7 +700,9 @@ export class ResultLandingComponent {
|| (resultLandingInfo.description && this.hasKeyword(resultLandingInfo.description,abstract_words)) || (resultLandingInfo.description && this.hasKeyword(resultLandingInfo.description,abstract_words))
) && ) &&
((resultLandingInfo.publisher && resultLandingInfo.publisher.toLowerCase() == "zenodo") || ((resultLandingInfo.publisher && resultLandingInfo.publisher.toLowerCase() == "zenodo") ||
resultLandingInfo.hostedBy_collectedFrom.filter( value => {return value.downloadName && value.downloadName.toLowerCase().indexOf("zenodo")!=-1}).length > 0)); resultLandingInfo.hostedBy_collectedFrom.filter(value => {
return value.downloadNames && value.downloadNames.filter(name => {return name && name.toLowerCase().indexOf("zenodo") != 1}).length > 0
}).length > 0));
// console.log("spam content " + allow) // console.log("spam content " + allow)
//common titles/ description / authors //common titles/ description / authors
let common_titles = ["introduction", "editorial", "book reviews", "preface", "reviews", "none", "book review", "foreword", "conclusion", "review", "reply","einleitung","short notices","erratum","discussion", "letters to the editor","letter to the editor","reviews of books",":{unav)","editorial board"]; let common_titles = ["introduction", "editorial", "book reviews", "preface", "reviews", "none", "book review", "foreword", "conclusion", "review", "reply","einleitung","short notices","erratum","discussion", "letters to the editor","letter to the editor","reviews of books",":{unav)","editorial board"];
@ -751,4 +764,9 @@ export class ResultLandingComponent {
public enrichContexts(contextsWithLink: any) { public enrichContexts(contextsWithLink: any) {
this.contextsWithLink = contextsWithLink; this.contextsWithLink = contextsWithLink;
} }
public relatedClassChanged() {
this.relatedPage = 1;
this.filteredRelatedResults = this.resultLandingInfo.relatedResults.filter(result => !this.relatedClassSelected || result.relationName.toLowerCase() == this.relatedClassSelected.toLowerCase());
}
} }

View File

@ -29,6 +29,8 @@ import {FeedbackModule} from "../feedback/feedback.module";
import {TabsModule} from "../../utils/tabs/tabs.module"; import {TabsModule} from "../../utils/tabs/tabs.module";
import {LoadingModule} from "../../utils/loading/loading.module"; import {LoadingModule} from "../../utils/loading/loading.module";
import {OrcidModule} from "../../orcid/orcid.module"; import {OrcidModule} from "../../orcid/orcid.module";
import {MatFormFieldModule} from "@angular/material/form-field";
import {MatSelectModule} from "@angular/material/select";
@NgModule({ @NgModule({
imports: [ imports: [
@ -37,7 +39,7 @@ import {OrcidModule} from "../../orcid/orcid.module";
MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule,
DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule,
AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule, AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule,
OrcidModule OrcidModule, MatFormFieldModule, MatSelectModule
], ],
declarations: [ declarations: [
ResultLandingComponent ResultLandingComponent

View File

@ -187,21 +187,19 @@ export class ResultLandingService {
if(relation.hasOwnProperty("to")) { if(relation.hasOwnProperty("to")) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") { if(relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary); this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, provenanceActionVocabulary);
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "isrelatedto") { }
if(relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") {
let relationName = relation.to.class;
if(!this.resultLandingInfo.relatedClassFilters.has(relationName)) {
this.resultLandingInfo.relatedClassFilters.add(relationName);
}
let provenanceAction: string = ""; let provenanceAction: string = "";
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
provenanceAction = provenanceActionVocabulary[relation.provenanceaction]; provenanceAction = provenanceActionVocabulary[relation.provenanceaction];
} }
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction); this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction);
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasamongtopnsimilardocuments") {
this.resultLandingInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.resultLandingInfo.similarResearchResults, relation);
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "issupplementedby") {
this.resultLandingInfo.supplementaryResearchResults = this.parsingFunctions.parseSupplementaryResearchResults(this.resultLandingInfo.supplementaryResearchResults, relation);
} else if(relation['to'].class && relation['to'].class.toLowerCase() == "issupplementto") {
this.resultLandingInfo.supplementedByResearchResults = this.parsingFunctions.parseSupplementedByResearchResults(this.resultLandingInfo.supplementedByResearchResults, relation);
} }
} }
} }
@ -241,40 +239,58 @@ export class ResultLandingService {
let url; let url;
if(!Array.isArray(instance['webresource'])) { if(!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url; url = instance['webresource'].url;
if(url.includes('&amp;')) {
let regExp = /&amp;/gmu;
let newUrl = url.replace(regExp, '&');
url = newUrl;
}
} else { } else {
url = instance['webresource'][0].url; url = instance['webresource'][0].url;
if(url.includes('&amp;')) { }
let regExp = /&amp;/gmu; if(url.includes('&amp;')) {
let newUrl = url.replace(regExp, '&'); let regExp = /&amp;/gmu;
url = newUrl; let newUrl = url.replace(regExp, '&');
} url = newUrl;
} }
/**********************************************************/ /**********************************************************/
if(instance.hasOwnProperty("hostedby")) { if(instance.hasOwnProperty("hostedby")) {
counter = this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, data[0], url, counter/*, this.resultLandingInfo.title*/, this.resultLandingInfo.accessMode); this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, url, this.resultLandingInfo.accessMode);
} }
/**********************************************************/ /**********************************************************/
} }
} }
/* Order Download from via openness*/ /* Order Download from via openness*/
this.resultLandingInfo.hostedBy_collectedFrom.sort((a, b) => { this.resultLandingInfo.hostedBy_collectedFrom.sort((a, b) => {
if(a.bestAccessMode && a.bestAccessMode.toLowerCase() === 'open access') { let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null);
return -1; let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null);
} else if(b.bestAccessMode && b.bestAccessMode.toLowerCase() === 'open access') {
return 1; if (firstAccessRight === secondAccessRight) {
} else if(!a.bestAccessMode || a.bestAccessMode.toLowerCase() !== 'not available') {
return 1;
} else if(!b.bestAccessMode || b.bestAccessMode.toLowerCase() !== 'not available') {
return -1;
} else {
return 0; return 0;
} else {
if (firstAccessRight === 'open access') {
return -1;
} else if (secondAccessRight === 'open access') {
return 1;
} else if (firstAccessRight === "open source") {
return -1;
} else if (secondAccessRight === "open source") {
return 1;
} else if (firstAccessRight === "embargo") {
return -1;
} else if (secondAccessRight === "embargo") {
return 1;
} else if (firstAccessRight === "restricted") {
return -1;
} else if (secondAccessRight === "restricted") {
return 1;
} else if (firstAccessRight === "closed access") {
return -1;
} else if (secondAccessRight === "closed access") {
return 1;
} else if (firstAccessRight === "not available") {
return -1;
} else if (secondAccessRight === "not available") {
return 1;
}
} }
return 0;
}); });
} }
@ -377,10 +393,8 @@ export class ResultLandingService {
return (item != undefined && item.fullName != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResearchResults);
this.resultLandingInfo.similarResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.similarResearchResults); this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults);
this.resultLandingInfo.supplementaryResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.supplementaryResearchResults);
this.resultLandingInfo.supplementedByResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.supplementedByResearchResults);
return this.resultLandingInfo; return this.resultLandingInfo;
} }

View File

@ -315,11 +315,32 @@ export class HelpContentService {
.pipe(catchError(this.handleError)); .pipe(catchError(this.handleError));
} }
// Menu Items
getMenuItems(portalPid: string) { getMenuItems(portalPid: string) {
return this.http.get<Array<MenuItem>>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/root/full") return this.http.get<Array<MenuItem>>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/root/full")
.pipe(catchError(this.handleError)); .pipe(catchError(this.handleError));
} }
saveMenuItem(menuItem: MenuItem, portalPid: string) {
HelpContentService.removeNulls(menuItem);
return this.http.post<MenuItem>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/save", JSON.stringify(menuItem), CustomOptions.getAuthOptionsWithBody())
.pipe(catchError(this.handleError));
}
updateMenuItem(menuItem: MenuItem, portalPid: string) {
HelpContentService.removeNulls(menuItem);
return this.http.post<MenuItem>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/update", JSON.stringify(menuItem), CustomOptions.getAuthOptionsWithBody())
.pipe(catchError(this.handleError));
}
deleteMenuItem(menuItemId: string, portalPid: string) {
return this.http.post<MenuItem>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/delete", menuItemId, CustomOptions.getAuthOptionsWithBody())
.pipe(catchError(this.handleError));
}
// unused // unused
getCommunities( helpContentUrl:string) { getCommunities( helpContentUrl:string) {
return this.http.get<Array<Portal>>(helpContentUrl + properties.adminToolsPortalType) return this.http.get<Array<Portal>>(helpContentUrl + properties.adminToolsPortalType)

View File

@ -1,6 +1,7 @@
export class MenuItem { export class MenuItem {
id: string = ""; // for root menu in order to close the dropdown when clicked _id: string = ""; // for root menu in order to close the dropdown when clicked
title: string = ""; title: string = "";
type: string = "internal";
url: string = ""; // external url url: string = ""; // external url
route: string = ""; // internal url - using angular routing and components route: string = ""; // internal url - using angular routing and components
routeActive: string = ""; // route to check if it is active routeActive: string = ""; // route to check if it is active
@ -16,7 +17,7 @@ export class MenuItem {
customClass: string = null; customClass: string = null;
constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon=null, fragment = null, customClass = null, routeActive = null) { constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon=null, fragment = null, customClass = null, routeActive = null) {
this.id = id; this._id = id;
this.title = title; this.title = title;
this.url = url; this.url = url;
this.route = route; this.route = route;
@ -82,8 +83,3 @@ export class SideMenuItem {
items: RootMenuItem[] = []; items: RootMenuItem[] = [];
ukIcon: string = ''; ukIcon: string = '';
} }
export interface CheckMenuItem {
menuItem: MenuItem;
checked: boolean;
}

View File

@ -7,6 +7,7 @@ export interface Page {
type: string; type: string;
isEnabled: boolean; isEnabled: boolean;
portalType: string; portalType: string;
portalPid: string;
entities: Entity[] | string[]; entities: Entity[] | string[];
top: boolean; top: boolean;
bottom: boolean; bottom: boolean;

View File

@ -51,15 +51,65 @@ export class ResultLandingInfo {
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects> classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
showEgiNotebookButton: boolean = false; showEgiNotebookButton: boolean = false;
// percentage is for trust // // percentage is for trust
relatedResearchResults: RelationResult[]; // relatedResearchResults: RelationResult[];
// percentage is for similarity // // percentage is for similarity
similarResearchResults: RelationResult[]; // similarResearchResults: RelationResult[];
//isSupplementedBy // //isSupplementedBy
supplementaryResearchResults: RelationResult[]; // supplementaryResearchResults: RelationResult[];
//isSupplementTo // //isSupplementTo
supplementedByResearchResults: RelationResult[]; // supplementedByResearchResults: RelationResult[];
//
// // IsPartOf
// parentResearchResults: RelationResult[];
// // HasPart
// childrenResearchResults: RelationResult[];
// // Reviews
// reviewedByResearchResults: RelationResult[];
// // IsReviewedBy
// reviewerResearchResults: RelationResult[];
// // References
// referencedByResearchResults: RelationResult[];
// // IsReferencedBy
// refererResearchResults: RelationResult[];
// // IsIdenticalTo
// identicalResearchResults: RelationResult[];
// // IsContinuedBy
// continuatorResearchResults: RelationResult[];
// // Continues
// continuedByResearchResults: RelationResult[];
// // IsDocumentedBy
// documentaryResearchResults: RelationResult[];
// // Documents
// documentedByResearchResults: RelationResult[];
// // IsCompiledBy
// compilerResearchResults: RelationResult[];
// // Compiles
// compiledByResearchResults: RelationResult[];
// // IsPreviousVersionOf
// newerResearchResults: RelationResult[];
// // IsNewVersionOf
// previousResearchResults: RelationResult[];
// // IsVersionOf
// versionedByResearchResults: RelationResult[];
// // HasVersion
// isVersionResearchResults: RelationResult[];
// // IsSourceOf
// derivedResearchResults: RelationResult[];
// // IsDerivedFrom
// sourceResearchResults: RelationResult[];
// // IsVariantFormOf
// originalResearchResults: RelationResult[];
// // IsOriginalFormOf
// variantResearchResults: RelationResult[];
// // IsObsoletedBy
// obsoleteResearchResults: RelationResult[];
// // Obsolete
// obsoletedByResearchResults: RelationResult[];
relatedResults: RelationResult[];
relatedClassFilters: Set<string> = new Set();
contexts: { "labelContext": string, "idContext": string, contexts: { "labelContext": string, "idContext": string,
"labelCategory": string, "idCategory": string, "labelCategory": string, "idCategory": string,
"labelConcept": string, "idConcept": string}[]; "labelConcept": string, "idConcept": string}[];

View File

@ -119,7 +119,7 @@
<div class="uk-margin-small-bottom"> <div class="uk-margin-small-bottom">
<span <span
*ngIf="result.accessMode && result.accessMode.toLowerCase() !== 'not available'" *ngIf="result.accessMode && result.accessMode.toLowerCase() !== 'not available'"
class="uk-label custom-label" [ngClass]="'label-' + accessClass(result.accessMode)" class="uk-label custom-label uk-text-truncate " [ngClass]="'label-' + accessClass(result.accessMode)"
title="Access Mode"> title="Access Mode">
{{result.accessMode}} {{result.accessMode}}
</span>{{' '}} </span>{{' '}}
@ -254,41 +254,29 @@
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0" <div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0"
class="uk-margin-small-bottom download-from"> class="uk-margin-small-bottom download-from">
<div *ngFor="let from of result.hostedBy_collectedFrom" <div *ngFor="let from of result.hostedBy_collectedFrom"
[title]="from.bestAccessMode ? from.bestAccessMode : 'Not available'" [title]="from.accessRight ? from.accessRight : 'Not available'"
class="uk-flex"> class="uk-flex">
<span class="uk-margin-small-right"> <span class="uk-margin-small-right">
<img [src]="from.icon" loading="lazy"> <img [src]="from.accessRightIcon" loading="lazy">
</span> </span>
<span class="uk-width-expand"> <span class="uk-width-expand">
<span class="uk-margin-right uk-display-inline-block"> <span class="uk-margin-right uk-display-inline-block">
<span class="uk-text-muted">Download from: </span> <span class="uk-text-muted">Download from: </span>
<span *ngIf="from.downloadUrl.length > 1" class="title"> <a *ngIf="from.downloadUrl"
<span>{{from.downloadName}}</span> [href]="from.downloadUrl" target="_blank" class="title">
<a *ngFor="let url of from.downloadUrl; let i=index;" <span>{{from.downloadNames.join("; ")}}</span>
[href]="url" target="_blank">
[{{(i + 1) | number}}]
</a>
</span>
<a *ngIf="from.downloadUrl && from.downloadUrl.length === 1"
[href]="from.downloadUrl[0]" target="_blank" class="title">
{{from.downloadName}}
<span class="custom-external space"></span> <span class="custom-external space"></span>
</a> </a>
<span *ngIf="!from.downloadUrl || from.downloadUrl.length === 0" class="title"> <span *ngIf="!from.downloadUrl || from.downloadUrl.length === 0" class="title">
{{from.downloadName}} <span>{{from.downloadNames.join(", ")}}</span>
</span> </span>
</span> </span>
<span class="provider uk-display-inline-block"> <span class="provider uk-display-inline-block">
<span class="uk-text-muted">Provider: </span> <span class="uk-text-muted">Provider: </span>
<!-- target="_blank"--> <a *ngFor="let collectedName of from.collectedNamesAndIds.keys(); let i=index" [routerLink]="dataProviderUrl"
<a *ngIf="from.collectedId" [routerLink]="dataProviderUrl" [queryParams]="{datasourceId: from.collectedId}" [queryParams]="{datasourceId: from.collectedNamesAndIds.get(collectedName)}" (click)="onClick();">
[href]="from.downloadUrl[0]" (click)="onClick();"> {{collectedName}}<ng-container *ngIf="(i !== (from.collectedNamesAndIds.size - 1))">; </ng-container>
{{from.collectedName}}
<!-- <span class="custom-external space"></span>-->
</a> </a>
<span *ngIf="!from.collectedId">
{{from.collectedName}}
</span>
</span> </span>
</span> </span>
</div> </div>

View File

@ -112,6 +112,12 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
if(this.result.provenanceAction) { if(this.result.provenanceAction) {
this.beforeTitle.push(this.result.provenanceAction); this.beforeTitle.push(this.result.provenanceAction);
} }
if(this.result.relationName) {
this.beforeTitle.push(this.result.relationName);
}
// if(this.result.percentage) {
// this.beforeTitle.push((this.result.relation ? this.result.relation+": " : "") + this.result.percentage.toString() + "%");
// }
} }
public getTypeName(type: string): string { public getTypeName(type: string): string {

View File

@ -3,15 +3,13 @@ import {ResultLandingInfo} from "../entities/resultLandingInfo";
import {OrganizationInfo} from "../entities/organizationInfo"; import {OrganizationInfo} from "../entities/organizationInfo";
export interface HostedByCollectedFrom { export interface HostedByCollectedFrom {
downloadName: string; downloadNames: string[];
downloadUrl: string[]; downloadUrl: string;
collectedName: string; collectedNamesAndIds: Map<string, string>;
collectedId: string; accessRight: string;
accessMode: string[]; types: string[];
bestAccessMode: string; years: string[];
type: string; accessRightIcon: string;
year: string;
icon: string
} }
export interface Journal { export interface Journal {
@ -30,8 +28,10 @@ export interface RelationResult {
id: string; id: string;
date: string; date: string;
percentage: number; percentage: number;
percentageName?: string;
class: string class: string
provenanceAction?: string; provenanceAction?: string;
relationName?: string;
} }
export interface Project { export interface Project {
@ -133,6 +133,7 @@ export class ResultPreview {
types: string[]; types: string[];
// Relation result // Relation result
relationName: string;
relation: string; relation: string;
percentage: number; percentage: number;
provenanceAction: string; provenanceAction: string;
@ -219,7 +220,7 @@ export class ResultPreview {
return resultPreview; return resultPreview;
} }
public static relationResultConvert(result: RelationResult, relation: string = 'trust'): ResultPreview { public static relationResultConvert(result: RelationResult): ResultPreview {
let resultPreview: ResultPreview = new ResultPreview(); let resultPreview: ResultPreview = new ResultPreview();
resultPreview.id = result.id; resultPreview.id = result.id;
resultPreview.title = result.name; resultPreview.title = result.name;
@ -227,7 +228,8 @@ export class ResultPreview {
if(result.date) { if(result.date) {
resultPreview.year = result.date.toString(); resultPreview.year = result.date.toString();
} }
resultPreview.relation = relation; resultPreview.relationName = result.relationName;
resultPreview.relation = result.percentageName;
resultPreview.percentage = result.percentage; resultPreview.percentage = result.percentage;
resultPreview.provenanceAction = result.provenanceAction; resultPreview.provenanceAction = result.provenanceAction;
return resultPreview; return resultPreview;

View File

@ -20,11 +20,11 @@ declare var UIkit: any;
<ng-container *ngIf="tabs.toArray().length > 2"> <ng-container *ngIf="tabs.toArray().length > 2">
<ul class="uk-hidden@m uk-tab main-tabs uk-margin-remove uk-child-width-expand"> <ul class="uk-hidden@m uk-tab main-tabs uk-margin-remove uk-child-width-expand">
<!-- *ngFor="let activeTab of activeTabs"--> <!-- *ngFor="let activeTab of activeTabs"-->
<li [class]="'uk-active uk-padding-remove '+(activeTab.statistics ? ' statistics ' : '')"> <li [class]="'uk-active uk-padding-remove '+activeTab.customClass">
<a class="uk-width-1-1 uk-height-1-1"> <a class="uk-width-1-1 uk-height-1-1">
<div class="tab-header">{{activeTab.title}}</div> <div class="tab-header">{{activeTab.title}}</div>
<div *ngIf="activeTab.num" class="number">{{activeTab.num | number}}</div> <div *ngIf="activeTab.num" class="number">{{activeTab.num | number}}</div>
<div *ngIf="activeTab.statistics" class="number"> <div *ngIf="activeTab.customClass == 'statistics'" class="number">
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
<path d="M0 0h24v24H0z" fill="none"></path> <path d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 20h4V4h-4v16zm-6 0h4v-8H4v8zM16 9v11h4V9h-4z"></path> <path d="M10 20h4V4h-4v16zm-6 0h4v-8H4v8zM16 9v11h4V9h-4z"></path>