diff --git a/ui/src/main/java/org/jboss/hal/ui/resource/BooleanFormItem.java b/ui/src/main/java/org/jboss/hal/ui/resource/BooleanFormItem.java index d7f28ef..7499fc6 100644 --- a/ui/src/main/java/org/jboss/hal/ui/resource/BooleanFormItem.java +++ b/ui/src/main/java/org/jboss/hal/ui/resource/BooleanFormItem.java @@ -120,30 +120,32 @@ boolean validate() { @Override boolean isModified() { - if (flags.scope == NEW_RESOURCE) { - if (inputMode == NATIVE) { - if (ra.description.hasDefault()) { - return ra.description.get(DEFAULT).asBoolean() != switchControl.value(); - } else { - return ra.value.asBoolean(false) != switchControl.value(); + if (ra.readable && !ra.description.readOnly()) { + if (flags.scope == NEW_RESOURCE) { + if (inputMode == NATIVE) { + if (ra.description.hasDefault()) { + return ra.description.get(DEFAULT).asBoolean() != switchControl.value(); + } else { + return ra.value.asBoolean(false) != switchControl.value(); + } + } else if (inputMode == EXPRESSION) { + return isExpressionModified(); } - } else if (inputMode == EXPRESSION) { - return isExpressionModified(); - } - } else if (flags.scope == EXISTING_RESOURCE) { - boolean wasDefined = ra.value.isDefined(); - if (inputMode == NATIVE) { - if (wasDefined) { - // modified if the original value was an expression or is different from the current user input - return ra.expression || ra.value.asBoolean() != switchControl.value(); - } else { - return true; + } else if (flags.scope == EXISTING_RESOURCE) { + boolean wasDefined = ra.value.isDefined(); + if (inputMode == NATIVE) { + if (wasDefined) { + // modified if the original value was an expression or is different from the current user input + return ra.expression || ra.value.asBoolean() != switchControl.value(); + } else { + return true; + } + } else if (inputMode == EXPRESSION) { + return isExpressionModified(); } - } else if (inputMode == EXPRESSION) { - return isExpressionModified(); + } else { + unknownScope(); } - } else { - unknownScope(); } return false; } diff --git a/ui/src/main/java/org/jboss/hal/ui/resource/NumberFormItem.java b/ui/src/main/java/org/jboss/hal/ui/resource/NumberFormItem.java index 7359189..7ca4586 100644 --- a/ui/src/main/java/org/jboss/hal/ui/resource/NumberFormItem.java +++ b/ui/src/main/java/org/jboss/hal/ui/resource/NumberFormItem.java @@ -340,56 +340,58 @@ private RangeValidation inRange(NumericValidation numericValidation) { @Override boolean isModified() { - if (flags.scope == NEW_RESOURCE) { - if (inputMode == NATIVE) { - if (allowedValuesControl != null) { - String selectedValue = allowedValuesControl.value(); - if (ra.description.hasDefault()) { - return !ra.description.get(DEFAULT).asString().equals(selectedValue); - } else { - return !UNDEFINED.equals(selectedValue); - } - } else if (minMaxControl != null) { - if (ra.description.hasDefault()) { - return !ra.description.get(DEFAULT).asString().equals(minMaxControl.value()); - } else { - return !minMaxControl.value().isEmpty(); + if (ra.readable && !ra.description.readOnly()) { + if (flags.scope == NEW_RESOURCE) { + if (inputMode == NATIVE) { + if (allowedValuesControl != null) { + String selectedValue = allowedValuesControl.value(); + if (ra.description.hasDefault()) { + return !ra.description.get(DEFAULT).asString().equals(selectedValue); + } else { + return !UNDEFINED.equals(selectedValue); + } + } else if (minMaxControl != null) { + if (ra.description.hasDefault()) { + return !ra.description.get(DEFAULT).asString().equals(minMaxControl.value()); + } else { + return !minMaxControl.value().isEmpty(); + } } + } else if (inputMode == EXPRESSION) { + return isExpressionModified(); } - } else if (inputMode == EXPRESSION) { - return isExpressionModified(); - } - } else if (flags.scope == EXISTING_RESOURCE) { - boolean wasDefined = ra.value.isDefined(); - if (inputMode == NATIVE) { - if (allowedValuesControl != null) { - String selectedValue = allowedValuesControl.value(); - if (wasDefined) { - // modified if the original value was an expression or is different from the current user input - String originalValue = ra.value.asString(); - return ra.expression || !originalValue.equals(selectedValue); - } else { - return !UNDEFINED.equals(selectedValue); + } else if (flags.scope == EXISTING_RESOURCE) { + boolean wasDefined = ra.value.isDefined(); + if (inputMode == NATIVE) { + if (allowedValuesControl != null) { + String selectedValue = allowedValuesControl.value(); + if (wasDefined) { + // modified if the original value was an expression or is different from the current user input + String originalValue = ra.value.asString(); + return ra.expression || !originalValue.equals(selectedValue); + } else { + return !UNDEFINED.equals(selectedValue); + } + } else if (minMaxControl != null) { + if (wasDefined) { + // modified if the original value was an expression or is different from the current user input + String originalValue = ra.value.asString(); + return ra.expression || !originalValue.equals(minMaxControl.value()); + } else { + return !minMaxControl.value().isEmpty(); + } } - } else if (minMaxControl != null) { + } else if (inputMode == EXPRESSION) { if (wasDefined) { - // modified if the original value was an expression or is different from the current user input String originalValue = ra.value.asString(); - return ra.expression || !originalValue.equals(minMaxControl.value()); + return !originalValue.equals(textControlValue()); } else { - return !minMaxControl.value().isEmpty(); + return !textControlValue().isEmpty(); } } - } else if (inputMode == EXPRESSION) { - if (wasDefined) { - String originalValue = ra.value.asString(); - return !originalValue.equals(textControlValue()); - } else { - return !textControlValue().isEmpty(); - } + } else { + unknownScope(); } - } else { - unknownScope(); } return false; } diff --git a/ui/src/main/java/org/jboss/hal/ui/resource/ResourceDialogs.java b/ui/src/main/java/org/jboss/hal/ui/resource/ResourceDialogs.java index 34db8f2..703090b 100644 --- a/ui/src/main/java/org/jboss/hal/ui/resource/ResourceDialogs.java +++ b/ui/src/main/java/org/jboss/hal/ui/resource/ResourceDialogs.java @@ -193,7 +193,7 @@ public static void executeOperation(AddressTemplate template, String operation) private static ResourceForm operationForm(AddressTemplate template, Metadata metadata, OperationDescription operationDescription) { - List resourceAttributes = resourceAttributes(operationDescription, __ -> true); + List resourceAttributes = resourceAttributes(operationDescription, notDeprecated()); ResourceForm resourceForm = new ResourceForm(template); for (ResourceAttribute ra : resourceAttributes) { resourceForm.addItem(formItem(template, metadata, ra, diff --git a/ui/src/main/java/org/jboss/hal/ui/resource/SelectFormItem.java b/ui/src/main/java/org/jboss/hal/ui/resource/SelectFormItem.java index 1b7f507..c66b43f 100644 --- a/ui/src/main/java/org/jboss/hal/ui/resource/SelectFormItem.java +++ b/ui/src/main/java/org/jboss/hal/ui/resource/SelectFormItem.java @@ -110,7 +110,9 @@ private FormSelect selectControl() { @Override void resetValidation() { super.resetValidation(); - selectControl.resetValidation(); + if (selectControl != null) { + selectControl.resetValidation(); + } } @Override @@ -132,33 +134,35 @@ boolean validate() { @Override boolean isModified() { - if (flags.scope == NEW_RESOURCE) { - if (inputMode == NATIVE) { - String selectedValue = selectControl.value(); - if (ra.description.hasDefault()) { - return !ra.description.get(DEFAULT).asString().equals(selectedValue); - } else { - return !UNDEFINED.equals(selectedValue); + if (ra.readable && !ra.description.readOnly()) { + if (flags.scope == NEW_RESOURCE) { + if (inputMode == NATIVE) { + String selectedValue = selectControl.value(); + if (ra.description.hasDefault()) { + return !ra.description.get(DEFAULT).asString().equals(selectedValue); + } else { + return !UNDEFINED.equals(selectedValue); + } + } else if (inputMode == EXPRESSION) { + return isExpressionModified(); } - } else if (inputMode == EXPRESSION) { - return isExpressionModified(); - } - } else if (flags.scope == EXISTING_RESOURCE) { - boolean wasDefined = ra.value.isDefined(); - if (inputMode == NATIVE) { - String selectedValue = selectControl.value(); - if (wasDefined) { - // modified if the original value was an expression or is different from the current user input - String originalValue = ra.value.asString(); - return ra.expression || !originalValue.equals(selectedValue); - } else { - return !UNDEFINED.equals(selectedValue); + } else if (flags.scope == EXISTING_RESOURCE) { + boolean wasDefined = ra.value.isDefined(); + if (inputMode == NATIVE) { + String selectedValue = selectControl.value(); + if (wasDefined) { + // modified if the original value was an expression or is different from the current user input + String originalValue = ra.value.asString(); + return ra.expression || !originalValue.equals(selectedValue); + } else { + return !UNDEFINED.equals(selectedValue); + } + } else if (inputMode == EXPRESSION) { + return isExpressionModified(); } - } else if (inputMode == EXPRESSION) { - return isExpressionModified(); + } else { + unknownScope(); } - } else { - unknownScope(); } return false; } diff --git a/ui/src/main/java/org/jboss/hal/ui/resource/StringFormItem.java b/ui/src/main/java/org/jboss/hal/ui/resource/StringFormItem.java index f31dd6f..a51f719 100644 --- a/ui/src/main/java/org/jboss/hal/ui/resource/StringFormItem.java +++ b/ui/src/main/java/org/jboss/hal/ui/resource/StringFormItem.java @@ -93,8 +93,11 @@ boolean validate() { @Override boolean isModified() { - // StringFormItem runs in mixed mode, so it's safe to delegate to isExpressionModified() - return isExpressionModified(); + if (ra.readable && !ra.description.readOnly()) { + // StringFormItem runs in mixed mode, so it's safe to delegate to isExpressionModified() + return isExpressionModified(); + } + return false; } @Override