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
c4b9385c
Unverified
Commit
c4b9385c
authored
May 20, 2021
by
David Disu
Committed by
GitHub
May 20, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1185 from ethereum/publish-gist-menu
Publish files and folder to gist
parents
0553a65a
7e4e9e33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
19 deletions
+38
-19
gist.spec.ts
apps/remix-ide-e2e/src/tests/gist.spec.ts
+6
-6
gist-handler.js
apps/remix-ide/src/lib/gist-handler.js
+3
-1
fileSystem.ts
libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts
+9
-5
file-explorer-context-menu.tsx
...x-ui/file-explorer/src/lib/file-explorer-context-menu.tsx
+8
-2
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+0
-0
fileSystem.ts
libs/remix-ui/file-explorer/src/lib/reducers/fileSystem.ts
+6
-3
index.ts
libs/remix-ui/file-explorer/src/lib/types/index.ts
+6
-2
No files found.
apps/remix-ide-e2e/src/tests/gist.spec.ts
View file @
c4b9385c
...
...
@@ -54,9 +54,9 @@ module.exports = {
.
click
(
'[data-id="default_workspace-modal-footer-cancel-react"]'
)
.
executeScript
(
`remix.loadgist('
${
gistid
}
')`
)
// .perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('gists') } done() })
.
waitForElementVisible
(
`[data-id="treeViewLitreeViewItem
${
gistid
}
"]`
)
.
click
(
`[data-id="treeViewLitreeViewItem
${
gistid
}
"]`
)
.
openFile
(
`
${
gistid
}
/README.txt`
)
.
waitForElementVisible
(
`[data-id="treeViewLitreeViewItem
/gist-
${
gistid
}
"]`
)
.
click
(
`[data-id="treeViewLitreeViewItem
/gist-
${
gistid
}
"]`
)
.
openFile
(
`
gist-
${
gistid
}
/README.txt`
)
}
})
},
...
...
@@ -118,9 +118,9 @@ module.exports = {
.
waitForElementVisible
(
'*[data-id="modalDialogCustomPromptText"]'
)
.
setValue
(
'*[data-id="modalDialogCustomPromptText"]'
,
testData
.
validGistId
)
.
modalFooterOKClick
()
.
openFile
(
`
${
testData
.
validGistId
}
/ApplicationRegistry`
)
.
waitForElementVisible
(
`div[title='default_workspace/
${
testData
.
validGistId
}
/ApplicationRegistry']`
)
.
assert
.
containsText
(
`div[title='default_workspace/
${
testData
.
validGistId
}
/ApplicationRegistry'] > span`
,
'ApplicationRegistry'
)
.
openFile
(
`
gist-
${
testData
.
validGistId
}
/ApplicationRegistry`
)
.
waitForElementVisible
(
`div[title='default_workspace/
gist-
${
testData
.
validGistId
}
/ApplicationRegistry']`
)
.
assert
.
containsText
(
`div[title='default_workspace/
gist-
${
testData
.
validGistId
}
/ApplicationRegistry'] > span`
,
'ApplicationRegistry'
)
.
end
()
}
}
apps/remix-ide/src/lib/gist-handler.js
View file @
c4b9385c
...
...
@@ -54,7 +54,9 @@ function GistHandler (_window) {
}
const
obj
=
{}
Object
.
keys
(
data
.
files
).
forEach
((
element
)
=>
{
obj
[
'/'
+
gistId
+
'/'
+
element
]
=
data
.
files
[
element
]
const
path
=
element
.
replace
(
/
\.\.\.
/g
,
'/'
)
obj
[
'/'
+
'gist-'
+
gistId
+
'/'
+
path
]
=
data
.
files
[
element
]
})
fileManager
.
setBatchFiles
(
obj
,
'workspace'
,
true
,
(
errorLoadingFile
)
=>
{
if
(
!
errorLoadingFile
)
{
...
...
libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts
View file @
c4b9385c
...
...
@@ -41,14 +41,16 @@ const normalize = (parent, filesList, newInputType?: string): any => {
if
(
filesList
[
key
].
isDirectory
)
{
folders
[
extractNameFromKey
(
key
)]
=
{
path
,
name
:
extractNameFromKey
(
path
),
isDirectory
:
filesList
[
key
].
isDirectory
name
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
extractNameFromKey
(
path
).
split
(
'-'
)[
1
]
:
extractNameFromKey
(
path
),
isDirectory
:
filesList
[
key
].
isDirectory
,
type
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
'gist'
:
'folder'
}
}
else
{
files
[
extractNameFromKey
(
key
)]
=
{
path
,
name
:
extractNameFromKey
(
path
),
isDirectory
:
filesList
[
key
].
isDirectory
isDirectory
:
filesList
[
key
].
isDirectory
,
type
:
'file'
}
}
})
...
...
@@ -59,7 +61,8 @@ const normalize = (parent, filesList, newInputType?: string): any => {
folders
[
path
]
=
{
path
:
path
,
name
:
''
,
isDirectory
:
true
isDirectory
:
true
,
type
:
'folder'
}
}
else
if
(
newInputType
===
'file'
)
{
const
path
=
parent
+
'/blank'
...
...
@@ -67,7 +70,8 @@ const normalize = (parent, filesList, newInputType?: string): any => {
files
[
path
]
=
{
path
:
path
,
name
:
''
,
isDirectory
:
false
isDirectory
:
false
,
type
:
'file'
}
}
...
...
libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx
View file @
c4b9385c
...
...
@@ -4,7 +4,7 @@ import { FileExplorerContextMenuProps } from './types'
import
'./css/file-explorer-context-menu.css'
export
const
FileExplorerContextMenu
=
(
props
:
FileExplorerContextMenuProps
)
=>
{
const
{
actions
,
createNewFile
,
createNewFolder
,
deletePath
,
renamePath
,
hideContextMenu
,
pu
blish
ToGist
,
runScript
,
emit
,
pageX
,
pageY
,
path
,
type
,
...
otherProps
}
=
props
const
{
actions
,
createNewFile
,
createNewFolder
,
deletePath
,
renamePath
,
hideContextMenu
,
pu
shChangesToGist
,
publishFileToGist
,
publishFolder
ToGist
,
runScript
,
emit
,
pageX
,
pageY
,
path
,
type
,
...
otherProps
}
=
props
const
contextMenuRef
=
useRef
(
null
)
useEffect
(()
=>
{
...
...
@@ -50,7 +50,13 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
deletePath
(
path
)
break
case
'Push changes to gist'
:
publishToGist
()
pushChangesToGist
(
path
,
type
)
break
case
'Publish folder to gist'
:
publishFolderToGist
(
path
,
type
)
break
case
'Publish file to gist'
:
publishFileToGist
(
path
,
type
)
break
case
'Run'
:
runScript
(
path
)
...
...
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
c4b9385c
This diff is collapsed.
Click to expand it.
libs/remix-ui/file-explorer/src/lib/reducers/fileSystem.ts
View file @
c4b9385c
...
...
@@ -258,7 +258,8 @@ const resolveDirectory = (root, path: string, files, content) => {
files
=
_
.
set
(
files
,
_path
,
{
isDirectory
:
true
,
path
,
name
:
extractNameFromKey
(
path
),
name
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
extractNameFromKey
(
path
).
split
(
'-'
)[
1
]
:
extractNameFromKey
(
path
),
type
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
'gist'
:
'folder'
,
child
:
{
...
content
[
pathArr
[
pathArr
.
length
-
1
]],
...(
prevFiles
?
prevFiles
.
child
:
{})
}
})
...
...
@@ -278,7 +279,8 @@ const removePath = (root, path: string, pathName, files) => {
files
=
_
.
set
(
files
,
_path
,
{
isDirectory
:
true
,
path
,
name
:
extractNameFromKey
(
path
),
name
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
extractNameFromKey
(
path
).
split
(
'-'
)[
1
]
:
extractNameFromKey
(
path
),
type
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
'gist'
:
'folder'
,
child
:
prevFiles
?
prevFiles
.
child
:
{}
})
...
...
@@ -336,7 +338,8 @@ const fileRenamed = (root, path: string, removePath: string, files, content) =>
files
=
_
.
set
(
files
,
_path
,
{
isDirectory
:
true
,
path
,
name
:
extractNameFromKey
(
path
),
name
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
extractNameFromKey
(
path
).
split
(
'-'
)[
1
]
:
extractNameFromKey
(
path
),
type
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
'gist'
:
'folder'
,
child
:
{
...
content
[
pathArr
[
pathArr
.
length
-
1
]],
...
prevFiles
.
child
}
})
...
...
libs/remix-ui/file-explorer/src/lib/types/index.ts
View file @
c4b9385c
...
...
@@ -15,6 +15,7 @@ export interface File {
path
:
string
,
name
:
string
,
isDirectory
:
boolean
,
type
:
string
,
child
?:
File
[]
}
...
...
@@ -24,7 +25,7 @@ export interface FileExplorerMenuProps {
fileManager
:
any
,
createNewFile
:
(
folder
?:
string
)
=>
void
,
createNewFolder
:
(
parentFolder
?:
string
)
=>
void
,
publishToGist
:
()
=>
void
,
publishToGist
:
(
path
?:
string
)
=>
void
,
uploadFile
:
(
target
:
EventTarget
&
HTMLInputElement
)
=>
void
}
...
...
@@ -35,7 +36,10 @@ export interface FileExplorerContextMenuProps {
deletePath
:
(
path
:
string
)
=>
void
,
renamePath
:
(
path
:
string
,
type
:
string
)
=>
void
,
hideContextMenu
:
()
=>
void
,
publishToGist
?:
()
=>
void
,
publishToGist
?:
(
path
?:
string
,
type
?:
string
)
=>
void
,
pushChangesToGist
?:
(
path
?:
string
,
type
?:
string
)
=>
void
,
publishFolderToGist
?:
(
path
?:
string
,
type
?:
string
)
=>
void
,
publishFileToGist
?:
(
path
?:
string
,
type
?:
string
)
=>
void
,
runScript
?:
(
path
:
string
)
=>
void
,
emit
?:
(
id
:
string
,
path
:
string
)
=>
void
,
pageX
:
number
,
...
...
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