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
6ef49df0
Commit
6ef49df0
authored
Feb 25, 2021
by
ioedeveloper
Committed by
yann300
Mar 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor modals
parent
0dddd453
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
125 additions
and
173 deletions
+125
-173
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+46
-6
remix-ui-workspace.tsx
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+79
-167
No files found.
apps/remix-ide/src/app/panels/file-panel.js
View file @
6ef49df0
...
@@ -4,6 +4,7 @@ import * as packageJson from '../../../../../package.json'
...
@@ -4,6 +4,7 @@ import * as packageJson from '../../../../../package.json'
import
React
from
'react'
// eslint-disable-line
import
React
from
'react'
// eslint-disable-line
import
ReactDOM
from
'react-dom'
import
ReactDOM
from
'react-dom'
import
{
Workspace
}
from
'@remix-ui/workspace'
// eslint-disable-line
import
{
Workspace
}
from
'@remix-ui/workspace'
// eslint-disable-line
import
ethutil
from
'ethereumjs-util'
var
EventManager
=
require
(
'../../lib/events'
)
var
EventManager
=
require
(
'../../lib/events'
)
var
{
RemixdHandle
}
=
require
(
'../files/remixd-handle.js'
)
var
{
RemixdHandle
}
=
require
(
'../files/remixd-handle.js'
)
var
{
GitHandle
}
=
require
(
'../files/git-handle.js'
)
var
{
GitHandle
}
=
require
(
'../files/git-handle.js'
)
...
@@ -61,7 +62,7 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -61,7 +62,7 @@ module.exports = class Filepanel extends ViewPlugin {
this
.
registeredMenuItems
=
[]
this
.
registeredMenuItems
=
[]
this
.
request
=
{}
this
.
request
=
{}
this
.
workspaces
=
[]
this
.
workspaces
=
[]
this
.
renderComponent
()
this
.
initWorkspace
()
}
}
render
()
{
render
()
{
...
@@ -70,7 +71,7 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -70,7 +71,7 @@ module.exports = class Filepanel extends ViewPlugin {
renderComponent
()
{
renderComponent
()
{
ReactDOM
.
render
(
ReactDOM
.
render
(
<
Workspace
<
Workspace
setWorkspace
=
{
this
.
setWorkspace
.
bind
(
this
)}
setWorkspace
=
{
this
.
setWorkspace
.
bind
(
this
)}
workspaceRenamed
=
{
this
.
workspaceRenamed
.
bind
(
this
)}
workspaceRenamed
=
{
this
.
workspaceRenamed
.
bind
(
this
)}
workspaceDeleted
=
{
this
.
workspaceDeleted
.
bind
(
this
)}
workspaceDeleted
=
{
this
.
workspaceDeleted
.
bind
(
this
)}
...
@@ -79,16 +80,15 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -79,16 +80,15 @@ module.exports = class Filepanel extends ViewPlugin {
browser
=
{
this
.
_deps
.
fileProviders
.
browser
}
browser
=
{
this
.
_deps
.
fileProviders
.
browser
}
localhost
=
{
this
.
_deps
.
fileProviders
.
localhost
}
localhost
=
{
this
.
_deps
.
fileProviders
.
localhost
}
fileManager
=
{
this
.
_deps
.
fileManager
}
fileManager
=
{
this
.
_deps
.
fileManager
}
examples
=
{
examples
}
queryParams
=
{
new
QueryParams
()}
gistHandler
=
{
new
GistHandler
()}
registry
=
{
this
.
_components
.
registry
}
registry
=
{
this
.
_components
.
registry
}
plugin
=
{
this
}
plugin
=
{
this
}
request
=
{
this
.
request
}
request
=
{
this
.
request
}
examples
=
{
examples
}
workspaces
=
{
this
.
workspaces
}
workspaces
=
{
this
.
workspaces
}
setWorkspaceName
=
{
this
.
setWorkspaceName
}
registeredMenuItems
=
{
this
.
registeredMenuItems
}
registeredMenuItems
=
{
this
.
registeredMenuItems
}
/
>
/
>
,
this
.
el
)
,
this
.
el
)
}
}
/**
/**
...
@@ -126,6 +126,45 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -126,6 +126,45 @@ module.exports = class Filepanel extends ViewPlugin {
return
this
.
workspaces
return
this
.
workspaces
}
}
async
initWorkspace
()
{
const
queryParams
=
new
QueryParams
()
const
gistHandler
=
new
GistHandler
()
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
const
params
=
queryParams
.
get
()
// get the file from gist
const
loadedFromGist
=
gistHandler
.
loadFromGist
(
params
,
this
.
_deps
.
fileManager
)
if
(
loadedFromGist
)
return
if
(
params
.
code
)
{
try
{
await
this
.
_deps
.
fileManager
.
createWorkspace
(
'code-sample'
)
var
hash
=
ethutil
.
bufferToHex
(
ethutil
.
keccak
(
params
.
code
))
const
fileName
=
'contract-'
+
hash
.
replace
(
'0x'
,
''
).
substring
(
0
,
10
)
+
'.sol'
const
path
=
'browser/'
+
workspacesPath
+
'/code-sample/'
+
fileName
await
this
.
_deps
.
fileManager
.
writeFile
(
path
,
atob
(
params
.
code
))
this
.
setWorkspace
({
name
:
'code-sample'
,
isLocalhost
:
false
})
await
this
.
_deps
.
fileManager
.
openFile
(
path
)
}
catch
(
e
)
{
console
.
error
(
e
)
}
return
}
// insert example contracts if there are no files to show
this
.
_deps
.
fileProviders
.
browser
.
resolveDirectory
(
'/'
,
async
(
error
,
filesList
)
=>
{
if
(
error
)
console
.
error
(
error
)
if
(
Object
.
keys
(
filesList
).
length
===
0
)
{
for
(
const
file
in
examples
)
{
try
{
await
this
.
_deps
.
fileManager
.
writeFile
(
'browser/'
+
workspacesPath
+
'/default_workspace/'
+
examples
[
file
].
name
,
examples
[
file
].
content
)
}
catch
(
error
)
{
console
.
error
(
error
)
}
}
}
this
.
getWorkspaces
()
})
}
async
createNewFile
()
{
async
createNewFile
()
{
return
await
this
.
request
.
createNewFile
()
return
await
this
.
request
.
createNewFile
()
}
}
...
@@ -146,6 +185,7 @@ module.exports = class Filepanel extends ViewPlugin {
...
@@ -146,6 +185,7 @@ module.exports = class Filepanel extends ViewPlugin {
}
else
if
(
await
this
.
call
(
'manager'
,
'isActive'
,
'remixd'
))
{
}
else
if
(
await
this
.
call
(
'manager'
,
'isActive'
,
'remixd'
))
{
this
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
this
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
}
}
this
.
setWorkspaceName
=
workspace
.
name
this
.
emit
(
'setWorkspace'
,
workspace
)
this
.
emit
(
'setWorkspace'
,
workspace
)
}
}
...
...
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
View file @
6ef49df0
This diff is collapsed.
Click to expand it.
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