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

Adds a new deprovision button and it's resource-container wrapper #245

Merged
merged 6 commits into from Jul 10, 2019

Conversation

Minivera
Copy link

@Minivera Minivera commented Jul 9, 2019

Work is related to manifoldco/engineering#8688

Reason for change

This adds a deprovision button based on the code for the provision button. This button can be used standalone and will fetch the resource id if not provided, or as a manifold-resource-deprovision component that will get it's data from the resource-container component.

Testing

Test with storybook

This adds a deprovision button based on the code for the provision button. This button can be used standalone and will fetch the resource id if not provided, or as a `manifold-resource-deprovision` component that will get it's data from the `resource-container` component.

Work is related to manifoldco/engineering#8688
@Minivera Minivera self-assigned this Jul 9, 2019
@drwpow drwpow temporarily deployed to manifold-ui-stage-pr-245 July 9, 2019 20:29 Inactive
@codecov
Copy link

codecov bot commented Jul 9, 2019

Codecov Report

Merging #245 into master will increase coverage by 0.78%.
The diff coverage is 78.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #245      +/-   ##
==========================================
+ Coverage   57.98%   58.77%   +0.78%     
==========================================
  Files          39       40       +1     
  Lines         883      946      +63     
  Branches      204      222      +18     
==========================================
+ Hits          512      556      +44     
- Misses        362      379      +17     
- Partials        9       11       +2
Impacted Files Coverage Δ
...vision-button/manifold-data-deprovision-button.tsx 78.37% <78.37%> (ø)
...resource-container/manifold-resource-container.tsx 65.38% <0%> (-3.04%) ⬇️
...ts/manifold-service-card/manifold-service-card.tsx 55.1% <0%> (-1.57%) ⬇️
...ifold-region-selector/manifold-region-selector.tsx 63.88% <0%> (+2.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3e5186...c3de6cf. Read the comment docs.

@drwpow drwpow temporarily deployed to manifold-ui-stage-pr-245 July 10, 2019 14:12 Inactive
@drwpow drwpow temporarily deployed to manifold-ui-stage-pr-245 July 10, 2019 16:02 Inactive
render() {
return (
<button
type="submit"

Choose a reason for hiding this comment

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

should this be a submit? doesn't a submit usually go inside a form? or are we expecting to use this in a form in association with a text input

Copy link
Author

Choose a reason for hiding this comment

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

All our data buttons are submits, not sure why 🤔 @DangoDev do you have an idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah typically these buttons are in forms with other bits of form data (e.g. a text input). type="submit" enables users to hit enter from the name field, which is preferable.

But if there’s not an input it doesn’t matter as much. But maybe the ability to submit a form is nice, in general?

<manifold-data-deprovision-button resourceId={state.data.id} resourceName={state.data.label}>
<manifold-forward-slot>
<slot />
</manifold-forward-slot>

Choose a reason for hiding this comment

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

What does manifold-forward-slot do?

Copy link
Author

Choose a reason for hiding this comment

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

It allows this deprovision button to "forward" its slot into the internal data deprovision button so this is possible:

<manifold-resource-deprovision>
   Content
</manifold-resource-deprovision>

Copy link
Contributor

Choose a reason for hiding this comment

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

Sam made this. This is just a nice utility helper to pass named slots several layers through components. Otherwise it’s just a little more brittle.

<slot />
</manifold-forward-slot>
</manifold-data-deprovision-button>
)}

Choose a reason for hiding this comment

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

seems like there would be a cleaner way to do this ternary rather than duplicating the markup. 🤔
something like this maybe?

...
<manifold-data-deprovision-button
  resourceId={state.data ? state.data.id : undefined} 
  resourceName={state.data ? state.data.label : undefined}
  loading={state.loading}
>
 ...

Copy link
Author

Choose a reason for hiding this comment

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

I find the ternary more readable, but I'm open to changing if you think it's a blocker 🤷‍♂

Choose a reason for hiding this comment

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

I'll defer to @DangoDev for a ruling on that. I don't feel too strongly about it

Copy link
Contributor

Choose a reason for hiding this comment

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

Dave’s way is clearer to my brain, but it’s a minor thing. I don’t feel too strongly about it either. 🍌

Copy link
Author

Choose a reason for hiding this comment

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

I ended up doing it

</manifold-data-provision-button>
---

# 🔒 Derovision Button
Copy link
Contributor

Choose a reason for hiding this comment

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

Deprovision (spelling)

DOM][shadow-dom] encapsulation for ease of use, we figured this component
should be customizable. As such, style it however you’d like! We recommend
attaching styles to a parent element using any CSS-in-JS framework of your
choice, or plain ol’ CSS.
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ curly quotes

return;
}

this.resourceId = resources[0].id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see what you’re doing here. Yeah this is strange, but I can’t think of a better way.

Copy link
Contributor

Choose a reason for hiding this comment

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

Overall though I think it’s nice functionality allowing resource-name or resource-id to be used 👍

Copy link
Author

Choose a reason for hiding this comment

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

GraphQl? 🤷‍♂

Copy link
Contributor

Choose a reason for hiding this comment

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

Someday…

@drwpow drwpow temporarily deployed to manifold-ui-stage-pr-245 July 10, 2019 18:33 Inactive
@Minivera Minivera merged commit d4ffdbb into master Jul 10, 2019
@Minivera Minivera deleted the gui/8688-deprovision-button branch July 10, 2019 19:59
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.

None yet

3 participants