pull/4791/head
filip mertens 6 months ago
parent 62782ebe71
commit b5dcbc6ba3
  1. 1
      apps/remix-ide/src/app/files/dgitProvider.ts
  2. 6
      apps/remix-ide/src/app/plugins/git.tsx
  3. 3
      libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx
  4. 5
      libs/remix-ui/git/src/components/gitui.tsx
  5. 4
      libs/remix-ui/git/src/lib/gitactions.ts
  6. 10
      libs/remix-ui/git/src/lib/listeners.ts
  7. 1
      libs/remix-ui/git/src/state/context.tsx

@ -786,7 +786,6 @@ class DGitProvider extends Plugin {
...cmd2
})
}
console.log('pull result', result)
setTimeout(async () => {
await this.call('fileManager', 'refresh')
}, 1000)

@ -19,6 +19,8 @@ const profile = {
export class GitPlugin extends ViewPlugin {
constructor() {
super(profile)
@ -29,6 +31,10 @@ export class GitPlugin extends ViewPlugin {
this.call('manager', 'activatePlugin', 'dgitApi')
}
async open(panel:string) {
this.emit('openPanel', panel)
}
render() {
return <div id='gitTab'><GitUI plugin={this} /></div>
}

@ -51,7 +51,8 @@ export const SourceControlButtons = () => {
}
const refresh = async() => {
actions.getFileStatusMatrix(null)
await actions.getFileStatusMatrix(null)
await actions.gitlog()
}
const buttonsDisabled = () => {

@ -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, loadGitHubUserFromToken, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences, getFileStatusMatrix, init, showAlert } from '../lib/gitactions'
import { add, addall, checkout, checkoutfile, clone, commit, createBranch, remoteBranches, repositories, rm, getCommitChanges, diff, resolveRef, getBranchCommits, setUpstreamRemote, loadGitHubUserFromToken, getBranches, getRemotes, remoteCommits, saveGitHubCredentials, getGitHubCredentialsFromLocalStorage, fetch, pull, push, setDefaultRemote, addRemote, removeRemote, sendToGitLog, clearGitLog, getBranchDifferences, getFileStatusMatrix, init, showAlert, gitlog } 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'
@ -63,7 +63,7 @@ export const GitUI = (props: IGitUi) => {
useEffect(() => {
if (!appLoaded) return
setCallBacks(plugin, gitDispatch, loaderDispatch)
setCallBacks(plugin, gitDispatch, loaderDispatch, setActivePanel)
setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true })
@ -146,6 +146,7 @@ export const GitUI = (props: IGitUi) => {
sendToGitLog,
clearGitLog,
getFileStatusMatrix,
gitlog,
init
}

@ -63,6 +63,7 @@ export const setUpstreamRemote = async (remote: remote) => {
}
export const getFileStatusMatrix = async (filepaths: string[]) => {
dispatch(setLoading(true))
const fileStatusResult = await statusMatrix(filepaths);
fileStatusResult.map((m) => {
statusmatrix.map((sm) => {
@ -77,6 +78,7 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
dispatch(fileStatusMerge(fileStatusResult))
setFileDecorators(fileStatusResult)
}
dispatch(setLoading(false))
}
export const getCommits = async () => {
@ -95,6 +97,7 @@ export const getCommits = async () => {
}
export const gitlog = async () => {
dispatch(setLoading(true))
let commits = []
try {
commits = await getCommits()
@ -102,6 +105,7 @@ export const gitlog = async () => {
}
dispatch(setCommits(commits))
await showCurrentBranch()
dispatch(setLoading(false))
}
export const showCurrentBranch = async () => {

@ -34,7 +34,7 @@ class AsyncDebouncedQueue {
}
}
export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<gitActionDispatch>, loaderDispatcher: React.Dispatch<any>) => {
export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<gitActionDispatch>, loaderDispatcher: React.Dispatch<any>, setAtivePanel: React.Dispatch<React.SetStateAction<string>>) => {
plugin = viewPlugin
gitDispatch = gitDispatcher
loaderDispatch = loaderDispatcher
@ -163,6 +163,14 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
await getGitConfig()
})
plugin.on('dgit' as any, 'openPanel', async (panel: string) => {
const panels = {
'branches': '2'
}
const panelNumber = panels[panel]
setAtivePanel(panelNumber)
})
callBackEnabled = true;
}

@ -31,6 +31,7 @@ export interface gitActions {
sendToGitLog: (message: gitLog) => Promise<void>
clearGitLog: () => Promise<void>
getFileStatusMatrix(filespaths:[]): Promise<void>
gitlog(): Promise<void>
init(): Promise<void>
}

Loading…
Cancel
Save