Skip to content

Commit 5796a7c

Browse files
authoredOct 1, 2024··
feat(ui): make name property for repos (#20077)
* 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>
1 parent afcc71b commit 5796a7c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed
 

‎ui/src/app/settings/components/repo-details/repo-details.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
1717
title: 'Repository URL',
1818
view: repository.repo
1919
},
20+
{
21+
title: 'Name',
22+
view: repository.name || '',
23+
edit: (formApi: FormApi) => <FormField formApi={formApi} field='name' component={Text} />
24+
},
2025
{
2126
title: 'Username (optional)',
2227
view: repository.username || '',
@@ -29,13 +34,6 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
2934
}
3035
];
3136

32-
if (repository.name) {
33-
items.splice(1, 0, {
34-
title: 'NAME',
35-
view: repository.name
36-
});
37-
}
38-
3937
if (repository.project) {
4038
items.splice(repository.name ? 2 : 1, 0, {
4139
title: 'Project',
@@ -86,6 +84,7 @@ export const RepoDetails = (props: {repo: models.Repository; save?: (params: New
8684
})}
8785
save={async input => {
8886
const params: NewHTTPSRepoParams = {...newRepo};
87+
params.name = input.name || '';
8988
params.username = input.username || '';
9089
params.password = input.password || '';
9190
save(params);

‎ui/src/app/settings/components/repos-list/repos-list.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,14 @@ export class ReposList extends React.Component<
470470
<div className='argo-form-row'>
471471
<FormField formApi={formApi} label='Type' field='type' component={FormSelect} componentProps={{options: ['git', 'helm']}} />
472472
</div>
473-
{formApi.getFormState().values.type === 'helm' && (
473+
{(formApi.getFormState().values.type === 'helm' || formApi.getFormState().values.type === 'git') && (
474474
<div className='argo-form-row'>
475-
<FormField formApi={formApi} label='Name' field='name' component={Text} />
475+
<FormField
476+
formApi={formApi}
477+
label={`Name ${formApi.getFormState().values.type === 'git' ? '(optional)' : ''}`}
478+
field='name'
479+
component={Text}
480+
/>
476481
</div>
477482
)}
478483
<div className='argo-form-row'>

0 commit comments

Comments
 (0)
Please sign in to comment.