Merge branch 'master' of https://github.com/ethereum/remix-project into desktop-master

pull/5370/head
Your Name 5 months ago
commit 041bc535e4
  1. 10
      apps/remix-ide/src/app/files/dgitProvider.ts
  2. 2
      apps/remix-ide/src/app/files/fileManager.ts
  3. 2
      apps/remix-ide/src/remixEngine.js
  4. 12
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -436,7 +436,7 @@ class DGitProvider extends Plugin {
const permission = await this.askUserPermission('clone', 'Import multiple files into your workspaces.') const permission = await this.askUserPermission('clone', 'Import multiple files into your workspaces.')
if (!permission) return false if (!permission) return false
if (parseFloat(this.calculateLocalStorage()) > 10000) throw new Error('The local storage of the browser is full.') if (parseFloat(this.calculateLocalStorage()) > 10000) throw new Error('The local storage of the browser is full.')
if (!workspaceExists) await this.call('filePanel', 'createWorkspace', workspaceName || `workspace_${Date.now()}`, true) if (!workspaceExists) await this.call('filePanel', 'createWorkspace', workspaceName || `workspace_${Date.now()}`, '', true)
const cmd = { const cmd = {
url: input.url, url: input.url,
singleBranch: input.singleBranch, singleBranch: input.singleBranch,
@ -445,7 +445,7 @@ class DGitProvider extends Plugin {
...await this.parseInput(input), ...await this.parseInput(input),
...await this.getGitConfig() ...await this.getGitConfig()
} }
this.call('terminal', 'logHtml', `Cloning ${input.url}...`) this.call('terminal', 'logHtml', `Cloning ${input.url}... please wait...`)
const result = await git.clone(cmd) const result = await git.clone(cmd)
if (!workspaceExists) { if (!workspaceExists) {
setTimeout(async () => { setTimeout(async () => {
@ -453,6 +453,12 @@ class DGitProvider extends Plugin {
}, 1000) }, 1000)
} }
this.emit('clone') this.emit('clone')
this.call('fileManager', 'hasGitSubmodules').then((submodules) => {
if (submodules) {
this.call('terminal', 'log', { type: 'warn', value: 'This repository has submodules. Please update submodules to pull all the dependencies.' })
this.emit('repositoryWithSubmodulesCloned')
}
})
return result return result
} }
} }

@ -24,7 +24,7 @@ const profile = {
methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'writeMultipleFiles', 'writeFileNoRewrite', methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'writeMultipleFiles', 'writeFileNoRewrite',
'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'dirList', 'fileList', 'remove', 'getCurrentFile', 'getFile', 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'dirList', 'fileList', 'remove', 'getCurrentFile', 'getFile',
'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath',
'saveCurrentFile', 'setBatchFiles', 'isGitRepo', 'isFile', 'isDirectory', 'hasGitSubmodule', 'copyFolderToJson' 'saveCurrentFile', 'setBatchFiles', 'isGitRepo', 'isFile', 'isDirectory', 'hasGitSubmodules', 'copyFolderToJson'
], ],
kind: 'file-system' kind: 'file-system'
} }

@ -10,7 +10,7 @@ export class RemixEngine extends Engine {
setPluginOption ({ name, kind }) { setPluginOption ({ name, kind }) {
if (kind === 'provider') return { queueTimeout: 60000 * 2 } if (kind === 'provider') return { queueTimeout: 60000 * 2 }
if (name === 'LearnEth') return { queueTimeout: 60000 } if (name === 'LearnEth') return { queueTimeout: 60000 }
if (name === 'dGitProvider') return { queueTimeout: 60000 * 4 } if (name === 'dGitProvider') return { queueTimeout: 60000 * 30 }
if (name === 'slither') return { queueTimeout: 60000 * 4 } // Requires when a solc version is installed if (name === 'slither') return { queueTimeout: 60000 * 4 } // Requires when a solc version is installed
if (name === 'hardhat') return { queueTimeout: 60000 * 4 } if (name === 'hardhat') return { queueTimeout: 60000 * 4 }
if (name === 'truffle') return { queueTimeout: 60000 * 4 } if (name === 'truffle') return { queueTimeout: 60000 * 4 }

@ -30,6 +30,7 @@ export function Workspace() {
const [showDropdown, setShowDropdown] = useState<boolean>(false) const [showDropdown, setShowDropdown] = useState<boolean>(false)
const [showIconsMenu, hideIconsMenu] = useState<boolean>(false) const [showIconsMenu, hideIconsMenu] = useState<boolean>(false)
const [showBranches, setShowBranches] = useState<boolean>(false) const [showBranches, setShowBranches] = useState<boolean>(false)
const [highlightUpdateSubmodules, setHighlightUpdateSubmodules] = useState<boolean>(false)
const [branchFilter, setBranchFilter] = useState<string>('') const [branchFilter, setBranchFilter] = useState<string>('')
const displayOzCustomRef = useRef<HTMLDivElement>() const displayOzCustomRef = useRef<HTMLDivElement>()
const mintableCheckboxRef = useRef() const mintableCheckboxRef = useRef()
@ -123,6 +124,10 @@ export function Workspace() {
cloneGitRepository() cloneGitRepository()
} }
} }
global.plugin.on('dGitProvider', 'repositoryWithSubmodulesCloned', () => {
setHighlightUpdateSubmodules(true)
})
}, []) }, [])
useEffect(() => { useEffect(() => {
@ -677,6 +682,7 @@ export function Workspace() {
const updateSubModules = async () => { const updateSubModules = async () => {
try { try {
setHighlightUpdateSubmodules(false)
await global.dispatchUpdateGitSubmodules() await global.dispatchUpdateGitSubmodules()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
@ -1205,11 +1211,11 @@ export function Workspace() {
{selectedWorkspace && ( {selectedWorkspace && (
<div className={`bg-light border-top ${selectedWorkspace.isGitRepo && currentBranch ? 'd-block' : 'd-none'}`} data-id="workspaceGitPanel"> <div className={`bg-light border-top ${selectedWorkspace.isGitRepo && currentBranch ? 'd-block' : 'd-none'}`} data-id="workspaceGitPanel">
<div className="d-flex justify-space-between p-1"> <div className="d-flex justify-space-between p-1">
<div className="mr-auto text-uppercase text-dark pt-2 pl-2">GIT</div> <div className="mr-auto text-uppercase text-dark pt-2 px-1">GIT</div>
{selectedWorkspace.hasGitSubmodules? {selectedWorkspace.hasGitSubmodules?
<div className="pt-1 mr-1"> <div className="pt-1 mr-1">
{global.fs.browser.isRequestingCloning ? <div style={{ height: 30 }} className='btn btn-sm border text-muted small'><i className="fad fa-spinner fa-spin"></i> updating submodules</div> : {global.fs.browser.isRequestingCloning ? <div style={{ height: 30, minWidth: 165 }} className='btn btn-sm border text-muted small'><i className="fad fa-spinner fa-spin"></i> updating submodules</div> :
<div style={{ height: 30 }} onClick={updateSubModules} data-id='updatesubmodules' className='btn btn-sm border text-muted small'>update submodules</div>} <div style={{ height: 30, minWidth: 165 }} onClick={updateSubModules} data-id='updatesubmodules' className={`btn btn-sm border small ${highlightUpdateSubmodules ? 'text-warning' : 'text-muted'}`}>update submodules</div>}
</div> </div>
: null} : null}
<div className="pt-1 mr-1" data-id="workspaceGitBranchesDropdown"> <div className="pt-1 mr-1" data-id="workspaceGitBranchesDropdown">

Loading…
Cancel
Save