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

removed isLoading #804

Merged
merged 4 commits into from
Oct 18, 2021
Merged

removed isLoading #804

merged 4 commits into from
Oct 18, 2021

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Oct 11, 2021

These changes close #783

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Deleted tests for removed functionality.
  • No change log entry required - invisible to users.
  • No documentation update required.

@wxtim wxtim requested review from kinow and oliver-sanders October 11, 2021 10:26
@wxtim wxtim self-assigned this Oct 11, 2021
@wxtim wxtim added the small label Oct 11, 2021
@wxtim wxtim marked this pull request as draft October 11, 2021 11:01
Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

@wxtim I think this is almost ready to be merged. But only the Vuex store isLoading needs to go. The isLoading from other views and components stay (they replaced the global state from the Vuex store.)

Thanks @wxtim !

src/components/cylc/gscan/GScan.vue Outdated Show resolved Hide resolved
src/mixins/subscription.js Outdated Show resolved Hide resolved
src/store/options.js Show resolved Hide resolved
src/views/Dashboard.vue Outdated Show resolved Hide resolved
src/views/Workflow.vue Outdated Show resolved Hide resolved
src/views/WorkflowsTable.vue Outdated Show resolved Hide resolved
tests/unit/components/cylc/gscan/gscan.vue.spec.js Outdated Show resolved Hide resolved
tests/unit/mixins/subscription.spec.js Outdated Show resolved Hide resolved
@wxtim wxtim force-pushed the removed.isLoading branch from 54f337c to e70321c Compare October 12, 2021 18:58
@wxtim wxtim marked this pull request as ready for review October 12, 2021 18:59
@wxtim wxtim requested a review from kinow October 12, 2021 18:59
@wxtim
Copy link
Member Author

wxtim commented Oct 12, 2021

@kinow - I don't exactly what hours you keep relative to your time zone, but I wouldn't mind a quick chat if this isn't it. It doesn't seem like much. I head for bed about 10.

Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

Hi @wxtim ! I started working a bit later this morning 😪 sorry. See my review comments, I think you are nearly there in this PR. I've pointed what needs to be removed, if you could amend this PR once more (sorry!), then it should be ready for review+merge.

Since you are modifying the Vuex store here too, you may find interesting reading just the first paragraphs of the Vuex docs for mutations and for actions (you can ignore the rest, but just so the distinction of action & mutation in Vuex is clear 😬 )

