Skip to content

Commit

Permalink
#223 Fix the search feature using non ASCII chars
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 6, 2017
1 parent de88ee6 commit 7988a55
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion ui/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"saveSvgAsPng": false,
"Blob": false,
"File": false,
"hljs": false
"hljs": false,
"Base64": false
}
}
2 changes: 1 addition & 1 deletion ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
<script src="bower_components/angular-ui-notification/dist/angular-ui-notification.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/c3/c3.js"></script>
<script src="bower_components/angular-base64/angular-base64.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/ng-file-upload/ng-file-upload.js"></script>
<script src="bower_components/ng-file-upload-shim/ng-file-upload-shim.js"></script>
Expand All @@ -106,6 +105,7 @@
<script src="bower_components/angular-base64-upload/src/angular-base64-upload.js"></script>
<script src="bower_components/jquery-ui/jquery-ui.js"></script>
<script src="bower_components/angular-ui-sortable/sortable.js"></script>
<script src="bower_components/js-base64/base64.js"></script>
<!-- endbower -->

<script type="text/javascript" src="bower_components/ace-builds/src-min-noconflict/ace.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ angular.module('theHiveDirectives', []);
angular.module('thehive', ['ngAnimate', 'ngMessages', 'ngSanitize', 'ui.bootstrap', 'ui.router', 'ui.sortable',
'theHiveControllers', 'theHiveServices', 'theHiveFilters',
'theHiveDirectives', 'yaru22.jsonHuman', 'timer', 'angularMoment', 'ngCsv', 'ngTagsInput', 'btford.markdown',
'ngResource', 'ui-notification', 'angularjs-dropdown-multiselect', 'base64', 'angular-clipboard',
'ngResource', 'ui-notification', 'angularjs-dropdown-multiselect', 'angular-clipboard',
'LocalStorageModule', 'angular-markdown-editor', 'hc.marked', 'hljs', 'ui.ace', 'angular-page-loader', 'naif.base64', 'images-resizer'
])
.config(function($resourceProvider) {
Expand Down
4 changes: 2 additions & 2 deletions ui/app/scripts/controllers/RootCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Controller for main page
*/
angular.module('theHiveControllers').controller('RootCtrl',
function($scope, $rootScope, $uibModal, $location, $state, $base64, AuthenticationSrv, AlertingSrv, StreamSrv, StreamStatSrv, TemplateSrv, MetricsCacheSrv, NotificationSrv, AppLayoutSrv, currentUser, appConfig) {
function($scope, $rootScope, $uibModal, $location, $state, AuthenticationSrv, AlertingSrv, StreamSrv, StreamStatSrv, TemplateSrv, MetricsCacheSrv, NotificationSrv, AppLayoutSrv, currentUser, appConfig) {
'use strict';

if(currentUser === 520) {
Expand Down Expand Up @@ -122,7 +122,7 @@ angular.module('theHiveControllers').controller('RootCtrl',
};

$scope.search = function(querystring) {
var query = $base64.encode(angular.toJson({
var query = Base64.encode(angular.toJson({
_string: querystring
}));

Expand Down
4 changes: 2 additions & 2 deletions ui/app/scripts/controllers/SearchCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers')
.controller('SearchCtrl', function($scope, $stateParams, $base64, PSearchSrv, CaseTaskSrv, NotificationSrv, EntitySrv, UserInfoSrv) {
.controller('SearchCtrl', function($scope, $stateParams, PSearchSrv, CaseTaskSrv, NotificationSrv, EntitySrv, UserInfoSrv) {
$scope.filter = {
type: {
values: [
Expand Down Expand Up @@ -42,7 +42,7 @@

$scope.getUserInfo = UserInfoSrv;
$scope.searchResults = PSearchSrv(undefined, 'any', {
'filter': angular.fromJson($base64.decode($stateParams.q)),
'filter': angular.fromJson(Base64.decode($stateParams.q)),
'baseFilter': {_string: '!_type:audit AND !_type:data AND !_type:user AND !_type:analyzer AND !_type:alert AND !_type:case_artifact_job_log AND !status:Deleted'},
'nparent': 10,
skipStream: true
Expand Down
4 changes: 2 additions & 2 deletions ui/app/scripts/directives/charts/donut-chart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function() {
'use strict';
angular.module('theHiveDirectives').directive('donutChart', function(StatSrv, $state, $base64, NotificationSrv) {
angular.module('theHiveDirectives').directive('donutChart', function(StatSrv, $state, NotificationSrv) {
return {
restrict: 'E',
scope: {
Expand Down Expand Up @@ -60,7 +60,7 @@
};

$state.go('app.search', {
q: $base64.encode(angular.toJson(searchQuery))
q: Base64.encode(angular.toJson(searchQuery))
});
}
},
Expand Down
4 changes: 2 additions & 2 deletions ui/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"cryptojslib": "~3.1.2",
"angular-ui-notification": "0.3.6",
"c3": "~0.4.11",
"angular-base64": "~2.0.5",
"css-spaces": "~0.3.5",
"angular-messages": "1.5.8",
"ng-file-upload-shim": "^12.2.5",
Expand All @@ -47,7 +46,8 @@
"angular-page-loader": "*",
"angular-images-resizer": "^2.0.2",
"angular-base64-upload": "^0.1.19",
"angular-ui-sortable": "^0.17.0"
"angular-ui-sortable": "^0.17.0",
"js-base64": "^2.1.9"
},
"devDependencies": {
"angular-mocks": "1.5.8"
Expand Down
2 changes: 1 addition & 1 deletion ui/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module.exports = function(config) {
'bower_components/angular-ui-notification/dist/angular-ui-notification.js',
'bower_components/d3/d3.js',
'bower_components/c3/c3.js',
'bower_components/angular-base64/angular-base64.js',
'bower_components/angular-messages/angular-messages.js',
'bower_components/ng-file-upload/ng-file-upload.js',
'bower_components/ng-file-upload-shim/ng-file-upload-shim.js',
Expand All @@ -68,6 +67,7 @@ module.exports = function(config) {
'bower_components/angular-base64-upload/src/angular-base64-upload.js',
'bower_components/jquery-ui/jquery-ui.js',
'bower_components/angular-ui-sortable/sortable.js',
'bower_components/js-base64/base64.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
"bower_components/cryptojslib/components/core-min.js",
Expand Down

0 comments on commit 7988a55

Please sign in to comment.