diff --git a/apps/remix-ide/src/app/files/dgitProvider.ts b/apps/remix-ide/src/app/files/dgitProvider.ts index 745abab38b..6fe5c5c1ee 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.ts +++ b/apps/remix-ide/src/app/files/dgitProvider.ts @@ -786,7 +786,6 @@ class DGitProvider extends Plugin { ...cmd2 }) } - console.log('pull result', result) setTimeout(async () => { await this.call('fileManager', 'refresh') }, 1000) diff --git a/apps/remix-ide/src/app/plugins/git.tsx b/apps/remix-ide/src/app/plugins/git.tsx index 586f3e1300..44e34d632c 100644 --- a/apps/remix-ide/src/app/plugins/git.tsx +++ b/apps/remix-ide/src/app/plugins/git.tsx @@ -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
} diff --git a/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx b/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx index 1450921f91..9591c8f719 100644 --- a/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx +++ b/libs/remix-ui/git/src/components/buttons/sourcecontrolbuttons.tsx @@ -51,7 +51,8 @@ export const SourceControlButtons = () => { } const refresh = async() => { - actions.getFileStatusMatrix(null) + await actions.getFileStatusMatrix(null) + await actions.gitlog() } const buttonsDisabled = () => { diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index 03df19ff65..6827a10dc6 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -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 } diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index 8a550873ce..58e8874aea 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -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 () => { diff --git a/libs/remix-ui/git/src/lib/listeners.ts b/libs/remix-ui/git/src/lib/listeners.ts index 50a05198ee..9894582aa5 100644 --- a/libs/remix-ui/git/src/lib/listeners.ts +++ b/libs/remix-ui/git/src/lib/listeners.ts @@ -34,7 +34,7 @@ class AsyncDebouncedQueue { } } -export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch, loaderDispatcher: React.Dispatch) => { +export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch, loaderDispatcher: React.Dispatch, setAtivePanel: React.Dispatch>) => { plugin = viewPlugin gitDispatch = gitDispatcher loaderDispatch = loaderDispatcher @@ -163,6 +163,14 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch { + const panels = { + 'branches': '2' + } + const panelNumber = panels[panel] + setAtivePanel(panelNumber) + }) + callBackEnabled = true; } diff --git a/libs/remix-ui/git/src/state/context.tsx b/libs/remix-ui/git/src/state/context.tsx index 4bd641eb54..4608406a7f 100644 --- a/libs/remix-ui/git/src/state/context.tsx +++ b/libs/remix-ui/git/src/state/context.tsx @@ -31,6 +31,7 @@ export interface gitActions { sendToGitLog: (message: gitLog) => Promise clearGitLog: () => Promise getFileStatusMatrix(filespaths:[]): Promise + gitlog(): Promise init(): Promise }