Add additional columns to search results

Refs #69
This commit is contained in:
Will Abson
2016-05-20 16:38:54 +01:00
parent aaaf728168
commit f97f4ea088
3 changed files with 56 additions and 0 deletions

View File

@@ -4,15 +4,27 @@
<table *ngIf="results" class="mdl-data-table mdl-js-data-table mdl-shadow--2dp full-width">
<thead>
<tr>
<th>
<span class="mdl-data-table__cell--non-numeric"></span>
</th>
<th>
<span class="mdl-data-table__cell--non-numeric">Name</span>
</th>
<th>
<span class="mdl-data-table__cell--non-numeric">Modified by</span>
</th>
<th>
<span class="mdl-data-table__cell--non-numeric">Modified at</span>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="#result of results; #idx = index">
<td><img src="{{getDocumentThumbnailUrl(result)}}" /></td>
<td>{{result.entry.name}}</td>
<td>{{result.entry.modifiedByUser.displayName}}</td>
<td>{{result.entry.modifiedAt}}</td>
</tr>
</tbody>
</table>

View File

@@ -55,6 +55,30 @@ export class AlfrescoSearchComponent {
this.displaySearchResults(this.currentSearchTerm);
}
/**
* Gets content URL for the given node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getContentUrl(node: any): string {
if (this._alfrescoService) {
return this._alfrescoService.getContentUrl(node);
}
return null;
}
/**
* Gets thumbnail URL for the given document node.
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(node: any): string {
if (this._alfrescoService) {
return this._alfrescoService.getDocumentThumbnailUrl(node);
}
return null;
}
/**
* Loads and displays folder content
* @param searchTerm Search query entered by user

View File

@@ -91,6 +91,26 @@ export class AlfrescoService {
.catch(this.handleError);
}
/**
* Get thumbnail URL for the given document node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
getDocumentThumbnailUrl(document: any) {
return this.getContentUrl(document) + '/thumbnails/doclib?c=queue&ph=true&lastModified=1&alf_ticket=' + this.getAlfrescoTicket();
}
/**
* Get content URL for the given node.
* @param document Node to get URL for.
* @returns {string} URL address.
*/
getContentUrl(document: any) {
return this._host +
'/alfresco/service/api/node/workspace/SpacesStore/' +
document.entry.id + '/content';
}
private handleError(error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console