From d89473046c2c725c9e1e8602b2a61221cc935892 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 29 Jun 2018 13:03:58 +0100 Subject: [PATCH] fix location link sorting (#473) --- e2e/components/data-table/data-table.ts | 2 +- .../custom-dl-row.component.html | 4 +-- .../favorites/favorites.component.html | 4 +-- .../location-link/location-link.component.ts | 26 +++++++++---------- .../recent-files/recent-files.component.html | 4 +-- .../shared-files/shared-files.component.html | 4 +-- .../trashcan/trashcan.component.html | 4 +-- 7 files changed, 23 insertions(+), 25 deletions(-) diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index 2939adebe..c8ec0d9c7 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -43,7 +43,7 @@ export class DataTable extends Component { row: '.adf-datatable-row[role]', selectedRow: '.adf-datatable-row.is-selected', cell: '.adf-data-table-cell', - locationLink: 'app-location-link', + locationLink: 'aca-location-link', selectedIcon: '.mat-icon', diff --git a/src/app/components/custom-dl-row/custom-dl-row.component.html b/src/app/components/custom-dl-row/custom-dl-row.component.html index 154a8f24b..be695e086 100644 --- a/src/app/components/custom-dl-row/custom-dl-row.component.html +++ b/src/app/components/custom-dl-row/custom-dl-row.component.html @@ -17,5 +17,5 @@ | {{ 'APP.BROWSE.SEARCH.CUSTOM_ROW.SIZE' | translate }}: {{ size | adfFileSize }} -
{{ 'APP.BROWSE.SEARCH.CUSTOM_ROW.LOCATION' | translate }}:
- \ No newline at end of file +
{{ 'APP.BROWSE.SEARCH.CUSTOM_ROW.LOCATION' | translate }}:
+ diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html index 9959a67e3..330b340d9 100644 --- a/src/app/components/favorites/favorites.component.html +++ b/src/app/components/favorites/favorites.component.html @@ -126,10 +126,10 @@ - + diff --git a/src/app/components/location-link/location-link.component.ts b/src/app/components/location-link/location-link.component.ts index ed23e74de..1f083351e 100644 --- a/src/app/components/location-link/location-link.component.ts +++ b/src/app/components/location-link/location-link.component.ts @@ -24,8 +24,7 @@ */ import { Component, Input, ChangeDetectionStrategy, OnInit, ViewEncapsulation } from '@angular/core'; -import { DataColumn, DataRow, DataTableAdapter } from '@alfresco/adf-core'; -import { PathInfoEntity, MinimalNodeEntity } from 'alfresco-js-api'; +import { PathInfo, MinimalNodeEntity } from 'alfresco-js-api'; import { Observable } from 'rxjs/Rx'; import { Store } from '@ngrx/store'; @@ -34,7 +33,7 @@ import { NavigateToParentFolder } from '../../store/actions'; import { ContentApiService } from '../../services/content-api.service'; @Component({ - selector: 'app-location-link', + selector: 'aca-location-link', template: ` {{ displayText | async }} @@ -42,7 +41,7 @@ import { ContentApiService } from '../../services/content-api.service'; `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, - host: { 'class': 'app-location-link adf-location-cell' } + host: { 'class': 'aca-location-link adf-location-cell' } }) export class LocationLinkComponent implements OnInit { @@ -72,21 +71,20 @@ export class LocationLinkComponent implements OnInit { ngOnInit() { if (this.context) { - const data: DataTableAdapter = this.context.data; - const col: DataColumn = this.context.col; - const row: DataRow = this.context.row; - const path: PathInfoEntity = data.getValue(row, col); - const value = path || this.context.row.node.entry.path; + const node: MinimalNodeEntity = this.context.row.node; + if (node && node.entry && node.entry.path) { + const path = node.entry.path; - if (value && value.name && value.elements) { - this.displayText = this.getDisplayText(value); - this.tooltip = this.getTooltip(value); + if (path && path.name && path.elements) { + this.displayText = this.getDisplayText(path); + this.tooltip = this.getTooltip(path); + } } } } // todo: review once 5.2.3 is out - private getDisplayText(path: PathInfoEntity): Observable { + private getDisplayText(path: PathInfo): Observable { const elements = path.elements.map(e => e.name); // for admin users @@ -122,7 +120,7 @@ export class LocationLinkComponent implements OnInit { } // todo: review once 5.2.3 is out - private getTooltip(path: PathInfoEntity): Observable { + private getTooltip(path: PathInfo): Observable { const elements = path.elements.map(e => Object.assign({}, e)); if (elements[0].name === 'Company Home') { diff --git a/src/app/components/recent-files/recent-files.component.html b/src/app/components/recent-files/recent-files.component.html index 67f5fea8c..0196a3a92 100644 --- a/src/app/components/recent-files/recent-files.component.html +++ b/src/app/components/recent-files/recent-files.component.html @@ -120,10 +120,10 @@ - + diff --git a/src/app/components/shared-files/shared-files.component.html b/src/app/components/shared-files/shared-files.component.html index 5d8fae5f7..29c92d2e1 100644 --- a/src/app/components/shared-files/shared-files.component.html +++ b/src/app/components/shared-files/shared-files.component.html @@ -125,10 +125,10 @@ - + diff --git a/src/app/components/trashcan/trashcan.component.html b/src/app/components/trashcan/trashcan.component.html index b9a6700d1..33406bf59 100644 --- a/src/app/components/trashcan/trashcan.component.html +++ b/src/app/components/trashcan/trashcan.component.html @@ -60,10 +60,10 @@ - +