diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-22 22:52:09 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-22 22:52:09 +0100 |
commit | b83c4eed1a75e9e68279ab6f84cd7b5eb602abec (patch) | |
tree | 0a1a24ba310fa53e793db3bb298536a81b01f3c3 /src/main/resources/webapp | |
parent | 498fd62e043e31bf5beddfff0e9b5f7f889b884c (diff) | |
download | esper-testing-b83c4eed1a75e9e68279ab6f84cd7b5eb602abec.tar.gz esper-testing-b83c4eed1a75e9e68279ab6f84cd7b5eb602abec.tar.bz2 esper-testing-b83c4eed1a75e9e68279ab6f84cd7b5eb602abec.tar.xz esper-testing-b83c4eed1a75e9e68279ab6f84cd7b5eb602abec.zip |
NavbarService:
o Storing the current tab with $location.search.
JenkinsApp:
o Implementing job search.
Diffstat (limited to 'src/main/resources/webapp')
3 files changed, 20 insertions, 9 deletions
diff --git a/src/main/resources/webapp/apps/core/PagingTableService.js b/src/main/resources/webapp/apps/core/PagingTableService.js index 802c0c8..61446a6 100755 --- a/src/main/resources/webapp/apps/core/PagingTableService.js +++ b/src/main/resources/webapp/apps/core/PagingTableService.js @@ -156,7 +156,7 @@ function PagingTableService() { console.log("Fetching page. args =", args); Resource.query(args, function(data, headers) { var totalResults = headers("total-results"); - console.log("Total results =", totalResults, "Data =", data); + console.log("Total results =", totalResults, "data.length =", data.length, "Data =", data); cb({ totalResults: totalResults, rows: data 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"> |