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

Loader components on applications and charts #644

Merged

Conversation

migmartri
Copy link
Contributor

@migmartri migmartri commented Sep 14, 2018

Closes #165

Adds loader components to the app view, deployment and upgrade components, as well as enhances the shared test scenarios.

NOTE: I have decided to go with without children because otherwise it will require quite a refactor in some cases like in the upgrade component.

peek 2018-09-14 15-54

@migmartri migmartri changed the title WIP Loader components on application show, deploy and upgrade Loader components on application view, deploy and upgrade Sep 14, 2018
beforeEach(() => {
props = { ...defaultProps, apps: { isFetching: true } };
});
context("while fetching apps", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the difference between context and describe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is just syntax sugar. I like using describe to mention the test subject and context to set scenarios.

It might now be worth adding the library that's why I did not load it globally, let me know if you'd prefer not to have it.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay, was just wondering if there was actually some difference, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

that module has been deprecated: https://www.npmjs.com/package/jest-context. If you want to add it apparently you should use "jest-plugins". In any case I don't think we should add it, as happened with @prydonius or myself, other people may be confused with the context usage. Also, in my opinion, we should try to use avoid using third-party modules if possible (to avoid possible vulnerabilities or license issues).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch @andresmgot.

Also, in my opinion, we should try to use avoid using third-party modules if possible (to avoid possible vulnerabilities or license issues).

This is tricky, because this single module is nothing compared to all the dependencies from our main components.

I do not see any license issue in this case since it is MIT.

In any case I don't think we should add it, as happened with @prydonius or myself, other people may be confused with the context usage.

What do you find confusing? Having two methods? This concept comes from rspec in which describe and context are used for different things. Context used to setup a context or scenario and describe to express the test subject.

I can remove it and use nested describes but honestly that looks odd and adding context helps with tests readability (at least for me). If you are strongly opinionated against it I can remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a minor thing, I know that in this case it's just a minor package with a single line. I am not against it so go ahead if you want to use it. I guess I am more used to see nested describes so I don't find it weird.


export default {
loadingSpecs,
export default (sharedExampleName: string, args: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

🆒

@prydonius prydonius mentioned this pull request Sep 14, 2018
Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

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

thanks! The loader looks great.


// Although LoadingWrapper checks that the app is loaded before loading this wrapper
// it seems that react renders it even before causing it to crash because app is null
// that's why we need to have an app && guard clause
Copy link
Contributor

Choose a reason for hiding this comment

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

(regarding the comment) isn't it better then to use in render?:

return isLoading ? <LoadingWrapper ... /> : {this.appInfo()}

I would find that easier to understand, what's the benefit of setting appInfo as children?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would find that easier to understand, what's the benefit of setting appInfo as children?

That's a good point. I can change that. There is not an actual benefit apart of you do not need to add logic to show one or the other. That said, the fact that I need to do app actually defuses the purpose.

beforeEach(() => {
props = { ...defaultProps, apps: { isFetching: true } };
});
context("while fetching apps", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

that module has been deprecated: https://www.npmjs.com/package/jest-context. If you want to add it apparently you should use "jest-plugins". In any case I don't think we should add it, as happened with @prydonius or myself, other people may be confused with the context usage. Also, in my opinion, we should try to use avoid using third-party modules if possible (to avoid possible vulnerabilities or license issues).

@migmartri migmartri changed the title Loader components on application view, deploy and upgrade Loader components on applications and charts Sep 17, 2018
@migmartri migmartri merged commit 226a8e2 into vmware-tanzu:master Sep 17, 2018
@migmartri migmartri deleted the 165-loader-component-applications branch September 17, 2018 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants