Commit 31e21002 by Vishal Kadam

Type specific views and env variable fix

parent b03dd70a
...@@ -11,7 +11,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -11,7 +11,7 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
SearchResource.search($location.search(query).search(), function(response) { SearchResource.search($location.search(query).search(), function(response) {
$scope.results = response; $scope.results = response;
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', {}, {
location: false location: false
...@@ -19,6 +19,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -19,6 +19,10 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
}); });
}; };
$scope.typeAvailable = function() {
return ['hive_table'].indexOf(this.result.type && this.result.type.toLowerCase()) > -1;
};
var urlParts = $location.url().split('?'); var urlParts = $location.url().split('?');
$scope.query = urlParts.length > 1 ? urlParts[1] : null; $scope.query = urlParts.length > 1 ? urlParts[1] : null;
if ($scope.query) { if ($scope.query) {
......
<h4>"{{query}}" results</h4> <h4>"{{query}}" results</h4>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li ng-repeat="result in results"> <li ng-repeat="result in results">
<ng-include src="'/modules/search/views/'+result.type+'.html'"/> <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/guid.html'"></div>
</li> </li>
</ul> </ul>
\ No newline at end of file
<a data-ui-sref="details({id:result.guid})">{{result.guid}}</a>
\ No newline at end of file
...@@ -13,13 +13,8 @@ var express = require('express'); ...@@ -13,13 +13,8 @@ var express = require('express');
*/ */
// Initializing system variables // Initializing system variables
var config = require('./server/config/config'); var config = require('./server/config/config'),
app = express();
// Load configurations
// Set the node enviornment variable if not set before
process.env.NODE_ENV = config.nodeEnv;
var app = express();
// Express settings // Express settings
require('./server/config/express')(app); require('./server/config/express')(app);
...@@ -28,8 +23,8 @@ require('./server/config/express')(app); ...@@ -28,8 +23,8 @@ require('./server/config/express')(app);
var port = process.env.PORT || config.port; var port = process.env.PORT || config.port;
app.listen(port); app.listen(port);
console.log('Environment is = "' + process.env.NODE_ENV + '"'); console.log('Environment is = "' + config.nodeEnv + '"');
console.log('Express app started on port ' + port + ' using config\n', config); console.log('Express app started on port ' + port + ' using config\n', JSON.stringify(config, null, 4));
// Expose app // Expose app
module.exports = app; module.exports = app;
...@@ -25,5 +25,6 @@ var path = require('path'), ...@@ -25,5 +25,6 @@ var path = require('path'),
}] }]
} }
}); });
// Set the node enviornment variable if not set before
config.nodeEnv = process.env.NODE_ENV = process.env.NODE_ENV || config.nodeEnv;
module.exports = config; module.exports = config;
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