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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.toolbox
Commits
f262c408
Commit
f262c408
authored
Oct 03, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ask confirm before delete sr or instance folder
parent
0ea58389
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
29 deletions
+51
-29
slapos/runner/static/css/styles.css
slapos/runner/static/css/styles.css
+2
-2
slapos/runner/static/js/scripts/common.js
slapos/runner/static/js/scripts/common.js
+29
-14
slapos/runner/static/js/scripts/folder.js
slapos/runner/static/js/scripts/folder.js
+7
-7
slapos/runner/static/js/scripts/inspectSoftware.js
slapos/runner/static/js/scripts/inspectSoftware.js
+3
-0
slapos/runner/static/js/scripts/login.js
slapos/runner/static/js/scripts/login.js
+4
-1
slapos/runner/templates/layout.html
slapos/runner/templates/layout.html
+3
-2
slapos/runner/views.py
slapos/runner/views.py
+3
-3
No files found.
slapos/runner/static/css/styles.css
View file @
f262c408
...
...
@@ -243,12 +243,12 @@ overflow-y: scroll;
color
:
#4c6172
;
text-shadow
:
0px
1px
1px
#fff
;
}
.dsblebutton
{
color
:
#9C9C9C
;
padding
:
5px
10px
;
display
:
inline
;
background
:
#eee
;
font-weight
:
bold
;
border
:
1px
solid
#000
;
margin-top
:
10px
;}
.button
{
padding
:
5px
10px
;
display
:
inline
;
background
:
#eee
;
border
:
none
;
color
:
#000
;
cursor
:
pointer
;
font-weight
:
bold
;
...
...
slapos/runner/static/js/scripts/common.js
View file @
f262c408
...
...
@@ -3,33 +3,48 @@ String.prototype.toHtmlChar = function(){
var
c
=
{
'
<
'
:
'
<
'
,
'
>
'
:
'
>
'
,
'
&
'
:
'
&
'
,
'
"
'
:
'
"
'
,
"
'
"
:
'
'
'
,
'
#
'
:
'
#
'
};
return
this
.
replace
(
/
[
<&>'"#
]
/g
,
function
(
s
)
{
return
c
[
s
];
}
);
}
}
;
String
.
prototype
.
trim
=
function
()
{
return
this
.
replace
(
/^
\s
*/
,
""
).
replace
(
/
\s
*$/
,
""
);
}
};
/****************************************/
function
setInput
(
$elt
)
{
if
(
!
$elt
){
var
$elt
=
$
(
'
input[type="text"], input[type="password"]
'
);}
if
(
!
$elt
){
$elt
=
$
(
'
input[type="text"], input[type="password"]
'
);}
$elt
.
addClass
(
"
idleField
"
);
$elt
.
focus
(
function
()
{
$
(
this
).
removeClass
(
"
idleField
"
).
addClass
(
"
focusField
"
);
if
(
this
.
value
==
this
.
defaultValue
){
this
.
value
=
''
;
}
if
(
this
.
value
!=
this
.
defaultValue
){
this
.
select
();
}
$elt
.
focus
(
function
()
{
$
(
this
).
removeClass
(
"
idleField
"
).
addClass
(
"
focusField
"
);
if
(
this
.
value
==
this
.
defaultValue
){
this
.
value
=
''
;
}
if
(
this
.
value
!=
this
.
defaultValue
){
this
.
select
();
}
});
$elt
.
blur
(
function
()
{
$
(
this
).
removeClass
(
"
focusField
"
).
addClass
(
"
idleField
"
);
if
(
$
.
trim
(
this
.
value
)
==
''
){
this
.
value
=
(
this
.
defaultValue
?
this
.
defaultValue
:
''
);
if
(
$
.
trim
(
this
.
value
)
==
=
''
){
this
.
value
=
(
this
.
defaultValue
?
this
.
defaultValue
:
''
);
}
});
}
/*******************Bind remove all button*******************/
function
bindRemove
(){
$
(
"
a#removeSr
"
).
click
(
function
(){
if
(
!
window
.
confirm
(
"
Do you really want to remove all software release?
"
)){
return
false
;
}
location
.
href
=
$SCRIPT_ROOT
+
'
/removeSoftware
'
;
});
$
(
"
a#removeIst
"
).
click
(
function
(){
if
(
!
window
.
confirm
(
"
Do you really want to remove all computer partition?
"
)){
return
false
;
}
location
.
href
=
$SCRIPT_ROOT
+
'
/removeInstance
'
;
});
}
/**************************/
(
function
(
$
,
document
,
window
)
{
$
.
extend
(
$
.
fn
,
{
...
...
slapos/runner/static/js/scripts/folder.js
View file @
f262c408
...
...
@@ -23,20 +23,20 @@ $(document).ready( function() {
}
var
repo_url
=
$
(
"
input#repo
"
).
val
();
var
email
=
""
;
var
name
=
""
var
name
=
""
;
/* /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/ */
if
(
$
(
"
input#repo
"
).
val
()
==
""
||
!
repo_url
.
match
(
/^
[\w\d\.\/
:~@_-
]
+$/
)){
if
(
$
(
"
input#repo
"
).
val
()
==
=
''
||
!
repo_url
.
match
(
/^
[\w\d\.\/
:~@_-
]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Invalid url for the repository
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#name
"
).
val
()
==
""
||
!
$
(
"
input#name
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
)){
if
(
$
(
"
input#name
"
).
val
()
==
=
''
||
!
$
(
"
input#name
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Invalid project name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#user
"
).
val
()
!==
""
){
name
=
$
(
"
input#user
"
).
val
();
}
if
(
$
(
"
input#email
"
).
val
()
!=
""
&&
$
(
"
input#email
"
).
val
()
!
=
"
Enter your email adress...
"
){
if
(
$
(
"
input#email
"
).
val
()
!=
=
''
&&
$
(
"
input#email
"
).
val
()
!=
=
"
Enter your email adress...
"
){
if
(
!
$
(
"
input#email
"
).
val
().
match
(
/^
([
a-zA-Z0-9_
\.\-])
+
\@(([
a-zA-Z0-9
\-])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Please enter a valid email adress!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
...
...
@@ -75,8 +75,8 @@ $(document).ready( function() {
cloneRequest
=
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/cloneRepository
'
,
data
:
{
repo
:
repo_url
,
name
:
(
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
$
(
"
input#name
"
).
val
()),
email
:
email
,
data
:
{
repo
:
repo_url
,
name
:
(
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
$
(
"
input#name
"
).
val
()),
email
:
email
,
user
:
name
},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
...
...
@@ -97,7 +97,7 @@ $(document).ready( function() {
error
:
function
(
request
,
error
)
{
$
(
"
#error
"
).
Popup
(
"
unable to clone your project, please check your internet connection
"
,
{
type
:
'
error
'
,
duration
:
3000
});
$
(
"
#imgwaitting
"
).
hide
();
$
(
"
#clone
"
).
empty
();
$
(
"
#clone
"
).
empty
();
$
(
"
#clone
"
).
append
(
"
Clone
"
);
}
});
...
...
slapos/runner/static/js/scripts/inspectSoftware.js
View file @
f262c408
...
...
@@ -39,6 +39,9 @@ $(document).ready( function() {
return
false
;
}
if
(
send
)
return
;
if
(
!
window
.
confirm
(
"
Do you really want to delete this software release?
"
)){
return
;
}
send
=
false
;
var
elt
=
$
(
"
option:selected
"
,
$
(
"
#softwarelist
"
));
$
.
ajax
({
...
...
slapos/runner/static/js/scripts/login.js
View file @
f262c408
...
...
@@ -15,6 +15,7 @@ $(document).ready( function() {
send
=
true
;
var
param
=
{
clogin
:
$
(
"
input#clogin
"
).
val
(),
cpwd
:
$
(
"
input#cpwd
"
).
val
()};
var
url
=
$SCRIPT_ROOT
+
"
/doLogin
"
;
$
(
"
#login
"
).
removeClass
(
"
button
"
).
addClass
(
"
dsblebutton
"
);
$
.
post
(
url
,
param
,
function
(
data
)
{
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
'
/
'
;
...
...
@@ -23,9 +24,11 @@ $(document).ready( function() {
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
})
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Cannot send your account identifier please try again!!
"
,
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Cannot send your account identifier please try again!!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});})
.
complete
(
function
()
{
$
(
"
#login
"
).
removeClass
(
'
dsblebutton
'
).
addClass
(
'
button
'
);
send
=
false
;
});
return
false
;
...
...
slapos/runner/templates/layout.html
View file @
f262c408
...
...
@@ -25,6 +25,7 @@
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
setInput
();
bindRemove
();
});
</script>
{% if request.path != '/login' %}
...
...
@@ -68,14 +69,14 @@
<li><a
href=
"{{ url_for('runSoftwareProfile') }}"
id=
"softrun"
>
Run
</a></li>
<li><a
href=
"{{ url_for('viewSoftwareLog') }}"
>
Build log
</a></li>
<li><a
href=
"{{ url_for('inspectSoftware') }}"
>
Inspect
</a></li>
<li><a
href=
"{{ url_for('removeSoftware') }}
"
>
Remove all
</a></li>
<li><a
id=
"removeSr"
href=
"#
"
>
Remove all
</a></li>
<li
class=
"space"
><span
class=
"title_instance"
>
Instance
</span></li>
<li><a
href=
"{{ url_for('editInstanceProfile') }}"
>
Edit
</a></li>
<li><a
href=
"{{ url_for('runInstanceProfile') }}"
id=
"instrun"
>
Run
</a></li>
<li><a
href=
"{{ url_for('viewInstanceLog') }}"
>
Build log
</a></li>
<li><a
href=
"{{ url_for('inspectInstance') }}"
>
Inspect
</a></li>
<li><a
href=
"{{ url_for('removeInstance') }}
"
>
Remove all
</a></li>
<li><a
id=
"removeIst"
href=
"#
"
>
Remove all
</a></li>
</ul>
</div>
<div
class=
"clear"
></div>
...
...
slapos/runner/views.py
View file @
f262c408
...
...
@@ -105,13 +105,13 @@ def inspectSoftware():
#remove content of compiled software release
@
login_required
()
def
removeSoftware
():
file_config
=
os
.
path
.
join
(
app
.
config
[
'etc_dir'
],
".softdata"
)
if
isSoftwareRunning
(
app
.
config
)
or
isInstanceRunning
(
app
.
config
):
flash
(
'Software installation or instantiation in progress, cannot remove'
)
elif
os
.
path
.
exists
(
file_config
):
elif
os
.
path
.
exists
(
app
.
config
[
'software_root'
]
):
svcStopAll
(
app
.
config
)
shutil
.
rmtree
(
app
.
config
[
'software_root'
])
os
.
remove
(
file_config
)
for
link
in
os
.
listdir
(
app
.
config
[
'software_link'
]):
os
.
remove
(
os
.
path
.
join
(
app
.
config
[
'software_link'
],
link
))
flash
(
'Software removed'
)
return
redirect
(
url_for
(
'inspectSoftware'
))
...
...
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