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
Kirill Smelkov
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
Show 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{
...
@@ -656,7 +656,7 @@ a.lshare img{
position
:
absolute
;
position
:
absolute
;
top
:
0px
;
top
:
0px
;
left
:
0
;
left
:
0
;
right
:
7
0px
;
right
:
3
0px
;
}
}
#error
div
{
#error
div
{
...
@@ -667,7 +667,7 @@ a.lshare img{
...
@@ -667,7 +667,7 @@ a.lshare img{
min-width
:
300px
;
min-width
:
300px
;
max-width
:
500px
;
max-width
:
500px
;
float
:
right
;
float
:
right
;
border-radius
:
4
px
;
border-radius
:
2
px
;
box-shadow
:
0
2px
4px
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
0
2px
4px
rgba
(
0
,
0
,
0
,
0.2
);
text-align
:
left
;
text-align
:
left
;
position
:
relative
;
position
:
relative
;
...
...
slapos/runner/static/css/ui.fancytree.css
View file @
5d67b673
...
@@ -42,7 +42,6 @@ ul.fancytree-container li
...
@@ -42,7 +42,6 @@ ul.fancytree-container li
background-position
:
0
0
;
background-position
:
0
0
;
background-repeat
:
repeat-y
;
background-repeat
:
repeat-y
;
background-image
:
none
;
/* no v-lines */
background-image
:
none
;
/* no v-lines */
margin
:
0
;
margin
:
0
;
padding
:
4px
0
0
0
;
padding
:
4px
0
0
0
;
}
}
...
@@ -67,7 +66,7 @@ ul.fancytree-no-connector > li
...
@@ -67,7 +66,7 @@ ul.fancytree-no-connector > li
span
.fancytree-node
span
.fancytree-node
{
{
display
:
inline-
block
;
display
:
inline-
table
;
width
:
100%
;
width
:
100%
;
border
:
1px
solid
transparent
;
border
:
1px
solid
transparent
;
}
}
...
...
slapos/runner/static/js/scripts/softwareFolder.js
View file @
5d67b673
...
@@ -29,6 +29,7 @@ $(document).ready(function () {
...
@@ -29,6 +29,7 @@ $(document).ready(function () {
base_path
=
function
()
{
base_path
=
function
()
{
return
softwareDisplay
?
currentProject
:
'
workspace/
'
;
return
softwareDisplay
?
currentProject
:
'
workspace/
'
;
};
};
var
MAX_TABITITLE_WIDTH
=
126
;
var
MAX_TABITITLE_WIDTH
=
126
;
var
TAB_EXTRA_WIDTH
=
25
;
var
TAB_EXTRA_WIDTH
=
25
;
var
MIN_TABITEM_WIDTH
=
61
;
//The minimum size of tabItem
var
MIN_TABITEM_WIDTH
=
61
;
//The minimum size of tabItem
...
@@ -124,7 +125,6 @@ $(document).ready(function () {
...
@@ -124,7 +125,6 @@ $(document).ready(function () {
})
})
.
always
(
function
()
{
.
always
(
function
()
{
editorlist
[
hash
].
busy
=
false
;
editorlist
[
hash
].
busy
=
false
;
editorlist
[
hash
].
editor
.
session
.
getUndoManager
().
markClean
();
});
});
}
}
...
@@ -286,10 +286,10 @@ $(document).ready(function () {
...
@@ -286,10 +286,10 @@ $(document).ready(function () {
editor
.
on
(
'
input
'
,
function
(
e
)
{
editor
.
on
(
'
input
'
,
function
(
e
)
{
var
activeToken
=
getActiveToken
(),
var
activeToken
=
getActiveToken
(),
activeSpan
=
getActiveTabTitleSelector
();
activeSpan
=
getActiveTabTitleSelector
();
if
(
editorlist
[
activeToken
].
editor
.
session
.
getUndoManager
().
isClean
()){
if
(
!
editorlist
[
activeToken
].
busy
&&
!
editorlist
[
activeToken
].
changed
)
{
if
(
!
editorlist
[
activeToken
].
editor
.
session
.
getUndoManager
().
hasUndo
()){
return
;
return
;
}
}
if
(
!
editorlist
[
activeToken
].
busy
&&
!
editorlist
[
activeToken
].
changed
)
{
editorlist
[
activeToken
].
changed
=
true
;
editorlist
[
activeToken
].
changed
=
true
;
$
(
activeSpan
).
html
(
"
*
"
+
$
(
activeSpan
).
html
());
$
(
activeSpan
).
html
(
"
*
"
+
$
(
activeSpan
).
html
());
if
(
beforeunload_warning_set
===
0
)
{
if
(
beforeunload_warning_set
===
0
)
{
...
@@ -370,8 +370,14 @@ $(document).ready(function () {
...
@@ -370,8 +370,14 @@ $(document).ready(function () {
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
if
(
data
.
code
===
1
)
{
filename
=
path
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
filename
=
path
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
if
(
$
(
"
body
"
).
hasClass
(
"
fullScreen
"
)
)
{
$
(
"
#error
"
).
Popup
(
"
Md5sum for file [
"
+
filename
+
"
]:<br/>
"
+
"
<b>
"
+
data
.
result
+
"
</b>
"
,
{
type
:
'
confirm
'
});
}
else
{
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
html
(
"
Md5sum for file [
"
+
filename
+
"
]:
"
+
data
.
result
);
$
(
"
#info
"
).
html
(
"
Md5sum for file [
"
+
filename
+
"
]:
"
+
data
.
result
);
}
}
else
{
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
...
@@ -475,7 +481,7 @@ $(document).ready(function () {
...
@@ -475,7 +481,7 @@ $(document).ready(function () {
if
(
ajaxResult
){
if
(
ajaxResult
){
if
(
dataForSend
.
opt
===
14
){
if
(
dataForSend
.
opt
===
14
){
node
.
load
(
true
);
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
}
else
if
(
node
.
isExpanded
()){
else
if
(
node
.
isExpanded
()){
node
.
addChildren
(
cb
);
node
.
addChildren
(
cb
);
...
@@ -498,7 +504,7 @@ $(document).ready(function () {
...
@@ -498,7 +504,7 @@ $(document).ready(function () {
node
.
setFocus
();
node
.
setFocus
();
node
.
setActive
();
node
.
setActive
();
if
(
srcElement
.
hasClass
(
'
fancytree-folder
'
)){
if
(
srcElement
.
hasClass
(
'
fancytree-folder
'
)){
menu
.
disableContextMenuItems
(
"
#edit,#view,#md5sum
,#favorite
"
);
menu
.
disableContextMenuItems
(
"
#edit,#view,#md5sum
"
);
}
}
else
{
else
{
menu
.
disableContextMenuItems
(
"
#nfile,#nfolder,#refresh,#paste,#ufile
"
);
menu
.
disableContextMenuItems
(
"
#nfile,#nfolder,#refresh,#paste,#ufile
"
);
...
@@ -579,7 +585,7 @@ $(document).ready(function () {
...
@@ -579,7 +585,7 @@ $(document).ready(function () {
break
;
break
;
case
"
refresh
"
:
case
"
refresh
"
:
node
.
load
(
true
);
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
break
;
break
;
case
"
nfolder
"
:
case
"
nfolder
"
:
var
newName
=
window
.
prompt
(
'
Please Enter the folder name:
'
);
var
newName
=
window
.
prompt
(
'
Please Enter the folder name:
'
);
...
@@ -595,7 +601,7 @@ $(document).ready(function () {
...
@@ -595,7 +601,7 @@ $(document).ready(function () {
request
.
always
(
function
()
{
request
.
always
(
function
()
{
if
(
ajaxResult
){
if
(
ajaxResult
){
node
.
load
(
true
);
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
}
});
});
break
;
break
;
...
@@ -613,7 +619,7 @@ $(document).ready(function () {
...
@@ -613,7 +619,7 @@ $(document).ready(function () {
request
.
always
(
function
()
{
request
.
always
(
function
()
{
if
(
ajaxResult
){
if
(
ajaxResult
){
node
.
load
(
true
);
node
.
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
}
});
});
break
;
break
;
...
@@ -635,7 +641,7 @@ $(document).ready(function () {
...
@@ -635,7 +641,7 @@ $(document).ready(function () {
break
;
break
;
case
"
rename
"
:
case
"
rename
"
:
var
newName
=
window
.
prompt
(
'
Please enter the new name:
'
,
node
.
title
);
var
newName
=
window
.
prompt
(
'
Please enter the new name:
'
,
node
.
title
);
if
(
newName
==
null
)
{
if
(
newName
==
=
null
)
{
return
;
return
;
}
}
dataForSend
=
{
dataForSend
=
{
...
@@ -657,14 +663,18 @@ $(document).ready(function () {
...
@@ -657,14 +663,18 @@ $(document).ready(function () {
}
}
else
{
else
{
node
.
getParent
().
load
(
true
);
node
.
getParent
().
load
(
true
);
node
.
toggleExpanded
(
);
expandAfterLoad
(
node
,
true
);
}
}
}
}
});
});
break
;
break
;
case
"
favorite
"
:
case
"
favorite
"
:
addToFavourite
(
node
.
data
.
path
);
var
nodePath
=
node
.
data
.
path
;
if
(
node
.
isFolder
())
{
nodePath
=
(
nodePath
.
substr
(
-
1
)
===
'
/
'
)
?
nodePath
:
nodePath
+
'
/
'
;
}
addToFavourite
(
nodePath
);
break
;
break
;
case
"
ufile
"
:
case
"
ufile
"
:
$
.
colorbox
.
remove
();
$
.
colorbox
.
remove
();
...
@@ -765,13 +775,84 @@ $(document).ready(function () {
...
@@ -765,13 +775,84 @@ $(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 ******/
/******* END ******/
function
openOnFavourite
(
$elt
){
function
openOnFavourite
(
$elt
){
var
index
=
parseInt
(
$elt
.
attr
(
'
rel
'
)),
var
index
=
parseInt
(
$elt
.
attr
(
'
rel
'
)),
file
=
favourite_list
[
index
];
file
=
favourite_list
[
index
];
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
);
openFile
(
file
);
saveTabList
();
saveTabList
();
}
$
(
"
#filelist
"
).
click
();
$
(
"
#filelist
"
).
click
();
}
}
...
@@ -800,6 +881,7 @@ $(document).ready(function () {
...
@@ -800,6 +881,7 @@ $(document).ready(function () {
function
initEditor
(){
function
initEditor
(){
var
tmp
,
filename
;
var
tmp
,
filename
;
/*GET TAB List and Open files in tab*/
var
strList
=
getCookie
(
"
OPENED_TAB_LIST
"
),
tabList
;
var
strList
=
getCookie
(
"
OPENED_TAB_LIST
"
),
tabList
;
if
(
strList
)
{
if
(
strList
)
{
tabList
=
strList
.
split
(
"
#
"
);
tabList
=
strList
.
split
(
"
#
"
);
...
@@ -807,6 +889,7 @@ $(document).ready(function () {
...
@@ -807,6 +889,7 @@ $(document).ready(function () {
openFile
(
tabList
[
i
]);
openFile
(
tabList
[
i
]);
}
}
}
}
/*Load Favourite Files and Folders*/
tmp
=
getCookie
(
"
FAV_FILE_LIST
"
);
tmp
=
getCookie
(
"
FAV_FILE_LIST
"
);
if
(
tmp
){
if
(
tmp
){
favourite_list
=
tmp
.
split
(
'
#
'
);
favourite_list
=
tmp
.
split
(
'
#
'
);
...
@@ -815,6 +898,10 @@ $(document).ready(function () {
...
@@ -815,6 +898,10 @@ $(document).ready(function () {
}
}
for
(
var
i
=
0
;
i
<
favourite_list
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
favourite_list
.
length
;
i
++
){
filename
=
favourite_list
[
i
].
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
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
+
$
(
"
#tooltip-filelist ul
"
).
append
(
'
<li rel="
'
+
i
+
'
"><span class="bt_close" title="Remove this element!" rel="
'
+
i
+
'
"><span class="bt_close" title="Remove this element!" rel="
'
+
i
+
'
">×</span><a href="#" rel="
'
+
i
+
'
" title="
'
+
favourite_list
[
i
]
'
">×</span><a href="#" rel="
'
+
i
+
'
" title="
'
+
favourite_list
[
i
]
...
@@ -840,11 +927,16 @@ $(document).ready(function () {
...
@@ -840,11 +927,16 @@ $(document).ready(function () {
}
}
var
i
=
favourite_list
.
length
,
var
i
=
favourite_list
.
length
,
filename
=
filepath
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
filename
=
filepath
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
if
(
filename
===
''
&&
filepath
.
substr
(
-
1
)
===
'
/
'
)
{
filename
=
'
[DIR]
'
+
filepath
.
slice
(
0
,
-
1
).
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
}
if
(
i
===
0
){
if
(
i
===
0
){
$
(
"
#tooltip-filelist ul
"
).
empty
();
$
(
"
#tooltip-filelist ul
"
).
empty
();
}
}
if
(
favourite_list
.
indexOf
(
filepath
)
!==
-
1
){
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
{
else
{
favourite_list
.
push
(
filepath
);
favourite_list
.
push
(
filepath
);
...
@@ -867,6 +959,7 @@ $(document).ready(function () {
...
@@ -867,6 +959,7 @@ $(document).ready(function () {
}
}
/************ INITIALIZE FUNTIONS CALLS ************************/
/************ INITIALIZE FUNTIONS CALLS ************************/
modelist
=
require
(
"
ace/ext/modelist
"
);
modelist
=
require
(
"
ace/ext/modelist
"
);
...
...
slapos/runner/templates/softwareFolder.html
View file @
5d67b673
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
<li
class=
"delete "
><a
href=
"#delete"
>
Delete
</a></li>
<li
class=
"delete "
><a
href=
"#delete"
>
Delete
</a></li>
<li
class=
"refresh separator"
><a
href=
"#refresh"
>
Refresh
</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=
"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=
"copy separator"
><a
href=
"#copy"
>
Copy
</a></li>
<li
class=
"cut"
><a
href=
"#cut"
>
Cut
</a></li>
<li
class=
"cut"
><a
href=
"#cut"
>
Cut
</a></li>
<li
class=
"paste"
><a
href=
"#paste"
>
Paste
</a></li>
<li
class=
"paste"
><a
href=
"#paste"
>
Paste
</a></li>
...
@@ -96,8 +96,8 @@
...
@@ -96,8 +96,8 @@
<div
id=
"tooltip-filelist"
style=
"display:none"
>
<div
id=
"tooltip-filelist"
style=
"display:none"
>
<div
style=
"min-width: 190px; padding-bottom:10px;"
>
<div
style=
"min-width: 190px; padding-bottom:10px;"
>
<span
class=
"list first-list"
>
All your favourite file
s
</span>
<span
class=
"list first-list"
>
Favourites Files / Folder
s
</span>
<ul
class=
"inline"
>
<ul
class=
"
file
inline"
>
<li>
Your favourites files list is
<br/>
empty for the moment!
</li>
<li>
Your favourites files list is
<br/>
empty for the moment!
</li>
</ul>
</ul>
</div>
</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