Make existing empty metadata properties optional
Editing of snapshot image or updating its metadata from Horizon is
not allowed until existing properties with empty values are set or
removed from metadata tree.
They are allowed to be None, therefore Horizon should consider them
optional too.
Closes-Bug: #1945706
Change-Id: Idfec71d209430c7d069133a40ca1a7d340163783
(cherry picked from commit 4e0f5a5a85
)
This commit is contained in:
parent
3a65699602
commit
a9ae00b164
|
@ -13,7 +13,7 @@
|
|||
type="text"
|
||||
class="form-control"
|
||||
ng-pattern="ctrl.item.leaf.pattern"
|
||||
required
|
||||
ng-required="ctrl.item.leaf.required"
|
||||
ng-model="ctrl.item.leaf.value"
|
||||
ng-minlength="{$ ::ctrl.item.leaf.minLength $}"
|
||||
ng-maxlength="{$ ::ctrl.item.leaf.maxLength $}"
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
this.default = null;
|
||||
this.type = 'string';
|
||||
this.readonly = false;
|
||||
this.required = true;
|
||||
this.operators = ['<in>'];
|
||||
angular.extend(this, json);
|
||||
this.operator = this.operators[0];
|
||||
|
@ -73,6 +74,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// if the existing property has empty string value, make the field not required
|
||||
if (value === '') {
|
||||
this.required = false;
|
||||
}
|
||||
|
||||
switch (this.type) {
|
||||
case 'integer':
|
||||
this.value = parseInt(value, 10);
|
||||
|
|
Loading…
Reference in New Issue