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

Add a isUniqueValuesLoading key to columns in the vuex state #499

Merged
merged 5 commits into from
Apr 21, 2020

Conversation

zegonz
Copy link
Contributor

@zegonz zegonz commented Apr 7, 2020

state.dataset.headers contains elements like:
Before: {name: 'col1', type: 'number'}
Now: {name: 'col1', type: 'number', isUniqueValuesLoading: false}
Also, add the corresponding getter and mutation

Please read commit by commit.

ezgif com-optimize

NB:
This PR also fix story of DataViewer and remove the broken story of RenameStep. An issue has been written to create stories for the form steps: #501

@zegonz zegonz added enhancement New feature or request need review labels Apr 7, 2020
@zegonz zegonz force-pushed the f/change-isloading-state branch 2 times, most recently from 7723379 to ca9872d Compare April 7, 2020 14:04
@codecov
Copy link

codecov bot commented Apr 7, 2020

Codecov Report

Merging #499 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #499   +/-   ##
=======================================
  Coverage   97.77%   97.78%           
=======================================
  Files         128      128           
  Lines        2925     2933    +8     
  Branches      410      410           
=======================================
+ Hits         2860     2868    +8     
  Misses         65       65           
Impacted Files Coverage Δ
src/components/ListUniqueValues.vue 100.00% <100.00%> (ø)
src/store/getters.ts 95.12% <100.00%> (+0.25%) ⬆️
src/store/mutations.ts 96.73% <100.00%> (+0.14%) ⬆️

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 b9382df...d24ac3c. Read the comment docs.

@zegonz
Copy link
Contributor Author

zegonz commented Apr 7, 2020

@davinov davinov changed the title change isloading state Multiple "loading" states Apr 7, 2020
@davinov
Copy link
Member

davinov commented Apr 7, 2020

I'm not that sure it's such a good idea to introduce an enumeration here.
Why not simply add a "areUniqueValuesLoading" boolean?

@rhuille
Copy link
Contributor

rhuille commented Apr 7, 2020

The idea is to limit the number of state properties and to keep inside the name loading the loading state.

@rhuille rhuille force-pushed the f/change-isloading-state branch from ca9872d to ab4db9f Compare April 8, 2020 08:36
@zegonz zegonz force-pushed the f/change-isloading-state branch from ab4db9f to bdbb3a1 Compare April 9, 2020 15:32
@rhuille rhuille force-pushed the f/change-isloading-state branch from bdbb3a1 to 2184c98 Compare April 9, 2020 16:06
@zegonz zegonz changed the title Multiple "loading" states Add "isUniqueValuesLoading" states Apr 10, 2020
@rhuille rhuille force-pushed the f/change-isloading-state branch 4 times, most recently from 46b80db to 09b18d0 Compare April 10, 2020 12:37
@zegonz zegonz force-pushed the f/change-isloading-state branch from 09b18d0 to 4b06e07 Compare April 10, 2020 14:18
@rhuille rhuille force-pushed the f/change-isloading-state branch 2 times, most recently from c3d7d57 to fd991cb Compare April 10, 2020 14:38
@rhuille rhuille changed the title Add "isUniqueValuesLoading" states @rhuille Add a isUniqueValuesLoading key to columns in the vuex state Apr 10, 2020
@rhuille rhuille changed the title @rhuille Add a isUniqueValuesLoading key to columns in the vuex state Add a isUniqueValuesLoading key to columns in the vuex state Apr 10, 2020
@rhuille rhuille force-pushed the f/change-isloading-state branch from fd991cb to 63ab186 Compare April 10, 2020 14:58
Comment on lines 294 to 298
state.dataset.headers[
state.dataset.headers.map(col => col.name).indexOf(column)
].isUniqueValuesLoading = isLoading;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
state.dataset.headers[
state.dataset.headers.map(col => col.name).indexOf(column)
].isUniqueValuesLoading = isLoading;
}
state.dataset.headers.find(hdr => hdr.name === column).isUniqueValuesLoading = isLoading;

src/lib/dataset/index.ts Outdated Show resolved Hide resolved
* helper that is True if unique values are loading
*/
isUniqueValuesLoading: (state: VQBState) => (column: string) =>
state.dataset.headers[state.dataset.headers.map(col => col.name).indexOf(column)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
state.dataset.headers[state.dataset.headers.map(col => col.name).indexOf(column)]
state.dataset.headers.find(hdr => hdr.name === column).isUniqueValuesLoading

@zegonz zegonz force-pushed the f/change-isloading-state branch from 4cde97d to 03ea30b Compare April 15, 2020 13:41
@zegonz
Copy link
Contributor Author

zegonz commented Apr 15, 2020

@adimasci I push changes you ask for, can you have a look please ?

]);
const wrapper = mount(PipelineComponent, { store, localVue });
wrapper.find('.query-pipeline-queue__dot').trigger('click');
await flushPromises();
Copy link
Contributor

@adimascio adimascio Apr 19, 2020

Choose a reason for hiding this comment

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

Genuine question: is there a reason why $nextTick() would not work here? Idem for other flushPromises() occurrences?

@rhuille rhuille force-pushed the f/change-isloading-state branch 2 times, most recently from afbd51e to 96ce88a Compare April 20, 2020 14:46
`state.dataset.headers` contains elements like:
Before: `{name: 'col1', type: 'number'}`
Now: `{name: 'col1', type: 'number', isUniqueValuesLoading: false}`
Also, add the corresponding getter and mutation
@rhuille rhuille force-pushed the f/change-isloading-state branch from 96ce88a to a2926c7 Compare April 20, 2020 15:08
* helper that is True if unique values are loading
*/
isUniqueValuesLoading: (state: VQBState) => (column: string) =>
(state.dataset.headers.find(hdr => hdr.name === column) as DataSetColumn).isUniqueValuesLoading,
Copy link
Contributor

@adimascio adimascio Apr 20, 2020

Choose a reason for hiding this comment

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

I'm surprised that the explicit type annotation is necessary 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

The column names are not explicitly listed for typescript. Consequently, the .find() method may return an undefined value...

const shallowMountWrapper = (
filterValue: string[] = ['France', 'Spain'],
operator: 'in' | 'nin' = 'in',
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 ?

Copy link
Contributor

@adimascio adimascio left a comment

Choose a reason for hiding this comment

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

Thanks for this work!

I've added 2 questions but I would be ok to merge the code as is.

raphael and others added 4 commits April 21, 2020 09:17
- Add a spinner when colunm unique values are loading
- Emit an event at click on "Load All Values" button
It must register `vqb` module and not setup directly the store
This fix allow us make the storybook of ListUniqueValues
form-renam-step is removed because it was not working since a long time, implementation of this step has changed a lot
@rhuille rhuille force-pushed the f/change-isloading-state branch from a2926c7 to d24ac3c Compare April 21, 2020 07:17
@rhuille rhuille merged commit 455b22f into master Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request need review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants