Commit dca3e290 by Anders Båtstrand Committed by Johannes Edmeier

Display version for groups in application list

Display the version for groups. For multiple versions the lowest (by lexical compare) gets chosen and a ellipsis is appended. closes #312
parent d322b0a4
......@@ -71,7 +71,7 @@ module.run(function ($rootScope, $state, Notification, Application, ApplicationG
var applicationGroups = new ApplicationGroups();
$rootScope.applicationGroups = applicationGroups;
var refresh = function (application) {
var refresh = function (group, application) {
application.info = {};
application.refreshing = true;
application.getInfo().then(function (response) {
......@@ -81,6 +81,12 @@ module.run(function ($rootScope, $state, Notification, Application, ApplicationG
if (info.build && info.build.version) {
application.version = info.build.version;
}
if (application.version) {
group.versionsCounter[application.version] = (group.versionsCounter[application.version] || 0) + 1;
var versions = Object.keys(group.versionsCounter);
versions.sort;
group.version = versions[0] + (versions.length > 1 ? ', ...' : '');
}
application.info = info;
}).finally(function () {
application.refreshing = false;
......@@ -89,8 +95,8 @@ module.run(function ($rootScope, $state, Notification, Application, ApplicationG
Application.query(function (applications) {
for (var i = 0; i < applications.length; i++) {
refresh(applications[i]);
applicationGroups.addApplication(applications[i]);
var group = applicationGroups.addApplication(applications[i]);
refresh(group, applications[i]);
}
});
......
......@@ -59,8 +59,8 @@ module.exports = function () {
};
this.addApplication = function (application, overwrite) {
var groupIdx = findGroup(this.groups,application.name);
var group = groupIdx > -1 ? this.groups[groupIdx] : { applications: [], statusCounter: {}, name: application.name, status: 'UNKNOWN' };
var groupIdx = findGroup(this.groups, application.name);
var group = groupIdx > -1 ? this.groups[groupIdx] : { applications: [], statusCounter: {}, versionsCounter: [], name: application.name, status: 'UNKNOWN' };
if (groupIdx === -1) {
this.groups.push(group);
}
......@@ -71,10 +71,11 @@ module.exports = function () {
group.applications[index] = application;
}
updateStatus(group);
return group;
};
this.removeApplication = function (application) {
var groupIdx = findGroup(this.groups,application.name);
var groupIdx = findGroup(this.groups, application.name);
if (groupIdx > -1) {
var group = this.groups[groupIdx];
var index = findApplication(group.applications, application);
......
......@@ -26,12 +26,13 @@
<tr ng-repeat-start="group in applicationGroups.groups|orderBy:order.column:order.descending|orderBy:'status':false|filter:searchFilter track by group.name"
ng-init="group.collapsed = group.applications.length > 1 && !expandAll" ng-show="group.collapsed">
<td class="group-column" ng-click="group.collapsed = false"><i class="fa fa-plus"></i></td>
<td colspan="3" ng-bind="group.name"></td>
<td>
<td ng-bind="group.name"></td>
<td><span ng-bind="group.version"></span></td>
<td></td>
<td colspan="2">
<span ng-repeat-start="(status, count) in group.statusCounter track by status" class="status-{{status}}" ng-bind="count + ' ' + status"></span>
<span ng-repeat-end ng-hide="$last"> / </span>
</td>
<th colspan="2"></th>
</tr>
<tr ng-hide="group.collapsed" ng-repeat="application in filteredApps = (group.applications|orderBy:order.column:order.descending|orderBy:'statusInfo.status':false|filter:searchFilter) track by application.id"
ng-init="views = viewsForApplication(application)" ng-repeat-end>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment