mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACS-7382] Standalone AdfConfigPipe pipe (#9558)
* standalone AdfConfigPipe * standalone AdfConfigPipe [ci:force]
This commit is contained in:
parent
43b950631c
commit
05884e829b
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { EventEmitter } from '@angular/core';
|
import { EventEmitter } from '@angular/core';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { AppConfigModule, AppConfigService, CoreTestingModule } from '@alfresco/adf-core';
|
import { AppConfigService, CoreTestingModule } 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';
|
||||||
@ -35,7 +35,7 @@ describe('UploadService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule, AppConfigModule],
|
imports: [CoreTestingModule],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: DiscoveryApiService,
|
provide: DiscoveryApiService,
|
||||||
|
@ -25,22 +25,9 @@ import { CoreModule } from '@alfresco/adf-core';
|
|||||||
import { VersionManagerModule } from '../version-manager';
|
import { VersionManagerModule } from '../version-manager';
|
||||||
import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog';
|
import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [CommonModule, MaterialModule, CoreModule, UploadModule, FormsModule, VersionManagerModule],
|
||||||
CommonModule,
|
declarations: [NewVersionUploaderDialogComponent],
|
||||||
MaterialModule,
|
exports: [NewVersionUploaderDialogComponent, FormsModule]
|
||||||
CoreModule,
|
|
||||||
UploadModule,
|
|
||||||
FormsModule,
|
|
||||||
VersionManagerModule
|
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
NewVersionUploaderDialogComponent
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
NewVersionUploaderDialogComponent,
|
|
||||||
FormsModule
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class NewVersionUploaderModule { }
|
export class NewVersionUploaderModule {}
|
||||||
|
@ -15,20 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { AppConfigPipe } from './app-config.pipe';
|
import { AppConfigPipe } from './app-config.pipe';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [AppConfigPipe],
|
||||||
HttpClientModule
|
exports: [AppConfigPipe]
|
||||||
],
|
|
||||||
declarations: [
|
|
||||||
AppConfigPipe
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
AppConfigPipe
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class AppConfigModule {
|
/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */
|
||||||
}
|
export class AppConfigModule {}
|
||||||
|
@ -19,7 +19,8 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||||||
import { AppConfigService } from './app-config.service';
|
import { AppConfigService } from './app-config.service';
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'adfAppConfig'
|
name: 'adfAppConfig',
|
||||||
|
standalone: true
|
||||||
})
|
})
|
||||||
export class AppConfigPipe implements PipeTransform {
|
export class AppConfigPipe implements PipeTransform {
|
||||||
constructor(private config: AppConfigService) {}
|
constructor(private config: AppConfigService) {}
|
||||||
|
@ -18,21 +18,18 @@
|
|||||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { AppConfigService } from './app-config.service';
|
import { AppConfigService } from './app-config.service';
|
||||||
import { AppConfigModule } from './app-config.module';
|
|
||||||
import { ExtensionConfig, ExtensionService } from '@alfresco/adf-extensions';
|
import { ExtensionConfig, ExtensionService } from '@alfresco/adf-extensions';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
class TestExtensionService extends ExtensionService {
|
class TestExtensionService extends ExtensionService {
|
||||||
|
|
||||||
onSetup(config: ExtensionConfig) {
|
onSetup(config: ExtensionConfig) {
|
||||||
this.onSetup$.next(config);
|
this.onSetup$.next(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('AppConfigService', () => {
|
describe('AppConfigService', () => {
|
||||||
|
|
||||||
let appConfigService: AppConfigService;
|
let appConfigService: AppConfigService;
|
||||||
let extensionService: ExtensionService;
|
let extensionService: ExtensionService;
|
||||||
let httpClient: HttpClient;
|
let httpClient: HttpClient;
|
||||||
@ -52,13 +49,8 @@ describe('AppConfigService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [HttpClientModule],
|
||||||
HttpClientModule,
|
providers: [{ provide: ExtensionService, useClass: TestExtensionService }]
|
||||||
AppConfigModule
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
{ provide: ExtensionService, useClass: TestExtensionService }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -191,7 +183,7 @@ describe('AppConfigService', () => {
|
|||||||
|
|
||||||
it('should execute callback function if is passed to the load method', async () => {
|
it('should execute callback function if is passed to the load method', async () => {
|
||||||
const fakeCallBack = jasmine.createSpy('fakeCallBack');
|
const fakeCallBack = jasmine.createSpy('fakeCallBack');
|
||||||
fakeCallBack.and.returnValue(()=>{});
|
fakeCallBack.and.returnValue(() => {});
|
||||||
|
|
||||||
await appConfigService.load(fakeCallBack);
|
await appConfigService.load(fakeCallBack);
|
||||||
|
|
||||||
@ -212,6 +204,4 @@ describe('AppConfigService', () => {
|
|||||||
expect(appConfigService.get<any>('objectKey').secondUrl).toEqual('http://localhost:8080');
|
expect(appConfigService.get<any>('objectKey').secondUrl).toEqual('http://localhost:8080');
|
||||||
expect(appConfigService.get<any>('objectKey').thirdUrl).toEqual('http://localhost:8080');
|
expect(appConfigService.get<any>('objectKey').thirdUrl).toEqual('http://localhost:8080');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,6 @@ import { TranslateModule, TranslateLoader, TranslateStore, TranslateService } fr
|
|||||||
|
|
||||||
import { MaterialModule } from './material.module';
|
import { MaterialModule } from './material.module';
|
||||||
import { AboutModule } from './about/about.module';
|
import { AboutModule } from './about/about.module';
|
||||||
import { AppConfigModule } from './app-config/app-config.module';
|
|
||||||
import { CardViewModule } from './card-view/card-view.module';
|
import { CardViewModule } from './card-view/card-view.module';
|
||||||
import { ContextMenuModule } from './context-menu/context-menu.module';
|
import { ContextMenuModule } from './context-menu/context-menu.module';
|
||||||
import { DataTableModule } from './datatable/datatable.module';
|
import { DataTableModule } from './datatable/datatable.module';
|
||||||
@ -66,7 +65,7 @@ import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-facto
|
|||||||
import { AdfDateFnsAdapter } from './common/utils/date-fns-adapter';
|
import { AdfDateFnsAdapter } from './common/utils/date-fns-adapter';
|
||||||
import { MomentDateAdapter } from './common/utils/moment-date-adapter';
|
import { MomentDateAdapter } from './common/utils/moment-date-adapter';
|
||||||
import { AdfDateTimeFnsAdapter } from './common/utils/datetime-fns-adapter';
|
import { AdfDateTimeFnsAdapter } from './common/utils/datetime-fns-adapter';
|
||||||
import { StoragePrefixFactory } from './app-config';
|
import { AppConfigPipe, StoragePrefixFactory } from './app-config';
|
||||||
import { UnsavedChangesDialogModule } from './dialogs';
|
import { UnsavedChangesDialogModule } from './dialogs';
|
||||||
import { DynamicChipListModule } from './dynamic-chip-list';
|
import { DynamicChipListModule } from './dynamic-chip-list';
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ import { DynamicChipListModule } from './dynamic-chip-list';
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
AppConfigModule,
|
AppConfigPipe,
|
||||||
PaginationModule,
|
PaginationModule,
|
||||||
ToolbarModule,
|
ToolbarModule,
|
||||||
ContextMenuModule,
|
ContextMenuModule,
|
||||||
@ -123,7 +122,7 @@ import { DynamicChipListModule } from './dynamic-chip-list';
|
|||||||
IdentityUserInfoModule,
|
IdentityUserInfoModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
AppConfigModule,
|
AppConfigPipe,
|
||||||
PaginationModule,
|
PaginationModule,
|
||||||
ToolbarModule,
|
ToolbarModule,
|
||||||
ContextMenuModule,
|
ContextMenuModule,
|
||||||
@ -162,12 +161,7 @@ export class CoreModule {
|
|||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: loadAppConfig,
|
useFactory: loadAppConfig,
|
||||||
deps: [
|
deps: [AppConfigService, StorageService, AdfHttpClient, StoragePrefixFactory],
|
||||||
AppConfigService,
|
|
||||||
StorageService,
|
|
||||||
AdfHttpClient,
|
|
||||||
StoragePrefixFactory
|
|
||||||
],
|
|
||||||
multi: true
|
multi: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -187,7 +181,7 @@ export class CoreModule {
|
|||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: createAlfrescoApiInstance,
|
useFactory: createAlfrescoApiInstance,
|
||||||
deps: [ AlfrescoApiLoaderService ],
|
deps: [AlfrescoApiLoaderService],
|
||||||
multi: true
|
multi: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user