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
92ce5981
Commit
92ce5981
authored
Jun 08, 2021
by
bunsenstraat
Committed by
Liana Husikyan
Jun 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor setworkspace event
mr console rm constants linting lint lint close file before settting workspace to null
parent
d17cb0a6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
remixd-handle.js
apps/remix-ide/src/app/files/remixd-handle.js
+4
-1
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+6
-6
remix-ui-workspace.tsx
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+5
-4
No files found.
apps/remix-ide/src/app/files/remixd-handle.js
View file @
92ce5981
...
...
@@ -19,6 +19,7 @@ var css = csjs`
word-break: break-word;
}
`
const
LOCALHOST
=
' - connect to localhost - '
const
profile
=
{
name
:
'remixd'
,
...
...
@@ -83,7 +84,9 @@ export class RemixdHandle extends WebsocketPlugin {
this
.
canceled
()
}
},
3000
)
this
.
localhostProvider
.
init
(()
=>
{})
this
.
localhostProvider
.
init
(()
=>
{
this
.
call
(
'filePanel'
,
'setWorkspace'
,
{
name
:
LOCALHOST
,
isLocalhost
:
true
},
true
)
})
this
.
call
(
'manager'
,
'activatePlugin'
,
'hardhat'
)
}
}
...
...
apps/remix-ide/src/app/panels/file-panel.js
View file @
92ce5981
...
...
@@ -34,7 +34,7 @@ const modalDialogCustom = require('../ui/modal-dialog-custom')
const
profile
=
{
name
:
'filePanel'
,
displayName
:
'File explorers'
,
methods
:
[
'createNewFile'
,
'uploadFile'
,
'getCurrentWorkspace'
,
'getWorkspaces'
,
'createWorkspace'
],
methods
:
[
'createNewFile'
,
'uploadFile'
,
'getCurrentWorkspace'
,
'getWorkspaces'
,
'createWorkspace'
,
'setWorkspace'
],
events
:
[
'setWorkspace'
,
'renameWorkspace'
,
'deleteWorkspace'
,
'createWorkspace'
],
icon
:
'assets/img/fileManager.webp'
,
description
:
' - '
,
...
...
@@ -43,7 +43,6 @@ const profile = {
documentation
:
'https://remix-ide.readthedocs.io/en/latest/file_explorer.html'
,
version
:
packageJson
.
version
}
module
.
exports
=
class
Filepanel
extends
ViewPlugin
{
constructor
(
appManager
)
{
super
(
profile
)
...
...
@@ -114,7 +113,6 @@ module.exports = class Filepanel extends ViewPlugin {
async
getWorkspaces
()
{
const
result
=
new
Promise
((
resolve
,
reject
)
=>
{
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
this
.
_deps
.
fileProviders
.
browser
.
resolveDirectory
(
'/'
+
workspacesPath
,
(
error
,
items
)
=>
{
if
(
error
)
{
console
.
error
(
error
)
...
...
@@ -247,14 +245,16 @@ module.exports = class Filepanel extends ViewPlugin {
}
/** these are called by the react component, action is already finished whent it's called */
async
setWorkspace
(
workspace
)
{
this
.
_deps
.
fileManager
.
closeAllFiles
()
async
setWorkspace
(
workspace
,
setEvent
=
true
)
{
if
(
workspace
.
isLocalhost
)
{
this
.
call
(
'manager'
,
'activatePlugin'
,
'remixd'
)
}
else
if
(
await
this
.
call
(
'manager'
,
'isActive'
,
'remixd'
))
{
this
.
call
(
'manager'
,
'deactivatePlugin'
,
'remixd'
)
}
this
.
emit
(
'setWorkspace'
,
workspace
)
if
(
setEvent
)
{
this
.
_deps
.
fileManager
.
setMode
(
workspace
.
isLocalhost
?
'localhost'
:
'browser'
)
this
.
emit
(
'setWorkspace'
,
workspace
)
}
}
workspaceRenamed
(
workspace
)
{
...
...
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
View file @
92ce5981
...
...
@@ -6,7 +6,7 @@ import { Toaster } from '@remix-ui/toaster'// eslint-disable-line
/* eslint-disable-next-line */
export
interface
WorkspaceProps
{
setWorkspace
:
({
name
:
string
,
isLocalhost
:
boolean
})
=>
void
,
setWorkspace
:
({
name
:
string
,
isLocalhost
:
boolean
}
,
setEvent
:
boolean
)
=>
void
,
createWorkspace
:
(
name
:
string
)
=>
void
,
renameWorkspace
:
(
oldName
:
string
,
newName
:
string
)
=>
void
workspaceRenamed
:
({
name
:
string
})
=>
void
,
...
...
@@ -74,7 +74,7 @@ export const Workspace = (props: WorkspaceProps) => {
let
getWorkspaces
=
async
()
=>
{
if
(
props
.
workspaces
&&
Array
.
isArray
(
props
.
workspaces
))
{
if
(
props
.
workspaces
.
length
>
0
&&
state
.
currentWorkspace
===
NO_WORKSPACE
)
{
props
.
workspace
.
setWorkspace
(
props
.
workspaces
[
0
])
await
props
.
workspace
.
setWorkspace
(
props
.
workspaces
[
0
])
setState
(
prevState
=>
{
return
{
...
prevState
,
workspaces
:
props
.
workspaces
,
currentWorkspace
:
props
.
workspaces
[
0
]
}
})
...
...
@@ -240,14 +240,15 @@ export const Workspace = (props: WorkspaceProps) => {
}
const
setWorkspace
=
async
(
name
)
=>
{
await
props
.
setWorkspace
({
name
,
isLocalhost
:
name
===
LOCALHOST
}
)
await
props
.
fileManager
.
closeAllFiles
(
)
if
(
name
===
LOCALHOST
)
{
props
.
workspace
.
clearWorkspace
()
}
else
if
(
name
===
NO_WORKSPACE
)
{
props
.
workspace
.
clearWorkspace
()
}
else
{
props
.
workspace
.
setWorkspace
(
name
)
await
props
.
workspace
.
setWorkspace
(
name
)
}
await
props
.
setWorkspace
({
name
,
isLocalhost
:
name
===
LOCALHOST
},
!
(
name
===
LOCALHOST
||
name
===
NO_WORKSPACE
))
props
.
plugin
.
getWorkspaces
()
setState
(
prevState
=>
{
return
{
...
prevState
,
currentWorkspace
:
name
}
...
...
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