Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #801 from satishc1/master
Browse files Browse the repository at this point in the history
Replace collectorName with collectorNiceName in build detail widget. …
  • Loading branch information
amitmawkin committed Sep 9, 2016
2 parents d4f98a3 + 88f1a3b commit ccf01b6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
6 changes: 3 additions & 3 deletions UI/src/components/widgets/build/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<div class="col-md-3 build-time">
<span>{{::detail.build.endTime | date:'MMM d, HH:mm:ss'}}</span>
</div>
<div class="col-md-3 build-duration">
<div class="col-md-2 build-duration">
<span>Duration: {{::detail.build.duration | duration}}</span>
</div>
<div class="col-md-3 view-in-tool">
<div class="col-md-4 view-in-tool">
<a ng-href="{{::detail.build.buildUrl}}" target="_blank">
View in {{::detail.collectorName}} <span class="fa fa-angle-right"></span>
View in {{detail.buildUrlNiceName()}} <span class="fa fa-angle-right"></span>
</a>
</div>
</div>
Expand Down
20 changes: 18 additions & 2 deletions UI/src/components/widgets/build/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,32 @@
.module(HygieiaConfig.module)
.controller('BuildWidgetDetailController', BuildWidgetDetailController);

BuildWidgetDetailController.$inject = ['$scope', '$modalInstance', 'build', 'collectorName'];
function BuildWidgetDetailController($scope, $modalInstance, build, collectorName) {
BuildWidgetDetailController.$inject = ['$scope', '$modalInstance', 'build', 'collectorName', 'collectorNiceName'];
function BuildWidgetDetailController($scope, $modalInstance, build, collectorName, collectorNiceName) {
var ctrl = this;

ctrl.build = build;
ctrl.collectorName = collectorName;
ctrl.collectorNiceName = collectorNiceName;

ctrl.buildUrlNiceName = buildUrlNiceName;
ctrl.buildPassed = buildPassed;
ctrl.close = close;

function buildUrlNiceName() {
if (!isEmpty(collectorNiceName)) {
return collectorNiceName;
} else {
return collectorName;
}
}

function isEmpty(str) {
//!str returns true for uninitialized, null and empty strings
//the test checks if the string only contains whitespaces and returns true.
return !str || /^[\s]*$/.test(str);
}

function buildPassed() {
return ctrl.build.buildStatus === 'Success';
}
Expand Down
3 changes: 3 additions & 0 deletions UI/src/components/widgets/build/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
},
collectorName: function () {
return $scope.dashboard.application.components[0].collectorItems.Build[0].collector.name;
},
collectorNiceName: function () {
return $scope.dashboard.application.components[0].collectorItems.Build[0].niceName;
}
}
});
Expand Down

0 comments on commit ccf01b6

Please sign in to comment.