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 ...cmd2
}) })
} }
console.log('pull result', result)
setTimeout(async () => { setTimeout(async () => {
await this.call('fileManager', 'refresh') await this.call('fileManager', 'refresh')
}, 1000) }, 1000)

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

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

@ -1,5 +1,5 @@
import React, { useEffect, useReducer, useState } from 'react' 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 { loadFiles, setCallBacks } from '../lib/listeners'
import { openDiff, openFile, saveToken, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged } from '../lib/pluginActions' import { openDiff, openFile, saveToken, setModifiedDecorator, setPlugin, setUntrackedDecorator, statusChanged } from '../lib/pluginActions'
import { gitActionsContext, pluginActionsContext } from '../state/context' import { gitActionsContext, pluginActionsContext } from '../state/context'
@ -63,7 +63,7 @@ export const GitUI = (props: IGitUi) => {
useEffect(() => { useEffect(() => {
if (!appLoaded) return if (!appLoaded) return
setCallBacks(plugin, gitDispatch, loaderDispatch) setCallBacks(plugin, gitDispatch, loaderDispatch, setActivePanel)
setPlugin(plugin, gitDispatch, loaderDispatch) setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true }) loaderDispatch({ type: 'plugin', payload: true })
@ -146,6 +146,7 @@ export const GitUI = (props: IGitUi) => {
sendToGitLog, sendToGitLog,
clearGitLog, clearGitLog,
getFileStatusMatrix, getFileStatusMatrix,
gitlog,
init init
} }

@ -63,6 +63,7 @@ export const setUpstreamRemote = async (remote: remote) => {
} }
export const getFileStatusMatrix = async (filepaths: string[]) => { export const getFileStatusMatrix = async (filepaths: string[]) => {
dispatch(setLoading(true))
const fileStatusResult = await statusMatrix(filepaths); const fileStatusResult = await statusMatrix(filepaths);
fileStatusResult.map((m) => { fileStatusResult.map((m) => {
statusmatrix.map((sm) => { statusmatrix.map((sm) => {
@ -77,6 +78,7 @@ export const getFileStatusMatrix = async (filepaths: string[]) => {
dispatch(fileStatusMerge(fileStatusResult)) dispatch(fileStatusMerge(fileStatusResult))
setFileDecorators(fileStatusResult) setFileDecorators(fileStatusResult)
} }
dispatch(setLoading(false))
} }
export const getCommits = async () => { export const getCommits = async () => {
@ -95,6 +97,7 @@ export const getCommits = async () => {
} }
export const gitlog = async () => { export const gitlog = async () => {
dispatch(setLoading(true))
let commits = [] let commits = []
try { try {
commits = await getCommits() commits = await getCommits()
@ -102,6 +105,7 @@ export const gitlog = async () => {
} }
dispatch(setCommits(commits)) dispatch(setCommits(commits))
await showCurrentBranch() await showCurrentBranch()
dispatch(setLoading(false))
} }
export const showCurrentBranch = async () => { 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 plugin = viewPlugin
gitDispatch = gitDispatcher gitDispatch = gitDispatcher
loaderDispatch = loaderDispatcher loaderDispatch = loaderDispatcher
@ -163,6 +163,14 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
await getGitConfig() await getGitConfig()
}) })
plugin.on('dgit' as any, 'openPanel', async (panel: string) => {
const panels = {
'branches': '2'
}
const panelNumber = panels[panel]
setAtivePanel(panelNumber)
})
callBackEnabled = true; callBackEnabled = true;
} }

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

Loading…
Cancel
Save