Commit 1f03b1ae by Vishal Kadam

Vishal: Beautified

parent 3bf027b7
...@@ -27,7 +27,7 @@ angular.module('dgc.details').controller('DetailsController', ['$scope', '$state ...@@ -27,7 +27,7 @@ angular.module('dgc.details').controller('DetailsController', ['$scope', '$state
$scope.details = data; $scope.details = data;
$scope.tableName = data.values.name; $scope.tableName = data.values.name;
}); });
$scope.isString = angular.isString; $scope.isString = angular.isString;
$scope.schemas = DetailsResource.get({ $scope.schemas = DetailsResource.get({
......
...@@ -133,4 +133,4 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -133,4 +133,4 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
} }
} }
]); ]);
\ No newline at end of file
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource', angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource',
function($scope, NavigationResource) { function($scope, NavigationResource) {
$scope.leftnav= NavigationResource.get(); $scope.leftnav = NavigationResource.get();
$scope.updateVar = function(event) { $scope.updateVar = function(event) {
$scope.$$prevSibling.query = angular.element(event.target).text(); $scope.$$prevSibling.query = angular.element(event.target).text();
}; };
} }
]); ]);
\ No newline at end of file
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
'use strict'; 'use strict';
angular.module('dgc.navigation',[]); angular.module('dgc.navigation', []);
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource) { angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource) {
return $resource('api/metadata/types?type=TRAIT', {}, { return $resource('api/metadata/types?type=TRAIT', {}, {
get: { get: {
'method': 'GET', 'method': 'GET',
'responseType': 'json', 'responseType': 'json',
'isArray': true, 'isArray': true,
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
angular.module('dgc.search').controller('SearchController', ['$scope', '$location', '$http', '$state', '$stateParams', 'SearchResource', 'NotificationService', angular.module('dgc.search').controller('SearchController', ['$scope', '$location', '$http', '$state', '$stateParams', 'SearchResource', 'NotificationService',
function($scope, $location, $http, $state, $stateParams, SearchResource, NotificationService) { function($scope, $location, $http, $state, $stateParams, SearchResource, NotificationService) {
$scope.types = ['table','column','db','view','loadprocess','storagedesc']; $scope.types = ['table', 'column', 'db', 'view', 'loadprocess', 'storagedesc'];
$scope.results = []; $scope.results = [];
$scope.resultCount=0; $scope.resultCount = 0;
$scope.isCollapsed = true; $scope.isCollapsed = true;
$scope.currentPage = 1; $scope.currentPage = 1;
$scope.itemsPerPage = 10; $scope.itemsPerPage = 10;
...@@ -31,15 +31,17 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -31,15 +31,17 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.filteredResults = []; $scope.filteredResults = [];
$scope.resultRows = []; $scope.resultRows = [];
$scope.setPage = function (pageNo) { $scope.setPage = function(pageNo) {
$scope.currentPage = pageNo; $scope.currentPage = pageNo;
}; };
$scope.search = function(query) { $scope.search = function(query) {
$scope.results = []; $scope.results = [];
NotificationService.reset(); NotificationService.reset();
$scope.limit = 4; $scope.limit = 4;
SearchResource.search({query:query}, function searchSuccess(response) { SearchResource.search({
$scope.resultCount=response.count; query: query
}, function searchSuccess(response) {
$scope.resultCount = response.count;
$scope.results = response.results; $scope.results = response.results;
$scope.resultRows = $scope.results.rows; $scope.resultRows = $scope.results.rows;
$scope.totalItems = $scope.resultCount; $scope.totalItems = $scope.resultCount;
...@@ -50,21 +52,23 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -50,21 +52,23 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
if ($scope.searchTypesAvailable) { if ($scope.searchTypesAvailable) {
$scope.searchMessage = 'loading results...'; $scope.searchMessage = 'loading results...';
$scope.filteredResults = $scope.resultRows.slice(begin, end); $scope.filteredResults = $scope.resultRows.slice(begin, end);
$scope.pageCount = function () { $scope.pageCount = function() {
return Math.ceil($scope.resultCount / $scope.itemsPerPage); return Math.ceil($scope.resultCount / $scope.itemsPerPage);
}; };
if ($scope.results.rows) if ($scope.results.rows)
$scope.searchMessage = $scope.results.rows.length +' results matching your search query '+ $scope.query +' were found'; $scope.searchMessage = $scope.results.rows.length + ' results matching your search query ' + $scope.query + ' were found';
else else
$scope.searchMessage = '0 results matching your search query '+ $scope.query +' were found'; $scope.searchMessage = '0 results matching your search query ' + $scope.query + ' were found';
if ($scope.results.length < 1) { if ($scope.results.length < 1) {
NotificationService.error('No Result found', false); NotificationService.error('No Result found', false);
} }
} else { } else {
$scope.searchMessage = '0 results matching your search query '+ $scope.query +' were found'; $scope.searchMessage = '0 results matching your search query ' + $scope.query + ' were found';
} }
}); });
$state.go('search.results', {query:query}, { $state.go('search.results', {
query: query
}, {
location: 'replace' location: 'replace'
}); });
...@@ -75,18 +79,18 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -75,18 +79,18 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
$scope.typeAvailable = function() { $scope.typeAvailable = function() {
if($scope.results.dataType) { if ($scope.results.dataType) {
return $scope.types.indexOf($scope.results.dataType.typeName && $scope.results.dataType.typeName.toLowerCase()) > -1; return $scope.types.indexOf($scope.results.dataType.typeName && $scope.results.dataType.typeName.toLowerCase()) > -1;
} }
}; };
$scope.doToggle = function($event,el) { $scope.doToggle = function($event, el) {
this.isCollapsed = !el; this.isCollapsed = !el;
}; };
$scope.filterSearchResults = function(items) { $scope.filterSearchResults = function(items) {
var res = {}; var res = {};
var count = 0; var count = 0;
angular.forEach(items, function(value, key) { angular.forEach(items, function(value, key) {
if(typeof value !== 'object') { if (typeof value !== 'object') {
res[key] = value; res[key] = value;
count++; count++;
} }
...@@ -96,10 +100,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -96,10 +100,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
return res; return res;
}; };
$scope.searchQuery = $location.search(); $scope.searchQuery = $location.search();
$scope.query=($location.search()).query; $scope.query = ($location.search()).query;
if ($scope.query) { if ($scope.query) {
$scope.searchMessage = 'searching...'; $scope.searchMessage = 'searching...';
$scope.search($scope.query); $scope.search($scope.query);
} }
} }
]); ]);
\ No newline at end of file
...@@ -30,6 +30,6 @@ angular.module('dgc.search').config(['$stateProvider', ...@@ -30,6 +30,6 @@ angular.module('dgc.search').config(['$stateProvider',
url: '?query', url: '?query',
templateUrl: '/modules/search/views/searchResult.html', templateUrl: '/modules/search/views/searchResult.html',
controller: 'SearchController' controller: 'SearchController'
}); });
} }
]); ]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment