Skip to content

Commit

Permalink
#191 Add a scroll animation when displaying analysis report
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 8, 2017
1 parent a62298a commit 580e05c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<link rel="stylesheet" href="styles/filters.css"/>
<link rel="stylesheet" href="styles/case-item.css"/>
<link rel="stylesheet" href="styles/directives/page-sizer.css"/>
<link rel="stylesheet" href="styles/directives/user.css"/>
<link rel="stylesheet" href="styles/directives/user.css"/>
<!-- endbuild -->

<style>
Expand Down Expand Up @@ -106,6 +106,7 @@
<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>
<script src="bower_components/angular-scroll/angular-scroll.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 @@ -7,7 +7,7 @@ angular.module('thehive', ['ngAnimate', 'ngMessages', 'ngSanitize', 'ui.bootstra
'theHiveControllers', 'theHiveServices', 'theHiveFilters',
'theHiveDirectives', 'yaru22.jsonHuman', 'timer', 'angularMoment', 'ngCsv', 'ngTagsInput', 'btford.markdown',
'ngResource', 'ui-notification', 'angularjs-dropdown-multiselect', 'angular-clipboard',
'LocalStorageModule', 'angular-markdown-editor', 'hc.marked', 'hljs', 'ui.ace', 'angular-page-loader', 'naif.base64', 'images-resizer'
'LocalStorageModule', 'angular-markdown-editor', 'hc.marked', 'hljs', 'ui.ace', 'angular-page-loader', 'naif.base64', 'images-resizer', 'duScroll'
])
.config(function($resourceProvider) {
'use strict';
Expand Down
12 changes: 11 additions & 1 deletion ui/app/scripts/controllers/case/CaseObservablesItemCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module('theHiveControllers').controller('CaseObservablesItemCtrl',
function ($scope, $state, $stateParams, $q, $timeout, CaseTabsSrv, CaseArtifactSrv, CortexSrv, PSearchSrv, AnalyzerSrv, NotificationSrv, VersionSrv, appConfig) {
function ($scope, $state, $stateParams, $q, $timeout, $document, CaseTabsSrv, CaseArtifactSrv, CortexSrv, PSearchSrv, AnalyzerSrv, NotificationSrv, VersionSrv, appConfig) {
var observableId = $stateParams.itemId,
observableName = 'observable-' + observableId;

Expand Down Expand Up @@ -132,6 +132,16 @@
startDate: job.startDate,
endDate: job.endDate
};

$timeout(function() {
var reportEl = angular.element(document.getElementById('analysis-report'))[0];

// Scrolling hack using jQuery stuff
$('html,body').animate({
scrollTop: $(reportEl).offset().top
}, 'fast');
}, 500);

}, function(/*err*/) {
NotificationSrv.log('An expected error occured while fetching the job report');
});
Expand Down
1 change: 1 addition & 0 deletions ui/app/scripts/services/Constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(function() {
'use strict';
angular.module('theHiveServices')
.value('duScrollOffset', 30)
.value('CaseResolutionStatus', {
Indeterminate: 'Indeterminate',
FalsePositive: 'False Positive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h3 class="pv-xxs pr-xxs text-primary">
</div>
</div>

<div class="row">
<div class="row" id="analysis-report">
<div class="col-md-6 col-md-offset-3">
<hr>
</div>
Expand Down
3 changes: 2 additions & 1 deletion ui/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"angular-images-resizer": "^2.0.2",
"angular-base64-upload": "^0.1.19",
"angular-ui-sortable": "^0.17.0",
"js-base64": "^2.1.9"
"js-base64": "^2.1.9",
"angular-scroll": "^1.0.1"
},
"devDependencies": {
"angular-mocks": "1.5.8"
Expand Down
1 change: 1 addition & 0 deletions ui/test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ module.exports = function(config) {
'bower_components/jquery-ui/jquery-ui.js',
'bower_components/angular-ui-sortable/sortable.js',
'bower_components/js-base64/base64.js',
'bower_components/angular-scroll/angular-scroll.js',
'bower_components/angular-mocks/angular-mocks.js',
// endbower
"bower_components/cryptojslib/components/core-min.js",
Expand Down

0 comments on commit 580e05c

Please sign in to comment.