-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GDB-8760: Implement backup and restore monitoring view in WB
## What A new view, 'Backup and Restore' has been added to display running backup or restore operations. ## Why We aim to provide our clients with the opportunity to easily check if there are ongoing backup or restore operations. ## How The view displays all currently running backup and restore operations in a table format. The page automatically refreshes every 2 seconds.
- Loading branch information
1 parent
ac4593b
commit b8b45b6
Showing
19 changed files
with
414 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.backup-and-restore-updater-icon div, .backup-and-restore-updater-icon img { | ||
display: inline-block; | ||
} | ||
|
||
.backup-and-restore table td { | ||
vertical-align: top; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'angular/backup-and-restore/controllers'; | ||
const modules = [ | ||
'graphdb.framework.monitoring.backupandrestore.controllers' | ||
]; | ||
|
||
angular.module('graphdb.framework.monitoring.backupandrestore', modules); |
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,65 @@ | ||
const modules = []; | ||
const UPDATE_BACKUP_AND_RESTORE_INFO_DATA_TIME_INTERVAL = 2000; | ||
|
||
angular | ||
.module('graphdb.framework.monitoring.backupandrestore.controllers', modules) | ||
.controller('BackupAndRestoreCtrl', BackupAndRestoreCtrl); | ||
|
||
BackupAndRestoreCtrl.$inject = ['$scope', '$interval', 'MonitoringRestService']; | ||
|
||
function BackupAndRestoreCtrl($scope, $interval, MonitoringRestService) { | ||
|
||
$scope.loading = false; | ||
$scope.initialized = false; | ||
|
||
/** | ||
* @type {BackupAndRestoreInfo[]} | ||
*/ | ||
$scope.backupAndRestoreInfos = undefined; | ||
$scope.hasClusterOperation = false; | ||
let timer = undefined; | ||
|
||
// ========================= | ||
// Public functions | ||
// ========================= | ||
$scope.hasToShowValue = (value) => { | ||
if (typeof value === 'boolean') { | ||
return true; | ||
} | ||
return !!value; | ||
}; | ||
|
||
// ========================= | ||
// Private functions | ||
// ========================= | ||
const loadBackupAndRestoreData = () => { | ||
if ($scope.loading) { | ||
return; | ||
} | ||
$scope.loading = true; | ||
MonitoringRestService.monitorBackup() | ||
.then((backupAndRestoreInfos) => { | ||
$scope.backupAndRestoreInfos = backupAndRestoreInfos; | ||
$scope.initialized = true; | ||
$scope.hasClusterOperation = $scope.backupAndRestoreInfos.some((backupAndRestoreInfo) => backupAndRestoreInfo.nodePerformingClusterBackup); | ||
}) | ||
.finally(() => $scope.loading = false); | ||
}; | ||
|
||
const removeAllListeners = () => { | ||
if (timer) { | ||
$interval.cancel(timer); | ||
} | ||
}; | ||
|
||
// ========================= | ||
// Event handlers | ||
// ========================= | ||
$scope.$on('$destroy', removeAllListeners); | ||
|
||
// ========================= | ||
// Initializes controller. | ||
// ========================= | ||
loadBackupAndRestoreData(); | ||
timer = $interval(() => loadBackupAndRestoreData(), UPDATE_BACKUP_AND_RESTORE_INFO_DATA_TIME_INTERVAL); | ||
} |
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 @@ | ||
PluginRegistry.add('route', { | ||
'url': '/monitor/backup-and-restore', | ||
'module': 'graphdb.framework.monitoring.backupandrestore', | ||
'path': 'backup-and-restore/app', | ||
'chunk': 'monitor-backup-and-restore', | ||
'controller': 'BackupAndRestoreCtrl', | ||
'templateUrl': 'pages/monitor/backup-and-restore.html', | ||
'title': 'view.monitoring.backup_and_restore.title', | ||
'helpInfo': 'view.monitoring.backup_and_restore.helpInfo' | ||
}); | ||
|
||
PluginRegistry.add('main.menu', { | ||
'items': [ | ||
{ | ||
label: 'Backup and Restore', | ||
labelKey: 'menu.backup_and_restore.label', | ||
href: 'monitor/backup-and-restore', | ||
order: 2, | ||
parent: 'Monitor', | ||
guideSelector: 'sub-menu-backup-and-restore' | ||
} | ||
] | ||
}); |
15 changes: 15 additions & 0 deletions
15
src/js/angular/models/monitoring/backup-and-restore-info.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,15 @@ | ||
export class BackupAndRestoreInfo { | ||
constructor() { | ||
this.id = undefined; | ||
this.username = ''; | ||
|
||
/** | ||
* @type {string} - The value must be one of the @{see BackupAndRestoreOperationType} values. | ||
*/ | ||
this.operation = ''; | ||
this.affectedRepositories = []; | ||
this.secondsSinceCreated = 0; | ||
this.snapshotOptions = []; | ||
this.nodePerformingClusterBackup = ''; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/js/angular/models/monitoring/backup-and-restore-operation-type.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,6 @@ | ||
export const BackupAndRestoreOperationType = { | ||
'CREATE_BACKUP_IN_PROGRESS': 'CREATE_BACKUP_IN_PROGRESS', | ||
'RESTORE_BACKUP_IN_PROGRESS': 'RESTORE_BACKUP_IN_PROGRESS', | ||
'CREATE_CLOUD_BACKUP_IN_PROGRESS': 'CREATE_CLOUD_BACKUP_IN_PROGRESS', | ||
'RESTORE_CLOUD_BACKUP_IN_PROGRESS': 'RESTORE_CLOUD_BACKUP_IN_PROGRESS' | ||
}; |
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,11 @@ | ||
export class SnapshotOptionInfo { | ||
constructor() { | ||
this.withRepositoryData = false; | ||
this.withSystemData = false; | ||
this.withClusterData = false; | ||
this.cleanDataDir = false; | ||
this.removeCluster = false; | ||
this.repositories = []; | ||
this.replicationTimeoutMs = 0; | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
src/js/angular/rest/mappers/monitor-backup-and-restore-mapper.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,30 @@ | ||
import {BackupAndRestoreInfo} from "../../models/monitoring/backup-and-restore-info"; | ||
import {SnapshotOptionInfo} from "../../models/monitoring/snapshot-option-info"; | ||
|
||
export const mapBackupAndRestoreResponseToModel = (responseData = []) => { | ||
const backupAndRestoreInfos = []; | ||
responseData.forEach((backupAndRestoreResponseData) => { | ||
const backupAndRestoreInfo = new BackupAndRestoreInfo(); | ||
backupAndRestoreInfo.id = backupAndRestoreResponseData.id; | ||
backupAndRestoreInfo.username = backupAndRestoreResponseData.username; | ||
backupAndRestoreInfo.operation = backupAndRestoreResponseData.operation; | ||
backupAndRestoreInfo.affectedRepositories = backupAndRestoreResponseData.affectedRepositories; | ||
backupAndRestoreInfo.secondsSinceCreated = backupAndRestoreResponseData.msSinceCreated / 1000; | ||
backupAndRestoreInfo.snapshotOptions = mapSnapshotOptionsResponseToModel(backupAndRestoreResponseData.snapshotOptions); | ||
backupAndRestoreInfo.nodePerformingClusterBackup = backupAndRestoreResponseData.nodePerformingClusterBackup; | ||
backupAndRestoreInfos.push(backupAndRestoreInfo); | ||
}); | ||
return backupAndRestoreInfos; | ||
}; | ||
|
||
export const mapSnapshotOptionsResponseToModel = ((snapshotOption) => { | ||
const snapshotOptionInfo = new SnapshotOptionInfo(); | ||
snapshotOptionInfo.withRepositoryData = snapshotOption.withRepositoryData; | ||
snapshotOptionInfo.withSystemData = snapshotOption.withSystemData; | ||
snapshotOptionInfo.withClusterData = snapshotOption.withClusterData; | ||
snapshotOptionInfo.cleanDataDir = snapshotOption.cleanDataDir; | ||
snapshotOptionInfo.removeCluster = snapshotOption.removeCluster; | ||
snapshotOptionInfo.repositories = snapshotOption.repositories; | ||
snapshotOptionInfo.replicationTimeoutMs = snapshotOption.replicationTimeoutMs; | ||
return snapshotOptionInfo; | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<div> | ||
<title>${messages.app.title} : ${messages.jmx.QueryMonitoringPage.title}</title> | ||
|
||
<link href="css/backup-and-restore.css?v=[AIV]{version}[/AIV]" rel="stylesheet"/> | ||
|
||
<h1> | ||
{{title}} | ||
<span class="btn btn-link" | ||
uib-popover-template="'js/angular/templates/titlePopoverTemplate.html'" | ||
popover-trigger="mouseenter" | ||
popover-placement="bottom-right" | ||
popover-append-to-body="true"> | ||
<span class="icon-info text-tertiary"></span> | ||
</span> | ||
<span onto-loader-new class="backup-and-restore-updater-icon" size="25"> | ||
</span> | ||
</h1> | ||
|
||
<div core-errors ontop></div> | ||
|
||
<div ng-if="initialized" class="backup-and-restore"> | ||
<table ng-if="backupAndRestoreInfos && backupAndRestoreInfos.length > 0" class="table table-striped table-bordered" | ||
aria-describedby="Monitor backup and restore"> | ||
<thead> | ||
<tr> | ||
<th class="id-header">{{'view.monitoring.backup_and_restore.id.header' | translate}}</th> | ||
<th class="username-header">{{'view.monitoring.backup_and_restore.username.header' | translate}}</th> | ||
<th class="recovery-operation-header">{{'view.monitoring.backup_and_restore.recovery_operation_type.header' | translate}} | ||
</th> | ||
<th class="affected-repository-header">{{'view.monitoring.backup_and_restore.affected_repositories.header' | translate}} | ||
</th> | ||
<th class="lifetime-header">{{'view.monitoring.backup_and_restore.lifetime.header' | translate}}</th> | ||
<th class="snapshot-options-header">{{'view.monitoring.backup_and_restore.snapshot_options.header' | translate}}</th> | ||
<th ng-if="hasClusterOperation" class="node-performing-cluster-backup-header"> | ||
{{'view.monitoring.backup_and_restore.node_performing_cluster_backup.header' | translate}} | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="backupAndRestoreInfo in backupAndRestoreInfos"> | ||
<td>{{backupAndRestoreInfo.id}}</td> | ||
<td>{{backupAndRestoreInfo.username}}</td> | ||
<td>{{('view.monitoring.backup_and_restore.' + backupAndRestoreInfo.operation) | translate}}</td> | ||
<td> | ||
<div ng-repeat="repository in backupAndRestoreInfo.affectedRepositories"> | ||
{{repository}} | ||
</div> | ||
</td> | ||
<td>{{getHumanReadableSeconds(backupAndRestoreInfo.secondsSinceCreated)}}</td> | ||
<td class="snapshot-options-data"> | ||
<div ng-repeat="(key, value) in backupAndRestoreInfo.snapshotOptions"> | ||
<div ng-if="hasToShowValue(value)"> | ||
<b>{{key}}</b> : {{value}} | ||
</div> | ||
</div> | ||
</td> | ||
<td ng-if="hasClusterOperation">{{backupAndRestoreInfo.nodePerformingClusterBackup}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<div class="alert alert-info no-icon no-running-backup-and-restore-alert" | ||
ng-if="!backupAndRestoreInfos || !backupAndRestoreInfos.length || backupAndRestoreInfos.length === 0"> | ||
{{'view.monitoring.backup_and_restore.no_running_backup_and_restore' | translate}} | ||
</div> | ||
</div> | ||
|
||
<div ng-if="!initialized && loading"> | ||
<div onto-loader-new | ||
ng-if="loading" | ||
size="75"> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.