mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-9166]: redundant types
This commit is contained in:
@@ -54,7 +54,7 @@ export abstract class SavedSearchesBaseService implements SavedSearchStrategy {
|
|||||||
saveSearch(newSaveSearch: Pick<SavedSearch, 'name' | 'description' | 'encodedUrl'>): Observable<NodeEntry> {
|
saveSearch(newSaveSearch: Pick<SavedSearch, 'name' | 'description' | 'encodedUrl'>): Observable<NodeEntry> {
|
||||||
return this.fetchAllSavedSearches().pipe(
|
return this.fetchAllSavedSearches().pipe(
|
||||||
take(1),
|
take(1),
|
||||||
switchMap((savedSearches: SavedSearch[]) => {
|
switchMap((savedSearches) => {
|
||||||
let updatedSavedSearches: SavedSearch[] = [];
|
let updatedSavedSearches: SavedSearch[] = [];
|
||||||
|
|
||||||
if (savedSearches.length < 5) {
|
if (savedSearches.length < 5) {
|
||||||
@@ -80,14 +80,14 @@ export abstract class SavedSearchesBaseService implements SavedSearchStrategy {
|
|||||||
let previousSavedSearches: SavedSearch[];
|
let previousSavedSearches: SavedSearch[];
|
||||||
return this.savedSearches$.pipe(
|
return this.savedSearches$.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((savedSearches: SavedSearch[]) => {
|
map((savedSearches) => {
|
||||||
previousSavedSearches = [...savedSearches];
|
previousSavedSearches = [...savedSearches];
|
||||||
return savedSearches.map((search) => (search.order === updatedSavedSearch.order ? updatedSavedSearch : search));
|
return savedSearches.map((search) => (search.order === updatedSavedSearch.order ? updatedSavedSearch : search));
|
||||||
}),
|
}),
|
||||||
tap((updatedSearches: SavedSearch[]) => {
|
tap((updatedSearches) => {
|
||||||
this._savedSearches$.next(updatedSearches);
|
this._savedSearches$.next(updatedSearches);
|
||||||
}),
|
}),
|
||||||
switchMap((updatedSearches: SavedSearch[]) => this.updateSavedSearches(updatedSearches)),
|
switchMap((updatedSearches) => this.updateSavedSearches(updatedSearches)),
|
||||||
catchError((error) => {
|
catchError((error) => {
|
||||||
this._savedSearches$.next(previousSavedSearches);
|
this._savedSearches$.next(previousSavedSearches);
|
||||||
return throwError(() => error);
|
return throwError(() => error);
|
||||||
@@ -99,7 +99,7 @@ export abstract class SavedSearchesBaseService implements SavedSearchStrategy {
|
|||||||
let previousSavedSearchesOrder: SavedSearch[];
|
let previousSavedSearchesOrder: SavedSearch[];
|
||||||
return this.savedSearches$.pipe(
|
return this.savedSearches$.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((savedSearches: SavedSearch[]) => {
|
map((savedSearches) => {
|
||||||
previousSavedSearchesOrder = [...savedSearches];
|
previousSavedSearchesOrder = [...savedSearches];
|
||||||
const updatedSearches = savedSearches.filter((search) => search.order !== deletedSavedSearch.order);
|
const updatedSearches = savedSearches.filter((search) => search.order !== deletedSavedSearch.order);
|
||||||
return updatedSearches.map((search, index) => ({ ...search, order: index }));
|
return updatedSearches.map((search, index) => ({ ...search, order: index }));
|
||||||
@@ -120,7 +120,7 @@ export abstract class SavedSearchesBaseService implements SavedSearchStrategy {
|
|||||||
this.savedSearches$
|
this.savedSearches$
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((savedSearches: SavedSearch[]) => {
|
map((savedSearches) => {
|
||||||
previousSavedSearchesOrder = [...savedSearches];
|
previousSavedSearchesOrder = [...savedSearches];
|
||||||
const [movedSearch] = savedSearches.splice(previousIndex, 1);
|
const [movedSearch] = savedSearches.splice(previousIndex, 1);
|
||||||
savedSearches.splice(currentIndex, 0, movedSearch);
|
savedSearches.splice(currentIndex, 0, movedSearch);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { AlfrescoApiService } from '../../services';
|
import { AlfrescoApiService } from '../../services';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
import { AlfrescoApiServiceMock } from '../../mock';
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
|
||||||
import { AuthenticationService } from '@alfresco/adf-core';
|
import { AuthenticationService } from '@alfresco/adf-core';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { SavedSearchesLegacyService } from './saved-searches-legacy.service';
|
import { SavedSearchesLegacyService } from './saved-searches-legacy.service';
|
||||||
@@ -28,7 +27,7 @@ describe('SavedSearchesLegacyService', () => {
|
|||||||
let service: SavedSearchesLegacyService;
|
let service: SavedSearchesLegacyService;
|
||||||
let authService: AuthenticationService;
|
let authService: AuthenticationService;
|
||||||
let testUserName: string;
|
let testUserName: string;
|
||||||
let getNodeContentSpy: jasmine.Spy;
|
let getNodeContentSpy: jasmine.Spy<jasmine.Func>;
|
||||||
|
|
||||||
const testNodeId = 'test-node-id';
|
const testNodeId = 'test-node-id';
|
||||||
const SAVED_SEARCHES_NODE_ID = 'saved-searches-node-id__';
|
const SAVED_SEARCHES_NODE_ID = 'saved-searches-node-id__';
|
||||||
@@ -49,7 +48,6 @@ describe('SavedSearchesLegacyService', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
testUserName = 'test-user';
|
testUserName = 'test-user';
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpClientTestingModule],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||||
{ provide: AuthenticationService, useValue: { getUsername: () => {}, onLogin: new Subject() } },
|
{ provide: AuthenticationService, useValue: { getUsername: () => {}, onLogin: new Subject() } },
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
|||||||
import { AlfrescoApiServiceMock } from '../../mock';
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
import { SavedSearchesService } from './saved-searches.service';
|
import { SavedSearchesService } from './saved-searches.service';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
|
||||||
import { AuthenticationService } from '@alfresco/adf-core';
|
import { AuthenticationService } from '@alfresco/adf-core';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
@@ -48,7 +47,6 @@ describe('SavedSearchesService', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
testUserName = 'test-user';
|
testUserName = 'test-user';
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpClientTestingModule],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||||
{ provide: AuthenticationService, useValue: { getUsername: () => {}, onLogin: new Subject() } },
|
{ provide: AuthenticationService, useValue: { getUsername: () => {}, onLogin: new Subject() } },
|
||||||
|
|||||||
Reference in New Issue
Block a user