-
Notifications
You must be signed in to change notification settings - Fork 549
Add ssh public keys on user-profile page #5223
Conversation
@@ -0,0 +1,159 @@ | |||
// Copyright (c) Microsoft Corporation |
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.
Please use this header:
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
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.
Will modifiy it. And looks like that still have many files write that.
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, they are the old headers. We haven't modified them. This one is the new header.
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.
ok
</Hint> | ||
<Stack horizontal gap='l1'> | ||
<TextField | ||
Lable='Add additional ssh public key' |
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.
Please change ssh
to SSH
.
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.
ok
<Stack horizontal gap='l1'> | ||
<TextField | ||
Lable='Add additional ssh public key' | ||
placeholder='Additional ssh public key' |
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.
Please change ssh
to SSH
.
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.
ok
@@ -210,6 +250,29 @@ const UserProfile = () => { | |||
> | |||
<TokenList tokens={tokens} onRevoke={onRevokeToken} /> | |||
</UserProfileCard> | |||
<UserProfileCard |
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.
Please move this UserProfileCard of SSH Public Keys
before the UserProfileCard of Tokens
.
SSH is supposed to be used more frequently than tokens.
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.
ok
}} | ||
minWidth={400} | ||
> | ||
<div>Are you sure you want to delete this ssh key?</div> |
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.
Please change ssh
to SSH
.
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.
ok
if (title.trim() === '') { | ||
setInputTitleError('Please input title'); | ||
} else if (value.trim() === '') { | ||
setInputValueError('Please input ssk value'); |
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.
Please change ssk
to SSH
.
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.
ok
setInputTitleError('Please input title'); | ||
} else if (value.trim() === '') { | ||
setInputValueError('Please input ssk value'); | ||
} else { |
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.
Please validate the value
matches SSH key's format.
You can use this regex: /^ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3}.*$/
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
// click `add public ssh keys button` -> open dialog | ||
const onAddPublicKeys = useCallback(async sshPublicKeys => { | ||
setSSHProcessing(true); | ||
let updatedSSHPublickeys = []; |
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.
Please validate here: the user cannot add ssh keys with duplicate titles. (Title should be unique for one user)
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
} | ||
updatedSSHPublickeys = updatedSSHPublickeys.filter( | ||
item => | ||
item.title !== sshPublicKeys.title && |
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.
Please only filter with item.title !== sshPublicKeys.title
.
Title should be unique and delete means delete an ssh key with a certain title.
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.
ok
<div> | ||
<div className={t.mt1}> | ||
<TextField | ||
label='title' |
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.
Better to give the user some hints.
title
-> Title (Please give the SSH key a name):
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
</div> | ||
<div className={t.mt1}> | ||
<TextField | ||
label='value' |
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.
Better to give the user some hints.
value
-> Value (SSH Public key, starts with
ssh-rsa):
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
data: { | ||
username: username, | ||
extension: { | ||
sshKeys: sskMessage, |
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.
sskMessage
-> sshMessage
?
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.
updated
@@ -179,6 +179,26 @@ export const getUserRequest = async username => { | |||
}); | |||
}; | |||
|
|||
export const updateUserRequest = async (username, sskMessage) => { |
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.
sskMessage
-> sshMessage
?
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.
updated
} | ||
} | ||
|
||
// if (title.trim() === '') { |
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.
Please remove these comments
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.
ok
TODO:
improve SSH layout: