Cherry pick Filips fixes

pull/2879/head
filip mertens 2 years ago committed by David Disu
parent 4fb5bec7af
commit af256c5071
  1. 6
      apps/remix-ide/src/app/files/dgitProvider.js
  2. 16
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  3. 2
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -116,6 +116,7 @@ class DGitProvider extends Plugin {
await this.call('fileManager', 'refresh')
}, 1000)
}
this.emit('checkout')
}
async log (cmd) {
@ -146,6 +147,7 @@ class DGitProvider extends Plugin {
await this.call('fileManager', 'refresh')
}, 1000)
}
this.emit('branch')
return status
}
@ -389,6 +391,8 @@ class DGitProvider extends Plugin {
pinata_api_key: pinataApiKey,
pinata_secret_api_key: pinataSecretApiKey
}
}).catch((e) => {
console.log(e)
})
// also commit to remix IPFS for availability after pinning to Pinata
return await this.export(this.remixIPFS) || result.data.IpfsHash
@ -407,6 +411,8 @@ class DGitProvider extends Plugin {
pinata_api_key: pinataApiKey,
pinata_secret_api_key: pinataSecretApiKey
}
}).catch((e) => {
console.log('Pinata unreachable')
})
return result.data
} catch (error) {

@ -26,6 +26,13 @@ let plugin, dispatch: React.Dispatch<any>
export const setPlugin = (filePanelPlugin, reducerDispatch) => {
plugin = filePanelPlugin
dispatch = reducerDispatch
plugin.on('dGitProvider', 'checkout', async () => {
const currentBranch = await plugin.call('dGitProvider', 'currentbranch')
dispatch(setCurrentWorkspaceCurrentBranch(currentBranch))
})
plugin.on('dGitProvider', 'branch', async () => {
await refreshBranches()
})
}
export const addInputField = async (type: 'file' | 'folder', path: string, cb?: (err: Error, result?: string | number | boolean | Record<string, any>) => void) => {
@ -453,7 +460,16 @@ export const showAllBranches = async () => {
plugin.call('menuicons', 'select', 'dgit')
}
const refreshBranches = async () => {
const workspacesPath = plugin.fileProviders.workspace.workspacesPath
const workspaceName = plugin.fileProviders.workspace.workspace
const branches = await getGitRepoBranches(workspacesPath + '/' + workspaceName)
dispatch(setCurrentWorkspaceBranches(branches))
}
export const switchBranch = async (branch: string) => {
await plugin.call('fileManager', 'closeAllFiles')
const localChanges = await hasLocalChanges()
if (Array.isArray(localChanges) && localChanges.length > 0) {

@ -217,7 +217,7 @@ export function Workspace () {
global.dispatchShowAllBranches()
}
const switchToBranch = async (branch: { remote: any, name: string }) => {
const switchToBranch = async (branch: { remote: string, name: string }) => {
try {
if (branch.remote) {
await global.dispatchCheckoutRemoteBranch(branch.name, branch.remote)

Loading…
Cancel
Save