Add ability to specify insecure and LFS modes when adding repos via UI (#1979)

This commit is contained in:
jannfis 2019-07-23 18:24:40 +02:00 committed by Alex Collins
parent a6cf2c5145
commit d58339561c
2 changed files with 12 additions and 3 deletions

View file

@ -4,7 +4,7 @@ import * as React from 'react';
import {Form, FormApi, Text} from 'react-form';
import {RouteComponentProps} from 'react-router';
import {ConnectionStateIcon, DataLoader, EmptyState, ErrorNotification, Page} from '../../../shared/components';
import {CheckboxField, ConnectionStateIcon, DataLoader, EmptyState, ErrorNotification, Page} from '../../../shared/components';
import {Repo} from '../../../shared/components/repo';
import {AppContext} from '../../../shared/context';
import * as models from '../../../shared/models';
@ -16,6 +16,8 @@ interface NewRepoParams {
url: string;
username: string;
password: string;
insecure: boolean;
enableLfs: boolean;
}
export class ReposList extends React.Component<RouteComponentProps<any>> {
@ -119,6 +121,12 @@ export class ReposList extends React.Component<RouteComponentProps<any>> {
<FormField formApi={formApi} label='Password' field='password' component={Text}
componentProps={{type: 'password'}}/>
</div>
<div className='argo-form-row'>
<FormField formApi={formApi} label='Skip server verification' field='insecure' component={CheckboxField}/>
</div>
<div className='argo-form-row'>
<FormField formApi={formApi} label='Enable LFS support' field='enableLfs' component={CheckboxField}/>
</div>
</form>
)}
</Form>

View file

@ -6,8 +6,9 @@ export class RepositoriesService {
return requests.get('/repositories').then((res) => res.body as models.RepositoryList).then((list) => list.items || []);
}
public create({url, username, password}: {url: string, username: string, password: string}): Promise<models.Repository> {
return requests.post('/repositories').send({ repo: url, username, password }).then((res) => res.body as models.Repository);
public create({url, username, password, insecure, enableLfs}:
{url: string, username: string, password: string, insecure: boolean, enableLfs: boolean}): Promise<models.Repository> {
return requests.post('/repositories').send({ repo: url, username, password, insecure, enableLfs }).then((res) => res.body as models.Repository);
}
public delete(url: string): Promise<models.Repository> {