diff --git a/demo-shell/src/app.config.json b/demo-shell/src/app.config.json index d91ba90295..8e948f274f 100644 --- a/demo-shell/src/app.config.json +++ b/demo-shell/src/app.config.json @@ -462,21 +462,21 @@ "pattern": "cm:name:'(.*?)'", "field": "cm:name", "placeholder": "SEARCH.SEARCH_HEADER.FILTERS.NAME.PLACEHOLDER", - "searchSuffix" : "*", - "allowUpdateOnChange" : false + "searchSuffix": "*", + "allowUpdateOnChange": false } } }, { "id": "checkList", "name": "SEARCH.SEARCH_HEADER.FILTERS.TYPE.TITLE", - "columnKey":"$thumbnail", + "columnKey": "$thumbnail", "enabled": true, "component": { "selector": "check-list", "settings": { "pageSize": 5, - "allowUpdateOnChange" : false, + "allowUpdateOnChange": false, "operator": "OR", "options": [ { @@ -494,12 +494,12 @@ { "id": "contentSize", "name": "SEARCH.SEARCH_HEADER.FILTERS.SIZE.TITLE", - "columnKey":"content.sizeInBytes", + "columnKey": "content.sizeInBytes", "enabled": true, "component": { "selector": "check-list", "settings": { - "allowUpdateOnChange" : false, + "allowUpdateOnChange": false, "options": [ { "name": "SEARCH.SEARCH_HEADER.FILTERS.SIZE.SMALL", @@ -529,7 +529,7 @@ "component": { "selector": "date-range", "settings": { - "allowUpdateOnChange" : false, + "allowUpdateOnChange": false, "field": "cm:created", "dateFormat": "DD-MMM-YY", "maxDate": "today" @@ -1052,22 +1052,24 @@ "ai:textLines": "*" }, "all-aspects": "*", - "custom-title": [{ - "title": "Exif", - "items": [ - { - "aspect": "exif:exif", - "editing": false, - "properties": [ - "exif:pixelXDimension", - { - "title": "Custom YDimension Name", - "name": "exif:pixelYDimension" - } - ] - } - ] - }] + "custom-title": [ + { + "title": "Exif", + "items": [ + { + "aspect": "exif:exif", + "editing": false, + "properties": [ + "exif:pixelXDimension", + { + "title": "Custom YDimension Name", + "name": "exif:pixelYDimension" + } + ] + } + ] + } + ] }, "multi-value-pipe-separator": ", ", "multi-value-chips": true, @@ -1227,11 +1229,38 @@ } ], "aspect-visible": { - "default" : ["cm:generalclassifiable", "cm:complianceable", - "cm:dublincore", "cm:effectivity", "cm:summarizable", - "cm:versionable", "cm:templatable","cm:emailed", "emailserver:aliasable", - "cm:taggable", "app:inlineeditable", "cm:geographic", "exif:exif", - "audio:audio", "cm:indexControl", "dp:restrictable", "smf:customConfigSmartFolder", "smf:systemConfigSmartFolder"], - "ai": ["ai:products", "ai:dates", "ai:places", "ai:events", "ai:organizations", "ai:people", "ai:things", "ai:quantities", "ai:creativeWorks", "ai:labels", "ai:textLines"] + "default": [ + "cm:generalclassifiable", + "cm:complianceable", + "cm:dublincore", + "cm:effectivity", + "cm:summarizable", + "cm:versionable", + "cm:templatable", + "cm:emailed", + "emailserver:aliasable", + "cm:taggable", + "app:inlineeditable", + "cm:geographic", + "exif:exif", + "audio:audio", + "cm:indexControl", + "dp:restrictable", + "smf:customConfigSmartFolder", + "smf:systemConfigSmartFolder" + ], + "ai": [ + "ai:products", + "ai:dates", + "ai:places", + "ai:events", + "ai:organizations", + "ai:people", + "ai:things", + "ai:quantities", + "ai:creativeWorks", + "ai:labels", + "ai:textLines" + ] } } diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json index af5630ab90..93be31543c 100644 --- a/e2e/protractor.excludes.json +++ b/e2e/protractor.excludes.json @@ -9,5 +9,5 @@ "C279930": "login problem APS not basic", "C260241": "ADF-5335- this will exclude 2 tests", "C587515": "https://alfresco.atlassian.net/browse/ADF-5340", - "C311290": "fix is in the progress by Vito" + "C311290": "https://alfresco.atlassian.net/browse/ADF-5308" } diff --git a/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts b/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts index 721c52b700..006ed017ee 100644 --- a/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/services/notification-cloud.service.ts @@ -17,8 +17,9 @@ import { Apollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; -import { split, gql, InMemoryCache } from '@apollo/client/core'; +import { split, gql, InMemoryCache, ApolloLink, InMemoryCacheConfig } from '@apollo/client/core'; import { WebSocketLink } from '@apollo/client/link/ws'; +import { onError } from '@apollo/client/link/error'; import { getMainDefinition } from '@apollo/client/utilities'; import { Injectable } from '@angular/core'; import { StorageService, AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; @@ -75,9 +76,34 @@ export class NotificationCloudService extends BaseCloudService { httpLink ); + const errorLink = onError(({ graphQLErrors, operation, forward }) => { + if (graphQLErrors) { + for (const err of graphQLErrors) { + switch (err.extensions.code) { + case 'UNAUTHENTICATED': + const oldHeaders = operation.getContext().headers; + operation.setContext({ + headers: { + ...oldHeaders, + 'X-Authorization': 'Bearer ' + this.storageService.getItem('access_token') + } + }); + forward(operation); + break; + default: + } + } + } + }); + this.apollo.createNamed(appName, { - link, - cache: new InMemoryCache() + link: ApolloLink.from([errorLink, link]), + cache: new InMemoryCache({ merge: true } as InMemoryCacheConfig), + defaultOptions: { + watchQuery: { + errorPolicy: 'all' + } + } }); } } diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts index f0d559dbe6..8c16815333 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts @@ -16,7 +16,7 @@ */ import { SimpleChange } from '@angular/core'; -import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { ComponentFixture, TestBed, async, fakeAsync, tick } from '@angular/core/testing'; import { setupTestBed } from '@alfresco/adf-core'; import { from, Observable, of } from 'rxjs'; import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service'; @@ -381,10 +381,11 @@ describe('TaskFiltersCloudComponent', () => { }); })); - it('should update filter counter when notification received', async(() => { + it('should update filter counter when notification received', fakeAsync(() => { spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable); component.appName = 'my-app-1'; component.ngOnInit(); + tick(5000); fixture.detectChanges(); component.showIcons = true; fixture.whenStable().then(() => { @@ -396,11 +397,12 @@ describe('TaskFiltersCloudComponent', () => { }); })); - it('should reset filter counter notification when filter is selected', async(() => { + it('should reset filter counter notification when filter is selected', fakeAsync(() => { spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable); let change = new SimpleChange(undefined, 'my-app-1', true); component.appName = 'my-app-1'; component.ngOnInit(); + tick(5000); fixture.detectChanges(); component.showIcons = true; fixture.whenStable().then(() => { diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts index 002d6688c0..5bb9611674 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts @@ -20,7 +20,7 @@ import { Observable } from 'rxjs'; import { TaskFilterCloudService } from '../services/task-filter-cloud.service'; import { TaskFilterCloudModel, FilterParamsModel } from '../models/filter-cloud.model'; import { TranslationService } from '@alfresco/adf-core'; -import { takeUntil } from 'rxjs/operators'; +import { debounceTime, takeUntil } from 'rxjs/operators'; import { BaseTaskFiltersCloudComponent } from './base-task-filters-cloud.component'; import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model'; import { TaskCloudEngineEvent } from '../../../models/engine-event-cloud.model'; @@ -98,6 +98,7 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp initFilterCounterNotifications() { if (this.appName) { this.taskFilterCloudService.getTaskNotificationSubscription(this.appName) + .pipe(debounceTime(5000)) .subscribe((result: TaskCloudEngineEvent[]) => { result.map((taskEvent: TaskCloudEngineEvent) => { this.checkFilterCounter(taskEvent.entity);