Fix filter on disable bug. Add new private icon in portal-search-results. Add method to convert a stakeholder into StakeholderInfo

This commit is contained in:
Konstantinos Triantafyllou 2022-02-16 18:18:12 +02:00
parent 4e9981f24f
commit cf6ab4a03b
7 changed files with 23 additions and 9 deletions

View File

@ -1,5 +1,6 @@
import {SafeResourceUrl} from "@angular/platform-browser";
import {properties} from "../../../../environments/environment";
import {Session, User} from "../../login/utils/helper.class";
export const ChartHelper = {
prefix: "((__",
@ -49,6 +50,14 @@ export class Stakeholder {
export class StakeholderInfo extends Stakeholder {
isManager: boolean = false;
isMember: boolean = false;
public static toStakeholderInfo(stakeholders: (Stakeholder & StakeholderInfo)[], user: User): StakeholderInfo[] {
return stakeholders.map(stakeholder => {
stakeholder.isManager = Session.isPortalAdministrator(user) || Session.isMonitorCurator(user) || Session.isManager(stakeholder.type, stakeholder.alias, user);
stakeholder.isMember = Session.isMember(stakeholder.type, stakeholder.alias, user);
return stakeholder;
})
}
}
export class Topic {

View File

@ -79,7 +79,7 @@ export class StakeholderService {
}));
}
getMyStakeholders(url: string, type: string = null): Observable<Stakeholder[]> {
getMyStakeholders(url: string, type: string = null): Observable<(Stakeholder & StakeholderInfo)[]> {
return this.http.get<Stakeholder[]>(url + '/my-stakeholder' + ((type) ? ('?type=' + type) : ''), CustomOptions.registryOptions()).pipe(map(stakeholders => {
return this.formalize(this.checkIsUpload(stakeholders));
}));

View File

@ -29,7 +29,7 @@
<span class="uk-width-auto">
<a [attr.uk-tooltip]="'Remove ' + filter.selectedFromAndToValues" (click)="removeRangeFilter(filter)"
[class.uk-disabled]="disabled">
<span class="filter-taguk-flex uk-flex-middle">
<span class="filter-tag uk-flex uk-flex-middle">
<span class="uk-margin-small-right uk-width-expand">{{filter.selectedFromAndToValues}}</span>
<icon name="close" flex="true" ratio="0.7"></icon>
</span>
@ -234,7 +234,7 @@
target="_blank"> OpenAIRE - Explore</a>.
</div>
<!-- Total results, number of pages -->
<h5 class="uk-margin-bottom">
<h6 class="uk-margin-bottom">
<ng-container *ngIf="results && searchUtils.totalResults > 0">
<span>{{searchUtils.totalResults|number}}</span>
<span class="uk-text-muted uk-text-capitalize"> {{type}}, page </span>
@ -247,7 +247,7 @@
<span>{{searchUtils.page | number}}</span>
<span class="uk-text-muted"> of {{(totalPages(oldTotalResults)|number)}}</span>
</ng-container>
</h5>
</h6>
<!-- TODO Download results position-->
<div *ngIf="showDownload" class="uk-width-auto@m uk-margin-small-bottom">
<search-download

View File

@ -22,7 +22,7 @@ export class PortalSearchResultComponent implements OnInit{
@Input() properties: EnvProperties;
@ViewChild('AlertModal') modal;
visibilityIcon: Map<Visibility, string> = new Map<Visibility, string> ([
["PRIVATE", 'visibility_off'],
["PRIVATE", 'incognito'],
["RESTRICTED", 'group']
]);
public urlParam: string;
@ -64,7 +64,7 @@ export class PortalSearchResultComponent implements OnInit{
return result.status === "all" || (result.status === "manager" && result.isManager);
} else if(this.type === "stakeholder") {
return result.visibility === "PUBLIC" || (result.visibility === "RESTRICTED" && (result.isManager || result.isMember)) ||
(result.visibility === "PRIVATE" || result.isManager);
(result.visibility === "PRIVATE" && result.isManager);
}
}

View File

@ -9,7 +9,7 @@ import {ManageModule} from "../../utils/manage/manage.module";
import {IconsModule} from "../../utils/icons/icons.module";
import {UrlPrefixModule} from "../../utils/pipes/url-prefix.module";
import {IconsService} from "../../utils/icons/icons.service";
import {group, lock} from "../../utils/icons/icons";
import {incognito} from "../../utils/icons/icons";
import {LogoUrlPipeModule} from "../../utils/pipes/logoUrlPipe.module";
@NgModule({
@ -29,6 +29,6 @@ import {LogoUrlPipeModule} from "../../utils/pipes/logoUrlPipe.module";
})
export class PortalSearchResultModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([lock])
this.iconsService.registerIcons([incognito])
}
}

View File

@ -86,7 +86,7 @@
</ng-template>
<ng-template #input_label_wrapper let-filter="filter" let-value="value">
<a *ngIf="actionRoute" [routerLink]="getRoute()"
[queryParams]="getParams(filter,value)" class="uk-link-muted"
[queryParams]="getParams(filter,value)" class="uk-link-muted uk-display-inline-block"
[class.uk-disabled]="disabled(value.number)" [class.uk-link-text]="!disabled(value.number)">
<ng-container *ngTemplateOutlet="input_label; context: {filter: filter, value: value}"></ng-container>
</a>

View File

@ -148,3 +148,8 @@ export const print = {
}
/** Add new icon under this line to be sure that it will be added on preview */
export const incognito = {
name: 'incognito',
data: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24.51 19.525"><g id="Group_13376" data-name="Group 13376" transform="translate(-428.81 -3863.018)"><path id="Path_104500" data-name="Path 104500" d="M44.68,105.185H43.024a23.507,23.507,0,0,0-9.194-.158V106a3.909,3.909,0,0,1,1.264,1.668c.455,1.119.2,3.05,4.148,3.289s4-4.041,4.034-4.438.577-.372.577-.372.541-.021.579.372.09,4.673,4.034,4.438,3.693-2.17,4.146-3.289A3.9,3.9,0,0,1,53.879,106v-.969A23.686,23.686,0,0,0,44.68,105.185Z" transform="translate(397.218 3771.582)" fill="#2c2c2c"/><path id="Path_104501" data-name="Path 104501" d="M41.867,35.784H40.326s-1.95-6.217-2.207-6.735a2.8,2.8,0,0,0-2.591-2.061c-1.92-.266-2.138,1.225-3.544,1.268-1.406-.049-1.617-1.546-3.542-1.268a2.817,2.817,0,0,0-2.592,2.061c-.246.518-2.205,6.735-2.205,6.735H22.1a2.31,2.31,0,0,0-2.371,2.245H44.24A2.311,2.311,0,0,0,41.867,35.784Z" transform="translate(409.08 3836.064)" fill="#2c2c2c"/></g></svg>'
}