Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
feat: open to grid-ui terminal (#340)
Browse files Browse the repository at this point in the history
* feat: open to grid-ui terminal

* chore: remove node-pty dep
  • Loading branch information
wolovim authored and PhilippLgh committed Jul 18, 2019
1 parent 7b788da commit e20a739
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
20 changes: 1 addition & 19 deletions ethereum_clients/Plugin.js
Expand Up @@ -4,7 +4,6 @@ const os = require('os')
const { EventEmitter } = require('events')
const { getBinaryUpdater } = require('./util')
const ControlledProcess = require('./ControlledProcess')
const pty = require('node-pty')

let rpcId = 1

Expand Down Expand Up @@ -182,22 +181,8 @@ class Plugin extends EventEmitter {
console.warn('no binary found for', release)
return undefined
}
async startPtyProcess() {
// FIXME only a test
// Initialize node-pty with an appropriate shell
const { binaryPath } = await this.getLocalBinary()
const shell = process.env[os.platform() === 'win32' ? 'COMSPEC' : 'SHELL']
const ptyProcess = pty.spawn(shell, [], {
name: 'xterm-color',
cols: 80,
rows: 30,
cwd: path.join(binaryPath, '..'),
env: process.env
})
return ptyProcess
}

async start(release, flags) {
async start(release, flags) {
// TODO do flag validation here based on proxy metadata
const { beforeStart } = this.config
if (beforeStart && beforeStart.execute) {
Expand Down Expand Up @@ -363,9 +348,6 @@ class PluginProxy extends EventEmitter {
getLocalBinary(release) {
return this.plugin.getLocalBinary(release)
}
startPtyProcess() {
return this.plugin.startPtyProcess()
}
start(release, config) {
return this.plugin.start(release, config)
}
Expand Down
5 changes: 1 addition & 4 deletions package.json
Expand Up @@ -19,16 +19,13 @@
"test:integration:geth": "cross-env NODE_ENV=test mocha ./test/integration/geth.test.js",
"prepare-release": "node ./scripts/copyApp.js",
"build": "yarn run prepare-release && build",
"release": "env-cmd .env build",
"rebuild": "electron-rebuild -f -o node-pty",
"postinstall": "yarn rebuild"
"release": "env-cmd .env build"
},
"dependencies": {
"@philipplgh/electron-app-manager": "^0.42.0",
"auto-launch": "^5.0.5",
"debug": "^4.1.1",
"menubar": "^6.0.6",
"node-pty": "^0.9.0-beta19",
"xterm": "^3.14.4"
},
"peerDependencies": {},
Expand Down
12 changes: 10 additions & 2 deletions ui/nano.html
Expand Up @@ -364,7 +364,8 @@
openUI: async function() {
const settings = Grid.Config.getItem('settings')
const newSettings = Object.assign({}, settings, {
selected: this.client.name
selected: this.client.name,
selectedTab: 0
})
Grid.Config.setItem('settings', newSettings)

Expand All @@ -380,12 +381,19 @@
})
},
openTerminal: async function() {
const settings = Grid.Config.getItem('settings')
const newSettings = Object.assign({}, settings, {
selected: this.client.name,
selectedTab: 2
})
Grid.Config.setItem('settings', newSettings)

this.terminalWindowId = await window.Grid.AppManager.launch({
name: 'grid-ui',
id: this.terminalWindowId,
args: {
scope: {
component: 'terminal',
component: 'ui',
client: this.client.name
}
}
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Expand Up @@ -4148,7 +4148,7 @@ mute-stream@0.0.7:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=

nan@^2.0.8, nan@^2.12.1, nan@^2.13.2, nan@^2.14.0, nan@^2.2.1:
nan@^2.0.8, nan@^2.12.1, nan@^2.14.0, nan@^2.2.1:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
Expand Down Expand Up @@ -4236,13 +4236,6 @@ node-pre-gyp@^0.12.0:
semver "^5.3.0"
tar "^4"

node-pty@^0.9.0-beta19:
version "0.9.0-beta9"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.9.0-beta9.tgz#75cffcf4026f543475c115f017ca7fe66cf6e7fe"
integrity sha512-h6e8jUikGSZwqt1JHmzT5Zi0fdUCultX/BWrS35suTaZNJm/YSJA2QDG9HTVoSA6dhRvtFoaGiBtgbX9uZKe6w==
dependencies:
nan "^2.13.2"

"nopt@2 || 3":
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
Expand Down

0 comments on commit e20a739

Please sign in to comment.