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

Refactor binding list #742

Merged
merged 10 commits into from
Oct 24, 2018
Merged

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Oct 18, 2018

Fixes #455

This PR refactors how the binding list is represented in the Service Instance View. The summary of the changes are:

  • The columns of the table are now: Binding | Status | Message | Details
  • Since the message can be quite big it's now displayed in its own modal if the user clicks in the button "Show message". (Recommendation made by @Angelmmiguel )
  • I removed the Extend/Collapse button since it was adding a new row to the table which looked confusing. Instead the "Details" column is now always present. The format of these details has been refactored as well.
  • It fixes Display status message for Service Bindings #455 since the latest condition from the list is now picked by date instead of relying in the order of the array.

If these changes are approved we should use the same approach for ordering in ServiceInstanceCardList and apply the "Show message" button to the service instance message as well.

Screenshots:

screen shot 2018-10-24 at 12 34 44

When clicking in "Show message":

screen shot 2018-10-17 at 18 16 34

When clicking in the "show" link of the secret a similar modal is displayed:

screen shot 2018-10-24 at 12 34 55

For the record this is how the table looks without these changes:

screen shot 2018-10-18 at 12 43 34

<td className="col-2">{name}</td>
<td className="col-2">{reason}</td>
<td className="col-2">
<button className="button" onClick={this.openModal}>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a small button will work better :)

Suggested change
<button className="button" onClick={this.openModal}>
<button className="button button-small" onClick={this.openModal}>

Copy link
Contributor

@Angelmmiguel Angelmmiguel left a comment

Choose a reason for hiding this comment

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

Small changes, but in general it looks good to me :)

<button className={"button button-primary button-small"} onClick={this.toggleExpand}>
Expand/Collapse
return (
<tr className="row padding-t-small">
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a big fan of modifying default table behaviour with flex. Is there any reason you had to use row and col classes here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not really, the result is almost the same without it, it was just to set specific sizes for the columns

<a>
<span
className="Terminal__Top__Button Terminal__Top__Button--red"
onClick={this.props.closeModal}
Copy link
Contributor

Choose a reason for hiding this comment

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

Love that red button actually close the modal 😂

message: string;
}

class MessageDetails extends React.Component<IMessageDetailsProps> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you make this component Pure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed offline to make this a Stateless component

@andresmgot
Copy link
Contributor Author

andresmgot commented Oct 22, 2018

Thanks @Angelmmiguel for taking a look! Can you do a quick review again?

@prydonius
Copy link
Contributor

I think we should hide by default the secret values, can we either show a modal with those values or show them inline with a click of a "show" link next to the secret name?

@andresmgot
Copy link
Contributor Author

@prydonius I have applied your suggestions (check the screenshots)

@andresmgot
Copy link
Contributor Author

cc/ @Angelmmiguel

@Angelmmiguel
Copy link
Contributor

Sure! I'm gonna review it @andresmgot. Btw, did you remember the conversation about function vs pure components? React v16.6 comes with a React.memo method to create pure components based on functions: https://reactjs.org/blog/2018/10/23/react-v-16-6.html

Copy link
Contributor

@Angelmmiguel Angelmmiguel left a comment

Choose a reason for hiding this comment

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

LGTM @andresmgot! Nice work :)

/>
</a>
</div>
<div className="Terminal__Top__Title">Message</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

[Not a blocker] Could you change this title to something more specific? I think Message is to general.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 I would make it a prop so that it can be set by the caller

/>
</a>
</div>
<div className="Terminal__Top__Title">Message</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 I would make it a prop so that it can be set by the caller

@@ -0,0 +1,52 @@
import * as React from "react";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this component should be renamed as it is used for the secret and the error message, so a more general name would be better. Perhaps something like TerminalModal makes more sense?

@andresmgot
Copy link
Contributor Author

React v16.6 comes with a React.memo method to create pure components based on functions

Cool, nice to know, thanks for the heads up! (we are still in react 16.4)

I applied the rest of your comments. Thanks for the reviews!

Copy link
Contributor

@prydonius prydonius left a comment

Choose a reason for hiding this comment

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

lgtm thanks!

dashboard/src/components/BindingList/BindingDetails.tsx Outdated Show resolved Hide resolved
prydonius and others added 2 commits October 24, 2018 14:46
Co-Authored-By: andresmgot <andres.mgotor@gmail.com>
@andresmgot andresmgot merged commit ba7d634 into vmware-tanzu:master Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display status message for Service Bindings
3 participants