mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
[ACA-1060] [Recent Files] Working copy is incorrectly displayed for a file locked for offline editing (#128)
-moved common code to PageComponent to avoid duplication -used the imageResolver and onNodeSelect on recent files also
This commit is contained in:
@@ -24,14 +24,13 @@
|
||||
*/
|
||||
|
||||
import { Observable, Subscription } from 'rxjs/Rx';
|
||||
import { Component, OnInit, OnDestroy, ViewChild, NgZone } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, NgZone } from '@angular/core';
|
||||
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElementEntity, NodePaging, PathElement } from 'alfresco-js-api';
|
||||
import {
|
||||
UploadService, FileUploadEvent, NodesApiService,
|
||||
ContentService, AlfrescoApiService, UserPreferencesService
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListComponent, ShareDataRow } from '@alfresco/adf-content-services';
|
||||
|
||||
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
@@ -43,8 +42,6 @@ import { PageComponent } from '../page.component';
|
||||
templateUrl: './files.component.html'
|
||||
})
|
||||
export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
@ViewChild(DocumentListComponent)
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
private routeData: any = {};
|
||||
isValidPath = true;
|
||||
@@ -147,7 +144,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
this.navigate(node.id);
|
||||
}
|
||||
|
||||
if (node.isLocked) {
|
||||
if (PageComponent.isLockedNode(node)) {
|
||||
event.preventDefault();
|
||||
|
||||
} else if (node.isFile) {
|
||||
@@ -158,33 +155,6 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onNodeSelect(event) {
|
||||
if (!!event.detail && !!event.detail.node) {
|
||||
|
||||
const node: MinimalNodeEntryEntity = event.detail.node.entry;
|
||||
if (node && node.isLocked) {
|
||||
this.unSelectLockedNodes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unSelectLockedNodes() {
|
||||
this.documentList.selection = this.documentList.selection.filter(item => !item.entry.isLocked);
|
||||
|
||||
const dataTable = this.documentList.dataTable;
|
||||
if (dataTable && dataTable.data) {
|
||||
const rows = dataTable.data.getRows();
|
||||
|
||||
if (rows && rows.length > 0) {
|
||||
rows.forEach(r => {
|
||||
if (r.getValue('isLocked')) {
|
||||
r.isSelected = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onBreadcrumbNavigate(route: PathElementEntity) {
|
||||
// todo: review this approach once 5.2.3 is out
|
||||
if (this.nodePath && this.nodePath.length > 2) {
|
||||
@@ -316,13 +286,4 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
imageResolver(row: ShareDataRow): string | null {
|
||||
const entry: MinimalNodeEntryEntity = row.node.entry;
|
||||
|
||||
if (entry.isLocked) {
|
||||
return '/assets/images/ic_lock_black_24dp_1x.png';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user