open on click, click outside is handled

pull/2249/head
lianahus 3 years ago committed by yann300
parent e68d5b7e03
commit 842d5844ac
  1. 10
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  2. 6
      apps/remix-ide/src/app/tabs/compile-tab.js
  3. 5
      apps/solidity-compiler/src/app/compiler.ts
  4. 2
      libs/remix-lib/src/types/ICompilerApi.ts
  5. 9
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  6. 3
      libs/remix-ui/solidity-compiler/src/lib/css/style.css
  7. 1
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -231,10 +231,10 @@ module.exports = {
'Should get current files #group7': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'fileManager:readdir', {
'compiler_config.json': { isDirectory: false },
contracts: { isDirectory: true },
scripts: { isDirectory: true },
tests: { isDirectory: true },
'compiler_config.json': { isDirectory: false },
'README.txt': { isDirectory: false }
}, null, '/')
},
@ -293,7 +293,13 @@ module.exports = {
'Should create workspace #group2': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'testspace')
await clickAndCheckLog(browser, 'filePanel:getCurrentWorkspace', { name: 'testspace', isLocalhost: false, absolutePath: '.workspaces/testspace' }, null, null)
await clickAndCheckLog(browser, 'fileManager:readdir', { contracts: { isDirectory: true }, scripts: { isDirectory: true }, tests: { isDirectory: true }, 'compiler_config.json': { isDirectory: false }, 'README.txt': { isDirectory: false } }, null, null)
await clickAndCheckLog(browser, 'fileManager:readdir', {
'compiler_config.json': { isDirectory: false },
contracts: { isDirectory: true },
scripts: { isDirectory: true },
tests: { isDirectory: true },
'README.txt': { isDirectory: false }
}, null, null)
},
'Should get all workspaces #group2': async function (browser: NightwatchBrowser) {
await clickAndCheckLog(browser, 'filePanel:getWorkspaces', ['default_workspace', 'emptyworkspace', 'testspace'], null, null)

@ -135,9 +135,15 @@ class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerA
}
setCompilerParameters (params) {
console.log("compiler-tab.ts")
this.queryParams.update(params)
}
async openFile (path) {
return await this.call('fileManager', 'open', path)
}
async getAppParameter (name) {
return await this.call('config', 'getAppParameter', name)
}

@ -52,11 +52,16 @@ export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements
}
setCompilerParameters (params) {
console.log("compiler.ts")
for (const key of Object.keys(params)) {
localStorage.setItem(key, params[key])
}
}
async openFile (path) {
return await PluginClient.call('fileManager', 'open', path)
}
async getAppParameter (name) {
return await PluginClient.call('config', 'getAppParameter', name)
}

@ -14,6 +14,8 @@ export interface ICompilerApi {
getCompilerParameters: () => ConfigurationSettings
setCompilerParameters: (ConfigurationSettings?) => void
openFile: (path: string) => Promise<any>
getAppParameter: (value: string) => Promise<any>
setAppParameter: (name: string, value: string | boolean) => void

@ -197,7 +197,10 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
return { ...prevState, useFileConfiguration: !state.useFileConfiguration }
})
api.setAppParameter('useFileConfiguration', state.useFileConfiguration)
}
const openFile = async () => {
await api.openFile(state.configFilePath)
}
const createNewConfigFile = async () => {
@ -752,7 +755,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<label className="form-check-label custom-control-label" htmlFor="scFileConfig">Use configuration file</label>
</div>
<div className={`pt-2 ml-4 ml-2 align-items-start flex-column d-flex`}>
{ (!showFilePathInput && state.useFileConfiguration) && <span className="py-2 text-primary">{state.configFilePath}</span> }
{ (!showFilePathInput && state.useFileConfiguration) && <span
title="Click to open the config file."
onClick={openFile}
className="py-2 text-primary remixui_compilerConfigPath"
>{state.configFilePath}</span> }
{ (!showFilePathInput&& !state.useFileConfiguration) && <span className="py-2 text-secondary">{state.configFilePath}</span> }
<input
ref={configFilePathInput}

@ -78,6 +78,9 @@
.remixui_compilerConfigSection {
font-size: 1rem;
}
.remixui_compilerConfigPath {
cursor: pointer;
}
.remixui_compilerLabel {
margin-bottom: 2px;
font-size: 11px;

@ -111,7 +111,6 @@ export class CompileTabLogic {
const sources = { [target]: { content } }
this.event.emit('removeAnnotations')
this.event.emit('startingCompilation')
console.log("compile from ", this.configFilePath)
this.api.readFile(this.configFilePath).then( contentConfig => {
this.compiler.set('configFileContent', contentConfig)
})

Loading…
Cancel
Save