remixd disable

pull/4791/head
bunsenstraat 5 months ago
parent c5915b0ad6
commit 0af14a0b8f
  1. 24
      apps/remix-ide-e2e/src/tests/remixd.test.ts
  2. 12
      libs/remix-ui/git/src/components/disabled.tsx
  3. 7
      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,7 +332,7 @@ 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')
) { ) {

@ -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,7 +162,10 @@ export const GitUI = (props: IGitUi) => {
showAlert showAlert
} }
return ( return (
<>{(!gitState.canUseApp) ? <Disabled></Disabled> :
<div className="m-1"> <div className="m-1">
<gitPluginContext.Provider value={gitState}> <gitPluginContext.Provider value={gitState}>
<loaderContext.Provider value={loaderState}> <loaderContext.Provider value={loaderState}>
@ -237,6 +241,7 @@ export const GitUI = (props: IGitUi) => {
</gitActionsContext.Provider> </gitActionsContext.Provider>
</loaderContext.Provider> </loaderContext.Provider>
</gitPluginContext.Provider> </gitPluginContext.Provider>
</div> </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