mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5235] Facet fix and improve search test (#6122)
* improve search test * fix * fix * fix * changes * modify * logout public URL * improve stability some e2e * fx lint * fix * fix * improve * fix * improve * fix * fix * fix * fix [skip ci] * fix * some fix [skip ci] * fix * fix lint * fix * fix * fix * fix * fix * fix * fix * fix * fix * convert C291893 in manual test case in testrail * fix * fix
This commit is contained in:
@@ -35,7 +35,6 @@ export class SimpleInheritedPermissionTestComponent {
|
||||
}
|
||||
|
||||
onUpdate(node: any) {
|
||||
this.updatedNode = node.permissions.isInheritanceEnabled;
|
||||
this.updatedNode = node.permissions?.isInheritanceEnabled ?? false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ describe('InheritPermissionDirective', () => {
|
||||
it('should be able to add inherited permission', async(() => {
|
||||
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeNoInherit));
|
||||
spyOn(nodeService, 'updateNode').and.callFake((_, nodeBody) => {
|
||||
if (nodeBody.permissions.isInheritanceEnabled) {
|
||||
if (nodeBody.permissions?.isInheritanceEnabled) {
|
||||
return of(fakeNodeWithInherit);
|
||||
} else {
|
||||
return of(fakeNodeNoInherit);
|
||||
@@ -79,7 +79,7 @@ describe('InheritPermissionDirective', () => {
|
||||
it('should be able to remove inherited permission', async(() => {
|
||||
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeWithInherit));
|
||||
spyOn(nodeService, 'updateNode').and.callFake((_, nodeBody) => {
|
||||
if (nodeBody.permissions.isInheritanceEnabled) {
|
||||
if (nodeBody.permissions?.isInheritanceEnabled) {
|
||||
return of(fakeNodeWithInherit);
|
||||
} else {
|
||||
return of(fakeNodeNoInherit);
|
||||
|
@@ -48,7 +48,7 @@ export class InheritPermissionDirective {
|
||||
onInheritPermissionClicked() {
|
||||
this.nodeService.getNode(this.nodeId).subscribe((node: Node) => {
|
||||
if (this.contentService.hasAllowableOperations(node, AllowableOperationsEnum.UPDATEPERMISSIONS)) {
|
||||
const nodeBody = { permissions: { isInheritanceEnabled: !node.permissions.isInheritanceEnabled } };
|
||||
const nodeBody = { permissions: { isInheritanceEnabled: !node?.permissions?.isInheritanceEnabled ?? false} };
|
||||
this.nodeService.updateNode(this.nodeId, nodeBody, { include: ['permissions'] }).subscribe((nodeUpdated: Node) => {
|
||||
this.updated.emit(nodeUpdated);
|
||||
}, (error) => this.error.emit(error));
|
||||
|
@@ -71,13 +71,13 @@ export class PermissionListComponent implements OnInit {
|
||||
|
||||
private getPermissionList(node: Node): PermissionDisplayModel[] {
|
||||
const allPermissions: PermissionDisplayModel[] = [];
|
||||
if (node.permissions.locallySet) {
|
||||
if (node?.permissions?.locallySet) {
|
||||
node.permissions.locallySet.map((permissionElement: PermissionElement) => {
|
||||
const permission = new PermissionDisplayModel(permissionElement);
|
||||
allPermissions.push(permission);
|
||||
});
|
||||
}
|
||||
if (node.permissions.inherited) {
|
||||
if (node?.permissions?.inherited) {
|
||||
node.permissions.inherited.map((permissionElement: PermissionElement) => {
|
||||
const permissionInherited = new PermissionDisplayModel(permissionElement);
|
||||
permissionInherited.isInherited = true;
|
||||
|
@@ -303,7 +303,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
|
||||
private getResponseQueryBuckets(responseField: GenericFacetResponse, configGroup: any): FacetFieldBucket[] {
|
||||
return (configGroup || []).map((query) => {
|
||||
const respBucket = ((responseField && responseField.buckets) || [])
|
||||
.find((bucket) => bucket.label === query.label);
|
||||
.find((bucket) => bucket.label === query.label) || {};
|
||||
|
||||
respBucket['count'] = this.getCountValue(respBucket);
|
||||
return <FacetFieldBucket> {
|
||||
@@ -316,8 +316,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private getCountValue(bucket: GenericBucket): number {
|
||||
return (!!bucket && !!bucket.metrics && bucket.metrics[0] && bucket.metrics[0].value && bucket.metrics[0].value.count)
|
||||
|| 0;
|
||||
return (!!bucket && !!bucket.metrics && bucket.metrics[0]?.value?.count) || 0;
|
||||
}
|
||||
|
||||
getBucketCountDisplay(bucket: FacetFieldBucket): string {
|
||||
|
Reference in New Issue
Block a user