Skip to content

Commit

Permalink
#1815 Add confirmation dialogs on trigger and reindex actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Mar 5, 2021
1 parent c3e0cdd commit 5d58871
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';

angular.module('theHiveControllers').controller('PlatformStatusCtrl', function(PlatformSrv, NotificationSrv, appConfig) {
angular.module('theHiveControllers').controller('PlatformStatusCtrl', function(ModalSrv, PlatformSrv, NotificationSrv, appConfig) {
var self = this;

self.appConfig = appConfig;
Expand Down Expand Up @@ -43,7 +43,6 @@
var date = new moment().format('YYYYMMDD-HH:mmZ');
var fileName = 'Platform-Status-Report-'+date+'.json';


var content = {
indexStatus: self.indexStatus,
checkStatus: self.checkStats,
Expand All @@ -61,16 +60,46 @@
}

this.reindex = function(indexName) {
PlatformSrv.runReindex(indexName)
.then(function(response) {
NotificationSrv.log('Reindexing of ' + indexName + ' started sucessfully', 'success');
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) {
PlatformSrv.runCheck(checkName)
.then(function(response) {
NotificationSrv.log('Integrity check of ' + checkName + ' started sucessfully', 'success');
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);
}
});
}

Expand Down
38 changes: 23 additions & 15 deletions frontend/app/views/partials/admin/platform/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ <h3 class="box-title">Platform Status</h3>
<div class="btn-group">
<button class="btn btn-sm btn-primary" type="button" ng-click="$vm.exportReport()">
<i class="fa fa-save"></i>
Export Report
Export status report
</button>
</div>
</div>
</div>
</div>

<h4 class="text-primary mt-m">Index status <small class="ml-m clickable" ng-click="$vm.loadIndexStatus()"><i class="fa fa-refresh"></i> Reload</small></h4>
<h4 class="text-primary mt-m">Data index status <small class="ml-m clickable" ng-click="$vm.loadIndexStatus()"><i class="fa fa-refresh"></i> Reload</small></h4>
<div class="empty-message" ng-if="$vm.loading.index">Loading index status...</div>
<div class="flex-table" ng-show="!$vm.loading.index">
<div class="flex-header mt-xs">
<div class="flex-col flex-w-120 text-center">Status</div>
<div class="flex-col flex-2">Index name</div>
<div class="flex-col flex-1">Mixed count</div>
<div class="flex-col flex-1">Composite</div>
<div class="flex-col flex-1">Database Objects</div>
<div class="flex-col flex-1">Index Objects</div>
<div class="flex-col flex-w-100"></div>
</div>
<div ng-repeat="(indexName, data) in $vm.indexStatus" class="flex-table">
Expand All @@ -40,10 +40,18 @@ <h4 class="text-primary mt-m">Index status <small class="ml-m clickable" ng-clic
<h4 class="media-heading text-primary">
{{indexName}}
</h4>
<div class="mt-xs">
<div>{{(data.mixedCount / data.compositeCount) * 100}}%</div>
<div class="progress progress-xs">
<div class="progress-bar" ng-class="{
'OK': 'progress-bar-success',
'Error': 'progress-bar-danger'}[data.status]" style="width: {{(data.mixedCount / data.compositeCount) * 100}}%"></div>
</div>
</div>
</div>

<div class="flex-col flex-1 vertical">
{{data.mixedCount}}
{{data.mixedCount}} objects in DB
</div>
<div class="flex-col flex-1 vertical">
{{data.compositeCount}}
Expand All @@ -57,8 +65,8 @@ <h4 class="media-heading text-primary">
</div>


<h4 class="text-primary mt-m">Integrity control status <small class="ml-m clickable" ng-click="$vm.loadCheckStats()"><i class="fa fa-refresh"></i> Reload</small></h4>
<div class="empty-message" ng-if="$vm.loading.check">Loading integrity control stats...</div>
<h4 class="text-primary mt-m">Data health status <small class="ml-m clickable" ng-click="$vm.loadCheckStats()"><i class="fa fa-refresh"></i> Reload</small></h4>
<div class="empty-message" ng-if="$vm.loading.check">Loading data health stats...</div>
<div class="flex-table" ng-show="!$vm.loading.check">
<div class="flex-header mt-xs">
<div class="flex-col flex-w-120 text-center">Status</div>
Expand All @@ -84,11 +92,11 @@ <h4 class="media-heading text-primary">
<div class="flex-col flex-2">
<div class="row">
<div class="col-sm-12">
<span class="label label-default mr-xxxs">Iterations:
{{data.globalStats.global.iterations}}</span>
<span class="label label-default mr-xxxs">Duplicate:
<span class="label label-lg label-default mr-xxxs">Iterations:
{{data.globalStats.global.iteration}}</span>
<span class="label label-lg label-default mr-xxxs">Duplicate:
{{data.globalStats.global.duplicate}}</span>
<span class="label label-default">Duration:
<span class="label label-lg label-default">Duration:
{{data.globalStats.global.duration}}</span>
</div>
</div>
Expand All @@ -102,11 +110,11 @@ <h4 class="media-heading text-primary">
<div class="flex-col flex-2">
<div class="row">
<div class="col-sm-12">
<span class="label label-default mr-xxxs">Iterations:
{{data.duplicateStats.global.iterations}}</span>
<span class="label label-default mr-xxxs">Duplicate:
<span class="label label-lg label-default mr-xxxs">Iterations:
{{data.duplicateStats.global.iteration}}</span>
<span class="label label-lg label-default mr-xxxs">Duplicate:
{{data.duplicateStats.global.duplicate}}</span>
<span class="label label-default">Duration:
<span class="label label-lg label-default">Duration:
{{data.duplicateStats.global.duration}}</span>
</div>
</div>
Expand Down

0 comments on commit 5d58871

Please sign in to comment.