remixd disable

pull/4791/head
bunsenstraat 5 months ago
parent c5915b0ad6
commit 0af14a0b8f
  1. 30
      apps/remix-ide-e2e/src/tests/remixd.test.ts
  2. 12
      libs/remix-ui/git/src/components/disabled.tsx
  3. 157
      libs/remix-ui/git/src/components/gitui.tsx
  4. 1
      libs/remix-ui/git/src/lib/listeners.ts

@ -254,6 +254,28 @@ module.exports = {
}) })
},
'Should disable git when running remixd #group9': function (browser: NightwatchBrowser) {
browser.perform(async (done) => {
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/hardhat'))
console.log('working directory', process.cwd())
connectRemixd(browser, done)
})
browser
.clickLaunchIcon('dgit')
.waitForElementVisible('*[data-id="disabled"]')
.pause(2000)
.clickLaunchIcon('filePanel')
.switchWorkspace('default_workspace')
.click({
selector:'[data-path="connectionAlert-modal-footer-ok-react"]',
suppressNotFoundErrors: true,
timeout: 2000
})
.pause(2000)
.clickLaunchIcon('dgit')
.waitForElementNotPresent('*[data-id="disabled"]')
} }
} }
@ -310,11 +332,11 @@ async function spawnRemixd(path: string): Promise<ChildProcess> {
const remixd = spawn('chmod +x dist/libs/remixd/src/bin/remixd.js && dist/libs/remixd/src/bin/remixd.js --remix-ide http://127.0.0.1:8080', [`-s ${path}`], { cwd: process.cwd(), shell: true, detached: true }) const remixd = spawn('chmod +x dist/libs/remixd/src/bin/remixd.js && dist/libs/remixd/src/bin/remixd.js --remix-ide http://127.0.0.1:8080', [`-s ${path}`], { cwd: process.cwd(), shell: true, detached: true })
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
remixd.stdout.on('data', function (data) { remixd.stdout.on('data', function (data) {
if( if (
data.toString().includes('is listening') data.toString().includes('is listening')
|| data.toString().includes('There is already a client running') || data.toString().includes('There is already a client running')
) { ) {
resolve(remixd) resolve(remixd)
} }
}) })

@ -0,0 +1,12 @@
import React, { useEffect, useState } from 'react'
export const Disabled = () => {
return (
<div data-id='disabled' className='text-sm w-100 alert alert-warning'>
Git is currently disabled.<br></br>
If you are using RemixD you can use git on the terminal.<br></br>
</div>
)
}

@ -33,6 +33,7 @@ import { Setup } from './panels/setup'
import { Init } from './panels/init' import { Init } from './panels/init'
import { CustomRemixApi } from "@remix-api"; import { CustomRemixApi } from "@remix-api";
import { Plugin } from "@remixproject/engine"; import { Plugin } from "@remixproject/engine";
import { Disabled } from './disabled'
export const gitPluginContext = React.createContext<gitState>(defaultGitState) export const gitPluginContext = React.createContext<gitState>(defaultGitState)
export const loaderContext = React.createContext<loaderState>(defaultLoaderState) export const loaderContext = React.createContext<loaderState>(defaultLoaderState)
@ -161,82 +162,86 @@ export const GitUI = (props: IGitUi) => {
showAlert showAlert
} }
return ( return (
<div className="m-1"> <>{(!gitState.canUseApp) ? <Disabled></Disabled> :
<gitPluginContext.Provider value={gitState}> <div className="m-1">
<loaderContext.Provider value={loaderState}> <gitPluginContext.Provider value={gitState}>
<gitActionsContext.Provider value={gitActionsProviderValue}> <loaderContext.Provider value={loaderState}>
<pluginActionsContext.Provider value={pluginActionsProviderValue}> <gitActionsContext.Provider value={gitActionsProviderValue}>
<BranchHeader /> <pluginActionsContext.Provider value={pluginActionsProviderValue}>
<BranchHeader />
{setup && !needsInit ? <Setup></Setup> : null}
{needsInit ? <Init></Init> : null} {setup && !needsInit ? <Setup></Setup> : null}
{!setup && !needsInit ? {needsInit ? <Init></Init> : null}
<Accordion activeKey={activePanel} defaultActiveKey="0"> {!setup && !needsInit ?
<SourceControlNavigation eventKey="0" activePanel={activePanel} callback={setActivePanel} /> <Accordion activeKey={activePanel} defaultActiveKey="0">
<SourceControlNavigation eventKey="0" activePanel={activePanel} callback={setActivePanel} />
<Accordion.Collapse className='bg-light' eventKey="0">
<> <Accordion.Collapse className='bg-light' eventKey="0">
<SourceControlBase><CommitMessage /></SourceControlBase> <>
<SourceControl /> <SourceControlBase><CommitMessage /></SourceControlBase>
</> <SourceControl />
</Accordion.Collapse> </>
<hr></hr> </Accordion.Collapse>
<CommandsNavigation eventKey="1" activePanel={activePanel} callback={setActivePanel} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="1"> <CommandsNavigation eventKey="1" activePanel={activePanel} callback={setActivePanel} />
<> <Accordion.Collapse className='bg-light' eventKey="1">
<Commands></Commands> <>
</> <Commands></Commands>
</Accordion.Collapse> </>
<hr></hr> </Accordion.Collapse>
<CommitsNavigation title={`COMMITS`} eventKey="3" activePanel={activePanel} callback={setActivePanel} showButtons={true} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="3"> <CommitsNavigation title={`COMMITS`} eventKey="3" activePanel={activePanel} callback={setActivePanel} showButtons={true} />
<> <Accordion.Collapse className='bg-light' eventKey="3">
<Commits /> <>
</> <Commits />
</Accordion.Collapse> </>
<hr></hr> </Accordion.Collapse>
<BranchesNavigation eventKey="2" activePanel={activePanel} callback={setActivePanel} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="2"> <BranchesNavigation eventKey="2" activePanel={activePanel} callback={setActivePanel} />
<> <Accordion.Collapse className='bg-light' eventKey="2">
<Branches /></> <>
</Accordion.Collapse> <Branches /></>
<hr></hr> </Accordion.Collapse>
<RemotesNavigation eventKey="5" activePanel={activePanel} callback={setActivePanel} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="5"> <RemotesNavigation eventKey="5" activePanel={activePanel} callback={setActivePanel} />
<> <Accordion.Collapse className='bg-light' eventKey="5">
<Remotes></Remotes> <>
</> <Remotes></Remotes>
</Accordion.Collapse> </>
<hr></hr> </Accordion.Collapse>
<CloneNavigation eventKey="4" activePanel={activePanel} callback={setActivePanel} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="4"> <CloneNavigation eventKey="4" activePanel={activePanel} callback={setActivePanel} />
<> <Accordion.Collapse className='bg-light' eventKey="4">
<Clone /></> <>
</Accordion.Collapse> <Clone /></>
<hr></hr> </Accordion.Collapse>
<GitHubNavigation eventKey="7" activePanel={activePanel} callback={setActivePanel} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="7"> <GitHubNavigation eventKey="7" activePanel={activePanel} callback={setActivePanel} />
<> <Accordion.Collapse className='bg-light' eventKey="7">
<GetDeviceCode></GetDeviceCode> <>
<hr></hr> <GetDeviceCode></GetDeviceCode>
<GitHubCredentials></GitHubCredentials> <hr></hr>
</> <GitHubCredentials></GitHubCredentials>
</Accordion.Collapse> </>
<hr></hr> </Accordion.Collapse>
<LogNavigation eventKey="6" activePanel={activePanel} callback={setActivePanel} /> <hr></hr>
<Accordion.Collapse className='bg-light' eventKey="6"> <LogNavigation eventKey="6" activePanel={activePanel} callback={setActivePanel} />
<> <Accordion.Collapse className='bg-light' eventKey="6">
<LogViewer /> <>
</> <LogViewer />
</Accordion.Collapse> </>
</Accordion.Collapse>
</Accordion>
: null} </Accordion>
</pluginActionsContext.Provider> : null}
</gitActionsContext.Provider> </pluginActionsContext.Provider>
</loaderContext.Provider> </gitActionsContext.Provider>
</gitPluginContext.Provider> </loaderContext.Provider>
</div> </gitPluginContext.Provider>
</div>}
</>
) )
} }

@ -67,6 +67,7 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
}); });
plugin.on("filePanel", "setWorkspace", async (x: any) => { plugin.on("filePanel", "setWorkspace", async (x: any) => {
gitDispatch(setCanUseApp(x && !x.isLocalhost && x.name))
loadFileQueue.enqueue(async () => { loadFileQueue.enqueue(async () => {
loadFiles() loadFiles()
}) })

Loading…
Cancel
Save