-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-th4' into issue-1264
- Loading branch information
Showing
74 changed files
with
1,975 additions
and
338 deletions.
There are no files selected for viewing
Submodule ScalliGraph
updated
4 files
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
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
167 changes: 167 additions & 0 deletions
167
frontend/app/scripts/components/organisation/OrgCustomTagsListCmp.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,167 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('theHiveComponents') | ||
.component('orgCustomTagsList', { | ||
controller: function($scope, PaginatedQuerySrv, FilteringSrv, TagSrv, UserSrv, ModalUtilsSrv, NotificationSrv) { | ||
var self = this; | ||
|
||
self.tags = []; | ||
self.getUserInfo = UserSrv.getCache; | ||
|
||
this.$onInit = function() { | ||
// TODO: FIXME | ||
self.filtering = new FilteringSrv('tag', 'custom-tags.list', { | ||
version: 'v1', | ||
defaults: { | ||
showFilters: true, | ||
showStats: false, | ||
pageSize: 15, | ||
sort: ['+predicate'] | ||
}, | ||
defaultFilter: [] | ||
}); | ||
|
||
self.filtering.initContext(self.organisation.name) | ||
.then(function() { | ||
self.load(); | ||
|
||
$scope.$watch('$vm.list.pageSize', function (newValue) { | ||
self.filtering.setPageSize(newValue); | ||
}); | ||
}); | ||
}; | ||
|
||
this.load = function() { | ||
|
||
self.list = new PaginatedQuerySrv({ | ||
name: 'organisation-custom-tags', | ||
version: 'v1', | ||
skipStream: true, | ||
sort: self.filtering.context.sort, | ||
loadAll: false, | ||
pageSize: self.filtering.context.pageSize, | ||
filter: this.filtering.buildQuery(), | ||
operations: [ | ||
{ | ||
'_name': 'listTag' | ||
}, | ||
{ | ||
'_name': 'freetags' | ||
} | ||
], | ||
extraData: ['usage'], | ||
onFailure: function(err) { | ||
if(err && err.status === 400) { | ||
self.filtering.resetContext(); | ||
self.load(); | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
self.deleteTag = function (tag) { | ||
ModalUtilsSrv.confirm('Remove free tag', 'Are you sure you want to delete this tag?', { | ||
okText: 'Yes, remove it', | ||
flavor: 'danger' | ||
}) | ||
.then(function () { | ||
return TagSrv.removeTag(tag._id); | ||
}) | ||
.then(function () { | ||
NotificationSrv.success('Tag [' + tag.predicate + '] removed successfully'); | ||
|
||
self.load(); | ||
|
||
$scope.$emit('freetags:refresh'); | ||
}); | ||
}; | ||
|
||
self.updateColour = function(id, colour) { | ||
TagSrv.updateTag(id, {colour: colour}) | ||
.then(function(/*response*/) { | ||
NotificationSrv.success('Tag colour updated successfully'); | ||
}) | ||
.catch(function(err) { | ||
NotificationSrv.error('Tag list', err.data, err.status); | ||
}) | ||
} | ||
|
||
self.updateTag = function(id, value) { | ||
TagSrv.updateTag(id, {predicate: value}) | ||
.then(function(/*response*/) { | ||
NotificationSrv.success('Tag value updated successfully'); | ||
}) | ||
.catch(function(err) { | ||
NotificationSrv.error('Tag list', err.data, err.status); | ||
}) | ||
} | ||
|
||
// Filtering | ||
this.toggleFilters = function () { | ||
this.filtering.toggleFilters(); | ||
}; | ||
|
||
this.filter = function () { | ||
self.filtering.filter().then(this.applyFilters); | ||
}; | ||
|
||
this.clearFilters = function () { | ||
this.filtering.clearFilters() | ||
.then(self.search); | ||
}; | ||
|
||
this.removeFilter = function (index) { | ||
self.filtering.removeFilter(index) | ||
.then(self.search); | ||
}; | ||
|
||
this.search = function () { | ||
self.load(); | ||
self.filtering.storeContext(); | ||
}; | ||
this.addFilterValue = function (field, value) { | ||
this.filtering.addFilterValue(field, value); | ||
this.search(); | ||
}; | ||
|
||
this.filterBy = function(field, value) { | ||
self.filtering.clearFilters() | ||
.then(function(){ | ||
self.addFilterValue(field, value); | ||
}); | ||
}; | ||
|
||
this.sortBy = function(sort) { | ||
self.list.sort = sort; | ||
self.list.update(); | ||
self.filtering.setSort(sort); | ||
}; | ||
|
||
this.sortByField = function(field) { | ||
var context = this.filtering.context; | ||
var currentSort = Array.isArray(context.sort) ? context.sort[0] : context.sort; | ||
var sort = null; | ||
|
||
if(currentSort.substr(1) !== field) { | ||
sort = ['+' + field]; | ||
} else { | ||
sort = [(currentSort === '+' + field) ? '-'+field : '+'+field]; | ||
} | ||
|
||
self.list.sort = sort; | ||
self.list.update(); | ||
self.filtering.setSort(sort); | ||
}; | ||
}, | ||
controllerAs: '$vm', | ||
templateUrl: 'views/components/org/custom-tags/tag-list.html', | ||
bindings: { | ||
organisation: '<', | ||
templates: '=', | ||
fields: '<', | ||
onReload: '&', | ||
onEdit: '&' | ||
} | ||
}); | ||
})(); |
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
107 changes: 107 additions & 0 deletions
107
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,107 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('theHiveControllers').controller('PlatformStatusCtrl', function(ModalSrv, 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) { | ||
var modalInstance = ModalSrv.confirm( | ||
'Reindex', | ||
'Are you sure you want to trigger ' + indexName + ' data reindex', { | ||
okText: 'Yes, reindex it' | ||
} | ||
); | ||
|
||
modalInstance.result | ||
.then(function() { | ||
PlatformSrv.runReindex(indexName); | ||
}) | ||
.then(function(/*response*/) { | ||
NotificationSrv.success('Reindexing of ' + indexName + ' data started sucessfully'); | ||
}) | ||
.catch(function(err) { | ||
if (!_.isString(err)) { | ||
NotificationSrv.error('Platform status', err.data, err.status); | ||
} | ||
}); | ||
}; | ||
|
||
this.checkControl = function(checkName) { | ||
var modalInstance = ModalSrv.confirm( | ||
'Data health check', | ||
'Are you sure you want to trigger ' + checkName + ' health check', { | ||
okText: 'Yes, trigger it' | ||
} | ||
); | ||
|
||
modalInstance.result | ||
.then(function() { | ||
PlatformSrv.runCheck(checkName); | ||
}) | ||
.then(function(/*response*/) { | ||
NotificationSrv.success('Data health check of ' + checkName + ' started sucessfully'); | ||
}) | ||
.catch(function(err) { | ||
if (!_.isString(err)) { | ||
NotificationSrv.error('Platform status', err.data, err.status); | ||
} | ||
}); | ||
} | ||
|
||
}); | ||
})(); |
Oops, something went wrong.