-
Notifications
You must be signed in to change notification settings - Fork 3
Support Pausing #5
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
Conversation
| * | ||
| * @param {Event} event | ||
| */ | ||
| debounceInput(event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debouncing of input isn't needed
| * | ||
| * @param {Event} event | ||
| */ | ||
| debounceChange(event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debouncing of change isn't needed
| export default Controller.extend(ActionMixin, ObjectQueryManager, { | ||
| isActive: computed.not('model.paused'), | ||
| isPausedDisabled: computed('isActionRunning', 'model.status', function() { | ||
| if (this.get('isActionRunning')) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling of the switch should just use disabled={{isActionRunning}} in the template... or, rather, the autosave switch component should disable itself when running. Then you do not need to use this
| /** | ||
| * | ||
| */ | ||
| async pause() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should take the value directly as an argument, and not use the bound value
| import pauseLineItem from '@base-cms/parcel-plug-manage/gql/mutations/lineitem/pause'; | ||
|
|
||
| export default Controller.extend(ObjectQueryManager, ActionMixin, { | ||
| isActive: computed.not('model.paused'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not an isActive() method on the model schema... perhaps make this a graph field and use instead of a computed property
| /** | ||
| * | ||
| */ | ||
| async pause() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use the value directly as an arg, instead of the mode value
| * The number of milliseconds to debounce the | ||
| * change event by when typing. | ||
| */ | ||
| typeDelay: 750, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type delay can be removed
| try { | ||
| await this.get('apollo').mutate({ mutation, variables }, 'pauseAd'); | ||
| } catch (e) { | ||
| this.get('graphErrors').show(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should throw the error so the form component can handle it as a validation error message
| try { | ||
| await this.get('apollo').mutate({ mutation, variables }, 'pauseLineItem'); | ||
| } catch (e) { | ||
| this.get('graphErrors').show(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should throw the error so the form component can handle it as a validation error message
| this.get('graphErrors').show(e); | ||
| } finally { | ||
| this.endAction(); | ||
| this.set('isPausing', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isPausing would not be necessary if you make the switch auto save component disable itself on save
|
@solocommand I know it's annoying, but can you manually add a class to the switch and add custom css to make it the same height/width of the regular input elements? |
| * | ||
| * @param {Event} event | ||
| */ | ||
| debounceChange({ target }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debounce change can be removed still :)
| <div class="custom-control custom-switch"> | ||
| {{yield | ||
| (hash | ||
| element=(component "form-elements/input" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use the form-elements/checkbox component?
|
|
||
| validator=validator | ||
| on-insert=(action "setChildInputComponent") | ||
| change=(action "debounceChange") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change can fire the sendOnChange directly
|
@solocommand I added a few more comments yesterday... just wanted to check if still had any changes to push, or if I should just merge? |


Support pausing for line items and ads