From 454b67e61e2aeaef5e72938e83420c81b11b0207 Mon Sep 17 00:00:00 2001 From: Nick Reid Date: Wed, 29 Jun 2016 15:56:02 -0700 Subject: [PATCH 1/2] MOTECH-2409 Added statistics to bundles list Added statistics to bundles list, which also meant styling the motech-list header. added unstyled statistics bar for bundles list added dl-inline class moved bundle list into navbar --- src/admin/bundles/bundles-list.controller.js | 37 ++++++++++++++++++++ src/admin/bundles/bundles-list.html | 13 +++++++ src/admin/bundles/bundles.factory.js | 9 +++++ src/common/base/base.scss | 6 ++++ src/common/motech-list/list.base.scss | 4 +++ src/common/navbar.scss | 16 +++++++++ 6 files changed, 85 insertions(+) diff --git a/src/admin/bundles/bundles-list.controller.js b/src/admin/bundles/bundles-list.controller.js index 69f5917..4c1ca6a 100644 --- a/src/admin/bundles/bundles-list.controller.js +++ b/src/admin/bundles/bundles-list.controller.js @@ -6,9 +6,46 @@ bundlesListController.$inject = ['$scope', '$rootScope', 'BundlesFactory']; function bundlesListController ($scope, $rootScope, BundlesFactory) { + $scope.bundles = []; BundlesFactory.query(function(bundles){ $scope.bundles = bundles; }); + + $scope.allBundlesCount = function () { + if ($scope.bundles) { + return $scope.bundles.length; + } else { + return 0; + } + }; + + $scope.activeBundlesCount = function () { + var count = 0; + angular.forEach($scope.bundles, function (bundle) { + count += bundle.isActive() ? 1 : 0; + }); + + return count; + }; + + $scope.installedBundlesCount = function () { + var count = 0; + angular.forEach($scope.bundles, function (bundle) { + count += bundle.isInstalled() ? 1 : 0; + }); + + return count; + }; + + $scope.resolvedBundlesCount = function () { + var count = 0; + angular.forEach($scope.bundles, function (bundle) { + count += bundle.isResolved() ? 1 : 0; + }); + + return count; + }; + } })(); \ No newline at end of file diff --git a/src/admin/bundles/bundles-list.html b/src/admin/bundles/bundles-list.html index 6754f2b..e679b39 100644 --- a/src/admin/bundles/bundles-list.html +++ b/src/admin/bundles/bundles-list.html @@ -1,4 +1,17 @@ + +

{{msg('admin.bundles.statistics')}}

+
+
{{msg('admin.bundles.statistics.total')}}
+
{{allBundlesCount()}}
+
{{msg('admin.bundles.statistics.active')}}
+
{{activeBundlesCount()}}
+
{{msg('admin.bundles.statistics.installed')}}
+
{{installedBundlesCount()}}
+
{{msg('admin.bundles.statistics.resolved')}}
+
{{resolvedBundlesCount()}}
+
+
diff --git a/src/admin/bundles/bundles.factory.js b/src/admin/bundles/bundles.factory.js index 9a442e1..ff53fb7 100644 --- a/src/admin/bundles/bundles.factory.js +++ b/src/admin/bundles/bundles.factory.js @@ -29,6 +29,13 @@ return this.state === "ACTIVE"; }; + Bundle.prototype.isInstalled = function () { + return this.state === 'INSTALLED'; + }; + + Bundle.prototype.isResolved = function () { + return this.state === 'RESOLVED'; + }; function callbackSuccess(){ LoadingModal.close(); @@ -75,6 +82,8 @@ }); }; + + return Bundle; } diff --git a/src/common/base/base.scss b/src/common/base/base.scss index 53e672d..4940e26 100644 --- a/src/common/base/base.scss +++ b/src/common/base/base.scss @@ -50,3 +50,9 @@ h3, h4{ position: relative; padding: 0em 1em; } + +dl{ + dt, dd{ + line-height: 1em; + } +} diff --git a/src/common/motech-list/list.base.scss b/src/common/motech-list/list.base.scss index ee21c47..5aaf7d6 100644 --- a/src/common/motech-list/list.base.scss +++ b/src/common/motech-list/list.base.scss @@ -45,6 +45,10 @@ @extend .clearfix; background-color: $brand-accent; padding: $space-size; + >*{ + @extend .navbar; + border-bottom: 0px; + } .pagination{ @extend .button-group-primary; } diff --git a/src/common/navbar.scss b/src/common/navbar.scss index 1716c4c..260eb6d 100644 --- a/src/common/navbar.scss +++ b/src/common/navbar.scss @@ -24,6 +24,7 @@ Styleguide 5.1 padding: 0em 0.5em; display: block; >*{ + margin-bottom: 0px; margin-right: 1em; float: left; } @@ -53,3 +54,18 @@ nav.navbar, border-bottom-color: transparent; } } + +.navbar dl{ + display: inline-block; + >*{ + display: inline-block; + } + dt:after{ + content: ": "; + white-space: pre; + } + dd:after{ + content: ". "; + white-space: pre; + } +} From ad75acb537e844f433dd9e90163655dde4440601 Mon Sep 17 00:00:00 2001 From: Nick Reid Date: Thu, 14 Jul 2016 14:59:24 -0700 Subject: [PATCH 2/2] MOTECH-2409 Added filter to bundles list Added a filter input to the admin bundles list. --- src/admin/bundles/bundles-list.controller.js | 1 + src/admin/bundles/bundles-list.html | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/admin/bundles/bundles-list.controller.js b/src/admin/bundles/bundles-list.controller.js index 4c1ca6a..46ac6fa 100644 --- a/src/admin/bundles/bundles-list.controller.js +++ b/src/admin/bundles/bundles-list.controller.js @@ -7,6 +7,7 @@ bundlesListController.$inject = ['$scope', '$rootScope', 'BundlesFactory']; function bundlesListController ($scope, $rootScope, BundlesFactory) { $scope.bundles = []; + $scope.search = {}; BundlesFactory.query(function(bundles){ $scope.bundles = bundles; }); diff --git a/src/admin/bundles/bundles-list.html b/src/admin/bundles/bundles-list.html index e679b39..a3e83fb 100644 --- a/src/admin/bundles/bundles-list.html +++ b/src/admin/bundles/bundles-list.html @@ -1,5 +1,11 @@ +
+
+ + +
+

{{msg('admin.bundles.statistics')}}

{{msg('admin.bundles.statistics.total')}}
@@ -12,7 +18,7 @@

{{msg('admin.bundles.statistics')}}

{{resolvedBundlesCount()}}
- +