MNT-21595- Fetch all the groups (#1527)

* Fix constructor

* Use latest of ADF

* Call the groupService to fetch all
This commit is contained in:
Maurizio Vitale 2020-07-20 20:29:31 +01:00 committed by GitHub
parent b0a4ec3841
commit cd3e0012ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1212 additions and 2393 deletions

3577
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -32,10 +32,10 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "3.10.0-d1672596bad1cd90940de9499e24791801dc9011", "@alfresco/adf-content-services": "3.10.0-44c5472fa25d6c22226c8a86a332c3ea5bcfa359",
"@alfresco/adf-core": "3.10.0-d1672596bad1cd90940de9499e24791801dc9011", "@alfresco/adf-core": "3.10.0-44c5472fa25d6c22226c8a86a332c3ea5bcfa359",
"@alfresco/adf-extensions": "3.10.0-d1672596bad1cd90940de9499e24791801dc9011", "@alfresco/adf-extensions": "3.10.0-44c5472fa25d6c22226c8a86a332c3ea5bcfa359",
"@alfresco/js-api": "3.10.0-1deb4e85760f96f550a7d6d894e4002ecd4a4c18", "@alfresco/js-api": "3.10.0-c1ad5d79a257f31a52ffd327022458da7926c211",
"@angular-custom-builders/lite-serve": "0.2.2", "@angular-custom-builders/lite-serve": "0.2.2",
"@angular/animations": "10.0.4", "@angular/animations": "10.0.4",
"@angular/cdk": "^10.0.2", "@angular/cdk": "^10.0.2",
@ -66,8 +66,8 @@
"zone.js": "~0.10.2" "zone.js": "~0.10.2"
}, },
"devDependencies": { "devDependencies": {
"@alfresco/adf-cli": "3.10.0-270020f56129a0dab3b9461df1e1f01dde75760f", "@alfresco/adf-cli": "3.10.0-44c5472fa25d6c22226c8a86a332c3ea5bcfa359",
"@alfresco/adf-testing": "3.10.0-6001ff801e211e8385966d2f2b773e59b4667dd9", "@alfresco/adf-testing": "3.10.0-44c5472fa25d6c22226c8a86a332c3ea5bcfa359",
"@angular-devkit/build-angular": "~0.1000.3", "@angular-devkit/build-angular": "~0.1000.3",
"@angular-devkit/build-ng-packagr": "~0.1000.3", "@angular-devkit/build-ng-packagr": "~0.1000.3",
"@angular/cli": "^10.0.3", "@angular/cli": "^10.0.3",

View File

@ -60,7 +60,7 @@ describe('AppComponent', () => {
router = TestBed.inject(Router); router = TestBed.inject(Router);
component = new AppComponent(null, router, null, storeMock, configMock, null, null, null, null, null, null, null, storageMock); component = new AppComponent(null, router, null, storeMock, configMock, null, null, null, null, null, null, null, storageMock, null);
storeMock.dispatch = jasmine.createSpy('dispatch'); storeMock.dispatch = jasmine.createSpy('dispatch');
}); });

View File

@ -33,6 +33,7 @@ import {
SharedLinksApiService, SharedLinksApiService,
StorageService StorageService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { GroupService } from '@alfresco/adf-content-services';
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router, ActivationEnd } from '@angular/router'; import { ActivatedRoute, Router, ActivationEnd } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@ -48,7 +49,7 @@ import {
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { filter, takeUntil } from 'rxjs/operators'; import { filter, takeUntil } from 'rxjs/operators';
import { AppExtensionService, AppService, ContentApiService, ExtensionRoute } from '@alfresco/aca-shared'; import { AppExtensionService, AppService, ContentApiService, ExtensionRoute } from '@alfresco/aca-shared';
import { DiscoveryEntry, GroupsApi, Group } from '@alfresco/js-api'; import { DiscoveryEntry, GroupEntry, Group } from '@alfresco/js-api';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { INITIAL_APP_STATE } from './store/initial-state'; import { INITIAL_APP_STATE } from './store/initial-state';
@ -74,7 +75,8 @@ export class AppComponent implements OnInit, OnDestroy {
private contentApi: ContentApiService, private contentApi: ContentApiService,
private appService: AppService, private appService: AppService,
private sharedLinksApiService: SharedLinksApiService, private sharedLinksApiService: SharedLinksApiService,
private storage: StorageService private storage: StorageService,
private groupService: GroupService
) {} ) {}
ngOnInit() { ngOnInit() {
@ -163,12 +165,12 @@ export class AppComponent implements OnInit, OnDestroy {
} }
private async loadUserProfile() { private async loadUserProfile() {
const groupsApi = new GroupsApi(this.alfrescoApiService.getInstance()); const groupsEntries: GroupEntry[] = await this.groupService.listAllGroupMembershipsForPerson('-me-', { maxItems: 250 });
const paging = await groupsApi.listGroupMembershipsForPerson('-me-');
const groups: Group[] = []; const groups: Group[] = [];
if (paging && paging.list && paging.list.entries) { if (groupsEntries) {
groups.push(...paging.list.entries.map((obj) => obj.entry)); groups.push(...groupsEntries.map((obj) => obj.entry));
} }
this.contentApi.getPerson('-me-').subscribe((person) => { this.contentApi.getPerson('-me-').subscribe((person) => {