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:
|
with:
|
||||||
dry-run-flag: ${{ inputs.dry-run-flag }}
|
dry-run-flag: ${{ inputs.dry-run-flag }}
|
||||||
- uses: ./.github/actions/download-node-modules-and-artifacts
|
- uses: ./.github/actions/download-node-modules-and-artifacts
|
||||||
- name: build libraries
|
- name: Set libraries versions
|
||||||
run: |
|
run: |
|
||||||
set -u;
|
set -u;
|
||||||
./scripts/update-version.sh -gnu || exit 1;
|
./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: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=pretheme
|
||||||
|
npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics
|
||||||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||||
name: release libraries GH registry
|
name: release libraries GH registry
|
||||||
with:
|
with:
|
||||||
|
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@ -182,12 +182,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dry-run-flag: ${{ inputs.dry-run-flag }}
|
dry-run-flag: ${{ inputs.dry-run-flag }}
|
||||||
- uses: ./.github/actions/download-node-modules-and-artifacts
|
- uses: ./.github/actions/download-node-modules-and-artifacts
|
||||||
- name: build libraries
|
- name: Set libraries versions
|
||||||
run: |
|
run: |
|
||||||
set -u;
|
set -u;
|
||||||
./scripts/github/build/bumpversion.sh
|
./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: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=pretheme
|
||||||
|
npx nx affected $NX_CALCULATION_FLAGS --target=build-schematics
|
||||||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||||
name: release libraries GH registry
|
name: release libraries GH registry
|
||||||
with:
|
with:
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
AlfrescoApiService,
|
|
||||||
AvatarComponent,
|
AvatarComponent,
|
||||||
HeaderLayoutComponent,
|
HeaderLayoutComponent,
|
||||||
LogoutDirective,
|
LogoutDirective,
|
||||||
@ -35,7 +34,7 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
import { MatLineModule } from '@angular/material/core';
|
import { MatLineModule } from '@angular/material/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
||||||
import { FileUploadingDialogComponent } from '@alfresco/adf-content-services';
|
import { AlfrescoApiService, FileUploadingDialogComponent } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation, EventEmitter, Output } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||||
import { Pagination, UserProcessInstanceFilterRepresentation, ScriptFilesApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
import { Pagination, UserProcessInstanceFilterRepresentation, ScriptFilesApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
||||||
import {
|
import {
|
||||||
FORM_FIELD_VALIDATORS,
|
FORM_FIELD_VALIDATORS,
|
||||||
@ -26,7 +27,6 @@ import {
|
|||||||
AppConfigService,
|
AppConfigService,
|
||||||
PaginationComponent,
|
PaginationComponent,
|
||||||
UserPreferenceValues,
|
UserPreferenceValues,
|
||||||
AlfrescoApiService,
|
|
||||||
UserPreferencesService,
|
UserPreferencesService,
|
||||||
NotificationService,
|
NotificationService,
|
||||||
SidebarActionMenuComponent
|
SidebarActionMenuComponent
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, EventEmitter, Output, ViewEncapsulation, OnInit, Input } from '@angular/core';
|
import { Component, EventEmitter, Output, ViewEncapsulation, OnInit, Input } from '@angular/core';
|
||||||
import { Validators, UntypedFormGroup, UntypedFormBuilder, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
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 { ENTER } from '@angular/cdk/keycodes';
|
||||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
|
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -26,6 +26,7 @@ import { MatRadioModule } from '@angular/material/radio';
|
|||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
export const HOST_REGEX = '^(http|https)://.*[^/]$';
|
export const HOST_REGEX = '^(http|https)://.*[^/]$';
|
||||||
|
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { AppConfigService, UserPreferencesService, StorageService, AuthenticationService } from '@alfresco/adf-core';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AppConfigService, AlfrescoApiService, StorageService, UserPreferencesService, AuthenticationService } from '@alfresco/adf-core';
|
|
||||||
import { DemoForm } from './demo-form.mock';
|
import { DemoForm } from './demo-form.mock';
|
||||||
|
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -194,7 +194,7 @@ A collection of Angular components for generic use.
|
|||||||
| Name | Description | Source link |
|
| 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) |
|
| [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) |
|
| [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) |
|
| [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) |
|
| [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
|
```ts
|
||||||
import { ChangeDetectorRef } from '@angular/core';
|
import { ChangeDetectorRef } from '@angular/core';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
export class FilesComponent implements OnInit {
|
export class FilesComponent implements OnInit {
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ Status: Active
|
|||||||
Last reviewed: 2019-01-17
|
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.
|
Provides access to an initialized **AlfrescoJSApi** instance.
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ file and replace the content with the following:
|
|||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Component, OnInit } from '@angular/core';
|
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';
|
import { ObjectDataTableAdapter, ObjectDataRow } from '@alfresco/adf-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
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 { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AppConfigService } from '../app-config';
|
|
||||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
@ -17,9 +17,8 @@
|
|||||||
|
|
||||||
import { AlfrescoApiConfig } from '@alfresco/js-api';
|
import { AlfrescoApiConfig } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
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 { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
import { StorageService } from '../common/services/storage.service';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a factory to resolve an api service instance
|
* 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 { TestBed } from '@angular/core/testing';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
|
||||||
import { AspectListService } from './aspect-list.service';
|
import { AspectListService } from './aspect-list.service';
|
||||||
import { AspectPaging, AspectsApi, AspectEntry } from '@alfresco/js-api';
|
import { AspectPaging, AspectsApi, AspectEntry } from '@alfresco/js-api';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
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 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' } };
|
const stdAspect2: AspectEntry = { entry: { id: 'std:standardAspectTwo', description: 'Standard Aspect Two', title: 'StandardAspectTwo' } };
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
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 { from, Observable, of, zip } from 'rxjs';
|
||||||
import { catchError, map } from 'rxjs/operators';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api';
|
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 { NodeAspectService } from './node-aspect.service';
|
||||||
import { DialogAspectListService } from './dialog-aspect-list.service';
|
import { DialogAspectListService } from './dialog-aspect-list.service';
|
||||||
import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service';
|
import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service';
|
||||||
import { TagService } from '@alfresco/adf-content-services';
|
import { TagService } from '../../tag';
|
||||||
|
|
||||||
describe('NodeAspectService', () => {
|
describe('NodeAspectService', () => {
|
||||||
let dialogAspectListService: DialogAspectListService;
|
let dialogAspectListService: DialogAspectListService;
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
import { fakeAsync, TestBed } from '@angular/core/testing';
|
import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||||
import { CategoryService } from '../services/category.service';
|
import { CategoryService } from '../services/category.service';
|
||||||
import { CategoryNode, CategoryTreeDatasourceService } from '@alfresco/adf-content-services';
|
|
||||||
import { CategoryServiceMock } from '../mock/category-mock.service';
|
import { CategoryServiceMock } from '../mock/category-mock.service';
|
||||||
import { TreeNodeType, TreeResponse } from '../../tree';
|
import { TreeNodeType, TreeResponse } from '../../tree';
|
||||||
import { EMPTY, of } from 'rxjs';
|
import { EMPTY, of } from 'rxjs';
|
||||||
import { Pagination } from '@alfresco/js-api';
|
import { Pagination } from '@alfresco/js-api';
|
||||||
|
import { CategoryTreeDatasourceService } from './category-tree-datasource.service';
|
||||||
|
import { CategoryNode } from '../models/category-node.interface';
|
||||||
|
|
||||||
describe('CategoryTreeDatasourceService', () => {
|
describe('CategoryTreeDatasourceService', () => {
|
||||||
let categoryTreeDatasourceService: CategoryTreeDatasourceService;
|
let categoryTreeDatasourceService: CategoryTreeDatasourceService;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService, AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import {
|
import {
|
||||||
CategoriesApi,
|
CategoriesApi,
|
||||||
CategoryBody,
|
CategoryBody,
|
||||||
@ -27,6 +27,7 @@ import {
|
|||||||
SearchApi,
|
SearchApi,
|
||||||
SEARCH_LANGUAGE
|
SEARCH_LANGUAGE
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ContentApi, Node, NodeEntry } from '@alfresco/js-api';
|
import { ContentApi, Node, NodeEntry } from '@alfresco/js-api';
|
||||||
import { Subject } from 'rxjs';
|
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 { PermissionsEnum } from '../models/permissions.enum';
|
||||||
import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
|
import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
export interface FolderCreatedEvent {
|
export interface FolderCreatedEvent {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -18,21 +18,15 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { from, Observable, throwError, Subject } from 'rxjs';
|
import { from, Observable, throwError, Subject } from 'rxjs';
|
||||||
import { catchError, map, switchMap, filter, take } from 'rxjs/operators';
|
import { catchError, map, switchMap, filter, take } from 'rxjs/operators';
|
||||||
import {
|
import { RepositoryInfo, SystemPropertiesRepresentation, DiscoveryApi, AboutApi, SystemPropertiesApi } from '@alfresco/js-api';
|
||||||
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({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DiscoveryApiService {
|
export class DiscoveryApiService {
|
||||||
|
|
||||||
private _discoveryApi: DiscoveryApi;
|
private _discoveryApi: DiscoveryApi;
|
||||||
get discoveryApi(): DiscoveryApi {
|
get discoveryApi(): DiscoveryApi {
|
||||||
this._discoveryApi = this._discoveryApi ?? new DiscoveryApi(this.alfrescoApiService.getInstance());
|
this._discoveryApi = this._discoveryApi ?? new DiscoveryApi(this.alfrescoApiService.getInstance());
|
||||||
@ -44,31 +38,25 @@ export class DiscoveryApiService {
|
|||||||
*/
|
*/
|
||||||
ecmProductInfo$ = new Subject<RepositoryInfo>();
|
ecmProductInfo$ = new Subject<RepositoryInfo>();
|
||||||
|
|
||||||
constructor(
|
constructor(private authenticationService: AuthenticationService, private alfrescoApiService: AlfrescoApiService) {
|
||||||
private authenticationService: AuthenticationService,
|
|
||||||
private alfrescoApiService: AlfrescoApiService
|
|
||||||
) {
|
|
||||||
this.authenticationService.onLogin.subscribe(() => {
|
this.authenticationService.onLogin.subscribe(() => {
|
||||||
this.alfrescoApiService.alfrescoApiInitialized.pipe(
|
this.alfrescoApiService.alfrescoApiInitialized
|
||||||
|
.pipe(
|
||||||
filter(() => this.authenticationService.isEcmLoggedIn()),
|
filter(() => this.authenticationService.isEcmLoggedIn()),
|
||||||
take(1),
|
take(1),
|
||||||
switchMap(() => this.getEcmProductInfo())
|
switchMap(() => this.getEcmProductInfo())
|
||||||
)
|
)
|
||||||
.subscribe((info) => this.ecmProductInfo$.next(info));
|
.subscribe((info) => this.ecmProductInfo$.next(info));
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets product information for Content Services.
|
* Gets product information for Content Services.
|
||||||
*
|
*
|
||||||
* @returns ProductVersionModel containing product details
|
* @returns ProductVersionModel containing product details
|
||||||
*/
|
*/
|
||||||
getEcmProductInfo(): Observable<RepositoryInfo> {
|
getEcmProductInfo(): Observable<RepositoryInfo> {
|
||||||
|
return from(this.discoveryApi.getRepositoryInformation()).pipe(
|
||||||
return from(this.discoveryApi.getRepositoryInformation())
|
|
||||||
.pipe(
|
|
||||||
map((res) => res.entry.repository),
|
map((res) => res.entry.repository),
|
||||||
catchError((err) => throwError(err))
|
catchError((err) => throwError(err))
|
||||||
);
|
);
|
||||||
@ -82,8 +70,7 @@ export class DiscoveryApiService {
|
|||||||
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
||||||
const aboutApi = new AboutApi(this.alfrescoApiService.getInstance());
|
const aboutApi = new AboutApi(this.alfrescoApiService.getInstance());
|
||||||
|
|
||||||
return from(aboutApi.getAppVersion())
|
return from(aboutApi.getAppVersion()).pipe(
|
||||||
.pipe(
|
|
||||||
map((res) => new BpmProductVersionModel(res)),
|
map((res) => new BpmProductVersionModel(res)),
|
||||||
catchError((err) => throwError(err))
|
catchError((err) => throwError(err))
|
||||||
);
|
);
|
||||||
@ -92,10 +79,9 @@ export class DiscoveryApiService {
|
|||||||
getBPMSystemProperties(): Observable<SystemPropertiesRepresentation> {
|
getBPMSystemProperties(): Observable<SystemPropertiesRepresentation> {
|
||||||
const systemPropertiesApi = new SystemPropertiesApi(this.alfrescoApiService.getInstance());
|
const systemPropertiesApi = new SystemPropertiesApi(this.alfrescoApiService.getInstance());
|
||||||
|
|
||||||
return from(systemPropertiesApi.getProperties())
|
return from(systemPropertiesApi.getProperties()).pipe(
|
||||||
.pipe(
|
|
||||||
map((res: any) => {
|
map((res: any) => {
|
||||||
if ('string' === typeof (res)) {
|
if ('string' === typeof res) {
|
||||||
throw new Error('Not valid response');
|
throw new Error('Not valid response');
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { FavoritesApi, NodePaging, FavoritePaging } from '@alfresco/js-api';
|
import { FavoritesApi, NodePaging, FavoritePaging } from '@alfresco/js-api';
|
||||||
import { Observable, from, of } from 'rxjs';
|
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';
|
import { catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
* limitations under the License.
|
* 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 { ContentPagingQuery, Node, NodeAssignedHold, NodeEntry, NodePaging, NodesApi, NodesIncludeQuery, TrashcanApi } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { from, Observable, Subject, throwError } from 'rxjs';
|
import { from, Observable, Subject, throwError } from 'rxjs';
|
||||||
import { catchError, map } from 'rxjs/operators';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { NodeMetadata } from '../models/node-metadata.model';
|
import { NodeMetadata } from '../models/node-metadata.model';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { fakeEcmUser } from '../mocks/ecm-user.service.mock';
|
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 { PeopleContentQueryRequestModel, PeopleContentService } from './people-content.service';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { PersonPaging } from '@alfresco/js-api';
|
import { PersonPaging } from '@alfresco/js-api';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
import { EMPTY, of } from 'rxjs';
|
import { EMPTY, of } from 'rxjs';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
|
|
||||||
export const fakeEcmUser2 = {
|
export const fakeEcmUser2 = {
|
||||||
id: 'another-fake-id',
|
id: 'another-fake-id',
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { from, Observable, of } from 'rxjs';
|
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 { map, tap } from 'rxjs/operators';
|
||||||
import { Pagination, PeopleApi, PersonBodyCreate, PersonBodyUpdate } from '@alfresco/js-api';
|
import { Pagination, PeopleApi, PersonBodyCreate, PersonBodyUpdate } from '@alfresco/js-api';
|
||||||
import { EcmUserModel } from '../models/ecm-user.model';
|
import { EcmUserModel } from '../models/ecm-user.model';
|
||||||
import { ContentService } from './content.service';
|
import { ContentService } from './content.service';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
export interface PeopleContentQueryResponse {
|
export interface PeopleContentQueryResponse {
|
||||||
pagination: Pagination;
|
pagination: Pagination;
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ContentApi, RenditionEntry, RenditionPaging, RenditionsApi, VersionsApi } from '@alfresco/js-api';
|
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({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
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 { 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 => ({
|
const getRenditionEntry = (status: Rendition.StatusEnum): RenditionEntry => ({
|
||||||
entry: {
|
entry: {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
|
||||||
import {
|
import {
|
||||||
Node,
|
Node,
|
||||||
SiteBodyCreate,
|
SiteBodyCreate,
|
||||||
@ -32,6 +31,7 @@ import {
|
|||||||
SitePaging,
|
SitePaging,
|
||||||
SitesApi
|
SitesApi
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -17,13 +17,15 @@
|
|||||||
|
|
||||||
import { EventEmitter } from '@angular/core';
|
import { EventEmitter } from '@angular/core';
|
||||||
import { TestBed } from '@angular/core/testing';
|
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 { UploadService } from './upload.service';
|
||||||
import { RepositoryInfo } from '@alfresco/js-api';
|
import { RepositoryInfo } from '@alfresco/js-api';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
||||||
import { FileModel, FileUploadStatus } from '../../common/models/file.model';
|
import { FileModel, FileUploadStatus } from '../../common/models/file.model';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
|
@ -20,10 +20,11 @@ import { Minimatch } from 'minimatch';
|
|||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { FileUploadCompleteEvent, FileUploadDeleteEvent, FileUploadErrorEvent, FileUploadEvent } from '../events/file.event';
|
import { FileUploadCompleteEvent, FileUploadDeleteEvent, FileUploadErrorEvent, FileUploadEvent } from '../events/file.event';
|
||||||
import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model';
|
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 { filter } from 'rxjs/operators';
|
||||||
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
||||||
import { NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
import { NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
||||||
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
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 { ContentMetadataService } from '../../services/content-metadata.service';
|
||||||
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
|
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
|
||||||
import { of } from 'rxjs';
|
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 { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { versionCompatibilityFactory } from '../../../version-compatibility/version-compatibility-factory';
|
import { versionCompatibilityFactory } from '../../../version-compatibility/version-compatibility-factory';
|
||||||
import { VersionCompatibilityService } from '../../../version-compatibility';
|
import { VersionCompatibilityService } from '../../../version-compatibility';
|
||||||
@ -34,6 +34,8 @@ import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|||||||
import { CategoryService } from '../../../category';
|
import { CategoryService } from '../../../category';
|
||||||
import { TagService } from '../../../tag';
|
import { TagService } from '../../../tag';
|
||||||
import { PropertyDescriptorsService } from '../../public-api';
|
import { PropertyDescriptorsService } from '../../public-api';
|
||||||
|
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||||
|
import { AlfrescoApiServiceMock } from '../../../mock/alfresco-api.service.mock';
|
||||||
|
|
||||||
describe('ContentMetadataCardComponent', () => {
|
describe('ContentMetadataCardComponent', () => {
|
||||||
let component: 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 { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service';
|
||||||
import { PropertyGroup } from '../../interfaces/property-group.interface';
|
import { PropertyGroup } from '../../interfaces/property-group.interface';
|
||||||
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
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 { MatExpansionPanel } from '@angular/material/expansion';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatChipHarness } from '@angular/material/chips/testing';
|
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', () => {
|
describe('ContentMetadataComponent', () => {
|
||||||
let component: ContentMetadataComponent;
|
let component: ContentMetadataComponent;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
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 { Observable, defer, forkJoin } from 'rxjs';
|
||||||
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
|
import { PropertyGroup, PropertyGroupContainer } from '../interfaces/content-metadata.interfaces';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
@ -21,7 +21,7 @@ import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
|||||||
|
|
||||||
import { ShareDialogComponent } from './content-node-share.dialog';
|
import { ShareDialogComponent } from './content-node-share.dialog';
|
||||||
import { Observable, from, Subject } from 'rxjs';
|
import { Observable, from, Subject } from 'rxjs';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { NodePaging, SharedLinkBodyCreate, SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
import { NodePaging, SharedLinkBodyCreate, SharedLinkEntry, SharedlinksApi } from '@alfresco/js-api';
|
||||||
import { Observable, from, of, Subject } from 'rxjs';
|
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 { catchError } from 'rxjs/operators';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
|
|
||||||
import { TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api';
|
import { TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
|
@ -46,6 +46,9 @@ import { AlfrescoViewerComponent } from './viewer';
|
|||||||
import { ContentTypeDialogComponent } from './content-type';
|
import { ContentTypeDialogComponent } from './content-type';
|
||||||
import { MaterialModule } from './material.module';
|
import { MaterialModule } from './material.module';
|
||||||
import { AlfrescoIconComponent } from './alfresco-icon/alfresco-icon.component';
|
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({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@ -111,6 +114,7 @@ export class ContentModule {
|
|||||||
providers: [
|
providers: [
|
||||||
provideTranslations('adf-content-services', 'assets/adf-content-services'),
|
provideTranslations('adf-content-services', 'assets/adf-content-services'),
|
||||||
ContentAuthLoaderService,
|
ContentAuthLoaderService,
|
||||||
|
{ provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService },
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: versionCompatibilityFactory,
|
useFactory: versionCompatibilityFactory,
|
||||||
@ -122,6 +126,12 @@ export class ContentModule {
|
|||||||
useFactory: contentAuthLoaderFactory,
|
useFactory: contentAuthLoaderFactory,
|
||||||
deps: [ContentAuthLoaderService],
|
deps: [ContentAuthLoaderService],
|
||||||
multi: true
|
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 { DownloadZipService } from './services/download-zip.service';
|
||||||
import { DownloadEntry, FileDownloadStatus } from '@alfresco/js-api';
|
import { DownloadEntry, FileDownloadStatus } from '@alfresco/js-api';
|
||||||
import { EMPTY, Observable, of } from 'rxjs';
|
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 { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
|
|
||||||
describe('DownloadZipDialogComponent', () => {
|
describe('DownloadZipDialogComponent', () => {
|
||||||
let fixture: ComponentFixture<DownloadZipDialogComponent>;
|
let fixture: ComponentFixture<DownloadZipDialogComponent>;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular';
|
import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component';
|
import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component';
|
||||||
import { AlfrescoApiServiceMock, ContentApiMock, DownloadZipMockService, NodesApiMock } from './mock/download-zip-service.mock';
|
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 { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
import { importProvidersFrom } from '@angular/core';
|
import { importProvidersFrom } from '@angular/core';
|
||||||
import { CoreStoryModule } from '../../../../../core/src/public-api';
|
import { CoreStoryModule } from '../../../../../core/src/public-api';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
component: DownloadZipDialogStorybookComponent,
|
component: DownloadZipDialogStorybookComponent,
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api';
|
import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -28,7 +28,7 @@ import {
|
|||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { QueriesApi, SiteBodyCreate, SiteEntry, SitePaging } from '@alfresco/js-api';
|
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 { debounceTime, finalize, mergeMap, takeUntil } from 'rxjs/operators';
|
||||||
import { SitesService } from '../../common/services/sites.service';
|
import { SitesService } from '../../common/services/sites.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -38,6 +38,7 @@ import { MatInputModule } from '@angular/material/input';
|
|||||||
import { AutoFocusDirective } from '../../directives';
|
import { AutoFocusDirective } from '../../directives';
|
||||||
import { MatRadioModule } from '@angular/material/radio';
|
import { MatRadioModule } from '@angular/material/radio';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-library-dialog',
|
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 { ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||||
import { differenceInSeconds } from 'date-fns';
|
import { differenceInSeconds } from 'date-fns';
|
||||||
import { NodeBodyLock, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
import { NodeBodyLock, Node, NodeEntry, NodesApi } from '@alfresco/js-api';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
@ -28,6 +27,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|||||||
import { MatDatetimepickerModule } from '@mat-datetimepicker/core';
|
import { MatDatetimepickerModule } from '@mat-datetimepicker/core';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-node-lock',
|
selector: 'adf-node-lock',
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Directive, HostListener, Input, OnChanges, Output, EventEmitter, SimpleChanges } from '@angular/core';
|
import { Directive, HostListener, Input, OnChanges, Output, EventEmitter, SimpleChanges } from '@angular/core';
|
||||||
import { FavoriteBodyCreate, FavoritesApi } from '@alfresco/js-api';
|
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';
|
import { LibraryEntity } from '../interfaces/library-entity.interface';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
|
@ -19,9 +19,10 @@ import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
|||||||
import { LibraryMembershipDirective } from './library-membership.directive';
|
import { LibraryMembershipDirective } from './library-membership.directive';
|
||||||
import { SimpleChange } from '@angular/core';
|
import { SimpleChange } from '@angular/core';
|
||||||
import { of, throwError, Subject } from 'rxjs';
|
import { of, throwError, Subject } from 'rxjs';
|
||||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core';
|
|
||||||
import { SitesService } from '../common/services/sites.service';
|
import { SitesService } from '../common/services/sites.service';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock';
|
||||||
|
|
||||||
describe('LibraryMembershipDirective', () => {
|
describe('LibraryMembershipDirective', () => {
|
||||||
let alfrescoApiService: AlfrescoApiService;
|
let alfrescoApiService: AlfrescoApiService;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||||
import { SiteEntry, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry, SitesApi } from '@alfresco/js-api';
|
import { SiteEntry, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry, SitesApi } from '@alfresco/js-api';
|
||||||
import { BehaviorSubject, from, Observable } from 'rxjs';
|
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 { LibraryMembershipToggleEvent } from '../interfaces/library-membership-toggle-event.interface';
|
||||||
import { LibraryMembershipErrorEvent } from '../interfaces/library-membership-error-event.interface';
|
import { LibraryMembershipErrorEvent } from '../interfaces/library-membership-error-event.interface';
|
||||||
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
||||||
|
@ -20,8 +20,9 @@
|
|||||||
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
|
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
|
||||||
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
|
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
|
||||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
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 { map, catchError, retry } from 'rxjs/operators';
|
||||||
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
|
||||||
interface ProcessedNodeData {
|
interface ProcessedNodeData {
|
||||||
entry: Node | DeletedNode;
|
entry: Node | DeletedNode;
|
||||||
|
@ -19,10 +19,11 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
import { Component, DebugElement, ViewChild } from '@angular/core';
|
import { Component, DebugElement, ViewChild } from '@angular/core';
|
||||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core';
|
|
||||||
import { NodeDownloadDirective } from './node-download.directive';
|
import { NodeDownloadDirective } from './node-download.directive';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
import { ContentApi } from '@alfresco/js-api';
|
import { ContentApi } from '@alfresco/js-api';
|
||||||
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
|
|
||||||
import { Directive, Input, HostListener } from '@angular/core';
|
import { Directive, Input, HostListener } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
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 { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
|
||||||
import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
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
|
* Directive selectors without adf- prefix will be deprecated on 3.0.0
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
import { SimpleChange } from '@angular/core';
|
import { SimpleChange } from '@angular/core';
|
||||||
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||||
import { NodeFavoriteDirective } from './node-favorite.directive';
|
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 { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
import { AlfrescoApiService } from '../services';
|
||||||
|
import { AlfrescoApiServiceMock } from '../mock';
|
||||||
|
|
||||||
describe('NodeFavoriteDirective', () => {
|
describe('NodeFavoriteDirective', () => {
|
||||||
let directive: 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 { FavoriteBodyCreate, NodeEntry, SharedLinkEntry, Node, SharedLink, FavoritesApi } from '@alfresco/js-api';
|
||||||
import { Observable, from, forkJoin, of } from 'rxjs';
|
import { Observable, from, forkJoin, of } from 'rxjs';
|
||||||
import { catchError, map } from 'rxjs/operators';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
@ -21,8 +21,9 @@ import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/c
|
|||||||
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging } from '@alfresco/js-api';
|
import { TrashcanApi, DeletedNodeEntry, DeletedNodesPaging } from '@alfresco/js-api';
|
||||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
import { Observable, forkJoin, from, of } from 'rxjs';
|
||||||
import { tap, mergeMap, map, catchError } from 'rxjs/operators';
|
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 { RestoreMessageModel } from '../interfaces/restore-message-model.interface';
|
||||||
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/naming-convention */
|
/* eslint-disable @typescript-eslint/naming-convention */
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AlfrescoApiService,
|
|
||||||
AppConfigService,
|
AppConfigService,
|
||||||
ColumnsSelectorComponent,
|
ColumnsSelectorComponent,
|
||||||
CustomEmptyContentTemplateDirective,
|
CustomEmptyContentTemplateDirective,
|
||||||
@ -86,6 +85,7 @@ import { FilterHeaderComponent } from './filter-header/filter-header.component';
|
|||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
const BYTES_TO_MB_CONVERSION_VALUE = 1048576;
|
const BYTES_TO_MB_CONVERSION_VALUE = 1048576;
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
* limitations under the License.
|
* 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 {
|
import {
|
||||||
DeletedNodesPaging,
|
DeletedNodesPaging,
|
||||||
SearchRequest,
|
SearchRequest,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* 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 { NodesApiService } from '../../common/services/nodes-api.service';
|
||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { Node, NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api';
|
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 { map } from 'rxjs/operators';
|
||||||
import { DocumentListLoader } from '../interfaces/document-list-loader.interface';
|
import { DocumentListLoader } from '../interfaces/document-list-loader.interface';
|
||||||
import { CustomResourcesService } from './custom-resources.service';
|
import { CustomResourcesService } from './custom-resources.service';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
const ROOT_ID = '-root-';
|
const ROOT_ID = '-root-';
|
||||||
|
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
import { Injectable, Output, EventEmitter } from '@angular/core';
|
import { Injectable, Output, EventEmitter } from '@angular/core';
|
||||||
import { Node, NodeEntry } from '@alfresco/js-api';
|
import { Node, NodeEntry } from '@alfresco/js-api';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core';
|
import { DownloadService } from '@alfresco/adf-core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { ContentService } from '../../common/services/content.service';
|
import { ContentService } from '../../common/services/content.service';
|
||||||
import { NodeDownloadDirective } from '../../directives/node-download.directive';
|
import { NodeDownloadDirective } from '../../directives/node-download.directive';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
import { DocumentListService } from './document-list.service';
|
import { DocumentListService } from './document-list.service';
|
||||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
import { GroupService } from '@alfresco/adf-content-services';
|
|
||||||
import { ContentIncludeQuery, GroupEntry } from '@alfresco/js-api';
|
import { ContentIncludeQuery, GroupEntry } from '@alfresco/js-api';
|
||||||
|
import { GroupService } from './group.service';
|
||||||
|
|
||||||
describe('GroupService', () => {
|
describe('GroupService', () => {
|
||||||
let service: GroupService;
|
let service: GroupService;
|
||||||
@ -83,12 +83,16 @@ describe('GroupService', () => {
|
|||||||
|
|
||||||
service.updateGroup(group.entry, opts).subscribe((groupEntry) => {
|
service.updateGroup(group.entry, opts).subscribe((groupEntry) => {
|
||||||
expect(groupEntry).toEqual(returnedGroup);
|
expect(groupEntry).toEqual(returnedGroup);
|
||||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, {
|
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(
|
||||||
|
group.entry.id,
|
||||||
|
{
|
||||||
displayName: group.entry.displayName,
|
displayName: group.entry.displayName,
|
||||||
description: group.entry.description
|
description: group.entry.description
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
include: ['description']
|
include: ['description']
|
||||||
});
|
}
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -105,12 +109,16 @@ describe('GroupService', () => {
|
|||||||
description: ''
|
description: ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, {
|
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(
|
||||||
|
group.entry.id,
|
||||||
|
{
|
||||||
displayName: group.entry.displayName,
|
displayName: group.entry.displayName,
|
||||||
description: group.entry.description
|
description: group.entry.description
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
include: ['description']
|
include: ['description']
|
||||||
});
|
}
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -121,12 +129,16 @@ describe('GroupService', () => {
|
|||||||
|
|
||||||
service.updateGroup(group.entry, opts).subscribe((groupEntry) => {
|
service.updateGroup(group.entry, opts).subscribe((groupEntry) => {
|
||||||
expect(groupEntry).toEqual(returnedGroup);
|
expect(groupEntry).toEqual(returnedGroup);
|
||||||
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(group.entry.id, {
|
expect(service.groupsApi.updateGroup).toHaveBeenCalledWith(
|
||||||
|
group.entry.id,
|
||||||
|
{
|
||||||
displayName: group.entry.displayName,
|
displayName: group.entry.displayName,
|
||||||
description: group.entry.description
|
description: group.entry.description
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
include: ['description']
|
include: ['description']
|
||||||
});
|
}
|
||||||
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ContentIncludeQuery, Group, GroupEntry, GroupsApi } from '@alfresco/js-api';
|
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 { from, Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
|
||||||
import {
|
import {
|
||||||
BulkAssignHoldResponseEntry,
|
BulkAssignHoldResponseEntry,
|
||||||
ContentPagingQuery,
|
ContentPagingQuery,
|
||||||
@ -30,6 +29,7 @@ import {
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AppConfigService } from '../app-config/app-config.service';
|
|
||||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
import { StorageService } from '../common/services/storage.service';
|
import { AppConfigService, StorageService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoApiServiceMock extends AlfrescoApiService {
|
export class AlfrescoApiServiceMock extends AlfrescoApiService {
|
@ -24,3 +24,4 @@ export * from './sites-dropdown.component.mock';
|
|||||||
export * from './search-query.mock';
|
export * from './search-query.mock';
|
||||||
export * from './new-version-uploader.service.mock';
|
export * from './new-version-uploader.service.mock';
|
||||||
export * from './date-range-search-filter.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 { Component, ViewChild } from '@angular/core';
|
||||||
import { SearchComponent } from '../search/components/search.component';
|
import { SearchComponent } from '../search/components/search.component';
|
||||||
import { SearchRequest, ResultSetPaging, ResultSetRowEntry, ContentInfo, UserInfo, ResultNode } from '@alfresco/js-api';
|
import { SearchRequest, ResultSetPaging, ResultSetRowEntry, ContentInfo, UserInfo, ResultNode } from '@alfresco/js-api';
|
||||||
|
import { SearchModule } from '../search';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
const entryItem = new ResultSetRowEntry({
|
const entryItem = new ResultSetRowEntry({
|
||||||
entry: new ResultNode({
|
entry: new ResultNode({
|
||||||
@ -103,7 +105,9 @@ export const noResult = {
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
</adf-search>
|
</adf-search>
|
||||||
<span id="component-result-message">{{ message }}</span>
|
<span id="component-result-message">{{ message }}</span>
|
||||||
`
|
`,
|
||||||
|
standalone: true,
|
||||||
|
imports: [SearchModule, CommonModule]
|
||||||
})
|
})
|
||||||
export class SimpleSearchTestComponent {
|
export class SimpleSearchTestComponent {
|
||||||
@ViewChild('search', { static: true })
|
@ViewChild('search', { static: true })
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
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 { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog';
|
||||||
import { VersionsApi } from '@alfresco/js-api';
|
import { VersionsApi } from '@alfresco/js-api';
|
||||||
import { NewVersionUploaderData, NewVersionUploaderDialogData } from './models';
|
import { NewVersionUploaderData, NewVersionUploaderDialogData } from './models';
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
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 { fakeContentComment, fakeContentComments } from '../mocks/node-comments.mock';
|
||||||
import { NodeCommentsService } from './node-comments.service';
|
import { NodeCommentsService } from './node-comments.service';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
import { EMPTY, of } from 'rxjs';
|
import { EMPTY, of } from 'rxjs';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
* limitations under the License.
|
* 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 { CommentEntry, CommentsApi, Comment } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { ContentService } from '../../common/services/content.service';
|
import { ContentService } from '../../common/services/content.service';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { PopOverDirective } from '@alfresco/adf-content-services';
|
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { OverlayModule } from '@angular/cdk/overlay';
|
import { OverlayModule } from '@angular/cdk/overlay';
|
||||||
|
import { PopOverDirective } from './pop-over.directive';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
* limitations under the License.
|
* 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 { NodesApiService } from '../../common/services/nodes-api.service';
|
||||||
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
||||||
import { Group, GroupMemberPaging, GroupsApi, Node, PathElement, PermissionElement, SearchRequest } from '@alfresco/js-api';
|
import { Group, GroupMemberPaging, GroupsApi, Node, PathElement, PermissionElement, SearchRequest } from '@alfresco/js-api';
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
|
||||||
import { PredictionsApi, PredictionPaging, ReviewStatus } from '@alfresco/js-api';
|
import { PredictionsApi, PredictionPaging, ReviewStatus } from '@alfresco/js-api';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class PredictionService {
|
export class PredictionService {
|
||||||
|
@ -19,9 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
import { SearchFilterAutocompleteChipsComponent } from './search-filter-autocomplete-chips.component';
|
import { SearchFilterAutocompleteChipsComponent } from './search-filter-autocomplete-chips.component';
|
||||||
import { TagService } from '@alfresco/adf-content-services';
|
|
||||||
import { EMPTY, of } from 'rxjs';
|
import { EMPTY, of } from 'rxjs';
|
||||||
import { AutocompleteField } from '../../models/autocomplete-option.interface';
|
import { AutocompleteField } from '../../models/autocomplete-option.interface';
|
||||||
|
import { TagService } from '../../../tag/services/tag.service';
|
||||||
|
|
||||||
describe('SearchFilterAutocompleteChipsComponent', () => {
|
describe('SearchFilterAutocompleteChipsComponent', () => {
|
||||||
let component: SearchFilterAutocompleteChipsComponent;
|
let component: SearchFilterAutocompleteChipsComponent;
|
||||||
|
@ -20,10 +20,11 @@ import { SearchPropertiesComponent } from './search-properties.component';
|
|||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { MatOption } from '@angular/material/core';
|
import { MatOption } from '@angular/material/core';
|
||||||
import { SearchChipAutocompleteInputComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
|
||||||
import { FileSizeUnit } from './file-size-unit.enum';
|
import { FileSizeUnit } from './file-size-unit.enum';
|
||||||
import { FileSizeOperator } from './file-size-operator.enum';
|
import { FileSizeOperator } from './file-size-operator.enum';
|
||||||
import { SearchProperties } from './search-properties';
|
import { SearchProperties } from './search-properties';
|
||||||
|
import { SearchChipAutocompleteInputComponent } from '../search-chip-autocomplete-input';
|
||||||
|
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
|
||||||
|
|
||||||
describe('SearchPropertiesComponent', () => {
|
describe('SearchPropertiesComponent', () => {
|
||||||
let component: SearchPropertiesComponent;
|
let component: SearchPropertiesComponent;
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
|
|
||||||
import { SearchSortingPickerComponent } from './search-sorting-picker.component';
|
import { SearchSortingPickerComponent } from './search-sorting-picker.component';
|
||||||
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
|
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 { SearchConfiguration } from '../../models/search-configuration.interface';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
|
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||||
|
|
||||||
describe('SearchSortingPickerComponent', () => {
|
describe('SearchSortingPickerComponent', () => {
|
||||||
let queryBuilder: SearchQueryBuilderService;
|
let queryBuilder: SearchQueryBuilderService;
|
||||||
|
@ -29,8 +29,7 @@ describe('SearchComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [ContentTestingModule],
|
imports: [ContentTestingModule, SimpleSearchTestComponent]
|
||||||
declarations: [SimpleSearchTestComponent]
|
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(SimpleSearchTestComponent);
|
fixture = TestBed.createComponent(SimpleSearchTestComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Subject, Observable, from, ReplaySubject } from 'rxjs';
|
import { Subject, Observable, from, ReplaySubject } from 'rxjs';
|
||||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
import {
|
import {
|
||||||
SearchRequest,
|
SearchRequest,
|
||||||
RequestFacetFields,
|
RequestFacetFields,
|
||||||
@ -36,6 +36,7 @@ import { SearchSortingDefinition } from '../models/search-sorting-definition.int
|
|||||||
import { FacetField } from '../models/facet-field.interface';
|
import { FacetField } from '../models/facet-field.interface';
|
||||||
import { FacetFieldBucket } from '../models/facet-field-bucket.interface';
|
import { FacetFieldBucket } from '../models/facet-field-bucket.interface';
|
||||||
import { SearchForm } from '../models/search-form.interface';
|
import { SearchForm } from '../models/search-form.interface';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
export abstract class BaseQueryBuilderService {
|
export abstract class BaseQueryBuilderService {
|
||||||
private _searchApi: SearchApi;
|
private _searchApi: SearchApi;
|
||||||
|
@ -20,8 +20,9 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { SearchFacetFiltersService } from './search-facet-filters.service';
|
import { SearchFacetFiltersService } from './search-facet-filters.service';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
import { SearchQueryBuilderService } from './search-query-builder.service';
|
import { SearchQueryBuilderService } from './search-query-builder.service';
|
||||||
import { CategoryService, FacetBucketSortBy, FacetBucketSortDirection } from '@alfresco/adf-content-services';
|
|
||||||
import { EMPTY, of } from 'rxjs';
|
import { EMPTY, of } from 'rxjs';
|
||||||
|
import { CategoryService } from '../../category/services/category.service';
|
||||||
|
import { FacetBucketSortBy, FacetBucketSortDirection } from '../models/facet-field.interface';
|
||||||
|
|
||||||
describe('SearchFacetFiltersService', () => {
|
describe('SearchFacetFiltersService', () => {
|
||||||
let searchFacetFiltersService: SearchFacetFiltersService;
|
let searchFacetFiltersService: SearchFacetFiltersService;
|
||||||
@ -31,12 +32,14 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [ContentTestingModule],
|
imports: [ContentTestingModule],
|
||||||
providers: [{
|
providers: [
|
||||||
|
{
|
||||||
provide: CategoryService,
|
provide: CategoryService,
|
||||||
useValue: {
|
useValue: {
|
||||||
getCategory: () => EMPTY
|
getCategory: () => EMPTY
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
categoryService = TestBed.inject(CategoryService);
|
categoryService = TestBed.inject(CategoryService);
|
||||||
@ -67,17 +70,19 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const queries = [
|
const queries = [
|
||||||
{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1}}] },
|
{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||||
{ label: 'q2', filterQuery: 'query2', metrics: [{value: {count: 1}}] }
|
{ label: 'q2', filterQuery: 'query2', metrics: [{ value: { count: 1 } }] }
|
||||||
];
|
];
|
||||||
const data = {
|
const data = {
|
||||||
list: {
|
list: {
|
||||||
context: {
|
context: {
|
||||||
facets: [{
|
facets: [
|
||||||
|
{
|
||||||
type: 'query',
|
type: 'query',
|
||||||
label: 'label1',
|
label: 'label1',
|
||||||
buckets: queries
|
buckets: queries
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -104,19 +109,20 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const queries = [
|
const queries = [
|
||||||
{ label: 'q2', filterQuery: 'query2', metrics: [{value: {count: 1}}] },
|
{ label: 'q2', filterQuery: 'query2', metrics: [{ value: { count: 1 } }] },
|
||||||
{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1}}] },
|
{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||||
{ label: 'q3', filterQuery: 'query3', metrics: [{value: {count: 1}}] }
|
{ label: 'q3', filterQuery: 'query3', metrics: [{ value: { count: 1 } }] }
|
||||||
|
|
||||||
];
|
];
|
||||||
const data = {
|
const data = {
|
||||||
list: {
|
list: {
|
||||||
context: {
|
context: {
|
||||||
facets: [{
|
facets: [
|
||||||
|
{
|
||||||
type: 'query',
|
type: 'query',
|
||||||
label: 'label1',
|
label: 'label1',
|
||||||
buckets: queries
|
buckets: queries
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -158,10 +164,12 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
|
|
||||||
queryBuilder.config = {
|
queryBuilder.config = {
|
||||||
categories: [],
|
categories: [],
|
||||||
facetFields: { fields: [
|
facetFields: {
|
||||||
|
fields: [
|
||||||
{ label: 'f1', field: 'f1', mincount: 0 },
|
{ label: 'f1', field: 'f1', mincount: 0 },
|
||||||
{ label: 'f2', field: 'f2', mincount: 0 }
|
{ label: 'f2', field: 'f2', mincount: 0 }
|
||||||
]},
|
]
|
||||||
|
},
|
||||||
facetQueries: {
|
facetQueries: {
|
||||||
queries: []
|
queries: []
|
||||||
}
|
}
|
||||||
@ -189,9 +197,7 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
it('should filter response facet fields based on search filter config method', () => {
|
it('should filter response facet fields based on search filter config method', () => {
|
||||||
queryBuilder.config = {
|
queryBuilder.config = {
|
||||||
categories: [],
|
categories: [],
|
||||||
facetFields: { fields: [
|
facetFields: { fields: [{ label: 'f1', field: 'f1' }] },
|
||||||
{ label: 'f1', field: 'f1' }
|
|
||||||
]},
|
|
||||||
facetQueries: {
|
facetQueries: {
|
||||||
queries: []
|
queries: []
|
||||||
},
|
},
|
||||||
@ -199,10 +205,13 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initialFields: any = [
|
const initialFields: any = [
|
||||||
{ type: 'field', label: 'f1', buckets: [
|
{
|
||||||
{ label: 'firstLabel', display: 'firstLabel', metrics: [{value: {count: 5}}] },
|
type: 'field',
|
||||||
{ label: 'secondLabel', display: 'secondLabel', metrics: [{value: {count: 5}}] },
|
label: 'f1',
|
||||||
{ label: 'thirdLabel', display: 'thirdLabel', metrics: [{value: {count: 5}}] }
|
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 = {
|
queryBuilder.config = {
|
||||||
categories: [],
|
categories: [],
|
||||||
facetFields: { fields: [
|
facetFields: {
|
||||||
|
fields: [
|
||||||
{ label: 'f1', field: 'f1' },
|
{ label: 'f1', field: 'f1' },
|
||||||
{ label: 'f2', field: 'f2' }
|
{ label: 'f2', field: 'f2' }
|
||||||
]},
|
]
|
||||||
|
},
|
||||||
facetQueries: {
|
facetQueries: {
|
||||||
queries: []
|
queries: []
|
||||||
}
|
}
|
||||||
@ -253,8 +264,8 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'f1',
|
label: 'f1',
|
||||||
buckets: [
|
buckets: [
|
||||||
{ label: 'b1', metrics: [{value: {count: 10}}] },
|
{ label: 'b1', metrics: [{ value: { count: 10 } }] },
|
||||||
{ label: 'b2', metrics: [{value: {count: 1}}] }
|
{ label: 'b2', metrics: [{ value: { count: 1 } }] }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ type: 'field', label: 'f2', buckets: [] }
|
{ type: 'field', label: 'f2', buckets: [] }
|
||||||
@ -276,17 +287,28 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
it('should fetch facet fields from response payload and update the existing bucket values', () => {
|
it('should fetch facet fields from response payload and update the existing bucket values', () => {
|
||||||
queryBuilder.config = {
|
queryBuilder.config = {
|
||||||
categories: [],
|
categories: [],
|
||||||
facetFields: { fields: [
|
facetFields: {
|
||||||
|
fields: [
|
||||||
{ label: 'f1', field: 'f1' },
|
{ label: 'f1', field: 'f1' },
|
||||||
{ label: 'f2', field: 'f2' }
|
{ label: 'f2', field: 'f2' }
|
||||||
]},
|
]
|
||||||
|
},
|
||||||
facetQueries: {
|
facetQueries: {
|
||||||
queries: []
|
queries: []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialFields: any = [
|
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: [] }
|
{ type: 'field', label: 'f2', buckets: [] }
|
||||||
];
|
];
|
||||||
searchFacetFiltersService.responseFacets = initialFields;
|
searchFacetFiltersService.responseFacets = initialFields;
|
||||||
@ -294,9 +316,14 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items[1].count).toEqual(1);
|
expect(searchFacetFiltersService.responseFacets[0].buckets.items[1].count).toEqual(1);
|
||||||
|
|
||||||
const serverResponseFields: any = [
|
const serverResponseFields: any = [
|
||||||
{ type: 'field', label: 'f1', buckets:
|
{
|
||||||
[{ label: 'b1', metrics: [{value: {count: 6}}], filterQuery: 'filter' },
|
type: 'field',
|
||||||
{ label: 'b2', metrics: [{value: {count: 0}}] }] },
|
label: 'f1',
|
||||||
|
buckets: [
|
||||||
|
{ label: 'b1', metrics: [{ value: { count: 6 } }], filterQuery: 'filter' },
|
||||||
|
{ label: 'b2', metrics: [{ value: { count: 0 } }] }
|
||||||
|
]
|
||||||
|
},
|
||||||
{ type: 'field', label: 'f2', buckets: [] }
|
{ type: 'field', label: 'f2', buckets: [] }
|
||||||
];
|
];
|
||||||
const data = {
|
const data = {
|
||||||
@ -321,21 +348,25 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
facetQueries: { queries: [] }
|
facetQueries: { queries: [] }
|
||||||
};
|
};
|
||||||
|
|
||||||
const firstCallFields: any = [{
|
const firstCallFields: any = [
|
||||||
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'f1',
|
label: 'f1',
|
||||||
buckets: [{ label: 'b1', metrics: [{value: {count: 10}}] }]
|
buckets: [{ label: 'b1', metrics: [{ value: { count: 10 } }] }]
|
||||||
}];
|
}
|
||||||
const firstCallData = { list: { context: { facets: firstCallFields }}};
|
];
|
||||||
|
const firstCallData = { list: { context: { facets: firstCallFields } } };
|
||||||
searchFacetFiltersService.onDataLoaded(firstCallData);
|
searchFacetFiltersService.onDataLoaded(firstCallData);
|
||||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(10);
|
expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(10);
|
||||||
|
|
||||||
const secondCallFields: any = [{
|
const secondCallFields: any = [
|
||||||
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'f1',
|
label: 'f1',
|
||||||
buckets: [{ label: 'b1', metrics: [{value: {count: 6}}] }]
|
buckets: [{ label: 'b1', metrics: [{ value: { count: 6 } }] }]
|
||||||
}];
|
}
|
||||||
const secondCallData = { list: { context: { facets: secondCallFields}}};
|
];
|
||||||
|
const secondCallData = { list: { context: { facets: secondCallFields } } };
|
||||||
searchFacetFiltersService.onDataLoaded(secondCallData);
|
searchFacetFiltersService.onDataLoaded(secondCallData);
|
||||||
expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(6);
|
expect(searchFacetFiltersService.responseFacets[0].buckets.items[0].count).toEqual(6);
|
||||||
});
|
});
|
||||||
@ -346,25 +377,33 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
categories: [],
|
categories: [],
|
||||||
facetIntervals: {
|
facetIntervals: {
|
||||||
intervals: [
|
intervals: [
|
||||||
{ label: 'test_intervals1', field: 'f1', sets: [
|
{
|
||||||
{ label: 'interval1', start: 's1', end: 'e1'},
|
label: 'test_intervals1',
|
||||||
{ label: 'interval2', start: 's2', end: 'e2'}
|
field: 'f1',
|
||||||
]},
|
sets: [
|
||||||
{ label: 'test_intervals2', field: 'f2', sets: [
|
{ label: 'interval1', start: 's1', end: 'e1' },
|
||||||
{ label: 'interval3', start: 's3', end: 'e3'},
|
{ label: 'interval2', start: 's2', end: 'e2' }
|
||||||
{ label: 'interval4', start: 's4', end: 'e4'}
|
]
|
||||||
]}
|
},
|
||||||
|
{
|
||||||
|
label: 'test_intervals2',
|
||||||
|
field: 'f2',
|
||||||
|
sets: [
|
||||||
|
{ label: 'interval3', start: 's3', end: 'e3' },
|
||||||
|
{ label: 'interval4', start: 's4', end: 'e4' }
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const response1 = [
|
const response1 = [
|
||||||
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 }}]},
|
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||||
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 }}]}
|
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 } }] }
|
||||||
];
|
];
|
||||||
const response2 = [
|
const response2 = [
|
||||||
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 }}]},
|
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 } }] },
|
||||||
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 }}]}
|
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 } }] }
|
||||||
];
|
];
|
||||||
const data = {
|
const data = {
|
||||||
list: {
|
list: {
|
||||||
@ -390,25 +429,35 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
categories: [],
|
categories: [],
|
||||||
facetIntervals: {
|
facetIntervals: {
|
||||||
intervals: [
|
intervals: [
|
||||||
{ label: 'test_intervals1', field: 'f1', mincount: 2, sets: [
|
{
|
||||||
{ label: 'interval1', start: 's1', end: 'e1'},
|
label: 'test_intervals1',
|
||||||
{ label: 'interval2', start: 's2', end: 'e2'}
|
field: 'f1',
|
||||||
]},
|
mincount: 2,
|
||||||
{ label: 'test_intervals2', field: 'f2', mincount: 5, sets: [
|
sets: [
|
||||||
{ label: 'interval3', start: 's3', end: 'e3'},
|
{ label: 'interval1', start: 's1', end: 'e1' },
|
||||||
{ label: 'interval4', start: 's4', end: 'e4'}
|
{ label: 'interval2', start: 's2', end: 'e2' }
|
||||||
]}
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'test_intervals2',
|
||||||
|
field: 'f2',
|
||||||
|
mincount: 5,
|
||||||
|
sets: [
|
||||||
|
{ label: 'interval3', start: 's3', end: 'e3' },
|
||||||
|
{ label: 'interval4', start: 's4', end: 'e4' }
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const response1 = [
|
const response1 = [
|
||||||
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 }}]},
|
{ label: 'interval1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] },
|
||||||
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 }}]}
|
{ label: 'interval2', filterQuery: 'query2', metrics: [{ value: { count: 2 } }] }
|
||||||
];
|
];
|
||||||
const response2 = [
|
const response2 = [
|
||||||
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 }}]},
|
{ label: 'interval3', filterQuery: 'query3', metrics: [{ value: { count: 3 } }] },
|
||||||
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 }}]}
|
{ label: 'interval4', filterQuery: 'query4', metrics: [{ value: { count: 4 } }] }
|
||||||
];
|
];
|
||||||
const data = {
|
const data = {
|
||||||
list: {
|
list: {
|
||||||
@ -443,14 +492,14 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
},
|
},
|
||||||
facetFields: {
|
facetFields: {
|
||||||
fields: [
|
fields: [
|
||||||
{ field: 'field1', label: 'Field 1', settings: { facetOrder: 200 }},
|
{ field: 'field1', label: 'Field 1', settings: { facetOrder: 200 } },
|
||||||
{ field: 'field2', label: 'Field 2', settings: { facetOrder: 400 }},
|
{ field: 'field2', label: 'Field 2', settings: { facetOrder: 400 } },
|
||||||
{ field: 'field3', label: 'Field 3', settings: { facetOrder: 500 }},
|
{ field: 'field3', label: 'Field 3', settings: { facetOrder: 500 } },
|
||||||
{ field: 'field4', label: 'Field 4', settings: { facetOrder: 100 }}
|
{ field: 'field4', label: 'Field 4', settings: { facetOrder: 100 } }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const queryBucketsMock = [{ label: 'q1', filterQuery: 'query1', metrics: [{value: {count: 1} }] }];
|
const queryBucketsMock = [{ label: 'q1', filterQuery: 'query1', metrics: [{ value: { count: 1 } }] }];
|
||||||
const fieldBucketsMock = [{ label: 'b1', metrics: [{ value: { count: 10 } }] }];
|
const fieldBucketsMock = [{ label: 'b1', metrics: [{ value: { count: 10 } }] }];
|
||||||
const data = {
|
const data = {
|
||||||
list: {
|
list: {
|
||||||
@ -467,20 +516,20 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
searchFacetFiltersService.onDataLoaded(data);
|
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', () => {
|
it('should load category names for cm:categories facet', () => {
|
||||||
const entry = {id: 'test-id-test', name: 'name', path: '/categories/General/Test Category/Subcategory'};
|
const entry = { id: 'test-id-test', name: 'name', path: '/categories/General/Test Category/Subcategory' };
|
||||||
searchFacetFiltersService.responseFacets = null;
|
searchFacetFiltersService.responseFacets = null;
|
||||||
spyOn(categoryService, 'getCategory').and.returnValue(of({entry}));
|
spyOn(categoryService, 'getCategory').and.returnValue(of({ entry }));
|
||||||
|
|
||||||
queryBuilder.config = {
|
queryBuilder.config = {
|
||||||
categories: [],
|
categories: [],
|
||||||
facetFields: {
|
facetFields: {
|
||||||
fields: [
|
fields: [
|
||||||
{label: 'f1', field: 'f1', mincount: 0},
|
{ label: 'f1', field: 'f1', mincount: 0 },
|
||||||
{label: 'categories', field: 'cm:categories', mincount: 0}
|
{ label: 'categories', field: 'cm:categories', mincount: 0 }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
facetQueries: {
|
facetQueries: {
|
||||||
@ -489,12 +538,16 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fields: any = [
|
const fields: any = [
|
||||||
{type: 'field', label: 'f1', buckets: [{label: 'a1'}, {label: 'a2'}]},
|
{ type: 'field', label: 'f1', buckets: [{ label: 'a1' }, { label: 'a2' }] },
|
||||||
|
{
|
||||||
|
type: 'field',
|
||||||
|
label: 'categories',
|
||||||
|
buckets: [
|
||||||
{
|
{
|
||||||
type: 'field', label: 'categories', buckets: [{
|
|
||||||
label: `workspace://SpacesStore/${entry.id}`,
|
label: `workspace://SpacesStore/${entry.id}`,
|
||||||
filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"`
|
filterQuery: `cm:categories:"workspace://SpacesStore/${entry.id}"`
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const data = {
|
const data = {
|
||||||
@ -507,7 +560,7 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
|
|
||||||
searchFacetFiltersService.onDataLoaded(data);
|
searchFacetFiltersService.onDataLoaded(data);
|
||||||
|
|
||||||
expect(categoryService.getCategory).toHaveBeenCalledWith(entry.id, { include: [ 'path' ]});
|
expect(categoryService.getCategory).toHaveBeenCalledWith(entry.id, { include: ['path'] });
|
||||||
expect(searchFacetFiltersService.responseFacets[1].buckets.items[0].display).toBe(`Test Category/Subcategory/${entry.name}`);
|
expect(searchFacetFiltersService.responseFacets[1].buckets.items[0].display).toBe(`Test Category/Subcategory/${entry.name}`);
|
||||||
expect(searchFacetFiltersService.responseFacets[1].buckets.length).toEqual(1);
|
expect(searchFacetFiltersService.responseFacets[1].buckets.length).toEqual(1);
|
||||||
expect(searchFacetFiltersService.responseFacets.length).toEqual(2);
|
expect(searchFacetFiltersService.responseFacets.length).toEqual(2);
|
||||||
@ -517,10 +570,12 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
searchFacetFiltersService.responseFacets = null;
|
searchFacetFiltersService.responseFacets = null;
|
||||||
queryBuilder.config = {
|
queryBuilder.config = {
|
||||||
categories: [],
|
categories: [],
|
||||||
facetFields: { fields: [
|
facetFields: {
|
||||||
|
fields: [
|
||||||
{ label: 'creator', field: 'creator' },
|
{ label: 'creator', field: 'creator' },
|
||||||
{ label: 'modifier', field: 'modifier' }
|
{ label: 'modifier', field: 'modifier' }
|
||||||
]},
|
]
|
||||||
|
},
|
||||||
facetQueries: {
|
facetQueries: {
|
||||||
queries: []
|
queries: []
|
||||||
}
|
}
|
||||||
@ -531,16 +586,16 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'creator',
|
label: 'creator',
|
||||||
buckets: [
|
buckets: [
|
||||||
{ label: 'b1', metrics: [{value: {count: 10}}] },
|
{ label: 'b1', metrics: [{ value: { count: 10 } }] },
|
||||||
{ label: 'b2', metrics: [{value: {count: 1}}] }
|
{ label: 'b2', metrics: [{ value: { count: 1 } }] }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'modifier',
|
label: 'modifier',
|
||||||
buckets: [
|
buckets: [
|
||||||
{ label: 'c1', metrics: [{value: {count: 10}}] },
|
{ label: 'c1', metrics: [{ value: { count: 10 } }] },
|
||||||
{ label: 'c2', metrics: [{value: {count: 1}}] }
|
{ label: 'c2', metrics: [{ value: { count: 1 } }] }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -594,13 +649,17 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
facetQueries: { queries: [] },
|
facetQueries: { queries: [] },
|
||||||
facetFields: {
|
facetFields: {
|
||||||
fields: [
|
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);
|
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', () => {
|
it('should sort the buckets by count', () => {
|
||||||
@ -609,13 +668,17 @@ describe('SearchFacetFiltersService', () => {
|
|||||||
facetQueries: { queries: [] },
|
facetQueries: { queries: [] },
|
||||||
facetFields: {
|
facetFields: {
|
||||||
fields: [
|
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);
|
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 { 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 { SearchHeaderQueryBuilderService } from './search-header-query-builder.service';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
describe('SearchHeaderQueryBuilderService', () => {
|
describe('SearchHeaderQueryBuilderService', () => {
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
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 { SearchConfiguration } from '../models/search-configuration.interface';
|
||||||
import { BaseQueryBuilderService } from './base-query-builder.service';
|
import { BaseQueryBuilderService } from './base-query-builder.service';
|
||||||
import { SearchCategory } from '../models/search-category.interface';
|
import { SearchCategory } from '../models/search-category.interface';
|
||||||
@ -26,6 +26,7 @@ import { Observable } from 'rxjs';
|
|||||||
import { SearchSortingDefinition } from '../models/search-sorting-definition.interface';
|
import { SearchSortingDefinition } from '../models/search-sorting-definition.interface';
|
||||||
import { FilterSearch } from '../models/filter-search.interface';
|
import { FilterSearch } from '../models/filter-search.interface';
|
||||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
import { SearchQueryBuilderService } from './search-query-builder.service';
|
import { SearchQueryBuilderService } from './search-query-builder.service';
|
||||||
import { SearchConfiguration } from '../models/search-configuration.interface';
|
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 { FacetField } from '../models/facet-field.interface';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
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 { SearchConfiguration } from '../models/search-configuration.interface';
|
||||||
import { BaseQueryBuilderService } from './base-query-builder.service';
|
import { BaseQueryBuilderService } from './base-query-builder.service';
|
||||||
import { ADF_SEARCH_CONFIGURATION } from '../search-configuration.token';
|
import { ADF_SEARCH_CONFIGURATION } from '../search-configuration.token';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class SearchQueryBuilderService extends BaseQueryBuilderService {
|
export class SearchQueryBuilderService extends BaseQueryBuilderService {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { NodePaging, QueriesApi, SearchRequest, ResultSetPaging, SearchApi } from '@alfresco/js-api';
|
import { NodePaging, QueriesApi, SearchRequest, ResultSetPaging, SearchApi } from '@alfresco/js-api';
|
||||||
import { Observable, Subject, from } from 'rxjs';
|
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';
|
import { SearchConfigurationService } from './search-configuration.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -32,8 +32,9 @@ import {
|
|||||||
NodeSecurityMarkBody,
|
NodeSecurityMarkBody,
|
||||||
GsGroupInclude
|
GsGroupInclude
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { finalize } from 'rxjs/operators';
|
import { finalize } from 'rxjs/operators';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
const DEFAULT_SKIP_COUNT = 0;
|
const DEFAULT_SKIP_COUNT = 0;
|
||||||
const DEFAULT_INCLUDE = 'inUse';
|
const DEFAULT_INCLUDE = 'inUse';
|
||||||
|
@ -17,12 +17,9 @@
|
|||||||
|
|
||||||
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
|
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
|
||||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
|
||||||
import { ReplaySubject } from 'rxjs';
|
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 { 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');
|
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'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AlfrescoApiService {
|
export class AlfrescoApiService {
|
||||||
|
|
||||||
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
|
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
|
||||||
|
|
||||||
protected alfrescoApi: AlfrescoApi;
|
protected alfrescoApi: AlfrescoApi;
|
||||||
@ -50,7 +46,8 @@ export class AlfrescoApiService {
|
|||||||
protected appConfig: AppConfigService,
|
protected appConfig: AppConfigService,
|
||||||
protected storageService: StorageService,
|
protected storageService: StorageService,
|
||||||
@Optional()
|
@Optional()
|
||||||
@Inject(ALFRESCO_API_FACTORY) private alfrescoApiFactory?: AlfrescoApiFactory
|
@Inject(ALFRESCO_API_FACTORY)
|
||||||
|
private alfrescoApiFactory?: AlfrescoApiFactory
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async load(config: AlfrescoApiConfig): Promise<void> {
|
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.
|
* 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 { EventEmitter, Injectable, Output } from '@angular/core';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { map, tap } from 'rxjs/operators';
|
import { map, tap } from 'rxjs/operators';
|
||||||
|
@ -20,10 +20,8 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import {
|
import {
|
||||||
CoreModule,
|
CoreModule,
|
||||||
AlfrescoApiService,
|
|
||||||
AppConfigService,
|
AppConfigService,
|
||||||
CookieService,
|
CookieService,
|
||||||
AlfrescoApiServiceMock,
|
|
||||||
AppConfigServiceMock,
|
AppConfigServiceMock,
|
||||||
CookieServiceMock,
|
CookieServiceMock,
|
||||||
AuthModule,
|
AuthModule,
|
||||||
@ -31,8 +29,10 @@ import {
|
|||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { ContentModule } from '../content.module';
|
import { ContentModule } from '../content.module';
|
||||||
import { versionCompatibilityFactory } from '../version-compatibility/version-compatibility-factory';
|
import { versionCompatibilityFactory } from '../version-compatibility/version-compatibility-factory';
|
||||||
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
||||||
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||||
|
import { AlfrescoApiServiceMock } from '../mock';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
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 { ContentApi } from '@alfresco/js-api';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
* limitations under the License.
|
* 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 { 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 { VersionsApi, Node, VersionEntry, NodesApi, NodeEntry, ContentApi, ContentPagingQuery } from '@alfresco/js-api';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
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 { ContentInfo, Node, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||||
import { AlfrescoViewerComponent, ContentService, NodeActionsService, RenditionService } from '@alfresco/adf-content-services';
|
import { AlfrescoViewerComponent, ContentService, NodeActionsService, RenditionService } from '@alfresco/adf-content-services';
|
||||||
import {
|
import {
|
||||||
AlfrescoApiService,
|
|
||||||
AlfrescoApiServiceMock,
|
|
||||||
AuthModule,
|
AuthModule,
|
||||||
CloseButtonPosition,
|
CloseButtonPosition,
|
||||||
EventMock,
|
EventMock,
|
||||||
@ -41,6 +39,8 @@ import { throwError } from 'rxjs';
|
|||||||
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { ESCAPE } from '@angular/cdk/keycodes';
|
import { ESCAPE } from '@angular/cdk/keycodes';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { AlfrescoApiService } from '../../services';
|
||||||
|
import { AlfrescoApiServiceMock } from '../../mock';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-toolbar',
|
selector: 'adf-viewer-container-toolbar',
|
||||||
|
@ -30,7 +30,6 @@ import {
|
|||||||
ViewEncapsulation
|
ViewEncapsulation
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
AlfrescoApiService,
|
|
||||||
CloseButtonPosition,
|
CloseButtonPosition,
|
||||||
Track,
|
Track,
|
||||||
ViewerComponent,
|
ViewerComponent,
|
||||||
@ -42,6 +41,7 @@ import {
|
|||||||
ViewerToolbarComponent,
|
ViewerToolbarComponent,
|
||||||
ViewUtilService
|
ViewUtilService
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { ContentApi, Node, NodeEntry, NodesApi, RenditionEntry, SharedlinksApi, Version, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
import { ContentApi, Node, NodeEntry, NodesApi, RenditionEntry, SharedlinksApi, Version, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||||
import { RenditionService } from '../../common/services/rendition.service';
|
import { RenditionService } from '../../common/services/rendition.service';
|
||||||
|
@ -42,9 +42,13 @@ export * from './lib/tree/index';
|
|||||||
export * from './lib/category/index';
|
export * from './lib/category/index';
|
||||||
export * from './lib/viewer/index';
|
export * from './lib/viewer/index';
|
||||||
export * from './lib/security/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/infinite-scroll-datasource';
|
||||||
export * from './lib/prediction/index';
|
export * from './lib/prediction/index';
|
||||||
export * from './lib/legal-hold/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/content.module';
|
||||||
export * from './lib/material.module';
|
export * from './lib/material.module';
|
||||||
|
@ -16,3 +16,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './src/public-api';
|
export * from './src/public-api';
|
||||||
|
export * from './api/src/index';
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
"@alfresco/adf-extensions": ">=7.0.0-alpha.2-0",
|
"@alfresco/adf-extensions": ">=7.0.0-alpha.2-0",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
"minimatch-browser": ">=1.0.0",
|
"minimatch-browser": ">=1.0.0",
|
||||||
"pdfjs-dist": ">=3.3.122"
|
"pdfjs-dist": ">=3.3.122",
|
||||||
|
"ts-morph": "^20.0.0"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"core",
|
"core",
|
||||||
@ -45,5 +46,11 @@
|
|||||||
"angular",
|
"angular",
|
||||||
"components"
|
"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"
|
"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": {
|
"test": {
|
||||||
"executor": "@angular-devkit/build-angular:karma",
|
"executor": "@angular-devkit/build-angular:karma",
|
||||||
"options": {
|
"options": {
|
||||||
@ -133,7 +143,7 @@
|
|||||||
},
|
},
|
||||||
"npm-publish": {
|
"npm-publish": {
|
||||||
"executor": "nx:run-commands",
|
"executor": "nx:run-commands",
|
||||||
"dependsOn": ["build", "pretheme"],
|
"dependsOn": ["build", "pretheme", "build-schematics"],
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "dist/libs/core",
|
"cwd": "dist/libs/core",
|
||||||
"commands": [
|
"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'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AppConfigService {
|
export class AppConfigService {
|
||||||
|
|
||||||
config: any = {
|
config: any = {
|
||||||
application: {
|
application: {
|
||||||
name: 'Alfresco ADF Application'
|
name: 'Alfresco ADF Application'
|
||||||
@ -97,8 +96,7 @@ export class AppConfigService {
|
|||||||
* @returns Property value, when loaded
|
* @returns Property value, when loaded
|
||||||
*/
|
*/
|
||||||
select(property: string): Observable<any> {
|
select(property: string): Observable<any> {
|
||||||
return this.onLoadSubject
|
return this.onLoadSubject.pipe(
|
||||||
.pipe(
|
|
||||||
map((config) => ObjectUtils.getValue(config, property)),
|
map((config) => ObjectUtils.getValue(config, property)),
|
||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
);
|
);
|
||||||
@ -170,9 +168,7 @@ export class AppConfigService {
|
|||||||
protected onDataLoaded() {
|
protected onDataLoaded() {
|
||||||
this.onLoadSubject.next(this.config);
|
this.onLoadSubject.next(this.config);
|
||||||
|
|
||||||
this.extensionService.setup$
|
this.extensionService.setup$.pipe(take(1)).subscribe((config) => this.onExtensionsLoaded(config));
|
||||||
.pipe(take(1))
|
|
||||||
.subscribe((config) => this.onExtensionsLoaded(config));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onExtensionsLoaded(config: ExtensionConfig) {
|
protected onExtensionsLoaded(config: ExtensionConfig) {
|
||||||
@ -229,9 +225,7 @@ export class AppConfigService {
|
|||||||
*/
|
*/
|
||||||
loadWellKnown(hostIdp: string): Promise<OpenidConfiguration> {
|
loadWellKnown(hostIdp: string): Promise<OpenidConfiguration> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.http
|
this.http.get<OpenidConfiguration>(`${hostIdp}/.well-known/openid-configuration`).subscribe({
|
||||||
.get<OpenidConfiguration>(`${hostIdp}/.well-known/openid-configuration`)
|
|
||||||
.subscribe({
|
|
||||||
next: (res: OpenidConfiguration) => {
|
next: (res: OpenidConfiguration) => {
|
||||||
resolve(res);
|
resolve(res);
|
||||||
},
|
},
|
||||||
@ -273,5 +267,4 @@ export class AppConfigService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
||||||
import { AUTH_CONFIG, OAuthModule, OAuthStorage } from 'angular-oauth2-oidc';
|
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 { AuthenticationService } from '../services/authentication.service';
|
||||||
import { StorageService } from '../../common/services/storage.service';
|
import { StorageService } from '../../common/services/storage.service';
|
||||||
import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config';
|
import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config';
|
||||||
@ -44,7 +42,6 @@ export function loginFactory(redirectService: RedirectAuthService): () => Promis
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: OAuthStorage, useExisting: StorageService },
|
{ provide: OAuthStorage, useExisting: StorageService },
|
||||||
{ provide: AuthenticationService},
|
{ provide: AuthenticationService},
|
||||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService },
|
|
||||||
{
|
{
|
||||||
provide: AUTH_CONFIG,
|
provide: AUTH_CONFIG,
|
||||||
useFactory: authConfigFactory,
|
useFactory: authConfigFactory,
|
||||||
|
@ -21,8 +21,6 @@ import { AppConfigService } from '../../app-config/app-config.service';
|
|||||||
import { StorageService } from '../../common/services/storage.service';
|
import { StorageService } from '../../common/services/storage.service';
|
||||||
import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service';
|
import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service';
|
||||||
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
|
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';
|
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||||
|
|
||||||
describe('UserPreferencesService', () => {
|
describe('UserPreferencesService', () => {
|
||||||
@ -30,14 +28,12 @@ describe('UserPreferencesService', () => {
|
|||||||
let preferences: UserPreferencesService;
|
let preferences: UserPreferencesService;
|
||||||
let storage: StorageService;
|
let storage: StorageService;
|
||||||
let appConfig: AppConfigServiceMock;
|
let appConfig: AppConfigServiceMock;
|
||||||
let alfrescoApiService: AlfrescoApiServiceMock;
|
|
||||||
let translate: TranslateService;
|
let translate: TranslateService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [NoopTranslateModule],
|
imports: [NoopTranslateModule],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
|
||||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@ -53,7 +49,6 @@ describe('UserPreferencesService', () => {
|
|||||||
storage = TestBed.inject(StorageService);
|
storage = TestBed.inject(StorageService);
|
||||||
storage.clear();
|
storage.clear();
|
||||||
translate = TestBed.inject(TranslateService);
|
translate = TestBed.inject(TranslateService);
|
||||||
alfrescoApiService = TestBed.inject(AlfrescoApiService) as AlfrescoApiServiceMock;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -103,7 +98,7 @@ describe('UserPreferencesService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should null value return default prefix', () => {
|
it('should null value return default prefix', () => {
|
||||||
storage.setItem('paginationSize', null);
|
storage.setItem('paginationSize', '');
|
||||||
const paginationSize = preferences.getPropertyKey('paginationSize');
|
const paginationSize = preferences.getPropertyKey('paginationSize');
|
||||||
expect(preferences.get(paginationSize, 'default')).toBe('default');
|
expect(preferences.get(paginationSize, 'default')).toBe('default');
|
||||||
});
|
});
|
||||||
@ -172,7 +167,7 @@ describe('UserPreferencesService', () => {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
appConfig.config.locale = 'fake-locale-config';
|
appConfig.config.locale = 'fake-locale-config';
|
||||||
alfrescoApiService.initialize();
|
appConfig.load();
|
||||||
const textOrientation = preferences.getPropertyKey('textOrientation');
|
const textOrientation = preferences.getPropertyKey('textOrientation');
|
||||||
expect(storage.getItem(textOrientation)).toBe('ltr');
|
expect(storage.getItem(textOrientation)).toBe('ltr');
|
||||||
});
|
});
|
||||||
@ -185,7 +180,7 @@ describe('UserPreferencesService', () => {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
appConfig.config.locale = 'fake-locale-config';
|
appConfig.config.locale = 'fake-locale-config';
|
||||||
alfrescoApiService.initialize();
|
appConfig.load();
|
||||||
const textOrientation = preferences.getPropertyKey('textOrientation');
|
const textOrientation = preferences.getPropertyKey('textOrientation');
|
||||||
expect(storage.getItem(textOrientation)).toBe('rtl');
|
expect(storage.getItem(textOrientation)).toBe('rtl');
|
||||||
});
|
});
|
||||||
@ -196,7 +191,6 @@ describe('UserPreferencesService', () => {
|
|||||||
key: 'fake-locale-browser'
|
key: 'fake-locale-browser'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
alfrescoApiService.initialize();
|
|
||||||
|
|
||||||
const textOrientation = preferences.getPropertyKey('textOrientation');
|
const textOrientation = preferences.getPropertyKey('textOrientation');
|
||||||
expect(storage.getItem(textOrientation)).toBe(null);
|
expect(storage.getItem(textOrientation)).toBe(null);
|
||||||
@ -210,7 +204,7 @@ describe('UserPreferencesService', () => {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
spyOn(translate, 'getBrowserCultureLang').and.returnValue('fake-locale-browser');
|
spyOn(translate, 'getBrowserCultureLang').and.returnValue('fake-locale-browser');
|
||||||
alfrescoApiService.initialize();
|
appConfig.load();
|
||||||
|
|
||||||
let lastValue;
|
let lastValue;
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { Observable, BehaviorSubject } from 'rxjs';
|
import { Observable, BehaviorSubject } from 'rxjs';
|
||||||
import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service';
|
import { AppConfigService, AppConfigValues } from '../../app-config/app-config.service';
|
||||||
import { StorageService } from './storage.service';
|
import { StorageService } from './storage.service';
|
||||||
import { distinctUntilChanged, map, filter } from 'rxjs/operators';
|
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
|
||||||
import { LanguageItem } from './language-item.interface';
|
import { LanguageItem } from './language-item.interface';
|
||||||
|
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
@ -48,13 +47,17 @@ export class UserPreferencesService {
|
|||||||
private onChangeSubject: BehaviorSubject<any>;
|
private onChangeSubject: BehaviorSubject<any>;
|
||||||
onChange: Observable<any>;
|
onChange: Observable<any>;
|
||||||
|
|
||||||
constructor(public translate: TranslateService,
|
constructor(
|
||||||
|
public translate: TranslateService,
|
||||||
private appConfig: AppConfigService,
|
private appConfig: AppConfigService,
|
||||||
private storage: StorageService,
|
private storage: StorageService
|
||||||
private alfrescoApiService: AlfrescoApiService) {
|
) {
|
||||||
this.alfrescoApiService.alfrescoApiInitialized.pipe(filter(status => status)).subscribe(this.initUserPreferenceStatus.bind(this));
|
|
||||||
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
|
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
|
||||||
this.onChange = this.onChangeSubject.asObservable();
|
this.onChange = this.onChangeSubject.asObservable();
|
||||||
|
|
||||||
|
this.appConfig.onLoad.subscribe(() => {
|
||||||
|
this.initUserPreferenceStatus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private initUserPreferenceStatus() {
|
private initUserPreferenceStatus() {
|
||||||
@ -168,7 +171,7 @@ export class UserPreferencesService {
|
|||||||
*
|
*
|
||||||
* @param value Name of the prefix
|
* @param value Name of the prefix
|
||||||
*/
|
*/
|
||||||
setStoragePrefix(value: string) {
|
setStoragePrefix(value: string | null) {
|
||||||
this.storage.setItem('USER_PROFILE', value || 'GUEST');
|
this.storage.setItem('USER_PROFILE', value || 'GUEST');
|
||||||
this.initUserPreferenceStatus();
|
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