git4refactor
filip mertens 7 months ago
parent e1fc893076
commit aa7d58bad1
  1. 2
      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

@ -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 { return {
...state, ...state,
log: [...state.log, action.payload] log: previousLog
} }
}
return {
...state,
log: [...previousLog, action.payload]
}
case 'CLEAR_LOG': case 'CLEAR_LOG':
return { return {

Loading…
Cancel
Save