commit
c5f52d9fb4
@ -0,0 +1,79 @@ |
|||||||
|
'use strict' |
||||||
|
import { NightwatchBrowser } from 'nightwatch' |
||||||
|
import init from '../helpers/init' |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
before: function (browser: NightwatchBrowser, done: VoidFunction) { |
||||||
|
init(browser, done) |
||||||
|
}, |
||||||
|
|
||||||
|
'@sources': function () { |
||||||
|
return sources |
||||||
|
}, |
||||||
|
|
||||||
|
'Should pin solidity compiler plugin to the right and switch focus for left side panel to the file-explorer': function (browser: NightwatchBrowser) { |
||||||
|
browser.waitForElementVisible('[data-id="movePluginToRight"]') |
||||||
|
.click('[data-id="movePluginToRight"]') |
||||||
|
.waitForElementVisible('[data-id="movePluginToLeft"]') |
||||||
|
.waitForElementVisible('.pinned-panel h6[data-id="sidePanelSwapitTitle"]') |
||||||
|
.assert.containsText('.sidepanel h6[data-id="sidePanelSwapitTitle"]', 'FILE EXPLORER') |
||||||
|
.assert.containsText('.pinned-panel h6[data-id="sidePanelSwapitTitle"]', 'SOLIDITY COMPILER') |
||||||
|
}, |
||||||
|
'Should unpin and focus on solidity compiler in the left side panel': function (browser: NightwatchBrowser) { |
||||||
|
browser.waitForElementVisible('[data-id="movePluginToLeft"]') |
||||||
|
.click('[data-id="movePluginToLeft"]') |
||||||
|
.waitForElementVisible('[data-id="movePluginToRight"]') |
||||||
|
.assert.containsText('.sidepanel h6[data-id="sidePanelSwapitTitle"]', 'SOLIDITY COMPILER') |
||||||
|
.waitForElementNotVisible('.pinned-panel h6[data-id="sidePanelSwapitTitle"]') |
||||||
|
}, |
||||||
|
'Should pin a plugin while a another plugin is already pinned': function (browser: NightwatchBrowser) { |
||||||
|
browser.waitForElementVisible('[data-id="movePluginToRight"]') |
||||||
|
.click('[data-id="movePluginToRight"]') |
||||||
|
.waitForElementVisible('[data-id="movePluginToLeft"]') |
||||||
|
.waitForElementVisible('.pinned-panel h6[data-id="sidePanelSwapitTitle"]') |
||||||
|
.assert.containsText('.pinned-panel h6[data-id="sidePanelSwapitTitle"]', 'SOLIDITY COMPILER') |
||||||
|
.clickLaunchIcon('udapp') |
||||||
|
.click('[data-id="movePluginToRight"]') |
||||||
|
.waitForElementVisible('[data-id="movePluginToLeft"]') |
||||||
|
.assert.containsText('.pinned-panel h6[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS') |
||||||
|
.assert.containsText('.sidepanel h6[data-id="sidePanelSwapitTitle"]', 'SOLIDITY COMPILER') |
||||||
|
}, |
||||||
|
'Should pin a pinned plugin to the right after reloading the page': function (browser: NightwatchBrowser) { |
||||||
|
browser.refreshPage() |
||||||
|
.waitForElementVisible('.pinned-panel h6[data-id="sidePanelSwapitTitle"]') |
||||||
|
.assert.containsText('.pinned-panel h6[data-id="sidePanelSwapitTitle"]', 'DEPLOY & RUN TRANSACTIONS') |
||||||
|
}, |
||||||
|
'Should maintain logged state of udapp plugin after pinning and unpinning': function (browser: NightwatchBrowser) { |
||||||
|
browser.waitForElementVisible('*[data-id="treeViewLitreeViewItemcontracts"]') |
||||||
|
.click('*[data-id="treeViewLitreeViewItemcontracts"]') |
||||||
|
.openFile('contracts/1_Storage.sol') |
||||||
|
.pause(5000) |
||||||
|
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') |
||||||
|
.click('*[data-id="Deploy - transact (not payable)"]') |
||||||
|
.waitForElementPresent('#instance0xd9145CCE52D386f254917e481eB44e9943F39138') |
||||||
|
.clickInstance(0) |
||||||
|
.clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '10' }) |
||||||
|
.clickFunction('retrieve - call') |
||||||
|
.click('[data-id="movePluginToLeft"]') |
||||||
|
.waitForElementVisible('[data-id="movePluginToRight"]') |
||||||
|
.clickInstance(0) |
||||||
|
.waitForElementContainsText('[data-id="treeViewLi0"]', 'uint256: 10') |
||||||
|
}, |
||||||
|
'Should maintain logged state of search plugin after pinning and unpinning': function (browser: NightwatchBrowser) { |
||||||
|
browser.clickLaunchIcon('search') |
||||||
|
.waitForElementVisible('*[id="search_input"]') |
||||||
|
.waitForElementVisible('*[id="search_include"]') |
||||||
|
.setValue('*[id="search_include"]', ', *.*').pause(2000) |
||||||
|
.setValue('*[id="search_input"]', 'read').sendKeys('*[id="search_input"]', browser.Keys.ENTER) |
||||||
|
.pause(1000) |
||||||
|
.waitForElementContainsText('*[data-id="search_results"]', '3_BALLOT.SOL', 60000) |
||||||
|
.waitForElementContainsText('*[data-id="search_results"]', 'contracts', 60000) |
||||||
|
.waitForElementContainsText('*[data-id="search_results"]', 'README.TXT', 60000) |
||||||
|
.click('[data-id="movePluginToRight"]') |
||||||
|
.waitForElementContainsText('*[data-id="search_results"]', '3_BALLOT.SOL') |
||||||
|
.waitForElementContainsText('*[data-id="search_results"]', 'contracts') |
||||||
|
.waitForElementContainsText('*[data-id="search_results"]', 'README.TXT') |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
const sources = [] |
@ -0,0 +1,84 @@ |
|||||||
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
import React from 'react' |
||||||
|
import { AbstractPanel } from './panel' |
||||||
|
import { PluginRecord, RemixPluginPanel } from '@remix-ui/panel' |
||||||
|
import packageJson from '../../../../../package.json' |
||||||
|
import { RemixUIPanelHeader } from '@remix-ui/panel' |
||||||
|
import { PluginViewWrapper } from '@remix-ui/helper' |
||||||
|
|
||||||
|
const pinnedPanel = { |
||||||
|
name: 'pinnedPanel', |
||||||
|
displayName: 'Pinned Panel', |
||||||
|
description: 'Remix IDE pinned panel', |
||||||
|
version: packageJson.version, |
||||||
|
methods: ['addView', 'removeView', 'currentFocus', 'pinView', 'unPinView'] |
||||||
|
} |
||||||
|
|
||||||
|
export class PinnedPanel extends AbstractPanel { |
||||||
|
dispatch: React.Dispatch<any> = () => {} |
||||||
|
loggedState: any |
||||||
|
|
||||||
|
constructor() { |
||||||
|
super(pinnedPanel) |
||||||
|
} |
||||||
|
|
||||||
|
onActivation() { |
||||||
|
this.renderComponent() |
||||||
|
this.on('sidePanel', 'pluginDisabled', (name) => { |
||||||
|
if (this.plugins[name] && this.plugins[name].active) { |
||||||
|
this.emit('unPinnedPlugin', name) |
||||||
|
this.events.emit('unPinnedPlugin', name) |
||||||
|
super.remove(name) |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
async pinView (profile, view) { |
||||||
|
const activePlugin = this.currentFocus() |
||||||
|
|
||||||
|
if (activePlugin === profile.name) throw new Error(`Plugin ${profile.name} already pinned`) |
||||||
|
if (activePlugin) { |
||||||
|
await this.call('sidePanel', 'unPinView', this.plugins[activePlugin].profile, this.plugins[activePlugin].view) |
||||||
|
this.remove(activePlugin) |
||||||
|
} |
||||||
|
this.loggedState = await this.call('pluginStateLogger', 'getPluginState', profile.name) |
||||||
|
this.addView(profile, view) |
||||||
|
this.plugins[profile.name].pinned = true |
||||||
|
this.plugins[profile.name].active = true |
||||||
|
this.renderComponent() |
||||||
|
this.events.emit('pinnedPlugin', profile) |
||||||
|
this.emit('pinnedPlugin', profile) |
||||||
|
} |
||||||
|
|
||||||
|
async unPinView (profile) { |
||||||
|
const activePlugin = this.currentFocus() |
||||||
|
|
||||||
|
if (activePlugin !== profile.name) throw new Error(`Plugin ${profile.name} is not pinned`) |
||||||
|
await this.call('sidePanel', 'unPinView', profile, this.plugins[profile.name].view) |
||||||
|
super.remove(profile.name) |
||||||
|
this.renderComponent() |
||||||
|
this.events.emit('unPinnedPlugin', profile) |
||||||
|
this.emit('unPinnedPlugin', profile) |
||||||
|
} |
||||||
|
|
||||||
|
setDispatch (dispatch: React.Dispatch<any>) { |
||||||
|
this.dispatch = dispatch |
||||||
|
} |
||||||
|
|
||||||
|
render() { |
||||||
|
return ( |
||||||
|
<section className='panel pinned-panel'> <PluginViewWrapper plugin={this} /></section> |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
updateComponent(state: any) { |
||||||
|
return <RemixPluginPanel header={<RemixUIPanelHeader plugins={state.plugins} pinView={this.pinView.bind(this)} unPinView={this.unPinView.bind(this)}></RemixUIPanelHeader>} plugins={state.plugins} pluginState={state.pluginState} /> |
||||||
|
} |
||||||
|
|
||||||
|
renderComponent() { |
||||||
|
this.dispatch({ |
||||||
|
plugins: this.plugins, |
||||||
|
pluginState: this.loggedState |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -1,10 +0,0 @@ |
|||||||
{ |
|
||||||
"panel.author": "Autor", |
|
||||||
"panel.maintainedBy": "Mantenido por", |
|
||||||
"panel.documentation": "Documentación", |
|
||||||
"panel.description": "Descripción", |
|
||||||
"panel.maintainedByRemix": "Mantenido por Remix", |
|
||||||
"panel.pluginInfo": "Información del Complemento", |
|
||||||
"panel.linkToDoc": "Enlace a la documentación", |
|
||||||
"panel.makeAnissue": "Crear un asunto" |
|
||||||
} |
|
@ -1,10 +0,0 @@ |
|||||||
{ |
|
||||||
"panel.author": "Auteur", |
|
||||||
"panel.maintainedBy": "Maintenu par :", |
|
||||||
"panel.documentation": "Documentation", |
|
||||||
"panel.description": "Description", |
|
||||||
"panel.maintainedByRemix": "Maintenu par Remix", |
|
||||||
"panel.pluginInfo": "Informations sur l'extension", |
|
||||||
"panel.linkToDoc": "Lien vers la documentation", |
|
||||||
"panel.makeAnissue": "Faire un ticket" |
|
||||||
} |
|
@ -1,10 +0,0 @@ |
|||||||
{ |
|
||||||
"panel.author": "Autore", |
|
||||||
"panel.maintainedBy": "Mantenuto Da", |
|
||||||
"panel.documentation": "Documentazione", |
|
||||||
"panel.description": "Descrizione", |
|
||||||
"panel.maintainedByRemix": "Mantenuto da Remix", |
|
||||||
"panel.pluginInfo": "Informazioni sul plugin", |
|
||||||
"panel.linkToDoc": "Link alla documentazione", |
|
||||||
"panel.makeAnissue": "Crea una Issue" |
|
||||||
} |
|
@ -1,10 +0,0 @@ |
|||||||
{ |
|
||||||
"panel.author": "Автор", |
|
||||||
"panel.maintainedBy": "Поддерживается", |
|
||||||
"panel.documentation": "Документация", |
|
||||||
"panel.description": "Описание", |
|
||||||
"panel.maintainedByRemix": "Поддерживается Remix", |
|
||||||
"panel.pluginInfo": "Информация о плагине", |
|
||||||
"panel.linkToDoc": "Ссылка на документацию", |
|
||||||
"panel.makeAnissue": "Создать задачу" |
|
||||||
} |
|
@ -1,10 +0,0 @@ |
|||||||
{ |
|
||||||
"panel.author": "作者", |
|
||||||
"panel.maintainedBy": "维护者", |
|
||||||
"panel.documentation": "文档", |
|
||||||
"panel.description": "描述", |
|
||||||
"panel.maintainedByRemix": "由 Remix 维护", |
|
||||||
"panel.pluginInfo": "插件信息", |
|
||||||
"panel.linkToDoc": "文档链接", |
|
||||||
"panel.makeAnissue": "提交 issue" |
|
||||||
} |
|
@ -0,0 +1,26 @@ |
|||||||
|
import { Plugin } from "@remixproject/engine" |
||||||
|
import { EventEmitter } from 'events' |
||||||
|
import * as packageJson from '../../../../../package.json' |
||||||
|
|
||||||
|
const profile = { |
||||||
|
name: 'pluginStateLogger', |
||||||
|
events: [], |
||||||
|
methods: ['logPluginState', 'getPluginState'], |
||||||
|
version: packageJson.version, |
||||||
|
} |
||||||
|
|
||||||
|
export class PluginStateLogger extends Plugin { |
||||||
|
constructor() { |
||||||
|
super(profile) |
||||||
|
this.events = new EventEmitter() |
||||||
|
this.stateLogs = {} |
||||||
|
} |
||||||
|
|
||||||
|
logPluginState(name, state) { |
||||||
|
this.stateLogs[name] = state |
||||||
|
} |
||||||
|
|
||||||
|
getPluginState(name) { |
||||||
|
return this.stateLogs[name] |
||||||
|
} |
||||||
|
} |
Binary file not shown.
Binary file not shown.
@ -1 +1,2 @@ |
|||||||
export { Provider, extend, JSONRPCRequestPayload, JSONRPCResponsePayload, JSONRPCResponseCallback } from './provider' |
export { Provider, extend, JSONRPCRequestPayload, JSONRPCResponsePayload, JSONRPCResponseCallback } from './provider' |
||||||
|
export { Server } from './server' |
||||||
|
Loading…
Reference in new issue