Merge "Correct the form validation in ng-image create volume form"
This commit is contained in:
commit
e8bc3ef529
|
@ -27,6 +27,7 @@
|
|||
'horizon.app.core.openstack-service-api.cinder',
|
||||
'horizon.app.core.openstack-service-api.nova',
|
||||
'horizon.framework.widgets.charts.quotaChartDefaults',
|
||||
'horizon.app.core.images.validationRules',
|
||||
'BYTE_TO_GIB'
|
||||
];
|
||||
|
||||
|
@ -38,11 +39,20 @@
|
|||
* @param {Object} cinder
|
||||
* @param {Object} nova
|
||||
* @param {Object} quotaChartDefaults
|
||||
* @param {Object} validationRules
|
||||
* @description
|
||||
* This controller is use for creating an image.
|
||||
* @return {undefined} No return value
|
||||
*/
|
||||
function CreateVolumeController($scope, $filter, cinder, nova, quotaChartDefaults, BYTE_TO_GIB) {
|
||||
function CreateVolumeController(
|
||||
$scope,
|
||||
$filter,
|
||||
cinder,
|
||||
nova,
|
||||
quotaChartDefaults,
|
||||
validationRules,
|
||||
BYTE_TO_GIB
|
||||
) {
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.volumeType = {};
|
||||
|
@ -50,6 +60,7 @@
|
|||
ctrl.availabilityZones = [];
|
||||
ctrl.image = $scope.image;
|
||||
ctrl.sourceImage = getSourceImage(ctrl.image);
|
||||
ctrl.validationRules = validationRules;
|
||||
ctrl.maxTotalVolumeGigabytes = 100;
|
||||
ctrl.totalGigabytesUsed = 0;
|
||||
ctrl.maxTotalVolumes = 1;
|
||||
|
|
|
@ -3,18 +3,31 @@
|
|||
<fieldset ng-disabled="createVolumeCtrl.volumeQuota.overMax">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<div class="form-group" ng-class="{'has-error':volumeForm.name.$invalid && volumeForm.name.$dirty}">
|
||||
<label class="control-label">
|
||||
<span translate>Name</span>
|
||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||
</label>
|
||||
<input class="form-control" type="text" ng-required="true" ng-model="createVolumeCtrl.volume.name">
|
||||
<input name="name" class="form-control" type="text" ng-model="createVolumeCtrl.volume.name"
|
||||
ng-maxlength="createVolumeCtrl.validationRules.fieldMaxLength">
|
||||
<p class="help-block alert alert-danger"
|
||||
ng-show="volumeForm.name.$invalid && volumeForm.name.$dirty">
|
||||
<translate>
|
||||
A volume name less than {$createVolumeCtrl.validationRules.fieldMaxLength + 1$} characters is required.
|
||||
</translate>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group" ng-class="{'has-error':volumeForm.description.$invalid && volumeForm.description.$dirty}">
|
||||
<label class="control-label">
|
||||
<span translate>Description</span>
|
||||
</label>
|
||||
<input class="form-control" type="text" ng-model="createVolumeCtrl.volume.description">
|
||||
<input name="description" class="form-control" type="text" ng-model="createVolumeCtrl.volume.description"
|
||||
ng-maxlength="createVolumeCtrl.validationRules.fieldMaxLength">
|
||||
<p class="help-block alert alert-danger"
|
||||
ng-show="volumeForm.description.$invalid && volumeForm.description.$dirty">
|
||||
<translate>
|
||||
A volume description less than {$createVolumeCtrl.validationRules.fieldMaxLength + 1$} characters is required.
|
||||
</translate>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">
|
||||
|
|
Loading…
Reference in New Issue