From e653efaa1393bdf511cb8a558d515512bab76811 Mon Sep 17 00:00:00 2001 From: Chris Reid Date: Fri, 17 Nov 2017 07:21:19 -0700 Subject: [PATCH] adding team searching --- index.js | 16 ++++++++++++++++ public/index.html | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ef908ac..be41371 100644 --- a/index.js +++ b/index.js @@ -209,6 +209,22 @@ server.register([ } }); + server.route({ + method: 'GET', + path: '/team/{team}', + handler: { + file: 'public/index.html' + } + }); + + server.route({ + method: 'GET', + path: '/team/{team}/search/{pattern*}', + handler: { + file: 'public/index.html' + } + }); + server.route({ method: 'GET', path: '/e', diff --git a/public/index.html b/public/index.html index f57d573..56dfeae 100644 --- a/public/index.html +++ b/public/index.html @@ -528,8 +528,17 @@ $scope.concourseInfo = jsinfo; } - var pathSearch = $window.location.pathname.split('/').slice(1); - pathSearch = pathSearch[0] === 'search' ? pathSearch.slice(1).join('/') : false; + var windowPath = $window.location.pathname.split('/').slice(1); + var pathTeam; + if (windowPath[0] === 'team') { + windowPath.shift(); // team + pathTeam = windowPath.shift(); + } + var pathSearch; + if (windowPath[0] === 'search') { + windowPath.shift(); // search + pathSearch = windowPath.shift(); + } $scope.getPipes = function() { $http({ method: 'GET', @@ -540,6 +549,11 @@ return item.name.includes(pathSearch); }); } + if (pathTeam) { + response.data = response.data.filter(function(item) { + return item.team_name.includes(pathTeam); + }); + } $scope.setPipes(response.data); }, function(err) { console.error(err);