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 #22734 - Add ability to edit RH Subscription entitlements #7317

Merged
merged 1 commit into from
May 7, 2018
Merged

Fixes #22734 - Add ability to edit RH Subscription entitlements #7317

merged 1 commit into from
May 7, 2018

Conversation

tstrachota
Copy link
Member

@tstrachota tstrachota commented Apr 17, 2018

Contains also Walden's 748a501 which will be removed eventually.

It requires patternfly/patternfly-react#240 (review) for the inline edit capabilities.

TODO:

  • Either add dependency to the latest patternfly-react or copy over the inline edit components (if the other PR doesn't get merged)
  • Confirm modal
  • Add icon for changed inputs
  • Tests

@theforeman-bot
Copy link

Issues: #22734


return (
<td className="editable">
<div

Choose a reason for hiding this comment

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

Visible, non-interactive elements with click handlers must have at least one keyboard listener jsx-a11y/click-events-have-key-events
Static HTML elements with event handlers require a role jsx-a11y/no-static-element-interactions

this.state = {
updatedQuantity: {},
editing: false,
rows: props.subscriptions.results,

Choose a reason for hiding this comment

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

'subscriptions.results' is missing in props validation react/prop-types

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.

Initial review is mainly nitpicks. I will look at the code in more depth for my next review.

I am, however, getting the following webpack compilation errors which prevent me from testing:

02:09:51 webpack.1 |        [0] ./node_modules/css-loader?sourceMap!./node_modules/sass-loader/lib/loader.js?sourceMap!../katello/webpack/scenes/Subscriptions/Subscriptions.scss 310 bytes {0} [built] [failed] [1 error]
02:09:51 webpack.1 |     
02:09:51 webpack.1 |     ERROR in ./node_modules/css-loader?sourceMap!./node_modules/sass-loader/lib/loader.js?sourceMap!../katello/webpack/scenes/Subscriptions/Subscriptions.scss
02:09:51 webpack.1 |     Module build failed: 
02:09:51 webpack.1 |     @import '~patternfly-react/dist/sass/inline-edit';
02:09:51 webpack.1 |     ^
02:09:51 webpack.1 |           File to import not found or unreadable: ~patternfly-react/dist/sass/inline-edit.
02:09:51 webpack.1 |     Parent style sheet: stdin
02:09:51 webpack.1 |           in /home/vagrant/katello/webpack/scenes/Subscriptions/Subscriptions.scss (line 2, column 1)
02:09:51 webpack.1 | Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js?sourceMap!node_modules/sass-loader/lib/loader.js?sourceMap!../katello/webpack/scenes/Subscriptions/Subscriptions.scss:
02:09:51 webpack.1 |        [0] ./node_modules/css-loader?sourceMap!./node_modules/sass-loader/lib/loader.js?sourceMap!../katello/webpack/scenes/Subscriptions/Subscriptions.scss 310 bytes {0} [built] [failed] [1 error]
02:09:51 webpack.1 |     
02:09:51 webpack.1 |     ERROR in ./node_modules/css-loader?sourceMap!./node_modules/sass-loader/lib/loader.js?sourceMap!../katello/webpack/scenes/Subscriptions/Subscriptions.scss
02:09:51 webpack.1 |     Module build failed: 
02:09:51 webpack.1 |     @import '~patternfly-react/dist/sass/inline-edit';
02:09:51 webpack.1 |     ^
02:09:51 webpack.1 |           File to import not found or unreadable: ~patternfly-react/dist/sass/inline-edit.
02:09:51 webpack.1 |     Parent style sheet: stdin
02:09:51 webpack.1 |           in /home/vagrant/katello/webpack/scenes/Subscriptions/Subscriptions.scss (line 2, column 1)
02:09:51 webpack.1 | webpack: Failed to compile.

.eslintrc Outdated
@@ -15,6 +15,7 @@
"react"
],
"rules": {
"no-console": "off",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to allow console statements?

Copy link
Member Author

Choose a reason for hiding this comment

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

I often use console logs for development. I can put it back if you prefer to keep it disabled.

Copy link
Contributor

@waldenraines waldenraines Apr 18, 2018

Choose a reason for hiding this comment

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

I do too but I prefer to keep it disabled to avoid accidentally merging the many console.log("WTF WHY ISN'T THIS WORKING?!?!?!?"); statements I often put into my code 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to keeping eslint checking for console statements, I also tend to leave them in my code and would like eslint to check for this

.editable {
background: none;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to put this into overrides.scss.

<ManageManifestModal showModal={this.state.manifestModalOpen} onClose={onModalClose} />

{ this.renderSubscriptionTable() }
<SubscriptionsTable
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice change here, thanks!

};

const buildTableRows = (subscriptions, updatedQuantity) =>
subscriptions.map((x) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on changing x to row or something else descriptive?

/>
{__('Max')}
{' '}
{additionalData.rowData.available}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: what about {[__('Max'), additionalData.rowData.available].join(' ')}?

@waldenraines
Copy link
Contributor

I am, however, getting the following webpack compilation errors which prevent me from testing:

Just realized that I forgot to install patternfly-react from patternfly/patternfly-react#240. After doing so I now get:

SubscriptionsTableSchema.js:6 Uncaught TypeError: _patternflyReact.Table.inlineEditFormatterFactory is not a function
    at inlineEditFormatter (SubscriptionsTableSchema.js:6)
    at columns (SubscriptionsTableSchema.js:138)
    at SubscriptionsTable.render (SubscriptionsTable.js:113)
    at finishClassComponent (react-dom.development.js:7873)
    at updateClassComponent (react-dom.development.js:7850)
    at beginWork (react-dom.development.js:8225)
    at performUnitOfWork (react-dom.development.js:10224)
    at workLoop (react-dom.development.js:10288)
    at HTMLUnknownElement.callCallback (react-dom.development.js:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:581)

But I'm not sure that I'm doing this correctly, I had to checkout your branch within node_modules and npm run build to build dist. Otherwise, if I just tried to npm install using your branch I ended up with no src or dist directories.

@jturel jturel self-assigned this Apr 18, 2018
@tstrachota
Copy link
Member Author

But I'm not sure that I'm doing this correctly

I have a checkout outside of node_modules where I ran npm build. Then I removed patternfly_rect from node_modules (in foreman checkout) and created a symlink to my_pf_react_checkout/dist. That worked for me.

{[__('Max'), additionalData.rowData.available].join(' ')}
</td>
);
}

Choose a reason for hiding this comment

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

Missing trailing comma comma-dangle

@waldenraines
Copy link
Contributor

waldenraines commented Apr 18, 2018

I have a checkout outside of node_modules where I ran npm build. Then I removed patternfly_rect from node_modules (in foreman checkout) and created a symlink to my_pf_react_checkout/dist. That worked for me.

If I symlink to my_pf_react_checkout/dist then how would this work?

@import '~patternfly/dist/sass/patternfly/variables';
@import '~patternfly-react/dist/sass/inline-edit';

In fact, I get this error:

Module build failed: ModuleBuildError: Module build failed:
14:43:26 rails.1   |  | @import '~patternfly-react/dist/sass/inline-edit';
14:43:26 rails.1   |  | ^
14:43:26 rails.1   |  |       File to import not found or unreadable: ~patternfly-react/dist/sass/inline-edit.
14:43:26 rails.1   |  | Parent style sheet: stdin
14:43:26 rails.1   |  |       in /home/vagrant/katello/webpack/scenes/Subscriptions/Subscriptions.scss (line 2, column 1)
14:43:26 rails.1   |  |     at runLoaders (/home/vagrant/foreman/node_modules/webpack/lib/NormalModule.js:195:19)
14:43:26 rails.1   |  |     at /home/vagrant/foreman/node_modules/loader-runner/lib/LoaderRunner.js:364:11
14:43:26 rails.1   |  |     at /home/vagrant/foreman/node_modules/loader-runner/lib/LoaderRunner.js:230:18
14:43:26 rails.1   |  |     at context.callback (/home/vagrant/foreman/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
14:43:26 rails.1   |  |     at Object.asyncSassJobQueue.push [as callback] (/home/vagrant/foreman/node_modules/sass-loader/lib/loader.js:55:13)
14:43:26 rails.1   |  |     at Object.done [as callback] (/home/vagrant/foreman/node_modules/neo-async/async.js:7921:18)
14:43:26 rails.1   |  |     at options.error (/home/vagrant/foreman/node_modules/node-sass/lib/index.js:294:32)
14:43:26 rails.1   |  |  @ ../katello/webpack/scenes/Subscriptions/Subscriptions.scss
14:43:26 rails.1   |  |  @ ../katello/webpack/scenes/Subscriptions/index.js
14:43:26 rails.1   |  |  @ ../katello/webpack/redux/reducers/index.js
14:43:26 rails.1   |  |  @ ../katello/webpack/redux/index.js
14:43:26 rails.1   |  |  @ ../katello/webpack/index.js
14:43:26 rails.1   |  |  @ multi (webpack)-dev-server/client?http://0.0.0.0:3808 webpack/hot/dev-server ../katello/webpack/index.js):

And if I symlink to my_pf_react_checkout/ then I get the same JS error as mentioned above.

@tstrachota
Copy link
Member Author

@waldenraines my bad, you're right. I removed just the dist directory and symlinked it to my local checkout's dist.

@waldenraines
Copy link
Contributor

waldenraines commented Apr 18, 2018

@waldenraines my bad, you're right. I removed just the dist directory and symlinked it to my local checkout's dist.

I did this (although it should be the exact same as symlinking the entire my_pf_react_checkout/ directory) and I still get the above JS error.

And just to prove that inlineEditFormatterFactory is included:

[vagrant@centos7-devel patternfly-react]$ grep -r inlineEditFormatterFactory dist/
dist/js/components/Table/Formatters/inlineEditFormatterFactory.js:var inlineEditFormatterFactory = function inlineEditFormatterFactory() {
dist/js/components/Table/Formatters/inlineEditFormatterFactory.js:exports.default = inlineEditFormatterFactory;
dist/js/components/Table/index.js:exports.TABLE_SORT_DIRECTIONS = exports.TABLE_SORT_DIRECTION = exports.TABLE_ALIGNMENT_TYPES = exports.TABLE_ALIGN = exports.TableSelectionHeading = exports.TableSelectionCell = exports.TableInlineEditHeaderRow = exports.TableInlineEditRow = exports.TablePfProvider = exports.TableHeading = exports.TableDropdownKebab = exports.TableCheckbox = exports.TableCell = exports.TableButton = e;
dist/js/components/Table/index.js:var _inlineEditFormatterFactory = require('./Formatters/inlineEditFormatterFactory');
dist/js/components/Table/index.js:var _inlineEditFormatterFactory2 = _interopRequireDefault(_inlineEditFormatterFactory);
dist/js/components/Table/index.js:_Table.Table.inlineEditFormatterFactory = _inlineEditFormatterFactory2.default;
dist/js/components/Table/index.js:exports.inlineEditFormatterFactory = _inlineEditFormatterFactory2.default;

@waldenraines
Copy link
Contributor

I did this (although it should be the exact same as symlinking the entire my_pf_react_checkout/ directory) and I still get the above JS error.

My mistake, I symlinked to katello/node_modules instead of foreman/node_modules.

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 had a chance to test this out and it works for the most part, nice 👍 Here are some issues I found:

  • There are no errors if you set the number of entitlements to below the max or to an invalid value ("asfhgsdh", for example)
  • I'm seeing -1 entitlements for custom products. I assume we should so "Unlimited" in this case, but will need to confirm
  • Sometimes upon editing an entitlement amount I am seeing it revert to the previous value. It's usually the first time I edit a value that I am seeing this.
  • I'm seeing emptyState upon initial load even though I have subscription results in the API response. Once I go to the Add Subscriptions page and then back it loads correctly.
  • I get a JS error when going to the next page after editing a subscription:
SubscriptionsTable.js:88 Uncaught TypeError: Cannot read property 'quantity' of undefined
    at Object.hasChanged (SubscriptionsTable.js:88)
    at renderEdit (SubscriptionsTableSchema.js:35)
    at InlineEdit (InlineEdit.js:21)
    at mountIndeterminateComponent (react-dom.development.js:8032)
    at beginWork (react-dom.development.js:8221)
    at performUnitOfWork (react-dom.development.js:10224)
    at workLoop (react-dom.development.js:10288)
    at HTMLUnknownElement.callCallback (react-dom.development.js:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:581)
    at invokeGuardedCallback (react-dom.development.js:438)

{[
__('Max'),
additionalData.rowData.available,
].join(' ')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Odd formatting here.

@tstrachota
Copy link
Member Author

Updated:

  • bumps patternfly-react dependency to a version that contains inline edit components
  • loading available quantities
  • added confirmation modal windows
  • more tests

We might need to update patternfly-react to ^2.1.0 in foreman as well, I'm not sure.

Known issues:

  • The confirm button on the table isn't disabled when there are no changes or some validation errors. It will require additional PR into patternfly-react (my bad) so I'd prefer to fix it separately.
  • The overlay progressbar for running tasks is still missing. I prefer to fix it separately too.

Additional comments:
@Rohoover I wasn't sure how to display validation messages for the inline edits. I added a tooltip on hover when there's an error but I'm afraid it's a new concept we don't use anywhere else. Please let me know if it's ok or if there's better way.
screenshot from 2018-04-24 17-03-58

@waldenraines I fixed the validations. Reverting to the previous values right after confirmation should be fixed once we introduce the overlay progressbar for running tasks. It's expected behavior at the moment.
Unfortunately I wasn't able to reproduce any of the other issues you reported. Can you please re-test with the updated version and provide snapshots of the redux state if they persist?

@tstrachota tstrachota changed the title WIP: Fixes #22734 - Add ability to edit RH Subscription entitlements Fixes #22734 - Add ability to edit RH Subscription entitlements Apr 24, 2018
Copy link

@Rohoover Rohoover left a comment

Choose a reason for hiding this comment

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

@tstrachota

Inline validation occurs below the form field:
http://www.patternfly.org/pattern-library/forms-and-controls/inline-edit/#design

You are correct that the tooltip for inline editing errors would be out of standard. Technically the "Max 500" being red is correct.

@waldenraines
Copy link
Contributor

We might need to update patternfly-react to ^2.1.0 in foreman as well, I'm not sure.

We will need to do that, and have the rpm built as well.

The confirm button on the table isn't disabled when there are no changes or some validation errors. It will require additional PR into patternfly-react (my bad) so I'd prefer to fix it separately.

Works for me.

The overlay progressbar for running tasks is still missing. I prefer to fix it separately too.

👍

I'm copying the list from my previous comment here. Will check off the items that I can no longer reproduce after I'm unblocked in testing by this first issue.

  • When I try to edit a subscription I get this JS error that is preventing me from testing further "Katello::Resources::Candlepin::Product: 404 Not Found {"displayMessage":"Product with ID '2f9da13741754e4386b2f1c9156cd157' could not be found.","requestUuid":"867b21de-946b-4191-8adf-6a35c0dafa33"} (GET /candlepin/owners/Default_Organization/products/2f9da13741754e4386b2f1c9156cd157/?)" . This is due to a backend error but we need to handle it better.
  • There are no errors if you set the number of entitlements to below the max or to an invalid value ("asfhgsdh", for example)
  • I'm seeing -1 entitlements for custom products. I assume we should so "Unlimited" in this case, but will need to confirm
  • Sometimes upon editing an entitlement amount I am seeing it revert to the previous value. It's usually the first time I edit a value that I am seeing this.
  • I'm seeing emptyState upon initial load even though I have subscription results in the API response. Once I go to the Add Subscriptions page and then back it loads correctly.
  • I get a JS error when going to the next page after editing a subscription:
SubscriptionsTable.js:88 Uncaught TypeError: Cannot read property 'quantity' of undefined
    at Object.hasChanged (SubscriptionsTable.js:88)
    at renderEdit (SubscriptionsTableSchema.js:35)
    at InlineEdit (InlineEdit.js:21)
    at mountIndeterminateComponent (react-dom.development.js:8032)
    at beginWork (react-dom.development.js:8221)
    at performUnitOfWork (react-dom.development.js:10224)
    at workLoop (react-dom.development.js:10288)
    at HTMLUnknownElement.callCallback (react-dom.development.js:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:581)
    at invokeGuardedCallback (react-dom.development.js:438)

{paginationComponent}
</div>
);
}
}
}
export default Table;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to export default Table if you are doing export class Table above?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not necessarily. I just tend to always add a default export if there's some "main" component in the module.

@johnpmitsch
Copy link
Contributor

Getting this error while viewing the page

EntitlementsInlineEditFormatter.js:38 Uncaught TypeError: _patternflyReact.Table.inlineEditFormatterFactory is not a function
    at entitlementsInlineEditFormatter (EntitlementsInlineEditFormatter.js:38)
    at columns (SubscriptionsTableSchema.js:101)
    at SubscriptionsTable.render (SubscriptionsTable.js:164)
    at finishClassComponent (react-dom.development.js:8389)
    at updateClassComponent (react-dom.development.js:8357)
    at beginWork (react-dom.development.js:8982)
    at performUnitOfWork (react-dom.development.js:11814)
    at workLoop (react-dom.development.js:11843)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)

