Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
slapos.toolbox
Commits
5d67b673
Commit
5d67b673
authored
May 27, 2014
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Editor: Add favourites folders, fix fileTree
parent
bcf067ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
24 deletions
+116
-24
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+2
-2
slapos/runner/static/css/ui.fancytree.css
slapos/runner/static/css/ui.fancytree.css
+1
-2
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+110
-17
slapos/runner/templates/softwareFolder.html
slapos/runner/templates/softwareFolder.html
+3
-3
No files found.
slapos/runner/static/css/styles.css
View file @
5d67b673
...
...
@@ -656,7 +656,7 @@ a.lshare img{
position
:
absolute
;
top
:
0px
;
left
:
0
;
right
:
7
0px
;
right
:
3
0px
;
}
#error
div
{
...
...
@@ -667,7 +667,7 @@ a.lshare img{
min-width
:
300px
;
max-width
:
500px
;
float
:
right
;
border-radius
:
4
px
;
border-radius
:
2
px
;
box-shadow
:
0
2px
4px
rgba
(
0
,
0
,
0
,
0.2
);
text-align
:
left
;
position
:
relative
;
...
...
slapos/runner/static/css/ui.fancytree.css
View file @
5d67b673
...
...
@@ -42,7 +42,6 @@ ul.fancytree-container li
background-position
:
0
0
;
background-repeat
:
repeat-y
;
background-image
:
none
;
/* no v-lines */
margin
:
0
;
padding
:
4px
0
0
0
;
}
...
...
@@ -67,7 +66,7 @@ ul.fancytree-no-connector > li
span
.fancytree-node
{
display
:
inline-
block
;
display
:
inline-
table
;
width
:
100%
;
border
:
1px
solid
transparent
;
}
...
...
slapos/runner/static/js/scripts/softwareFolder.js
View file @
5d67b673
...
...
@@ -29,6 +29,7 @@ $(document).ready(function () {
base_path
=
function
()
{
return
softwareDisplay
?
currentProject
:
'
workspace/
'
;
};
var
MAX_TABITITLE_WIDTH
=
126
;
var
TAB_EXTRA_WIDTH
=
25
;
var
MIN_TABITEM_WIDTH
=
61
;
//The minimum size of tabItem
...
...
@@ -124,7 +125,6 @@ $(document).ready(function () {
})
.
always
(
function
()
{
editorlist
[
hash
].
busy
=
false
;
editorlist
[
hash
].
editor
.
session
.
getUndoManager
().
markClean
();
});
}
...
...
@@ -286,10 +286,10 @@ $(document).ready(function () {
editor
.
on
(
'
input
'
,
function
(
e
)
{
var
activeToken
=
getActiveToken
(),
activeSpan
=
getActiveTabTitleSelector
();
if
(
editorlist
[
activeToken
].
editor
.
session
.
getUndoManager
().
isClean
()){
return
;
}
if
(
!
editorlist
[
activeToken
].
busy
&&
!
editorlist
[
activeToken
].
changed
)
{
if
(
!
editorlist
[
activeToken
].
editor
.
session
.
getUndoManager
().
hasUndo
()){
return
;
}
editorlist
[
activeToken
].
changed
=
true
;
$
(
activeSpan
).
html
(
"
*
"
+
$
(
activeSpan
).
html
());
if
(
beforeunload_warning_set
===
0
)
{
...
...
@@ -370,8 +370,14 @@ $(document).ready(function () {
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
filename
=
path
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
html
(
"
Md5sum for file [
"
+
filename
+
"
]:
"
+
data
.
result
);
if
(
$
(
"
body
"
).
hasClass
(
"
fullScreen
"
)
)
{
$
(
"
#error
"
).
Popup
(
"
Md5sum for file [
"
+
filename
+
"
]:<br/>
"
+
"
<b>
"
+
data
.
result
+
"
</b>
"
,
{
type
:
'
confirm
'
});
}
else
{
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
html
(
"
Md5sum for file [
"
+
filename
+
"
]:
"
+
data
.
result
);
}
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
...
...
@@ -475,7 +481,7 @@ $(document).ready(function () {
if
(
ajaxResult
){
if
(
dataForSend
.
opt
===
14
){
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
else
if
(
node
.
isExpanded
()){
node
.
addChildren
(
cb
);
...
...
@@ -498,7 +504,7 @@ $(document).ready(function () {
node
.
setFocus
();
node
.
setActive
();
if
(
srcElement
.
hasClass
(
'
fancytree-folder
'
)){
menu
.
disableContextMenuItems
(
"
#edit,#view,#md5sum
,#favorite
"
);
menu
.
disableContextMenuItems
(
"
#edit,#view,#md5sum
"
);
}
else
{
menu
.
disableContextMenuItems
(
"
#nfile,#nfolder,#refresh,#paste,#ufile
"
);
...
...
@@ -579,7 +585,7 @@ $(document).ready(function () {
break
;
case
"
refresh
"
:
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
break
;
case
"
nfolder
"
:
var
newName
=
window
.
prompt
(
'
Please Enter the folder name:
'
);
...
...
@@ -595,7 +601,7 @@ $(document).ready(function () {
request
.
always
(
function
()
{
if
(
ajaxResult
){
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
});
break
;
...
...
@@ -613,7 +619,7 @@ $(document).ready(function () {
request
.
always
(
function
()
{
if
(
ajaxResult
){
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
});
break
;
...
...
@@ -635,7 +641,7 @@ $(document).ready(function () {
break
;
case
"
rename
"
:
var
newName
=
window
.
prompt
(
'
Please enter the new name:
'
,
node
.
title
);
if
(
newName
==
null
)
{
if
(
newName
==
=
null
)
{
return
;
}
dataForSend
=
{
...
...
@@ -657,14 +663,18 @@ $(document).ready(function () {
}
else
{
node
.
getParent
().
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
}
});
break
;
case
"
favorite
"
:
addToFavourite
(
node
.
data
.
path
);
var
nodePath
=
node
.
data
.
path
;
if
(
node
.
isFolder
())
{
nodePath
=
(
nodePath
.
substr
(
-
1
)
===
'
/
'
)
?
nodePath
:
nodePath
+
'
/
'
;
}
addToFavourite
(
nodePath
);
break
;
case
"
ufile
"
:
$
.
colorbox
.
remove
();
...
...
@@ -764,14 +774,85 @@ $(document).ready(function () {
}
});
}
function
expandAfterLoad
(
node
,
toState
)
{
/*Expand node after the call of load.
toState if true of false*/
setTimeout
(
function
()
{
if
(
node
.
isLoaded
())
{
node
.
setExpanded
(
toState
);
}
else
{
expandAfterLoad
(
node
,
toState
);
}
},
300
);
}
function
loadNodeAndExpand
(
tree
,
subNode
,
node
,
position
,
loading
)
{
var
i
=
position
,
nextNode
=
null
;
if
(
i
>=
subNode
.
length
)
{
if
(
node
)
{
node
.
setActive
(
true
);
node
.
scrollIntoView
();
}
return
;
}
if
(
!
loading
)
{
var
childList
=
(
i
===
1
)
?
tree
.
toDict
()
:
node
.
getChildren
();
for
(
var
j
=
0
;
j
<
childList
.
length
;
j
++
){
if
(
childList
[
j
].
title
===
subNode
[
i
])
{
nextNode
=
(
i
===
1
)
?
tree
.
getNodeByKey
(
childList
[
j
].
key
)
:
childList
[
j
];
break
;
}
}
}
else
{
nextNode
=
node
;
}
if
(
nextNode
)
{
if
(
!
loading
)
{
if
(
!
nextNode
.
isLoaded
())
{
nextNode
.
load
(
false
);
}
position
++
;
}
setTimeout
(
function
()
{
if
(
nextNode
.
isLoaded
())
{
nextNode
.
setExpanded
(
true
);
}
loadNodeAndExpand
(
tree
,
subNode
,
nextNode
,
position
,
!
nextNode
.
isLoaded
());
},
300
);
}
else
{
$
(
"
#error
"
).
Popup
(
"
ERROR: File or Folder not found. Please make sure that it exist!!
"
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
/******* END ******/
function
openOnFavourite
(
$elt
){
var
index
=
parseInt
(
$elt
.
attr
(
'
rel
'
)),
file
=
favourite_list
[
index
];
openFile
(
file
);
saveTabList
();
if
(
file
.
substr
(
-
1
)
===
'
/
'
)
{
file
=
file
.
slice
(
0
,
-
1
);
var
subNode
=
file
.
split
(
'
/
'
),
tree
=
null
;
if
(
softwareDisplay
)
{
softwareDisplay
=
!
softwareDisplay
;
switchContent
();
}
tree
=
$
(
'
#fileTreeFull
'
).
fancytree
(
"
getTree
"
);
//XXX - hard values, get relative path form runner_workdir directory
if
(
subNode
[
0
]
===
'
workspace
'
)
{
subNode
.
splice
(
0
,
0
,
'
runner_workdir
'
);
subNode
[
1
]
=
'
project
'
;
}
loadNodeAndExpand
(
tree
,
subNode
,
null
,
1
,
false
);
}
else
{
openFile
(
file
);
saveTabList
();
}
$
(
"
#filelist
"
).
click
();
}
...
...
@@ -800,6 +881,7 @@ $(document).ready(function () {
function
initEditor
(){
var
tmp
,
filename
;
/*GET TAB List and Open files in tab*/
var
strList
=
getCookie
(
"
OPENED_TAB_LIST
"
),
tabList
;
if
(
strList
)
{
tabList
=
strList
.
split
(
"
#
"
);
...
...
@@ -807,6 +889,7 @@ $(document).ready(function () {
openFile
(
tabList
[
i
]);
}
}
/*Load Favourite Files and Folders*/
tmp
=
getCookie
(
"
FAV_FILE_LIST
"
);
if
(
tmp
){
favourite_list
=
tmp
.
split
(
'
#
'
);
...
...
@@ -815,6 +898,10 @@ $(document).ready(function () {
}
for
(
var
i
=
0
;
i
<
favourite_list
.
length
;
i
++
){
filename
=
favourite_list
[
i
].
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
if
(
filename
===
''
&&
favourite_list
[
i
].
substr
(
-
1
)
===
'
/
'
)
{
filename
=
'
[DIR]
'
+
favourite_list
[
i
].
slice
(
0
,
-
1
).
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
}
$
(
"
#tooltip-filelist ul
"
).
append
(
'
<li rel="
'
+
i
+
'
"><span class="bt_close" title="Remove this element!" rel="
'
+
i
+
'
">×</span><a href="#" rel="
'
+
i
+
'
" title="
'
+
favourite_list
[
i
]
...
...
@@ -840,11 +927,16 @@ $(document).ready(function () {
}
var
i
=
favourite_list
.
length
,
filename
=
filepath
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
if
(
filename
===
''
&&
filepath
.
substr
(
-
1
)
===
'
/
'
)
{
filename
=
'
[DIR]
'
+
filepath
.
slice
(
0
,
-
1
).
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
}
if
(
i
===
0
){
$
(
"
#tooltip-filelist ul
"
).
empty
();
}
if
(
favourite_list
.
indexOf
(
filepath
)
!==
-
1
){
$
(
"
#error
"
).
Popup
(
"
<b>Duplicate item!</b><br/>This files already exist in your favourite list
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
$
(
"
#error
"
).
Popup
(
"
<b>Duplicate item!</b><br/>This Item (
"
+
filename
+
"
) already exist in your favourite list
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
}
else
{
favourite_list
.
push
(
filepath
);
...
...
@@ -865,6 +957,7 @@ $(document).ready(function () {
$
(
"
#error
"
).
Popup
(
"
<b>Item added!</b><br/>
"
+
filename
+
"
has been added to your favourite list.
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
}
}
/************ INITIALIZE FUNTIONS CALLS ************************/
...
...
slapos/runner/templates/softwareFolder.html
View file @
5d67b673
...
...
@@ -34,7 +34,7 @@
<li
class=
"delete "
><a
href=
"#delete"
>
Delete
</a></li>
<li
class=
"refresh separator"
><a
href=
"#refresh"
>
Refresh
</a></li>
<li
class=
"md5sum"
><a
href=
"#md5sum"
>
File md5 sum
</a></li>
<li
class=
"favorite"
><a
href=
"#favorite"
>
Add
file to favorites
</a></li>
<li
class=
"favorite"
><a
href=
"#favorite"
>
Add
to favorites list
</a></li>
<li
class=
"copy separator"
><a
href=
"#copy"
>
Copy
</a></li>
<li
class=
"cut"
><a
href=
"#cut"
>
Cut
</a></li>
<li
class=
"paste"
><a
href=
"#paste"
>
Paste
</a></li>
...
...
@@ -96,8 +96,8 @@
<div
id=
"tooltip-filelist"
style=
"display:none"
>
<div
style=
"min-width: 190px; padding-bottom:10px;"
>
<span
class=
"list first-list"
>
All your favourite file
s
</span>
<ul
class=
"inline"
>
<span
class=
"list first-list"
>
Favourites Files / Folder
s
</span>
<ul
class=
"
file
inline"
>
<li>
Your favourites files list is
<br/>
empty for the moment!
</li>
</ul>
</div>
...
...
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