From 0af14a0b8fc223bb36ecb4486abdb985b7e22088 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 11 Jun 2024 06:59:24 +0200 Subject: [PATCH] remixd disable --- apps/remix-ide-e2e/src/tests/remixd.test.ts | 30 +++- libs/remix-ui/git/src/components/disabled.tsx | 12 ++ libs/remix-ui/git/src/components/gitui.tsx | 157 +++++++++--------- libs/remix-ui/git/src/lib/listeners.ts | 1 + 4 files changed, 120 insertions(+), 80 deletions(-) create mode 100644 libs/remix-ui/git/src/components/disabled.tsx diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index ceebe0d553..880ccb47cb 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.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 { 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) => { remixd.stdout.on('data', function (data) { - if( - data.toString().includes('is listening') + if ( + data.toString().includes('is listening') || data.toString().includes('There is already a client running') - ) { - + ) { + resolve(remixd) } }) diff --git a/libs/remix-ui/git/src/components/disabled.tsx b/libs/remix-ui/git/src/components/disabled.tsx new file mode 100644 index 0000000000..3ba210dd10 --- /dev/null +++ b/libs/remix-ui/git/src/components/disabled.tsx @@ -0,0 +1,12 @@ +import React, { useEffect, useState } from 'react' + +export const Disabled = () => { + + return ( +
+ Git is currently disabled.

+ If you are using RemixD you can use git on the terminal.

+
+ ) + +} \ No newline at end of file diff --git a/libs/remix-ui/git/src/components/gitui.tsx b/libs/remix-ui/git/src/components/gitui.tsx index d3e7d0e5ca..e7b6d2e940 100644 --- a/libs/remix-ui/git/src/components/gitui.tsx +++ b/libs/remix-ui/git/src/components/gitui.tsx @@ -33,6 +33,7 @@ import { Setup } from './panels/setup' import { Init } from './panels/init' import { CustomRemixApi } from "@remix-api"; import { Plugin } from "@remixproject/engine"; +import { Disabled } from './disabled' export const gitPluginContext = React.createContext(defaultGitState) export const loaderContext = React.createContext(defaultLoaderState) @@ -161,82 +162,86 @@ export const GitUI = (props: IGitUi) => { showAlert } + + return ( -
- - - - - - - {setup && !needsInit ? : null} - {needsInit ? : null} - {!setup && !needsInit ? - - - - - <> - - - - -
- - - <> - - - -
- - - <> - - - -
- - - <> - - -
- - - <> - - - -
- - - <> - - -
- - - <> - -
- - -
-
- - - <> - - - - -
- : null} -
-
-
-
-
+ <>{(!gitState.canUseApp) ? : +
+ + + + + + + {setup && !needsInit ? : null} + {needsInit ? : null} + {!setup && !needsInit ? + + + + + <> + + + + +
+ + + <> + + + +
+ + + <> + + + +
+ + + <> + + +
+ + + <> + + + +
+ + + <> + + +
+ + + <> + +
+ + +
+
+ + + <> + + + + +
+ : null} +
+
+
+
+
} + ) } \ No newline at end of file diff --git a/libs/remix-ui/git/src/lib/listeners.ts b/libs/remix-ui/git/src/lib/listeners.ts index 6c44938fa6..66c94bdd8d 100644 --- a/libs/remix-ui/git/src/lib/listeners.ts +++ b/libs/remix-ui/git/src/lib/listeners.ts @@ -67,6 +67,7 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch { + gitDispatch(setCanUseApp(x && !x.isLocalhost && x.name)) loadFileQueue.enqueue(async () => { loadFiles() })