-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: handle connected services in the admin panel #3329
Conversation
You can access the deployment of this PR at https://renku-ci-ui-3329.dev.renku.ch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about the API.
* Finish the component to add a new service. * Polish the card to show existing services. * Add the delete button.
7e530cd
to
13bfef7
Compare
@leafty Thank you for the early review. I incorporated your suggestions and finished the PR. P.S. Sorry for rebasing; I changed the target branch to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update form does not work for the client secret. If the value is not changed, then do not send the field to the API. Also, do not populate the value with redacted
.
Note that this is a blocker for the PR. We cannot have admins break connected services by just updating the display name for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1aef2c3
* Add provider button text * Connected serivces page button color * italics text
@leafty Thank you for the review. I applied your suggestions and fixed the problem with the client secret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, there is one change to do, see below:
useEffect(() => { | ||
if (!result.isSuccess) { | ||
return; | ||
} | ||
toggle(); | ||
}, [result.isSuccess, toggle]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also reset the form here. Otherwise the client secret
field is still populated when opening the form again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That shouldn't be necessary. After adding a new service, this invokes toggle()
so that the other useEffect
will trigger and invoke result.reset()
. I tried a few combinations to test this.
I can still add a reset here to be safe if you think there are cases that I might be missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, add a form reset()
in the useEffect()
just below then 😄 . The result.reset()
is for RTK Query. You also need to reset the form at the same time when you do a result.reset()
in almost all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I wrote result.reset()
but I meant reset()
from the other useEffect
. When you open the new modal, the previous client_secret
isn't there.
Anyway, adding a reset()
here still makes the code more readable (and it makes sense to reset immediately after the successful action) so I added it in d640d83.
control={control} | ||
name="client_secret" | ||
render={({ field }) => ( | ||
<Input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this field could be of type password
with the button to toggle it to text
like we have for some other hidden values. You can push that to a new issue if you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense; I was undecided whether to use text or password here, but since you also mentioned this I'll switch to password
-- no need for another PR 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in ae36898
@leafty I implemented your second batch of suggestions; thanks for taking the time to go through the PR again. That helps in reducing the follow-up fixes/improvements :D I noticed that IDs with spaces are accepted, but editing/deleting those services triggers errors. Any idea what could be wrong? |
This is a bug with the backend, I will have to fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks
Tearing down the temporary RenkuLab deplyoment for this PR. |
Handle connected services in the admin panel.
/deploy