mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
feat: replace api usage for SerachApi
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService, LogService, PaginationModel } from '@alfresco/adf-core';
|
import { AlfrescoApiService, ApiClientsService, LogService, PaginationModel } from '@alfresco/adf-core';
|
||||||
import {
|
import {
|
||||||
NodePaging,
|
NodePaging,
|
||||||
DeletedNodesPaging,
|
DeletedNodesPaging,
|
||||||
@@ -59,10 +59,8 @@ export class CustomResourcesService {
|
|||||||
return this._trashcanApi;
|
return this._trashcanApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _searchApi: SearchApi;
|
|
||||||
get searchApi(): SearchApi {
|
get searchApi(): SearchApi {
|
||||||
this._searchApi = this._searchApi ?? new SearchApi(this.apiService.getInstance());
|
return this.apiClientsService.get('SearchClient.search');
|
||||||
return this._searchApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _sharedLinksApi: SharedlinksApi;
|
private _sharedLinksApi: SharedlinksApi;
|
||||||
@@ -83,8 +81,11 @@ export class CustomResourcesService {
|
|||||||
return this._nodesApi;
|
return this._nodesApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {
|
constructor(
|
||||||
}
|
private apiClientsService: ApiClientsService,
|
||||||
|
private apiService: AlfrescoApiService,
|
||||||
|
private logService: LogService
|
||||||
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets files recently accessed by a user.
|
* Gets files recently accessed by a user.
|
||||||
|
@@ -18,11 +18,13 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ActivitiClientModule } from './activiti/activiti-client.module';
|
import { ActivitiClientModule } from './activiti/activiti-client.module';
|
||||||
import { DiscoveryClientModule } from './discovery/discovery-client.module';
|
import { DiscoveryClientModule } from './discovery/discovery-client.module';
|
||||||
|
import { SearchClientModule } from './search/search-client.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
ActivitiClientModule,
|
ActivitiClientModule,
|
||||||
DiscoveryClientModule
|
DiscoveryClientModule,
|
||||||
|
SearchClientModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AlfrescoJsClientsModule { }
|
export class AlfrescoJsClientsModule { }
|
||||||
|
36
lib/core/api/clients/search/search-client.module.ts
Normal file
36
lib/core/api/clients/search/search-client.module.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { SearchApi } 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 {
|
||||||
|
['SearchClient.search']: SearchApi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule()
|
||||||
|
export class SearchClientModule {
|
||||||
|
constructor(private apiClientsService: ApiClientsService) {
|
||||||
|
this.apiClientsService.register('SearchClient.search', SearchApi);
|
||||||
|
}
|
||||||
|
}
|
@@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { NodePaging, QueriesApi, QueryBody, ResultSetPaging, SearchApi } from '@alfresco/js-api';
|
import { NodePaging, QueriesApi, QueryBody, ResultSetPaging } from '@alfresco/js-api';
|
||||||
import { Observable, Subject, from, throwError } from 'rxjs';
|
import { Observable, Subject, from, throwError } from 'rxjs';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { SearchConfigurationService } from './search-configuration.service';
|
import { SearchConfigurationService } from './search-configuration.service';
|
||||||
|
import { ApiClientsService } from '../api/api-clients.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -34,13 +35,13 @@ export class SearchService {
|
|||||||
return this._queriesApi;
|
return this._queriesApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _searchApi: SearchApi;
|
get searchApi() {
|
||||||
get searchApi(): SearchApi {
|
return this.apiClientsService.get('SearchClient.search');
|
||||||
this._searchApi = this._searchApi ?? new SearchApi(this.apiService.getInstance());
|
|
||||||
return this._searchApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService,
|
constructor(
|
||||||
|
private apiClientsService: ApiClientsService,
|
||||||
|
private apiService: AlfrescoApiService,
|
||||||
private searchConfigurationService: SearchConfigurationService) {
|
private searchConfigurationService: SearchConfigurationService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user