GUAC-933 Cleaned up history entry display logic a bit.

This commit is contained in:
James Muehlner
2014-12-10 08:48:54 -08:00
parent 3c55e97abe
commit ed96f27603
2 changed files with 7 additions and 5 deletions

View File

@@ -97,9 +97,11 @@ THE SOFTWARE.
<tr ng-repeat="wrapper in historyEntryWrappers">
<td class="username">{{wrapper.entry.username}}</td>
<td class="start">{{wrapper.entry.startDate | date:'short'}}</td>
<td ng-show="wrapper.entry.endDate && !wrapper.entry.active" class="duration">{{'manage.edit.connection.history.formattedDuration' | translate:"{VALUE: wrapper.duration.value, UNIT: wrapper.duration.unit}"}}</td>
<td ng-show="!wrapper.entry.endDate && !wrapper.entry.active" class="duration">{{'manage.edit.connection.history.unknownEnd' | translate}}</td>
<td ng-show="wrapper.entry.active" class="duration">{{'manage.edit.connection.history.activeNow' | translate}}</td>
<td class="duration">
<span ng-show="wrapper.duration">{{'manage.edit.connection.history.formattedDuration' | translate:"{VALUE: wrapper.duration.value, UNIT: wrapper.duration.unit}"}}</span>
<span ng-show="wrapper.entry.active">{{'manage.edit.connection.history.activeNow' | translate}}</span>
<span ng-show="!wrapper.entry.active &amp;&amp; !wrapper.duration">{{'manage.edit.connection.history.unknownEnd' | translate}}</span>
</td>
</tr>
</tbody>
</table>

View File

@@ -103,8 +103,8 @@ angular.module('manage').factory('HistoryEntryWrapper', [function defineHistoryE
*/
this.duration = null;
// Set the duration if the necessary information is present
if (historyEntry.endDate && historyEntry.startDate)
// Set the duration if the necessary information is present and the entry is not still active
if (historyEntry.endDate && historyEntry.startDate && !historyEntry.active)
this.duration = formatMilliseconds(historyEntry.endDate - historyEntry.startDate);
};