Commit 915b4ac6 by Vishal Kadam

Vishal: Added details page

parent 15f61140
{ {
"name": "dgc-metadata", "name": "dgc-metadata",
"description": "DGC Metadata", "description": "DGC Metadata",
"version": "1.0.0-SNAPSHOT", "version": "1.0.0-SNAPSHOT",
"dependencies": { "dependencies": {
"angular": "1.2.15", "angular": "~1.2.15",
"angular-resource": "1.2.15", "angular-resource": "~1.2.15",
"angular-cookies": "1.2.15", "angular-cookies": "~1.2.15",
"angular-route": "1.2.15", "angular-route": "~1.2.15",
"angular-sanitize": "1.2.15", "angular-sanitize": "~1.2.15",
"bootstrap": "~3.1.1", "bootstrap": "~3.1.1",
"angular-bootstrap": "~0.12.0", "angular-bootstrap": "~0.12.0",
"angular-ui-router": "~0.2.13", "angular-ui-router": "~0.2.13",
"lodash": "~3.0.0", "lodash": "~3.0.0",
"angular-ui-utils": "~0.1.1", "angular-ui-utils": "~0.1.1",
"font-awesome": "~4.2.0" "font-awesome": "~4.2.0"
} }
} }
...@@ -83,7 +83,7 @@ module.exports = function(grunt) { ...@@ -83,7 +83,7 @@ module.exports = function(grunt) {
require('load-grunt-tasks')(grunt); require('load-grunt-tasks')(grunt);
//Default task(s). //Default task(s).
grunt.registerTask('default', ['bower', 'jsbeautifier:default']); grunt.registerTask('default', ['bower', 'jshint', 'jsbeautifier:default']);
// Server task // Server task
grunt.registerTask('server', ['bower', 'jshint', 'concurrent']); grunt.registerTask('server', ['bower', 'jshint', 'concurrent']);
......
{ {
"name": "dgc-metadata", "name": "dgc-metadata",
"description": "DGC Metadata", "description": "DGC Metadata",
"version": "1.0.0-SNAPSHOT", "version": "1.0.0-SNAPSHOT",
"private": true, "private": true,
"bin": "server.js", "bin": "server.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/hortonworks/metadata" "url": "https://github.com/hortonworks/metadata"
}, },
"engines": { "engines": {
"node": "0.10.x", "node": "0.10.x",
"npm": "1.3.x" "npm": "1.3.x"
}, },
"keywords": [ "keywords": [
"DGC", "DGC",
"HortonWorks" "HortonWorks"
], ],
"scripts": { "scripts": {
"postinstall": "node node_modules/bower/bin/bower install" "postinstall": "node node_modules/bower/bin/bower install"
}, },
"dependencies": { "dependencies": {
"body-parser": "^1.2.0", "body-parser": "^1.2.0",
"bower": "~1.3.1", "bower": "~1.3.1",
"compression": "^1.0.2", "compression": "^1.0.2",
"consolidate": "~0.10.0", "consolidate": "~0.10.0",
"cookie-parser": "^1.0.1", "cookie-parser": "^1.0.1",
"cookies": "~0.4.0", "cookies": "~0.4.0",
"express": "~4.2.0", "express": "~4.2.0",
"express-load": "^1.1.14", "express-load": "^1.1.14",
"forever": "~0.11.1", "forever": "~0.11.1",
"lodash": "~2.4.1", "lodash": "~2.4.1",
"method-override": "^1.0.0", "method-override": "^1.0.0",
"morgan": "^1.0.1", "morgan": "^1.0.1",
"path-extra": "~0.1.1", "path-extra": "~0.1.1",
"proxit": "^0.6.0", "proxit": "^0.6.0",
"q": "~1.0.1", "q": "~1.0.1",
"rc": "~0.3.4", "rc": "~0.3.4",
"serve-favicon": "^2.0.0", "serve-favicon": "^2.0.0",
"static-favicon": "^2.0.0-alpha", "static-favicon": "^2.0.0-alpha",
"superagent": "^0.20.0", "superagent": "^0.20.0",
"swig": "~1.3.2", "swig": "~1.3.2",
"view-helpers": "~0.1.4" "view-helpers": "~0.1.4"
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.2", "grunt": "~0.4.2",
"grunt-bower-task": "~0.4.0", "grunt-bower-task": "~0.4.0",
"grunt-cli": "~0.1.11", "grunt-cli": "~0.1.11",
"grunt-concurrent": "0.4.3", "grunt-concurrent": "0.4.3",
"grunt-contrib-jshint": "0.9.2", "grunt-contrib-jshint": "0.9.2",
"grunt-contrib-watch": "0.6.0", "grunt-contrib-watch": "0.6.0",
"grunt-jsbeautifier": "~0.2.6", "grunt-jsbeautifier": "~0.2.6",
"grunt-nodemon": "0.2.0", "grunt-nodemon": "0.2.0",
"load-grunt-tasks": "^2.0.0" "load-grunt-tasks": "^2.0.0"
} }
} }
...@@ -6,7 +6,8 @@ angular.module('dgc', ['ngCookies', ...@@ -6,7 +6,8 @@ angular.module('dgc', ['ngCookies',
'ui.router', 'ui.router',
'dgc.system', 'dgc.system',
'dgc.home', 'dgc.home',
'dgc.search' 'dgc.search',
'dgc.details'
]); ]);
angular.module('dgc.system', ['dgc.system.notification']); angular.module('dgc.system', ['dgc.system.notification']);
......
'use strict'; 'use strict';
//Setting up route //Setting up route
angular.module('dgc').config(['$locationProvider', '$urlRouterProvider', function($locationProvider, $urlRouterProvider) { angular.module('dgc').config(['$locationProvider', '$urlRouterProvider',
$locationProvider.hashPrefix('!'); function($locationProvider, $urlRouterProvider) {
// For unmatched routes: $locationProvider.hashPrefix('!');
$urlRouterProvider.otherwise('/'); // For unmatched routes:
$urlRouterProvider.when('/', '/search'); $urlRouterProvider.otherwise('/search');
}]); }
\ No newline at end of file ]);
'use strict';
angular.module('dgc.details').controller('DetailsController', ['$scope', '$stateParams', 'DetailsResource',
function($scope, $stateParams, DetailsResource) {
$scope.details = DetailsResource.get({
id: $stateParams.id
});
$scope.isString = angular.isString;
}
]);
'use strict';
angular.module('dgc.details', []);
'use strict';
angular.module('dgc.details').factory('DetailsResource', ['$resource', function($resource) {
return $resource('/api/metadata/entities/definition/:id', {}, {
get: {
method: 'GET',
transformResponse: function(data) {
if (data) {
return angular.fromJson(data.definition);
}
},
responseType: 'json'
}
});
}]);
'use strict';
angular.module('dgc.details').config(['$stateProvider',
function($stateProvider) {
// states for my app
$stateProvider.state('details', {
url: '/details/:id',
templateUrl: '/modules/details/views/details.html'
});
}
]);
<h4>{{key}}:</h4>
<p>{{value}}</p>
\ No newline at end of file
<div class="container" data-ng-controller="DetailsController">
<div class="col-lg-12">
<tabset>
<tab data-heading="Wiki">
<div data-ng-repeat="(key,value) in details" data-ng-if="isString(value)" ng-include="'/modules/details/views/attribute.html'"></div>
</tab>
<tab data-heading="Raw">
<pre>{{details | json}}</pre>
</tab>
<tab data-heading="Lineage">Graph will be here soon...</tab>
</tabset>
</div>
</div>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
angular.module('dgc.home').controller('HeaderController', ['$scope', function($scope) { angular.module('dgc.home').controller('HeaderController', ['$scope', function($scope) {
$scope.menu = [{'state': 'search', 'title': 'Search'}]; $scope.menu = [];
$scope.isCollapsed = true; $scope.isCollapsed = true;
$scope.isLoggedIn = function() { $scope.isLoggedIn = function() {
......
'use strict'; 'use strict';
angular.module('dgc.home', ['dgc.home.routes']); angular.module('dgc.home', ['dgc.home.routes']);
\ No newline at end of file
...@@ -10,4 +10,4 @@ angular.module('dgc.home.routes', []).config(['$stateProvider', ...@@ -10,4 +10,4 @@ angular.module('dgc.home.routes', []).config(['$stateProvider',
templateUrl: '/modules/home/views/home.html' templateUrl: '/modules/home/views/home.html'
}); });
} }
]); ]);
\ No newline at end of file
...@@ -9,4 +9,4 @@ angular.module('dgc.system.notification', ['ui.router']).constant('ColorCoding', ...@@ -9,4 +9,4 @@ angular.module('dgc.system.notification', ['ui.router']).constant('ColorCoding',
NotificationService.reset(); NotificationService.reset();
} }
}); });
}); });
\ No newline at end of file
...@@ -20,7 +20,9 @@ angular.module('dgc.system.notification').service('NotificationService', ['$time ...@@ -20,7 +20,9 @@ angular.module('dgc.system.notification').service('NotificationService', ['$time
service[key] = function(message) { service[key] = function(message) {
var notification = message; var notification = message;
if (_.isString(message)) { if (_.isString(message)) {
notification = {message: message}; notification = {
message: message
};
} }
notification.message = notification.msg || notification.message; notification.message = notification.msg || notification.message;
......
'use strict'; 'use strict';
angular.module('dgc.search').controller('SearchController', ['$scope', function($scope) { angular.module('dgc.search').controller('SearchController', ['$scope', '$state', '$stateParams', 'SearchResource', 'DetailsResource',
function($scope, $state, $stateParams, SearchResource, DetailsResource) {
$scope.types = []; $scope.types = ['hive_table', 'hive_database'];
$scope.results = [];
$scope.search = function(query) {
SearchResource.get({
query: query
}, function(response) {
$scope.results = [];
angular.forEach(response.list, function(typeId) {
DetailsResource.get({
id: typeId
}, function(definition) {
$scope.results.push(definition);
});
});
$state.go('search.results', {
query: query
});
});
};
}]); $scope.query = $stateParams.query;
if ($scope.query) {
$scope.search($stateParams.query);
}
}
]);
'use strict'; 'use strict';
angular.module('dgc.search', ['dgc.search.routes']); angular.module('dgc.search', ['dgc.details']);
\ No newline at end of file
'use strict';
angular.module('dgc.search').factory('SearchResource', ['$resource', function($resource) {
return $resource('/api/metadata/entities/list/:query', {
'query': '@id'
});
}]);
'use strict'; 'use strict';
//Setting up route //Setting up route
angular.module('dgc.search.routes', []).config(['$stateProvider', angular.module('dgc.search').config(['$stateProvider',
function($stateProvider) { function($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'
}).state('search.results', {
url: '/:query',
templateUrl: '/modules/search/views/searchResult.html'
}); });
} }
]); ]);
\ No newline at end of file
<div class="container" data-ng-controller="SearchController"> <div class="container" data-ng-controller="SearchController">
<div class="row"> <form name="form" novalidate>
<div class="col-sm-offset-1 col-lg-5"> <div class="row">
<div class="input-group"> <div class="col-sm-offset-1 col-lg-5">
<input type="text" class="form-control" placeholder="Search"> <div class="input-group">
<span class="input-group-btn"> <input type="text" class="form-control" placeholder="Search" data-ng-model="query" data-typeahead="type for type in types" required/>
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search white "></i></button> <span class="input-group-btn">
</span> <button class="btn btn-default" type="submit" data-ng-disabled="form.$invalid" data-ng-click="search(query)"><i class="glyphicon glyphicon-search white "></i></button>
</span>
</div>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="col-sm-offset-1 col-lg-6">
<div class="col-sm-offset-1 col-lg-6"> <small class="small-txt">Search : hive_table, hive_database</small>
<small class="small-txt">Search : Hive,Table,xxxx</small> </div>
</div>
<div class="row" data-ng-show="results.length > 0">
<div class="col-sm-offset-1 col-lg-11" data-ui-view=""></div>
</div> </div>
</div> </form>
</div> </div>
\ No newline at end of file
<h4>{{query}} results</h4>
<ul class="list-unstyled">
<li ng-repeat="result in results">
<a data-ui-sref="details({id:result.$id$.id})">{{result.description}}</a>
</li>
</ul>
\ No newline at end of file
...@@ -28,8 +28,15 @@ ...@@ -28,8 +28,15 @@
<!-- Search Module --> <!-- Search Module -->
<script type="text/javascript" src="/modules/search/searchModule.js"></script> <script type="text/javascript" src="/modules/search/searchModule.js"></script>
<script type="text/javascript" src="/modules/search/searchRoutes.js"></script> <script type="text/javascript" src="/modules/search/searchRoutes.js"></script>
<script type="text/javascript" src="/modules/search/searchResource.js"></script>
<script type="text/javascript" src="/modules/search/searchController.js"></script> <script type="text/javascript" src="/modules/search/searchController.js"></script>
<!-- Details Module -->
<script type="text/javascript" src="/modules/details/detailsModule.js"></script>
<script type="text/javascript" src="/modules/details/detailsRoutes.js"></script>
<script type="text/javascript" src="/modules/details/detailsResource.js"></script>
<script type="text/javascript" src="/modules/details/detailsController.js"></script>
<!-- Initialize the application --> <!-- Initialize the application -->
<script type="text/javascript" src="js/init.js"></script> <script type="text/javascript" src="js/init.js"></script>
......
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