Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Rework of node/job attributes/meta using PathTree #23290

Conversation

philrenaud
Copy link
Contributor

This extends and reuses PathTree logic originally written for Variables in #13202

This PR specifically fixes a bug where a metadata k/v item wouldn't show up in the UI if its full key was the prefix of a nested child key.

For example, this metadata:

{
  'phil.hair': 'yes',
  'phil.hair.colour': 'black',
  'phil.hair.length': 'short'
};

would produce the following:
image

and now produces:
image

@philrenaud philrenaud self-assigned this Jun 10, 2024
@philrenaud philrenaud marked this pull request as ready for review June 10, 2024 21:05
Copy link

github-actions bot commented Jun 10, 2024

Ember Test Audit comparison

main d318131 change
passes 1572 1571 -1
failures 0 0 0
flaky 0 0 0
duration 11m 28s 001ms 11m 29s 543ms +01s 542ms

@philrenaud philrenaud force-pushed the 16034-ui-bug-node-metadata-doesnt-show-up-in-the-ui-when-key-is-also-a-prefix-for-others branch from a61fe30 to 7b922a9 Compare June 10, 2024 23:52
@philrenaud philrenaud force-pushed the 16034-ui-bug-node-metadata-doesnt-show-up-in-the-ui-when-key-is-also-a-prefix-for-others branch from 7b922a9 to 38326a8 Compare June 11, 2024 01:10
@@ -793,7 +793,7 @@
{{capitalize a.item.name}}
Attributes
</div>
{{#if a.item.attributes.structured}}
{{#if a.item.attributesShort}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional here now matches the property we use, rather than being a proxy for it.

@editable={{@editable}}
@onKVSave={{@onKVSave}}
@copyable={{@copyable}}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two notable changes here:

  • We no longer show the "key-prefix-only" blue headers like we used to. These were colspan="2"/full-width rows that both broke table accessibility conventions and made the page taller than it needed to be (especially with a lot of client metadata)
  • we place "terminal" items first, and then nested ones below, kind of like a filesystem layout might look in an explorer window, rather than alphabetizing all prefixes. I am less attached to this change but it feels right so far.

@@ -39,11 +39,14 @@ export default class PathTree {
/**
* @param {MutableArray<VariableModel>} variables
*/
constructor(variables) {
constructor(variables, { delimiter = '/' } = {}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stopped short of fully generifying this (changing .files[] to .terminal[] etc.) but did:

  • parameterize the delimiter
  • add prefix as a returned field for ease of use in the UI

@@ -81,27 +92,4 @@ module('Integration | Component | attributes table', function (hooks) {
'properties'
);
});

test('should render a row for key/value pairs even when the value is another object', async function (assert) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test became obsolete when we stopped showing the blue "key" rows.

@philrenaud philrenaud requested review from angrycub and tgross June 11, 2024 19:48
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! In addition to reviewing the code as best I can, I also took a look through the UI preview build and everything looks as I'd expect.

One note which is probably out of scope for this PR: the faded-out prefix is kinda low-contrast relative to the background. In places like Node attributes, where we don't show a "tree", this means that we never display the prefix value as black text. Snippet of what I mean from here:

Screenshot at 2024-06-12 09-18-14

Here "kernel" is never being shown to the user as black text, only faded.

@philrenaud
Copy link
Contributor Author

@tgross your comment got me to spitball with some components a bit; what would you think about the look of metadata/attributes if they were set in our Badge components?
image

Is this too visually heavy for what it is?

@tgross
Copy link
Member

tgross commented Jun 12, 2024

Is this too visually heavy for what it is?

Yeah, feels heavy to me.

@philrenaud philrenaud force-pushed the 16034-ui-bug-node-metadata-doesnt-show-up-in-the-ui-when-key-is-also-a-prefix-for-others branch from 145e13b to d318131 Compare June 12, 2024 17:19
@philrenaud philrenaud added backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.8.x backport to 1.8.x release line labels Jun 12, 2024
@philrenaud philrenaud removed the backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent label Jun 12, 2024
@philrenaud philrenaud merged commit d349434 into main Jun 12, 2024
21 checks passed
@philrenaud philrenaud deleted the 16034-ui-bug-node-metadata-doesnt-show-up-in-the-ui-when-key-is-also-a-prefix-for-others branch June 12, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.8.x backport to 1.8.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ui, bug] Node Metadata doesn't show up in the UI when key is also a prefix for others
2 participants