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
Łukasz Nowak
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
Show 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;
...
@@ -243,12 +243,12 @@ overflow-y: scroll;
color
:
#4c6172
;
color
:
#4c6172
;
text-shadow
:
0px
1px
1px
#fff
;
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
{
.button
{
padding
:
5px
10px
;
padding
:
5px
10px
;
display
:
inline
;
display
:
inline
;
background
:
#eee
;
background
:
#eee
;
border
:
none
;
color
:
#000
;
color
:
#000
;
cursor
:
pointer
;
cursor
:
pointer
;
font-weight
:
bold
;
font-weight
:
bold
;
...
...
slapos/runner/static/js/scripts/common.js
View file @
f262c408
...
@@ -3,15 +3,14 @@ String.prototype.toHtmlChar = function(){
...
@@ -3,15 +3,14 @@ String.prototype.toHtmlChar = function(){
var
c
=
{
'
<
'
:
'
<
'
,
'
>
'
:
'
>
'
,
'
&
'
:
'
&
'
,
'
"
'
:
'
"
'
,
"
'
"
:
'
'
'
,
var
c
=
{
'
<
'
:
'
<
'
,
'
>
'
:
'
>
'
,
'
&
'
:
'
&
'
,
'
"
'
:
'
"
'
,
"
'
"
:
'
'
'
,
'
#
'
:
'
#
'
};
'
#
'
:
'
#
'
};
return
this
.
replace
(
/
[
<&>'"#
]
/g
,
function
(
s
)
{
return
c
[
s
];
}
);
return
this
.
replace
(
/
[
<&>'"#
]
/g
,
function
(
s
)
{
return
c
[
s
];
}
);
}
}
;
String
.
prototype
.
trim
=
function
()
{
String
.
prototype
.
trim
=
function
()
{
return
this
.
replace
(
/^
\s
*/
,
""
).
replace
(
/
\s
*$/
,
""
);
return
this
.
replace
(
/^
\s
*/
,
""
).
replace
(
/
\s
*$/
,
""
);
}
};
/****************************************/
/****************************************/
function
setInput
(
$elt
)
{
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
.
addClass
(
"
idleField
"
);
$elt
.
focus
(
function
()
{
$elt
.
focus
(
function
()
{
$
(
this
).
removeClass
(
"
idleField
"
).
addClass
(
"
focusField
"
);
$
(
this
).
removeClass
(
"
idleField
"
).
addClass
(
"
focusField
"
);
...
@@ -24,12 +23,28 @@ function setInput($elt) {
...
@@ -24,12 +23,28 @@ function setInput($elt) {
});
});
$elt
.
blur
(
function
()
{
$elt
.
blur
(
function
()
{
$
(
this
).
removeClass
(
"
focusField
"
).
addClass
(
"
idleField
"
);
$
(
this
).
removeClass
(
"
focusField
"
).
addClass
(
"
idleField
"
);
if
(
$
.
trim
(
this
.
value
)
==
''
){
if
(
$
.
trim
(
this
.
value
)
==
=
''
){
this
.
value
=
(
this
.
defaultValue
?
this
.
defaultValue
:
''
);
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
)
{
(
function
(
$
,
document
,
window
)
{
$
.
extend
(
$
.
fn
,
{
$
.
extend
(
$
.
fn
,
{
...
...
slapos/runner/static/js/scripts/folder.js
View file @
f262c408
...
@@ -23,20 +23,20 @@ $(document).ready( function() {
...
@@ -23,20 +23,20 @@ $(document).ready( function() {
}
}
var
repo_url
=
$
(
"
input#repo
"
).
val
();
var
repo_url
=
$
(
"
input#repo
"
).
val
();
var
email
=
""
;
var
email
=
""
;
var
name
=
""
var
name
=
""
;
/* /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/ */
/* /^(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
});
$
(
"
#error
"
).
Popup
(
"
Invalid url for the repository
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
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
});
$
(
"
#error
"
).
Popup
(
"
Invalid project name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
return
false
;
}
}
if
(
$
(
"
input#user
"
).
val
()
!==
""
){
if
(
$
(
"
input#user
"
).
val
()
!==
""
){
name
=
$
(
"
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})
+$/
)){
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
});
$
(
"
#error
"
).
Popup
(
"
Please enter a valid email adress!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
return
false
;
...
@@ -75,8 +75,8 @@ $(document).ready( function() {
...
@@ -75,8 +75,8 @@ $(document).ready( function() {
cloneRequest
=
$
.
ajax
({
cloneRequest
=
$
.
ajax
({
type
:
"
POST
"
,
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/cloneRepository
'
,
url
:
$SCRIPT_ROOT
+
'
/cloneRepository
'
,
data
:
{
repo
:
repo_url
,
name
:
(
$
(
"
input#workdir
"
).
val
()
+
"
/
"
data
:
{
repo
:
repo_url
,
name
:
(
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
+
$
(
"
input#name
"
).
val
()),
email
:
email
,
$
(
"
input#name
"
).
val
()),
email
:
email
,
user
:
name
},
user
:
name
},
success
:
function
(
data
){
success
:
function
(
data
){
if
(
data
.
code
==
1
){
if
(
data
.
code
==
1
){
...
...
slapos/runner/static/js/scripts/inspectSoftware.js
View file @
f262c408
...
@@ -39,6 +39,9 @@ $(document).ready( function() {
...
@@ -39,6 +39,9 @@ $(document).ready( function() {
return
false
;
return
false
;
}
}
if
(
send
)
return
;
if
(
send
)
return
;
if
(
!
window
.
confirm
(
"
Do you really want to delete this software release?
"
)){
return
;
}
send
=
false
;
send
=
false
;
var
elt
=
$
(
"
option:selected
"
,
$
(
"
#softwarelist
"
));
var
elt
=
$
(
"
option:selected
"
,
$
(
"
#softwarelist
"
));
$
.
ajax
({
$
.
ajax
({
...
...
slapos/runner/static/js/scripts/login.js
View file @
f262c408
...
@@ -15,6 +15,7 @@ $(document).ready( function() {
...
@@ -15,6 +15,7 @@ $(document).ready( function() {
send
=
true
;
send
=
true
;
var
param
=
{
clogin
:
$
(
"
input#clogin
"
).
val
(),
cpwd
:
$
(
"
input#cpwd
"
).
val
()};
var
param
=
{
clogin
:
$
(
"
input#clogin
"
).
val
(),
cpwd
:
$
(
"
input#cpwd
"
).
val
()};
var
url
=
$SCRIPT_ROOT
+
"
/doLogin
"
;
var
url
=
$SCRIPT_ROOT
+
"
/doLogin
"
;
$
(
"
#login
"
).
removeClass
(
"
button
"
).
addClass
(
"
dsblebutton
"
);
$
.
post
(
url
,
param
,
function
(
data
)
{
$
.
post
(
url
,
param
,
function
(
data
)
{
if
(
data
.
code
==
1
){
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
'
/
'
;
location
.
href
=
$SCRIPT_ROOT
+
'
/
'
;
...
@@ -23,9 +24,11 @@ $(document).ready( function() {
...
@@ -23,9 +24,11 @@ $(document).ready( function() {
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#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
});})
{
type
:
'
alert
'
,
duration
:
3000
});})
.
complete
(
function
()
{
.
complete
(
function
()
{
$
(
"
#login
"
).
removeClass
(
'
dsblebutton
'
).
addClass
(
'
button
'
);
send
=
false
;
send
=
false
;
});
});
return
false
;
return
false
;
...
...
slapos/runner/templates/layout.html
View file @
f262c408
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
setInput
();
setInput
();
bindRemove
();
});
});
</script>
</script>
{% if request.path != '/login' %}
{% if request.path != '/login' %}
...
@@ -68,14 +69,14 @@
...
@@ -68,14 +69,14 @@
<li><a
href=
"{{ url_for('runSoftwareProfile') }}"
id=
"softrun"
>
Run
</a></li>
<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('viewSoftwareLog') }}"
>
Build log
</a></li>
<li><a
href=
"{{ url_for('inspectSoftware') }}"
>
Inspect
</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
class=
"space"
><span
class=
"title_instance"
>
Instance
</span></li>
<li><a
href=
"{{ url_for('editInstanceProfile') }}"
>
Edit
</a></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('runInstanceProfile') }}"
id=
"instrun"
>
Run
</a></li>
<li><a
href=
"{{ url_for('viewInstanceLog') }}"
>
Build log
</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('inspectInstance') }}"
>
Inspect
</a></li>
<li><a
href=
"{{ url_for('removeInstance') }}
"
>
Remove all
</a></li>
<li><a
id=
"removeIst"
href=
"#
"
>
Remove all
</a></li>
</ul>
</ul>
</div>
</div>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
...
...
slapos/runner/views.py
View file @
f262c408
...
@@ -105,13 +105,13 @@ def inspectSoftware():
...
@@ -105,13 +105,13 @@ def inspectSoftware():
#remove content of compiled software release
#remove content of compiled software release
@
login_required
()
@
login_required
()
def
removeSoftware
():
def
removeSoftware
():
file_config
=
os
.
path
.
join
(
app
.
config
[
'etc_dir'
],
".softdata"
)
if
isSoftwareRunning
(
app
.
config
)
or
isInstanceRunning
(
app
.
config
):
if
isSoftwareRunning
(
app
.
config
)
or
isInstanceRunning
(
app
.
config
):
flash
(
'Software installation or instantiation in progress, cannot remove'
)
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
)
svcStopAll
(
app
.
config
)
shutil
.
rmtree
(
app
.
config
[
'software_root'
])
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'
)
flash
(
'Software removed'
)
return
redirect
(
url_for
(
'inspectSoftware'
))
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