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

Form to add an App Repository #1954

Merged
merged 4 commits into from Aug 21, 2020
Merged

Form to add an App Repository #1954

merged 4 commits into from Aug 21, 2020

Conversation

andresmgot
Copy link
Contributor

Description of the change

AppRepositoryForm and AppRepoAddDockerCreds:

Screenshot from 2020-08-20 13-09-53

Screenshot from 2020-08-20 17-43-12

Possible drawbacks

Still need to debug a weird issue in which the docker-registry form causes a re-render of the AppList, closing the modal with all the form. Note that this issue is already present in the current UI.

Applicable issues

const password = "pass";
const email = "foo@bar.com";
const server = "docker.io";
// wrapper.setState({ secretName, user, password, email, server, showSecretSubForm: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

Left-over from checking whether setState can work, or is this documenting the intention of the following code? (If so, how about preceding with

// The following 6 `wrapper` calls effectively the same as
// wrapper.setState({ secretName, user, password, email, server, showSecretSubForm: true });

or even just pulling the code out into a func setState() just in this module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, left-over yes, forgot to remove.

padding: 0.6rem;
background-color: var(--clr-color-neutral-100);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised we're needing so much customization of the styles? Can any of this be generalized across the app? (not now)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this component was interesting. Since it was rendered in two places: the header as a result of the "Add repository button" and a table as a result of the "Edit" button, it inherited different style depending on its position (that's why this component is slightly larger, to define every style).

Regarding generalization, it's complex, we could move some things but we risk that we are missing some case in which the style change affects something unexpected (has happened to me before). It has to be very similar components to do so, for example, I have in my TODOs to generalize the state of headers (Applications, Catalog, App Repositories...) which are right now defined one by one.

<Alert theme="danger">
Found an error updating the repositories: {errors.update.message}
</Alert>
)}
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 not clear why this is being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error was already being shown in the AppRepoForm so it was duplicated.

@@ -21,6 +22,9 @@ const Modal = ({
staticBackdrop,
}) => {
const onClose = () => onModalClose();
// Control when users click outside
const ref = useRef(null);
useOutsideClick(onClose, [ref], showModal);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why we need to create a ref here, I guess it's tricky to document it with a test, but maybe useful link to more info, or just a bit more in the above comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, I should have added a test. The problem is that usually a Modal gets closed when you click outside of it (at least that's how react-modal behaves). But in this case, it was not possible to be closed unless specifically implementing a button for it (each time you use it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually this change is not needed, found out that there is a parameter for this: staticBackdrop. It was no clear what that was for.

@andresmgot andresmgot merged commit 024cb3b into master Aug 21, 2020
alexandredantas pushed a commit to alexandredantas/kubeapps that referenced this pull request Aug 26, 2020
@andresmgot andresmgot deleted the appRepoForm branch September 8, 2020 08:57
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.

None yet

2 participants