mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1873] Remove all deprecated code from ADF (#4145)
* remove deprecated code part 1 * remove deprecation step 2 * fix spellcheck * fix * fix lint * fix not used import * remove deprecation * fix test first part after remove deprecation * fix test * fix sidebar demo shell
This commit is contained in:
@@ -29,7 +29,7 @@ import {
|
||||
ViewChild,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { NodePaging, QueryBody } from '@alfresco/js-api';
|
||||
import { NodePaging } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
|
||||
@@ -64,10 +64,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
|
||||
@Input()
|
||||
skipResults: number = 0;
|
||||
|
||||
/** @deprecated in 2.1.0 */
|
||||
@Input()
|
||||
queryBody: QueryBody;
|
||||
|
||||
/** Search term to use when executing the search. Updating this value will
|
||||
* run a new search and update the results.
|
||||
*/
|
||||
@@ -129,10 +125,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if (changes.queryBody &&
|
||||
this.hasDifferentQueryBody(changes.queryBody.previousValue, changes.queryBody.currentValue)) {
|
||||
this.loadSearchResults();
|
||||
}
|
||||
if (changes.searchTerm && changes.searchTerm.currentValue) {
|
||||
this.loadSearchResults(changes.searchTerm.currentValue);
|
||||
}
|
||||
@@ -147,10 +139,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
|
||||
this.loadSearchResults(this.searchTerm);
|
||||
}
|
||||
|
||||
private hasDifferentQueryBody(previousQueryBody: QueryBody, currentQueryBody: QueryBody) {
|
||||
return JSON.stringify(previousQueryBody) !== JSON.stringify(currentQueryBody);
|
||||
}
|
||||
|
||||
private cleanResults() {
|
||||
if (this.results) {
|
||||
this.results = {};
|
||||
@@ -160,17 +148,10 @@ export class SearchComponent implements AfterContentInit, OnChanges {
|
||||
private loadSearchResults(searchTerm?: string) {
|
||||
this.resetResults();
|
||||
if (searchTerm) {
|
||||
if (this.queryBody) {
|
||||
this.searchService.searchByQueryBody(this.queryBody).subscribe(
|
||||
(result) => this.onSearchDataLoaded(result),
|
||||
(err) => this.onSearchDataError(err)
|
||||
);
|
||||
} else {
|
||||
this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
|
||||
(result) => this.onSearchDataLoaded(result),
|
||||
(err) => this.onSearchDataError(err)
|
||||
);
|
||||
}
|
||||
this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
|
||||
(result) => this.onSearchDataLoaded(result),
|
||||
(err) => this.onSearchDataError(err)
|
||||
);
|
||||
} else {
|
||||
this.cleanResults();
|
||||
}
|
||||
|
Reference in New Issue
Block a user