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
349f6113
Commit
349f6113
authored
Aug 16, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listen to notifications and display modal
parent
501d4b01
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
workspace.ts
libs/remix-ui/workspace/src/lib/actions/workspace.ts
+15
-17
FileSystemProvider.tsx
...mix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
+6
-0
No files found.
libs/remix-ui/workspace/src/lib/actions/workspace.ts
View file @
349f6113
...
...
@@ -60,7 +60,7 @@ export const displayNotification = (title: string, message: string, labelOk: str
export
const
hideNotification
=
()
=>
{
return
{
type
:
'
DISPLAY
_NOTIFICATION'
type
:
'
HIDE
_NOTIFICATION'
}
}
...
...
@@ -128,27 +128,25 @@ const createWorkspaceTemplate = async (workspaceName: string, setDefaults = true
const
response
:
AxiosResponse
=
await
axios
.
get
(
`https://api.github.com/gists/
${
gistId
}
`
)
const
data
=
response
.
data
console
.
log
(
'data: '
,
data
)
if
(
!
data
.
files
)
{
dispatch
(
displayNotification
(
'Gist load error'
,
'No files found'
,
'OK'
,
null
,
()
=>
{},
null
))
return
return
dispatch
(
displayNotification
(
'Gist load error'
,
'No files found'
,
'OK'
,
null
,
()
=>
{},
null
))
}
//
const obj = {}
const
obj
=
{}
//
Object.keys(data.files).forEach((element) => {
//
const path = element.replace(/\.\.\./g, '/')
Object
.
keys
(
data
.
files
).
forEach
((
element
)
=>
{
const
path
=
element
.
replace
(
/
\.\.\.
/g
,
'/'
)
//
obj['/' + 'gist-' + gistId + '/' + path] = data.files[element]
//
})
//
fileManager.setBatchFiles(obj, 'workspace', true, (errorLoadingFile) => {
//
if (!errorLoadingFile) {
// const provider =
fileManager.getProvider('workspace')
obj
[
'/'
+
'gist-'
+
gistId
+
'/'
+
path
]
=
data
.
files
[
element
]
})
plugin
.
fileManager
.
setBatchFiles
(
obj
,
'workspace'
,
true
,
(
errorLoadingFile
)
=>
{
if
(
!
errorLoadingFile
)
{
const
provider
=
plugin
.
fileManager
.
getProvider
(
'workspace'
)
//
provider.lastLoadedGistId = gistId
//
} else {
// // modalDialogCustom.alert('', errorLoadingFile.message || errorLoadingFile
)
//
}
//
})
provider
.
lastLoadedGistId
=
gistId
}
else
{
displayNotification
(
''
,
errorLoadingFile
.
message
||
errorLoadingFile
,
'OK'
,
null
,
()
=>
{},
null
)
}
})
}
catch
(
e
)
{
dispatch
(
displayNotification
(
'Gist load error'
,
e
.
message
,
'OK'
,
null
,
()
=>
{},
null
))
console
.
error
(
e
)
...
...
libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
View file @
349f6113
...
...
@@ -56,6 +56,12 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
}
},
[
modals
])
useEffect
(()
=>
{
if
(
fs
.
notification
.
title
)
{
modal
(
fs
.
notification
.
title
,
fs
.
notification
.
message
,
fs
.
notification
.
labelOk
,
fs
.
notification
.
actionOk
,
fs
.
notification
.
labelCancel
,
fs
.
notification
.
actionCancel
)
}
},
[
fs
.
notification
])
const
handleHideModal
=
()
=>
{
setFocusModal
(
modal
=>
{
return
{
...
modal
,
hide
:
true
,
message
:
null
}
...
...
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