-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
383 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
frontend/app/scripts/controllers/admin/platform/PlatformStatusCtrl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('theHiveControllers').controller('PlatformStatusCtrl', function(PlatformSrv, NotificationSrv, appConfig) { | ||
var self = this; | ||
|
||
self.appConfig = appConfig; | ||
self.indexStatus = {}; | ||
self.checkStats = {}; | ||
|
||
self.loading = { | ||
index: false, | ||
check: false | ||
} | ||
|
||
this.loadIndexStatus = function() { | ||
self.indexStatus = {}; | ||
self.loading.index = true; | ||
|
||
PlatformSrv.getIndexStatus() | ||
.then(function(response) { | ||
self.indexStatus = response.data; | ||
self.loading.index = false; | ||
}); | ||
} | ||
|
||
this.loadCheckStats = function() { | ||
self.loading.check = true; | ||
|
||
PlatformSrv.getCheckStats() | ||
.then(function(response) { | ||
self.checkStats = response.data; | ||
self.loading.check = false; | ||
}) | ||
} | ||
|
||
this.$onInit = function() { | ||
self.loadIndexStatus(); | ||
self.loadCheckStats(); | ||
}; | ||
|
||
this.exportReport = function() { | ||
var date = new moment().format('YYYYMMDD-HH:mmZ'); | ||
var fileName = 'Platform-Status-Report-'+date+'.json'; | ||
|
||
|
||
var content = { | ||
indexStatus: self.indexStatus, | ||
checkStatus: self.checkStats, | ||
schemaStatus: self.appConfig.schemaStatus | ||
}; | ||
|
||
// Create a blob of the data | ||
var fileToSave = new Blob([JSON.stringify(content)], { | ||
type: 'application/json', | ||
name: fileName | ||
}); | ||
|
||
// Save the file | ||
saveAs(fileToSave, fileName); | ||
} | ||
|
||
this.reindex = function(indexName) { | ||
PlatformSrv.runReindex(indexName) | ||
.then(function(response) { | ||
NotificationSrv.log('Reindexing of ' + indexName + ' started sucessfully', 'success'); | ||
}); | ||
}; | ||
|
||
this.checkControl = function(checkName) { | ||
PlatformSrv.runCheck(checkName) | ||
.then(function(response) { | ||
NotificationSrv.log('Integrity check of ' + checkName + ' started sucessfully', 'success'); | ||
}); | ||
} | ||
|
||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(function() { | ||
'use strict'; | ||
angular.module('theHiveServices') | ||
.service('PlatformSrv', function($http) { | ||
|
||
this.getIndexStatus = function() { | ||
return $http.get('./api/v1/admin/index/status') | ||
} | ||
|
||
this.runReindex = function(indexName) { | ||
return $http.get('./api/v1/admin/index/'+indexName+'/reindex'); | ||
} | ||
|
||
this.getCheckStats = function() { | ||
return $http.get('./api/v1/admin/check/stats') | ||
} | ||
|
||
this.runCheck = function(checkName) { | ||
return $http.get('./api/v1/admin/check/'+checkName+'/trigger'); | ||
} | ||
|
||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.