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 class="uk-width-1-1">
<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>
<a (click)="filterForm.get('status').setValue('resources'); activeRootMenu=item['_id']">
<a (click)="changeActiveRootMenuItem(item)">
<span class="title">{{item.title}}</span>
</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>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 10; delay-hide: 0; flip: false">
<ul class="uk-nav uk-dropdown-nav">
<li (click)="editRootMenu()">
<li (click)="editMenuItem(item, false)">
<a>Edit</a>
</li>
<hr class="uk-nav-divider">
<li (click)="deleteRootMenu()">
<li (click)="confirmDeleteMenuItem(item._id, false)">
<a>Delete</a>
</li>
</ul>
@ -25,12 +25,12 @@
</span>
</span>
</li>
<li (click)="newRootMenu()" class="uk-visible-toggle">
<li (click)="newMenuItem(false)" class="uk-visible-toggle">
<span class="clickable">
<span class="uk-icon-button small portal-icon-button">
<icon name="add"></icon>
</span>
<span class="space uk-hidden-hover">
<span class="space" [class.uk-hidden-hover]="rootMenuItems.length != 0">
Create new root menu
</span>
</span>
@ -44,7 +44,7 @@
[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>
<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">
<icon name="add"></icon>
</button>
@ -54,60 +54,36 @@
</a>
</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 inner>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!showLoading">
<ul *ngIf='activeRootMenu' class="uk-list submenu-items">
<li *ngFor="let child of getActiveRootItem(activeRootMenu).items" class="uk-card uk-card-default uk-margin-bottom">
<ul *ngIf='activeRootMenuId' class="uk-list submenu-items">
<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-width-4-5">
<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">
{{child.title}}
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
Additional info
<div *ngIf="child.url && child.type == 'external'" class="uk-grid uk-width-1-1 uk-margin-left">
<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 class="uk-width-1-5">
<div class="uk-flex uk-flex-center">
<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>
<span class="uk-margin-small-left"> Edit</span>
</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>
<span class="uk-margin-small-left"> Delete</span>
</div>
@ -117,15 +93,20 @@
</div>
</li>
</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>
<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>
<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 -->
<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 -->
<div *ngIf="menuItemForm.get('type').value === 'internal'">
<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>
<h6 class="uk-text-bold uk-margin-remove-top">Create New Page</h6>
</div>
<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="Route" placeholder="Write a route"></div>
<div>
<form *ngIf="pageForm" [formGroup]="pageForm" class="uk grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="pageForm.get('name')" type="text" label="Name" placeholder="Write a name"></div>
<div dashboard-input [formInput]="pageForm.get('route')" type="text" label="Route" placeholder="Write a route"></div>
<!-- <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>">
</mat-slide-toggle>
</div>
</div> -->
<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>
</form>
</div>
</div>
</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 {Session} from '../../login/utils/helper.class';
import {UserManagementService} from '../../services/user-management.service';
import {Subscriber} from "rxjs";
import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../../../environments/environment";
import {StringUtils} from "../../utils/string-utils.class";
import {Title} from "@angular/platform-browser";
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 {Page} from '../../utils/entities/adminTool/page';
import {Option} from '../../sharedComponents/input/input.component';
declare var UIkit;
@Component({
selector: 'menuSelector',
templateUrl: './menu.component.html',
styles: [`
.z-index-2 {
z-index: 2;
}
`]
})
export class MenuComponent implements OnInit {
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
@ViewChild('editModal') editModal: AlertModal;
@ViewChild('deleteModal') deleteModal: AlertModal;
private selectedMenuItems: string[] = [];
public checkboxes: CheckMenuItem[] = [];
// public menuItems: MenuItem[] = [];
// public rootMenuForm: FormGroup;
public activeRootMenu: string;
public activeRootMenuId: string;
public activeRootMenu: MenuItem;
public childrenMenuItems: MenuItem[] = [];
private index: number;
public menuItemForm: FormGroup;
public pageForm: FormGroup;
public rootMenuItems = [];
public menuItems = [];
public allPages = [];
public keyword = '';
public selectedMenuItem: string;
public isChild: boolean = false;
public communities: Portal[] = [];
public portal: string;
public properties: EnvProperties = properties;
public newPageWindowOpen: boolean = false;
public showLoading = true;
public isPortalAdministrator = null;
public filterForm: FormGroup;
public typeOptions = [
public typeOptions: Option[] = [
{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 typeSub: Subscription = null;
constructor(private element: ElementRef, private route: ActivatedRoute,
private _router: Router, private title: Title,
@ -65,8 +79,11 @@ export class MenuComponent implements OnInit {
ngOnInit() {
this.filterForm = this._fb.group({
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.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) {
@ -91,17 +108,23 @@ export class MenuComponent implements OnInit {
value();
}
});
this.destroyTypeSubscription();
}
destroyTypeSubscription() {
if(this.typeSub instanceof Subscriber) {
this.typeSub.unsubscribe();
}
}
getMenuItems() {
this.subscriptions.push(
this._helpContentService.getMenuItems(this.portal).subscribe(
data => {
console.log(data);
this.rootMenuItems = data;
if(data && data.length > 0) {
this.activeRootMenu = data[0]['_id'];
console.log(this.activeRootMenu);
// this.activeRootMenuId = data[0]['_id'];
this.changeActiveRootMenuItem(data[0]);
}
},
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 {
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() {
this.subscriptions.push(
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({
id: this._fb.control(""),
_id: this._fb.control(""),
title: this._fb.control("",Validators.required),
type: this._fb.control(""),
type: this._fb.control("",Validators.required),
route: this._fb.control(""),
url: 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({
id: this._fb.control("id"),
title: this._fb.control("Resources",Validators.required),
type: this._fb.control("",Validators.required),
route: this._fb.control("noNeed"),
url: this._fb.control("noNeed"),
isEnabled: this._fb.control("enabled",Validators.required),
_id: this._fb.control(menuItem['_id']),
title: this._fb.control(menuItem.title,Validators.required),
type: this._fb.control(menuItem['type'],Validators.required),
route: this._fb.control(menuItem.route),
url: this._fb.control(menuItem.url),
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() {
console.log('Delete root menu');
public confirmDeleteMenuItem(id: string, isChild: boolean = false) {
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() {
this.deleteModal.cancelButton = true;
this.deleteModal.okButton = true;
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.open();
}
public newMenuItem() {
this.menuItemForm = this._fb.group({
id: this._fb.control(""),
title: this._fb.control("",Validators.required),
type: this._fb.control("",Validators.required),
route: this._fb.control(""),
url: this._fb.control(""),
isEnabled: this._fb.control("",Validators.required),
});
this.menuItemsModalOpen('Create Menu Item', 'Save Changes');
}
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 confirmedDeleteMenuItem(data: any, isChild: boolean = false) {
this.showLoading = true;
this.subscriptions.push(
this._helpContentService.deleteMenuItem(this.selectedMenuItem, this.portal).subscribe(
_ => {
this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild);
UIkit.notification('Menu item have been <b>successfully deleted</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
this.showLoading = false;
}
)
)
}
public deleteMenuItem() {
console.log('Delete menu item');
}
public newPageWindow() {
this.newPageWindowOpen = !this.newPageWindowOpen;
private deleteMenuItemFromArray(id: string, isChild: boolean = false) {
if(isChild) {
let i = this.getActiveRootItem(this.activeRootMenuId).items.findIndex(_ => _._id == id);
this.getActiveRootItem(this.activeRootMenuId).items.splice(i, 1);
} else {
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) {
@ -217,8 +310,58 @@ export class MenuComponent implements OnInit {
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() {
@ -229,11 +372,4 @@ export class MenuComponent implements OnInit {
this.selectedKeyword = null;
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}}
</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="actions" href="#">
<i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i>
@ -136,39 +136,42 @@
type="text" placeholder="Write a name"
label="Page Name">
</div>
<div dashboard-input [formInput]="pageForm.get('type')"
type="select" placeholder="Choose a page Type"
label="Type" [options]="typeOptions">
</div>
<div dashboard-input [formInput]="pageForm.get('entities')" placeholder="Add an entity"
type="chips" [options]="allEntities" label="Entities">
</div>
<div dashboard-input type="select" label="Portal Type" placeholder="Choose a type"
[formInput]="pageForm.get('portalType')" [options]="portalUtils.portalTypes"></div>
<div class="form-group">
<div class="uk-form-label uk-text-bold uk-margin-small-bottom"> Select if this page have helptext at:</div>
<div class="uk-grid uk-grid-small uk-child-width-1-4" uk-grid>
<div dashboard-input [formInput]="pageForm.get('top')"
type="checkbox"
label="Top">
</div>
<div dashboard-input [formInput]="pageForm.get('right')"
type="checkbox"
label="Right">
</div>
<div dashboard-input [formInput]="pageForm.get('bottom')"
type="checkbox"
label="Bottom">
</div>
<div dashboard-input [formInput]="pageForm.get('left')"
type="checkbox"
label="Left">
</div>
</div>
<label class="uk-text-danger">
By disabling a position, all contents in this position will be deleted.
</label>
</div>
<ng-template [ngIf]="isPortalAdministrator">
<div dashboard-input [formInput]="pageForm.get('type')"
type="select" placeholder="Choose a page Type"
label="Type" [options]="typeOptions">
</div>
<div dashboard-input [formInput]="pageForm.get('entities')" placeholder="Add an entity"
type="chips" [options]="allEntities" label="Entities">
</div>
<div dashboard-input type="select" label="Portal Type" placeholder="Choose a type"
[formInput]="pageForm.get('portalType')" [options]="portalUtils.portalTypes">
</div>
<div class="form-group">
<div class="uk-form-label uk-text-bold uk-margin-small-bottom"> Select if this page have helptext at:</div>
<div class="uk-grid uk-grid-small uk-child-width-1-4" uk-grid>
<div dashboard-input [formInput]="pageForm.get('top')"
type="checkbox"
label="Top">
</div>
<div dashboard-input [formInput]="pageForm.get('right')"
type="checkbox"
label="Right">
</div>
<div dashboard-input [formInput]="pageForm.get('bottom')"
type="checkbox"
label="Bottom">
</div>
<div dashboard-input [formInput]="pageForm.get('left')"
type="checkbox"
label="Left">
</div>
</div>
<label class="uk-text-danger">
By disabling a position, all contents in this position will be deleted.
</label>
</div>
</ng-template>
</form>
</modal-alert>

View File

@ -246,6 +246,7 @@ export class PagesComponent implements OnInit {
name: this._fb.control(page.name, Validators.required),
isEnabled: this._fb.control(page.isEnabled),
portalType: this._fb.control(page.portalType, Validators.required),
portalPid: this._fb.control(page.portalPid),
top: this._fb.control(page.top),
bottom: this._fb.control(page.bottom),
left: this._fb.control(page.left),
@ -271,6 +272,7 @@ export class PagesComponent implements OnInit {
name: this._fb.control('', Validators.required),
isEnabled: this._fb.control(true),
portalType: this._fb.control('', Validators.required),
portalPid: this._fb.control(null),
top: this._fb.control(true),
bottom: 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 {
if (this.activeItem || this.activeSubItem) {
return (!subItem && this.activeItem === item.id) ||
(subItem && this.activeItem === item.id && this.activeSubItem === subItem.id);
return (!subItem && this.activeItem === item._id) ||
(subItem && this.activeItem === item._id && this.activeSubItem === subItem._id);
} else {
if (subItem) {
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 {HelperFunctions} from "../../utils/HelperFunctions.class";
import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'availableOn',
template: `
<div 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 *ngIf="availableOn" class="download-from uk-height-max-large uk-overflow-auto uk-margin-small-bottom">
<div *ngFor="let instance of availableOn.slice(0, showNum) let i=index"
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">
<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>
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
<span *ngIf="available.downloadUrl.length > 1" class="title">
<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"
<a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank"
class="title">
{{available.downloadName}}
{{instance.downloadNames.join("; ")}}
<span class="custom-external custom-icon space"></span>
</a>
<span *ngIf="!available.downloadUrl || available.downloadUrl.length === 0" class="title">
{{available.downloadName}}
</span>
<div *ngIf="removeUnknown(available.type) || available.year">
<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 *ngIf="instance.types?.length > 0 || instance.years?.length > 0">
<span *ngIf="instance.types?.length > 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}</span>
<span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span>
<span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span>
</div>
<div *ngIf="available.collectedName">
<span>Provider: </span>
<a *ngIf="available.collectedId" [routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: available.collectedId}">
{{available.collectedName}}
<div *ngIf="instance.collectedNamesAndIds?.size > 0">
<span>Providers: </span>
<a *ngFor="let collectedName of instance.collectedNamesAndIds.keys(); let i=index" [routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}">
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
</a>
</div>
</div>

View File

@ -158,31 +158,23 @@ export class ParsingFunctions {
hostedBy_collectedFrom = [];
}
let available: HostedByCollectedFrom = {
downloadName: "",
downloadUrl: null,
collectedName: "",
collectedId: "",
accessMode: null,
bestAccessMode: null,
type: "",
year: "",
icon: ""
downloadNames: [],
downloadUrl: "",
collectedNamesAndIds: null,
accessRight: "",
types: [],
years: [],
accessRightIcon: ""
};
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'] == "") {
title['url'] = url;
@ -253,116 +245,105 @@ export class ParsingFunctions {
mapStructure.get(key)['accessMode'].push("");
}
}
parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
instance: any, data: any, url: string, counter: number/*,
title: { "name": string, "url": string, "accessMode": string}*/, accessMode: string): number {
let available: HostedByCollectedFrom = {
"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);
instance: any, url: string, globalAccessRight: string) {
if(!url) {
return;
}
if (available.downloadName) {
if (instance.hasOwnProperty("collectedfrom")) {
available.collectedId = instance['collectedfrom'].id;
available.collectedName = instance['collectedfrom'].name;
}
if (instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) {
available.type = instance['instancetype'].classname;
}
if (instance.hasOwnProperty("dateofacceptance")) {
var date: string = (instance.dateofacceptance) + ""; // transform to string in case it is an integer
available.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
}
available.accessMode = new Array<string>();
available.downloadUrl = new Array<string>();
available['downloadUrl'].push(url);
if(url.includes("doi.org/")) {
this.instanceWithDoiExists = true;
}
if (instance.hasOwnProperty("accessright")) {
if (url) {
available['accessMode'].push(instance['accessright'].classname);
let available: HostedByCollectedFrom = {
"downloadNames": [],
"downloadUrl": null,
"collectedNamesAndIds": new Map(),
"accessRight": null,
"accessRightIcon": "",
"types": [],
"years": []
};
if (instance.hasOwnProperty("hostedby")) {
let downloadNames: Set<string> = new Set();
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'];
if (hostedBy.name && hostedBy.name != "other resources" && hostedBy.name != "Unknown Repository") {
downloadNames.add(hostedBy.name);
}
if (this.changeBestAccessMode(available.bestAccessMode, instance['accessright'])) {
available.bestAccessMode = instance['accessright'].classname;
/*
if(title != undefined) {
if(this.changeBestAccessMode(title['accessMode'], instance['accessright'])) {
title['accessMode'] = instance['accessright'].classid;
title['url'] = url;
}
}
*/
if (this.changeBestAccessMode(accessMode, instance['accessright'])) {
accessMode = instance['accessright'].classname;
}
available.downloadNames = Array.from(downloadNames);
if (available.downloadNames.length == 0) {
available.downloadNames.push(url.substring(0, 30) + '...'); // substring(from, to);
}
}
if (instance.hasOwnProperty("collectedfrom")) {
let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
for (let i = 0; i < length; i++) {
let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
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
@ -444,7 +425,69 @@ export class ParsingFunctions {
similarResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "similarity"));
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
parseRelatedOrSimilarResearchResult(relation: any, percentageName: string, provenanceAction: string = null): RelationResult {
let researchResult: RelationResult = {

View File

@ -121,7 +121,7 @@ export class DeletedByInferenceService {
}
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">
<span *ngIf="resultLandingInfo.accessMode
&& 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}}
</span>{{" "}}
<span *ngIf="resultLandingInfo.languages &&
@ -146,7 +146,7 @@
</metrics>
</div>
<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>
</div>
</div>
@ -291,108 +291,185 @@
<!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>-->
</div>
</ng-template>
<ng-template #supplementary_tab>
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<div
*ngIf="resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0"
class="uk-margin-bottom">
<h6>Supplementary Outcomes</h6>
<no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateSupplementaryPage($event)"
[page]="supplementaryPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.supplementaryResearchResults.length">
</no-load-paging>
<ul class="uk-list uk-list-divider uk-margin">
<li *ngFor="let item of resultLandingInfo.supplementaryResearchResults.slice((supplementaryPage-1)*pageSize, supplementaryPage*pageSize)">
<result-preview [modal]="relationModal" [properties]="properties"
[result]="getResultPreview(item)"></result-preview>
</li>
</ul>
<no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateSupplementaryPage($event)"
[page]="supplementaryPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.supplementaryResearchResults.length">
</no-load-paging>
</div>
<div
*ngIf="resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0">
<h6>Outcomes Supplemented by this {{getTypeName()}}</h6>
<no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateSupplementedByPage($event)"
[page]="supplementedByPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.supplementedByResearchResults.length">
</no-load-paging>
<ul class="uk-list uk-list-divider uk-margin">
<li *ngFor="let item of resultLandingInfo.supplementedByResearchResults.slice((supplementedByPage-1)*pageSize, supplementedByPage*pageSize)">
<result-preview [modal]="relationModal" [properties]="properties"
[result]="getResultPreview(item)"></result-preview>
</li>
</ul>
<no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize"
[type]="'research outcomes'"
(pageChange)="updateSupplementedByPage($event)"
[page]="supplementedByPage" [pageSize]="pageSize"
[totalResults]="resultLandingInfo.supplementedByResearchResults.length">
</no-load-paging>
</div>
</div>
<!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>-->
<!-- <ng-template #supplementary_tab>-->
<!-- <div class="uk-grid uk-margin-remove">-->
<!-- <div class="uk-width-expand uk-padding">-->
<!-- <div-->
<!-- *ngIf="resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0"-->
<!-- class="uk-margin-bottom">-->
<!-- <h6>Supplementary Outcomes</h6>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateSupplementaryPage($event)"-->
<!-- [page]="supplementaryPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.supplementaryResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- <ul class="uk-list uk-list-divider uk-margin">-->
<!-- <li *ngFor="let item of resultLandingInfo.supplementaryResearchResults.slice((supplementaryPage-1)*pageSize, supplementaryPage*pageSize)">-->
<!-- <result-preview [modal]="relationModal" [properties]="properties"-->
<!-- [result]="getResultPreview(item)"></result-preview>-->
<!-- </li>-->
<!-- </ul>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.supplementaryResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateSupplementaryPage($event)"-->
<!-- [page]="supplementaryPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.supplementaryResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- </div>-->
<!-- <div-->
<!-- *ngIf="resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0">-->
<!-- <h6>Outcomes Supplemented by this {{getTypeName()}}</h6>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateSupplementedByPage($event)"-->
<!-- [page]="supplementedByPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.supplementedByResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- <ul class="uk-list uk-list-divider uk-margin">-->
<!-- <li *ngFor="let item of resultLandingInfo.supplementedByResearchResults.slice((supplementedByPage-1)*pageSize, supplementedByPage*pageSize)">-->
<!-- <result-preview [modal]="relationModal" [properties]="properties"-->
<!-- [result]="getResultPreview(item)"></result-preview>-->
<!-- </li>-->
<!-- </ul>-->
<!-- <no-load-paging *ngIf="resultLandingInfo.supplementedByResearchResults.length > pageSize"-->
<!-- [type]="'research outcomes'"-->
<!-- (pageChange)="updateSupplementedByPage($event)"-->
<!-- [page]="supplementedByPage" [pageSize]="pageSize"-->
<!-- [totalResults]="resultLandingInfo.supplementedByResearchResults.length">-->
<!-- </no-load-paging>-->
<!-- </div>-->
<!-- </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>
</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-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: filteredRelatedResults, header: '', relatedClassFilters: resultLandingInfo.relatedClassFilters}"></ng-container>
</div>
<!--<div class="uk-width-1-3@m uk-width-1-1 right-column uk-padding-remove"></div>-->
</div>
</ng-template>
<ng-template #bioentities_tab>
@ -476,18 +553,36 @@
<ng-container *ngTemplateOutlet="references_tab;"></ng-container>
</my-tab>
<!-- [class]="(activeTab === 'supplementary')?'uk-active':''"-->
<my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) ||
(resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)"
[tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'"
[tabNumber]="supplementaryResults">
<ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container>
</my-tab>
<!-- [class]="(activeTab === 'related')?'uk-active':''"-->
<my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||
(resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)"
[tabTitle]="'Related research'" [tabId]="'related'"
[tabNumber]="relatedResultsNum">
<ng-container *ngTemplateOutlet="related_tab;"></ng-container>
<!-- <my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) ||-->
<!-- (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)"-->
<!-- [tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'"-->
<!-- [tabNumber]="supplementaryResults">-->
<!-- <ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container>-->
<!-- </my-tab>-->
<!--&lt;!&ndash; [class]="(activeTab === 'related')?'uk-active':''"&ndash;&gt;-->
<!-- <my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||-->
<!-- (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0) ||-->
<!-- resultLandingInfo.parentResearchResults?.length > 0 || resultLandingInfo.childrenResearchResults?.length > 0 ||-->
<!-- 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>
<!-- [class]="(activeTab === 'bioentities')?'uk-active':''"-->
<my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0"
@ -514,18 +609,23 @@
<ng-container *ngTemplateOutlet="references_tab;"></ng-container>
</my-tab>
<!-- [class]="(activeTab === 'supplementary')?'uk-active':''"-->
<my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) ||
(resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)"
[tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'"
[tabNumber]="supplementaryResults">
<ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container>
</my-tab>
<!-- [class]="(activeTab === 'related')?'uk-active':''"-->
<my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||
(resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)"
[tabTitle]="'Related research'" [tabId]="'related'"
[tabNumber]="relatedResultsNum">
<ng-container *ngTemplateOutlet="related_tab;"></ng-container>
<!-- <my-tab *ngIf="(resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0) ||-->
<!-- (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)"-->
<!-- [tabTitle]="'Supplementary outcomes'" [tabId]="'supplementary'"-->
<!-- [tabNumber]="supplementaryResults">-->
<!-- <ng-container *ngTemplateOutlet="supplementary_tab;"></ng-container>-->
<!-- </my-tab>-->
<!-- &lt;!&ndash; [class]="(activeTab === 'related')?'uk-active':''"&ndash;&gt;-->
<!-- <my-tab *ngIf="(resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0) ||-->
<!-- (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.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>
<!-- [class]="(activeTab === 'bioentities')?'uk-active':''"-->
<my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0"

View File

@ -116,6 +116,9 @@ export class ResultLandingComponent {
@ViewChild("annotation") annotation: AnnotationComponent;
public contextsWithLink: any;
public relatedClassSelected: string = "";
public filteredRelatedResults: RelationResult[];
constructor(private _resultLandingService: ResultLandingService,
private _vocabulariesService: ISVocabulariesService,
private _piwikService: PiwikService,
@ -317,12 +320,14 @@ export class ResultLandingComponent {
this.activeTab = 'summary';
} else if (this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) {
this.activeTab = 'references';
} else if ((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
(this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
this.activeTab = 'supplementary';
} else if ((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
(this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
this.activeTab = 'related';
// } else if ((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
// (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
// this.activeTab = 'supplementary';
// } else if ((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
// (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
// 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) {
this.activeTab = 'bioentities';
} else if(this.enermapsId && this.properties.enermapsURL) {
@ -358,6 +363,7 @@ export class ResultLandingComponent {
return;
}
this.resultLandingInfo = null;
this.hasAltMetrics = false;
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
@ -416,6 +422,10 @@ export class ResultLandingComponent {
if(this.communityId && this.communityId == "enermaps" && properties.enermapsURL){
this.enermapsId = ParsingFunctions.getEnermapsConceptId(this.resultLandingInfo.contexts);
}
this.relatedClassSelected = "";
this.filteredRelatedResults = this.resultLandingInfo.relatedResults;
this.showLoading = false;
this.setActiveTab();
},
@ -578,7 +588,7 @@ export class ResultLandingComponent {
}
public getResultPreview(result: RelationResult): ResultPreview {
return ResultPreview.relationResultConvert(result, this.relation);
return ResultPreview.relationResultConvert(result);
}
updateUrlWithType(pid) {
@ -674,10 +684,11 @@ export class ResultLandingComponent {
|| (resultLandingInfo.organizations && resultLandingInfo.organizations.length > 0)
|| resultLandingInfo.bioentities || (resultLandingInfo.references && resultLandingInfo.references.length > 0)
|| (resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0)
|| (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)
|| (resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0)
|| (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)
// || (resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0)
// || (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)
// || (resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0)
// || (resultLandingInfo.supplementedByResearchResults &&
|| (resultLandingInfo.relatedResults && resultLandingInfo.relatedResults.length > 0)
)
);
// console.log("rich content " + allow)
@ -689,7 +700,9 @@ export class ResultLandingComponent {
|| (resultLandingInfo.description && this.hasKeyword(resultLandingInfo.description,abstract_words))
) &&
((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)
//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"];
@ -751,4 +764,9 @@ export class ResultLandingComponent {
public enrichContexts(contextsWithLink: any) {
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 {LoadingModule} from "../../utils/loading/loading.module";
import {OrcidModule} from "../../orcid/orcid.module";
import {MatFormFieldModule} from "@angular/material/form-field";
import {MatSelectModule} from "@angular/material/select";
@NgModule({
imports: [
@ -37,7 +39,7 @@ import {OrcidModule} from "../../orcid/orcid.module";
MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule,
DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule,
AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule,
OrcidModule
OrcidModule, MatFormFieldModule, MatSelectModule
],
declarations: [
ResultLandingComponent

View File

@ -187,21 +187,19 @@ export class ResultLandingService {
if(relation.hasOwnProperty("to")) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
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 = "";
if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) {
provenanceAction = provenanceActionVocabulary[relation.provenanceaction];
}
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, 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);
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction);
}
}
}
@ -241,40 +239,58 @@ export class ResultLandingService {
let url;
if(!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
if(url.includes('&amp;')) {
let regExp = /&amp;/gmu;
let newUrl = url.replace(regExp, '&');
url = newUrl;
}
} else {
url = instance['webresource'][0].url;
if(url.includes('&amp;')) {
let regExp = /&amp;/gmu;
let newUrl = url.replace(regExp, '&');
url = newUrl;
}
}
if(url.includes('&amp;')) {
let regExp = /&amp;/gmu;
let newUrl = url.replace(regExp, '&');
url = newUrl;
}
/**********************************************************/
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*/
this.resultLandingInfo.hostedBy_collectedFrom.sort((a, b) => {
if(a.bestAccessMode && a.bestAccessMode.toLowerCase() === 'open access') {
return -1;
} else if(b.bestAccessMode && b.bestAccessMode.toLowerCase() === 'open access') {
return 1;
} else if(!a.bestAccessMode || a.bestAccessMode.toLowerCase() !== 'not available') {
return 1;
} else if(!b.bestAccessMode || b.bestAccessMode.toLowerCase() !== 'not available') {
return -1;
} else {
let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null);
let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null);
if (firstAccessRight === secondAccessRight) {
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);
});
}
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResearchResults);
this.resultLandingInfo.similarResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.similarResearchResults);
this.resultLandingInfo.supplementaryResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.supplementaryResearchResults);
this.resultLandingInfo.supplementedByResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.supplementedByResearchResults);
this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults);
return this.resultLandingInfo;
}

View File

@ -315,11 +315,32 @@ export class HelpContentService {
.pipe(catchError(this.handleError));
}
// Menu Items
getMenuItems(portalPid: string) {
return this.http.get<Array<MenuItem>>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/root/full")
.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
getCommunities( helpContentUrl:string) {
return this.http.get<Array<Portal>>(helpContentUrl + properties.adminToolsPortalType)

View File

@ -1,6 +1,7 @@
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 = "";
type: string = "internal";
url: string = ""; // external url
route: string = ""; // internal url - using angular routing and components
routeActive: string = ""; // route to check if it is active
@ -16,7 +17,7 @@ export class MenuItem {
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) {
this.id = id;
this._id = id;
this.title = title;
this.url = url;
this.route = route;
@ -82,8 +83,3 @@ export class SideMenuItem {
items: RootMenuItem[] = [];
ukIcon: string = '';
}
export interface CheckMenuItem {
menuItem: MenuItem;
checked: boolean;
}

View File

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

View File

@ -51,15 +51,65 @@ export class ResultLandingInfo {
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
showEgiNotebookButton: boolean = false;
// percentage is for trust
relatedResearchResults: RelationResult[];
// percentage is for similarity
similarResearchResults: RelationResult[];
//isSupplementedBy
supplementaryResearchResults: RelationResult[];
//isSupplementTo
supplementedByResearchResults: RelationResult[];
// // percentage is for trust
// relatedResearchResults: RelationResult[];
// // percentage is for similarity
// similarResearchResults: RelationResult[];
// //isSupplementedBy
// supplementaryResearchResults: RelationResult[];
// //isSupplementTo
// 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,
"labelCategory": string, "idCategory": string,
"labelConcept": string, "idConcept": string}[];

View File

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

View File

@ -112,6 +112,12 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
if(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 {

View File

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

View File

@ -20,11 +20,11 @@ declare var UIkit: any;
<ng-container *ngIf="tabs.toArray().length > 2">
<ul class="uk-hidden@m uk-tab main-tabs uk-margin-remove uk-child-width-expand">
<!-- *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">
<div class="tab-header">{{activeTab.title}}</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">
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M10 20h4V4h-4v16zm-6 0h4v-8H4v8zM16 9v11h4V9h-4z"></path>