git4refactor
filip mertens 7 months ago
parent e1fc893076
commit aa7d58bad1
  1. 4
      libs/remix-ui/git/src/components/github/repositoryselect.tsx
  2. 8
      libs/remix-ui/git/src/lib/gitactions.ts
  3. 11
      libs/remix-ui/git/src/state/gitreducer.tsx

@ -45,7 +45,7 @@ const RepositorySelect = (props: RepositorySelectProps) => {
const repo = context.repositories.find(repo => { const repo = context.repositories.find(repo => {
return repo.id.toString() === value.toString() return repo.id.toString() === value.toString()
}) })
if (repo) { if (repo) {
props.select(repo) props.select(repo)
await actions.remoteBranches(repo.owner.login, repo.name) await actions.remoteBranches(repo.owner.login, repo.name)
@ -64,7 +64,7 @@ const RepositorySelect = (props: RepositorySelectProps) => {
}; };
return ( return (
<><TokenWarning /><Button onClick={fetchRepositories} className="w-100 mt-1"> <><Button onClick={fetchRepositories} className="w-100 mt-1">
<i className="fab fa-github mr-1"></i>Fetch Repositories from GitHub <i className="fab fa-github mr-1"></i>Fetch Repositories from GitHub
</Button> </Button>
{ {

@ -488,7 +488,7 @@ export const repositories = async () => {
} else { } else {
plugin.call('notification', 'alert', { plugin.call('notification', 'alert', {
title: 'Error getting repositories', title: 'Error getting repositories',
message: `Please check your GitHub token in the GitHub settings. It needs to have access to the repositories.` message: `Please check your GitHub token in the GitHub settings... cannot connect to GitHub`
}) })
dispatch(setRepos([])) dispatch(setRepos([]))
} }
@ -558,12 +558,8 @@ export const remoteCommits = async (url: string, branch: string, length: number)
} else { } else {
sendToGitLog({ sendToGitLog({
type: 'error', type: 'error',
message: `Please check your GitHub token in the GitHub settings. It needs to have access to the commits.` message: `Please check your GitHub token in the GitHub settings.`
}) })
//plugin.call('notification', 'alert', {
// title: 'Error getting commits',
// message: `Please check your GitHub token in the GitHub settings. It needs to have access to the commits.`
//})
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)

@ -182,10 +182,19 @@ export const gitReducer = (state: gitState = defaultGitState, action: Action): g
} }
case 'SET_LOG': case 'SET_LOG':
const previousLog = [...state.log]
// check if the new message is the same as the last
if (previousLog.length > 0 && previousLog[previousLog.length - 1].message === action.payload.message) {
return {
...state,
log: previousLog
}
}
return { return {
...state, ...state,
log: [...state.log, action.payload] log: [...previousLog, action.payload]
} }
case 'CLEAR_LOG': case 'CLEAR_LOG':
return { return {

Loading…
Cancel
Save