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

Fixes #22731 - Add delete button to subscriptions page #7356

Merged
merged 1 commit into from
May 8, 2018

Conversation

johnpmitsch
Copy link
Contributor

@johnpmitsch johnpmitsch commented May 3, 2018

This adds the capability to delete subscriptions upstream (in RHSM) and trigger a manifest refresh.

Depends on #7317, my changes are in a separate commit to make things easier to review.

To do:

@theforeman-bot
Copy link

Issues: #22731

@theforeman-bot
Copy link

@johnpmitsch, this pull request is currently not mergeable. Please rebase against the master branch and push again.

If you have a remote called 'upstream' that points to this repository, you can do this by running:

    $ git pull --rebase upstream master

This message was auto-generated by Foreman's prprocessor

@johnpmitsch
Copy link
Contributor Author

Note that the page won't be refreshed after the subscription is deleted, that is being handled by a separate issue which will show task progress on this page

@johnpmitsch
Copy link
Contributor Author

@tstrachota @waldenraines: I'm getting this when clicking on delete, I'm at a loss to what I am passing the ConfirmDialog component that would cause this error:

warning.js:33 Warning: Received `true` for a non-boolean attribute `appear`.

If you want to write it to the DOM, pass a string instead: appear="true" or appear={value.toString()}.
    in div (created by CustomModalDialog)
    in CustomModalDialog (created by Modal)
    in Transition (created by Fade)
    in Fade (created by Modal)
    in RefHolder (created by Modal)
    in div (created by Modal)
    in Portal (created by Modal)
    in Modal (created by Modal)
    in Modal (created by ConfirmDialog)
    in ConfirmDialog (created by SubscriptionsTable)
    in Spinner (created by SubscriptionsTable)
    in SubscriptionsTable (created by SubscriptionsPage)
    in div (created by Col)
    in Col (created by SubscriptionsPage)
    in div (created by Row)
    in Row (created by SubscriptionsPage)
    in div (created by Grid)
    in Grid (created by SubscriptionsPage)
    in SubscriptionsPage (created by Connect(SubscriptionsPage))
    in Connect(SubscriptionsPage) (created by Route)
    in Route
    in div
    in Unknown (created by Application)
    in Router (created by BrowserRouter)
    in BrowserRouter (created by Application)
    in Application (created by Connect(Application))
    in Connect(Application)
    in Provider

},
formatters: [
label => (
<Table.SelectionHeading aria-label={label}>
Copy link
Member

Choose a reason for hiding this comment

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

Could you factor it out into a reusable formatter? I guess this is a pattern that will be repeated often.
Ideally we should use it on the upstream subscriptions page too.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@waldenraines
Copy link
Contributor

I cannot test this because I always get an empty state even though I have subscriptions. I observed this on @tstrachota's PR and since that is included with this it is broken here too.

Copy link
Contributor

@waldenraines waldenraines left a comment

Choose a reason for hiding this comment

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

I can't test this because of the aforementioned empty state issue I'm seeing.

Note to any reviewers from outside the team:

The progress of the deletion will be shown once http://projects.theforeman.org/issues/23285 is implemented.

@@ -14,6 +14,8 @@ class SubscriptionsPage extends Component {
super(props);
this.state = {
manifestModalOpen: false,
subscriptionDeleteModalOpen: false,
hideDeleteButton: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps rename this to disableDeleteButton?

@@ -217,6 +255,25 @@ class SubscriptionsTable extends Component {
onConfirm={() => this.cancelEdit()}
onCancel={() => this.showCancelConfirm(false)}
/>
<ConfirmDialog
show={this.props.subscriptionDeleteModalOpen}
title="Confirm Deletion"
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll want to use {__('Confirm Deletion')} here so this is translated.

),
}}

confirmLabel="Delete"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same note about translation above.

},
formatters: [
label => (
<Table.SelectionHeading aria-label={label}>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@johnpmitsch johnpmitsch force-pushed the 22731_delete_subs branch 2 times, most recently from 998c198 to cfc21af Compare May 7, 2018 18:00
@johnpmitsch johnpmitsch changed the title [WIP] Fixes #22731 - Add delete button to subscriptions page Fixes #22731 - Add delete button to subscriptions page May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@Katello Katello deleted a comment from houndci-bot May 7, 2018
@johnpmitsch
Copy link
Contributor Author

@tstrachota @waldenraines updated according to comments. A few outstanding questions:

  • I'm still getting this error and not sure what to do
  • I updated the tests and not sure if I went about it the right way, suggestions are welcome :)

@johnpmitsch johnpmitsch changed the title Fixes #22731 - Add delete button to subscriptions page [DO NOT MERGE] Fixes #22731 - Add delete button to subscriptions page May 7, 2018
@johnpmitsch
Copy link
Contributor Author

to test:

  • enable lab features in settings
  • import a manifest that you own
  • go to lab features > subscriptions
  • check boxes subscriptions for subscription you want to delete, the button should be disabled if no subs are selected
  • click delete button
  • check deletion task is created, once it finishes, you will have to refresh the page to see the changes. This will be updated in a future commit that handles tasks on this page.
  • to add subscriptions back, find your subscription at https://access.redhat.com/management/subscription_allocations and add it back, then refresh your manifest in katello

@johnpmitsch johnpmitsch changed the title [DO NOT MERGE] Fixes #22731 - Add delete button to subscriptions page Fixes #22731 - Add delete button to subscriptions page May 7, 2018
@waldenraines
Copy link
Contributor

I'm still getting this error and not sure what to do

I'm fine with us fixing this after this PR is merged if you want to file an issue for it.

I updated the tests and not sure if I went about it the right way, suggestions are welcome :)

We should probably do more to test individual functions within the page but we don't really do this elsewhere yet so I won't hold you to that.

Copy link
Contributor

@waldenraines waldenraines left a comment

Choose a reason for hiding this comment

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

Just a nitpick from me. Tested and it worked as expected.

export const DELETE_SUBSCRIPTIONS_SUCCESS = 'DELETE_SUBSCRIPTIONS_SUCCESS';
export const DELETE_SUBSCRIPTIONS_FAILURE = 'DELETE_SUBSCRIPTIONS_FAILURE';


Copy link
Contributor

Choose a reason for hiding this comment

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

Extra newline here.

This will delete subscriptions upstream (in RHSM) and refresh your
manifest.
@johnpmitsch
Copy link
Contributor Author

@waldenraines thanks, updated

@waldenraines
Copy link
Contributor

waldenraines commented May 8, 2018

@johnpmitsch can you file an issue for the aforementioned JS error please? After that I think we're good to merge pending green checks.

@johnpmitsch
Copy link
Contributor Author

@waldenraines
Copy link
Contributor

Feel free to merge this.

@johnpmitsch johnpmitsch merged commit 2984610 into Katello:master May 8, 2018
@johnpmitsch johnpmitsch deleted the 22731_delete_subs branch May 9, 2018 03:49
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.

4 participants