[ACA-3492] ADF - Expose new Groups Endpoints (#5893)

* [ACA-3492] ADF - Expose new Groups Endpoints

* * docs added

* * fix ut

* unit test split cloud

* Update data-table-component.page.ts

* unit test split cloud

Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
dhrn 2020-07-22 15:50:07 +05:30 committed by GitHub
parent 7b1da04f77
commit a5972e753a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 243 additions and 39 deletions

View File

@ -67,8 +67,11 @@ jobs:
name: Unit test core extension demo name: Unit test core extension demo
script: ./scripts/travis/unit-test/core-extension.sh script: ./scripts/travis/unit-test/core-extension.sh
- stage: Unit test - stage: Unit test
name: Unit test process process-cloud insights name: Unit test process insights
script: ./scripts/travis/unit-test/process.sh script: ./scripts/travis/unit-test/process.sh
- stage: Unit test
name: Unit test process-cloud
script: ./scripts/travis/unit-test/process-cloud.sh
- stage: Update Children Projects - stage: Update Children Projects

View File

@ -13,28 +13,38 @@ Accesses and manipulates sites from a Content Services repository.
### Methods ### Methods
- **approveSiteMembershipRequest**(siteId: `string`, inviteeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`|__type>`<br/> - **approveSiteMembershipRequest**(siteId: `string`, inviteeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`>`<br/>
Accept site membership requests. Accept site membership requests.
- _siteId:_ `string` - The identifier of a site. - _siteId:_ `string` - The identifier of a site.
- _inviteeId:_ `string` - The invitee user name. - _inviteeId:_ `string` - The invitee user name.
- _opts:_ `any` - (Optional) Options supported by JS-API - _opts:_ `any` - (Optional) Options supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`|__type>` - Null response notifying when the operation is complete - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`>` - Null response notifying when the operation is complete
- **createSiteMembership**(siteId: `string`, siteMembershipBodyCreate: [`SiteMembershipBodyCreate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyCreate.ts), opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`|__type>`<br/> - **createSiteGroupMembership**(siteId: `string`, siteMembershipBodyCreate: [`SiteMembershipBodyCreate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyCreate.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupEntry.ts)`>`<br/>
Create a site membership for group
- _siteId:_ `string` - The identifier of a site.
- _siteMembershipBodyCreate:_ [`SiteMembershipBodyCreate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyCreate.ts) - The Group to add and its role
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupEntry.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteGroupEntry>
- **createSiteMembership**(siteId: `string`, siteMembershipBodyCreate: [`SiteMembershipBodyCreate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyCreate.ts), opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`>`<br/>
Creates a site membership for person **personId** on site **siteId**. Creates a site membership for person **personId** on site **siteId**.
- _siteId:_ `string` - The identifier of a site - _siteId:_ `string` - The identifier of a site
- _siteMembershipBodyCreate:_ [`SiteMembershipBodyCreate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyCreate.ts) - The person to add and their role - _siteMembershipBodyCreate:_ [`SiteMembershipBodyCreate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyCreate.ts) - The person to add and their role
- _opts:_ `any` - (Optional) Optional parameters - _opts:_ `any` - (Optional) Optional parameters
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`|__type>` - Site member entry - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteMemberEntry>
- **deleteSite**(siteId: `string`, permanentFlag: `boolean` = `true`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/> - **deleteSite**(siteId: `string`, permanentFlag: `boolean` = `true`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Deletes a site. Deletes a site.
- _siteId:_ `string` - Site to delete - _siteId:_ `string` - Site to delete
- _permanentFlag:_ `boolean` - True: deletion is permanent; False: site is moved to the trash - _permanentFlag:_ `boolean` - True: deletion is permanent; False: site is moved to the trash
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response notifying when the operation is complete - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response notifying when the operation is complete
- **deleteSiteMembership**(siteId: `string`, personId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/> - **deleteSiteGroupMembership**(siteId: `string`, groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<void>`<br/>
Delete a group membership for site
- _siteId:_ `string` - The identifier of a site.
- _groupId:_ `string` - The authorityId of a group.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<void>` - [`Observable`](http://reactivex.io/documentation/observable.html)&lt;void>
- **deleteSiteMembership**(siteId: `string`, personId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<void>`<br/>
Delete a site membership Delete a site membership
- _siteId:_ `string` - The identifier of a site. - _siteId:_ `string` - The identifier of a site.
- _personId:_ `string` - The identifier of a person. - _personId:_ `string` - The identifier of a person.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response notifying when the operation is complete - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<void>` - Null response notifying when the operation is complete
- **getEcmCurrentLoggedUserName**(): `string`<br/> - **getEcmCurrentLoggedUserName**(): `string`<br/>
Gets the username of the user currently logged into ACS. Gets the username of the user currently logged into ACS.
- **Returns** `string` - Username string - **Returns** `string` - Username string
@ -47,14 +57,19 @@ Accesses and manipulates sites from a Content Services repository.
Gets a site's content. Gets a site's content.
- _siteId:_ `string` - ID of the target site - _siteId:_ `string` - ID of the target site
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site content - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site content
- **getSiteGroupMembership**(siteId: `string`, groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupEntry.ts)`>`<br/>
Get information about site membership of group
- _siteId:_ `string` - The identifier of a site.
- _groupId:_ `string` - The authorityId of a group.
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupEntry.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteGroupEntry>
- **getSiteMembers**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`<br/> - **getSiteMembers**(siteId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>`<br/>
Gets a list of all a site's members. Gets a list of all a site's members.
- _siteId:_ `string` - ID of the target site - _siteId:_ `string` - ID of the target site
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site members - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SiteEntry.md)`|__type>` - Site members
- **getSiteMembershipRequests**(opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`|__type>`<br/> - **getSiteMembershipRequests**(opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`>`<br/>
Gets a list of site membership requests. Gets a list of site membership requests.
- _opts:_ `any` - (Optional) Options supported by JS-API - _opts:_ `any` - (Optional) Options supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`|__type>` - Site membership requests - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`>` - Site membership requests
- **getSiteNameFromNodePath**(node: [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md)): `string`<br/> - **getSiteNameFromNodePath**(node: [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md)): `string`<br/>
Looks for a site inside the path of a [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) and returns its guid if it finds one. (return an empty string if no site is found) Looks for a site inside the path of a [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) and returns its guid if it finds one. (return an empty string if no site is found)
- _node:_ [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to look for parent site - _node:_ [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to look for parent site
@ -63,19 +78,35 @@ Accesses and manipulates sites from a Content Services repository.
Gets a list of all sites in the repository. Gets a list of all sites in the repository.
- _opts:_ `any` - Options supported by JS-API - _opts:_ `any` - Options supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md)`>` - List of sites - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SitePaging`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/SitePaging.md)`>` - List of sites
- **rejectSiteMembershipRequest**(siteId: `string`, inviteeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`|__type>`<br/> - **listSiteGroups**(siteId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupPaging.ts)`>`<br/>
List group membership for site
- _siteId:_ `string` - The identifier of a site.
- _opts:_ `any` - (Optional) Options supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupPaging.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteGroupPaging>
- **listSiteMemberships**(siteId: `string`, opts: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberPaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/SiteMemberPaging.md)`>`<br/>
Gets a list of all a site's members.
- _siteId:_ `string` - ID of the target site
- _opts:_ `any` - Optional parameters supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberPaging`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/SiteMemberPaging.md)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteMemberPaging>
- **rejectSiteMembershipRequest**(siteId: `string`, inviteeId: `string`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`>`<br/>
Reject site membership requests. Reject site membership requests.
- _siteId:_ `string` - The identifier of a site. - _siteId:_ `string` - The identifier of a site.
- _inviteeId:_ `string` - The invitee user name. - _inviteeId:_ `string` - The invitee user name.
- _opts:_ `any` - (Optional) Options supported by JS-API - _opts:_ `any` - (Optional) Options supported by JS-API
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`|__type>` - Null response notifying when the operation is complete - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMembershipRequestWithPersonPaging`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipRequestWithPersonPaging.ts)`>` - Null response notifying when the operation is complete
- **updateSiteMembership**(siteId: `string`, personId: `string`, siteMembershipBodyUpdate: [`SiteMembershipBodyUpdate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyUpdate.ts), opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`|__type>`<br/> - **updateSiteGroupMembership**(siteId: `string`, groupId: `string`, siteMembershipBodyUpdate: [`SiteMembershipBodyUpdate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyUpdate.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupEntry.ts)`>`<br/>
Update site membership of group
- _siteId:_ `string` - The identifier of a site.
- _groupId:_ `string` - The authorityId of a group.
- _siteMembershipBodyUpdate:_ [`SiteMembershipBodyUpdate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyUpdate.ts) - The group new role
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteGroupEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteGroupEntry.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteGroupEntry>
- **updateSiteMembership**(siteId: `string`, personId: `string`, siteMembershipBodyUpdate: [`SiteMembershipBodyUpdate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyUpdate.ts), opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`>`<br/>
Update a site membership Update a site membership
- _siteId:_ `string` - The identifier of a site. - _siteId:_ `string` - The identifier of a site.
- _personId:_ `string` - The identifier of a person. - _personId:_ `string` - The identifier of a person.
- _siteMembershipBodyUpdate:_ [`SiteMembershipBodyUpdate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyUpdate.ts) - The persons new role - _siteMembershipBodyUpdate:_ [`SiteMembershipBodyUpdate`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMembershipBodyUpdate.ts) - The persons new role
- _opts:_ `any` - (Optional) Optional parameters - _opts:_ `any` - (Optional) Optional parameters
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`|__type>` - Site member entry> - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`SiteMemberEntry`](../../../node_modules/@alfresco/js-api/src/api/content-rest-api/model/siteMemberEntry.ts)`>` - [Observable](http://reactivex.io/documentation/observable.html)&lt;SiteMemberEntry>
## Details ## Details

View File

@ -21,6 +21,8 @@ import { UserProcessModel } from '../models/user-process.model';
import { EcmUserModel } from '../models/ecm-user.model'; import { EcmUserModel } from '../models/ecm-user.model';
import { IdentityUserModel } from '../models/identity-user.model'; import { IdentityUserModel } from '../models/identity-user.model';
export type User = (EcmUserModel | UserProcessModel | IdentityUserModel) & { displayName?: string };
@Pipe({ @Pipe({
name: 'usernameInitials' name: 'usernameInitials'
}) })
@ -29,10 +31,10 @@ export class InitialUsernamePipe implements PipeTransform {
constructor(private sanitized: DomSanitizer) { constructor(private sanitized: DomSanitizer) {
} }
transform(user: UserProcessModel | EcmUserModel | IdentityUserModel, className: string = '', delimiter: string = ''): SafeHtml { transform(user: User, className: string = '', delimiter: string = ''): SafeHtml {
let safeHtml: SafeHtml = ''; let safeHtml: SafeHtml = '';
if (user) { if (user) {
const initialResult = this.getInitialUserName(user.firstName, user.lastName, delimiter); const initialResult = this.getInitialUserName(user.firstName || user.displayName, user.lastName, delimiter);
safeHtml = this.sanitized.bypassSecurityTrustHtml(`<div id="user-initials-image" class="${className}">${initialResult}</div>`); safeHtml = this.sanitized.bypassSecurityTrustHtml(`<div id="user-initials-image" class="${className}">${initialResult}</div>`);
} }
return safeHtml; return safeHtml;

View File

@ -16,9 +16,19 @@
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs'; import { from, Observable, throwError } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service'; import { AlfrescoApiService } from './alfresco-api.service';
import { SitePaging, SiteEntry, MinimalNode, SitesApi, SiteMembershipRequestWithPersonPaging, SiteMembershipBodyCreate, SiteMemberEntry, SiteMembershipBodyUpdate } from '@alfresco/js-api'; import {
MinimalNode,
SiteEntry, SiteGroupEntry, SiteGroupPaging,
SiteMemberEntry,
SiteMemberPaging,
SiteMembershipBodyCreate,
SiteMembershipBodyUpdate,
SiteMembershipRequestWithPersonPaging,
SitePaging,
SitesApi
} from '@alfresco/js-api';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
@Injectable({ @Injectable({
@ -95,6 +105,16 @@ export class SitesService {
return this.getSite(siteId, { relations: ['members'] }); return this.getSite(siteId, { relations: ['members'] });
} }
/**
* Gets a list of all a site's members.
* @param siteId ID of the target site
* @param opts Optional parameters supported by JS-API
* @returns Observable<SiteMemberPaging>
*/
listSiteMemberships(siteId: string, opts: any): Observable<SiteMemberPaging> {
return from(this.sitesApi.listSiteMemberships(siteId, opts));
}
/** /**
* Gets the username of the user currently logged into ACS. * Gets the username of the user currently logged into ACS.
* @returns Username string * @returns Username string
@ -126,7 +146,7 @@ export class SitesService {
* @param opts Options supported by JS-API * @param opts Options supported by JS-API
* @returns Site membership requests * @returns Site membership requests
*/ */
getSiteMembershipRequests(opts?: any): Observable<SiteMembershipRequestWithPersonPaging | {}> { getSiteMembershipRequests(opts?: any): Observable<SiteMembershipRequestWithPersonPaging> {
return from(this.sitesApi.getSiteMembershipRequests(opts)) return from(this.sitesApi.getSiteMembershipRequests(opts))
.pipe( .pipe(
catchError((err: any) => this.handleError(err)) catchError((err: any) => this.handleError(err))
@ -138,9 +158,9 @@ export class SitesService {
* @param siteId The identifier of a site * @param siteId The identifier of a site
* @param siteMembershipBodyCreate The person to add and their role * @param siteMembershipBodyCreate The person to add and their role
* @param opts Optional parameters * @param opts Optional parameters
* @return Site member entry * @return Observable<SiteMemberEntry>
*/ */
createSiteMembership(siteId: string, siteMembershipBodyCreate: SiteMembershipBodyCreate, opts?: any): Observable<SiteMemberEntry | {}> { createSiteMembership(siteId: string, siteMembershipBodyCreate: SiteMembershipBodyCreate, opts?: any): Observable<SiteMemberEntry> {
return from(this.sitesApi.createSiteMembership(siteId, siteMembershipBodyCreate, opts)) return from(this.sitesApi.createSiteMembership(siteId, siteMembershipBodyCreate, opts))
.pipe( .pipe(
catchError((err: any) => this.handleError(err)) catchError((err: any) => this.handleError(err))
@ -153,9 +173,9 @@ export class SitesService {
* @param personId The identifier of a person. * @param personId The identifier of a person.
* @param siteMembershipBodyUpdate The persons new role * @param siteMembershipBodyUpdate The persons new role
* @param opts Optional parameters * @param opts Optional parameters
* @return Site member entry> * @return Observable<SiteMemberEntry>
*/ */
updateSiteMembership(siteId: string, personId: string, siteMembershipBodyUpdate: SiteMembershipBodyUpdate, opts?: any): Observable<SiteMemberEntry | {}> { updateSiteMembership(siteId: string, personId: string, siteMembershipBodyUpdate: SiteMembershipBodyUpdate, opts?: any): Observable<SiteMemberEntry> {
return from(this.sitesApi.updateSiteMembership(siteId, personId, siteMembershipBodyUpdate, opts)) return from(this.sitesApi.updateSiteMembership(siteId, personId, siteMembershipBodyUpdate, opts))
.pipe( .pipe(
catchError((err: any) => this.handleError(err)) catchError((err: any) => this.handleError(err))
@ -168,7 +188,7 @@ export class SitesService {
* @param personId The identifier of a person. * @param personId The identifier of a person.
* @return Null response notifying when the operation is complete * @return Null response notifying when the operation is complete
*/ */
deleteSiteMembership(siteId: string, personId: string): Observable<any> { deleteSiteMembership(siteId: string, personId: string): Observable<void> {
return from(this.sitesApi.deleteSiteMembership(siteId, personId)) return from(this.sitesApi.deleteSiteMembership(siteId, personId))
.pipe( .pipe(
catchError((err: any) => this.handleError(err)) catchError((err: any) => this.handleError(err))
@ -182,7 +202,7 @@ export class SitesService {
* @param opts Options supported by JS-API * @param opts Options supported by JS-API
* @returns Null response notifying when the operation is complete * @returns Null response notifying when the operation is complete
*/ */
approveSiteMembershipRequest(siteId: string, inviteeId: string, opts?: any): Observable<SiteMembershipRequestWithPersonPaging | {}> { approveSiteMembershipRequest(siteId: string, inviteeId: string, opts?: any): Observable<SiteMembershipRequestWithPersonPaging> {
return from(this.sitesApi.approveSiteMembershipRequest(siteId, inviteeId, opts)) return from(this.sitesApi.approveSiteMembershipRequest(siteId, inviteeId, opts))
.pipe( .pipe(
catchError((err: any) => this.handleError(err)) catchError((err: any) => this.handleError(err))
@ -196,14 +216,80 @@ export class SitesService {
* @param opts Options supported by JS-API * @param opts Options supported by JS-API
* @returns Null response notifying when the operation is complete * @returns Null response notifying when the operation is complete
*/ */
rejectSiteMembershipRequest(siteId: string, inviteeId: string, opts?: any): Observable<SiteMembershipRequestWithPersonPaging | {}> { rejectSiteMembershipRequest(siteId: string, inviteeId: string, opts?: any): Observable<SiteMembershipRequestWithPersonPaging> {
return from(this.sitesApi.rejectSiteMembershipRequest(siteId, inviteeId, opts)) return from(this.sitesApi.rejectSiteMembershipRequest(siteId, inviteeId, opts))
.pipe( .pipe(
catchError((err: any) => this.handleError(err)) catchError((err: any) => this.handleError(err))
); );
} }
private handleError(error: any): any { /**
* List group membership for site
* @param siteId The identifier of a site.
* @param opts Options supported by JS-API
* @returns Observable<SiteGroupPaging>
*/
listSiteGroups(siteId: string, opts?: any): Observable<SiteGroupPaging> {
return from(this.sitesApi.listSiteGroups(siteId, opts))
.pipe(
catchError((err: any) => this.handleError(err))
);
}
/**
* Create a site membership for group
* @param siteId The identifier of a site.
* @param siteMembershipBodyCreate The Group to add and its role
* @returns Observable<SiteGroupEntry>
*/
createSiteGroupMembership(siteId: string, siteMembershipBodyCreate: SiteMembershipBodyCreate): Observable<SiteGroupEntry> {
return from(this.sitesApi.createSiteGroupMembership(siteId, siteMembershipBodyCreate))
.pipe(
catchError((err: any) => this.handleError(err))
);
}
/**
* Get information about site membership of group
* @param siteId The identifier of a site.
* @param groupId The authorityId of a group.
* @return Observable<SiteGroupEntry>
*/
getSiteGroupMembership(siteId: string, groupId: string): Observable<SiteGroupEntry> {
return from(this.sitesApi.getSiteGroupMembership(siteId, groupId))
.pipe(
catchError((err: any) => this.handleError(err))
);
}
/**
* Update site membership of group
* @param siteId The identifier of a site.
* @param groupId The authorityId of a group.
* @param siteMembershipBodyUpdate The group new role
* @return Observable<SiteGroupEntry>
*/
updateSiteGroupMembership(siteId: string, groupId: string, siteMembershipBodyUpdate: SiteMembershipBodyUpdate): Observable<SiteGroupEntry> {
return from(this.sitesApi.updateSiteGroupMembership(siteId, groupId, siteMembershipBodyUpdate))
.pipe(
catchError((err: any) => this.handleError(err))
);
}
/**
* Delete a group membership for site
* @param siteId The identifier of a site.
* @param groupId The authorityId of a group.
* @return Observable<void>
*/
deleteSiteGroupMembership(siteId: string, groupId: string): Observable<void> {
return from(this.sitesApi.deleteSiteGroupMembership(siteId, groupId))
.pipe(
catchError((err: any) => this.handleError(err))
);
}
private handleError(error: any): Observable<never> {
console.error(error); console.error(error);
return throwError(error || 'Server error'); return throwError(error || 'Server error');
} }

View File

@ -88,4 +88,13 @@ export class DocumentListPage {
async doubleClickRow(nodeName: string): Promise<void> { async doubleClickRow(nodeName: string): Promise<void> {
await this.dataTable.doubleClickRow('Display name', nodeName); await this.dataTable.doubleClickRow('Display name', nodeName);
} }
async isItemPresent(name: string): Promise<boolean> {
return this.dataTable.getRow('Display name', name).isPresent();
}
async getLibraryRole(name: string): Promise<string> {
return this.dataTable.getRow('Display name', name).element(by.css('adf-library-role-column')).getText();
}
} }

View File

@ -31,6 +31,9 @@ export class DataTableComponentPage {
allSelectedRows: ElementArrayFinder; allSelectedRows: ElementArrayFinder;
selectAll: ElementFinder; selectAll: ElementFinder;
copyColumnTooltip: ElementFinder; copyColumnTooltip: ElementFinder;
emptyList: ElementFinder;
emptyListTitle: ElementFinder;
emptyListSubtitle: ElementFinder;
constructor(rootElement = element.all(by.css('adf-datatable')).first()) { constructor(rootElement = element.all(by.css('adf-datatable')).first()) {
this.rootElement = rootElement; this.rootElement = rootElement;
@ -42,6 +45,9 @@ export class DataTableComponentPage {
this.allSelectedRows = this.rootElement.all(by.css(`adf-datatable-row[class*='is-selected']`)); this.allSelectedRows = this.rootElement.all(by.css(`adf-datatable-row[class*='is-selected']`));
this.selectAll = this.rootElement.element(by.css(`div[class*='adf-datatable-header'] mat-checkbox`)); this.selectAll = this.rootElement.element(by.css(`div[class*='adf-datatable-header'] mat-checkbox`));
this.copyColumnTooltip = this.rootElement.element(by.css(`adf-copy-content-tooltip span`)); this.copyColumnTooltip = this.rootElement.element(by.css(`adf-copy-content-tooltip span`));
this.emptyList = this.rootElement.element(by.css(`div.adf-no-content-container`));
this.emptyListTitle = this.rootElement.element(by.css(`.adf-empty-content__title`));
this.emptyListSubtitle = this.rootElement.element(by.css(`.adf-empty-content__subtitle`));
} }
async checkAllRowsButtonIsDisplayed(): Promise<void> { async checkAllRowsButtonIsDisplayed(): Promise<void> {
@ -372,4 +378,50 @@ export class DataTableComponentPage {
async clickColumn(columnName: string, columnValue: string): Promise<void> { async clickColumn(columnName: string, columnValue: string): Promise<void> {
await BrowserActions.clickExecuteScript(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`); await BrowserActions.clickExecuteScript(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`);
} }
async selectMultipleItems(names: string[]): Promise<void> {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
for (const name of names) {
await this.selectRowByContent(name);
}
await this.clearSelection();
}
async clearSelection(): Promise<void> {
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async getEmptyListText(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.rootElement.by.css('adf-custom-empty-content-template').getText();
}
return '';
}
async isEmpty(): Promise<boolean> {
return this.emptyList.isPresent();
}
async waitForEmptyState(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.tableBody.element(this.emptyList));
}
async getEmptyStateTitle(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.emptyListTitle.getText();
}
return '';
}
async getEmptyStateSubtitle(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.emptyListSubtitle.getText();
}
return '';
}
} }

6
package-lock.json generated
View File

@ -38,9 +38,9 @@
} }
}, },
"@alfresco/js-api": { "@alfresco/js-api": {
"version": "3.10.0-c1ad5d79a257f31a52ffd327022458da7926c211", "version": "3.10.0-c621b4be54d06caacc33c4bd8a23256c04a5523b",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.10.0-c1ad5d79a257f31a52ffd327022458da7926c211.tgz", "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.10.0-c621b4be54d06caacc33c4bd8a23256c04a5523b.tgz",
"integrity": "sha512-uGwCzNddEJYv9ZDME4cLqxc7Vam6CqK9ueMSz7pacIT1wHqoc5Y5XnON0zziL5msvRxVq1WMKu76QrF53OmJ3w==", "integrity": "sha512-EGofvx28Wb3JuQyL2akE3AEgegfAmJjb2WRI8hh0RbmCfFVVvgchj66n5qxrZmzxdfGZtCSqM11/EFv99DnGeA==",
"requires": { "requires": {
"event-emitter": "^0.3.5", "event-emitter": "^0.3.5",
"minimatch": "3.0.4", "minimatch": "3.0.4",

View File

@ -71,6 +71,7 @@
"process services-cloud" "process services-cloud"
], ],
"dependencies": { "dependencies": {
"@alfresco/js-api": "3.10.0-c621b4be54d06caacc33c4bd8a23256c04a5523b",
"@alfresco/js-api": "3.10.0-c1ad5d79a257f31a52ffd327022458da7926c211", "@alfresco/js-api": "3.10.0-c1ad5d79a257f31a52ffd327022458da7926c211",
"@angular/animations": "^10.0.4", "@angular/animations": "^10.0.4",
"@angular/cdk": "10.0.2", "@angular/cdk": "10.0.2",

View File

@ -6,7 +6,9 @@ cd $DIR/../../../
ng test content-services --watch=false || exit 1; ng test content-services --watch=false || exit 1;
# echo "================== content-services unit ===================" echo "================== AFFECTED_LIBS ${AFFECTED_LIBS} ==================="
echo "================== content-services unit ==================="
AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)" AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)"
if [[ $AFFECTED_LIBS =~ "content-services" || "${TRAVIS_EVENT_TYPE}" == "push" ]]; if [[ $AFFECTED_LIBS =~ "content-services" || "${TRAVIS_EVENT_TYPE}" == "push" ]];
@ -14,4 +16,4 @@ then
ng test content-services --watch=false || exit 1; ng test content-services --watch=false || exit 1;
fi; fi;
# bash <(curl -s https://codecov.io/bash) -X gcov bash <(curl -s https://codecov.io/bash) -X gcov

View File

@ -7,6 +7,8 @@ cd $DIR/../../../
AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)" AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)"
echo "================== AFFECTED_LIBS ${AFFECTED_LIBS} ==================="
echo "================== core unit ===================" echo "================== core unit ==================="
if [[ $AFFECTED_LIBS =~ "core" || "${TRAVIS_EVENT_TYPE}" == "push" ]]; if [[ $AFFECTED_LIBS =~ "core" || "${TRAVIS_EVENT_TYPE}" == "push" ]];
@ -21,4 +23,4 @@ then
ng test extensions --watch=false || exit 1; ng test extensions --watch=false || exit 1;
fi; fi;
# bash <(curl -s https://codecov.io/bash) -X gcov bash <(curl -s https://codecov.io/bash) -X gcov

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
command="concurrently "
cd $DIR/../../../
AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)"
echo "================== AFFECTED_LIBS ${AFFECTED_LIBS} ==================="
echo "================== process-services-cloud unit ==================="
if [[ $AFFECTED_LIBS =~ "process-services-cloud" || "${TRAVIS_EVENT_TYPE}" == "push" ]];
then
ng test process-services-cloud --watch=false || exit 1;
fi;
bash <(curl -s https://codecov.io/bash) -X gcov

View File

@ -9,6 +9,8 @@ cd $DIR/../../../
AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)" AFFECTED_LIBS="$(nx affected:libs --base=$BASE_HASH --head=$HEAD_HASH --plain)"
echo "================== AFFECTED_LIBS ${AFFECTED_LIBS} ==================="
echo "================== process-services unit ===================" echo "================== process-services unit ==================="
if [[ $AFFECTED_LIBS =~ "process-services" || "${TRAVIS_EVENT_TYPE}" == "push" ]]; if [[ $AFFECTED_LIBS =~ "process-services" || "${TRAVIS_EVENT_TYPE}" == "push" ]];
then then
@ -21,10 +23,4 @@ then
ng test insights --watch=false || exit 1; ng test insights --watch=false || exit 1;
fi; fi;
echo "================== process-services-cloud unit ===================" bash <(curl -s https://codecov.io/bash) -X gcov
if [[ $AFFECTED_LIBS =~ "process-services-cloud" || "${TRAVIS_EVENT_TYPE}" == "push" ]];
then
ng test process-services-cloud --watch=false || exit 1;
fi;
# bash <(curl -s https://codecov.io/bash) -X gcov