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

Deregister hosts list frontend #1601

Merged
merged 5 commits into from
Jul 11, 2023
Merged

Conversation

arbulu89
Copy link
Contributor

@arbulu89 arbulu89 commented Jul 6, 2023

Description

Add deregistration button and modal.
It includes a simple saga to handle this.
We need to add the same button in the host details view, with the unique different that when the call is successful, we should navigate to the host list.

deregister

Blocked by

#1599
#1587

How was this tested?

Tested

@arbulu89 arbulu89 added the enhancement New feature or request label Jul 6, 2023
@arbulu89 arbulu89 force-pushed the deregister-hosts-list-frontend branch 2 times, most recently from 7acda32 to 2ed1ec4 Compare July 6, 2023 16:01
@arbulu89 arbulu89 force-pushed the deregister-hosts-list-frontend branch from 2ed1ec4 to 98083f2 Compare July 10, 2023 07:36
@arbulu89 arbulu89 force-pushed the deregister-hosts-list-frontend branch from 98083f2 to 621fa21 Compare July 10, 2023 10:22
@arbulu89 arbulu89 force-pushed the deregister-hosts-list-frontend branch from 621fa21 to 7be678b Compare July 10, 2023 10:30
@arbulu89 arbulu89 marked this pull request as ready for review July 10, 2023 10:40
Copy link
Member

@nelsonkopliku nelsonkopliku left a comment

Choose a reason for hiding this comment

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

Cool! LGTM

return host;
});
},
setHostNotDeregistering: (state, action) => {
Copy link
Member

Choose a reason for hiding this comment

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

I have a doubt about naming. I would have thought of something that talks about starting a deregistration and completing a deregistration.
No hard feelings tho 😄

Copy link
Member

@CDimonaco CDimonaco left a comment

Choose a reason for hiding this comment

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

Lgtm, I left some comments, nitpicks but we could work on it

@@ -50,6 +53,8 @@ function HostsList() {
);

const [searchParams, setSearchParams] = useSearchParams();
const [cleanUpModalOpen, setCleanUpModalOpen] = useState(false);
const [selectedHost, setSelectedHost] = useState(undefined);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can rename the state property to hostToDeregister or something like that, selectedHost seems to generic

content && (
<CleanUpButton
cleaning={item.deregistering}
onClick={() => {
Copy link
Member

Choose a reason for hiding this comment

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

Can we extract this to a named function in the component?

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'm not a big fan of creating functions for such trivial things (2 lines in fact), as it forces the user to scroll up and down in the code, to find out such a simple thing.
Anyway, for the sake of a request and thumbs up, i will apply the change hehe

Copy link
Contributor Author

@arbulu89 arbulu89 Jul 11, 2023

Choose a reason for hiding this comment

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

@CDimonaco This is how it looks like now: 3614c2e

Personally, I find it uglier (specially, because the functions are still inside the component). What do you think?

<DeregistrationModal
hostname={selectedHost?.hostname}
isOpen={!!cleanUpModalOpen}
onCleanUp={() => {
Copy link
Member

Choose a reason for hiding this comment

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

Can we extract this to a named function in the component?

assets/js/state/sagas/hosts.test.js Show resolved Hide resolved
@CDimonaco
Copy link
Member

lgtm

@arbulu89 arbulu89 merged commit d545559 into main Jul 11, 2023
16 checks passed
@arbulu89 arbulu89 deleted the deregister-hosts-list-frontend branch July 11, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

4 participants