Skip to content

Commit

Permalink
feat(ui): make name property for repos (argoproj#20077)
Browse files Browse the repository at this point in the history
* name-option-added

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

* lint

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>

---------

Signed-off-by: Surajyadav <harrypotter1108@gmail.com>
Signed-off-by: austin5219 <3936059+austin5219@users.noreply.github.com>
  • Loading branch information
surajyadav1108 authored and austin5219 committed Oct 16, 2024
1 parent 6118c81 commit 9a105af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
13 changes: 6 additions & 7 deletions ui/src/app/settings/components/repo-details/repo-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
title: 'Repository URL',
view: repository.repo
},
{
title: 'Name',
view: repository.name || '',
edit: (formApi: FormApi) => <FormField formApi={formApi} field='name' component={Text} />
},
{
title: 'Username (optional)',
view: repository.username || '',
Expand All @@ -29,13 +34,6 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
}
];

if (repository.name) {
items.splice(1, 0, {
title: 'NAME',
view: repository.name
});
}

if (repository.project) {
items.splice(repository.name ? 2 : 1, 0, {
title: 'Project',
Expand Down Expand Up @@ -86,6 +84,7 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
})}
save={async input => {
const params: NewHTTPSRepoParams = {...newRepo};
params.name = input.name || '';
params.username = input.username || '';
params.password = input.password || '';
save(params);
Expand Down
9 changes: 7 additions & 2 deletions ui/src/app/settings/components/repos-list/repos-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,14 @@ export class ReposList extends React.Component<
<div className='argo-form-row'>
<FormField formApi={formApi} label='Type' field='type' component={FormSelect} componentProps={{options: ['git', 'helm']}} />
</div>
{formApi.getFormState().values.type === 'helm' && (
{(formApi.getFormState().values.type === 'helm' || formApi.getFormState().values.type === 'git') && (
<div className='argo-form-row'>
<FormField formApi={formApi} label='Name' field='name' component={Text} />
<FormField
formApi={formApi}
label={`Name ${formApi.getFormState().values.type === 'git' ? '(optional)' : ''}`}
field='name'
component={Text}
/>
</div>
)}
<div className='argo-form-row'>
Expand Down

0 comments on commit 9a105af

Please sign in to comment.