mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
feat: replace api usage for ModelApi
This commit is contained in:
@@ -17,29 +17,28 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core';
|
||||
import { ApiClientsService, AppConfigService, LogService } from '@alfresco/adf-core';
|
||||
import { from, Observable, of, Subject, zip } from 'rxjs';
|
||||
import { AspectListDialogComponentData } from './aspect-list-dialog-data.interface';
|
||||
import { AspectListDialogComponent } from './aspect-list-dialog.component';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api';
|
||||
import { AspectEntry, AspectPaging } from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AspectListService {
|
||||
|
||||
_aspectsApi: AspectsApi;
|
||||
get aspectsApi(): AspectsApi {
|
||||
this._aspectsApi = this._aspectsApi ?? new AspectsApi(this.alfrescoApiService.getInstance());
|
||||
return this._aspectsApi;
|
||||
get aspectsApi() {
|
||||
return this.apiClientsService.get('ModelClient.aspects');
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
constructor(
|
||||
private apiClientsService: ApiClientsService,
|
||||
private appConfigService: AppConfigService,
|
||||
private dialog: MatDialog,
|
||||
private logService: LogService) {
|
||||
}
|
||||
private logService: LogService
|
||||
) { }
|
||||
|
||||
getAspects(): Observable<AspectEntry[]> {
|
||||
const visibleAspectList = this.getVisibleAspects();
|
||||
|
@@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TypeEntry, TypePaging, TypesApi } from '@alfresco/js-api';
|
||||
import { TypeEntry, TypePaging } from '@alfresco/js-api';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ApiClientsService } from '@alfresco/adf-core';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@Injectable({
|
||||
@@ -25,13 +25,11 @@ import { map } from 'rxjs/operators';
|
||||
})
|
||||
export class ContentTypeService {
|
||||
|
||||
_typesApi: TypesApi;
|
||||
get typesApi(): TypesApi {
|
||||
this._typesApi = this._typesApi ?? new TypesApi(this.alfrescoApiService.getInstance());
|
||||
return this._typesApi;
|
||||
get typesApi() {
|
||||
return this.apiClientsService.get('ModelClient.types');
|
||||
}
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
constructor(private apiClientsService: ApiClientsService) {
|
||||
}
|
||||
|
||||
getContentTypeByPrefix(prefixedType: string): Observable<TypeEntry> {
|
||||
|
@@ -18,13 +18,15 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ActivitiClientModule } from './activiti/activiti-client.module';
|
||||
import { DiscoveryClientModule } from './discovery/discovery-client.module';
|
||||
import { ModelClientModule } from './model/model-client.module';
|
||||
import { SearchClientModule } from './search/search-client.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
ActivitiClientModule,
|
||||
DiscoveryClientModule,
|
||||
SearchClientModule
|
||||
SearchClientModule,
|
||||
ModelClientModule
|
||||
]
|
||||
})
|
||||
export class AlfrescoJsClientsModule { }
|
||||
|
38
lib/core/api/clients/model/model-client.module.ts
Normal file
38
lib/core/api/clients/model/model-client.module.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* 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 { AspectsApi, TypesApi } from '@alfresco/js-api';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ApiClientsService } from '../../api-clients.service';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Api {
|
||||
interface ApiRegistry {
|
||||
['ModelClient.aspects']: AspectsApi;
|
||||
['ModelClient.types']: TypesApi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule()
|
||||
export class ModelClientModule {
|
||||
constructor(private apiClientsService: ApiClientsService) {
|
||||
this.apiClientsService.register('ModelClient.aspects', AspectsApi);
|
||||
this.apiClientsService.register('ModelClient.types', TypesApi);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user