|
|
|
@ -18,6 +18,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { |
|
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
|
const [loading, setLoading] = useState(false) |
|
|
|
|
const [show, setShow] = useState(false) |
|
|
|
|
const [selected, setSelected] = useState<any>(null) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (context.repositories && context.repositories.length > 0) { |
|
|
|
@ -39,6 +40,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { |
|
|
|
|
const selectRepo = async (e: any) => { |
|
|
|
|
if (!e || !e.value) { |
|
|
|
|
props.select(null) |
|
|
|
|
setSelected(null) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
const value = e && e.value |
|
|
|
@ -49,6 +51,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { |
|
|
|
|
|
|
|
|
|
if (repo) { |
|
|
|
|
props.select(repo) |
|
|
|
|
setSelected(repo) |
|
|
|
|
await actions.remoteBranches(repo.owner.login, repo.name) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -70,6 +73,7 @@ const RepositorySelect = (props: RepositorySelectProps) => { |
|
|
|
|
</button> |
|
|
|
|
{ |
|
|
|
|
show ? |
|
|
|
|
<> |
|
|
|
|
<Select |
|
|
|
|
options={repoOtions} |
|
|
|
|
className="mt-1" |
|
|
|
@ -80,7 +84,9 @@ const RepositorySelect = (props: RepositorySelectProps) => { |
|
|
|
|
isClearable={true} |
|
|
|
|
placeholder="Type to search for a repository..." |
|
|
|
|
isLoading={loading} |
|
|
|
|
/> : null |
|
|
|
|
/> |
|
|
|
|
{ selected ? null : <label className="text-warning mt-2">Please select a repository</label> } |
|
|
|
|
</>: null |
|
|
|
|
}</> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|