Skip to content

Enhances 'environement get' commands with text results. Closes #2153#2160

Closed
nanddeepn wants to merge 3 commits intopnp:mainfrom
nanddeepn:improve-environement-get-commands
Closed

Enhances 'environement get' commands with text results. Closes #2153#2160
nanddeepn wants to merge 3 commits intopnp:mainfrom
nanddeepn:improve-environement-get-commands

Conversation

@nanddeepn
Copy link
Copy Markdown
Contributor

Enhances 'environement get' commands with text results. Closes #2153

@waldekmastykarz
Copy link
Copy Markdown
Member

Awesome @nanddeepn! We'll get through it asap 👏

@waldekmastykarz waldekmastykarz self-assigned this Feb 15, 2021
Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

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

Hey @nanddeepn, we should approach this differently. With the current solution we have two issues.

  1. Formatting is adjusted when the output is set explicitly to text. What this comparison is not taking into account, that if output is not set explicitly, it's also considered text.
  2. With this approach we make it impossible to use JMESPath queries and let users decide which properties they want to show. Instead, we always render a fixed set of properties.

A better approach would be to use the command's defaultProperties property and specify the list of properties that should be displayed. That way, we let users to specify their own properties using a JMESPath query, and if they don't we render the default set of properties.

To see how it's used, check out for example the flow environment list command.

@waldekmastykarz waldekmastykarz removed their assignment Feb 15, 2021
@waldekmastykarz waldekmastykarz marked this pull request as draft February 15, 2021 18:06
@nanddeepn nanddeepn marked this pull request as ready for review February 16, 2021 14:12
@nanddeepn
Copy link
Copy Markdown
Contributor Author

The tests are failing for SPO.

Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

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

Thank you for a quick turnaround @nanddeepn! If you could do one more adjustments, I think we're there 👍 Appreciate your help!

else {
logger.log(res);
}
res.name = res.name;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need to re-assign properties to the same names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops.. :( Thanks for noticing

request
.get(requestOptions)
.then((res: any): void => {
res.name = res.name;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need to re-assign properties to the same names.

@waldekmastykarz
Copy link
Copy Markdown
Member

As for the broken test, don't worry about it. I looked at the output log and it's something that happens occasionally when we'll get a time out. Nothing wrong on your part. Sorry for the trouble 😊

@waldekmastykarz waldekmastykarz self-assigned this Feb 16, 2021
Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

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

Excellent! Nothing to add 👏

@waldekmastykarz
Copy link
Copy Markdown
Member

Merged manually. Thank you! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: improve environement get commands with text results

2 participants