mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1794] Document List - users can see sites they are not members of (#2552)
* member sites * SitePaging type
This commit is contained in:
committed by
Eugenio Romano
parent
71e0204e01
commit
d019dab147
@@ -138,6 +138,27 @@
|
|||||||
"sortable": true
|
"sortable": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"-mysites-": [
|
||||||
|
{
|
||||||
|
"key": "$thumbnail",
|
||||||
|
"type": "image",
|
||||||
|
"srTitle": "ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL",
|
||||||
|
"sortable": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "title",
|
||||||
|
"type": "text",
|
||||||
|
"title": "ADF-DOCUMENT-LIST.LAYOUT.NAME",
|
||||||
|
"cssClass": "full-width ellipsis-cell",
|
||||||
|
"sortable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "visibility",
|
||||||
|
"type": "text",
|
||||||
|
"title": "ADF-DOCUMENT-LIST.LAYOUT.STATUS",
|
||||||
|
"sortable": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"-favorites-": [
|
"-favorites-": [
|
||||||
{
|
{
|
||||||
"key": "$thumbnail",
|
"key": "$thumbnail",
|
||||||
|
@@ -35,6 +35,7 @@ export class CustomSourcesComponent {
|
|||||||
{ title: 'Recent', value: '-recent-' },
|
{ title: 'Recent', value: '-recent-' },
|
||||||
{ title: 'Shared Links', value: '-sharedlinks-' },
|
{ title: 'Shared Links', value: '-sharedlinks-' },
|
||||||
{ title: 'Sites', value: '-sites-' },
|
{ title: 'Sites', value: '-sites-' },
|
||||||
|
{ title: 'My Sites', value: '-mysites-' },
|
||||||
{ title: 'Trashcan', value: '-trashcan-' },
|
{ title: 'Trashcan', value: '-trashcan-' },
|
||||||
{ title: 'Root', value: '-root-' },
|
{ title: 'Root', value: '-root-' },
|
||||||
{ title: 'My', value: '-my-' },
|
{ title: 'My', value: '-my-' },
|
||||||
|
@@ -157,6 +157,7 @@ The DocumentList component also provides support for the following reserved alia
|
|||||||
- `-trashcan-`,
|
- `-trashcan-`,
|
||||||
- `-sharedlinks-`
|
- `-sharedlinks-`
|
||||||
- `-sites-`
|
- `-sites-`
|
||||||
|
- `-mysites-`
|
||||||
- `-favorites-`
|
- `-favorites-`
|
||||||
- `-recent-`
|
- `-recent-`
|
||||||
|
|
||||||
@@ -230,6 +231,20 @@ Default layout:
|
|||||||
- Title
|
- Title
|
||||||
- Status
|
- Status
|
||||||
|
|
||||||
|
__My Sites__
|
||||||
|
|
||||||
|
```html
|
||||||
|
<adf-document-list
|
||||||
|
currentFolderId="-mysites-">
|
||||||
|
</adf-document-list>
|
||||||
|
```
|
||||||
|
|
||||||
|
Default layout:
|
||||||
|
|
||||||
|
- Icon
|
||||||
|
- Title
|
||||||
|
- Status
|
||||||
|
|
||||||
__Favorites__
|
__Favorites__
|
||||||
|
|
||||||
```html
|
```html
|
||||||
@@ -495,6 +510,7 @@ This column is used to display a clickable location link pointing to the parent
|
|||||||
You are going to use it with custom navigation or when displaying content from the sources like:
|
You are going to use it with custom navigation or when displaying content from the sources like:
|
||||||
|
|
||||||
- Sites
|
- Sites
|
||||||
|
- My Sites
|
||||||
- Shared Links
|
- Shared Links
|
||||||
- Recent Files
|
- Recent Files
|
||||||
- Favorites
|
- Favorites
|
||||||
|
@@ -892,7 +892,7 @@ describe('DocumentList', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not perform navigation for virtual sources', () => {
|
it('should not perform navigation for virtual sources', () => {
|
||||||
const sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-favorites-', '-recent-'];
|
const sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-mysites-', '-favorites-', '-recent-'];
|
||||||
const node = new FolderNode('folder');
|
const node = new FolderNode('folder');
|
||||||
|
|
||||||
documentList.currentFolderId = 'node-id';
|
documentList.currentFolderId = 'node-id';
|
||||||
@@ -927,6 +927,14 @@ describe('DocumentList', () => {
|
|||||||
expect(sitesApi.getSites).toHaveBeenCalled();
|
expect(sitesApi.getSites).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should fetch user membership sites', () => {
|
||||||
|
const peopleApi = apiService.getInstance().core.peopleApi;
|
||||||
|
spyOn(peopleApi, 'getSiteMembership').and.returnValue(Promise.resolve());
|
||||||
|
|
||||||
|
documentList.loadFolderByNodeId('-mysites-');
|
||||||
|
expect(peopleApi.getSiteMembership).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('should fetch favorites', () => {
|
it('should fetch favorites', () => {
|
||||||
const favoritesApi = apiService.getInstance().core.favoritesApi;
|
const favoritesApi = apiService.getInstance().core.favoritesApi;
|
||||||
spyOn(favoritesApi, 'getFavorites').and.returnValue(Promise.resolve(null));
|
spyOn(favoritesApi, 'getFavorites').and.returnValue(Promise.resolve(null));
|
||||||
|
@@ -19,7 +19,7 @@ import {
|
|||||||
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
|
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
|
||||||
OnChanges, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation
|
OnChanges, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { DeletedNodesPaging, MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging, Pagination, PersonEntry } from 'alfresco-js-api';
|
import { DeletedNodesPaging, MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging, Pagination, PersonEntry, SitePaging } from 'alfresco-js-api';
|
||||||
import { AlfrescoApiService, AppConfigService, DataColumnListComponent, UserPreferencesService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, AppConfigService, DataColumnListComponent, UserPreferencesService } from 'ng2-alfresco-core';
|
||||||
import { DataCellEvent, DataColumn, DataRowActionEvent, DataSorting, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable';
|
import { DataCellEvent, DataColumn, DataRowActionEvent, DataSorting, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable';
|
||||||
import { Observable, Subject } from 'rxjs/Rx';
|
import { Observable, Subject } from 'rxjs/Rx';
|
||||||
@@ -420,6 +420,8 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
this.loadSharedLinks();
|
this.loadSharedLinks();
|
||||||
} else if (nodeId === '-sites-') {
|
} else if (nodeId === '-sites-') {
|
||||||
this.loadSites();
|
this.loadSites();
|
||||||
|
} else if (nodeId === '-mysites-') {
|
||||||
|
this.loadMemberSites();
|
||||||
} else if (nodeId === '-favorites-') {
|
} else if (nodeId === '-favorites-') {
|
||||||
this.loadFavorites();
|
this.loadFavorites();
|
||||||
} else if (nodeId === '-recent-') {
|
} else if (nodeId === '-recent-') {
|
||||||
@@ -513,6 +515,28 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private loadMemberSites(): void {
|
||||||
|
const options = {
|
||||||
|
include: [ 'properties' ],
|
||||||
|
maxItems: this.pageSize,
|
||||||
|
skipCount: this.skipCount
|
||||||
|
};
|
||||||
|
|
||||||
|
this.apiService.peopleApi.getSiteMembership('-me-', options).then((result: SitePaging) => {
|
||||||
|
let page: NodePaging = {
|
||||||
|
list: {
|
||||||
|
entries: result.list.entries
|
||||||
|
.map(({ entry: { site }}: any) => ({
|
||||||
|
entry: site
|
||||||
|
})),
|
||||||
|
pagination: result.list.pagination
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onPageLoaded(page);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private loadFavorites(): void {
|
private loadFavorites(): void {
|
||||||
const options = {
|
const options = {
|
||||||
maxItems: this.pageSize,
|
maxItems: this.pageSize,
|
||||||
@@ -773,7 +797,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
}
|
}
|
||||||
|
|
||||||
isCustomSource(folderId: string): boolean {
|
isCustomSource(folderId: string): boolean {
|
||||||
const sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-favorites-', '-recent-'];
|
const sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-mysites-', '-favorites-', '-recent-'];
|
||||||
|
|
||||||
if (sources.indexOf(folderId) > -1) {
|
if (sources.indexOf(folderId) > -1) {
|
||||||
return true;
|
return true;
|
||||||
|
@@ -78,6 +78,27 @@ export let presetsDefaultModel = {
|
|||||||
sortable: true
|
sortable: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
'-mysites-': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'title',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'visibility',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.STATUS',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
'-favorites-': [
|
'-favorites-': [
|
||||||
{
|
{
|
||||||
key: '$thumbnail',
|
key: '$thumbnail',
|
||||||
|
Reference in New Issue
Block a user