Fix slider steps with the unit changes

This commit is contained in:
Girish Ramakrishnan
2022-10-13 21:57:12 +02:00
parent 60f8ab9030
commit 41604feb02
6 changed files with 9 additions and 9 deletions

View File

@@ -924,7 +924,7 @@
<div class="col-md-12">
<form role="form" name="resourcesForm" ng-submit="resources.submitMemoryLimit()" autocomplete="off">
<div class="form-group">
<label class="control-label" for="memoryLimit">{{ 'app.resources.memory.title' | tr }} <sup><a ng-href="https://docs.cloudron.io/apps/#memory-limit" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup> : <b>{{ resources.memoryLimit | prettyBinarySize:'Default (256 MB)' }}</b></label>
<label class="control-label" for="memoryLimit">{{ 'app.resources.memory.title' | tr }} <sup><a ng-href="https://docs.cloudron.io/apps/#memory-limit" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup> : <b>{{ resources.memoryLimit | prettyBinarySize:'Default (256 MiB)' }}</b></label>
<div style="padding: 0 10px;">
<slider id="memoryLimit" ng-model="resources.memoryLimit" step="134217728" tooltip="hide" ticks="resources.memoryTicks" ticks-snap-bounds="67108864"></slider>
</div>

View File

@@ -384,7 +384,7 @@
</div>
<div class="form-group" ng-show="s3like(configureBackup.provider)">
<label class="control-label">{{ 'backups.configureBackupStorage.uploadPartSize' | tr }}: <b>{{ configureBackup.uploadPartSize | prettyBinarySize:'Default (50 MB)' }}</b></label>
<label class="control-label">{{ 'backups.configureBackupStorage.uploadPartSize' | tr }}: <b>{{ configureBackup.uploadPartSize | prettyBinarySize:'Default (50 MiB)' }}</b></label>
<p class="small">{{ 'backups.configureBackupStorage.uploadPartSizeDescription' | tr }}</p>
<div style="padding: 0 10px;">
<slider id="sliderConfigureBackupUploadPartSize" ng-model="configureBackup.uploadPartSize" step="1048576" tooltip="hide" ticks="configureBackup.uploadPartSizeTicks" ticks-snap-bounds="2097152"></slider>

View File

@@ -159,7 +159,7 @@
</input>
</label>
<div style="padding: 0 10px;">
<slider id="storageQuota" ng-disabled="!mailboxes.edit.storageQuotaEnabled" ng-model="mailboxes.edit.storageQuota" step="1073741824" tooltip="hide" ticks="storageQuotaTicks"></slider>
<slider id="storageQuota" ng-disabled="!mailboxes.edit.storageQuotaEnabled" ng-model="mailboxes.edit.storageQuota" step="1000000000" tooltip="hide" ticks="storageQuotaTicks"></slider>
</div>
</div>

View File

@@ -42,7 +42,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
$scope.domain = null;
$scope.adminDomain = null;
$scope.diskUsage = {};
$scope.storageQuotaTicks = [ 1*1024*1024*1024, 15*1024*1024*1024, 50*1024*1024*1024, 100*1024*1024*1024 ];
$scope.storageQuotaTicks = [ 1*1000*1000*1000, 15*1000*1000*1000, 50*1000*1000*1000, 100*1000*1000*1000 ];
$scope.expectedDnsRecords = {
mx: { },
@@ -638,7 +638,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
}
function done() {
$scope.diskUsage[$scope.mailboxes.edit.name + '@' + $scope.domain.domain].quotaLimit = $scope.mailboxes.edit.storageQuotaEnabled ? $scope.mailboxes.edit.storageQuota/1024 : 0; // hack to avoid refresh
$scope.diskUsage[$scope.mailboxes.edit.name + '@' + $scope.domain.domain].quotaLimit = $scope.mailboxes.edit.storageQuotaEnabled ? $scope.mailboxes.edit.storageQuota/1000 : 0; // hack to avoid refresh
$scope.mailboxes.edit.busy = false;
$scope.mailboxes.edit.error = null;
@@ -709,8 +709,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
m.ownerDisplayName = m.owner ? m.owner.display : ''; // this meta property is set when we get the user list
var u = $scope.diskUsage[m.name + '@' + m.domain]; // this is unset when no emails have been received yet
m.usage = (u && u.quotaValue * 1024) || 0;
m.limit = (u && u.quotaLimit * 1024) || 0;
m.usage = (u && u.quotaValue * 1000) || 0;
m.limit = (u && u.quotaLimit * 1000) || 0;
});
$scope.mailboxes.mailboxes = mailboxes;

View File

@@ -58,7 +58,7 @@
<form name="maxEmailSizeChangeForm" role="form" novalidate ng-submit="maxEmailSize.submit()" autocomplete="off">
<div class="form-group">
<label class="control-label">{{ 'emails.changeMailSizeDialog.size' | tr }} <b>{{ maxEmailSize.size | prettyDecimalSize }}</b></label>
<slider ng-model="maxEmailSize.size" tooltip="hide" min="1048576" max="1073741824" step="1048576"></slider>
<slider ng-model="maxEmailSize.size" tooltip="hide" min="1000000" max="1000000000" step="1000000"></slider>
</div>
<input class="ng-hide" type="submit"/>
</form>