Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme
This commit is contained in:
commit
2c289af1e6
|
@ -41,37 +41,15 @@ export class ClaimResultsComponent {
|
|||
@Input() localStoragePrefix: string = "";
|
||||
@Input() basketLimit;
|
||||
|
||||
public isSelected(result: ClaimEntity) {
|
||||
let found: boolean = false;
|
||||
const id = result.id;
|
||||
for (let _i = 0; _i < this.selectedResults.length; _i++) {
|
||||
let item = this.selectedResults[_i];
|
||||
if (item.id && item.id == id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
// indexOf doesn't work when results came from
|
||||
// return this.selectedResults.indexOf(entity)!=-1;
|
||||
public isSelected(item: ClaimEntity) {
|
||||
return !!this.selectedResults.find(result => item.id === result.id);
|
||||
}
|
||||
|
||||
add(item: ClaimEntity) {
|
||||
// if (this.selectedResults.length > this.basketLimit) {
|
||||
// UIkit.notification({
|
||||
// message: 'Your basket exceeds the number of allowed results (150)',
|
||||
// status: 'warning',
|
||||
// timeout: 1500,
|
||||
// pos: 'top-center'
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
let found: boolean = this.isSelected(item);
|
||||
if (!found) {
|
||||
this.selectedResults.push(item);
|
||||
if (this.selectedResults != null) {
|
||||
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.selectedResults));
|
||||
}
|
||||
localStorage.setItem(this.localStoragePrefix, JSON.stringify(this.selectedResults));
|
||||
UIkit.notification(item.type + ' added in your basket!', {
|
||||
status: 'success',
|
||||
timeout: 4000,
|
||||
|
@ -80,8 +58,8 @@ export class ClaimResultsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
remove(item: any) {
|
||||
const index: number = this.selectedResults.indexOf(item);
|
||||
remove(item: ClaimEntity) {
|
||||
const index: number = this.selectedResults.findIndex(result => item.id === result.id);
|
||||
if (index > -1) {
|
||||
this.selectedResults.splice(index, 1);
|
||||
if (this.selectedResults != null) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<breadcrumbs [breadcrumbs]="breadcrumbs"></breadcrumbs>
|
||||
</div>
|
||||
</div>
|
||||
<div uk-sticky="offset: 65; top:#pageTop; bottom: #pageBottom; media: @m" class="uk-blur-background">
|
||||
<div uk-sticky="offset: 65; bottom: #pageBottom; media: @m" class="uk-blur-background">
|
||||
<div class="uk-section-xsmall">
|
||||
<stepper>
|
||||
<step *ngIf="!inlineEntity" [status]="stepStatus('source')" stepId="source" stepNumber="1"
|
||||
|
@ -68,106 +68,105 @@
|
|||
<div *ngIf="showOptions.show != 'claim'" class="uk-width-1-3">
|
||||
<div id="basket" uk-sticky=" offset: 220; top:#basketStickTop; bottom: #basketStickBottom; media: @m"
|
||||
class="uk-card uk-card-default linkingBasket" style="z-index: 0!important;">
|
||||
<div class="uk-card-body uk-padding-remove">
|
||||
<ul class="uk-padding-small uk-padding-remove-bottom" uk-tab>
|
||||
<li [class.uk-active]="showOptions.basketShowSources"
|
||||
(click)="showOptions.basketswitchToSources()">
|
||||
<a>
|
||||
Sources to link ({{(sources.length + (inlineEntity ? 1 : 0)) |number}})
|
||||
</a>
|
||||
</li>
|
||||
<li [class.uk-disabled]="sources.length == 0 && !inlineEntity"
|
||||
[class.uk-active]="showOptions.basketShowLinksTo">
|
||||
<a (click)="showOptions.basketswitchToLinkTo()">Link to <span
|
||||
*ngIf="results.length> 0">({{(results.length) | number}})</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="showOptions.basketShowSources">
|
||||
<div class="uk-margin-remove-top uk-height-medium uk-overflow-auto ">
|
||||
<div *ngIf="showOptions.show == 'source'" class=" uk-padding-small " style="min-height:
|
||||
17px;">
|
||||
<start-over *ngIf="showOptions.show == 'source' && sources.length> 0"
|
||||
[results]="sources"
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'"
|
||||
message="all sources" class="uk-float-right"></start-over>
|
||||
<bulk-claim *ngIf="showOptions.show == 'source'" [results]="sources"
|
||||
[properties]=properties
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'" [basketLimit]="basketLimit"
|
||||
>
|
||||
</bulk-claim>
|
||||
<div class="uk-card-body uk-padding-small">
|
||||
<div class="uk-margin-right">
|
||||
<ul class="uk-tab" uk-tab>
|
||||
<li [class.uk-active]="showOptions.basketShowSources"
|
||||
(click)="showOptions.basketswitchToSources()">
|
||||
<a>
|
||||
Sources to link ({{(sources.length + (inlineEntity ? 1 : 0)) |number}})
|
||||
</a>
|
||||
</li>
|
||||
<li [class.uk-disabled]="sources.length == 0 && !inlineEntity"
|
||||
[class.uk-active]="showOptions.basketShowLinksTo">
|
||||
<a (click)="showOptions.basketswitchToLinkTo()">Link to <span
|
||||
*ngIf="results.length> 0">({{(results.length) | number}})</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="showOptions.basketShowSources">
|
||||
<div class="uk-height-medium uk-overflow-auto">
|
||||
<div *ngIf="showOptions.show == 'source'" class="uk-padding-small uk-padding-remove-horizontal" style="min-height:17px;">
|
||||
<start-over *ngIf="showOptions.show == 'source' && sources.length> 0"
|
||||
[results]="sources"
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'"
|
||||
message="all sources" class="uk-float-right"></start-over>
|
||||
<bulk-claim *ngIf="showOptions.show == 'source'" [results]="sources"
|
||||
[properties]=properties
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'" [basketLimit]="basketLimit"
|
||||
>
|
||||
</bulk-claim>
|
||||
|
||||
</div>
|
||||
<div class="uk-animation-slide-top-small uk-padding-small">
|
||||
|
||||
<div *ngIf="sources.length == 0 && !inlineEntity " class="uk-text-center uk-text-meta">
|
||||
No Sources added yet. Start adding sources from the left panel. Or upload a DOI's CSV file.
|
||||
</div>
|
||||
<div *ngIf="sources.length >= basketLimit " class="uk-alert uk-alert-warning uk-text-center">
|
||||
Basket reached the size limit. No more sources can be added.
|
||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||
<div *ngIf="sources.length == 0 && !inlineEntity " class="uk-text-center uk-text-meta">
|
||||
No Sources added yet. Start adding sources from the left panel. Or upload a DOI's CSV file.
|
||||
</div>
|
||||
<div *ngIf="sources.length >= basketLimit " class="uk-alert uk-alert-warning uk-text-center">
|
||||
Basket reached the size limit. No more sources can be added.
|
||||
</div>
|
||||
<claim-selected-results *ngIf="inlineEntity" [results]="[inlineEntity]"
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'" class=""
|
||||
[enableRemove]="false" type="source">
|
||||
</claim-selected-results>
|
||||
<claim-selected-results *ngIf="sources.length > 0" [results]="sources"
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'" class=""
|
||||
[enableRemove]="true" type="source">
|
||||
</claim-selected-results>
|
||||
</div>
|
||||
<claim-selected-results *ngIf="inlineEntity" [results]="[inlineEntity]"
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'" class=""
|
||||
[enableRemove]="false" type="source">
|
||||
</claim-selected-results>
|
||||
<claim-selected-results *ngIf="sources.length > 0" [results]="sources"
|
||||
[localStoragePrefix]="localStoragePrefix+'sources'" class=""
|
||||
[enableRemove]="true" type="source">
|
||||
</claim-selected-results>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div *ngIf="showOptions.basketShowLinksTo">
|
||||
<div class="uk-height-medium uk-overflow-auto">
|
||||
<div *ngIf="(results.length)> 0 || showOptions.show=='result'" class="uk-padding-small" style="min-height: 17px;">
|
||||
<start-over *ngIf=" (results.length)> 0"
|
||||
[results]="results" [localStoragePrefix]="localStoragePrefix+'results'"
|
||||
message="all results (projects, communities, research results)"
|
||||
class="uk-float-right"></start-over>
|
||||
<bulk-claim *ngIf="showOptions.show=='result'" [results]="results" [properties]=properties
|
||||
[localStoragePrefix]="localStoragePrefix+'results'"
|
||||
[basketLimit]="basketLimit"></bulk-claim>
|
||||
</div>
|
||||
<div class="uk-padding-small uk-animation-slide-top-small">
|
||||
<div *ngIf="results.length >= basketLimit "
|
||||
class="uk-alert uk-alert-warning uk-text-center">
|
||||
Basket reached the size limit. No more entities can be added.
|
||||
</div>
|
||||
<claim-selected-results sectionTitle="Selected Results" [results]="results"
|
||||
[localStoragePrefix]="localStoragePrefix+'results'" type="target">
|
||||
</claim-selected-results>
|
||||
<div *ngIf="(results.length) == 0 " class=" uk-text-center">
|
||||
No entities to link with the sources. Start adding entities from the left panel.
|
||||
<div *ngIf="showOptions.basketShowLinksTo">
|
||||
<div class="uk-height-medium uk-overflow-auto">
|
||||
<div *ngIf="(results.length)> 0 || showOptions.show=='result'" class="uk-padding-small uk-padding-remove-horizontal" style="min-height: 17px;">
|
||||
<start-over *ngIf=" (results.length)> 0"
|
||||
[results]="results" [localStoragePrefix]="localStoragePrefix+'results'"
|
||||
message="all results (projects, communities, research results)"
|
||||
class="uk-float-right"></start-over>
|
||||
<bulk-claim *ngIf="showOptions.show=='result'" [results]="results" [properties]=properties
|
||||
[localStoragePrefix]="localStoragePrefix+'results'"
|
||||
[basketLimit]="basketLimit"></bulk-claim>
|
||||
</div>
|
||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||
<div *ngIf="results.length >= basketLimit "
|
||||
class="uk-alert uk-alert-warning uk-text-center">
|
||||
Basket reached the size limit. No more entities can be added.
|
||||
</div>
|
||||
<claim-selected-results sectionTitle="Selected Results" [results]="results"
|
||||
[localStoragePrefix]="localStoragePrefix+'results'" type="target">
|
||||
</claim-selected-results>
|
||||
<div *ngIf="(results.length) == 0 " class=" uk-text-center">
|
||||
No entities to link with the sources. Start adding entities from the left panel.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="showOptions.show == 'source'"
|
||||
class="uk-card-footer uk-flex uk-flex-center clickable"
|
||||
[class.uk-tile-primary]="sources.length > 0"
|
||||
[class.uk-background-muted]="sources.length == 0"
|
||||
[class.uk-disabled]="sources.length == 0"
|
||||
(click)="stepHasChanged('target')">
|
||||
<button class="uk-flex uk-flex-middle uk-button uk-button-text"
|
||||
[class.uk-disabled]="sources.length == 0" [disabled]="sources.length == 0">
|
||||
<icon name="link" visuallyHidden="link" [flex]="true"></icon>
|
||||
<div class="uk-width-expand uk-margin-small-left">STEP 2 - LINK SOURCES TO ENTITIES</div>
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="showOptions.show == 'source'"
|
||||
class="uk-card-footer uk-flex uk-flex-center clickable"
|
||||
[class.uk-tile-primary]="sources.length > 0"
|
||||
[class.uk-background-muted]="sources.length == 0"
|
||||
[class.uk-disabled]="sources.length == 0"
|
||||
(click)="stepHasChanged('target')">
|
||||
<button class="uk-flex uk-flex-middle uk-button uk-button-text"
|
||||
[class.uk-disabled]="sources.length == 0" [disabled]="sources.length == 0">
|
||||
<icon name="link" visuallyHidden="link" [flex]="true"></icon>
|
||||
<div class="uk-width-expand uk-margin-small-left">STEP 2 - LINK SOURCES TO ENTITIES</div>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<div *ngIf="showOptions.show != 'source'"
|
||||
class="uk-card-footer uk-flex uk-flex-center clickable"
|
||||
[class.uk-tile-primary]="results.length > 0"
|
||||
[class.uk-background-muted]="results.length == 0"
|
||||
[class.uk-disabled]="results.length == 0" (click)="stepHasChanged('claim')">
|
||||
<button class="uk-flex uk-flex-middle uk-button uk-button-text"
|
||||
[class.uk-disabled]="results.length == 0" [disabled]="results.length == 0">
|
||||
<icon *ngIf="inlineEntity" name="link" visuallyHidden="link" [flex]="true"></icon>
|
||||
<div class="uk-width-expand uk-margin-small-left">STEP {{inlineEntity ? '2' : '3'}} - FINALISE AND FINISH</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="showOptions.show != 'source'"
|
||||
class="uk-card-footer uk-flex uk-flex-center clickable"
|
||||
[class.uk-tile-primary]="results.length > 0"
|
||||
[class.uk-background-muted]="results.length == 0"
|
||||
[class.uk-disabled]="results.length == 0" (click)="stepHasChanged('claim')">
|
||||
<button class="uk-flex uk-flex-middle uk-button uk-button-text"
|
||||
[class.uk-disabled]="results.length == 0" [disabled]="results.length == 0">
|
||||
<icon *ngIf="inlineEntity" name="link" visuallyHidden="link" [flex]="true"></icon>
|
||||
<div class="uk-width-expand uk-margin-small-left">STEP {{inlineEntity ? '2' : '3'}} - FINALISE AND FINISH</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,7 @@ 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 {MenuItem, MenuItemExtended} from '../../sharedComponents/menu';
|
||||
import {MenuItemExtended} from '../../sharedComponents/menu';
|
||||
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
|
||||
import {Option} from '../../sharedComponents/input/input.component';
|
||||
import {CommunityInfo} from '../../connect/community/communityInfo';
|
||||
|
@ -45,10 +45,10 @@ export class MenuComponent implements OnInit {
|
|||
{label: 'Custom Menu', value: 'customMenu'}
|
||||
];
|
||||
public selectedMenuType = this.menuTypes[0].value;
|
||||
public normalMenuItems = [];
|
||||
public featuredMenuItems = [];
|
||||
public normalMenuItems: MenuItemExtended[] = [];
|
||||
public featuredMenuItems: MenuItemExtended[] = [];
|
||||
public allPages = [];
|
||||
public parentOptions = [];
|
||||
public parentOptions: Option[] = [];
|
||||
public pageStatus: Map<string,boolean> = null;
|
||||
|
||||
public selectedMenuItem: string;
|
||||
|
@ -190,11 +190,7 @@ export class MenuComponent implements OnInit {
|
|||
}
|
||||
|
||||
getParentOptions() {
|
||||
this.normalMenuItems.forEach(item => {
|
||||
if(item.items?.length || item.parentItemId != null || item.parentItemId != '') {
|
||||
this.parentOptions.push({label: item.title, value: item._id});
|
||||
}
|
||||
});
|
||||
this.parentOptions = this.normalMenuItems.map(item => ({label: item.title, value: item._id}));
|
||||
this.parentOptions.unshift({label: 'No parent', value: ''});
|
||||
}
|
||||
|
||||
|
@ -223,14 +219,14 @@ export class MenuComponent implements OnInit {
|
|||
route: this._fb.control(""),
|
||||
url: this._fb.control(""),
|
||||
isEnabled: this._fb.control(""),
|
||||
isFeatured: this._fb.control(this.selectedMenuType == 'customMenu' ? true : false),
|
||||
isFeatured: this._fb.control(this.selectedMenuType == 'customMenu'),
|
||||
parentItemId: this._fb.control("")
|
||||
});
|
||||
this.addValidatorForUrlOrRoute();
|
||||
this.menuItemsModalOpen('Add Menu Item', 'Create');
|
||||
}
|
||||
|
||||
public editMenuItem(index: number, menuItem: MenuItem, isChild: boolean = false) {
|
||||
public editMenuItem(index: number, menuItem: MenuItemExtended, isChild: boolean = false) {
|
||||
this.menuItemForm = this._fb.group({
|
||||
_id: this._fb.control(menuItem['_id']),
|
||||
title: this._fb.control(menuItem.title,Validators.required),
|
||||
|
@ -238,7 +234,7 @@ export class MenuComponent implements OnInit {
|
|||
route: this._fb.control(menuItem.route, (menuItem['type'] == "internal") ? [Validators.required] : []),
|
||||
url: this._fb.control(menuItem.url, (menuItem['type'] == "external") ? [Validators.required, StringUtils.urlValidator()] : []),
|
||||
isFeatured: this._fb.control(menuItem.isFeatured),
|
||||
parentItemId: this._fb.control(menuItem['parentItemId'])
|
||||
parentItemId: this._fb.control(menuItem.parentItemId)
|
||||
});
|
||||
this.isChild = isChild;
|
||||
this.index = index;
|
||||
|
@ -287,8 +283,7 @@ export class MenuComponent implements OnInit {
|
|||
} else {
|
||||
let i = this.normalMenuItems.findIndex(_ => _._id == id);
|
||||
this.normalMenuItems.splice(i, 1);
|
||||
let j = this.parentOptions.findIndex(_ => _._id == id);
|
||||
this.parentOptions.splice(j, 1);
|
||||
this.getParentOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +299,6 @@ export class MenuComponent implements OnInit {
|
|||
this.destroyTypeSubscription();
|
||||
this.showLoading = true;
|
||||
this.menuItemForm.value.target = this.menuItemForm.value['type'] == "internal" ? "_self" : "_blank";
|
||||
console.log(this.menuItemForm.value);
|
||||
if(!this.menuItemForm.value._id) {
|
||||
this.subscriptions.push(
|
||||
this._helpContentService.saveMenuItem(<MenuItemExtended>this.menuItemForm.getRawValue(), this.portal).subscribe(
|
||||
|
@ -330,26 +324,27 @@ export class MenuComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
public menuItemSavedSuccessfully(menuItem: MenuItem, isNew: boolean) {
|
||||
public menuItemSavedSuccessfully(menuItem: MenuItemExtended, isNew: boolean) {
|
||||
if(isNew) {
|
||||
if(menuItem['parentItemId']) {
|
||||
let i = this.normalMenuItems.findIndex(_ => _._id == menuItem['parentItemId']);
|
||||
if(menuItem.parentItemId) {
|
||||
let i = this.normalMenuItems.findIndex(_ => _._id == menuItem.parentItemId);
|
||||
this.normalMenuItems[i].items.push(menuItem);
|
||||
} else {
|
||||
if(menuItem.isFeatured) {
|
||||
this.featuredMenuItems.push(menuItem);
|
||||
} else {
|
||||
this.normalMenuItems.push(menuItem);
|
||||
this.parentOptions.push({label: menuItem.title, value: menuItem._id});
|
||||
this.getParentOptions();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(menuItem['parentItemId']) {
|
||||
if(menuItem.parentItemId) {
|
||||
} else {
|
||||
if(menuItem.isFeatured) {
|
||||
this.featuredMenuItems[this.index] = menuItem;
|
||||
} else {
|
||||
this.normalMenuItems[this.index] = menuItem;
|
||||
this.getParentOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -418,4 +413,4 @@ export class MenuComponent implements OnInit {
|
|||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ declare var UIkit: any;
|
|||
<a *ngIf="!showLoading" (click)="currentAction='add'; saveWorkPreparation();"
|
||||
class="uk-icon-button uk-icon landing-action-button landing-action-button-orcid"
|
||||
[class.uk-disabled]="showLoading || !isLoggedIn || !pids"
|
||||
[class.uk-text-muted]="!isLoggedIn || !pids"
|
||||
(mouseover)="hoverEvent($event)" (mouseout)="hoverEvent($event)">
|
||||
<icon *ngIf="!hoverAdd" name="orcid_add" ratio="1.1" visuallyHidden="add"></icon>
|
||||
<icon *ngIf="hoverAdd" name="add" visuallyHidden="add"></icon>
|
||||
|
@ -74,7 +73,6 @@ declare var UIkit: any;
|
|||
<a *ngIf="!showLoading" (click)="currentAction='delete'; deleteWorks();"
|
||||
class="uk-icon-button uk-icon landing-action-button landing-action-button-orcid"
|
||||
[class.uk-disabled]="showLoading || !isLoggedIn || !pids"
|
||||
[class.uk-text-muted]="!isLoggedIn || !pids"
|
||||
(mouseover)="hoverEvent($event, 'delete')" (mouseout)="hoverEvent($event, 'delete')">
|
||||
<icon *ngIf="!hoverDelete" name="orcid_bin" ratio="1.1" visuallyHidden="delete"></icon>
|
||||
<icon *ngIf="hoverDelete" name="delete_outline" class="uk-text-danger" visuallyHidden="delete"></icon>
|
||||
|
@ -463,7 +461,7 @@ export class OrcidWorkComponent {
|
|||
))
|
||||
}
|
||||
|
||||
private saveWorkPreparation() {
|
||||
public saveWorkPreparation() {
|
||||
if(!Session.isLoggedIn()){
|
||||
//this.userValidMessage = "User session has expired. Please login again.";
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
|
@ -589,7 +587,7 @@ export class OrcidWorkComponent {
|
|||
// }
|
||||
}
|
||||
|
||||
private getOrcidWorks() {
|
||||
public getOrcidWorks() {
|
||||
if(!Session.isLoggedIn()){
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
|
@ -626,7 +624,7 @@ export class OrcidWorkComponent {
|
|||
}
|
||||
|
||||
|
||||
private deleteWorks(confirmed: boolean = false) {
|
||||
public deleteWorks(confirmed: boolean = false) {
|
||||
if(!Session.isLoggedIn()){
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
|
|
|
@ -971,9 +971,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
public static createKeywordQuery(entityType: string, value: string, id, operatorId, countParams = 0, includes: boolean = true) {
|
||||
let params = "";
|
||||
let doisParams = "";
|
||||
if(!includes) {
|
||||
params += "(*=* NOT ";
|
||||
}
|
||||
var DOIs: Identifier[] = Identifier.getIdentifiersFromString(value);
|
||||
if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service")) {
|
||||
for (let identifier of DOIs) {
|
||||
|
@ -990,20 +987,17 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
}
|
||||
}
|
||||
if (doisParams.length > 0) {
|
||||
params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true, true) + " or " + doisParams + ")";
|
||||
params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true, true, includes) + " or " + doisParams + ")";
|
||||
} else {
|
||||
//if it is PIDs but no doisquery produced, forced to use quotes as the query will fail due to special characters
|
||||
params += this.createQuotedKeywordQuery(value, id, operatorId, countParams, true,
|
||||
(DOIs.length > 0 && doisParams.length == 0));
|
||||
}
|
||||
if(!includes) {
|
||||
params += ")";
|
||||
(DOIs.length > 0 && doisParams.length == 0), includes);
|
||||
}
|
||||
return params;
|
||||
|
||||
}
|
||||
|
||||
private static createQuotedKeywordQuery(fieldValue: string, fieldId, fieldOperator, countParams: number, isSearchAll: boolean, forceQuotted: boolean = false) {
|
||||
private static createQuotedKeywordQuery(fieldValue: string, fieldId, fieldOperator, countParams: number, isSearchAll: boolean, forceQuotted: boolean = false, includes: boolean = true) {
|
||||
let params = "";
|
||||
let countQuote = (fieldValue.match(/'/g) || []).length;
|
||||
let countDoubleQuote = (fieldValue.match(/"/g) || []).length;
|
||||
|
@ -1012,7 +1006,11 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
|||
quotedParts = (fieldValue) ? fieldValue.match(/(["'])(.*?)*?\1/g) : [];
|
||||
}
|
||||
params += (countParams == 0 ? "" : fieldOperator);
|
||||
params += " (";
|
||||
if(!includes) {
|
||||
params += "(*=* NOT ";
|
||||
} else {
|
||||
params += " (";
|
||||
}
|
||||
if (forceQuotted) {
|
||||
/** Remove double quotes **/
|
||||
fieldValue = fieldValue.replace(/["]+/g, '');
|
||||
|
|
|
@ -322,17 +322,16 @@ export class HelpContentService {
|
|||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
saveMenuItem(menuItem: MenuItem, portalPid: string) {
|
||||
saveMenuItem(menuItem: MenuItemExtended, portalPid: string) {
|
||||
HelpContentService.removeNulls(menuItem);
|
||||
|
||||
return this.http.post<MenuItem>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/save", JSON.stringify(menuItem), CustomOptions.getAuthOptionsWithBody())
|
||||
return this.http.post<MenuItemExtended>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/save", JSON.stringify(menuItem), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updateMenuItem(menuItem: MenuItem, portalPid: string) {
|
||||
updateMenuItem(menuItem: MenuItemExtended, portalPid: string) {
|
||||
HelpContentService.removeNulls(menuItem);
|
||||
|
||||
return this.http.post<MenuItem>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/update", JSON.stringify(menuItem), CustomOptions.getAuthOptionsWithBody())
|
||||
return this.http.post<MenuItemExtended>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/update", JSON.stringify(menuItem), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue