mirror of https://github.com/portainer/portainer
feat(storidge): profiles can enable snapshots without interval + interval in minutes
parent
072b20b9cc
commit
b3170b7f8e
|
@ -10,8 +10,8 @@ function StoridgeProfileDefaultModel() {
|
||||||
this.MaxBandwidth = 100;
|
this.MaxBandwidth = 100;
|
||||||
this.Filesystem = 'btrfs';
|
this.Filesystem = 'btrfs';
|
||||||
this.SnapshotEnabled = false;
|
this.SnapshotEnabled = false;
|
||||||
this.SnapshotInterval = 60;
|
this.SnapshotInterval = 0;
|
||||||
this.SnapshotMax = 1;
|
this.SnapshotMax = 0;
|
||||||
this.EncryptionEnabled = false;
|
this.EncryptionEnabled = false;
|
||||||
this.InterfaceType = 'nfs';
|
this.InterfaceType = 'nfs';
|
||||||
this.InterfaceDriver = '';
|
this.InterfaceDriver = '';
|
||||||
|
|
|
@ -50,6 +50,17 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService) {
|
||||||
delete profile.MaxBandwidth;
|
delete profile.MaxBandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (profile.SnapshotEnabled && $scope.state.RecurringSnapshotEnabled) {
|
||||||
|
if (!profile.SnapshotInterval) {
|
||||||
|
profile.SnapshotInterval = 1;
|
||||||
|
}
|
||||||
|
profile.SnapshotInterval *= 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$scope.state.RecurringSnapshotEnabled) {
|
||||||
|
profile.SnapshotInterval = 0;
|
||||||
|
}
|
||||||
|
|
||||||
prepareLabels(profile);
|
prepareLabels(profile);
|
||||||
|
|
||||||
$scope.state.actionInProgress = true;
|
$scope.state.actionInProgress = true;
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
<!-- !Filesystem -->
|
<!-- !Filesystem -->
|
||||||
<!-- snapshotEnabled -->
|
<!-- snapshotEnabled -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-6">
|
||||||
<label for="profile_snapshotEnabled" class="control-label text-left">
|
<label for="profile_snapshotEnabled" class="control-label text-left">
|
||||||
Enable snapshots
|
Enable snapshots
|
||||||
</label>
|
</label>
|
||||||
|
@ -113,28 +113,36 @@
|
||||||
<input name="profile_snapshotEnabled" type="checkbox" ng-model="model.SnapshotEnabled"><i></i>
|
<input name="profile_snapshotEnabled" type="checkbox" ng-model="model.SnapshotEnabled"><i></i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<label for="profile_recurringSnapshotEnabled" class="control-label text-left">
|
||||||
|
Enable periodic snapshots
|
||||||
|
</label>
|
||||||
|
<label class="switch" style="margin-left: 20px;">
|
||||||
|
<input name="profile_recurringSnapshotEnabled" type="checkbox" ng-model="state.RecurringSnapshotEnabled"><i></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- !snapshotEnabled -->
|
<!-- !snapshotEnabled -->
|
||||||
<!-- snapshotInterval -->
|
<!-- snapshotInterval -->
|
||||||
<div class="form-group" ng-if="model.SnapshotEnabled">
|
<div class="form-group" ng-if="state.RecurringSnapshotEnabled">
|
||||||
<label for="profile_snapshotInterval" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
<label for="profile_snapshotInterval" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
||||||
Snapshot interval
|
Snapshot interval
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<slider model="model.SnapshotInterval" floor="1" ceil="45000" step="1"></slider>
|
<slider model="model.SnapshotInterval" floor="1" ceil="750" step="1"></slider>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<input type="number" min="1" class="form-control" ng-model="model.SnapshotInterval" id="profile_snapshotInterval">
|
<input type="number" min="1" class="form-control" ng-model="model.SnapshotInterval" id="profile_snapshotInterval">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<p class="small text-muted" style="margin-top: 7px;">
|
<p class="small text-muted" style="margin-top: 7px;">
|
||||||
Snapshot interval (<b>s</b>)
|
Snapshot interval (<b>minutes</b>)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- !snapshotInterval -->
|
<!-- !snapshotInterval -->
|
||||||
<!-- snapshotMax -->
|
<!-- snapshotMax -->
|
||||||
<div class="form-group" ng-if="model.SnapshotEnabled">
|
<div class="form-group" ng-if="state.RecurringSnapshotEnabled">
|
||||||
<label for="profile_snapshotMax" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
<label for="profile_snapshotMax" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
||||||
Snapshot max
|
Snapshot max
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
<!-- !Filesystem -->
|
<!-- !Filesystem -->
|
||||||
<!-- snapshotEnabled -->
|
<!-- snapshotEnabled -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-6">
|
||||||
<label for="profile_snapshotEnabled" class="control-label text-left">
|
<label for="profile_snapshotEnabled" class="control-label text-left">
|
||||||
Enable snapshots
|
Enable snapshots
|
||||||
</label>
|
</label>
|
||||||
|
@ -106,28 +106,36 @@
|
||||||
<input name="profile_snapshotEnabled" type="checkbox" ng-model="profile.SnapshotEnabled"><i></i>
|
<input name="profile_snapshotEnabled" type="checkbox" ng-model="profile.SnapshotEnabled"><i></i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<label for="profile_recurringSnapshotEnabled" class="control-label text-left">
|
||||||
|
Enable periodic snapshots
|
||||||
|
</label>
|
||||||
|
<label class="switch" style="margin-left: 20px;">
|
||||||
|
<input name="profile_recurringSnapshotEnabled" type="checkbox" ng-model="state.RecurringSnapshotEnabled"><i></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- !snapshotEnabled -->
|
<!-- !snapshotEnabled -->
|
||||||
<!-- snapshotInterval -->
|
<!-- snapshotInterval -->
|
||||||
<div class="form-group" ng-if="profile.SnapshotEnabled">
|
<div class="form-group" ng-if="state.RecurringSnapshotEnabled">
|
||||||
<label for="profile_snapshotInterval" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
<label for="profile_snapshotInterval" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
||||||
Snapshot interval
|
Snapshot interval
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<slider model="profile.SnapshotInterval" floor="1" ceil="45000" step="1"></slider>
|
<slider model="profile.SnapshotInterval" floor="1" ceil="750" step="1"></slider>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<input type="number" min="1" class="form-control" ng-model="profile.SnapshotInterval" id="profile_snapshotInterval">
|
<input type="number" min="1" class="form-control" ng-model="profile.SnapshotInterval" id="profile_snapshotInterval">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<p class="small text-muted" style="margin-top: 7px;">
|
<p class="small text-muted" style="margin-top: 7px;">
|
||||||
Snapshot interval (<b>s</b>)
|
Snapshot interval (<b>minutes</b>)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- !snapshotInterval -->
|
<!-- !snapshotInterval -->
|
||||||
<!-- snapshotMax -->
|
<!-- snapshotMax -->
|
||||||
<div class="form-group" ng-if="profile.SnapshotEnabled">
|
<div class="form-group" ng-if="state.RecurringSnapshotEnabled">
|
||||||
<label for="profile_snapshotMax" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
<label for="profile_snapshotMax" class="col-sm-2 col-lg-1 control-label text-left" style="margin-top: 20px;">
|
||||||
Snapshot max
|
Snapshot max
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -11,7 +11,8 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M
|
||||||
LimitIOPS: false,
|
LimitIOPS: false,
|
||||||
LimitBandwidth: false,
|
LimitBandwidth: false,
|
||||||
updateInProgress: false,
|
updateInProgress: false,
|
||||||
deleteInProgress: false
|
deleteInProgress: false,
|
||||||
|
RecurringSnapshotEnabled: false
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addLabel = function() {
|
$scope.addLabel = function() {
|
||||||
|
@ -57,6 +58,17 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M
|
||||||
delete profile.MaxBandwidth;
|
delete profile.MaxBandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (profile.SnapshotEnabled && $scope.state.RecurringSnapshotEnabled) {
|
||||||
|
if (!profile.SnapshotInterval) {
|
||||||
|
profile.SnapshotInterval = 1;
|
||||||
|
}
|
||||||
|
profile.SnapshotInterval *= 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$scope.state.RecurringSnapshotEnabled) {
|
||||||
|
profile.SnapshotInterval = 0;
|
||||||
|
}
|
||||||
|
|
||||||
prepareLabels(profile);
|
prepareLabels(profile);
|
||||||
|
|
||||||
$scope.state.updateInProgress = true;
|
$scope.state.updateInProgress = true;
|
||||||
|
@ -111,6 +123,10 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M
|
||||||
} else {
|
} else {
|
||||||
$scope.state.NoLimit = true;
|
$scope.state.NoLimit = true;
|
||||||
}
|
}
|
||||||
|
if (profile.SnapshotEnabled && profile.SnapshotInterval) {
|
||||||
|
$scope.state.RecurringSnapshotEnabled = true;
|
||||||
|
profile.SnapshotInterval /= 60;
|
||||||
|
}
|
||||||
initLabels(profile.Labels);
|
initLabels(profile.Labels);
|
||||||
$scope.profile = profile;
|
$scope.profile = profile;
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue