Commit 208b2bf1 by babanb Committed by Vishal Kadam

Added known types pages for search

parent ccccd861
...@@ -67,9 +67,7 @@ header.navbar-top { ...@@ -67,9 +67,7 @@ header.navbar-top {
.search { .search {
padding-top: 20px; padding-top: 20px;
background-color: #eeeded;
padding-bottom: 10px; padding-bottom: 10px;
border-bottom: solid 1px #d9d9d8;
} }
header .container { header .container {
......
...@@ -24,7 +24,8 @@ angular.module('dgc', ['ngCookies', ...@@ -24,7 +24,8 @@ angular.module('dgc', ['ngCookies',
'ui.router', 'ui.router',
'dgc.system', 'dgc.system',
'dgc.home', 'dgc.home',
'dgc.search' 'dgc.search',
'dgc.navigation'
]); ]);
angular.module('dgc.system', ['dgc.system.notification']); angular.module('dgc.system', ['dgc.system.notification']);
......
...@@ -24,21 +24,11 @@ angular.module('dgc.details').controller('DetailsController', ['$scope', '$state ...@@ -24,21 +24,11 @@ angular.module('dgc.details').controller('DetailsController', ['$scope', '$state
$scope.details = DetailsResource.get({ $scope.details = DetailsResource.get({
id: $stateParams.id id: $stateParams.id
}); });
$scope.isString = angular.isString; $scope.isString = angular.isString;
//schema
$scope.schemas = DetailsResource.get({ $scope.schemas = DetailsResource.get({
id: $stateParams.id id: $stateParams.id
}); });
} }
]); ]);
...@@ -24,7 +24,7 @@ angular.module('dgc.details').factory('DetailsResource', ['$resource', function( ...@@ -24,7 +24,7 @@ angular.module('dgc.details').factory('DetailsResource', ['$resource', function(
method: 'GET', method: 'GET',
transformResponse: function(data) { transformResponse: function(data) {
if (data) { if (data) {
return angular.fromJson(data.results); return angular.fromJson(data.definition);
} }
}, },
responseType: 'json' responseType: 'json'
......
...@@ -36,4 +36,4 @@ ...@@ -36,4 +36,4 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
\ No newline at end of file
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
<div class="container details" data-ng-controller="DetailsController"> <div class="container details" data-ng-controller="DetailsController">
<div class="col-lg-12"> <div class="col-lg-12">
<h4>Name : {{details.name}}</h4> <h4>{{details.name}}</h4>
<h5>Description : {{details.description}}</h5> <h5>{{details.description}}</h5>
<tabset> <tabset>
<tab heading="Details"> <tab heading="Details">
......
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<div> <div>
<table class="table table-bordered"> <table class="table table-bordered">
<thead> <thead>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a data-ui-sref="home" data-ui-sref-active="active"><img src="modules/home/img/logo-sm.png"/></a> <a data-ui-sref="home" data-ui-sref-active="active"><h1>DGI</h1></a>
</div> </div>
<nav class="collapse navbar-collapse" data-collapse="isCollapsed" data-role="navigation"> <nav class="collapse navbar-collapse" data-collapse="isCollapsed" data-role="navigation">
<ul class="navbar-nav nav" data-ng-if="isLoggedIn()"> <ul class="navbar-nav nav" data-ng-if="isLoggedIn()">
......
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource',
function($scope, NavigationResource) {
$scope.leftnav= NavigationResource.get();
$scope.updateVar = function(event) {
$scope.$$prevSibling.query = angular.element(event.target).text();
};
}
]);
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('dgc.navigation',[]);
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
angular.module('dgc.navigation').factory('NavigationResource', ['$resource', function($resource) {
return $resource('api/metadata/types', {}, {
get: {
'method': 'GET',
'responseType': 'json',
'isArray': true,
'transformResponse': function(data) {
var results = [];
angular.forEach(data && data.results, function(val) {
results.push(val);
});
return results;
}
}
});
}]);
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<div data-ng-controller="NavigationController">
<div class="col-lg-3">
<h4>Tags</h4>
<div class="list-group">
<a ng-repeat="nav in leftnav" ui-sref="search.results({ query: nav })" class="list-group-item">{{nav}} </a>
</div>
</div>
</div>
\ No newline at end of file
...@@ -21,18 +21,20 @@ ...@@ -21,18 +21,20 @@
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 = []; $scope.types = ['table','column','db','view','loadprocess','storagedesc'];
$scope.results = []; $scope.results = [];
$scope.resultCount=0;
$scope.search = function(query) { $scope.search = function(query) {
$scope.results = []; $scope.results = [];
NotificationService.reset(); NotificationService.reset();
SearchResource.search($location.search(query).search(), function searchSuccess(response) { SearchResource.search({query:query}, function searchSuccess(response) {
$scope.results = response; $scope.results = response.results;
$scope.resultCount=response.count;
if ($scope.results.length < 1) { if ($scope.results.length < 1) {
NotificationService.error('No Result found', false); NotificationService.error('No Result found', false);
} }
$state.go('search.results', {}, { $state.go('search.results', {query:query}, {
location: false location: 'replace'
}); });
}, function searchError(err) { }, function searchError(err) {
NotificationService.error('Error occurred during executing search query, error status code = ' + err.status + ', status text = ' + err.statusText, false); NotificationService.error('Error occurred during executing search query, error status code = ' + err.status + ', status text = ' + err.statusText, false);
...@@ -40,11 +42,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -40,11 +42,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
}; };
$scope.typeAvailable = function() { $scope.typeAvailable = function() {
return ['hive_table'].indexOf(this.result.type && this.result.type.toLowerCase()) > -1; return $scope.types.indexOf(this.results.dataType.typeName && this.results.dataType.typeName.toLowerCase()) > -1;
}; };
var urlParts = $location.url().split('?'); $scope.query=$stateParams.query;
$scope.query = urlParts.length > 1 ? urlParts[1] : null;
if ($scope.query) { if ($scope.query) {
$scope.search($scope.query); $scope.search($scope.query);
} }
......
...@@ -19,18 +19,14 @@ ...@@ -19,18 +19,14 @@
'use strict'; 'use strict';
angular.module('dgc.search').factory('SearchResource', ['$resource', function($resource) { angular.module('dgc.search').factory('SearchResource', ['$resource', function($resource) {
return $resource('/api/metadata/discovery/search/fulltext', {}, { return $resource('/api/metadata/discovery/search/', {}, {
search: { search: {
'method': 'GET', 'method': 'GET',
'responseType': 'json', 'responseType': 'json',
'isArray': true,
'transformResponse': function(data) { 'transformResponse': function(data) {
var results = []; return data;
angular.forEach(data && data.vertices, function(val) {
results.push(val);
});
return results;
} }
} }
}); });
}]); }]);
...@@ -25,10 +25,12 @@ angular.module('dgc.search').config(['$stateProvider', ...@@ -25,10 +25,12 @@ angular.module('dgc.search').config(['$stateProvider',
// states for my app // states for my app
$stateProvider.state('search', { $stateProvider.state('search', {
url: '/search', url: '/search',
templateUrl: '/modules/search/views/search.html' templateUrl: '/modules/search/views/search.html',
controller:'SearchController'
}).state('search.results', { }).state('search.results', {
url: '/?', url: '/:query',
templateUrl: '/modules/search/views/searchResult.html' templateUrl: '/modules/search/views/searchResult.html',
controller:'SearchController'
}); });
} }
]); ]);
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div data-ng-controller="SearchController"> <div data-ng-controller="SearchController">
<div class="search"> <div class="search">
<form name="form" novalidate class="container"> <form name="form" novalidate class="container">
<div class="col-lg-7"> <div class="col-lg-7 col-lg-offset-3">
<div class="row input-group"> <div class="row input-group">
<input type="text" class="form-control" placeholder="Search" data-ng-model="query" data-typeahead="type for type in types" required/> <input type="text" class="form-control" placeholder="Search" data-ng-model="query" data-typeahead="type for type in types" required/>
<span class="input-group-btn"> <span class="input-group-btn">
...@@ -29,18 +29,17 @@ ...@@ -29,18 +29,17 @@
</span> </span>
</div> </div>
<div class="row"> <div class="row">
<small class="small-txt">Examples : property=HiveLineage.executionEngine&text=tez</small> <small class="small-txt">search: Table, DB, Column</small>
<br/>
<small class="small-txt">property=type&text=HiveLineage</small>
<br/>
<small class="small-txt">property=type&text=hive_table</small>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-11" data-ui-view=""></div>
<div data-ng-include="'/modules/navigation/views/navigation.html'"></div>
<div class="col-lg-9" data-ui-view=""></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<h4>{{results.length}} results matching your search query "{{query}}" were found</h4> <h4>{{resultCount}} results matching your search query "{{query}}" were found</h4>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li ng-repeat="result in results"> <li ng-repeat="result in results.rows">
<div data-ng-if="typeAvailable()" data-ng-include="'/modules/search/views/types/'+result.type.toLowerCase()+'.html'"></div> <div data-ng-if="typeAvailable()" data-ng-include="'/modules/search/views/types/'+results.dataType.typeName.toLowerCase()+'.html'"></div>
<div data-ng-if="!typeAvailable()" data-ng-include="'/modules/search/views/types/guid.html'"></div> <div data-ng-if="!typeAvailable()" data-ng-include="'/modules/search/views/types/guid.html'"></div>
</li> </li>
</ul> </ul>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<h4><a data-ui-sref="details({id:result['$id$'].id})">{{result.name}}</a></h4>
<p><b>Comment:</b> {{result.comment}}, <b>DataType:</b> {{result.dataType}},<b>Table:</b> {{result.table}}</p>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<h4><a data-ui-sref="details({id:result['$id$'].id})">{{result.name}}</a></h4>
<p>{{result.description}}</p>
<p><b>locationUri:</b> {{result.locationUri}}, <b>Owner: </b>{{result.owner}}</p>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
\ No newline at end of file
...@@ -16,4 +16,6 @@ ...@@ -16,4 +16,6 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<a data-ui-sref="details({id:result.guid})">{{result.guid}}</a> <h4><a data-ui-sref="details({id:result.instanceInfo.guid})">{{result.instanceInfo.guid}}</a></h4>
\ No newline at end of file <p><b>TypeName: </b>{{result.instanceInfo.typeName}}</p>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<h4><a data-ui-sref="details({id:result['$id$'].id})">{{result.name}}</a></h4>
<p>{{result.description}}</p>
<p><b>inputTables: </b>{{result.inputTables['id']}},<b>queryText: </b>{{result.queryText}},<b>startTime: </b>{{result.startTime | date:'medium'}},<b>endTime: </b> {{result.endTime | date:'medium'}}</p>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<h4><a data-ui-sref="details({id:result['$id$'].id})">{{result.name}}</a></h4>
<p><b>compressed: </b>{{result.compressed}},<b>outputFormat: </b>{{result.outputFormat}},<b>location: </b>{{result.location}}, <b>inputFormat: </b>{{result.inputFormat}}</p>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<h4><a data-ui-sref="details({id:result['$id$'].id})">{{result.name}}</a></h4>
<p>{{result.description}}</p>
<p><b>owner: </b>{{result.owner}}, <b>createTime: </b>{{result.createTime}}</p>
<h5>Tags : <a ng-repeat="(key, value) in result['$traits$']" data-ui-sref="search.results({query: key})">{{key}}</a> </h5>
\ No newline at end of file
...@@ -28,7 +28,7 @@ var path = require('path'), ...@@ -28,7 +28,7 @@ var path = require('path'),
config = require('rc')(packageJson.name, { config = require('rc')(packageJson.name, {
app: { app: {
name: packageJson.name, name: packageJson.name,
title: 'DGI | aetna' title: 'DGI'
}, },
nodeEnv: 'local', nodeEnv: 'local',
root: rootPath, root: rootPath,
...@@ -38,7 +38,7 @@ var path = require('path'), ...@@ -38,7 +38,7 @@ var path = require('path'),
verbose: true, verbose: true,
hosts: [{ hosts: [{
routes: { routes: {
'/api': 'http://162.249.6.76:21000/api' '/api': 'http://162.249.6.39:21000/api'
} }
}] }]
} }
......
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