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
5b2f422c
Commit
5b2f422c
authored
Sep 26, 2019
by
LianaHus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push to gist
parent
6f68cce0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
file-explorer.js
src/app/files/file-explorer.js
+23
-3
No files found.
src/app/files/file-explorer.js
View file @
5b2f422c
...
@@ -190,6 +190,16 @@ function fileExplorer (localRegistry, files, menuItems) {
...
@@ -190,6 +190,16 @@ function fileExplorer (localRegistry, files, menuItems) {
}
}
})
})
/**
* Extracts furst two folders as a subpath from the path.
**/
function
extractExternalFolder
(
path
)
{
const
firstSlIndex
=
path
.
indexOf
(
'/'
,
1
)
if
(
firstSlIndex
===
-
1
)
return
''
const
secondSlIndex
=
path
.
indexOf
(
'/'
,
firstSlIndex
+
1
)
if
(
secondSlIndex
===
-
1
)
return
''
return
path
.
substring
(
0
,
secondSlIndex
)
}
self
.
treeView
.
event
.
register
(
'nodeRightClick'
,
function
(
key
,
data
,
label
,
event
)
{
self
.
treeView
.
event
.
register
(
'nodeRightClick'
,
function
(
key
,
data
,
label
,
event
)
{
if
(
self
.
files
.
readonly
)
return
if
(
self
.
files
.
readonly
)
return
if
(
key
===
self
.
files
.
type
)
return
if
(
key
===
self
.
files
.
type
)
return
...
@@ -206,9 +216,19 @@ function fileExplorer (localRegistry, files, menuItems) {
...
@@ -206,9 +216,19 @@ function fileExplorer (localRegistry, files, menuItems) {
)
)
}
}
}
else
{
}
else
{
// extracts first two folders
const
folderPath
=
extractExternalFolder
(
key
)
const
firstTwoFolders
=
key
.
substring
(
0
,
key
.
indexOf
(
'/'
,
key
.
indexOf
(
'/'
,
1
)
+
1
))
if
(
folderPath
===
'browser/gists'
)
{
if
(
!
provider
.
isExternalFolder
(
firstTwoFolders
))
{
const
id
=
key
.
substr
(
key
.
lastIndexOf
(
'/'
),
key
.
length
-
1
)
actions
[
'Push changes to gist'
]
=
()
=>
{
modalDialogCustom
.
confirm
(
'Push back to Gist'
,
'Are you sure you want to push all your changes back to Gist?'
,
()
=>
{
this
.
toGist
(
id
)
},
()
=>
{}
)
}
}
if
(
!
provider
.
isExternalFolder
(
key
))
{
actions
[
'Rename'
]
=
()
=>
{
actions
[
'Rename'
]
=
()
=>
{
if
(
self
.
files
.
isReadOnly
(
key
))
{
return
tooltip
(
'cannot rename folder. '
+
self
.
files
.
type
+
' is a read only explorer'
)
}
if
(
self
.
files
.
isReadOnly
(
key
))
{
return
tooltip
(
'cannot rename folder. '
+
self
.
files
.
type
+
' is a read only explorer'
)
}
var
name
=
label
.
querySelector
(
'span[data-path="'
+
key
+
'"]'
)
var
name
=
label
.
querySelector
(
'span[data-path="'
+
key
+
'"]'
)
...
...
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