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
dc4c0ed5
Commit
dc4c0ed5
authored
Sep 27, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce read only mode
parent
8c8c4953
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
3 deletions
+9
-3
remixDProvider.js
apps/remix-ide/src/app/files/remixDProvider.js
+1
-0
events.ts
libs/remix-ui/workspace/src/lib/actions/events.ts
+5
-1
workspace.ts
libs/remix-ui/workspace/src/lib/actions/workspace.ts
+2
-1
file-explorer.tsx
libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
+1
-1
No files found.
apps/remix-ide/src/app/files/remixDProvider.js
View file @
dc4c0ed5
...
...
@@ -66,6 +66,7 @@ module.exports = class RemixDProvider extends FileProvider {
.
then
((
result
)
=>
{
this
.
_isReady
=
true
this
.
_readOnlyMode
=
result
this
.
event
.
emit
(
'readOnlyModeChanged'
,
result
)
this
.
_registerEvent
()
this
.
event
.
emit
(
'connected'
)
cb
&&
cb
()
...
...
libs/remix-ui/workspace/src/lib/actions/events.ts
View file @
dc4c0ed5
import
{
extractParentFromKey
}
from
'@remix-ui/helper'
import
React
from
'react'
import
{
action
}
from
'../types'
import
{
displayNotification
,
displayPopUp
,
fileAddedSuccess
,
fileRemovedSuccess
,
fileRenamedSuccess
,
folderAddedSuccess
,
loadLocalhostError
,
loadLocalhostRequest
,
loadLocalhostSuccess
,
removeContextMenuItem
,
rootFolderChangedSuccess
,
setContextMenuItem
,
setMode
}
from
'./payload'
import
{
displayNotification
,
displayPopUp
,
fileAddedSuccess
,
fileRemovedSuccess
,
fileRenamedSuccess
,
folderAddedSuccess
,
loadLocalhostError
,
loadLocalhostRequest
,
loadLocalhostSuccess
,
removeContextMenuItem
,
rootFolderChangedSuccess
,
setContextMenuItem
,
setMode
,
setReadOnlyMode
}
from
'./payload'
import
{
addInputField
,
createWorkspace
,
fetchWorkspaceDirectory
,
renameWorkspace
,
switchToWorkspace
,
uploadFile
}
from
'./workspace'
const
queuedEvents
=
[]
...
...
@@ -102,6 +102,10 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac
provider
.
event
.
on
(
'fileRenamedError'
,
async
()
=>
{
dispatch
(
displayNotification
(
'File Renamed Failed'
,
''
,
'Ok'
,
'Cancel'
))
})
provider
.
event
.
on
(
'readOnlyModeChanged'
,
(
mode
:
boolean
)
=>
{
dispatch
(
setReadOnlyMode
(
mode
))
})
}
const
registerContextMenuItem
=
(
item
:
action
)
=>
{
...
...
libs/remix-ui/workspace/src/lib/actions/workspace.ts
View file @
dc4c0ed5
import
{
bufferToHex
,
keccakFromString
}
from
'ethereumjs-util'
import
axios
,
{
AxiosResponse
}
from
'axios'
import
{
addInputFieldSuccess
,
createWorkspaceError
,
createWorkspaceRequest
,
createWorkspaceSuccess
,
displayNotification
,
fetchWorkspaceDirectoryError
,
fetchWorkspaceDirectoryRequest
,
fetchWorkspaceDirectorySuccess
,
hideNotification
,
setCurrentWorkspace
,
setMode
,
setRenameWorkspace
}
from
'./payload'
import
{
addInputFieldSuccess
,
createWorkspaceError
,
createWorkspaceRequest
,
createWorkspaceSuccess
,
displayNotification
,
fetchWorkspaceDirectoryError
,
fetchWorkspaceDirectoryRequest
,
fetchWorkspaceDirectorySuccess
,
hideNotification
,
setCurrentWorkspace
,
setMode
,
setRe
adOnlyMode
,
setRe
nameWorkspace
}
from
'./payload'
import
{
checkSlash
,
checkSpecialChars
}
from
'@remix-ui/helper'
const
examples
=
require
(
'../../../../../../apps/remix-ide/src/app/editor/examples'
)
...
...
@@ -197,6 +197,7 @@ export const switchToWorkspace = async (name: string) => {
await
plugin
.
fileProviders
.
workspace
.
setWorkspace
(
name
)
dispatch
(
setMode
(
'browser'
))
dispatch
(
setCurrentWorkspace
(
name
))
dispatch
(
setReadOnlyMode
(
false
))
plugin
.
emit
(
'setWorkspace'
,
{
name
,
isLocalhost
:
false
})
}
}
...
...
libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
View file @
dc4c0ed5
...
...
@@ -287,7 +287,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
}
const
editModeOn
=
(
path
:
string
,
type
:
string
,
isNew
:
boolean
=
false
)
=>
{
if
(
props
.
readonly
)
return
if
(
props
.
readonly
)
return
props
.
toast
(
'Cannot write/modify file system in read only mode.'
)
setState
(
prevState
=>
{
return
{
...
prevState
,
focusEdit
:
{
...
prevState
.
focusEdit
,
element
:
path
,
isNew
,
type
}
}
})
...
...
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