mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-20109] Move alfresco js-API and alfrescoapi service out from the core (#9317)
* AAE-20109 Remove alfrescoapiservice from core * fix after rebase * [AAe-12502] Post-rebase fix * [AAE-12502] Add unit test fix --------- Co-authored-by: Bartosz Sekula <Bartosz.Sekula@hyland.com> Co-authored-by: MichalKinas <michal.kinas@hyland.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
import { StorageService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoApiNoAuthService extends AlfrescoApiService {
|
||||
constructor(
|
||||
storage: StorageService,
|
||||
appConfig: AppConfigService,
|
||||
private readonly adfHttpClient: AdfHttpClient
|
||||
) {
|
||||
super(appConfig, storage);
|
||||
}
|
||||
|
||||
override createInstance(config: AlfrescoApiConfig) {
|
||||
return new AlfrescoApi({
|
||||
...config,
|
||||
oauthInit: false
|
||||
}, this.adfHttpClient);
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService, AppConfigValues, StorageService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
/**
|
||||
* Create a factory to resolve an api service instance
|
||||
*
|
||||
* @param angularAlfrescoApiService loader service
|
||||
* @returns factory function
|
||||
*/
|
||||
export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
|
||||
return () => angularAlfrescoApiService.init();
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AlfrescoApiLoaderService {
|
||||
constructor(private readonly appConfig: AppConfigService,
|
||||
private readonly apiService: AlfrescoApiService,
|
||||
private storageService: StorageService) {
|
||||
}
|
||||
|
||||
async init(): Promise<any> {
|
||||
await this.appConfig.load();
|
||||
return this.initAngularAlfrescoApi();
|
||||
}
|
||||
|
||||
private async initAngularAlfrescoApi() {
|
||||
const oauth = this.appConfig.oauth2;
|
||||
|
||||
if (oauth) {
|
||||
oauth.redirectUri = window.location.origin + window.location.pathname;
|
||||
oauth.redirectUriLogout = window.location.origin + window.location.pathname;
|
||||
}
|
||||
|
||||
const config = new AlfrescoApiConfig({
|
||||
provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
|
||||
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
|
||||
hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST),
|
||||
authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'),
|
||||
contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM),
|
||||
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
|
||||
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
|
||||
withCredentials: this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
|
||||
domainPrefix: this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX),
|
||||
ticketEcm: this.storageService.getItem(AppConfigValues.CONTENT_TICKET_STORAGE_LABEL),
|
||||
ticketBpm: this.storageService.getItem(AppConfigValues.PROCESS_TICKET_STORAGE_LABEL),
|
||||
oauth2: oauth
|
||||
});
|
||||
|
||||
await this.apiService.load(config);
|
||||
}
|
||||
}
|
18
lib/content-services/src/lib/api-factories/index.ts
Normal file
18
lib/content-services/src/lib/api-factories/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './public-api';
|
19
lib/content-services/src/lib/api-factories/public-api.ts
Normal file
19
lib/content-services/src/lib/api-factories/public-api.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './alfresco-api-no-auth.service';
|
||||
export * from './alfresco-api-v2-loader.service';
|
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AspectListService } from './aspect-list.service';
|
||||
import { AspectPaging, AspectsApi, AspectEntry } from '@alfresco/js-api';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
|
||||
const stdAspect1: AspectEntry = { entry: { id: 'std:standardAspectOne', description: 'Standard Aspect One', title: 'StandardAspectOne' } };
|
||||
const stdAspect2: AspectEntry = { entry: { id: 'std:standardAspectTwo', description: 'Standard Aspect Two', title: 'StandardAspectTwo' } };
|
||||
|
@@ -16,7 +16,8 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { from, Observable, of, zip } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api';
|
||||
|
@@ -23,7 +23,7 @@ import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { NodeAspectService } from './node-aspect.service';
|
||||
import { DialogAspectListService } from './dialog-aspect-list.service';
|
||||
import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service';
|
||||
import { TagService } from '@alfresco/adf-content-services';
|
||||
import { TagService } from '../../tag';
|
||||
|
||||
describe('NodeAspectService', () => {
|
||||
let dialogAspectListService: DialogAspectListService;
|
||||
|
@@ -17,11 +17,12 @@
|
||||
|
||||
import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { CategoryService } from '../services/category.service';
|
||||
import { CategoryNode, CategoryTreeDatasourceService } from '@alfresco/adf-content-services';
|
||||
import { CategoryServiceMock } from '../mock/category-mock.service';
|
||||
import { TreeNodeType, TreeResponse } from '../../tree';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
import { CategoryTreeDatasourceService } from './category-tree-datasource.service';
|
||||
import { CategoryNode } from '../models/category-node.interface';
|
||||
|
||||
describe('CategoryTreeDatasourceService', () => {
|
||||
let categoryTreeDatasourceService: CategoryTreeDatasourceService;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import {
|
||||
CategoriesApi,
|
||||
CategoryBody,
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
SearchApi,
|
||||
SEARCH_LANGUAGE
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { from, Observable } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
|
@@ -18,9 +18,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ContentApi, Node, NodeEntry } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { AlfrescoApiService, AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { PermissionsEnum } from '../models/permissions.enum';
|
||||
import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
export interface FolderCreatedEvent {
|
||||
name: string;
|
||||
|
@@ -18,21 +18,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { from, Observable, throwError, Subject } from 'rxjs';
|
||||
import { catchError, map, switchMap, filter, take } from 'rxjs/operators';
|
||||
import {
|
||||
RepositoryInfo,
|
||||
SystemPropertiesRepresentation,
|
||||
DiscoveryApi,
|
||||
AboutApi,
|
||||
SystemPropertiesApi
|
||||
} from '@alfresco/js-api';
|
||||
import { RepositoryInfo, SystemPropertiesRepresentation, DiscoveryApi, AboutApi, SystemPropertiesApi } from '@alfresco/js-api';
|
||||
|
||||
import { AlfrescoApiService, BpmProductVersionModel, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { BpmProductVersionModel, AuthenticationService } from '@alfresco/adf-core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DiscoveryApiService {
|
||||
|
||||
private _discoveryApi: DiscoveryApi;
|
||||
get discoveryApi(): DiscoveryApi {
|
||||
this._discoveryApi = this._discoveryApi ?? new DiscoveryApi(this.alfrescoApiService.getInstance());
|
||||
@@ -44,34 +38,28 @@ export class DiscoveryApiService {
|
||||
*/
|
||||
ecmProductInfo$ = new Subject<RepositoryInfo>();
|
||||
|
||||
constructor(
|
||||
private authenticationService: AuthenticationService,
|
||||
private alfrescoApiService: AlfrescoApiService
|
||||
) {
|
||||
constructor(private authenticationService: AuthenticationService, private alfrescoApiService: AlfrescoApiService) {
|
||||
this.authenticationService.onLogin.subscribe(() => {
|
||||
this.alfrescoApiService.alfrescoApiInitialized.pipe(
|
||||
filter(() => this.authenticationService.isEcmLoggedIn()),
|
||||
take(1),
|
||||
switchMap(() => this.getEcmProductInfo())
|
||||
)
|
||||
this.alfrescoApiService.alfrescoApiInitialized
|
||||
.pipe(
|
||||
filter(() => this.authenticationService.isEcmLoggedIn()),
|
||||
take(1),
|
||||
switchMap(() => this.getEcmProductInfo())
|
||||
)
|
||||
.subscribe((info) => this.ecmProductInfo$.next(info));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets product information for Content Services.
|
||||
*
|
||||
* @returns ProductVersionModel containing product details
|
||||
*/
|
||||
getEcmProductInfo(): Observable<RepositoryInfo> {
|
||||
|
||||
return from(this.discoveryApi.getRepositoryInformation())
|
||||
.pipe(
|
||||
map((res) => res.entry.repository),
|
||||
catchError((err) => throwError(err))
|
||||
);
|
||||
return from(this.discoveryApi.getRepositoryInformation()).pipe(
|
||||
map((res) => res.entry.repository),
|
||||
catchError((err) => throwError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,25 +70,23 @@ export class DiscoveryApiService {
|
||||
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
||||
const aboutApi = new AboutApi(this.alfrescoApiService.getInstance());
|
||||
|
||||
return from(aboutApi.getAppVersion())
|
||||
.pipe(
|
||||
map((res) => new BpmProductVersionModel(res)),
|
||||
catchError((err) => throwError(err))
|
||||
);
|
||||
return from(aboutApi.getAppVersion()).pipe(
|
||||
map((res) => new BpmProductVersionModel(res)),
|
||||
catchError((err) => throwError(err))
|
||||
);
|
||||
}
|
||||
|
||||
getBPMSystemProperties(): Observable<SystemPropertiesRepresentation> {
|
||||
const systemPropertiesApi = new SystemPropertiesApi(this.alfrescoApiService.getInstance());
|
||||
|
||||
return from(systemPropertiesApi.getProperties())
|
||||
.pipe(
|
||||
map((res: any) => {
|
||||
if ('string' === typeof (res)) {
|
||||
throw new Error('Not valid response');
|
||||
}
|
||||
return res;
|
||||
}),
|
||||
catchError((err) => throwError(err.error))
|
||||
);
|
||||
return from(systemPropertiesApi.getProperties()).pipe(
|
||||
map((res: any) => {
|
||||
if ('string' === typeof res) {
|
||||
throw new Error('Not valid response');
|
||||
}
|
||||
return res;
|
||||
}),
|
||||
catchError((err) => throwError(err.error))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { FavoritesApi, NodePaging, FavoritePaging } from '@alfresco/js-api';
|
||||
import { Observable, from, of } from 'rxjs';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
|
@@ -15,12 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ContentPagingQuery, Node, NodeAssignedHold, NodeEntry, NodePaging, NodesApi, NodesIncludeQuery, TrashcanApi } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { from, Observable, Subject, throwError } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { NodeMetadata } from '../models/node-metadata.model';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -16,12 +16,14 @@
|
||||
*/
|
||||
|
||||
import { fakeEcmUser } from '../mocks/ecm-user.service.mock';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { PeopleContentQueryRequestModel, PeopleContentService } from './people-content.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { PersonPaging } from '@alfresco/js-api';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
|
||||
export const fakeEcmUser2 = {
|
||||
id: 'another-fake-id',
|
||||
|
@@ -17,11 +17,12 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { from, Observable, of } from 'rxjs';
|
||||
import { AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
import { Pagination, PeopleApi, PersonBodyCreate, PersonBodyUpdate } from '@alfresco/js-api';
|
||||
import { EcmUserModel } from '../models/ecm-user.model';
|
||||
import { ContentService } from './content.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
export interface PeopleContentQueryResponse {
|
||||
pagination: Pagination;
|
||||
|
@@ -17,7 +17,8 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ContentApi, RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService, Track, TranslationService, ViewUtilService } from '@alfresco/adf-core';
|
||||
import { Track, TranslationService, ViewUtilService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -16,9 +16,10 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, TranslationService, ViewUtilService } from '@alfresco/adf-core';
|
||||
import { TranslationService, ViewUtilService } from '@alfresco/adf-core';
|
||||
import { Rendition, RenditionEntry, RenditionPaging, RenditionsApi } from '@alfresco/js-api';
|
||||
import { RenditionService } from '@alfresco/adf-content-services';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { RenditionService } from './rendition.service';
|
||||
|
||||
const getRenditionEntry = (status: Rendition.StatusEnum): RenditionEntry => ({
|
||||
entry: {
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import {
|
||||
Node,
|
||||
SiteBodyCreate,
|
||||
@@ -32,6 +31,7 @@ import {
|
||||
SitePaging,
|
||||
SitesApi
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -17,13 +17,15 @@
|
||||
|
||||
import { EventEmitter } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
|
||||
import { AppConfigModule, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
|
||||
import { UploadService } from './upload.service';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
||||
import { FileModel, FileUploadStatus } from '../../common/models/file.model';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
|
@@ -20,10 +20,11 @@ import { Minimatch } from 'minimatch';
|
||||
import { Subject } from 'rxjs';
|
||||
import { FileUploadCompleteEvent, FileUploadDeleteEvent, FileUploadErrorEvent, FileUploadEvent } from '../events/file.event';
|
||||
import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model';
|
||||
import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
||||
import { NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
||||
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
||||
|
@@ -25,7 +25,7 @@ import { NodeAspectService } from '../../../aspect-list/services/node-aspect.ser
|
||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
||||
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
|
||||
import { of } from 'rxjs';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, AuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { AuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { versionCompatibilityFactory } from '../../../version-compatibility/version-compatibility-factory';
|
||||
import { VersionCompatibilityService } from '../../../version-compatibility';
|
||||
@@ -34,6 +34,8 @@ import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { CategoryService } from '../../../category';
|
||||
import { TagService } from '../../../tag';
|
||||
import { PropertyDescriptorsService } from '../../public-api';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock } from '../../../mock/alfresco-api.service.mock';
|
||||
|
||||
describe('ContentMetadataCardComponent', () => {
|
||||
let component: ContentMetadataCardComponent;
|
||||
|
@@ -35,20 +35,16 @@ import { EMPTY, of, throwError } from 'rxjs';
|
||||
import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service';
|
||||
import { PropertyGroup } from '../../interfaces/property-group.interface';
|
||||
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
||||
import {
|
||||
CategoriesManagementComponent,
|
||||
CategoriesManagementMode,
|
||||
CategoryService,
|
||||
TagsCreatorComponent,
|
||||
TagsCreatorMode,
|
||||
TagService
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatChipHarness } from '@angular/material/chips/testing';
|
||||
import { TagService } from '../../../tag/services/tag.service';
|
||||
import { CategoryService } from '../../../category/services/category.service';
|
||||
import { TagsCreatorComponent, TagsCreatorMode } from '../../../tag';
|
||||
import { CategoriesManagementComponent, CategoriesManagementMode } from '../../../category';
|
||||
|
||||
describe('ContentMetadataComponent', () => {
|
||||
let component: ContentMetadataComponent;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { Observable, defer, forkJoin } from 'rxjs';
|
||||
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
@@ -21,7 +21,7 @@ import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
|
||||
import { ShareDialogComponent } from './content-node-share.dialog';
|
||||
import { Observable, from, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Directive({
|
||||
|
@@ -18,8 +18,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NodePaging, SharedLinkBodyCreate, SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
||||
import { Observable, from, of, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -17,9 +17,10 @@
|
||||
|
||||
import { TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
@@ -46,6 +46,9 @@ import { AlfrescoViewerComponent } from './viewer';
|
||||
import { ContentTypeDialogComponent } from './content-type';
|
||||
import { MaterialModule } from './material.module';
|
||||
import { AlfrescoIconComponent } from './alfresco-icon/alfresco-icon.component';
|
||||
import { AlfrescoApiService } from './services/alfresco-api.service';
|
||||
import { AlfrescoApiNoAuthService } from './api-factories/alfresco-api-no-auth.service';
|
||||
import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-factories/alfresco-api-v2-loader.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -111,6 +114,7 @@ export class ContentModule {
|
||||
providers: [
|
||||
provideTranslations('adf-content-services', 'assets/adf-content-services'),
|
||||
ContentAuthLoaderService,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: versionCompatibilityFactory,
|
||||
@@ -122,6 +126,12 @@ export class ContentModule {
|
||||
useFactory: contentAuthLoaderFactory,
|
||||
deps: [ContentAuthLoaderService],
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: createAlfrescoApiInstance,
|
||||
deps: [AlfrescoApiLoaderService],
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@@ -21,8 +21,10 @@ import { DownloadZipDialogComponent } from './download-zip.dialog';
|
||||
import { DownloadZipService } from './services/download-zip.service';
|
||||
import { DownloadEntry, FileDownloadStatus } from '@alfresco/js-api';
|
||||
import { EMPTY, Observable, of } from 'rxjs';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, NoopTranslateModule, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
|
||||
describe('DownloadZipDialogComponent', () => {
|
||||
let fixture: ComponentFixture<DownloadZipDialogComponent>;
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component';
|
||||
import { AlfrescoApiServiceMock, ContentApiMock, DownloadZipMockService, NodesApiMock } from './mock/download-zip-service.mock';
|
||||
@@ -27,6 +26,7 @@ import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { importProvidersFrom } from '@angular/core';
|
||||
import { CoreStoryModule } from '../../../../../core/src/public-api';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
|
||||
export default {
|
||||
component: DownloadZipDialogStorybookComponent,
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -28,7 +28,7 @@ import {
|
||||
} from '@angular/forms';
|
||||
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { QueriesApi, SiteBodyCreate, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService, NotificationService } from '@alfresco/adf-core';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { debounceTime, finalize, mergeMap, takeUntil } from 'rxjs/operators';
|
||||
import { SitesService } from '../../common/services/sites.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -38,6 +38,7 @@ import { MatInputModule } from '@angular/material/input';
|
||||
import { AutoFocusDirective } from '../../directives';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-library-dialog',
|
||||
|
@@ -20,7 +20,6 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia
|
||||
import { ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { differenceInSeconds } from 'date-fns';
|
||||
import { NodeBodyLock, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
@@ -28,6 +27,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatDatetimepickerModule } from '@mat-datetimepicker/core';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-node-lock',
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Directive, HostListener, Input, OnChanges, Output, EventEmitter, SimpleChanges } from '@angular/core';
|
||||
import { FavoriteBodyCreate, FavoritesApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { LibraryEntity } from '../interfaces/library-entity.interface';
|
||||
|
||||
@Directive({
|
||||
|
@@ -19,9 +19,10 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { LibraryMembershipDirective } from './library-membership.directive';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { of, throwError, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core';
|
||||
import { SitesService } from '../common/services/sites.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock';
|
||||
|
||||
describe('LibraryMembershipDirective', () => {
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { SiteEntry, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry, SitesApi } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, from, Observable } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { LibraryMembershipToggleEvent } from '../interfaces/library-membership-toggle-event.interface';
|
||||
import { LibraryMembershipErrorEvent } from '../interfaces/library-membership-error-event.interface';
|
||||
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
||||
|
@@ -20,8 +20,9 @@
|
||||
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
|
||||
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
|
||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { map, catchError, retry } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
interface ProcessedNodeData {
|
||||
entry: Node | DeletedNode;
|
||||
|
@@ -19,10 +19,11 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { Component, DebugElement, ViewChild } from '@angular/core';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core';
|
||||
import { NodeDownloadDirective } from './node-download.directive';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { ContentApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
@@ -17,9 +17,10 @@
|
||||
|
||||
import { Directive, Input, HostListener } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core';
|
||||
import { DownloadService } from '@alfresco/adf-core';
|
||||
import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
|
||||
import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
/**
|
||||
* Directive selectors without adf- prefix will be deprecated on 3.0.0
|
||||
|
@@ -18,8 +18,10 @@
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { NodeFavoriteDirective } from './node-favorite.directive';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
|
||||
import { AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { AlfrescoApiService } from '../services';
|
||||
import { AlfrescoApiServiceMock } from '../mock';
|
||||
|
||||
describe('NodeFavoriteDirective', () => {
|
||||
let directive: NodeFavoriteDirective;
|
||||
|
@@ -21,7 +21,7 @@ import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, Simple
|
||||
import { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi } from '@alfresco/js-api';
|
||||
import { Observable, from, forkJoin, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
@Directive({
|
||||
standalone: true,
|
||||
|
@@ -21,8 +21,9 @@ import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/c
|
||||
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging } from '@alfresco/js-api';
|
||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
||||
import { tap, mergeMap, map, catchError } from 'rxjs/operators';
|
||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { RestoreMessageModel } from '../interfaces/restore-message-model.interface';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
@Directive({
|
||||
standalone: true,
|
||||
|
@@ -19,7 +19,6 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
ColumnsSelectorComponent,
|
||||
CustomEmptyContentTemplateDirective,
|
||||
@@ -86,6 +85,7 @@ import { FilterHeaderComponent } from './filter-header/filter-header.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
const BYTES_TO_MB_CONVERSION_VALUE = 1048576;
|
||||
|
||||
|
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, PaginationModel } from '@alfresco/adf-core';
|
||||
import { PaginationModel } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import {
|
||||
DeletedNodesPaging,
|
||||
SearchRequest,
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, PaginationModel } from '@alfresco/adf-core';
|
||||
import { PaginationModel } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Node, NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api';
|
||||
@@ -24,6 +24,7 @@ import { Observable, from, forkJoin, Subject } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { DocumentListLoader } from '../interfaces/document-list-loader.interface';
|
||||
import { CustomResourcesService } from './custom-resources.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
const ROOT_ID = '-root-';
|
||||
|
||||
|
@@ -18,10 +18,11 @@
|
||||
import { Injectable, Output, EventEmitter } from '@angular/core';
|
||||
import { Node, NodeEntry } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core';
|
||||
import { DownloadService } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ContentService } from '../../common/services/content.service';
|
||||
import { NodeDownloadDirective } from '../../directives/node-download.directive';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||
|
@@ -17,8 +17,8 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { GroupService } from '@alfresco/adf-content-services';
|
||||
import { ContentIncludeQuery, GroupEntry } from '@alfresco/js-api';
|
||||
import { GroupService } from './group.service';
|
||||
|
||||
describe('GroupService', () => {
|
||||
let service: GroupService;
|
||||
@@ -83,12 +83,16 @@ describe('GroupService', () => {
|
||||
|
||||
service.updateGroup(group.entry, opts).subscribe((groupEntry) => {
|
||||
expect(groupEntry).toEqual(returnedGroup);
|
||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, {
|
||||
displayName: group.entry.displayName,
|
||||
description: group.entry.description
|
||||
}, {
|
||||
include: ['description']
|
||||
});
|
||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(
|
||||
group.entry.id,
|
||||
{
|
||||
displayName: group.entry.displayName,
|
||||
description: group.entry.description
|
||||
},
|
||||
{
|
||||
include: ['description']
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -105,12 +109,16 @@ describe('GroupService', () => {
|
||||
description: ''
|
||||
}
|
||||
});
|
||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, {
|
||||
displayName: group.entry.displayName,
|
||||
description: group.entry.description
|
||||
}, {
|
||||
include: ['description']
|
||||
});
|
||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(
|
||||
group.entry.id,
|
||||
{
|
||||
displayName: group.entry.displayName,
|
||||
description: group.entry.description
|
||||
},
|
||||
{
|
||||
include: ['description']
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -121,12 +129,16 @@ describe('GroupService', () => {
|
||||
|
||||
service.updateGroup(group.entry, opts).subscribe((groupEntry) => {
|
||||
expect(groupEntry).toEqual(returnedGroup);
|
||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, {
|
||||
displayName: group.entry.displayName,
|
||||
description: group.entry.description
|
||||
}, {
|
||||
include: ['description']
|
||||
});
|
||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(
|
||||
group.entry.id,
|
||||
{
|
||||
displayName: group.entry.displayName,
|
||||
description: group.entry.description
|
||||
},
|
||||
{
|
||||
include: ['description']
|
||||
}
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ContentIncludeQuery, Group, GroupEntry, GroupsApi } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
|
@@ -15,7 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import {
|
||||
BulkAssignHoldResponseEntry,
|
||||
ContentPagingQuery,
|
||||
@@ -30,6 +29,7 @@ import {
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -0,0 +1,39 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoApiServiceMock extends AlfrescoApiService {
|
||||
|
||||
constructor(protected appConfig: AppConfigService,
|
||||
protected storageService: StorageService) {
|
||||
super(appConfig, storageService);
|
||||
if (!this.alfrescoApi) {
|
||||
this.initAlfrescoApi();
|
||||
}
|
||||
}
|
||||
|
||||
initialize(): Promise<any> {
|
||||
return new Promise((resolve) => {
|
||||
this.alfrescoApiInitialized.next(true);
|
||||
resolve({});
|
||||
});
|
||||
}
|
||||
}
|
@@ -24,3 +24,4 @@ export * from './sites-dropdown.component.mock';
|
||||
export * from './search-query.mock';
|
||||
export * from './new-version-uploader.service.mock';
|
||||
export * from './date-range-search-filter.mock';
|
||||
export * from './alfresco-api.service.mock';
|
||||
|
@@ -18,6 +18,8 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { SearchComponent } from '../search/components/search.component';
|
||||
import { SearchRequest, ResultSetPaging, ResultSetRowEntry, ContentInfo, UserInfo, ResultNode } from '@alfresco/js-api';
|
||||
import { SearchModule } from '../search';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
const entryItem = new ResultSetRowEntry({
|
||||
entry: new ResultNode({
|
||||
@@ -103,7 +105,9 @@ export const noResult = {
|
||||
</ng-template>
|
||||
</adf-search>
|
||||
<span id="component-result-message">{{ message }}</span>
|
||||
`
|
||||
`,
|
||||
standalone: true,
|
||||
imports: [SearchModule, CommonModule]
|
||||
})
|
||||
export class SimpleSearchTestComponent {
|
||||
@ViewChild('search', { static: true })
|
||||
|
@@ -17,7 +17,8 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog';
|
||||
import { VersionsApi } from '@alfresco/js-api';
|
||||
import { NewVersionUploaderData, NewVersionUploaderDialogData } from './models';
|
||||
|
@@ -16,11 +16,13 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, CommentModel, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { CommentModel, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { fakeContentComment, fakeContentComments } from '../mocks/node-comments.mock';
|
||||
import { NodeCommentsService } from './node-comments.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
|
@@ -15,12 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, CommentModel, CommentsService, User } from '@alfresco/adf-core';
|
||||
import { CommentModel, CommentsService, User } from '@alfresco/adf-core';
|
||||
import { CommentEntry, CommentsApi, Comment } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ContentService } from '../../common/services/content.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -17,9 +17,9 @@
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PopOverDirective } from '@alfresco/adf-content-services';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { OverlayModule } from '@angular/cdk/overlay';
|
||||
import { PopOverDirective } from './pop-over.directive';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
||||
import { Group, GroupMemberPaging, GroupsApi, Node, PathElement, PermissionElement, SearchRequest } from '@alfresco/js-api';
|
||||
|
@@ -16,9 +16,9 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { PredictionsApi, PredictionPaging, ReviewStatus } from '@alfresco/js-api';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PredictionService {
|
||||
|
@@ -19,9 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
import { SearchFilterAutocompleteChipsComponent } from './search-filter-autocomplete-chips.component';
|
||||
import { TagService } from '@alfresco/adf-content-services';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { AutocompleteField } from '../../models/autocomplete-option.interface';
|
||||
import { TagService } from '../../../tag/services/tag.service';
|
||||
|
||||
describe('SearchFilterAutocompleteChipsComponent', () => {
|
||||
let component: SearchFilterAutocompleteChipsComponent;
|
||||
|
@@ -20,10 +20,11 @@ import { SearchPropertiesComponent } from './search-properties.component';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MatOption } from '@angular/material/core';
|
||||
import { SearchChipAutocompleteInputComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { FileSizeUnit } from './file-size-unit.enum';
|
||||
import { FileSizeOperator } from './file-size-operator.enum';
|
||||
import { SearchProperties } from './search-properties';
|
||||
import { SearchChipAutocompleteInputComponent } from '../search-chip-autocomplete-input';
|
||||
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
|
||||
|
||||
describe('SearchPropertiesComponent', () => {
|
||||
let component: SearchPropertiesComponent;
|
||||
|
@@ -17,10 +17,11 @@
|
||||
|
||||
import { SearchSortingPickerComponent } from './search-sorting-picker.component';
|
||||
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { SearchConfiguration } from '../../models/search-configuration.interface';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
|
||||
describe('SearchSortingPickerComponent', () => {
|
||||
let queryBuilder: SearchQueryBuilderService;
|
||||
|
@@ -29,8 +29,7 @@ describe('SearchComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule],
|
||||
declarations: [SimpleSearchTestComponent]
|
||||
imports: [ContentTestingModule, SimpleSearchTestComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(SimpleSearchTestComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Subject, Observable, from, ReplaySubject } from 'rxjs';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import {
|
||||
SearchRequest,
|
||||
RequestFacetFields,
|
||||
@@ -36,6 +36,7 @@ import { SearchSortingDefinition } from '../models/search-sorting-definition.int
|
||||
import { FacetField } from '../models/facet-field.interface';
|
||||
import { FacetFieldBucket } from '../models/facet-field-bucket.interface';
|
||||
import { SearchForm } from '../models/search-form.interface';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
export abstract class BaseQueryBuilderService {
|
||||
private _searchApi: SearchApi;
|
||||
|
@@ -20,8 +20,9 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { SearchFacetFiltersService } from './search-facet-filters.service';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { SearchQueryBuilderService } from './search-query-builder.service';
|
||||
import { CategoryService, FacetBucketSortBy, FacetBucketSortDirection } from '@alfresco/adf-content-services';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { CategoryService } from '../../category/services/category.service';
|
||||
import { FacetBucketSortBy, FacetBucketSortDirection } from '../models/facet-field.interface';
|
||||
|
||||
describe('SearchFacetFiltersService', () => {
|
||||
let searchFacetFiltersService: SearchFacetFiltersService;
|
||||
@@ -31,12 +32,14 @@ describe('SearchFacetFiltersService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule],
|
||||
providers: [{
|
||||
provide: CategoryService,
|
||||
useValue: {
|
||||
getCategory: () => EMPTY
|
||||
providers: [
|
||||
{
|
||||
provide: CategoryService,
|
||||
useValue: {
|
||||
getCategory: () => EMPTY
|
||||
}
|
||||
}
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
categoryService = TestBed.inject(CategoryService);
|
||||
@@ -67,17 +70,19 @@ describe('SearchFacetFiltersService', () => {
|
||||
};
|
||||
|
||||
const queries = [
|
||||
{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1}}] },
|
||||
{ label: 'q2', filterQuery: 'query2', metrics: [{value: {count: 1}}] }
|
||||
{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||
{ label: 'q2', filterQuery: 'query2', metrics: [{ value: { count: 1 } }] }
|
||||
];
|
||||
const data = {
|
||||
list: {
|
||||
context: {
|
||||
facets: [{
|
||||
type: 'query',
|
||||
label: 'label1',
|
||||
buckets: queries
|
||||
}]
|
||||
facets: [
|
||||
{
|
||||
type: 'query',
|
||||
label: 'label1',
|
||||
buckets: queries
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -104,19 +109,20 @@ describe('SearchFacetFiltersService', () => {
|
||||
};
|
||||
|
||||
const queries = [
|
||||
{ label: 'q2', filterQuery: 'query2', metrics: [{value: {count: 1}}] },
|
||||
{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1}}] },
|
||||
{ label: 'q3', filterQuery: 'query3', metrics: [{value: {count: 1}}] }
|
||||
|
||||
{ label: 'q2', filterQuery: 'query2', metrics: [{ value: { count: 1 } }] },
|
||||
{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||
{ label: 'q3', filterQuery: 'query3', metrics: [{ value: { count: 1 } }] }
|
||||
];
|
||||
const data = {
|
||||
list: {
|
||||
context: {
|
||||
facets: [{
|
||||
type: 'query',
|
||||
label: 'label1',
|
||||
buckets: queries
|
||||
}]
|
||||
facets: [
|
||||
{
|
||||
type: 'query',
|
||||
label: 'label1',
|
||||
buckets: queries
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -158,10 +164,12 @@ describe('SearchFacetFiltersService', () => {
|
||||
|
||||
queryBuilder.config = {
|
||||
categories: [],
|
||||
facetFields: { fields: [
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ label: 'f1', field: 'f1', mincount: 0 },
|
||||
{ label: 'f2', field: 'f2', mincount: 0 }
|
||||
]},
|
||||
]
|
||||
},
|
||||
facetQueries: {
|
||||
queries: []
|
||||
}
|
||||
@@ -189,9 +197,7 @@ describe('SearchFacetFiltersService', () => {
|
||||
it('should filter response facet fields based on search filter config method', () => {
|
||||
queryBuilder.config = {
|
||||
categories: [],
|
||||
facetFields: { fields: [
|
||||
{ label: 'f1', field: 'f1' }
|
||||
]},
|
||||
facetFields: { fields: [{ label: 'f1', field: 'f1' }] },
|
||||
facetQueries: {
|
||||
queries: []
|
||||
},
|
||||
@@ -199,10 +205,13 @@ describe('SearchFacetFiltersService', () => {
|
||||
};
|
||||
|
||||
const initialFields: any = [
|
||||
{ type: 'field', label: 'f1', buckets: [
|
||||
{ label: 'firstLabel', display: 'firstLabel', metrics: [{value: {count: 5}}] },
|
||||
{ label: 'secondLabel', display: 'secondLabel', metrics: [{value: {count: 5}}] },
|
||||
{ label: 'thirdLabel', display: 'thirdLabel', metrics: [{value: {count: 5}}] }
|
||||
{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [
|
||||
{ label: 'firstLabel', display: 'firstLabel', metrics: [{ value: { count: 5 } }] },
|
||||
{ label: 'secondLabel', display: 'secondLabel', metrics: [{ value: { count: 5 } }] },
|
||||
{ label: 'thirdLabel', display: 'thirdLabel', metrics: [{ value: { count: 5 } }] }
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -239,10 +248,12 @@ describe('SearchFacetFiltersService', () => {
|
||||
|
||||
queryBuilder.config = {
|
||||
categories: [],
|
||||
facetFields: { fields: [
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ label: 'f1', field: 'f1' },
|
||||
{ label: 'f2', field: 'f2' }
|
||||
]},
|
||||
]
|
||||
},
|
||||
facetQueries: {
|
||||
queries: []
|
||||
}
|
||||
@@ -253,8 +264,8 @@ describe('SearchFacetFiltersService', () => {
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [
|
||||
{ label: 'b1', metrics: [{value: {count: 10}}] },
|
||||
{ label: 'b2', metrics: [{value: {count: 1}}] }
|
||||
{ label: 'b1', metrics: [{ value: { count: 10 } }] },
|
||||
{ label: 'b2', metrics: [{ value: { count: 1 } }] }
|
||||
]
|
||||
},
|
||||
{ type: 'field', label: 'f2', buckets: [] }
|
||||
@@ -276,17 +287,28 @@ describe('SearchFacetFiltersService', () => {
|
||||
it('should fetch facet fields from response payload and update the existing bucket values', () => {
|
||||
queryBuilder.config = {
|
||||
categories: [],
|
||||
facetFields: { fields: [
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ label: 'f1', field: 'f1' },
|
||||
{ label: 'f2', field: 'f2' }
|
||||
]},
|
||||
]
|
||||
},
|
||||
facetQueries: {
|
||||
queries: []
|
||||
}
|
||||
};
|
||||
|
||||
const initialFields: any = [
|
||||
{ type: 'field', label: 'f1', buckets: { items: [{ label: 'b1', count: 10, filterQuery: 'filter' }, { label: 'b2', count: 1 }]} },
|
||||
{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: {
|
||||
items: [
|
||||
{ label: 'b1', count: 10, filterQuery: 'filter' },
|
||||
{ label: 'b2', count: 1 }
|
||||
]
|
||||
}
|
||||
},
|
||||
{ type: 'field', label: 'f2', buckets: [] }
|
||||
];
|
||||
searchFacetFiltersService.responseFacets = initialFields;
|
||||
@@ -294,9 +316,14 @@ describe('SearchFacetFiltersService', () => {
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items[1].count).toEqual(1);
|
||||
|
||||
const serverResponseFields: any = [
|
||||
{ type: 'field', label: 'f1', buckets:
|
||||
[{ label: 'b1', metrics: [{value: {count: 6}}], filterQuery: 'filter' },
|
||||
{ label: 'b2', metrics: [{value: {count: 0}}] }] },
|
||||
{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [
|
||||
{ label: 'b1', metrics: [{ value: { count: 6 } }], filterQuery: 'filter' },
|
||||
{ label: 'b2', metrics: [{ value: { count: 0 } }] }
|
||||
]
|
||||
},
|
||||
{ type: 'field', label: 'f2', buckets: [] }
|
||||
];
|
||||
const data = {
|
||||
@@ -321,21 +348,25 @@ describe('SearchFacetFiltersService', () => {
|
||||
facetQueries: { queries: [] }
|
||||
};
|
||||
|
||||
const firstCallFields: any = [{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [{ label: 'b1', metrics: [{value: {count: 10}}] }]
|
||||
}];
|
||||
const firstCallData = { list: { context: { facets: firstCallFields }}};
|
||||
const firstCallFields: any = [
|
||||
{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [{ label: 'b1', metrics: [{ value: { count: 10 } }] }]
|
||||
}
|
||||
];
|
||||
const firstCallData = { list: { context: { facets: firstCallFields } } };
|
||||
searchFacetFiltersService.onDataLoaded(firstCallData);
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(10);
|
||||
|
||||
const secondCallFields: any = [{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [{ label: 'b1', metrics: [{value: {count: 6}}] }]
|
||||
}];
|
||||
const secondCallData = { list: { context: { facets: secondCallFields}}};
|
||||
const secondCallFields: any = [
|
||||
{
|
||||
type: 'field',
|
||||
label: 'f1',
|
||||
buckets: [{ label: 'b1', metrics: [{ value: { count: 6 } }] }]
|
||||
}
|
||||
];
|
||||
const secondCallData = { list: { context: { facets: secondCallFields } } };
|
||||
searchFacetFiltersService.onDataLoaded(secondCallData);
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(6);
|
||||
});
|
||||
@@ -346,25 +377,33 @@ describe('SearchFacetFiltersService', () => {
|
||||
categories: [],
|
||||
facetIntervals: {
|
||||
intervals: [
|
||||
{ label: 'test_intervals1', field: 'f1', sets: [
|
||||
{ label: 'interval1', start: 's1', end: 'e1'},
|
||||
{ label: 'interval2', start: 's2', end: 'e2'}
|
||||
]},
|
||||
{ label: 'test_intervals2', field: 'f2', sets: [
|
||||
{ label: 'interval3', start: 's3', end: 'e3'},
|
||||
{ label: 'interval4', start: 's4', end: 'e4'}
|
||||
]}
|
||||
{
|
||||
label: 'test_intervals1',
|
||||
field: 'f1',
|
||||
sets: [
|
||||
{ label: 'interval1', start: 's1', end: 'e1' },
|
||||
{ label: 'interval2', start: 's2', end: 'e2' }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'test_intervals2',
|
||||
field: 'f2',
|
||||
sets: [
|
||||
{ label: 'interval3', start: 's3', end: 'e3' },
|
||||
{ label: 'interval4', start: 's4', end: 'e4' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
const response1 = [
|
||||
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 }}]},
|
||||
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 }}]}
|
||||
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 } }] }
|
||||
];
|
||||
const response2 = [
|
||||
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 }}]},
|
||||
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 }}]}
|
||||
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 } }] },
|
||||
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 } }] }
|
||||
];
|
||||
const data = {
|
||||
list: {
|
||||
@@ -390,25 +429,35 @@ describe('SearchFacetFiltersService', () => {
|
||||
categories: [],
|
||||
facetIntervals: {
|
||||
intervals: [
|
||||
{ label: 'test_intervals1', field: 'f1', mincount: 2, sets: [
|
||||
{ label: 'interval1', start: 's1', end: 'e1'},
|
||||
{ label: 'interval2', start: 's2', end: 'e2'}
|
||||
]},
|
||||
{ label: 'test_intervals2', field: 'f2', mincount: 5, sets: [
|
||||
{ label: 'interval3', start: 's3', end: 'e3'},
|
||||
{ label: 'interval4', start: 's4', end: 'e4'}
|
||||
]}
|
||||
{
|
||||
label: 'test_intervals1',
|
||||
field: 'f1',
|
||||
mincount: 2,
|
||||
sets: [
|
||||
{ label: 'interval1', start: 's1', end: 'e1' },
|
||||
{ label: 'interval2', start: 's2', end: 'e2' }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'test_intervals2',
|
||||
field: 'f2',
|
||||
mincount: 5,
|
||||
sets: [
|
||||
{ label: 'interval3', start: 's3', end: 'e3' },
|
||||
{ label: 'interval4', start: 's4', end: 'e4' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
const response1 = [
|
||||
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 }}]},
|
||||
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 }}]}
|
||||
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 } }] }
|
||||
];
|
||||
const response2 = [
|
||||
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 }}]},
|
||||
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 }}]}
|
||||
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 } }] },
|
||||
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 } }] }
|
||||
];
|
||||
const data = {
|
||||
list: {
|
||||
@@ -443,14 +492,14 @@ describe('SearchFacetFiltersService', () => {
|
||||
},
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ field: 'field1', label: 'Field 1', settings: { facetOrder: 200 }},
|
||||
{ field: 'field2', label: 'Field 2', settings: { facetOrder: 400 }},
|
||||
{ field: 'field3', label: 'Field 3', settings: { facetOrder: 500 }},
|
||||
{ field: 'field4', label: 'Field 4', settings: { facetOrder: 100 }}
|
||||
{ field: 'field1', label: 'Field 1', settings: { facetOrder: 200 } },
|
||||
{ field: 'field2', label: 'Field 2', settings: { facetOrder: 400 } },
|
||||
{ field: 'field3', label: 'Field 3', settings: { facetOrder: 500 } },
|
||||
{ field: 'field4', label: 'Field 4', settings: { facetOrder: 100 } }
|
||||
]
|
||||
}
|
||||
};
|
||||
const queryBucketsMock = [{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1} }] }];
|
||||
const queryBucketsMock = [{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }];
|
||||
const fieldBucketsMock = [{ label: 'b1', metrics: [{ value: { count: 10 } }] }];
|
||||
const data = {
|
||||
list: {
|
||||
@@ -467,20 +516,20 @@ describe('SearchFacetFiltersService', () => {
|
||||
};
|
||||
|
||||
searchFacetFiltersService.onDataLoaded(data);
|
||||
expect(searchFacetFiltersService.responseFacets.map(f => f.field)).toEqual(['field4', 'field1', 'Query 1', 'field2', 'field3']);
|
||||
expect(searchFacetFiltersService.responseFacets.map((f) => f.field)).toEqual(['field4', 'field1', 'Query 1', 'field2', 'field3']);
|
||||
});
|
||||
|
||||
it('should load category names for cm:categories facet', () => {
|
||||
const entry = {id: 'test-id-test', name: 'name', path: '/categories/General/Test Category/Subcategory'};
|
||||
const entry = { id: 'test-id-test', name: 'name', path: '/categories/General/Test Category/Subcategory' };
|
||||
searchFacetFiltersService.responseFacets = null;
|
||||
spyOn(categoryService, 'getCategory').and.returnValue(of({entry}));
|
||||
spyOn(categoryService, 'getCategory').and.returnValue(of({ entry }));
|
||||
|
||||
queryBuilder.config = {
|
||||
categories: [],
|
||||
facetFields: {
|
||||
fields: [
|
||||
{label: 'f1', field: 'f1', mincount: 0},
|
||||
{label: 'categories', field: 'cm:categories', mincount: 0}
|
||||
{ label: 'f1', field: 'f1', mincount: 0 },
|
||||
{ label: 'categories', field: 'cm:categories', mincount: 0 }
|
||||
]
|
||||
},
|
||||
facetQueries: {
|
||||
@@ -489,12 +538,16 @@ describe('SearchFacetFiltersService', () => {
|
||||
};
|
||||
|
||||
const fields: any = [
|
||||
{type: 'field', label: 'f1', buckets: [{label: 'a1'}, {label: 'a2'}]},
|
||||
{ type: 'field', label: 'f1', buckets: [{ label: 'a1' }, { label: 'a2' }] },
|
||||
{
|
||||
type: 'field', label: 'categories', buckets: [{
|
||||
label: `workspace://SpacesStore/${entry.id}`,
|
||||
filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"`
|
||||
}]
|
||||
type: 'field',
|
||||
label: 'categories',
|
||||
buckets: [
|
||||
{
|
||||
label: `workspace://SpacesStore/${entry.id}`,
|
||||
filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"`
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
const data = {
|
||||
@@ -507,7 +560,7 @@ describe('SearchFacetFiltersService', () => {
|
||||
|
||||
searchFacetFiltersService.onDataLoaded(data);
|
||||
|
||||
expect(categoryService.getCategory).toHaveBeenCalledWith(entry.id, { include: [ 'path' ]});
|
||||
expect(categoryService.getCategory).toHaveBeenCalledWith(entry.id, { include: ['path'] });
|
||||
expect(searchFacetFiltersService.responseFacets[1].buckets.items[0].display).toBe(`Test Category/Subcategory/${entry.name}`);
|
||||
expect(searchFacetFiltersService.responseFacets[1].buckets.length).toEqual(1);
|
||||
expect(searchFacetFiltersService.responseFacets.length).toEqual(2);
|
||||
@@ -517,10 +570,12 @@ describe('SearchFacetFiltersService', () => {
|
||||
searchFacetFiltersService.responseFacets = null;
|
||||
queryBuilder.config = {
|
||||
categories: [],
|
||||
facetFields: { fields: [
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ label: 'creator', field: 'creator' },
|
||||
{ label: 'modifier', field: 'modifier' }
|
||||
]},
|
||||
]
|
||||
},
|
||||
facetQueries: {
|
||||
queries: []
|
||||
}
|
||||
@@ -531,16 +586,16 @@ describe('SearchFacetFiltersService', () => {
|
||||
type: 'field',
|
||||
label: 'creator',
|
||||
buckets: [
|
||||
{ label: 'b1', metrics: [{value: {count: 10}}] },
|
||||
{ label: 'b2', metrics: [{value: {count: 1}}] }
|
||||
{ label: 'b1', metrics: [{ value: { count: 10 } }] },
|
||||
{ label: 'b2', metrics: [{ value: { count: 1 } }] }
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'field',
|
||||
label: 'modifier',
|
||||
buckets: [
|
||||
{ label: 'c1', metrics: [{value: {count: 10}}] },
|
||||
{ label: 'c2', metrics: [{value: {count: 1}}] }
|
||||
{ label: 'c1', metrics: [{ value: { count: 10 } }] },
|
||||
{ label: 'c2', metrics: [{ value: { count: 1 } }] }
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -594,13 +649,17 @@ describe('SearchFacetFiltersService', () => {
|
||||
facetQueries: { queries: [] },
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ field: 'field', label: 'Field', settings: { bucketSortBy: FacetBucketSortBy.LABEL, bucketSortDirection: FacetBucketSortDirection.DESCENDING }}
|
||||
{
|
||||
field: 'field',
|
||||
label: 'Field',
|
||||
settings: { bucketSortBy: FacetBucketSortBy.LABEL, bucketSortDirection: FacetBucketSortDirection.DESCENDING }
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
searchFacetFiltersService.onDataLoaded(data);
|
||||
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items.map(b => b.label)).toEqual(['xyzzy', 'qux', 'foo', 'baz', 'bar']);
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items.map((b) => b.label)).toEqual(['xyzzy', 'qux', 'foo', 'baz', 'bar']);
|
||||
});
|
||||
|
||||
it('should sort the buckets by count', () => {
|
||||
@@ -609,13 +668,17 @@ describe('SearchFacetFiltersService', () => {
|
||||
facetQueries: { queries: [] },
|
||||
facetFields: {
|
||||
fields: [
|
||||
{ field: 'field', label: 'Field', settings: { bucketSortBy: FacetBucketSortBy.COUNT, bucketSortDirection: FacetBucketSortDirection.ASCENDING }}
|
||||
{
|
||||
field: 'field',
|
||||
label: 'Field',
|
||||
settings: { bucketSortBy: FacetBucketSortBy.COUNT, bucketSortDirection: FacetBucketSortDirection.ASCENDING }
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
searchFacetFiltersService.onDataLoaded(data);
|
||||
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items.map(b => b.label)).toEqual(['baz', 'foo', 'xyzzy', 'qux', 'bar']);
|
||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items.map((b) => b.label)).toEqual(['baz', 'foo', 'xyzzy', 'qux', 'bar']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -16,10 +16,11 @@
|
||||
*/
|
||||
|
||||
import { SearchConfiguration } from '../models/search-configuration.interface';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { SearchHeaderQueryBuilderService } from './search-header-query-builder.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
describe('SearchHeaderQueryBuilderService', () => {
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, AppConfigService, DataSorting } from '@alfresco/adf-core';
|
||||
import { AppConfigService, DataSorting } from '@alfresco/adf-core';
|
||||
import { SearchConfiguration } from '../models/search-configuration.interface';
|
||||
import { BaseQueryBuilderService } from './base-query-builder.service';
|
||||
import { SearchCategory } from '../models/search-category.interface';
|
||||
@@ -26,6 +26,7 @@ import { Observable } from 'rxjs';
|
||||
import { SearchSortingDefinition } from '../models/search-sorting-definition.interface';
|
||||
import { FilterSearch } from '../models/filter-search.interface';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -17,7 +17,8 @@
|
||||
|
||||
import { SearchQueryBuilderService } from './search-query-builder.service';
|
||||
import { SearchConfiguration } from '../models/search-configuration.interface';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { FacetField } from '../models/facet-field.interface';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
|
@@ -16,10 +16,11 @@
|
||||
*/
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { SearchConfiguration } from '../models/search-configuration.interface';
|
||||
import { BaseQueryBuilderService } from './base-query-builder.service';
|
||||
import { ADF_SEARCH_CONFIGURATION } from '../search-configuration.token';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class SearchQueryBuilderService extends BaseQueryBuilderService {
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { NodePaging, QueriesApi, SearchRequest, ResultSetPaging, SearchApi } from '@alfresco/js-api';
|
||||
import { Observable, Subject, from } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { SearchConfigurationService } from './search-configuration.service';
|
||||
|
||||
@Injectable({
|
||||
|
@@ -32,8 +32,9 @@ import {
|
||||
NodeSecurityMarkBody,
|
||||
GsGroupInclude
|
||||
} from '@alfresco/js-api';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { finalize } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
|
||||
const DEFAULT_SKIP_COUNT = 0;
|
||||
const DEFAULT_INCLUDE = 'inUse';
|
||||
|
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiConfig, AlfrescoApi } from '@alfresco/js-api';
|
||||
|
||||
export interface AlfrescoApiInterface {
|
||||
load(): Promise<void> ;
|
||||
}
|
||||
|
||||
export interface AlfrescoApiFactory {
|
||||
createAlfrescoApi(config: AlfrescoApiConfig): AlfrescoApi;
|
||||
}
|
136
lib/content-services/src/lib/services/alfresco-api.service.ts
Normal file
136
lib/content-services/src/lib/services/alfresco-api.service.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { ReplaySubject } from 'rxjs';
|
||||
import { AlfrescoApiFactory } from './alfresco-api.interface';
|
||||
import { AppConfigService, AppConfigValues, OauthConfigModel, OpenidConfiguration, StorageService } from '@alfresco/adf-core';
|
||||
|
||||
export const ALFRESCO_API_FACTORY = new InjectionToken('ALFRESCO_API_FACTORY');
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AlfrescoApiService {
|
||||
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
|
||||
|
||||
protected alfrescoApi: AlfrescoApi;
|
||||
|
||||
lastConfig: AlfrescoApiConfig;
|
||||
currentAppConfig: AlfrescoApiConfig;
|
||||
|
||||
idpConfig: OpenidConfiguration;
|
||||
|
||||
private excludedErrorUrl: string[] = ['api/enterprise/system/properties'];
|
||||
|
||||
getInstance(): AlfrescoApi {
|
||||
return this.alfrescoApi;
|
||||
}
|
||||
|
||||
constructor(
|
||||
protected appConfig: AppConfigService,
|
||||
protected storageService: StorageService,
|
||||
@Optional()
|
||||
@Inject(ALFRESCO_API_FACTORY)
|
||||
private alfrescoApiFactory?: AlfrescoApiFactory
|
||||
) {}
|
||||
|
||||
async load(config: AlfrescoApiConfig): Promise<void> {
|
||||
this.currentAppConfig = config;
|
||||
|
||||
if (config.authType === 'OAUTH') {
|
||||
await this.mapAlfrescoApiOpenIdConfig();
|
||||
}
|
||||
|
||||
this.initAlfrescoApiWithConfig();
|
||||
this.alfrescoApiInitialized.next(true);
|
||||
}
|
||||
|
||||
async reset() {
|
||||
this.getCurrentAppConfig();
|
||||
if (this.currentAppConfig.authType === 'OAUTH') {
|
||||
await this.mapAlfrescoApiOpenIdConfig();
|
||||
}
|
||||
this.initAlfrescoApiWithConfig();
|
||||
}
|
||||
|
||||
private getAuthWithFixedOriginLocation(): OauthConfigModel {
|
||||
const oauth = this.appConfig.oauth2;
|
||||
|
||||
if (oauth) {
|
||||
oauth.redirectUri = window.location.origin + window.location.pathname;
|
||||
oauth.redirectUriLogout = window.location.origin + window.location.pathname;
|
||||
}
|
||||
return oauth;
|
||||
}
|
||||
|
||||
private async mapAlfrescoApiOpenIdConfig() {
|
||||
this.idpConfig = await this.appConfig.loadWellKnown(this.currentAppConfig.oauth2.host);
|
||||
this.currentAppConfig.oauth2.tokenUrl = this.idpConfig.token_endpoint;
|
||||
this.currentAppConfig.oauth2.authorizationUrl = this.idpConfig.authorization_endpoint;
|
||||
this.currentAppConfig.oauth2.logoutUrl = this.idpConfig.end_session_endpoint;
|
||||
this.currentAppConfig.oauth2.userinfoEndpoint = this.idpConfig.userinfo_endpoint;
|
||||
}
|
||||
|
||||
private getCurrentAppConfig() {
|
||||
const oauth = this.getAuthWithFixedOriginLocation();
|
||||
|
||||
this.currentAppConfig = new AlfrescoApiConfig({
|
||||
provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
|
||||
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
|
||||
hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST),
|
||||
authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'),
|
||||
contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM),
|
||||
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
|
||||
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
|
||||
withCredentials: this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
|
||||
domainPrefix: this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX),
|
||||
oauth2: oauth
|
||||
});
|
||||
}
|
||||
|
||||
protected initAlfrescoApi() {
|
||||
this.getCurrentAppConfig();
|
||||
this.initAlfrescoApiWithConfig();
|
||||
}
|
||||
|
||||
private initAlfrescoApiWithConfig() {
|
||||
if (this.alfrescoApi && this.isDifferentConfig(this.lastConfig, this.currentAppConfig)) {
|
||||
this.alfrescoApi.setConfig(this.currentAppConfig);
|
||||
} else {
|
||||
this.alfrescoApi = this.createInstance(this.currentAppConfig);
|
||||
}
|
||||
this.lastConfig = this.currentAppConfig;
|
||||
}
|
||||
|
||||
createInstance(config: AlfrescoApiConfig): AlfrescoApi {
|
||||
if (this.alfrescoApiFactory) {
|
||||
return this.alfrescoApiFactory.createAlfrescoApi(config);
|
||||
}
|
||||
return new AlfrescoApi(config);
|
||||
}
|
||||
|
||||
isDifferentConfig(lastConfig: AlfrescoApiConfig, newConfig: AlfrescoApiConfig) {
|
||||
return JSON.stringify(lastConfig) !== JSON.stringify(newConfig);
|
||||
}
|
||||
|
||||
isExcludedErrorListener(currentFullPath: string): boolean {
|
||||
const formattedPath = currentFullPath.replace(this.lastConfig.hostBpm + '/' + this.lastConfig.contextRootBpm, '');
|
||||
return this.excludedErrorUrl.includes(formattedPath);
|
||||
}
|
||||
}
|
18
lib/content-services/src/lib/services/index.ts
Normal file
18
lib/content-services/src/lib/services/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './public-api';
|
19
lib/content-services/src/lib/services/public-api.ts
Normal file
19
lib/content-services/src/lib/services/public-api.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './alfresco-api.service';
|
||||
export { AlfrescoApiFactory } from './alfresco-api.interface';
|
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { EventEmitter, Injectable, Output } from '@angular/core';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
|
@@ -20,10 +20,8 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import {
|
||||
CoreModule,
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
CookieService,
|
||||
AlfrescoApiServiceMock,
|
||||
AppConfigServiceMock,
|
||||
CookieServiceMock,
|
||||
AuthModule,
|
||||
@@ -31,8 +29,10 @@ import {
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentModule } from '../content.module';
|
||||
import { versionCompatibilityFactory } from '../version-compatibility/version-compatibility-factory';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
||||
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
import { AlfrescoApiServiceMock } from '../mock';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { ContentApi } from '@alfresco/js-api';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
|
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService, ConfirmDialogComponent } from '@alfresco/adf-core';
|
||||
import { ConfirmDialogComponent } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { Component, Input, OnChanges, ViewEncapsulation, EventEmitter, Output, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { VersionsApi, Node, VersionEntry, NodesApi, NodeEntry, ContentApi, ContentPagingQuery } from '@alfresco/js-api';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
@@ -23,8 +23,6 @@ import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extension
|
||||
import { ContentInfo, Node, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||
import { AlfrescoViewerComponent, ContentService, NodeActionsService, RenditionService } from '@alfresco/adf-content-services';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AlfrescoApiServiceMock,
|
||||
AuthModule,
|
||||
CloseButtonPosition,
|
||||
EventMock,
|
||||
@@ -41,6 +39,8 @@ import { throwError } from 'rxjs';
|
||||
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ESCAPE } from '@angular/cdk/keycodes';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AlfrescoApiService } from '../../services';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-viewer-container-toolbar',
|
||||
|
@@ -30,7 +30,6 @@ import {
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
CloseButtonPosition,
|
||||
Track,
|
||||
ViewerComponent,
|
||||
@@ -42,6 +41,7 @@ import {
|
||||
ViewerToolbarComponent,
|
||||
ViewUtilService
|
||||
} from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ContentApi, Node, NodeEntry, NodesApi, RenditionEntry, SharedlinksApi, Version, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { RenditionService } from '../../common/services/rendition.service';
|
||||
|
@@ -42,9 +42,13 @@ export * from './lib/tree/index';
|
||||
export * from './lib/category/index';
|
||||
export * from './lib/viewer/index';
|
||||
export * from './lib/security/index';
|
||||
export * from './lib/api-factories';
|
||||
export * from './lib/services/index';
|
||||
export * from './lib/infinite-scroll-datasource';
|
||||
export * from './lib/prediction/index';
|
||||
export * from './lib/legal-hold/index';
|
||||
export * from './lib/api-factories';
|
||||
export * from './lib/mock/alfresco-api.service.mock';
|
||||
|
||||
export * from './lib/content.module';
|
||||
export * from './lib/material.module';
|
||||
|
Reference in New Issue
Block a user