/**
* Whether the application is loading or not.
*/
isLoading: false,
/**
Copy link
Member

Choose a reason for hiding this comment

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

Ah, you had it right before in this file, sorry the confusion. There is an action1 (setLoading({ commit} ...)), and a mutation2 (SET_LOADING(state, ...)3) in this file that can be deleted too.

Footnotes

  1. an action is asynchronous

  2. a mutation is synchronous

  3. we started implementing both always, but in some cases we don't need an async action, it's useful when you have a request that takes a long time and you don't want to block the UI; also actions are camel-case, and mutations upper-case by convention

Copy link
Member

Choose a reason for hiding this comment

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

Then you also need to delete the tests for the store state isLoading, see tests/unit/store.index.spec.js. They are grouped under the describe('isLoading'). They can be deleted.

And in src/plugins/axios.js, remove store.dispatch('setLoading', ...)1 too.

After that the PR should be ready to be merged 🎉

Footnotes

  1. you dispatch a Vuex action (async), and commit a Vuex mutation (sync, blocking)
    After that this PR should be ready to be merged 🎉

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what I thought I needed to do, but the UI didn't work for me after I did it. 😞

Copy link
Member

Choose a reason for hiding this comment

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

Oh, interesting. Were there any errors in the browser console, or in the terminal where you were running yarn run serve or yarn run build:watch?

Copy link
Member

@kinow kinow Oct 13, 2021

Choose a reason for hiding this comment

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

After quickly peeking at the last commit, @wxtim , I think this one is missing?

And in src/plugins/axios.js, remove store.dispatch('setLoading', ...) lines too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. Works now.

Copy link
Member Author

@wxtim wxtim Oct 13, 2021

Choose a reason for hiding this comment

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

Massive thanks for holding my hand through that one. Main learning point - just bc it's a new language don't forget all the lessons you've learned in Python about reading traceback carefully.

@kinow Do you have an opinion on the Google Javascript style guide? @matthewrmshin suggested the Google Bash style guide as useful reading when I asked for a Bash opposite number to PEP8 - would that work here?

Is the code in axios.js actually doing anything now? It looks to me like it's intercepting requests and responses and doing nowt. Am I right? Is this now just form code that the Axios plugin requires? Does Axios do stuff by default?

Copy link
Member

Choose a reason for hiding this comment

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

Massive thanks for holding my hand through that one. Main learning point - just bc it's a new language don't forget all the lessons you've learned in Python about reading traceback carefully.

Don't mention it. Thanks for volunteering to work on this issue!

@kinow Do you have an opinion on the Google Javascript style guide? @matthewrmshin suggested the Google Bash style guide as useful reading when I asked for a Bash opposite number to PEP8 - would that work here?

I tried a few different styles for JavaScript, but what I looked were eslint shareable configurations (or style guides). I remember reading the Airbnb rules, but never checked the Google rules (I think they must be following the Google Javascript style you mentioned.)

We extend three rules, and apply a few more here. If there are things you think would improve readability/maintainability, we would probably start by customizing these rules or adopting other style guides, so our CI can verify them (IDE's/editors normally integrate with these style guides too.)

eslint is executed in our CI, see package.json for the yarn run lint script.

Is the code in axios.js actually doing anything now? It looks to me like it's intercepting requests and responses and doing nowt. Am I right?

You are right! Good catch! It was intercepting HTTP requests done with Axios (e.g. the HTTP request to Jupyter{Hub|Server} to fetch the user data). Looks like we can actually ditch the axios plug-in. Feel free to update this PR for that, or if you prefer we can start a separate PR or just create an issue. Up to you :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like we can actually ditch the axios plug-in.

Done

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2021

Codecov Report

Merging #804 (700d6a6) into master (bc7f5ff) will increase coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #804      +/-   ##
==========================================
+ Coverage   90.96%   91.10%   +0.13%     
==========================================
  Files          84       86       +2     
  Lines        1672     1686      +14     
  Branches      105      105              
==========================================
+ Hits         1521     1536      +15     
+ Misses        121      120       -1     
  Partials       30       30              
Flag Coverage Δ
e2e 79.06% <ø> (+1.25%) ⬆️
unittests 77.95% <ø> (-3.68%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/store/options.js 100.00% <ø> (ø)
src/components/cylc/gscan/deltas.js 83.33% <0.00%> (-16.67%) ⬇️
src/services/workflow.service.js 93.13% <0.00%> (-0.99%) ⬇️
src/views/Tree.vue 100.00% <0.00%> (ø)
src/views/Dashboard.vue 100.00% <0.00%> (ø)
src/model/Subscription.model.js 100.00% <0.00%> (ø)
src/components/cylc/tree/deltas.js 100.00% <0.00%> (ø)
src/components/cylc/gscan/GScan.vue 90.62% <0.00%> (ø)
src/model/SubscriptionQuery.model.js 100.00% <0.00%> (ø)
src/components/cylc/workflow/deltas.js
... and 5 more

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 bc7f5ff...700d6a6. Read the comment docs.

@wxtim wxtim requested a review from kinow October 13, 2021 08:19
Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

See my last comment on the axios.js plug-in @wxtim . Let me know if you'd like to update this one, or if we should merge it and later have another issue/PR.

@wxtim wxtim requested a review from datamel October 13, 2021 09:04
Copy link
Contributor

@datamel datamel left a comment

Choose a reason for hiding this comment

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

Built and working as expected. I have worked through the remaining isLoading code, with the comments from @kinow I am happy they should remain. I have also run tests locally. Thanks @wxtim!

@datamel datamel merged commit c065835 into cylc:master Oct 18, 2021
@MetRonnie MetRonnie added this to the 0.6.0 milestone Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove isLoading state & related action/mutation from Vuex
5 participants