-
Notifications
You must be signed in to change notification settings - Fork 7k
feat: make https repo credentials editable in the UI #9782
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
Merged
crenshaw-dev
merged 16 commits into
argoproj:master
from
ciiay:ui-9108-make-repo-setting-editable
Aug 19, 2022
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
70f2a89
fix: missing actions (#10327) (#10359)
crenshaw-dev 551ad34
chore: infer managed resources health from redis instead of storing i…
alexmt f82b1ae
fix: Add logic to handle for fileHandle.Close() (#9963) (#10361)
my-git9 c760c5a
docs: fix typo in upgrade notes (#10377)
daixijun cc518c4
fix: add space before prompt in CLI (#10362)
my-git9 29994cc
docs: fix indentation of example AppProject in 'Sync Windows' documen…
waltforme 1e92891
fix: Correctly assume cluster-scoped resources to be self-referenced …
jannfis 01d7852
ui-make-https-repo-credential-editable
ciiay 57c3475
Minor format fix
ciiay 3999838
Minor fix for unclickable input field
ciiay 8bc8002
Updates for comments
ciiay 56bb899
ui-make-https-repo-credential-editable
ciiay c2bc0b6
Minor format fix
ciiay 85d89fe
Minor fix for unclickable input field
ciiay 904780b
Updates for comments
ciiay bfc7c72
Merge branch 'ui-9108-make-repo-setting-editable' of https://github.c…
ciiay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
ui/src/app/settings/components/repo-details/repo-details.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import * as React from 'react'; | ||
| import {FormField} from 'argo-ui'; | ||
| import {FormApi, Text} from 'react-form'; | ||
| import {EditablePanel, EditablePanelItem} from '../../../shared/components'; | ||
| import * as models from '../../../shared/models'; | ||
| import {NewHTTPSRepoParams} from '../repos-list/repos-list'; | ||
|
|
||
| export const RepoDetails = (props: {repo: models.Repository; save?: (params: NewHTTPSRepoParams) => Promise<void>}) => { | ||
| const {repo, save} = props; | ||
| const FormItems = (repository: models.Repository): EditablePanelItem[] => { | ||
| const items: EditablePanelItem[] = [ | ||
| { | ||
| title: 'Type', | ||
| view: repository.type | ||
| }, | ||
| { | ||
| title: 'Repository URL', | ||
| view: repository.repo | ||
| }, | ||
| { | ||
| title: 'Username (optional)', | ||
| view: repository.username || '', | ||
| edit: (formApi: FormApi) => <FormField formApi={formApi} field='username' component={Text} /> | ||
| }, | ||
| { | ||
| title: 'Password (optional)', | ||
| view: repository.username ? '******' : '', | ||
| edit: (formApi: FormApi) => <FormField formApi={formApi} field='password' component={Text} componentProps={{type: 'password'}} /> | ||
| } | ||
| ]; | ||
|
|
||
| if (repository.name) { | ||
| items.splice(1, 0, { | ||
| title: 'NAME', | ||
| view: repository.name | ||
| }); | ||
| } | ||
|
|
||
| if (repository.project) { | ||
| items.splice(repository.name ? 2 : 1, 0, { | ||
| title: 'Project', | ||
| view: repository.project | ||
| }); | ||
| } | ||
|
|
||
| if (repository.proxy) { | ||
| items.push({ | ||
| title: 'Proxy (optional)', | ||
| view: repository.proxy | ||
| }); | ||
| } | ||
|
|
||
| return items; | ||
| }; | ||
|
|
||
| const newRepo = { | ||
| type: repo.type, | ||
| name: repo.name || '', | ||
| url: repo.repo, | ||
| username: repo.username || '', | ||
| password: repo.password || '', | ||
| tlsClientCertData: repo.tlsClientCertData || '', | ||
| tlsClientCertKey: repo.tlsClientCertKey || '', | ||
| insecure: repo.insecure || false, | ||
| enableLfs: repo.enableLfs || false, | ||
| proxy: repo.proxy || '', | ||
| project: repo.project || '' | ||
| }; | ||
|
|
||
| return ( | ||
| <EditablePanel | ||
| values={repo} | ||
| validate={input => ({ | ||
| username: !input.username && input.password && 'Username is required if password is given.', | ||
| password: !input.password && input.username && 'Password is required if username is given.' | ||
| })} | ||
| save={async input => { | ||
| const params: NewHTTPSRepoParams = {...newRepo}; | ||
| params.username = input.username || ''; | ||
| params.password = input.password || ''; | ||
| save(params); | ||
| }} | ||
| title='CONNECTED REPOSITORY' | ||
| items={FormItems(repo)} | ||
| /> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In case where only password is added without the username, there is no validation check and shows success box. That case can also be addressed here.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks for the review. I see the same thing when I wrote it but I aligned up with the current validation for the creation sliding panel. It only checks one way, so I kept it consistent. Do you think I should update both places or only the updating page?

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.
Maybe better to update both places for better user experience?