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
Justin
slapos.toolbox
Commits
81f046c3
Commit
81f046c3
authored
Nov 05, 2013
by
Alain Takoudjou
Committed by
Nicolas Wavrant
Feb 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keep in mind last opened file and manage favourites files
parent
58044d23
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
150 additions
and
71 deletions
+150
-71
slapos/runner/static/images/list2_down.png
slapos/runner/static/images/list2_down.png
+0
-0
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+122
-56
slapos/runner/templates/softwareFolder.html
slapos/runner/templates/softwareFolder.html
+25
-12
slapos/runner/views.py
slapos/runner/views.py
+3
-3
No files found.
slapos/runner/static/images/list2_down.png
0 → 100644
View file @
81f046c3
1.41 KB
slapos/runner/static/js/scripts/softwareFolder.js
View file @
81f046c3
...
@@ -22,6 +22,8 @@ $(document).ready(function () {
...
@@ -22,6 +22,8 @@ $(document).ready(function () {
pasteMode
=
null
,
pasteMode
=
null
,
selection
=
""
,
selection
=
""
,
edit_status
=
""
,
edit_status
=
""
,
current_file
=
null
,
favourite_list
=
new
Array
(),
base_path
=
function
()
{
base_path
=
function
()
{
return
softwareDisplay
?
currentProject
:
'
workspace/
'
;
return
softwareDisplay
?
currentProject
:
'
workspace/
'
;
};
};
...
@@ -45,7 +47,10 @@ $(document).ready(function () {
...
@@ -45,7 +47,10 @@ $(document).ready(function () {
}
}
send
=
true
;
send
=
true
;
edit
=
false
;
edit
=
false
;
$
(
"
a#option
"
).
hide
();
if
(
file
.
substr
(
-
1
)
!==
"
/
"
)
{
if
(
file
.
substr
(
-
1
)
!==
"
/
"
)
{
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
append
(
"
LOADING FILE... <img src='
"
+
$SCRIPT_ROOT
+
"
/static/images/loading.gif' />
"
);
$
.
ajax
({
$
.
ajax
({
type
:
"
POST
"
,
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getFileContent
'
,
url
:
$SCRIPT_ROOT
+
'
/getFileContent
'
,
...
@@ -65,9 +70,10 @@ $(document).ready(function () {
...
@@ -65,9 +70,10 @@ $(document).ready(function () {
editor
.
getSession
().
setValue
(
data
.
result
);
editor
.
getSession
().
setValue
(
data
.
result
);
setEditMode
(
name
[
name
.
length
-
1
]);
setEditMode
(
name
[
name
.
length
-
1
]);
edit
=
true
;
edit
=
true
;
$
(
"
input#subfolder
"
).
val
(
file
)
;
current_file
=
file
;
$
(
"
span#edit_status
"
).
html
(
""
);
$
(
"
span#edit_status
"
).
html
(
""
);
edit_status
=
""
;
edit_status
=
""
;
setCookie
(
"
EDIT_CURRENT_FILE
"
,
file
);
}
else
{
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
...
@@ -77,32 +83,11 @@ $(document).ready(function () {
...
@@ -77,32 +83,11 @@ $(document).ready(function () {
}
else
{
}
else
{
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
append
(
"
No file in editor
"
);
$
(
"
#edit_info
"
).
append
(
"
No file in editor
"
);
$
(
"
a#option
"
).
hide
();
editor
.
getSession
().
setValue
(
""
);
editor
.
getSession
().
setValue
(
""
);
}
}
return
;
return
;
}
}
function
selectFile
(
file
)
{
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
"
Current work tree:
"
+
file
);
selection
=
file
;
return
;
}
/*
function setDetailBox() {
var state = $("#details_box").css("display");
if (state === "none") {
$("#details_box").fadeIn("normal");
$("#details_head").removeClass("hide");
$("#details_head").addClass("show");
} else {
$("#details_box").fadeOut("normal");
$("#details_head").removeClass("show");
$("#details_head").addClass("hide");
}
} */
function
switchContent
()
{
function
switchContent
()
{
if
(
!
softwareDisplay
)
{
if
(
!
softwareDisplay
)
{
$
(
"
span.swith_btn
"
).
empty
();
$
(
"
span.swith_btn
"
).
empty
();
...
@@ -127,16 +112,15 @@ $(document).ready(function () {
...
@@ -127,16 +112,15 @@ $(document).ready(function () {
return
;
return
;
}
}
send
=
true
;
send
=
true
;
var
filepath
=
(
path
)
?
path
:
$
(
"
input#subfolder
"
).
val
(),
var
filename
;
filename
;
$
.
ajax
({
$
.
ajax
({
type
:
"
POST
"
,
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getmd5sum
'
,
url
:
$SCRIPT_ROOT
+
'
/getmd5sum
'
,
data
:
{
file
:
file
path
},
data
:
{
file
:
path
},
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
if
(
data
.
code
===
1
)
{
filename
=
filepath
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
)
filename
=
path
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
html
(
"
Md5sum for file [
"
+
filename
+
"
]:
"
+
data
.
result
);
$
(
"
#info
"
).
html
(
"
Md5sum for file [
"
+
filename
+
"
]:
"
+
data
.
result
);
}
else
{
}
else
{
...
@@ -406,6 +390,11 @@ $(document).ready(function () {
...
@@ -406,6 +390,11 @@ $(document).ready(function () {
// return false;
// return false;
}
}
},
},
dblclick
:
function
(
event
,
data
)
{
if
(
!
data
.
node
.
isFolder
()){
openFile
(
data
.
node
.
data
.
path
);
}
},
source
:
{
source
:
{
url
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
url
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
data
:{
opt
:
20
,
dir
:
path
,
key
:
key
,
listfiles
:
'
yes
'
},
data
:{
opt
:
20
,
dir
:
path
,
key
:
key
,
listfiles
:
'
yes
'
},
...
@@ -467,6 +456,56 @@ $(document).ready(function () {
...
@@ -467,6 +456,56 @@ $(document).ready(function () {
});
});
}
}
function
openOnFavourite
(
$elt
){
var
index
=
parseInt
(
$elt
.
attr
(
'
rel
'
)),
file
=
favourite_list
[
index
];
openFile
(
file
);
$
(
'
a[rel=tooltip], span[rel=tooltip], .popup
'
).
mouseout
();
}
function
removeFavourite
(
$elt
){
var
index
=
parseInt
(
$elt
.
attr
(
'
rel
'
));
favourite_list
.
splice
(
index
,
1
);
$elt
.
parent
().
remove
();
$
(
'
#tooltip-filelist ul li[rel="
'
+
index
+
'
"]
'
).
remove
();
if
(
favourite_list
.
length
===
0
){
$
(
"
#tooltip-filelist ul
"
).
append
(
"
<li>Your favourites files list is <br/>empty for the moment!</li>
"
);
}
deleteCookie
(
"
FAV_FILE_LIST
"
);
setCookie
(
"
FAV_FILE_LIST
"
,
favourite_list
.
join
(
'
#
'
));
}
function
initEditor
(){
var
tmp
,
filename
;
current_file
=
getCookie
(
"
EDIT_CURRENT_FILE
"
);
if
(
current_file
)
{
openFile
(
current_file
);
}
tmp
=
getCookie
(
"
FAV_FILE_LIST
"
);
if
(
tmp
){
favourite_list
=
tmp
.
split
(
'
#
'
);
if
(
favourite_list
.
length
!==
0
){
$
(
"
#tooltip-filelist ul
"
).
empty
();
}
for
(
var
i
=
0
;
i
<
favourite_list
.
length
;
i
++
){
filename
=
favourite_list
[
i
].
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);
$
(
"
#tooltip-filelist ul
"
).
append
(
'
<li rel="
'
+
i
+
'
"><span class="bt_close" title="Remove this element!" rel="
'
+
i
+
'
">×</span><a href="#" rel="
'
+
i
+
'
">
'
+
filename
+
'
</a></li>
'
);
}
}
//Click on favorite file in list to open it!
$
(
"
#tooltip-filelist ul li a
"
).
click
(
function
(){
openOnFavourite
(
$
(
this
));
return
false
;
});
//Remove favorite file in list
$
(
"
#tooltip-filelist ul li span
"
).
click
(
function
(){
removeFavourite
(
$
(
this
));
return
false
;
});
}
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
...
@@ -494,7 +533,7 @@ $(document).ready(function () {
...
@@ -494,7 +533,7 @@ $(document).ready(function () {
initTree
(
'
#fileTree
'
,
currentProject
,
'
pfolder
'
);
initTree
(
'
#fileTree
'
,
currentProject
,
'
pfolder
'
);
initTree
(
'
#fileTreeFull
'
,
'
workspace
'
);
initTree
(
'
#fileTreeFull
'
,
'
workspace
'
);
$
(
"
#info
"
).
append
(
"
Current work tree:
"
+
base_path
());
$
(
"
#info
"
).
append
(
"
Current work tree:
"
+
base_path
());
/*setDetailBox();*/
initEditor
();
editor
.
on
(
"
change
"
,
function
(
e
)
{
editor
.
on
(
"
change
"
,
function
(
e
)
{
if
(
edit_status
===
""
&&
edit
)
{
if
(
edit_status
===
""
&&
edit
)
{
...
@@ -523,7 +562,7 @@ $(document).ready(function () {
...
@@ -523,7 +562,7 @@ $(document).ready(function () {
type
:
"
POST
"
,
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/saveFileContent
'
,
url
:
$SCRIPT_ROOT
+
'
/saveFileContent
'
,
data
:
{
data
:
{
file
:
$
(
"
input#subfolder
"
).
val
()
,
file
:
current_file
,
content
:
editor
.
getSession
().
getValue
()
content
:
editor
.
getSession
().
getValue
()
},
},
success
:
function
(
data
)
{
success
:
function
(
data
)
{
...
@@ -549,7 +588,7 @@ $(document).ready(function () {
...
@@ -549,7 +588,7 @@ $(document).ready(function () {
return
false
;
return
false
;
});
});
$
(
"
#getmd5
"
).
click
(
function
()
{
$
(
"
#getmd5
"
).
click
(
function
()
{
getmd5sum
();
getmd5sum
(
current_file
);
return
false
;
return
false
;
});
});
...
@@ -557,7 +596,6 @@ $(document).ready(function () {
...
@@ -557,7 +596,6 @@ $(document).ready(function () {
edit
=
false
;
edit
=
false
;
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
"
Current work tree:
"
+
base_path
());
$
(
"
#info
"
).
append
(
"
Current work tree:
"
+
base_path
());
$
(
"
input#subfolder
"
).
val
(
""
);
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
append
(
"
No file in editor
"
);
$
(
"
#edit_info
"
).
append
(
"
No file in editor
"
);
editor
.
getSession
().
setValue
(
""
);
editor
.
getSession
().
setValue
(
""
);
...
@@ -581,6 +619,34 @@ $(document).ready(function () {
...
@@ -581,6 +619,34 @@ $(document).ready(function () {
}
}
return
false
;
return
false
;
});
});
$
(
"
a#addflist
"
).
click
(
function
(){
var
i
=
favourite_list
.
length
,
filename
=
current_file
.
replace
(
/^.*
(\\
|
\/
|
\:)
/
,
''
);;
if
(
i
===
0
){
$
(
"
#tooltip-filelist ul
"
).
empty
();
}
if
(
favourite_list
.
indexOf
(
current_file
)
!==
-
1
){
$
(
"
#error
"
).
Popup
(
"
<b>Duplicate item!</b><br/>This files already exist in your favourite list
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
}
else
{
favourite_list
.
push
(
current_file
);
$
(
"
#tooltip-filelist ul
"
).
append
(
'
<li rel="
'
+
i
+
'
"><span class="bt_close" title="Remove this element!" rel="
'
+
i
+
'
">×</span><a href="#" rel="
'
+
i
+
'
">
'
+
filename
+
'
</a></li>
'
);
deleteCookie
(
"
FAV_FILE_LIST
"
);
setCookie
(
"
FAV_FILE_LIST
"
,
favourite_list
.
join
(
'
#
'
));
$
(
"
#tooltip-filelist ul li a[rel='
"
+
i
+
"
']
"
).
bind
(
'
click
'
,
function
()
{
openOnFavourite
(
$
(
this
));
return
false
;
});
$
(
"
#tooltip-filelist ul li span[rel='
"
+
i
+
"
']
"
).
click
(
function
(){
removeFavourite
(
$
(
this
));
return
false
;
});
$
(
"
#error
"
).
Popup
(
"
<b>Item added!</b><br/>
"
+
filename
+
"
has been added to your favourite list.
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
}
return
false
;
});
});
});
slapos/runner/templates/softwareFolder.html
View file @
81f046c3
...
@@ -43,9 +43,10 @@
...
@@ -43,9 +43,10 @@
<ul
class=
'box_header'
>
<ul
class=
'box_header'
>
<li
id=
"switch"
><span
class=
"swith_btn"
title=
"Switch between differents file source"
>
This project
</span></li>
<li
id=
"switch"
><span
class=
"swith_btn"
title=
"Switch between differents file source"
>
This project
</span></li>
<li
id=
"save"
><span
class=
"save_btn"
title=
"Save current file. Hint: Use Ctrl+S"
>
Save
</span></li>
<li
id=
"save"
><span
class=
"save_btn"
title=
"Save current file. Hint: Use Ctrl+S"
>
Save
</span></li>
<li
id=
"flist"
><span
class=
"flist_btn"
id=
"filelist"
title=
"Recently opened files and favourites"
rel=
'tooltip'
>
</span></li>
<li>
<li>
<h2>
<h2>
<a
style=
"display:none"
id=
'option'
href=
'#'
rel=
'tooltip'
title=
'Show more option'
>
[
Current file
]
</a><span
id=
"edit_info"
>
No file in editor
</span>
<a
style=
"display:none"
id=
'option'
href=
'#'
rel=
'tooltip'
title=
'Show more option'
>
[
Menu
]
</a><span
id=
"edit_info"
>
No file in editor
</span>
<span
id=
"edit_status"
></span>
<span
id=
"edit_status"
></span>
</h2>
</h2>
</li>
</li>
...
@@ -74,9 +75,12 @@
...
@@ -74,9 +75,12 @@
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
<div
id=
"file_info"
class=
"file_info"
><span
id=
"info"
></span></div>
<div
id=
"file_info"
class=
"file_info"
><span
id=
"info"
></span></div>
</form>
</form>
<div
id=
"tooltip-option"
style=
"display:none"
>
<div
id=
"tooltip-option"
style=
"display:none"
>
<span
class=
"list first-list"
>
MD5 SUM for the current file
</span>
<span
class=
"list first-list"
>
Current file Menu
</span>
<a
id=
'getmd5'
href=
"#"
>
Get or Update md5sum
</a>
<a
id=
'getmd5'
href=
"#"
>
Get or Update md5sum
</a>
<a
id=
'addflist'
href=
"#"
>
Add to favourites
</a>
<div
class=
"sep"
></div>
<div
class=
"sep"
></div>
<span
class=
"list"
>
Add project development
</span>
<span
class=
"list"
>
Add project development
</span>
<ul
id=
"plist"
>
<ul
id=
"plist"
>
...
@@ -88,6 +92,15 @@
...
@@ -88,6 +92,15 @@
<a
href=
"#"
id=
"adddevelop"
class=
"lshare"
>
Add to profile
</a>
<a
href=
"#"
id=
"adddevelop"
class=
"lshare"
>
Add to profile
</a>
</div>
</div>
<div
id=
"tooltip-filelist"
style=
"display:none"
>
<div
style=
"min-width: 190px; padding-bottom:10px;"
>
<span
class=
"list first-list"
>
All your favourite files
</span>
<ul
class=
"inline"
>
<li>
Your favourites files list is
<br/>
empty for the moment!
</li>
</ul>
</div>
</div>
<!-- This contains the hidden content for inline calls -->
<!-- This contains the hidden content for inline calls -->
<a
id=
'inlineViewer'
style=
'display:none'
href=
"#inline_content"
>
Inline HTML
</a>
<a
id=
'inlineViewer'
style=
'display:none'
href=
"#inline_content"
>
Inline HTML
</a>
<div
style=
'display:none'
>
<div
style=
'display:none'
>
...
...
slapos/runner/views.py
View file @
81f046c3
...
@@ -116,7 +116,7 @@ def editSoftwareProfile():
...
@@ -116,7 +116,7 @@ def editSoftwareProfile():
if
profile
==
""
:
if
profile
==
""
:
flash
(
'Error: can not open profile, please select your project first'
)
flash
(
'Error: can not open profile, please select your project first'
)
return
render_template
(
'updateSoftwareProfile.html'
,
workDir
=
'workspace'
,
return
render_template
(
'updateSoftwareProfile.html'
,
workDir
=
'workspace'
,
profile
=
profile
,
projectList
=
getProjectList
(
app
.
config
[
'workspace'
]
))
profile
=
profile
,
projectList
=
listFolder
(
app
.
config
,
'workspace'
))
def
inspectSoftware
():
def
inspectSoftware
():
...
@@ -159,7 +159,7 @@ def editInstanceProfile():
...
@@ -159,7 +159,7 @@ def editInstanceProfile():
if
profile
==
""
:
if
profile
==
""
:
flash
(
'Error: can not open instance profile for this Software Release'
)
flash
(
'Error: can not open instance profile for this Software Release'
)
return
render_template
(
'updateInstanceProfile.html'
,
workDir
=
'workspace'
,
return
render_template
(
'updateInstanceProfile.html'
,
workDir
=
'workspace'
,
profile
=
profile
,
projectList
=
getProjectList
(
app
.
config
[
'workspace'
]
))
profile
=
profile
,
projectList
=
listFolder
(
app
.
config
,
'workspace'
))
# get status of all computer partitions and process state
# get status of all computer partitions and process state
...
@@ -640,7 +640,7 @@ def fileBrowser():
...
@@ -640,7 +640,7 @@ def fileBrowser():
def
editFile
():
def
editFile
():
return
render_template
(
'editFile.html'
,
workDir
=
'workspace'
,
return
render_template
(
'editFile.html'
,
workDir
=
'workspace'
,
profile
=
urllib
.
unquote
(
request
.
args
.
get
(
'profile'
,
''
)),
profile
=
urllib
.
unquote
(
request
.
args
.
get
(
'profile'
,
''
)),
projectList
=
getProjectList
(
app
.
config
[
'workspace'
]
),
projectList
=
listFolder
(
app
.
config
,
'workspace'
),
filename
=
urllib
.
unquote
(
request
.
args
.
get
(
'filename'
,
''
)))
filename
=
urllib
.
unquote
(
request
.
args
.
get
(
'filename'
,
''
)))
def
shell
():
def
shell
():
...
...
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