Skip to content

Commit

Permalink
[balrog-ui] Merge pull request #11 from bhearsum/linkify-mappings
Browse files Browse the repository at this point in the history
bug 1109071: Linkify mapping to populated search of releases page. r=peterbe
  • Loading branch information
Ben Hearsum committed Dec 18, 2015
2 parents bc1f19e + 938427d commit c052356
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
1 change: 0 additions & 1 deletion ui/app/js/controllers/release_data_controller.js
@@ -1,6 +1,5 @@
angular.module('app').controller('ReleaseDataCtrl',
function($scope, $http, $modalInstance, Releases, Rules, release, diff) {

$scope.release = release;
$scope.diff = diff;

Expand Down
31 changes: 30 additions & 1 deletion ui/app/js/controllers/rules_controller.js
@@ -1,5 +1,5 @@
angular.module("app").controller('RulesController',
function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $route) {
function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $route, Releases) {

$scope.loading = true;
$scope.failed = false;
Expand Down Expand Up @@ -228,4 +228,33 @@ function($scope, $routeParams, $location, $timeout, Rules, Search, $modal, $rout
};
/* End openDeleteModal */

$scope.openReleaseDataModal = function(mapping) {
Releases.getRelease(mapping)
.success(function(response) {
// it's the same rule, but this works
var modalInstance = $modal.open({
templateUrl: 'release_data_modal.html',
controller: 'ReleaseDataCtrl',
size: 'lg',
resolve: {
release: function () {
return response;
},
diff: function() {
return false;
}
}
});
})
.error(function() {
console.error(arguments);
$scope.failed = true;
})
.finally(function() {
$scope.loading = false;
});
};
/* End openDataModal */


});
12 changes: 11 additions & 1 deletion ui/app/templates/rules.html
Expand Up @@ -84,7 +84,17 @@ <h3 class="panel-title">
<div class="left" style="float: left">

<h5 title="Mapping">
Mapping: <b ng-bind-html="highlightSearch(rule.mapping, 'mapping')"></b>
Mapping: <span ng-show="rule.mapping">
<b ng-bind-html="highlightSearch(rule.mapping, 'mapping')"></b>
<a class="btn btn-default btn-xs" href="" ng-click="openReleaseDataModal(rule.mapping)">
<i class="glyphicon glyphicon-eye-open"></i>
View
</a>
<a class="btn btn-default btn-xs" href="/releases/#{{ rule.mapping }}">
<i class="glyphicon glyphicon-pencil"></i>
Edit
</a>
</span>
</h5>
<h5 title="Data version">
Data version: <b>{{ rule.data_version }}</b>
Expand Down
6 changes: 3 additions & 3 deletions ui/dist/js/app.js

Large diffs are not rendered by default.

0 comments on commit c052356

Please sign in to comment.