mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +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:
parent
b60797e3b1
commit
e617333f00
11
.github/workflows/release-branch.yml
vendored
11
.github/workflows/release-branch.yml
vendored
@ -123,12 +123,21 @@ jobs:
|
||||
with:
|
||||
dry-run-flag: ${{ inputs.dry-run-flag }}
|
||||
- uses: ./.github/actions/download-node-modules-and-artifacts
|
||||
- name: build libraries
|
||||
- name: Set libraries versions
|
||||
run: |
|
||||
set -u;
|
||||
./scripts/update-version.sh -gnu || exit 1;
|
||||
- name: Set migrations
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const setMigrations = require('./scripts/github/release/set-migrations.js');
|
||||
setMigrations();
|
||||
- name: Build libraries
|
||||
run: |
|
||||
npx nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache
|
||||
npx nx affected $NX_CALCULATION_FLAGS --target=pretheme
|
||||
npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics
|
||||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
name: release libraries GH registry
|
||||
with:
|
||||
|
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@ -182,12 +182,21 @@ jobs:
|
||||
with:
|
||||
dry-run-flag: ${{ inputs.dry-run-flag }}
|
||||
- uses: ./.github/actions/download-node-modules-and-artifacts
|
||||
- name: build libraries
|
||||
- name: Set libraries versions
|
||||
run: |
|
||||
set -u;
|
||||
./scripts/github/build/bumpversion.sh
|
||||
- name: Set migrations
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const setMigrations = require('./scripts/github/release/set-migrations.js');
|
||||
setMigrations();
|
||||
- name: build libraries
|
||||
run: |
|
||||
npx nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache
|
||||
npx nx affected $NX_CALCULATION_FLAGS --target=pretheme
|
||||
npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics
|
||||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
name: release libraries GH registry
|
||||
with:
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AvatarComponent,
|
||||
HeaderLayoutComponent,
|
||||
LogoutDirective,
|
||||
@ -35,7 +34,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatLineModule } from '@angular/material/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
||||
import { FileUploadingDialogComponent } from '@alfresco/adf-content-services';
|
||||
import { AlfrescoApiService, FileUploadingDialogComponent } from '@alfresco/adf-content-services';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
@ -18,6 +18,7 @@
|
||||
// eslint-disable-next-line
|
||||
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { Pagination, UserProcessInstanceFilterRepresentation, ScriptFilesApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
||||
import {
|
||||
FORM_FIELD_VALIDATORS,
|
||||
@ -26,7 +27,6 @@ import {
|
||||
AppConfigService,
|
||||
PaginationComponent,
|
||||
UserPreferenceValues,
|
||||
AlfrescoApiService,
|
||||
UserPreferencesService,
|
||||
NotificationService,
|
||||
SidebarActionMenuComponent
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, EventEmitter, Output, ViewEncapsulation, OnInit, Input } from '@angular/core';
|
||||
import { Validators, UntypedFormGroup, UntypedFormBuilder, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { AppConfigService, AppConfigValues, StorageService, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, AppConfigValues, StorageService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { ENTER } from '@angular/cdk/keycodes';
|
||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@ -26,6 +26,7 @@ import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
|
||||
export const HOST_REGEX = '^(http|https)://.*[^/]$';
|
||||
|
||||
|
@ -15,9 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AppConfigService, UserPreferencesService, StorageService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService, AlfrescoApiService, StorageService, UserPreferencesService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { DemoForm } from './demo-form.mock';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -194,7 +194,7 @@ A collection of Angular components for generic use.
|
||||
| Name | Description | Source link |
|
||||
| ---- | ----------- | -------- |
|
||||
| [APS Alfresco Content Service](core/services/activiti-alfresco.service.md) | Gets Alfresco Repository folder content based on a Repository account configured in Alfresco Process Services (APS). | [Source](../lib/process-services/src/lib/form/services/activiti-alfresco.service.ts) |
|
||||
| [Alfresco Api Service](core/services/alfresco-api.service.md) | Provides access to an initialized AlfrescoJSApi instance. | [Source](../lib/core/src/lib/services/alfresco-api.service.ts) |
|
||||
| [Alfresco Api Service](core/services/alfresco-api.service.md) | Provides access to an initialized AlfrescoJSApi instance. | [Source](lib/content-services/src/lib/services/alfresco-api.service.ts) |
|
||||
| [App Config service](core/services/app-config.service.md) | Supports app configuration settings, stored server side. | [Source](../lib/core/src/lib/app-config/app-config.service.ts) |
|
||||
| [Apps Process service](core/services/apps-process.service.md) | Gets details of the Process Services apps that are deployed for the user. | [Source](../lib/process-services/src/lib/services/apps-process.service.ts) |
|
||||
| [Auth Guard Bpm service](core/services/auth-guard-bpm.service.md) | Adds authentication with Process Services to a route within the app. | [Source](../lib/core/src/lib/auth/guard/auth-guard-bpm.service.ts) |
|
||||
|
24
docs/breaking-changes/breaking-change-6.10.0-7.0.0.md
Normal file
24
docs/breaking-changes/breaking-change-6.10.0-7.0.0.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
Title: Breaking changes, 6.10.0 -> 7.0.0
|
||||
---
|
||||
|
||||
# Breaking changes, 6.10.0 -> 7.0.0
|
||||
|
||||
This document lists all the deprecated ADF v2.x components that were removed for v3.0.0:
|
||||
|
||||
- [PR-9317](https://github.com/Alfresco/alfresco-ng2-components/pull/9317) Move alfresco js-API and AlfrescoApi service out from the core
|
||||
|
||||
Move `AlfrescoApiServiceMock` and `AlfrescoApiServiceMock` from `core` library to `content-services`, These libraries are content related therefore should not live in `core`
|
||||
|
||||
To mitigate this change, we can run migration:
|
||||
|
||||
```
|
||||
npx nx migrate @alfresco/adf-core@7.0.0
|
||||
npx nx migrate --run-migrations
|
||||
```
|
||||
|
||||
Or for pure angular repository:
|
||||
|
||||
```
|
||||
npx ng update @alfresco/adf-core@7.0.0
|
||||
```
|
@ -363,7 +363,7 @@ points you should pay attention to:
|
||||
|
||||
```ts
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
|
||||
export class FilesComponent implements OnInit {
|
||||
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2019-01-17
|
||||
---
|
||||
|
||||
# [Alfresco Api Service](../../../lib/core/src/lib/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts")
|
||||
# [Alfresco Api Service](lib/content-services/src/lib/services/alfresco-api.service.ts "Defined in alfresco-api.service.ts")
|
||||
|
||||
Provides access to an initialized **AlfrescoJSApi** instance.
|
||||
|
||||
|
@ -286,7 +286,7 @@ file and replace the content with the following:
|
||||
|
||||
```ts
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { ObjectDataTableAdapter, ObjectDataRow } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
|
@ -16,10 +16,9 @@
|
||||
*/
|
||||
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
import { StorageService } from '../common/services/storage.service';
|
||||
import { StorageService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService } from '../app-config';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
|
||||
@Injectable()
|
@ -17,9 +17,8 @@
|
||||
|
||||
import { AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||
import { AppConfigService, AppConfigValues, StorageService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { StorageService } from '../common/services/storage.service';
|
||||
|
||||
/**
|
||||
* Create a factory to resolve an api service instance
|
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,31 +38,25 @@ 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(
|
||||
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(
|
||||
return from(this.discoveryApi.getRepositoryInformation()).pipe(
|
||||
map((res) => res.entry.repository),
|
||||
catchError((err) => throwError(err))
|
||||
);
|
||||
@ -82,8 +70,7 @@ export class DiscoveryApiService {
|
||||
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
||||
const aboutApi = new AboutApi(this.alfrescoApiService.getInstance());
|
||||
|
||||
return from(aboutApi.getAppVersion())
|
||||
.pipe(
|
||||
return from(aboutApi.getAppVersion()).pipe(
|
||||
map((res) => new BpmProductVersionModel(res)),
|
||||
catchError((err) => throwError(err))
|
||||
);
|
||||
@ -92,10 +79,9 @@ export class DiscoveryApiService {
|
||||
getBPMSystemProperties(): Observable<SystemPropertiesRepresentation> {
|
||||
const systemPropertiesApi = new SystemPropertiesApi(this.alfrescoApiService.getInstance());
|
||||
|
||||
return from(systemPropertiesApi.getProperties())
|
||||
.pipe(
|
||||
return from(systemPropertiesApi.getProperties()).pipe(
|
||||
map((res: any) => {
|
||||
if ('string' === typeof (res)) {
|
||||
if ('string' === typeof res) {
|
||||
throw new Error('Not valid response');
|
||||
}
|
||||
return res;
|
||||
|
@ -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, {
|
||||
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, {
|
||||
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, {
|
||||
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'
|
||||
|
@ -16,9 +16,8 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { StorageService } from '../common/services/storage.service';
|
||||
import { AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||
|
||||
@Injectable()
|
||||
export class AlfrescoApiServiceMock extends AlfrescoApiService {
|
@ -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: [{
|
||||
providers: [
|
||||
{
|
||||
provide: CategoryService,
|
||||
useValue: {
|
||||
getCategory: () => EMPTY
|
||||
}
|
||||
}]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
categoryService = TestBed.inject(CategoryService);
|
||||
@ -73,11 +76,13 @@ describe('SearchFacetFiltersService', () => {
|
||||
const data = {
|
||||
list: {
|
||||
context: {
|
||||
facets: [{
|
||||
facets: [
|
||||
{
|
||||
type: 'query',
|
||||
label: 'label1',
|
||||
buckets: queries
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -107,16 +112,17 @@ describe('SearchFacetFiltersService', () => {
|
||||
{ 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: [{
|
||||
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,7 +205,10 @@ describe('SearchFacetFiltersService', () => {
|
||||
};
|
||||
|
||||
const initialFields: any = [
|
||||
{ type: 'field', label: 'f1', buckets: [
|
||||
{
|
||||
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: []
|
||||
}
|
||||
@ -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,20 +348,24 @@ describe('SearchFacetFiltersService', () => {
|
||||
facetQueries: { queries: [] }
|
||||
};
|
||||
|
||||
const firstCallFields: any = [{
|
||||
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 = [{
|
||||
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,14 +377,22 @@ describe('SearchFacetFiltersService', () => {
|
||||
categories: [],
|
||||
facetIntervals: {
|
||||
intervals: [
|
||||
{ label: 'test_intervals1', field: 'f1', sets: [
|
||||
{
|
||||
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: 'test_intervals2',
|
||||
field: 'f2',
|
||||
sets: [
|
||||
{ label: 'interval3', start: 's3', end: 'e3' },
|
||||
{ label: 'interval4', start: 's4', end: 'e4' }
|
||||
]}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -390,14 +429,24 @@ describe('SearchFacetFiltersService', () => {
|
||||
categories: [],
|
||||
facetIntervals: {
|
||||
intervals: [
|
||||
{ label: 'test_intervals1', field: 'f1', mincount: 2, sets: [
|
||||
{
|
||||
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: 'test_intervals2',
|
||||
field: 'f2',
|
||||
mincount: 5,
|
||||
sets: [
|
||||
{ label: 'interval3', start: 's3', end: 'e3' },
|
||||
{ label: 'interval4', start: 's4', end: 'e4' }
|
||||
]}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -467,7 +516,7 @@ 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', () => {
|
||||
@ -491,10 +540,14 @@ describe('SearchFacetFiltersService', () => {
|
||||
const fields: any = [
|
||||
{ type: 'field', label: 'f1', buckets: [{ label: 'a1' }, { label: 'a2' }] },
|
||||
{
|
||||
type: 'field', label: 'categories', buckets: [{
|
||||
type: 'field',
|
||||
label: 'categories',
|
||||
buckets: [
|
||||
{
|
||||
label: `workspace://SpacesStore/${entry.id}`,
|
||||
filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"`
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
const data = {
|
||||
@ -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: []
|
||||
}
|
||||
@ -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';
|
||||
|
@ -17,12 +17,9 @@
|
||||
|
||||
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||
import { ReplaySubject } from 'rxjs';
|
||||
import { OauthConfigModel } from '../auth/models/oauth-config.model';
|
||||
import { StorageService } from '../common/services/storage.service';
|
||||
import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface';
|
||||
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');
|
||||
|
||||
@ -30,7 +27,6 @@ export const ALFRESCO_API_FACTORY = new InjectionToken('ALFRESCO_API_FACTORY');
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AlfrescoApiService {
|
||||
|
||||
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
|
||||
|
||||
protected alfrescoApi: AlfrescoApi;
|
||||
@ -50,7 +46,8 @@ export class AlfrescoApiService {
|
||||
protected appConfig: AppConfigService,
|
||||
protected storageService: StorageService,
|
||||
@Optional()
|
||||
@Inject(ALFRESCO_API_FACTORY) private alfrescoApiFactory?: AlfrescoApiFactory
|
||||
@Inject(ALFRESCO_API_FACTORY)
|
||||
private alfrescoApiFactory?: AlfrescoApiFactory
|
||||
) {}
|
||||
|
||||
async load(config: AlfrescoApiConfig): Promise<void> {
|
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';
|
@ -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';
|
||||
|
@ -16,3 +16,4 @@
|
||||
*/
|
||||
|
||||
export * from './src/public-api';
|
||||
export * from './api/src/index';
|
||||
|
@ -37,7 +37,8 @@
|
||||
"@alfresco/adf-extensions": ">=7.0.0-alpha.2-0",
|
||||
"@ngx-translate/core": ">=14.0.0",
|
||||
"minimatch-browser": ">=1.0.0",
|
||||
"pdfjs-dist": ">=3.3.122"
|
||||
"pdfjs-dist": ">=3.3.122",
|
||||
"ts-morph": "^20.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"core",
|
||||
@ -45,5 +46,11 @@
|
||||
"angular",
|
||||
"components"
|
||||
],
|
||||
"license": "Apache-2.0"
|
||||
"license": "Apache-2.0",
|
||||
"ng-update": {
|
||||
"migrations": "./schematics/migrations/collection.json"
|
||||
},
|
||||
"nx-migrations": {
|
||||
"migrations": "./schematics/migrations/collection.json"
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,16 @@
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"build-schematics": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "npx tsc -p lib/core/tsconfig.schematics.json && cp lib/core/schematics/migrations/collection.json dist/libs/core/schematics/migrations/collection.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
@ -133,7 +143,7 @@
|
||||
},
|
||||
"npm-publish": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build", "pretheme"],
|
||||
"dependsOn": ["build", "pretheme", "build-schematics"],
|
||||
"options": {
|
||||
"cwd": "dist/libs/core",
|
||||
"commands": [
|
||||
|
189
lib/core/schematics/migrations/7_0_0/index.ts
Normal file
189
lib/core/schematics/migrations/7_0_0/index.ts
Normal file
@ -0,0 +1,189 @@
|
||||
/*!
|
||||
* @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 { Rule, SchematicContext, SchematicsException, Tree } from '@angular-devkit/schematics';
|
||||
import { Project, NamedImports, SourceFile, ImportSpecifier, ImportDeclaration } from 'ts-morph';
|
||||
|
||||
interface MigrationData {
|
||||
change: {
|
||||
importedValue: string;
|
||||
importSource: string;
|
||||
};
|
||||
to: {
|
||||
importedValue: string;
|
||||
importSource: string;
|
||||
};
|
||||
}
|
||||
|
||||
const alfrescoApiServiceMigration: MigrationData = {
|
||||
change: {
|
||||
importedValue: 'AlfrescoApiService',
|
||||
importSource: '@alfresco/adf-core'
|
||||
},
|
||||
to: {
|
||||
importedValue: 'AlfrescoApiService',
|
||||
importSource: '@alfresco/adf-content-services'
|
||||
}
|
||||
};
|
||||
|
||||
const alfrescoApiMockMigration: MigrationData = {
|
||||
change: {
|
||||
importedValue: 'AlfrescoApiServiceMock',
|
||||
importSource: '@alfresco/adf-core'
|
||||
},
|
||||
to: {
|
||||
importedValue: 'AlfrescoApiServiceMock',
|
||||
importSource: '@alfresco/adf-content-services'
|
||||
}
|
||||
};
|
||||
|
||||
const alfrescoApiFactoryMigration: MigrationData = {
|
||||
change: {
|
||||
importedValue: 'AlfrescoApiFactory',
|
||||
importSource: '@alfresco/adf-core'
|
||||
},
|
||||
to: {
|
||||
importedValue: 'AlfrescoApiFactory',
|
||||
importSource: '@alfresco/adf-content-services'
|
||||
}
|
||||
};
|
||||
|
||||
const migrations: MigrationData[] = [alfrescoApiServiceMigration, alfrescoApiMockMigration, alfrescoApiFactoryMigration];
|
||||
|
||||
/**
|
||||
* @returns Schematic rule for updating imports
|
||||
*/
|
||||
export function updateAlfrescoApiImports(): Rule {
|
||||
const project = new Project();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
return (tree: Tree, _context: SchematicContext) => {
|
||||
tree.visit((filePath: string) => visitor(filePath, tree, project));
|
||||
|
||||
return tree;
|
||||
};
|
||||
}
|
||||
|
||||
export const visitor = (filePath: string, tree: Pick<Tree, 'read' | 'overwrite'>, project: Project) => {
|
||||
if (
|
||||
!filePath.includes('/.git/') &&
|
||||
!filePath.includes('/node_modules/') &&
|
||||
!filePath.includes('/.angular/') &&
|
||||
!filePath.includes('/.nxcache/') &&
|
||||
/\.ts$/.test(filePath)
|
||||
) {
|
||||
const bufferFileContent = tree.read(filePath);
|
||||
|
||||
if (!bufferFileContent) {
|
||||
throw new SchematicsException(`Could not read file: ${filePath}`);
|
||||
}
|
||||
|
||||
migrations.forEach((migrationData) => {
|
||||
const fileWithUpdatedImport = moveImport(filePath, bufferFileContent, project, migrationData);
|
||||
|
||||
if (fileWithUpdatedImport) {
|
||||
tree.overwrite(filePath, fileWithUpdatedImport);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const moveImport = (filePath: string, bufferFileContent: Buffer, project: Project, migrationData: MigrationData): string | undefined => {
|
||||
const fileContent = bufferFileContent.toString();
|
||||
const predictImport = fileContent.includes(migrationData.change.importedValue);
|
||||
|
||||
if (predictImport) {
|
||||
const sourceFile = project.getSourceFile(`migration-${filePath}`) ?? project.createSourceFile(`migration-${filePath}`, fileContent);
|
||||
|
||||
const alfrescoApiImportResult = getImportedValueFromSource(sourceFile, {
|
||||
importedIdentifier: migrationData.change.importedValue,
|
||||
from: migrationData.change.importSource
|
||||
});
|
||||
|
||||
if (alfrescoApiImportResult?.importedValue) {
|
||||
if (alfrescoApiImportResult.allImportedValuesCount === 1) {
|
||||
// There is only one import e.g. import { A } from 'A';
|
||||
// Therefore, we need to remove whole import statement
|
||||
alfrescoApiImportResult.importSource?.remove();
|
||||
} else {
|
||||
alfrescoApiImportResult.importedValue?.remove();
|
||||
}
|
||||
|
||||
const alfrescoContentServiceImport = getSourceImport(sourceFile, migrationData.to.importSource);
|
||||
|
||||
if (alfrescoContentServiceImport) {
|
||||
alfrescoContentServiceImport.addNamedImport(migrationData.to.importedValue);
|
||||
} else {
|
||||
sourceFile.insertStatements(
|
||||
sourceFile.getImportDeclarations().length + 1,
|
||||
`import { ${migrationData.to.importedValue} } from '${migrationData.to.importSource}';`
|
||||
);
|
||||
}
|
||||
|
||||
return sourceFile.getFullText();
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const getSourceImport = (sourceFile: SourceFile, from: string): ImportDeclaration | undefined => {
|
||||
const moduleImports = sourceFile.getImportDeclarations();
|
||||
|
||||
const importDeclaration = moduleImports.find((moduleImport) => {
|
||||
const currentImportSource = moduleImport.getModuleSpecifierValue();
|
||||
return currentImportSource === from;
|
||||
});
|
||||
|
||||
return importDeclaration;
|
||||
};
|
||||
|
||||
const getImportedValueFromSource = (
|
||||
sourceFile: SourceFile,
|
||||
searchedImport: {
|
||||
importedIdentifier: string;
|
||||
from: string;
|
||||
}
|
||||
): {
|
||||
importedValue: ImportSpecifier | undefined;
|
||||
importSource: ImportDeclaration | undefined;
|
||||
allImportedValuesCount: number | undefined;
|
||||
} => {
|
||||
const importSource = getSourceImport(sourceFile, searchedImport.from);
|
||||
|
||||
if (!importSource) {
|
||||
return {
|
||||
importedValue: undefined,
|
||||
importSource: undefined,
|
||||
allImportedValuesCount: undefined
|
||||
};
|
||||
}
|
||||
|
||||
const importedValues = importSource?.getImportClause();
|
||||
const namedImports = importedValues?.getNamedBindings() as NamedImports;
|
||||
const namedImportsElements = namedImports?.getElements() ?? [];
|
||||
|
||||
const importedValue = namedImportsElements.find((binding) => binding.getName() === searchedImport.importedIdentifier);
|
||||
|
||||
return {
|
||||
importedValue,
|
||||
importSource,
|
||||
allImportedValuesCount: namedImportsElements.length
|
||||
};
|
||||
};
|
||||
|
||||
export default updateAlfrescoApiImports;
|
46
lib/core/schematics/migrations/collection.json
Normal file
46
lib/core/schematics/migrations/collection.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
||||
"schematics": {
|
||||
"move-out-alfresco-api": {
|
||||
"description": "Update alfresco-api imports",
|
||||
"version": "7.0.0",
|
||||
"factory": "./7_0_0/index#updateAlfrescoApiImports"
|
||||
}
|
||||
},
|
||||
"packageJsonUpdates": {
|
||||
"move-out-alfresco-api": {
|
||||
"version": "7.0.0",
|
||||
"packages": {
|
||||
"ts-morph": {
|
||||
"version": "^20.0.0",
|
||||
"alwaysAddToPackageJson": true,
|
||||
"addToPackageJson": "devDependencies"
|
||||
},
|
||||
"@alfresco/adf-content-services": {
|
||||
"version": "7.0.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@alfresco/adf-extensions": {
|
||||
"version": "7.0.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@alfresco/adf-process-services-cloud": {
|
||||
"version": "7.0.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@alfresco/adf-process-services": {
|
||||
"version": "7.0.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@alfresco/eslint-plugin-eslint-angular": {
|
||||
"version": "7.0.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
},
|
||||
"@alfresco/js-api": {
|
||||
"version": "8.0.0",
|
||||
"alwaysAddToPackageJson": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -63,7 +63,6 @@ export enum Status {
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppConfigService {
|
||||
|
||||
config: any = {
|
||||
application: {
|
||||
name: 'Alfresco ADF Application'
|
||||
@ -97,8 +96,7 @@ export class AppConfigService {
|
||||
* @returns Property value, when loaded
|
||||
*/
|
||||
select(property: string): Observable<any> {
|
||||
return this.onLoadSubject
|
||||
.pipe(
|
||||
return this.onLoadSubject.pipe(
|
||||
map((config) => ObjectUtils.getValue(config, property)),
|
||||
distinctUntilChanged()
|
||||
);
|
||||
@ -170,9 +168,7 @@ export class AppConfigService {
|
||||
protected onDataLoaded() {
|
||||
this.onLoadSubject.next(this.config);
|
||||
|
||||
this.extensionService.setup$
|
||||
.pipe(take(1))
|
||||
.subscribe((config) => this.onExtensionsLoaded(config));
|
||||
this.extensionService.setup$.pipe(take(1)).subscribe((config) => this.onExtensionsLoaded(config));
|
||||
}
|
||||
|
||||
protected onExtensionsLoaded(config: ExtensionConfig) {
|
||||
@ -229,9 +225,7 @@ export class AppConfigService {
|
||||
*/
|
||||
loadWellKnown(hostIdp: string): Promise<OpenidConfiguration> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.http
|
||||
.get<OpenidConfiguration>(`${hostIdp}/.well-known/openid-configuration`)
|
||||
.subscribe({
|
||||
this.http.get<OpenidConfiguration>(`${hostIdp}/.well-known/openid-configuration`).subscribe({
|
||||
next: (res: OpenidConfiguration) => {
|
||||
resolve(res);
|
||||
},
|
||||
@ -273,5 +267,4 @@ export class AppConfigService {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { AUTH_CONFIG, OAuthModule, OAuthStorage } from 'angular-oauth2-oidc';
|
||||
import { AlfrescoApiNoAuthService } from '../../api-factories/alfresco-api-no-auth.service';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AuthenticationService } from '../services/authentication.service';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config';
|
||||
@ -44,7 +42,6 @@ export function loginFactory(redirectService: RedirectAuthService): () => Promis
|
||||
providers: [
|
||||
{ provide: OAuthStorage, useExisting: StorageService },
|
||||
{ provide: AuthenticationService},
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService },
|
||||
{
|
||||
provide: AUTH_CONFIG,
|
||||
useFactory: authConfigFactory,
|
||||
|
@ -21,8 +21,6 @@ import { AppConfigService } from '../../app-config/app-config.service';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service';
|
||||
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('UserPreferencesService', () => {
|
||||
@ -30,14 +28,12 @@ describe('UserPreferencesService', () => {
|
||||
let preferences: UserPreferencesService;
|
||||
let storage: StorageService;
|
||||
let appConfig: AppConfigServiceMock;
|
||||
let alfrescoApiService: AlfrescoApiServiceMock;
|
||||
let translate: TranslateService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
]
|
||||
});
|
||||
@ -53,7 +49,6 @@ describe('UserPreferencesService', () => {
|
||||
storage = TestBed.inject(StorageService);
|
||||
storage.clear();
|
||||
translate = TestBed.inject(TranslateService);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService) as AlfrescoApiServiceMock;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -103,7 +98,7 @@ describe('UserPreferencesService', () => {
|
||||
});
|
||||
|
||||
it('should null value return default prefix', () => {
|
||||
storage.setItem('paginationSize', null);
|
||||
storage.setItem('paginationSize', '');
|
||||
const paginationSize = preferences.getPropertyKey('paginationSize');
|
||||
expect(preferences.get(paginationSize, 'default')).toBe('default');
|
||||
});
|
||||
@ -172,7 +167,7 @@ describe('UserPreferencesService', () => {
|
||||
}
|
||||
];
|
||||
appConfig.config.locale = 'fake-locale-config';
|
||||
alfrescoApiService.initialize();
|
||||
appConfig.load();
|
||||
const textOrientation = preferences.getPropertyKey('textOrientation');
|
||||
expect(storage.getItem(textOrientation)).toBe('ltr');
|
||||
});
|
||||
@ -185,7 +180,7 @@ describe('UserPreferencesService', () => {
|
||||
}
|
||||
];
|
||||
appConfig.config.locale = 'fake-locale-config';
|
||||
alfrescoApiService.initialize();
|
||||
appConfig.load();
|
||||
const textOrientation = preferences.getPropertyKey('textOrientation');
|
||||
expect(storage.getItem(textOrientation)).toBe('rtl');
|
||||
});
|
||||
@ -196,7 +191,6 @@ describe('UserPreferencesService', () => {
|
||||
key: 'fake-locale-browser'
|
||||
}
|
||||
];
|
||||
alfrescoApiService.initialize();
|
||||
|
||||
const textOrientation = preferences.getPropertyKey('textOrientation');
|
||||
expect(storage.getItem(textOrientation)).toBe(null);
|
||||
@ -210,7 +204,7 @@ describe('UserPreferencesService', () => {
|
||||
}
|
||||
];
|
||||
spyOn(translate, 'getBrowserCultureLang').and.returnValue('fake-locale-browser');
|
||||
alfrescoApiService.initialize();
|
||||
appConfig.load();
|
||||
|
||||
let lastValue;
|
||||
|
||||
|
@ -20,8 +20,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable, BehaviorSubject } from 'rxjs';
|
||||
import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service';
|
||||
import { StorageService } from './storage.service';
|
||||
import { distinctUntilChanged, map, filter } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||
import { LanguageItem } from './language-item.interface';
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
@ -48,13 +47,17 @@ export class UserPreferencesService {
|
||||
private onChangeSubject: BehaviorSubject<any>;
|
||||
onChange: Observable<any>;
|
||||
|
||||
constructor(public translate: TranslateService,
|
||||
constructor(
|
||||
public translate: TranslateService,
|
||||
private appConfig: AppConfigService,
|
||||
private storage: StorageService,
|
||||
private alfrescoApiService: AlfrescoApiService) {
|
||||
this.alfrescoApiService.alfrescoApiInitialized.pipe(filter(status => status)).subscribe(this.initUserPreferenceStatus.bind(this));
|
||||
private storage: StorageService
|
||||
) {
|
||||
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
|
||||
this.onChange = this.onChangeSubject.asObservable();
|
||||
|
||||
this.appConfig.onLoad.subscribe(() => {
|
||||
this.initUserPreferenceStatus();
|
||||
});
|
||||
}
|
||||
|
||||
private initUserPreferenceStatus() {
|
||||
@ -168,7 +171,7 @@ export class UserPreferencesService {
|
||||
*
|
||||
* @param value Name of the prefix
|
||||
*/
|
||||
setStoragePrefix(value: string) {
|
||||
setStoragePrefix(value: string | null) {
|
||||
this.storage.setItem('USER_PROFILE', value || 'GUEST');
|
||||
this.initUserPreferenceStatus();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user