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