mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-] update library to use new js-api 3.0.0 (#4097)
This commit is contained in:
committed by
Eugenio Romano
parent
2acd1b4e26
commit
3ef7d3b7ea
@@ -19,7 +19,7 @@ import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output,
|
||||
QueryList, ViewEncapsulation, ViewChild, ViewChildren, ElementRef, TemplateRef, ContentChild } from '@angular/core';
|
||||
import { MinimalNodeEntity, QueryBody } from 'alfresco-js-api';
|
||||
import { NodeEntry, QueryBody } from '@alfresco/js-api';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { SearchComponent } from './search.component';
|
||||
import { MatListItem } from '@angular/material';
|
||||
@@ -175,7 +175,7 @@ export class SearchControlComponent implements OnInit, OnDestroy {
|
||||
return this.autocomplete ? 'on' : 'off';
|
||||
}
|
||||
|
||||
getMimeTypeIcon(node: MinimalNodeEntity): string {
|
||||
getMimeTypeIcon(node: NodeEntry): string {
|
||||
let mimeType;
|
||||
|
||||
if (node.entry.content && node.entry.content.mimeType) {
|
||||
|
@@ -25,6 +25,7 @@ import { FacetQuery } from '../../facet-query.interface';
|
||||
import { FacetField } from '../../facet-field.interface';
|
||||
import { SearchFilterList } from './models/search-filter-list.model';
|
||||
import { takeWhile } from 'rxjs/operators';
|
||||
import { ResultSetPaging } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-search-filter',
|
||||
@@ -73,9 +74,9 @@ export class SearchFilterComponent implements OnInit, OnDestroy {
|
||||
if (this.queryBuilder) {
|
||||
this.queryBuilder.executed.pipe(
|
||||
takeWhile(() => this.isAlive)
|
||||
).subscribe((data) => {
|
||||
this.onDataLoaded(data);
|
||||
this.searchService.dataLoaded.next(data);
|
||||
).subscribe((resultSetPaging: ResultSetPaging) => {
|
||||
this.onDataLoaded(resultSetPaging);
|
||||
this.searchService.dataLoaded.next(resultSetPaging);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SearchService, setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { QueryBody } from 'alfresco-js-api';
|
||||
import { QueryBody } from '@alfresco/js-api';
|
||||
import { differentResult, folderResult, result, SimpleSearchTestComponent } from '../../mock';
|
||||
import { Observable, of, throwError } from 'rxjs';
|
||||
import { SearchModule } from '../search.module';
|
||||
|
@@ -29,7 +29,7 @@ import {
|
||||
ViewChild,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { NodePaging, QueryBody } from 'alfresco-js-api';
|
||||
import { NodePaging, QueryBody } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
|
||||
@@ -119,7 +119,7 @@ export class SearchComponent implements AfterContentInit, OnChanges {
|
||||
});
|
||||
|
||||
searchService.dataLoaded.subscribe(
|
||||
(data) => this.onSearchDataLoaded(data),
|
||||
(nodePaging: NodePaging) => this.onSearchDataLoaded(nodePaging),
|
||||
(error) => this.onSearchDataError(error)
|
||||
);
|
||||
}
|
||||
@@ -176,9 +176,9 @@ export class SearchComponent implements AfterContentInit, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
onSearchDataLoaded(data: NodePaging) {
|
||||
if (data) {
|
||||
this.results = data;
|
||||
onSearchDataLoaded(nodePaging: NodePaging) {
|
||||
if (nodePaging) {
|
||||
this.results = nodePaging;
|
||||
this.resultLoaded.emit(this.results);
|
||||
this.isOpen = true;
|
||||
this.setVisibility();
|
||||
|
@@ -18,7 +18,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { QueryBody, RequestFacetFields, RequestFacetField, RequestSortDefinitionInner } from 'alfresco-js-api';
|
||||
import {
|
||||
QueryBody,
|
||||
RequestFacetFields,
|
||||
RequestFacetField,
|
||||
RequestSortDefinitionInner,
|
||||
ResultSetPaging
|
||||
} from '@alfresco/js-api';
|
||||
import { SearchCategory } from './search-category.interface';
|
||||
import { FilterQuery } from './filter-query.interface';
|
||||
import { SearchRange } from './search-range.interface';
|
||||
@@ -36,7 +42,7 @@ export class SearchQueryBuilderService {
|
||||
private _userQuery = '';
|
||||
|
||||
updated: Subject<QueryBody> = new Subject();
|
||||
executed: Subject<any> = new Subject();
|
||||
executed: Subject<ResultSetPaging> = new Subject();
|
||||
|
||||
categories: Array<SearchCategory> = [];
|
||||
queryFragments: { [id: string]: string } = {};
|
||||
@@ -165,8 +171,8 @@ export class SearchQueryBuilderService {
|
||||
async execute() {
|
||||
const query = this.buildQuery();
|
||||
if (query) {
|
||||
const data = await this.alfrescoApiService.searchApi.search(query);
|
||||
this.executed.next(data);
|
||||
const resultSetPaging: ResultSetPaging = await this.alfrescoApiService.searchApi.search(query);
|
||||
this.executed.next(resultSetPaging);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,11 +240,11 @@ export class SearchQueryBuilderService {
|
||||
|
||||
protected get sort(): RequestSortDefinitionInner[] {
|
||||
return this.sorting.map((def) => {
|
||||
return {
|
||||
return new RequestSortDefinitionInner({
|
||||
type: def.type,
|
||||
field: def.field,
|
||||
ascending: def.ascending
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user