Merge branch 'master' of code-repo.d4science.org:MaDgIK/openaire-library

This commit is contained in:
argirok 2021-12-17 15:41:15 +02:00
commit 5c215af73e
6 changed files with 139 additions and 94 deletions

View File

@ -13,11 +13,11 @@
<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>
<li (click)="editRootMenu()">
<a>Edit</a>
</li>
<hr class="uk-nav-divider">
<li>
<li (click)="deleteRootMenu()">
<a>Delete</a>
</li>
</ul>
@ -25,7 +25,7 @@
</span>
</span>
</li>
<li class="uk-visible-toggle">
<li (click)="newRootMenu()" class="uk-visible-toggle">
<span class="clickable">
<span class="uk-icon-button small portal-icon-button">
<icon name="add"></icon>
@ -120,11 +120,18 @@
</div>
</div>
</div>
<modal-alert #editModal [okDisabled]="menuItemForm && (menuItemForm.invalid || menuItemForm.dirty)">
<modal-alert #editModal [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('name')" 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('route')" type="text" label="Route" placeholder="Write a route"></div>
<div dashboard-input [formInput]="menuItemForm.get('url')" type="text" label="URL" placeholder="Write a URL"></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>
<!-- Workflow for INTERNAL -->
<div *ngIf="menuItemForm.get('type').value === 'internal'">
<div class="uk-text-center">Select one of the pages</div>
<div dashboard-input [formInput]="menuItemForm.get('route')" type="autocomplete" label="Page" placeholder="Search all pages" [options]="allPages" [showOptionsOnEmpty]="false">
</div>
<div class="uk-text-center uk-margin-top">Or <a>create a new one</a></div>
</div>
</form>
</modal-alert>

View File

@ -13,6 +13,7 @@ import {Title} from "@angular/platform-browser";
import {AlertModal} from '../../utils/modal/alert';
import {CheckMenuItem, MenuItem} from '../../sharedComponents/menu';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {Option} from '../../sharedComponents/input/input.component';
@Component({
@ -32,6 +33,7 @@ export class MenuComponent implements OnInit {
// public rootMenuForm: FormGroup;
public menuItemForm: FormGroup;
public allPages = [];
public keyword = '';
@ -85,15 +87,33 @@ export class MenuComponent implements OnInit {
});
}
// public newRootMenu() {
// this.rootMenuForm = this._fb.group({
// id: this._fb.control(null),
// title: this._fb.control("",Validators.required),
// route: this._fb.control(""),
// isEnabled: this._fb.control("",Validators.required),
// });
// this.menuItemsModalOpen('Create Root Menu', 'Save Changes');
// }
public newRootMenu() {
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 Root Menu', 'Save Changes');
}
public editRootMenu() {
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),
});
this.menuItemsModalOpen('Edit Root Menu', 'Save Changes');
}
public deleteRootMenu() {
console.log('Delete root menu');
}
public getSelectedMenuItems(): string[] {
return this.checkboxes.filter(menuItem => menuItem.checked == true).map(checkedMenuItem => checkedMenuItem.menuItem).map(res => res.id);
@ -155,7 +175,7 @@ export class MenuComponent implements OnInit {
}
public onSearchClose() {
this.selectedKeyword = this.filterForm.value;
this.selectedKeyword = this.filterForm.get('keyword').value;
}
public reset() {

View File

@ -145,6 +145,7 @@ export class DataProviderComponent {
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.updateTitle("Content provider");
this.updateDescription("");
@ -259,11 +260,14 @@ export class DataProviderComponent {
"page_type": "dataprovider"
}
});
}
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else {
this.errorMessage = 'No dataProvider found';
this.showLoading = false;
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToDataProviders);
}
this.showLoading = false;
}
));
}
}

View File

@ -139,6 +139,7 @@ export class OrganizationComponent {
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.organizationInfo = null;
@ -337,9 +338,12 @@ export class OrganizationComponent {
"page_type": "organization"
}
});
}
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else {
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganizations);
this.errorMessage = 'No organization found';
}
this.showLoading = false;
}
));

View File

@ -152,6 +152,7 @@ export class ProjectComponent {
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
this.subscriptions.push(this.route.queryParams.subscribe(params => {
@ -351,9 +352,12 @@ export class ProjectComponent {
this.handleError("Error getting project for id: " + this.projectId, err);
if(err.status == 404) {
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
}
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else {
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
this.errorMessage = 'No project found';
}
this.showLoading = false;
}
));
@ -380,9 +384,12 @@ export class ProjectComponent {
this.handleError("Error getting project for grant id: " + grantId + " and funder: " + funder, err);
if(err.status == 404) {
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
}
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else {
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
this.errorMessage = 'No project found';
}
this.showLoading = false;
}
));

View File

@ -143,6 +143,7 @@ export class ResultLandingComponent {
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
this.subscriptions.push(this.route.queryParams.subscribe(data => {
if (data['articleId']) {
this.id = data['articleId'];
@ -422,8 +423,9 @@ export class ResultLandingComponent {
this.handleError("Error getting " + this.type + " for " + (this.id ? ("id: " + this.id) : ("pid: " + this.identifier.id + " ("+this.identifier.class+")")), err);
if (err.status == 404) {
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
}
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else{
if (this.type == "publication" || this.type == "software") {
this.errorMessage = 'No ' + this.type + ' found';
} else if (this.type == "dataset") {
@ -431,9 +433,10 @@ export class ResultLandingComponent {
} else if (this.type == "orp") {
this.errorMessage += "No research product found";
}
this.showLoading = false;
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToSearchPage);
}
this.showLoading = false;
}
));
}