Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
bea98e0a
Commit
bea98e0a
authored
Aug 12, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactorqueryParams
parent
0e6c0419
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
20 deletions
+27
-20
compile-tab.js
apps/remix-ide/src/app/tabs/compile-tab.js
+9
-1
compiler-container.tsx
...remix-ui/solidity-compiler/src/lib/compiler-container.tsx
+5
-5
compileTabLogic.ts
...mix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts
+10
-10
solidity-compiler.tsx
.../remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
+2
-2
index.ts
libs/remix-ui/solidity-compiler/src/lib/types/index.ts
+1
-2
No files found.
apps/remix-ide/src/app/tabs/compile-tab.js
View file @
bea98e0a
...
...
@@ -52,7 +52,7 @@ class CompileTab extends ViewPlugin {
eventHandlers
:
{},
loading
:
false
}
this
.
compileTabLogic
=
new
CompileTabLogic
(
this
.
compileTabLogic
=
new
CompileTabLogic
(
this
,
this
.
queryParams
,
this
.
fileManager
,
this
.
config
,
...
...
@@ -277,6 +277,14 @@ class CompileTab extends ViewPlugin {
,
this
.
el
)
}
getParameters
()
{
return
this
.
queryParams
.
get
()
}
setParameters
(
params
)
{
this
.
queryParams
.
update
(
params
)
}
onActivation
()
{
this
.
call
(
'manager'
,
'activatePlugin'
,
'solidity-logic'
)
this
.
listenToEvents
()
...
...
libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
View file @
bea98e0a
...
...
@@ -18,7 +18,7 @@ declare global {
const
_paq
=
window
.
_paq
=
window
.
_paq
||
[]
//eslint-disable-line
export
const
CompilerContainer
=
(
props
:
CompilerContainerProps
)
=>
{
const
{
config
,
queryParams
,
compileTabLogic
,
tooltip
,
modal
,
compiledFileName
,
setHardHatCompilation
,
updateCurrentVersion
,
isHardHatProject
,
configurationSettings
}
=
props
// eslint-disable-line
const
{
api
,
config
,
compileTabLogic
,
tooltip
,
modal
,
compiledFileName
,
setHardHatCompilation
,
updateCurrentVersion
,
isHardHatProject
,
configurationSettings
}
=
props
// eslint-disable-line
const
[
state
,
setState
]
=
useState
({
hideWarnings
:
false
,
autoCompile
:
false
,
...
...
@@ -65,7 +65,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
useEffect
(()
=>
{
if
(
compileTabLogic
&&
compileTabLogic
.
compiler
)
{
setState
(
prevState
=>
{
const
params
=
queryParams
.
get
()
const
params
=
api
.
getParameters
()
const
optimize
=
params
.
optimize
===
'false'
?
false
:
params
.
optimize
===
'true'
?
true
:
null
const
runs
=
params
.
runs
const
evmVersion
=
params
.
evmVersion
...
...
@@ -152,7 +152,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
allVersions
=
[...
allVersions
,
...
versions
]
selectedVersion
=
state
.
defaultVersion
if
(
queryParams
.
get
().
version
)
selectedVersion
=
queryParams
.
get
().
version
if
(
api
.
getParameters
().
version
)
selectedVersion
=
api
.
getParameters
().
version
// Check if version is a URL and corresponding filename starts with 'soljson'
if
(
selectedVersion
.
startsWith
(
'https://'
))
{
const
urlArr
=
selectedVersion
.
split
(
'/'
)
...
...
@@ -321,7 +321,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
})
}
updateCurrentVersion
(
selectedVersion
)
queryParams
.
update
({
version
:
selectedVersion
})
api
.
setParameters
({
version
:
selectedVersion
})
let
url
if
(
customUrl
!==
''
)
{
...
...
@@ -331,7 +331,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
})
updateCurrentVersion
(
selectedVersion
)
url
=
customUrl
queryParams
.
update
({
version
:
selectedVersion
})
api
.
setParameters
({
version
:
selectedVersion
})
}
else
if
(
selectedVersion
===
'builtin'
)
{
let
location
:
string
|
Location
=
window
.
document
.
location
let
path
=
location
.
pathname
...
...
libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts
View file @
bea98e0a
...
...
@@ -18,46 +18,46 @@ export class CompileTab extends Plugin {
public
compilerImport
public
event
constructor
(
public
queryParams
,
public
fileManager
,
public
config
,
public
fileProvider
,
public
contentImport
)
{
constructor
(
public
api
,
public
fileManager
,
public
config
,
public
fileProvider
,
public
contentImport
)
{
super
(
profile
)
this
.
event
=
new
EventEmitter
()
this
.
compiler
=
new
Compiler
((
url
,
cb
)
=>
this
.
call
(
'contentImport'
,
'resolveAndSave'
,
url
).
then
((
result
)
=>
cb
(
null
,
result
)).
catch
((
error
)
=>
cb
(
error
.
message
)))
}
init
()
{
this
.
optimize
=
this
.
queryParams
.
get
().
optimize
this
.
optimize
=
this
.
api
.
getParameters
().
optimize
this
.
optimize
=
this
.
optimize
===
'true'
this
.
queryParams
.
update
({
optimize
:
this
.
optimize
})
this
.
api
.
setParameters
({
optimize
:
this
.
optimize
})
this
.
compiler
.
set
(
'optimize'
,
this
.
optimize
)
this
.
runs
=
this
.
queryParams
.
get
().
runs
this
.
runs
=
this
.
api
.
getParameters
().
runs
this
.
runs
=
this
.
runs
&&
this
.
runs
!==
'undefined'
?
this
.
runs
:
200
this
.
queryParams
.
update
({
runs
:
this
.
runs
})
this
.
api
.
setParameters
({
runs
:
this
.
runs
})
this
.
compiler
.
set
(
'runs'
,
this
.
runs
)
this
.
evmVersion
=
this
.
queryParams
.
get
().
evmVersion
this
.
evmVersion
=
this
.
api
.
getParameters
().
evmVersion
if
(
this
.
evmVersion
===
'undefined'
||
this
.
evmVersion
===
'null'
||
!
this
.
evmVersion
)
{
this
.
evmVersion
=
null
}
this
.
queryParams
.
update
({
evmVersion
:
this
.
evmVersion
})
this
.
api
.
setParameters
({
evmVersion
:
this
.
evmVersion
})
this
.
compiler
.
set
(
'evmVersion'
,
this
.
evmVersion
)
}
setOptimize
(
newOptimizeValue
)
{
this
.
optimize
=
newOptimizeValue
this
.
queryParams
.
update
({
optimize
:
this
.
optimize
})
this
.
api
.
setParameters
({
optimize
:
this
.
optimize
})
this
.
compiler
.
set
(
'optimize'
,
this
.
optimize
)
}
setRuns
(
runs
)
{
this
.
runs
=
runs
this
.
queryParams
.
update
({
runs
:
this
.
runs
})
this
.
api
.
setParameters
({
runs
:
this
.
runs
})
this
.
compiler
.
set
(
'runs'
,
this
.
runs
)
}
setEvmVersion
(
newEvmVersion
)
{
this
.
evmVersion
=
newEvmVersion
this
.
queryParams
.
update
({
evmVersion
:
this
.
evmVersion
})
this
.
api
.
setParameters
({
evmVersion
:
this
.
evmVersion
})
this
.
compiler
.
set
(
'evmVersion'
,
this
.
evmVersion
)
}
...
...
libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
View file @
bea98e0a
...
...
@@ -9,7 +9,7 @@ import { Renderer } from '@remix-ui/renderer' // eslint-disable-line
import
'./css/style.css'
export
const
SolidityCompiler
=
(
props
:
SolidityCompilerProps
)
=>
{
const
{
plugin
,
plugin
:
{
config
,
queryParams
,
compileTabLogic
,
currentFile
,
fileProvider
,
fileManager
,
contractsDetails
,
contractMap
,
compileErrors
,
isHardHatProject
,
setHardHatCompilation
,
configurationSettings
}
}
=
props
const
{
plugin
,
plugin
:
{
config
,
compileTabLogic
,
currentFile
,
fileProvider
,
fileManager
,
contractsDetails
,
contractMap
,
compileErrors
,
isHardHatProject
,
setHardHatCompilation
,
configurationSettings
}
}
=
props
const
[
state
,
setState
]
=
useState
({
contractsDetails
:
{},
eventHandlers
:
{},
...
...
@@ -78,7 +78,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
return
(
<>
<
div
id=
"compileTabView"
>
<
CompilerContainer
config=
{
config
}
queryParams=
{
queryParams
}
compileTabLogic=
{
compileTabLogic
}
tooltip=
{
toast
}
modal=
{
modal
}
compiledFileName=
{
currentFile
}
setHardHatCompilation=
{
setHardHatCompilation
.
bind
(
plugin
)
}
updateCurrentVersion=
{
updateCurrentVersion
}
isHardHatProject=
{
isHardHatProject
}
configurationSettings=
{
configurationSettings
}
/>
<
CompilerContainer
api=
{
plugin
}
config=
{
config
}
compileTabLogic=
{
compileTabLogic
}
tooltip=
{
toast
}
modal=
{
modal
}
compiledFileName=
{
currentFile
}
setHardHatCompilation=
{
setHardHatCompilation
.
bind
(
plugin
)
}
updateCurrentVersion=
{
updateCurrentVersion
}
isHardHatProject=
{
isHardHatProject
}
configurationSettings=
{
configurationSettings
}
/>
<
ContractSelection
contractMap=
{
contractMap
}
fileProvider=
{
fileProvider
}
fileManager=
{
fileManager
}
contractsDetails=
{
contractsDetails
}
modal=
{
modal
}
/>
<
div
className=
"remixui_errorBlobs p-4"
data
-
id=
"compiledErrors"
>
<
span
data
-
id=
{
`compilationFinishedWith_${currentVersion}`
}
></
span
>
...
...
libs/remix-ui/solidity-compiler/src/lib/types/index.ts
View file @
bea98e0a
...
...
@@ -5,7 +5,6 @@ export interface SolidityCompilerProps {
}
|
Record
<
string
,
any
>
compileErrors
:
any
,
isHardHatProject
:
boolean
,
queryParams
:
any
,
compileTabLogic
:
any
,
currentFile
:
string
,
contractsDetails
:
Record
<
string
,
any
>
,
...
...
@@ -22,8 +21,8 @@ export interface SolidityCompilerProps {
}
export
interface
CompilerContainerProps
{
api
:
any
,
config
:
any
,
queryParams
:
any
,
compileTabLogic
:
any
,
tooltip
:
(
message
:
string
|
JSX
.
Element
)
=>
void
,
modal
:
(
title
:
string
,
message
:
string
|
JSX
.
Element
,
okLabel
:
string
,
okFn
:
()
=>
void
,
cancelLabel
?:
string
,
cancelFn
?:
()
=>
void
)
=>
void
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment