git4refactor
filip mertens 7 months ago
parent 53eee90070
commit 819202ba09
  1. 6
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  2. 5
      libs/remix-ui/git/src/components/gitui.tsx
  3. 1
      libs/remix-ui/git/src/state/context.tsx

@ -41,6 +41,10 @@ export const SourceControlButtons = () => {
await actions.push(getRemoteName(), branch ? branch.name : context.currentBranch.name)
}
const refresh = async() => {
actions.getFileStatusMatrix(null)
}
const buttonsDisabled = () => {
return (!context.upstream) || context.remotes.length === 0
}
@ -76,7 +80,7 @@ export const SourceControlButtons = () => {
<GitUIButton disabledCondition={buttonsDisabled()} onClick={sync} className='btn btn-sm pl-0 pr-2'><FontAwesomeIcon icon={faArrowsUpDown} className="" /></GitUIButton>
</CustomTooltip>
<CustomTooltip tooltipText={<FormattedMessage id="git.refresh" />}>
<GitUIButton disabledCondition={buttonsDisabled()} onClick={async () => { }} className='btn btn-sm'><FontAwesomeIcon icon={faArrowRotateRight} className="" /></GitUIButton>
<GitUIButton onClick={refresh} className='btn btn-sm'><FontAwesomeIcon icon={faArrowRotateRight} className="" /></GitUIButton>
</CustomTooltip>
</span>

@ -1,5 +1,5 @@
import React, { useEffect, useReducer, useState } from 'react'
import { add, addall, checkout, checkoutfile, clone, commit, createBranch, remoteBranches, repositories, rm, getCommitChanges, diff, resolveRef, getBranchCommits, setUpstreamRemote, getGitHubUser, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentials, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences } from '../lib/gitactions'
import { add, addall, checkout, checkoutfile, clone, commit, createBranch, remoteBranches, repositories, rm, getCommitChanges, diff, resolveRef, getBranchCommits, setUpstreamRemote, getGitHubUser, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentials, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences, getFileStatusMatrix } from '../lib/gitactions'
import { loadFiles, setCallBacks } from '../lib/listeners'
import { openDiff, openFile, saveToken, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged } from '../lib/pluginActions'
import { gitActionsContext, pluginActionsContext } from '../state/context'
@ -111,7 +111,8 @@ export const GitUI = (props: IGitUi) => {
addRemote,
removeRemote,
sendToGitLog,
clearGitLog
clearGitLog,
getFileStatusMatrix
}
const pluginActionsProviderValue = {

@ -30,6 +30,7 @@ export interface gitActions {
addRemote: (remote: remote) => Promise<void>
sendToGitLog: (message: gitLog) => Promise<void>
clearGitLog: () => Promise<void>
getFileStatusMatrix(filespaths:[]): Promise<void>
}
export const gitActionsContext = React.createContext<gitActions>(null)

Loading…
Cancel
Save