diff options
Diffstat (limited to 'src/main/resources/webapp/apps/jenkinsApp')
-rwxr-xr-x | src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js | 18 | ||||
-rwxr-xr-x | src/main/resources/webapp/apps/jenkinsApp/server.html | 9 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js b/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js index d632aaf..d31b81c 100755 --- a/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js +++ b/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js @@ -1,15 +1,19 @@ 'use strict'; -function NavbarService() { - var create = function(tabs) { - console.log("create", tabs); - var currentIndex = 0; +function NavbarService($location) { + var create = function(name, tabs) { + var keys = _.map(tabs, function(element) { + return element.toLowerCase().replace(' ', '-'); + }); + + var currentKey = $location.search()[name] || ""; + var currentIndex = _.indexOf(keys, currentKey) || 0; var currentTab = tabs[currentIndex]; var onClick = function(tab) { - console.log("onClick", arguments); currentTab = tab; currentIndex = _.indexOf(tabs, tab); + $location.search(name, keys[currentIndex]); }; var selected = function() { @@ -58,9 +62,9 @@ function ServerCtrl($scope, $routeParams, JenkinsServer, JenkinsJob, PagingTable $scope.server = server; }); - $scope.jobs = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsJob, {server: $scope.serverUuid})); + $scope.jobs = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsJob, {server: $scope.serverUuid, orderBy: "display_name"})); - $scope.navbar = NavbarService.create(["Overview", "Jobs", "Recent Builds"]); + $scope.navbar = NavbarService.create("view", ["Overview", "Jobs", "Recent Builds"]); } function JobCtrl($scope, $location, $routeParams, JenkinsJob, JenkinsBuild, PagingTableService) { diff --git a/src/main/resources/webapp/apps/jenkinsApp/server.html b/src/main/resources/webapp/apps/jenkinsApp/server.html index 2a220db..80544b0 100755 --- a/src/main/resources/webapp/apps/jenkinsApp/server.html +++ b/src/main/resources/webapp/apps/jenkinsApp/server.html @@ -57,7 +57,14 @@ <div ng-show="navbar.selectedIndex() == 1" class="row"> <div class="span12"> - <h3>Jobs</h3> + <form class="form-search form-inline well"> + <div class="input-append"> + <input type="text" class="span2 search-query" ng-model="jobs.query" ng-change="jobs.onSearchChange()"> + <button type="submit" class="btn" ng-click="jobs.onSearch()">Search</button> + </div> + </form> + </div> + <div class="span12"> <table class="table"> <tbody> <tr ng-repeat="job in jobs.rows"> |