hover
columns={columns}
{...otherProps}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to not repeat PfTable.PfProvider in this if/else? Asking as I will have to add to it and doing so will duplicate more code

@tstrachota
Copy link
Member Author

@johnpmitsch it now depends on theforeman/foreman#5514

@waldenraines could you describe when you see the Katello::Resources::Candlepin::Product: 404 Not Found error little closer? I couldn't reproduce it. Is the issue already tracked somewhere else?

@waldenraines
Copy link
Contributor

waldenraines commented May 1, 2018

@waldenraines could you describe when you see the Katello::Resources::Candlepin::Product: 404 Not Found error little closer? I couldn't reproduce it. Is the issue already tracked somewhere else?

I see that when attempting to edit any subscription. I have not filed an issue for this but we can if you would prefer to address this issue outside of this PR.

title={__('Editing Entitlements')}
dangerouslySetInnerHTML={{
__html: sprintf(
__("You're making changes to %(entitlementCount)s entitlements"),
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick make this entitlement(s)

@johnpmitsch
Copy link
Contributor

@tstrachota This worked well and code looks good. 👍 There are a few small comments/questions that still need to be addressed.

@johnpmitsch
Copy link
Contributor

I can submit a value larger than the max allowed (even if the text box is red and displaying a validation error). Shouldn't the submit check be disabled when the quantity is higher than the max?

Copy link

@Rohoover Rohoover left a comment

Choose a reason for hiding this comment

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

I think that is a possible option, or we keep throwing them an error every time they enter a number larger the max.

@johnpmitsch
Copy link
Contributor

error is fine, as long as it's handled before the task is kicked off

@@ -0,0 +1,40 @@
import React from 'react';
import { shallow, mount } from 'enzyme';

Choose a reason for hiding this comment

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

'mount' is defined but never used no-unused-vars

@tstrachota
Copy link
Member Author

Updated:

  • Added error handling:
    screenshot from 2018-05-03 15-18-26
  • Validation messages are below inputs:
    screenshot from 2018-05-03 15-15-56
  • Added a message dialog as a temporary solution that prevents from sending changes when there are validation errors (the ultimate solution is to disable the confirm button, but that needs changes in pf-react).
    screenshot from 2018-05-03 15-15-32

Following should be fixed as a separate issues (and I still need to create redmine tickets for that):

  • Inline edit header row should be able to disable buttons.
  • Overlay progress bar when some task is running.
  • Server side error while fetching available quantities should just hide them but not block editing.

Notes after rebase:
I removed customHeaderFormattersDefinition from the common Table component. Table now propagates props to the provider, so it can be easily customized on case-by-case basis. I think that we should avoid using customHeaderFormattersDefinition because it bypasses the reactabular's formatter design. Instead we should use our custom formatters similar to ones that @johnpmitsch adds in his PR mentioned above.

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.

Really nice work overall!

A few issues I'm seeing:

  • I still get the empty state sometimes when I first visit the page.
  • The first time I edit any entitlements I get a spinner that spins forever until I cancel the edit and try it again. The 2nd time after the page is loaded it works.
  • Hitting tab within an entitlement input field doesn't tab me to the next field.
  • For the error handling do we want to show the inline alert or should we create toast notifications for these errors instead? @Rohoover any input on this?
  • I don't see the validation error dialog or message when validation errors are triggered. Instead it just submits the request.

I am fine if you want to fix these after the fact or within this PR, it's up to you.

<div
onClick={() => inlineEditController.onActivate(additionalData)}
onKeyPress={(e) => {
if (e.key === 'Enter') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a safe way to do this? I thought you had to use onKeyDown() and e.charCode or e.keyCode.


export const SUBSCRIPTIONS_QUANTITIES_REQUEST = 'SUBSCRIPTIONS_QUANTITIES_REQUEST';
export const SUBSCRIPTIONS_QUANTITIES_SUCCESS = 'SUBSCRIPTIONS_QUANTITIES_SUCCESS';
export const SUBSCRIPTIONS_QUANTITIES_FAILURE = 'SUBSCRIPTIONS_QUANTITIES_FAILURE';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the task generated by these actions be added to the list of blocking task types below?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. The action runs on background so there's no need to block the UI for users. If the start editing prior to successful fetch a spinner is displayed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant to put this comment under the update actions. I mean that we need to add Actions::Katello::UpstreamSubscriptions::UpdateEntitlement to the list of BLOCKING_FOREMAN_TASK_TYPES below so that the buttons are disabled correctly when this task is in progress.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense. I didn't understand it first. Updated.

@@ -30,55 +27,10 @@ class SubscriptionsPage extends Component {
type: 'all',
active_only: true,
action_types: BLOCKING_FOREMAN_TASK_TYPES,
}, 10000);
}, 99999999999);
Copy link
Contributor

Choose a reason for hiding this comment

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

Intentional? See also http://projects.theforeman.org/issues/23475 which deals with coming up with a smarter way to poll for these tasks.

@tstrachota
Copy link
Member Author

Updated

  • I still get the empty state sometimes when I first visit the page.
  • The first time I edit any entitlements I get a spinner that spins forever until I cancel the edit and try it again. The 2nd time after the page is loaded it works.

I'll deal with it separately. Since I couldn't reproduce it, would you mind reporting the issues? I guess that you'll be able to provide closer details like snapshots of the redux state and better description than me.

  • Hitting tab within an entitlement input field doesn't tab me to the next field.

This one is difficult to fix. Reactabular calls createComponent for cells on each table render/state change. So when we update the state on blur, new inputs are created and the browser resets the current tab index. I wasn't able to reliably work it around. We'll need to fix reactabular first.

  • I don't see the validation error dialog or message when validation errors are triggered. Instead it just submits the request.

Fixed. There was an issue in the validation methods. I added some tests for it.

Copy link

@Rohoover Rohoover left a comment

Choose a reason for hiding this comment

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

@waldenraines I'm not sure the inline is needed when there are no subscriptions to view. That's not really an error, it's just an empty state.

For errors on the form, I'm debating whether we're good with just for the form handling since the toast disappears and inline messages tend to cause complaints of content shifting.

@waldenraines
Copy link
Contributor

waldenraines commented May 4, 2018

Fixed. There was an issue in the validation methods. I added some tests for it.

Now I can't save any field, I always get the validation error dialog even if there is no validation error.

@tstrachota
Copy link
Member Author

I always get the validation error dialog even if there is no validation error.

Oops, I forgot to exclude custom subscriptions from the validation. I'm sorry for that. Try now, please.

@waldenraines
Copy link
Contributor

I still get the empty state sometimes when I first visit the page.
The first time I edit any entitlements I get a spinner that spins forever until I cancel the edit and try it again. The 2nd time after the page is loaded it works.

These issues went away after I blew away node_modules/ in both foreman and katello and did a fresh npm install.

@waldenraines waldenraines merged commit e66857d into Katello:master May 7, 2018
@johnpmitsch
Copy link
Contributor

Even though this was merged, for this modal, I think we should say, "Do you want to cancel without saving your changes" to make it extra clear that you are cancelling the form. "continue" makes me second guess that its going to submit.
sub

@johnpmitsch
Copy link
Contributor

I'm just realizing there is a "Cancel" button as well, maybe have "Yes" and "No" for the buttons? @Rohoover how does this sound to 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.

7 participants