console icon indicating copy to clipboard operation
console copied to clipboard

[HAL-1991] Fix AddUnmanagedDialog

Open soul2zimate opened this issue 1 year ago • 4 comments

[HAL-1991] Fix AddUnmanagedDialog

Issue: https://issues.redhat.com/browse/HAL-1991

Fix AttributeCollection in AddUnmanagedDialog, it should be attributes() instead of requestProperties().

Also fix getAttributes method in ResourceDescription.java. The parentValue value type could be LIST for content Also it's incorrect to assume the nestedValue always inherit ACCESS_TYPE value from parent. For example, the content's Access Type is read-only. content.path can't be read-only if you want user input in this dialog.

@michpetrov I think you know more about the recent change around this area for #1187, could you review this ?

soul2zimate avatar Oct 28 '24 08:10 soul2zimate

@soul2zimate I'll look into it, it was request-properites before I made the change - https://github.com/hal/console/pull/1187/files#diff-80db9065f6e3c157627048c1b673c9abba7944e6a60f8111400a428ea35eb02f - so it's strange that it is failing now, and we're performing an ADD operation so using request properties makes sense.

As for the LIST type I'm pretty sure that's not included on purpose, I'll have to check.

michpetrov avatar Oct 29 '24 13:10 michpetrov

@soul2zimate ok, I see the problem. You're correct that the list type should be included but it has to be included only for request attributes. And I think that's all that needs to be fixed here, your fix unfortunately throws errors in the Model Browser (see e.g. "subsystem > datasources > jdbc-driver > h2").

To clarify:

  • requestProperties() is for creating a new resource
  • attributes() is for editing existing resources or for showing the model description, and you cannot manually edit the content of an existing deployment hence the read-only access-type (request attributes do not come with an access-type)

The reason we can't include lists in the attribute description is because an existing deployment doesn't have a content.path attribute (it would be e.g. content[0].path). So if we include it HAL tries to read it from the resource and create elements off of it. We make the list elements editable via separate forms but since the original description is left in I'm pretty sure those aren't affected either way.

michpetrov avatar Oct 29 '24 18:10 michpetrov

Thank you @michpetrov I have updated the fix as per your comments.

soul2zimate avatar Oct 30 '24 02:10 soul2zimate

LGTM

michpetrov avatar Oct 30 '24 14:10 michpetrov