fixed routerLink (in progess)

This commit is contained in:
Sofia Papacharalampous 2024-06-12 17:40:29 +03:00
parent 92ca0d46a5
commit 39ddf4377d
11 changed files with 21 additions and 16 deletions

View File

@ -19,7 +19,7 @@
<div class="col-auto description-to-dmp">{{'DESCRIPTION-EDITOR.TO-DMP' | translate}}</div>
<div class="dmp-title p-0">:&nbsp;{{ item?.dmp?.label }}</div>
<div class="col-auto d-flex align-items-center">
<a [routerLink]="['/plans/overview/' + item.dmp.id]" target="_blank" class="pointer open-in-new-icon">
<a [routerLink]="routerUtils.generateUrl(['/plans/overview/', item.dmp.id])" target="_blank" class="pointer open-in-new-icon">
<mat-icon class="size-18">open_in_new</mat-icon>
</a>
</div>

View File

@ -48,6 +48,7 @@ import { ToCEntry } from './table-of-contents/models/toc-entry';
import { ToCEntryType } from './table-of-contents/models/toc-entry-type.enum';
import { TableOfContentsService } from './table-of-contents/services/table-of-contents-service';
import { TableOfContentsComponent } from './table-of-contents/table-of-contents.component';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-description-editor-component',
@ -82,6 +83,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
constructor(
// BaseFormEditor injected dependencies
public routerUtils: RouterUtilsService,
protected dialog: MatDialog,
protected language: TranslateService,
protected formService: FormService,

View File

@ -5,7 +5,7 @@
<!-- <div class="card mt-0" [style.display]="isVisible ? 'block' : 'none'"> -->
<!-- <a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a> -->
<div class="card-content info-text mb-0">
<p>{{'DESCRIPTION-LISTING.TEXT-INFO' | translate}} <u class="pointer" [routerLink]="['/explore-descriptions']">{{'DESCRIPTION-LISTING.LINK-PUBLIC-DATASETS' | translate}}</u> {{'DESCRIPTION-LISTING.TEXT-INFO-REST' | translate}}</p>
<p>{{'DESCRIPTION-LISTING.TEXT-INFO' | translate}} <u class="pointer" [routerLink]="routerUtils.generateUrl(['/explore-descriptions'])">{{'DESCRIPTION-LISTING.LINK-PUBLIC-DATASETS' | translate}}</u> {{'DESCRIPTION-LISTING.TEXT-INFO-REST' | translate}}</p>
<p class="mt-4 pt-2">{{'DESCRIPTION-LISTING.TEXT-INFO-PAR' | translate}}
<div class="d-flex">
<button mat-raised-button class="add-description align-self-center yellow-btn" (click)="addNewDescription()">

View File

@ -34,6 +34,7 @@ import { TranslateService } from '@ngx-translate/core';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { StartNewDescriptionDialogComponent } from '../start-new-description-dialog/start-new-description-dialog.component';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-description-listing-component',
@ -87,6 +88,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
}
constructor(
public routerUtils: RouterUtilsService,
private descriptionService: DescriptionService,
private router: Router,
private route: ActivatedRoute,

View File

@ -28,6 +28,7 @@ import { AppPermission } from '@app/core/common/enum/permission.enum';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-description-listing-item-component',
@ -53,6 +54,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
constructor(
public routerUtils: RouterUtilsService,
private router: Router,
public enumUtils: EnumUtils,
private descriptionService: DescriptionService,
@ -116,9 +118,8 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
return this.authService.currentAccountIsAuthenticated();
}
getItemLink(): string[] {
// return this.isPublic ? [`/descriptions/publicEdit/${this.description.id}`] : [`/descriptions/edit/${this.description.id}`];
return this.isPublic ? ['/explore-descriptions/overview/public/' + this.description.id] : ['/descriptions/overview/' + this.description.id];
getItemLink(): string {
return this.isPublic ? this.routerUtils.generateUrl(['/explore-descriptions/overview/public/', this.description.id.toString()]) : this.routerUtils.generateUrl(['/descriptions/overview/', this.description.id.toString()]);
}
getDmpLink(): string[] {

View File

@ -115,7 +115,7 @@
</ol>
<ul *ngIf="item.id && section.hasTemplates && canEditSection(section.id) && !formGroup.disabled" class="add-description-option">
<li>
<a class="add-description-action" [ngClass]="{'drag-handle-disabled': !hasDescriptionTemplates(section) || !hasValidMultiplicity(section)}" [routerLink]="hasDescriptionTemplates(section) && hasValidMultiplicity(section) ? ['/descriptions/edit/' + item.id + '/' + section.id] : null">
<a class="add-description-action" [ngClass]="{'drag-handle-disabled': !hasDescriptionTemplates(section) || !hasValidMultiplicity(section)}" [routerLink]="hasDescriptionTemplates(section) && hasValidMultiplicity(section) ? this.routerUtils.generateUrl(['/descriptions/edit/', item.id, '/', section.id]) : null">
<ng-container *ngIf="!hasDescriptionTemplates(section)" >
<mat-icon [matTooltipDisabled]="hasDescriptionTemplates(section)" [matTooltip]="'DMP-EDITOR.DESCRIPTION-TEMPLATES.EMPTY' | translate">add</mat-icon>{{'DMP-EDITOR.ACTIONS.ADD-DESCRIPTION-IN-SECTION' | translate}}
</ng-container>

View File

@ -53,6 +53,7 @@ import { Title } from '@angular/platform-browser';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { DmpContactPrefillDialogComponent } from '../dmp-contact-prefill-dialog/dmp-contact-prefill-dialog.component';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-dmp-editor',
@ -163,6 +164,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
public dmpBlueprintService: DmpBlueprintService,
// public visibilityRulesService: VisibilityRulesService,
private languageInfoService: LanguageInfoService,
public routerUtils: RouterUtilsService,
public enumUtils: EnumUtils,
public descriptionTemplateService: DescriptionTemplateService,
public userService: UserService,

View File

@ -1,5 +1,5 @@
<div class="dmp-card">
<a [routerLink]="isPublic ? ['/explore-plans/overview/public/' + dmp.id] : ['/plans/overview/' + dmp.id]" class="pointer">
<a [routerLink]="isPublic ? this.routerUtils.generateUrl(['/explore-plans/overview/public/', dmp.id]) : this.routerUtils.generateUrl(['/plans/overview/', dmp.id])" class="pointer">
<div class="d-flex flex-direction-row">
<div class="col-auto dmp-label">{{ 'DMP-LISTING.DMP' | translate }}</div>
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{ 'DMP-LISTING.EDITED' | translate }}: {{ dmp.updatedAt | dateTimeCultureFormatter: "d MMMM y" }}</div>
@ -25,11 +25,11 @@
<div class="col-auto dmp-dataset-descriptions-name" *ngIf="last || i == 2">{{description.label}}</div>
</div>
</div>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="dmp.descriptions?.length > 3" [routerLink]="isPublic ? ['/explore-plans/overview/public/' + dmp.id] : ['/plans/overview/' + dmp.id]"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
<a class="d-flex justify-content-center pb-3 show-more" *ngIf="dmp.descriptions?.length > 3" [routerLink]="isPublic ? this.routerUtils.generateUrl(['/explore-plans/overview/public/', dmp.id]) : this.routerUtils.generateUrl(['/plans/overview/', dmp.id])"><u>{{'GENERAL.ACTIONS.SHOW-MORE' | translate}}</u></a>
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" *ngIf="canExportDmp(dmp) && fileTransformerService.availableFormatsFor(fileTransformerEntityTypeEnum.Dmp).length > 0" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp) && canEditDmp(dmp)" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp) && canEditDmp(dmp)" [routerLink]="this.routerUtils.generateUrl(['/plans/edit/', dmp.id])" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DESCRIPTION-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="canInviteDmpUsers(dmp)" (click)="inviteToDmp()"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="canCloneDmp(dmp)" (click)="cloneClicked()"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="!isAuthenticated()" (click)="viewVersions(dmp)"><span class="material-icons icon-align pr-2">library_books</span>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}</a>

View File

@ -30,6 +30,7 @@ import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpDeleteDialogComponent } from '../../dmp-delete-dialog/dmp-delete-dialog.component';
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-dmp-listing-item-component',
@ -50,6 +51,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
fileTransformerEntityTypeEnum = FileTransformerEntityType;
constructor(
public routerUtils: RouterUtilsService,
private router: Router,
private dialog: MatDialog,
private authentication: AuthService,

View File

@ -117,7 +117,7 @@
<div class="row mb-4">
<ng-container *ngFor="let description of dmp.descriptions">
<div class="col-12 col-lg-7 mt-1">
<a class="w-100 description" [routerLink]="isPublicView ? ['/descriptions/overview/public/' + description.id] : ['/descriptions/overview/' + description.id]" target="_blank">
<a class="w-100 description" [routerLink]="isPublicView ? this.routerUtils.generateUrl(['/descriptions/overview/public/', description.id]) : this.routerUtils.generateUrl(['/descriptions/overview/' + description.id])" target="_blank">
<button class="w-100" [ngClass]="{'dmp-btn': description.status === descriptionStatusEnum.Draft, 'dmp-finalized-btn': description.status === descriptionStatusEnum.Finalized}">
<div matTooltip="{{ description.label }}" class="d-flex align-items-center justify-content-between">
<div class="description-btn-label">{{ description.label }}</div>
@ -131,12 +131,6 @@
<span class="material-icons">horizontal_rule</span>
</div>
</div>
<!-- <div class="row mt-2 add-description-txt" *ngIf="!isLocked">
<a class="add-description-btn" *ngIf="canEditDmp()" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank">
<mat-icon>add</mat-icon>
{{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}}
</a>
</div> -->
</div>
<div class="col-12 col-lg-4">
<ng-container *ngIf="!hasDoi(dmp)">

View File

@ -52,6 +52,7 @@ import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component';
import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component';
import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-version-dialog.component';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
@Component({
selector: 'app-dmp-overview',
@ -87,6 +88,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
userName: string;
constructor(
public routerUtils: RouterUtilsService,
private route: ActivatedRoute,
private router: Router,
private dmpService: DmpService,