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
2f56b8f3
Commit
2f56b8f3
authored
Feb 02, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add commnet and llittle cleaning
parent
e7120360
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
basicReadOnlyExplorer.js
src/app/files/basicReadOnlyExplorer.js
+4
-3
No files found.
src/app/files/basicReadOnlyExplorer.js
View file @
2f56b8f3
...
@@ -45,10 +45,10 @@ class BasicReadOnlyExplorer {
...
@@ -45,10 +45,10 @@ class BasicReadOnlyExplorer {
}
}
addReadOnly
(
path
,
content
,
rawPath
)
{
addReadOnly
(
path
,
content
,
rawPath
)
{
var
unprefixedPath
=
this
.
removePrefix
(
path
)
try
{
// lazy try to format JSON
try
{
// lazy try to format JSON
content
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
'
\
t'
)
content
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
'
\
t'
)
}
catch
(
e
)
{}
}
catch
(
e
)
{}
// splitting off the path in a tree structure, the json tree is used in `resolveDirectory`
var
split
=
path
var
split
=
path
var
folder
=
false
var
folder
=
false
while
(
split
.
lastIndexOf
(
'/'
)
!==
-
1
)
{
while
(
split
.
lastIndexOf
(
'/'
)
!==
-
1
)
{
...
@@ -61,9 +61,9 @@ class BasicReadOnlyExplorer {
...
@@ -61,9 +61,9 @@ class BasicReadOnlyExplorer {
folder
=
true
folder
=
true
}
}
this
.
paths
[
this
.
type
][
split
]
=
{
isDirectory
:
folder
}
this
.
paths
[
this
.
type
][
split
]
=
{
isDirectory
:
folder
}
this
.
files
[
this
.
type
+
'/'
+
unprefixedP
ath
]
=
content
this
.
files
[
p
ath
]
=
content
this
.
normalizedNames
[
rawPath
]
=
path
this
.
normalizedNames
[
rawPath
]
=
path
this
.
event
.
trigger
(
'fileAdded'
,
[
this
.
type
+
'/'
+
unprefixedP
ath
,
true
])
this
.
event
.
trigger
(
'fileAdded'
,
[
p
ath
,
true
])
return
true
return
true
}
}
...
@@ -87,6 +87,7 @@ class BasicReadOnlyExplorer {
...
@@ -87,6 +87,7 @@ class BasicReadOnlyExplorer {
var
self
=
this
var
self
=
this
if
(
path
[
0
]
===
'/'
)
path
=
path
.
substring
(
1
)
if
(
path
[
0
]
===
'/'
)
path
=
path
.
substring
(
1
)
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
// we just return the json tree populated by `addReadOnly`
callback
(
null
,
this
.
paths
[
path
])
callback
(
null
,
this
.
paths
[
path
])
}
}
...
...
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