mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -6,6 +6,7 @@
|
||||
"RESULTS": {
|
||||
"SUMMARY": "Found {{numResults}} results for {{searchTerm}}",
|
||||
"NONE": "No results found for {{searchTerm}}",
|
||||
"ERROR": "An error occurred while running the search",
|
||||
"COLUMNS": {
|
||||
"NAME": "Name",
|
||||
"MODIFIED_BY": "Modified by",
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<p *ngIf="searchTerm">
|
||||
<p *ngIf="results.length">{{ 'SEARCH.RESULTS.SUMMARY' | translate:{numResults: results.length, searchTerm: searchTerm} }}</p>
|
||||
<p *ngIf="results.length == 0">{{ 'SEARCH.RESULTS.NONE' | translate:{searchTerm: searchTerm} }}</p>
|
||||
<table *ngIf="searchTerm && results.length" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
|
||||
<p *ngIf="results && results.length">{{ 'SEARCH.RESULTS.SUMMARY' | translate:{numResults: results.length, searchTerm: searchTerm} }}</p>
|
||||
<p *ngIf="results&& results.length == 0">{{ 'SEARCH.RESULTS.NONE' | translate:{searchTerm: searchTerm} }}</p>
|
||||
<table *ngIf="results && results.length && searchTerm" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@@ -28,3 +27,4 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p *ngIf="errorMessage">{{ 'SEARCH.RESULTS.ERROR' | translate:{errorMessage: errorMessage} }}</p>
|
||||
|
@@ -50,7 +50,7 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
{
|
||||
translate.addComponent('node_modules/ng2-alfresco-search');
|
||||
|
||||
this.results = [];
|
||||
this.results = null;
|
||||
if (params) {
|
||||
this.searchTerm = params.get('q');
|
||||
}
|
||||
@@ -97,8 +97,14 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
this._alfrescoService
|
||||
.getLiveSearchResults(searchTerm)
|
||||
.subscribe(
|
||||
results => this.results = results.list.entries,
|
||||
error => this.errorMessage = <any>error
|
||||
results => {
|
||||
this.results = results.list.entries
|
||||
this.errorMessage = null;
|
||||
},
|
||||
error => {
|
||||
this.results = null;
|
||||
this.errorMessage = <any>error;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user