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
5d5a0a86
Commit
5d5a0a86
authored
Oct 11, 2012
by
Marco Mariani
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mmariani-jslint' into slaprunner
parents
356e6558
625aa19a
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1754 additions
and
1511 deletions
+1754
-1511
slapos/runner/__init__.py
slapos/runner/__init__.py
+1
-1
slapos/runner/static/js/jquery/jqueryTabs.js
slapos/runner/static/js/jquery/jqueryTabs.js
+12
-12
slapos/runner/static/js/jquery/popup.js
slapos/runner/static/js/jquery/popup.js
+14
-14
slapos/runner/static/js/scripts/account.js
slapos/runner/static/js/scripts/account.js
+73
-62
slapos/runner/static/js/scripts/common.js
slapos/runner/static/js/scripts/common.js
+75
-55
slapos/runner/static/js/scripts/cookies.js
slapos/runner/static/js/scripts/cookies.js
+43
-31
slapos/runner/static/js/scripts/editor.js
slapos/runner/static/js/scripts/editor.js
+146
-121
slapos/runner/static/js/scripts/folder.js
slapos/runner/static/js/scripts/folder.js
+136
-127
slapos/runner/static/js/scripts/inspectInstance.js
slapos/runner/static/js/scripts/inspectInstance.js
+283
-239
slapos/runner/static/js/scripts/inspectSoftware.js
slapos/runner/static/js/scripts/inspectSoftware.js
+92
-79
slapos/runner/static/js/scripts/login.js
slapos/runner/static/js/scripts/login.js
+44
-35
slapos/runner/static/js/scripts/process.js
slapos/runner/static/js/scripts/process.js
+178
-138
slapos/runner/static/js/scripts/project.js
slapos/runner/static/js/scripts/project.js
+97
-99
slapos/runner/static/js/scripts/repo.js
slapos/runner/static/js/scripts/repo.js
+194
-180
slapos/runner/static/js/scripts/softwareFolder.js
slapos/runner/static/js/scripts/softwareFolder.js
+287
-263
slapos/runner/static/js/scripts/viewlog.js
slapos/runner/static/js/scripts/viewlog.js
+78
-54
slapos/shacache/config.py
slapos/shacache/config.py
+1
-1
No files found.
slapos/runner/__init__.py
View file @
5d5a0a86
...
...
@@ -16,7 +16,7 @@ class Parser(OptionParser):
"""
def
__init__
(
self
,
usage
=
None
,
version
=
None
):
"""
Initialize all
options possible
s.
Initialize all
possible option
s.
"""
OptionParser
.
__init__
(
self
,
usage
=
usage
,
version
=
version
,
option_list
=
[
...
...
slapos/runner/static/js/jquery/jqueryTabs.js
View file @
5d5a0a86
slapos/runner/static/js/jquery/popup.js
View file @
5d5a0a86
slapos/runner/static/js/scripts/account.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
send
=
false
;
$
(
"
#update
"
).
click
(
function
()
{
var
haspwd
=
false
;
var
hasAccount
=
!
(
$
(
"
input#hasAccount
"
).
val
()
=
==
""
);
if
(
$
(
"
input#username
"
).
val
()
===
""
||
!
$
(
"
input#username
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Invalid user name. Please check it!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#update
"
).
click
(
function
()
{
var
haspwd
=
false
,
hasAccount
=
(
$
(
"
input#hasAccount
"
).
val
()
!
==
""
);
if
(
$
(
"
input#username
"
).
val
()
===
""
||
!
$
(
"
input#username
"
).
val
().
match
(
/^
[\w\d\.
_
\-]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Invalid user name. Please check it!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
else
if
(
$
(
"
input#username
"
).
val
().
length
<
6
)
{
$
(
"
#error
"
).
Popup
(
"
Username must have at least 6 characters
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#username
"
).
val
().
length
<
6
)
{
$
(
"
#error
"
).
Popup
(
"
Username must have at least 6 characters
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#name
"
).
val
()
===
""
)
{
$
(
"
#error
"
).
Popup
(
"
Please enter your name and surname!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#name
"
).
val
()
===
""
)
{
$
(
"
#error
"
).
Popup
(
"
Please enter your name and surname!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
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
});
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
;
}
if
(
!
hasAccount
&&
!
$
(
"
input#password
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter your new password!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
!
hasAccount
&&
!
$
(
"
input#password
"
).
val
().
match
(
/^
[\w\d\.
_
\-]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter your new password!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#password
"
).
val
()
!==
""
&&
$
(
"
input#password
"
).
val
().
length
<
6
)
{
$
(
"
#error
"
).
Popup
(
"
The password must have at least 6 characters
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#password
"
).
val
()
!==
""
&&
$
(
"
input#password
"
).
val
().
length
<
6
)
{
$
(
"
#error
"
).
Popup
(
"
The password must have at least 6 characters
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#password
"
).
val
()
!==
""
)
{
if
(
$
(
"
input#password
"
).
val
()
===
""
||
!
$
(
"
input#password
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter your new password!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#password
"
).
val
()
!==
""
)
{
if
(
$
(
"
input#password
"
).
val
()
===
""
||
!
$
(
"
input#password
"
).
val
().
match
(
/^
[\w\d\.
_
\-]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter your new password!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#password
"
).
val
()
!==
$
(
"
input#cpassword
"
).
val
())
{
$
(
"
#error
"
).
Popup
(
"
your password does not match!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#password
"
).
val
()
!==
$
(
"
input#cpassword
"
).
val
())
{
$
(
"
#error
"
).
Popup
(
"
your password does not match!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
haspwd
=
true
;
}
if
(
!
$
(
"
input#rcode
"
).
val
().
match
(
/^
[\w\d]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Please enter your password recovery code.
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
!
$
(
"
input#rcode
"
).
val
().
match
(
/^
[\w\d]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter your password recovery code.
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
send
)
{
return
false
;
}
if
(
send
)
return
false
;
send
=
true
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
((
hasAccount
)?
'
/updateAccount
'
:
'
/configAccount
'
),
data
:
{
name
:
$
(
"
input#name
"
).
val
(),
username
:
$
(
"
input#username
"
).
val
(),
email
:
$
(
"
input#email
"
).
val
(),
password
:((
haspwd
)
?
$
(
"
input#password
"
).
val
():
""
),
rcode
:
$
(
"
input#rcode
"
).
val
()},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
"
/
"
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
url
:
$SCRIPT_ROOT
+
((
hasAccount
)
?
'
/updateAccount
'
:
'
/configAccount
'
),
data
:
{
name
:
$
(
"
input#name
"
).
val
(),
username
:
$
(
"
input#username
"
).
val
(),
email
:
$
(
"
input#email
"
).
val
(),
password
:
((
haspwd
)
?
$
(
"
input#password
"
).
val
()
:
""
),
rcode
:
$
(
"
input#rcode
"
).
val
()
},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/
"
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
},
error
:
function
(){
send
=
false
;
}
error
:
function
()
{
send
=
false
;
}
});
return
false
;
});
...
...
slapos/runner/static/js/scripts/common.js
View file @
5d5a0a86
/*jslint undef: true */
/*global $, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
/*Common javascript function*/
String
.
prototype
.
toHtmlChar
=
function
(){
var
c
=
{
'
<
'
:
'
<
'
,
'
>
'
:
'
>
'
,
'
&
'
:
'
&
'
,
'
"
'
:
'
"
'
,
"
'
"
:
'
'
'
,
'
#
'
:
'
#
'
};
return
this
.
replace
(
/
[
<&>'"#
]
/g
,
function
(
s
)
{
return
c
[
s
];
}
);
String
.
prototype
.
toHtmlChar
=
function
()
{
"
use strict
"
;
var
c
=
{
'
<
'
:
'
<
'
,
'
>
'
:
'
>
'
,
'
&
'
:
'
&
'
,
'
"
'
:
'
"
'
,
"
'
"
:
'
'
'
,
'
#
'
:
'
#
'
};
return
this
.
replace
(
/
[
<&>'"#
]
/g
,
function
(
s
)
{
return
c
[
s
];
});
};
String
.
prototype
.
trim
=
function
()
{
"
use strict
"
;
return
this
.
replace
(
/^
\s
*/
,
""
).
replace
(
/
\s
*$/
,
""
);
};
/****************************************/
function
setInput
(
$elt
)
{
if
(
!
$elt
){
$elt
=
$
(
'
input[type="text"], input[type="password"]
'
);}
"
use strict
"
;
if
(
!
$elt
)
{
$elt
=
$
(
'
input[type="text"], input[type="password"]
'
);
}
$elt
.
addClass
(
"
idleField
"
);
$elt
.
focus
(
function
()
{
$elt
.
focus
(
function
()
{
$
(
this
).
removeClass
(
"
idleField
"
).
addClass
(
"
focusField
"
);
if
(
this
.
value
==
this
.
defaultValue
)
{
if
(
this
.
value
===
this
.
defaultValue
)
{
this
.
value
=
''
;
}
if
(
this
.
value
!=
this
.
defaultValue
)
{
if
(
this
.
value
!==
this
.
defaultValue
)
{
this
.
select
();
}
});
$elt
.
blur
(
function
()
{
$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
||
''
);
}
});
}
/*******************Bind remove all button*******************/
function
bindRemove
(){
$
(
"
a#removeSr
"
).
click
(
function
(){
if
(
!
window
.
confirm
(
"
Do you really want to remove all software release?
"
)){
function
bindRemove
()
{
"
use strict
"
;
$
(
"
a#removeSr
"
).
click
(
function
()
{
if
(
!
window
.
confirm
(
"
Do you really want to remove all software release?
"
))
{
return
false
;
}
location
.
href
=
$SCRIPT_ROOT
+
'
/removeSoftware
'
;
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/removeSoftware
'
;
});
$
(
"
a#removeIst
"
).
click
(
function
()
{
if
(
!
window
.
confirm
(
"
Do you really want to remove all computer partition?
"
))
{
$
(
"
a#removeIst
"
).
click
(
function
()
{
if
(
!
window
.
confirm
(
"
Do you really want to remove all computer partition?
"
))
{
return
false
;
}
location
.
href
=
$SCRIPT_ROOT
+
'
/removeInstance
'
;
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/removeInstance
'
;
});
}
/**************************/
(
function
(
$
,
document
,
window
)
{
"
use strict
"
;
$
.
extend
(
$
.
fn
,
{
slideBox
:
function
(
state
)
{
if
(
!
state
)
state
=
"
hide
"
;
var
header
=
$
(
"
#
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
>h2
"
);
var
box
=
$
(
"
#
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
>div
"
);
slideBox
:
function
(
state
)
{
if
(
!
state
)
{
state
=
"
hide
"
;
}
var
header
=
$
(
"
#
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
>h2
"
),
box
=
$
(
"
#
"
+
$
(
this
).
attr
(
'
id
'
)
+
"
>div
"
);
header
.
addClass
(
state
);
if
(
state
==
"
hide
"
){
box
.
css
(
'
display
'
,
'
none
'
);}
header
.
click
(
function
(){
if
(
state
===
"
hide
"
)
{
box
.
css
(
'
display
'
,
'
none
'
);
}
header
.
click
(
function
()
{
var
state
=
box
.
css
(
"
display
"
);
if
(
state
==
"
none
"
)
{
if
(
state
===
"
none
"
)
{
box
.
slideDown
(
"
normal
"
);
header
.
removeClass
(
"
hide
"
);
header
.
addClass
(
"
show
"
);
}
else
{
}
else
{
box
.
slideUp
(
"
normal
"
);
header
.
removeClass
(
"
show
"
);
header
.
addClass
(
"
hide
"
);
...
...
slapos/runner/static/js/scripts/cookies.js
View file @
5d5a0a86
/*jslint undef: true */
/*global document, escape, unescape */
/* vim: set et sts=4: */
/*Cookies Management*/
function
setCookie
(
name
,
value
,
expires
,
path
,
domain
,
secure
){
if
(
!
expires
){
function
setCookie
(
name
,
value
,
expires
,
path
,
domain
,
secure
)
{
"
use strict
"
;
if
(
!
expires
)
{
var
today
=
new
Date
();
expires
=
new
Date
(
today
.
getTime
()
+
365
*
24
*
60
*
60
*
1000
);
}
...
...
@@ -10,23 +15,21 @@ function setCookie(name,value,expires,path,domain,secure){
((
domain
)
?
"
; domain=
"
+
domain
:
""
)
+
((
secure
)
?
"
; secure
"
:
""
);
}
function
deleteCookie
(
name
,
path
,
domain
)
{
if
(
getCookie
(
name
))
{
document
.
cookie
=
name
+
"
=
"
+
((
path
)
?
"
; path=
"
+
path
:
"
/
"
)
+
((
domain
)
?
"
; domain=
"
+
domain
:
""
)
+
"
; expires=Thu, 01-Jan-70 00:00:01 GMT
"
;
}
}
function
getCookie
(
name
)
{
var
i
,
x
,
y
,
ARRcookies
=
document
.
cookie
.
split
(
"
;
"
);
for
(
i
=
0
;
i
<
ARRcookies
.
length
;
i
++
){
x
=
ARRcookies
[
i
].
substr
(
0
,
ARRcookies
[
i
].
indexOf
(
"
=
"
));
y
=
ARRcookies
[
i
].
substr
(
ARRcookies
[
i
].
indexOf
(
"
=
"
)
+
1
);
x
=
x
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
if
(
x
==
name
){
var
result
=
unescape
(
y
);
if
(
result
!=
""
&&
result
!=
null
){
"
use strict
"
;
var
i
,
x
,
y
,
result
,
ARRcookies
=
document
.
cookie
.
split
(
"
;
"
);
for
(
i
=
0
;
i
<
ARRcookies
.
length
;
i
+=
1
)
{
x
=
ARRcookies
[
i
].
substr
(
0
,
ARRcookies
[
i
].
indexOf
(
"
=
"
));
y
=
ARRcookies
[
i
].
substr
(
ARRcookies
[
i
].
indexOf
(
"
=
"
)
+
1
);
x
=
x
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
if
(
x
===
name
)
{
result
=
unescape
(
y
);
if
(
result
!==
""
&&
result
!==
null
)
{
return
result
;
}
return
null
;
...
...
@@ -34,4 +37,13 @@ function getCookie(name) {
}
return
null
;
}
function
deleteCookie
(
name
,
path
,
domain
)
{
"
use strict
"
;
if
(
getCookie
(
name
))
{
document
.
cookie
=
name
+
"
=
"
+
(
path
?
"
; path=
"
+
path
:
"
/
"
)
+
(
domain
?
"
; domain=
"
+
domain
:
""
)
+
"
; expires=Thu, 01-Jan-70 00:00:01 GMT
"
;
}
}
/**************************/
slapos/runner/static/js/scripts/editor.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
editor
=
ace
.
edit
(
"
editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
/*jslint undef: true */
/*global $, document, ace, $SCRIPT_ROOT */
/* vim: set et sts=4: */
var
CurentMode
=
require
(
"
ace/mode/buildout
"
).
Mode
;
editor
.
getSession
().
setMode
(
new
CurentMode
());
editor
.
getSession
().
setTabSize
(
2
);
editor
.
getSession
().
setUseSoftTabs
(
true
);
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
var
file
=
$
(
"
input#profile
"
).
val
();
var
workdir
=
$
(
"
input#workdir
"
).
val
();
var
edit
=
false
;
var
send
=
false
;
selectFile
(
file
);
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
$
(
"
#save
"
).
click
(
function
(){
if
(
!
edit
){
$
(
"
#error
"
).
Popup
(
"
Can not load your file, please make sure that you have selected a Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
return
false
;
}
if
(
send
)
return
;
send
=
true
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/saveFileContent
'
,
data
:
{
file
:
file
,
content
:
editor
.
getSession
().
getValue
()},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#error
"
).
Popup
(
"
File Saved!
"
,
{
type
:
'
confirm
'
,
duration
:
2000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
return
false
;
});
$
(
"
#getmd5
"
).
click
(
function
(){
getmd5sum
();
return
false
;
});
$
(
"
#adddevelop
"
).
click
(
function
(){
var
developList
=
new
Array
();
var
i
=
0
;
$
(
"
#plist li
"
).
each
(
function
(
index
){
var
elt
=
$
(
this
).
find
(
"
input:checkbox
"
);
if
(
elt
.
is
(
"
:checked
"
)){
developList
[
i
]
=
workdir
+
"
/
"
+
elt
.
val
();
i
++
;
elt
.
attr
(
"
checked
"
,
false
);
}
});
if
(
developList
.
length
>
0
){
setDevelop
(
developList
);}
return
false
;
});
var
editor
,
CurrentMode
,
file
,
workdir
,
edit
,
send
;
function
selectFile
(
file
)
{
function
selectFile
(
file
)
{
edit
=
false
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getFileContent
'
,
data
:
"
file=
"
+
file
,
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
editor
.
getSession
().
setValue
(
data
.
result
);
edit
=
true
;
}
else
{
$
(
"
#error
"
).
Popup
(
"
Can not load your file, please make sure that you have selected a Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
"
Can not load your file, please make sure that you have selected a Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
}
}
});
return
;
}
function
getmd5sum
(){
if
(
send
)
return
;
send
=
true
function
getmd5sum
()
{
if
(
send
)
{
return
;
}
send
=
true
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getmd5sum
'
,
data
:
{
file
:
file
},
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
#md5sum
"
).
empty
();
$
(
"
#md5sum
"
).
append
(
'
md5sum : <span>
'
+
data
.
result
+
'
</span>
'
);
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
}
function
setDevelop
(
developList
){
if
(
developList
==
null
||
developList
.
length
<=
0
)
return
;
editor
.
navigateFileStart
();
editor
.
find
(
'
buildout
'
,{
caseSensitive
:
true
,
wholeWord
:
true
});
if
(
!
editor
.
getSelectionRange
().
isEmpty
()){
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
//if(!editor.getSelectionRange().isEmpty()){
//alert("found");
//}
//else{alert("no found");
//}
function
setDevelop
(
developList
)
{
if
(
developList
===
null
||
developList
.
length
<=
0
)
{
return
;
}
else
{
$
(
"
#error
"
).
Popup
(
"
Can not found part [buildout]! Please make sure that you have a cfg file
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
editor
.
navigateFileStart
();
editor
.
find
(
'
buildout
'
,
{
caseSensitive
:
true
,
wholeWord
:
true
});
if
(
editor
.
getSelectionRange
().
isEmpty
())
{
$
(
"
#error
"
).
Popup
(
"
Can not found part [buildout]! Please make sure that you have a cfg file
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
;
}
//else {
// //editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
// //if (!editor.getSelectionRange().isEmpty()) {
// //alert("found");
// //}
// //else{alert("no found");
// //}
//}
editor
.
navigateLineEnd
();
$
.
post
(
$SCRIPT_ROOT
+
"
/getPath
"
,
{
file
:
developList
.
join
(
"
#
"
)},
function
(
data
)
{
if
(
data
.
code
==
1
){
var
result
=
data
.
result
.
split
(
'
#
'
);
$
.
post
(
$SCRIPT_ROOT
+
"
/getPath
"
,
{
file
:
developList
.
join
(
"
#
"
)},
function
(
data
)
{
if
(
data
.
code
===
1
)
{
var
i
,
result
=
data
.
result
.
split
(
'
#
'
);
editor
.
insert
(
"
\n
develop =
\n\t
"
+
result
[
0
]
+
"
\n
"
);
for
(
var
i
=
1
;
i
<
result
.
length
;
i
++
)
for
(
i
=
1
;
i
<
result
.
length
;
i
+=
1
)
{
editor
.
insert
(
"
\t
"
+
result
[
i
]
+
"
\n
"
);
}
}
})
.
error
(
function
()
{
})
.
complete
(
function
()
{});
.
error
(
function
()
{
})
.
complete
(
function
()
{});
editor
.
insert
(
"
\n
"
);
}
editor
=
ace
.
edit
(
"
editor
"
);
CurrentMode
=
require
(
"
ace/mode/buildout
"
).
Mode
;
file
=
$
(
"
input#profile
"
).
val
();
workdir
=
$
(
"
input#workdir
"
).
val
();
edit
=
false
;
send
=
false
;
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
editor
.
getSession
().
setMode
(
new
CurrentMode
());
editor
.
getSession
().
setTabSize
(
2
);
editor
.
getSession
().
setUseSoftTabs
(
true
);
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
selectFile
(
file
);
$
(
"
#save
"
).
click
(
function
()
{
if
(
!
edit
)
{
$
(
"
#error
"
).
Popup
(
"
Can not load your file, please make sure that you have selected a Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
return
false
;
}
if
(
send
)
{
return
;
}
send
=
true
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/saveFileContent
'
,
data
:
{
file
:
file
,
content
:
editor
.
getSession
().
getValue
()},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
#error
"
).
Popup
(
"
File Saved!
"
,
{
type
:
'
confirm
'
,
duration
:
2000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
return
false
;
});
$
(
"
#getmd5
"
).
click
(
function
()
{
getmd5sum
();
return
false
;
});
$
(
"
#adddevelop
"
).
click
(
function
()
{
var
developList
=
[],
i
=
0
;
$
(
"
#plist li
"
).
each
(
function
(
index
)
{
var
elt
=
$
(
this
).
find
(
"
input:checkbox
"
);
if
(
elt
.
is
(
"
:checked
"
))
{
developList
[
i
]
=
workdir
+
"
/
"
+
elt
.
val
();
i
+=
1
;
elt
.
attr
(
"
checked
"
,
false
);
}
});
if
(
developList
.
length
>
0
)
{
setDevelop
(
developList
);
}
return
false
;
});
});
slapos/runner/static/js/scripts/folder.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
send
=
false
;
var
cloneRequest
;
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
"
workspace/
"
});
/*jslint undef: true */
/*global $, document, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
function
configRadio
()
{
$
(
"
#modelist li
"
).
each
(
function
(
index
)
{
var
boxselector
=
"
#box
"
+
index
;
if
(
$
(
this
).
hasClass
(
'
checked
'
))
{
$
(
this
).
removeClass
(
'
checked
'
);
$
(
boxselector
).
slideUp
(
"
normal
"
);
}
if
(
$
(
this
).
find
(
"
input:radio
"
).
is
(
'
:checked
'
))
{
$
(
this
).
addClass
(
'
checked
'
);
//change content here
$
(
boxselector
).
slideDown
(
"
normal
"
);
}
if
(
index
!==
2
)
{
$
(
"
input#password
"
).
val
(
""
);
$
(
"
input#cpassword
"
).
val
(
""
);
}
});
}
var
send
=
false
,
cloneRequest
;
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
"
workspace/
"
});
configRadio
();
$
(
"
input#nothing
"
).
change
(
function
()
{
$
(
"
input#nothing
"
).
change
(
function
()
{
configRadio
();
});
$
(
"
input#ssh
"
).
change
(
function
()
{
$
(
"
input#ssh
"
).
change
(
function
()
{
configRadio
();
});
$
(
"
input#https
"
).
change
(
function
()
{
$
(
"
input#https
"
).
change
(
function
()
{
configRadio
();
});
$
(
"
#clone
"
).
click
(
function
()
{
if
(
send
)
{
$
(
"
#clone
"
).
click
(
function
()
{
if
(
send
)
{
cloneRequest
.
abort
();
$
(
"
#imgwaitting
"
).
fadeOut
(
'
normal
'
);
$
(
"
#clone
"
).
empty
();
...
...
@@ -21,51 +48,49 @@ $(document).ready( function() {
send
=
false
;
return
;
}
var
repo_url
=
$
(
"
input#repo
"
).
val
();
var
email
=
""
;
var
name
=
""
;
var
repo_url
=
$
(
"
input#repo
"
).
val
(),
email
=
""
,
name
=
""
;
/* /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/ */
if
(
$
(
"
input#repo
"
).
val
()
===
''
||
!
repo_url
.
match
(
/^
[\w\d\.\/
:~@_-
]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Invalid url for the repository
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
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\.
_-
]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Invalid project name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
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
()
!==
""
)
{
if
(
$
(
"
input#user
"
).
val
()
!==
""
)
{
name
=
$
(
"
input#user
"
).
val
();
}
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
});
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
;
}
email
=
$
(
"
input#email
"
).
val
();
}
if
(
$
(
"
input#https
"
).
is
(
'
:checked
'
))
{
if
(
$
(
"
input#username
"
).
val
()
==
""
||
!
$
(
"
input#username
"
).
val
().
match
(
/^
[\w\d\.
_-
]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter a correct username
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#https
"
).
is
(
'
:checked
'
))
{
if
(
$
(
"
input#username
"
).
val
()
===
""
||
!
$
(
"
input#username
"
).
val
().
match
(
/^
[\w\d\.
_
\-]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter a correct username
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#password
"
).
val
()
!=
""
)
{
if
(
repo_url
.
indexOf
(
"
https://
"
)
!=
-
1
)
{
if
(
$
(
"
input#password
"
).
val
()
!==
""
)
{
if
(
repo_url
.
indexOf
(
"
https://
"
)
!==
-
1
)
{
repo_url
=
"
https://
"
+
$
(
"
input#username
"
).
val
()
+
"
:
"
+
$
(
"
input#password
"
).
val
()
+
"
@
"
+
repo_url
.
substring
(
8
);
}
else
{
$
(
"
#error
"
).
Popup
(
"
The URL of your repository should start with 'https://'
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
else
{
$
(
"
#error
"
).
Popup
(
"
The URL of your repository should start with 'https://'
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
}
else
{
$
(
"
#error
"
).
Popup
(
"
Please enter your password
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
else
{
$
(
"
#error
"
).
Popup
(
"
Please enter your password
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
}
else
if
(
repo_url
.
indexOf
(
"
https://
"
)
!=
-
1
){
$
(
"
#error
"
).
Popup
(
"
Please select HTTPS Security Mode for this repository
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
else
if
(
repo_url
.
indexOf
(
"
https://
"
)
!==
-
1
)
{
$
(
"
#error
"
).
Popup
(
"
Please select HTTPS Security Mode for this repository
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
$
(
"
#imgwaitting
"
).
fadeIn
(
'
normal
'
);
...
...
@@ -75,27 +100,29 @@ $(document).ready( function() {
cloneRequest
=
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/cloneRepository
'
,
data
:
{
repo
:
repo_url
,
name
:
(
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
$
(
"
input#name
"
).
val
()),
email
:
email
,
user
:
name
},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
data
:
{
repo
:
repo_url
,
name
:
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
$
(
"
input#name
"
).
val
(),
email
:
email
,
user
:
name
},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
#file_navigation
"
).
fadeIn
(
'
normal
'
);
$
(
"
#error
"
).
Popup
(
"
Your repository is cloned!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
$
(
"
#error
"
).
Popup
(
"
Your repository is cloned!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
$
(
"
input#repo
"
).
val
(
"
Enter the url of your repository...
"
);
$
(
"
input#name
"
).
val
(
"
Enter the project name...
"
);
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
"
workspace/
"
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
"
workspace/
"
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
}
$
(
"
#imgwaitting
"
).
hide
();
$
(
"
#clone
"
).
empty
();
$
(
"
#clone
"
).
append
(
"
Clone
"
);
send
=
false
;
},
error
:
function
(
request
,
error
)
{
$
(
"
#error
"
).
Popup
(
"
unable to clone your project, please check your internet connection
"
,
{
type
:
'
error
'
,
duration
:
3000
});
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
"
).
append
(
"
Clone
"
);
...
...
@@ -103,26 +130,8 @@ $(document).ready( function() {
});
return
false
;
});
function
configRadio
(){
$
(
"
#modelist li
"
).
each
(
function
(
index
)
{
var
boxselector
=
"
#box
"
+
index
;
if
(
$
(
this
).
hasClass
(
'
checked
'
)){
$
(
this
).
removeClass
(
'
checked
'
);
$
(
boxselector
).
slideUp
(
"
normal
"
);
}
if
(
$
(
this
).
find
(
"
input:radio
"
).
is
(
'
:checked
'
)){
$
(
this
).
addClass
(
'
checked
'
);
//change content here
$
(
boxselector
).
slideDown
(
"
normal
"
);
}
if
(
index
!=
2
){
$
(
"
input#password
"
).
val
(
""
);
$
(
"
input#cpassword
"
).
val
(
""
);
}
});
}
function
selectFile
(
file
)
{
function
selectFile
(
file
)
{
//nothing
return
;
}
...
...
slapos/runner/static/js/scripts/inspectInstance.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
editor
;
/*jslint undef: true */
/*global $, document, window, alert, $SCRIPT_ROOT, setInput, ace */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
editor
,
send
=
false
,
lastli
=
null
,
partitionAmount
=
$
(
'
input#partitionAmount
'
).
val
();
function
setupTextarea
(
$txt
)
{
var
size
=
Number
(
$txt
.
attr
(
'
id
'
).
split
(
'
_
'
)[
1
]),
hiddenDiv
=
$
(
document
.
createElement
(
'
div
'
)),
content
=
null
;
hiddenDiv
.
attr
(
'
id
'
,
'
div_
'
+
size
);
hiddenDiv
.
addClass
(
'
hiddendiv
'
);
$
(
'
div#parameterkw
'
).
append
(
hiddenDiv
);
$txt
.
keyup
(
function
()
{
content
=
$txt
.
val
().
replace
(
/
\n
/g
,
'
<br>
'
);
hiddenDiv
.
html
(
content
);
if
(
hiddenDiv
.
height
()
>
$txt
.
height
()
&&
hiddenDiv
.
height
()
>
120
)
{
return
;
}
$txt
.
css
(
'
height
'
,
hiddenDiv
.
height
()
+
'
px
'
);
});
}
function
setupFileTree
(
path
)
{
var
root
=
$
(
"
input#root
"
).
val
();
if
(
root
===
''
)
{
return
;
}
if
(
path
)
{
root
+=
'
/
'
+
path
+
'
/
'
;
}
else
{
root
+=
'
/
'
;
}
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
root
});
}
function
configRadio
()
{
$
(
'
#slappart li
'
).
each
(
function
()
{
var
$radio
=
$
(
this
).
find
(
'
input:radio
'
),
boxselector
=
'
#box
'
+
$radio
.
attr
(
'
id
'
);
if
(
$
(
this
).
hasClass
(
'
checked
'
))
{
$
(
this
).
removeClass
(
'
checked
'
);
$
(
boxselector
).
slideUp
(
'
normal
'
);
}
if
(
$radio
.
is
(
'
:checked
'
))
{
$
(
this
).
addClass
(
'
checked
'
);
//change content here
$
(
boxselector
).
slideDown
(
'
normal
'
);
}
});
}
function
setupSlappart
()
{
var
i
,
elt
,
fileId
;
for
(
i
=
0
;
i
<
partitionAmount
;
i
+=
1
)
{
elt
=
$
(
'
#slappart
'
+
i
+
'
Parameter
'
);
fileId
=
$
(
'
#slappart
'
+
i
+
'
Files
'
);
if
(
elt
&&
elt
!==
undefined
)
{
elt
.
click
(
function
()
{
alert
(
$
(
this
).
html
());
});
}
if
(
fileId
&&
fileId
!==
undefined
)
{
fileId
.
click
(
function
()
{
$
(
'
#instancetabfiles
'
).
click
();
setupFileTree
(
$
(
this
).
attr
(
'
rel
'
));
});
}
}
}
function
updateParameter
()
{
var
xml
=
'
<?xml version="1.0" encoding="utf-8"?>
\n
'
,
software_type
=
''
,
software_type_input_value
=
$
(
'
input#software_type
'
).
val
(),
size
=
$
(
'
#partitionParameter > tbody > tr
'
).
length
,
i
;
if
(
software_type_input_value
!==
''
&&
software_type_input_value
!==
'
Software Type here...
'
)
{
software_type
=
software_type_input_value
;
}
xml
+=
'
<instance>
\n
'
;
if
(
size
>
1
)
{
for
(
i
=
2
;
i
<=
size
;
i
+=
1
)
{
if
(
$
(
'
input#txt_
'
+
i
).
val
()
!==
''
)
{
xml
+=
'
<parameter id="
'
+
$
(
'
input#txt_
'
+
i
).
val
()
+
'
">
'
+
$
(
'
textarea#value_
'
+
i
).
val
()
+
'
</parameter>
\n
'
;
}
}
}
xml
+=
'
</instance>
\n
'
;
$
.
ajax
({
type
:
'
POST
'
,
url
:
$SCRIPT_ROOT
+
'
/saveParameterXml
'
,
data
:
{
software_type
:
software_type
,
parameter
:
xml
},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
'
#error
'
).
Popup
(
'
Instance parameters has been updated, please run your instance now!
'
,
{
type
:
'
confirm
'
,
duration
:
5000
});
}
else
{
$
(
'
#error
'
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
}
function
setupEditor
(
editable
)
{
editor
=
ace
.
edit
(
'
editor
'
);
editor
.
setTheme
(
'
ace/theme/crimson_editor
'
);
var
CurentMode
=
require
(
'
ace/mode/text
'
).
Mode
;
editor
.
getSession
().
setMode
(
new
CurentMode
());
editor
.
getSession
().
setTabSize
(
2
);
editor
.
getSession
().
setUseSoftTabs
(
true
);
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
if
(
!
editable
)
{
editor
.
setReadOnly
(
true
);
}
}
function
loadParameter
()
{
$
.
ajax
({
type
:
'
GET
'
,
url
:
$SCRIPT_ROOT
+
'
/getParameterXml/dict
'
,
success
:
function
(
data
)
{
var
dict
,
propertie
,
size
;
if
(
data
.
code
===
1
)
{
dict
=
data
.
result
.
instance
;
for
(
propertie
in
dict
)
{
$
(
"
#add_attribute
"
).
click
();
size
=
Number
(
$
(
"
#partitionParameter > tbody > tr
"
).
last
().
attr
(
'
id
'
).
split
(
'
_
'
)[
1
]);
$
(
"
input#txt_
"
+
size
).
val
(
propertie
);
$
(
"
textarea#value_
"
+
size
).
val
(
dict
[
propertie
]);
$
(
"
textarea#value_
"
+
size
).
keyup
();
}
}
else
{
$
(
'
#error
'
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
}
setupFileTree
();
$
(
$
(
'
#slappart li
'
)[
0
]).
find
(
'
input:radio
'
).
attr
(
'
checked
'
,
true
);
$
(
'
.menu-box-right>div
'
).
css
(
'
min-height
'
,
$
(
'
#slappart li
'
).
length
*
26
+
20
+
'
px
'
);
configRadio
();
var
send
=
false
;
var
lastli
=
null
;
var
partitionAmount
=
$
(
'
input#partitionAmount
'
).
val
();
$
(
'
#slappart li
'
).
each
(
function
()
{
$
(
'
#slappart li
'
).
each
(
function
()
{
lastli
=
$
(
this
);
$
(
this
).
find
(
'
input:radio
'
).
change
(
function
()
{
$
(
this
).
find
(
'
input:radio
'
).
change
(
function
()
{
configRadio
();
});
});
if
(
lastli
)
{
lastli
.
css
(
'
border-bottom
'
,
'
none
'
);}
if
(
lastli
)
{
lastli
.
css
(
'
border-bottom
'
,
'
none
'
);
}
$
(
'
#parameterkw
'
).
slideBox
(
'
show
'
);
setupSlappart
();
$
(
'
#reloadfiles
'
).
click
(
function
()
{
$
(
'
#reloadfiles
'
).
click
(
function
()
{
setupFileTree
();
});
$
(
'
#refresh
'
).
click
(
function
()
{
if
(
send
)
return
;
$
(
'
#refresh
'
).
click
(
function
()
{
if
(
send
)
{
return
;
}
$
(
'
#imgwaitting
'
).
fadeIn
();
$
.
ajax
({
type
:
'
GET
'
,
url
:
$SCRIPT_ROOT
+
'
/supervisordStatus
'
,
data
:
''
,
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
=
==
1
)
{
$
(
'
#supervisordcontent
'
).
empty
();
$
(
'
#supervisordcontent
'
).
append
(
data
.
result
);
}
...
...
@@ -37,25 +184,25 @@ $(document).ready(function() {
});
return
false
;
});
$
(
'
#add_attribute
'
).
click
(
function
()
{
var
size
=
Number
(
$
(
'
#partitionParameter > tbody > tr
'
).
last
().
attr
(
'
id
'
).
split
(
'
_
'
)[
1
])
+
1
;
var
row
=
"
<tr id='row_
"
+
size
+
"
'><td class='first'><input type='text' name='txt_
"
+
size
+
"
' id='txt_
"
+
size
+
"
'></td>
"
+
$
(
'
#add_attribute
'
).
click
(
function
()
{
var
size
=
Number
(
$
(
'
#partitionParameter > tbody > tr
'
).
last
().
attr
(
'
id
'
).
split
(
'
_
'
)[
1
])
+
1
,
row
=
"
<tr id='row_
"
+
size
+
"
'><td class='first'><input type='text' name='txt_
"
+
size
+
"
' id='txt_
"
+
size
+
"
'></td>
"
+
"
<td style='padding:6px'><textarea class='slap' id='value_
"
+
size
+
"
'></textarea>
"
+
"
</td><td valign='middle'><span style='margin-left: 10px;' id='btn_
"
+
size
+
"
' class='close'></span></td></tr>
"
;
$
(
'
#partitionParameter
'
).
append
(
row
);
setInput
(
$
(
'
input#txt_
'
+
size
));
setupTextarea
(
$
(
'
textarea#value_
'
+
size
));
$
(
'
#btn_
'
+
size
).
click
(
function
()
{
$
(
'
#btn_
'
+
size
).
click
(
function
()
{
var
index
=
$
(
this
).
attr
(
'
id
'
).
split
(
'
_
'
)[
1
];
$
(
'
tr#row_
'
+
index
).
remove
();
});
return
false
;
});
$
(
'
#updateParameters
'
).
click
(
function
()
{
$
(
'
#updateParameters
'
).
click
(
function
()
{
updateParameter
();
return
false
;
});
$
(
'
#xmlview
'
).
click
(
function
()
{
$
(
'
#xmlview
'
).
click
(
function
()
{
var
content
=
'
<h2 style="color: #4c6172; font: 18px
\'
Helvetica Neue
\'
, Helvetica, Arial, sans-serif;">
'
+
'
INSTANCE PARAMETERS: Load XML file</h2><p id="xmllog" class="message"><br/></p>
'
;
content
+=
'
<div class="main_content" style="height:230px"><pre id="editor"></pre></div>
'
+
...
...
@@ -63,38 +210,53 @@ $(document).ready(function() {
$
.
ajax
({
type
:
'
GET
'
,
url
:
$SCRIPT_ROOT
+
'
/getParameterXml/xml
'
,
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
#inline_instance
"
).
html
(
content
);
setupEditor
(
true
);
$
(
"
a#inlineInstance
"
).
colorbox
({
inline
:
true
,
width
:
"
600px
"
,
height
:
"
410px
"
,
onComplete
:
function
(){
$
(
"
a#inlineInstance
"
).
colorbox
(
{
inline
:
true
,
width
:
"
600px
"
,
height
:
"
410px
"
,
onComplete
:
function
()
{
editor
.
getSession
().
setValue
(
data
.
result
);
}});
}
}
);
$
(
"
a#inlineInstance
"
).
click
();
$
(
"
#loadxml
"
).
click
(
function
()
{
$
(
"
#loadxml
"
).
click
(
function
()
{
//Parse XML file
try
{
var
xmlDoc
=
$
.
parseXML
(
editor
.
getSession
().
getValue
()),
$xml
=
$
(
xmlDoc
);
if
(
$xml
.
find
(
'
parsererror
'
).
length
!==
0
)
{
$
(
'
p#xmllog
'
).
html
(
'
Error: Invalid XML document!<br/>
'
);
return
false
;}
if
(
$xml
.
find
(
'
parsererror
'
).
length
!==
0
)
{
$
(
'
p#xmllog
'
).
html
(
'
Error: Invalid XML document!<br/>
'
);
return
false
;
}
}
catch
(
err
)
{
$
(
'
p#xmllog
'
).
html
(
'
Error: Invalid XML document!<br/>
'
);
return
false
;
$
(
'
p#xmllog
'
).
html
(
'
Error: Invalid XML document!<br/>
'
);
return
false
;
}
$
.
ajax
({
type
:
'
POST
'
,
url
:
$SCRIPT_ROOT
+
'
/saveParameterXml
'
,
data
:
{
software_type
:
''
,
parameter
:
editor
.
getSession
().
getValue
()},
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
location
.
href
=
$SCRIPT_ROOT
+
'
/inspectInstance#tab3
'
;
location
.
reload
();
data
:
{
software_type
:
''
,
parameter
:
editor
.
getSession
().
getValue
()
},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/inspectInstance#tab3
'
;
window
.
location
.
reload
();
}
else
{
$
(
'
p#xmllog
'
).
html
(
data
.
result
);
}
else
{
$
(
'
p#xmllog
'
).
html
(
data
.
result
);}
}
});
return
false
;
});
}
else
{
}
else
{
$
(
'
#error
'
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
...
...
@@ -102,162 +264,44 @@ $(document).ready(function() {
});
//Load previous instance parameters
loadParameter
();
$
(
'
a#parameterTab
'
).
click
(
function
()
{
var
size
=
$
(
'
#partitionParameter > tbody > tr
'
).
length
;
for
(
var
i
=
2
;
i
<=
size
;
i
++
)
{
$
(
'
a#parameterTab
'
).
click
(
function
()
{
var
i
,
size
=
$
(
'
#partitionParameter > tbody > tr
'
).
length
;
for
(
i
=
2
;
i
<=
size
;
i
+=
1
)
{
$
(
'
textarea#value_
'
+
i
).
keyup
();
}
});
function
setupFileTree
(
path
){
var
root
=
$
(
"
input#root
"
).
val
();
if
(
root
===
''
)
return
;
if
(
path
){
root
+=
'
/
'
+
path
+
'
/
'
;
}
else
{
root
+=
'
/
'
;}
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
root
});
}
$
(
"
#parameter
"
).
load
(
$SCRIPT_ROOT
+
'
/getParameterXml
'
);
$
(
"
#update
"
).
click
(
function
()
{
if
(
$
(
"
#parameter
"
).
val
()
===
''
)
{
$
(
"
#error
"
).
Popup
(
"
Can not save empty value!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#update
"
).
click
(
function
()
{
if
(
$
(
"
#parameter
"
).
val
()
===
''
)
{
$
(
"
#error
"
).
Popup
(
"
Can not save empty value!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
$
.
ajax
({
type
:
'
POST
'
,
url
:
$SCRIPT_ROOT
+
'
/saveParameterXml
'
,
data
:
{
parameter
:
$
(
'
#parameter
'
).
val
().
trim
()},
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
=
==
1
)
{
$
(
'
#error
'
).
Popup
(
'
Instance parameters updated!
'
,
{
type
:
'
info
'
,
duration
:
3000
});
}
else
{
}
else
{
$
(
'
#error
'
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
});
function
updateParameter
()
{
var
xml
=
'
<?xml version="1.0" encoding="utf-8"?>
\n
'
,
software_type
=
''
,
software_type_input_value
=
$
(
'
input#software_type
'
).
val
();
if
(
software_type_input_value
!==
''
&&
software_type_input_value
!==
'
Software Type here...
'
)
{
software_type
=
software_type_input_value
;
}
xml
+=
'
<instance>
\n
'
;
var
size
=
$
(
'
#partitionParameter > tbody > tr
'
).
length
;
if
(
size
>
1
)
{
for
(
var
i
=
2
;
i
<=
size
;
i
++
)
{
if
(
$
(
'
input#txt_
'
+
i
).
val
()
!=
''
)
{
xml
+=
'
<parameter id="
'
+
$
(
'
input#txt_
'
+
i
).
val
()
+
'
">
'
+
$
(
'
textarea#value_
'
+
i
).
val
()
+
'
</parameter>
\n
'
;
}
}
}
xml
+=
'
</instance>
\n
'
;
$
.
ajax
({
type
:
'
POST
'
,
url
:
$SCRIPT_ROOT
+
'
/saveParameterXml
'
,
data
:
{
software_type
:
software_type
,
parameter
:
xml
},
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
$
(
'
#error
'
).
Popup
(
'
Instance parameters has been updated, please run your instance now!
'
,
{
type
:
'
confirm
'
,
duration
:
5000
});
}
else
{
$
(
'
#error
'
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
}
function
setupTextarea
(
$txt
)
{
var
size
=
Number
(
$txt
.
attr
(
'
id
'
).
split
(
'
_
'
)[
1
]);
var
hiddenDiv
=
$
(
document
.
createElement
(
'
div
'
)),
content
=
null
;
hiddenDiv
.
attr
(
'
id
'
,
'
div_
'
+
size
);
hiddenDiv
.
addClass
(
'
hiddendiv
'
);
$
(
'
div#parameterkw
'
).
append
(
hiddenDiv
);
$txt
.
keyup
(
function
()
{
content
=
$txt
.
val
().
replace
(
/
\n
/g
,
'
<br>
'
);
hiddenDiv
.
html
(
content
);
if
(
hiddenDiv
.
height
()
>
$txt
.
height
()
&&
hiddenDiv
.
height
()
>
120
)
{
return
;
}
$txt
.
css
(
'
height
'
,
hiddenDiv
.
height
()
+
'
px
'
);
});
}
function
loadParameter
()
{
$
.
ajax
({
type
:
'
GET
'
,
url
:
$SCRIPT_ROOT
+
'
/getParameterXml/dict
'
,
success
:
function
(
data
){
if
(
data
.
code
==
1
){
var
dict
=
data
.
result
[
'
instance
'
];
for
(
var
propertie
in
dict
){
$
(
"
#add_attribute
"
).
click
();
var
size
=
Number
(
$
(
"
#partitionParameter > tbody > tr
"
).
last
().
attr
(
'
id
'
).
split
(
'
_
'
)[
1
]);
$
(
"
input#txt_
"
+
size
).
val
(
propertie
);
$
(
"
textarea#value_
"
+
size
).
val
(
dict
[
propertie
]);
$
(
"
textarea#value_
"
+
size
).
keyup
();
}
}
else
{
$
(
'
#error
'
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
}
function
configRadio
()
{
$
(
'
#slappart li
'
).
each
(
function
()
{
var
$radio
=
$
(
this
).
find
(
'
input:radio
'
);
var
boxselector
=
'
#box
'
+
$radio
.
attr
(
'
id
'
);
if
(
$
(
this
).
hasClass
(
'
checked
'
))
{
$
(
this
).
removeClass
(
'
checked
'
);
$
(
boxselector
).
slideUp
(
'
normal
'
);
}
if
(
$radio
.
is
(
'
:checked
'
))
{
$
(
this
).
addClass
(
'
checked
'
);
//change content here
$
(
boxselector
).
slideDown
(
'
normal
'
);
}
});
}
function
setupBox
()
{
var
state
=
$
(
'
#softwareType
'
).
css
(
'
display
'
);
if
(
state
==
'
none
'
)
{
if
(
state
=
==
'
none
'
)
{
$
(
'
#softwareType
'
).
slideDown
(
'
normal
'
);
$
(
'
#softwareTypeHead
'
).
removeClass
(
'
hide
'
);
$
(
'
#softwareTypeHead
'
).
addClass
(
'
show
'
);
}
else
{
}
else
{
$
(
'
#softwareType
'
).
slideUp
(
'
normal
'
);
$
(
'
#softwareTypeHead
'
).
removeClass
(
'
show
'
);
$
(
'
#softwareTypeHead
'
).
addClass
(
'
hide
'
);
}
}
function
setupEditor
(
editable
)
{
editor
=
ace
.
edit
(
'
editor
'
);
editor
.
setTheme
(
'
ace/theme/crimson_editor
'
);
var
CurentMode
=
require
(
'
ace/mode/text
'
).
Mode
;
editor
.
getSession
().
setMode
(
new
CurentMode
());
editor
.
getSession
().
setTabSize
(
2
);
editor
.
getSession
().
setUseSoftTabs
(
true
);
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
if
(
!
editable
)
{
editor
.
setReadOnly
(
true
);}
}
function
setupSlappart
()
{
for
(
var
i
=
0
;
i
<
partitionAmount
;
i
++
)
{
var
elt
=
$
(
'
#slappart
'
+
i
+
'
Parameter
'
);
var
fileId
=
$
(
'
#slappart
'
+
i
+
'
Files
'
);
if
(
elt
&&
elt
!==
undefined
)
elt
.
click
(
function
()
{
alert
(
$
(
this
).
html
());
});
if
(
fileId
&&
fileId
!==
undefined
)
fileId
.
click
(
function
()
{
$
(
'
#instancetabfiles
'
).
click
();
setupFileTree
(
$
(
this
).
attr
(
'
rel
'
));
});
}
}
});
slapos/runner/static/js/scripts/inspectSoftware.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
editor
;
var
send
=
false
;
var
runnerDir
=
$
(
"
input#runnerdir
"
).
val
();
$
(
"
#reloadfiles
"
).
click
(
function
(){
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT, ace */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
editor
,
send
=
false
,
runnerDir
=
$
(
"
input#runnerdir
"
).
val
();
function
fillContent
()
{
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
runnerDir
});
}
$
(
"
#reloadfiles
"
).
click
(
function
()
{
fillContent
();
});
fillContent
();
function
fillContent
(){
$
(
'
#fileNavigator
'
).
gsFileManager
({
script
:
$SCRIPT_ROOT
+
"
/fileBrowser
"
,
root
:
runnerDir
});
}
$
(
"
#open
"
).
click
(
function
(){
$
(
"
#open
"
).
click
(
function
()
{
var
elt
=
$
(
"
option:selected
"
,
$
(
"
#softwarelist
"
));
if
(
elt
.
val
()
===
"
No Software Release found
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please select your Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
if
(
elt
.
val
()
===
"
No Software Release found
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please select your Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
return
false
;
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/setCurrentProject
'
,
data
:
"
path=
"
+
elt
.
attr
(
'
rel
'
),
success
:
function
(
data
){
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
return
false
;
});
$
(
"
#delete
"
).
click
(
function
()
{
if
(
$
(
"
#softwarelist
"
).
val
()
===
"
No Software Release found
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please select your Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
$
(
"
#delete
"
).
click
(
function
()
{
if
(
$
(
"
#softwarelist
"
).
val
()
===
"
No Software Release found
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please select your Software Release
"
,
{
type
:
'
alert
'
,
duration
:
5000
});
return
false
;
}
if
(
send
)
return
;
if
(
!
window
.
confirm
(
"
Do you really want to delete this software release?
"
)){
if
(
send
)
{
return
;
}
if
(
!
window
.
confirm
(
"
Do you really want to delete this software release?
"
))
{
return
;
}
send
=
false
;
...
...
@@ -47,24 +56,28 @@ $(document).ready( function() {
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/removeSoftwareDir
'
,
data
:
{
md5
:
$
(
"
#softwarelist
"
).
val
(),
title
:
elt
.
attr
(
'
title
'
)},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
data
:
{
md5
:
$
(
"
#softwarelist
"
).
val
(),
title
:
elt
.
attr
(
'
title
'
)
},
success
:
function
(
data
)
{
var
i
;
if
(
data
.
code
===
1
)
{
$
(
"
#softwarelist
"
).
empty
();
for
(
var
i
=
0
;
i
<
data
.
result
.
length
;
i
++
)
{
$
(
"
#softwarelist
"
).
append
(
'
<option value="
'
+
data
.
result
[
i
][
'
md5
'
]
+
'
" title="
'
+
data
.
result
[
i
][
'
title
'
]
+
'
" rel="
'
+
data
.
result
[
i
][
'
path
'
]
+
'
">
'
+
data
.
result
[
i
][
'
title
'
]
+
'
</option>
'
);
for
(
i
=
0
;
i
<
data
.
result
.
length
;
i
+=
1
)
{
$
(
"
#softwarelist
"
).
append
(
'
<option value="
'
+
data
.
result
[
i
].
md5
+
'
" title="
'
+
data
.
result
[
i
].
title
+
'
" rel="
'
+
data
.
result
[
i
].
path
+
'
">
'
+
data
.
result
[
i
].
title
+
'
</option>
'
);
}
if
(
data
.
result
.
length
<
1
)
{
if
(
data
.
result
.
length
<
1
)
{
$
(
"
#softwarelist
"
).
append
(
'
<option>No Software Release found</option>
'
);
$
(
'
#fileTree
'
).
empty
();
}
fillContent
();
$
(
"
#error
"
).
Popup
(
"
Operation complete, Selected Software Release has been delete!
"
,
{
type
:
'
confirm
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
$
(
"
#error
"
).
Popup
(
"
Operation complete, Selected Software Release has been delete!
"
,
{
type
:
'
confirm
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
}
send
=
false
;
}
...
...
@@ -72,7 +85,7 @@ $(document).ready( function() {
return
false
;
});
function
setupEditor
()
{
function
setupEditor
()
{
editor
=
ace
.
edit
(
"
editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
...
...
slapos/runner/static/js/scripts/login.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
send
=
false
;
//change background
$
(
"
body
"
).
css
(
"
background
"
,
"
#9C9C9C
"
);
$
(
"
#login
"
).
click
(
function
(){
if
(
send
)
return
false
;
if
(
$
(
"
input#clogin
"
).
val
()
===
""
||
!
$
(
"
input#clogin
"
).
val
().
match
(
/^
[\w\d\.
-
]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Please enter a valid user name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#login
"
).
click
(
function
()
{
if
(
send
)
{
return
false
;
}
if
(
$
(
"
input#cpwd
"
).
val
()
===
""
||
$
(
"
input#cpwd
"
).
val
()
===
"
******
"
){
$
(
"
#error
"
).
Popup
(
"
Please enter your password
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
if
(
$
(
"
input#clogin
"
).
val
()
===
""
||
!
$
(
"
input#clogin
"
).
val
().
match
(
/^
[\w\d\.\-]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Please enter a valid user name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#cpwd
"
).
val
()
===
""
||
$
(
"
input#cpwd
"
).
val
()
===
"
******
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please enter your password
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
send
=
true
;
var
param
=
{
clogin
:
$
(
"
input#clogin
"
).
val
(),
cpwd
:
$
(
"
input#cpwd
"
).
val
()};
var
url
=
$SCRIPT_ROOT
+
"
/doLogin
"
;
var
param
=
{
clogin
:
$
(
"
input#clogin
"
).
val
(),
cpwd
:
$
(
"
input#cpwd
"
).
val
()
},
url
=
$SCRIPT_ROOT
+
"
/doLogin
"
;
$
(
"
#login
"
).
removeClass
(
"
button
"
).
addClass
(
"
dsblebutton
"
);
$
.
post
(
url
,
param
,
function
(
data
)
{
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
'
/
'
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
.
post
(
url
,
param
,
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/
'
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
})
.
error
(
function
()
{
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Cannot send your account identifier please try again!!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});})
.
complete
(
function
()
{
{
type
:
'
alert
'
,
duration
:
3000
});
})
.
complete
(
function
()
{
$
(
"
#login
"
).
removeClass
(
'
dsblebutton
'
).
addClass
(
'
button
'
);
send
=
false
;
});
...
...
slapos/runner/static/js/scripts/process.js
View file @
5d5a0a86
/*jslint undef: true */
/*global $, window, $SCRIPT_ROOT, setRunningState, setCookie, getCookie, deleteCookie */
/*global currentState: true, running: true, $current: true, processType: true, currentProcess: true */
/*global sendStop: true, processState: true, openedlogpage: true, logReadingPosition: true, speed: true */
/*global isRunning: true */
/* vim: set et sts=4: */
//Global Traitment!!!
var
url
=
$SCRIPT_ROOT
+
"
/slapgridResult
"
var
url
=
$SCRIPT_ROOT
+
"
/slapgridResult
"
;
var
currentState
=
false
;
var
running
=
true
;
var
$current
;
...
...
@@ -10,85 +18,132 @@ var processState = "Checking"; //define slapgrid running state
var
openedlogpage
=
""
;
//content software or instance if the current page is software or instance log, otherwise nothing
var
logReadingPosition
=
0
;
var
speed
=
5000
;
var
isRunning
=
function
(){
if
(
running
){
$
(
"
#error
"
).
Popup
(
"
Slapgrid is currently under execution!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
var
isRunning
=
function
()
{
"
use strict
"
;
if
(
running
)
{
$
(
"
#error
"
).
Popup
(
"
Slapgrid is currently under execution!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
}
return
running
;
}
function
setSpeed
(
value
){
if
(
openedlogpage
==
""
){
};
function
setSpeed
(
value
)
{
"
use strict
"
;
if
(
openedlogpage
===
""
)
{
speed
=
5000
;
}
else
{
speed
=
value
;
}
else
{
speed
=
value
;}
}
function
getRunningState
(){
var
param
=
{
position
:
logReadingPosition
,
log
:(
processState
!=
"
Checking
"
&&
openedlogpage
==
processType
.
toLowerCase
())?
openedlogpage
:
""
}
var
jqxhr
=
$
.
post
(
url
,
param
,
function
(
data
)
{
setRunningState
(
data
)
function
clearAll
(
setStop
)
{
"
use strict
"
;
currentState
=
false
;
running
=
setStop
;
}
function
getRunningState
()
{
"
use strict
"
;
var
param
=
{
position
:
logReadingPosition
,
log
:
(
processState
!==
"
Checking
"
&&
openedlogpage
===
processType
.
toLowerCase
())
?
openedlogpage
:
""
},
jqxhr
=
$
.
post
(
url
,
param
,
function
(
data
)
{
setRunningState
(
data
);
logReadingPosition
=
data
.
content
.
position
;
if
(
data
.
content
.
content
!=
""
)
{
if
(
data
.
content
.
content
!==
""
)
{
$
(
"
#salpgridLog
"
).
append
(
data
.
content
.
content
.
toHtmlChar
());
$
(
"
#salpgridLog
"
)
.
scrollTop
(
$
(
"
#salpgridLog
"
)[
0
].
scrollHeight
-
$
(
"
#salpgridLog
"
)
.
height
());
.
scrollTop
(
$
(
"
#salpgridLog
"
)[
0
].
scrollHeight
-
$
(
"
#salpgridLog
"
).
height
());
}
if
(
running
&&
processState
===
"
Checking
"
&&
openedlogpage
!==
""
)
{
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#manualLog
"
).
hide
();
}
if
(
running
&&
processState
==
"
Checking
"
&&
openedlogpage
!=
""
){
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#manualLog
"
).
hide
();}
processState
=
(
running
)?
"
Running
"
:
"
Stopped
"
;
processState
=
running
?
"
Running
"
:
"
Stopped
"
;
})
.
error
(
function
()
{
clearAll
(
false
);
})
.
error
(
function
()
{
clearAll
(
false
);
})
.
complete
(
function
()
{
if
(
running
){
setTimeout
(
function
(){
.
complete
(
function
()
{
if
(
running
)
{
setTimeout
(
function
()
{
getRunningState
();
},
speed
);
}
});
}
function
clearAll
(
setStop
){
currentState
=
false
;
running
=
setStop
;
function
stopProcess
()
{
"
use strict
"
;
if
(
sendStop
)
{
return
;
}
if
(
running
)
{
sendStop
=
true
;
var
urlfor
=
$SCRIPT_ROOT
+
"
stopSlapgrid
"
,
type
=
"
slapgrid-sr.pid
"
;
if
(
$
(
"
#instrun
"
).
text
()
===
"
Stop
"
)
{
type
=
"
slapgrid-cp.pid
"
;
}
$
.
post
(
urlfor
,
{
type
:
type
},
function
(
data
)
{
//if (data.result) {
//$("#error").Popup("Failled to run Slapgrid", {type:'error', duration:3000}); });
//}
})
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Failed to stop Slapgrid process
"
,
{
type
:
'
error
'
,
duration
:
3000
});
})
.
complete
(
function
()
{
sendStop
=
false
;
processState
=
"
Stopped
"
;
});
}
}
function
bindRun
(){
$
(
"
#softrun
"
).
click
(
function
(){
if
(
$
(
"
#softrun
"
).
text
()
==
"
Stop
"
){
function
bindRun
()
{
"
use strict
"
;
$
(
"
#softrun
"
).
click
(
function
()
{
if
(
$
(
"
#softrun
"
).
text
()
===
"
Stop
"
)
{
stopProcess
();
}
else
{
if
(
!
isRunning
()){
}
else
{
if
(
!
isRunning
())
{
setCookie
(
"
slapgridCMD
"
,
"
Software
"
);
location
.
href
=
$SCRIPT_ROOT
+
"
/viewSoftwareLog
"
;
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/viewSoftwareLog
"
;
}
}
return
false
;
});
$
(
"
#instrun
"
).
click
(
function
()
{
if
(
$
(
"
#instrun
"
).
text
()
==
"
Stop
"
)
{
$
(
"
#instrun
"
).
click
(
function
()
{
if
(
$
(
"
#instrun
"
).
text
()
===
"
Stop
"
)
{
stopProcess
();
}
else
{
if
(
!
isRunning
()){
}
else
{
if
(
!
isRunning
())
{
setCookie
(
"
slapgridCMD
"
,
"
Instance
"
);
location
.
href
=
$SCRIPT_ROOT
+
"
/viewInstanceLog
"
;
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/viewInstanceLog
"
;
}
}
return
false
;
});
}
function
setRunningState
(
data
){
if
(
data
.
result
){
if
(
!
currentState
){
function
setRunningState
(
data
)
{
"
use strict
"
;
if
(
data
.
result
)
{
if
(
!
currentState
)
{
$
(
"
#running
"
).
show
();
running
=
true
;
//change run menu title and style
if
(
data
.
software
)
{
if
(
data
.
software
)
{
$
(
"
#softrun
"
).
empty
();
$
(
"
#softrun
"
).
append
(
"
Stop
"
);
$
(
"
#softrun
"
).
css
(
"
color
"
,
"
#0271BF
"
);
$current
=
$
(
"
#softrun
"
);
processType
=
"
Software
"
;
}
if
(
data
.
instance
)
{
if
(
data
.
instance
)
{
$
(
"
#instrun
"
).
empty
();
$
(
"
#instrun
"
).
append
(
"
Stop
"
);
$
(
"
#instrun
"
).
css
(
"
color
"
,
"
#0271BF
"
);
...
...
@@ -96,65 +151,50 @@ function setRunningState(data){
processType
=
"
Instance
"
;
}
}
}
else
{
}
else
{
$
(
"
#running
"
).
hide
();
running
=
false
;
//nothing is currently running
if
(
$current
!=
undefined
)
{
if
(
$current
!==
undefined
)
{
$current
.
empty
();
$current
.
append
(
"
Run
"
);
$current
.
css
(
"
color
"
,
"
#000
"
);
$current
=
undefined
;
currentState
=
false
;
$
(
"
#error
"
).
Popup
(
"
Slapgrid completely finish running your
"
+
processType
+
"
Profile
"
,
{
type
:
'
info
'
,
duration
:
3000
});
$
(
"
#error
"
).
Popup
(
"
Slapgrid completely finish running your
"
+
processType
+
"
Profile
"
,
{
type
:
'
info
'
,
duration
:
3000
});
}
}
currentState
=
data
.
result
;
}
function
runProcess
(
urlfor
,
data
){
if
(
!
isRunning
()){
function
runProcess
(
urlfor
,
data
)
{
"
use strict
"
;
if
(
!
isRunning
())
{
running
=
true
;
processState
=
"
Running
"
;
currentProcess
=
$
.
post
(
urlfor
)
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Failled to run Slapgrid
"
,
{
type
:
'
error
'
,
duration
:
3000
});
});
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Failled to run Slapgrid
"
,
{
type
:
'
error
'
,
duration
:
3000
});
});
setRunningState
(
data
);
setTimeout
(
"
getRunningState()
"
,
6000
);
}
}
function
stopProcess
(){
if
(
sendStop
)
return
;
if
(
running
){
sendStop
=
true
;
var
urlfor
=
$SCRIPT_ROOT
+
"
stopSlapgrid
"
var
type
=
"
slapgrid-sr.pid
"
;
if
(
$
(
"
#instrun
"
).
text
()
==
"
Stop
"
){
type
=
"
slapgrid-cp.pid
"
;
}
$
.
post
(
urlfor
,
{
type
:
type
},
function
(
data
){
//if (data.result){
//$("#error").Popup("Failled to run Slapgrid", {type:'error', duration:3000}); });
//}
})
.
error
(
function
()
{
$
(
"
#error
"
).
Popup
(
"
Failled to stop Slapgrid process
"
,
{
type
:
'
error
'
,
duration
:
3000
});
})
.
complete
(
function
()
{
sendStop
=
false
;
processState
=
"
Stopped
"
;});
setTimeout
(
getRunningState
,
6000
);
}
}
function
checkSavedCmd
(){
function
checkSavedCmd
()
{
"
use strict
"
;
var
result
=
getCookie
(
"
slapgridCMD
"
);
if
(
!
result
)
return
false
;
if
(
result
==
"
Software
"
){
if
(
!
result
)
{
return
false
;
}
if
(
result
===
"
Software
"
)
{
running
=
false
;
runProcess
((
$SCRIPT_ROOT
+
"
/runSoftwareProfile
"
),
{
result
:
true
,
instance
:
false
,
software
:
true
});
}
else
if
(
result
==
"
Instance
"
){
{
result
:
true
,
instance
:
false
,
software
:
true
});
}
else
if
(
result
===
"
Instance
"
)
{
running
=
false
;
runProcess
((
$SCRIPT_ROOT
+
"
/runInstanceProfile
"
),
{
result
:
true
,
instance
:
true
,
software
:
false
});
{
result
:
true
,
instance
:
true
,
software
:
false
});
}
deleteCookie
(
"
slapgridCMD
"
);
return
(
result
!
=
null
);
return
(
result
!=
=
null
);
}
slapos/runner/static/js/scripts/project.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
method
=
$
(
"
input#method
"
).
val
();
var
workdir
=
$
(
"
input#workdir
"
).
val
();
if
(
method
!=
"
file
"
){
script
=
"
/openFolder
"
;
$
(
'
#fileTree
'
).
fileTree
({
root
:
workdir
,
script
:
$SCRIPT_ROOT
+
script
,
folderEvent
:
'
click
'
,
expandSpeed
:
750
,
collapseSpeed
:
750
,
multiFolder
:
false
,
selectFolder
:
true
},
function
(
file
)
{
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
method
=
$
(
"
input#method
"
).
val
(),
workdir
=
$
(
"
input#workdir
"
).
val
();
function
checkFolder
(
path
)
{
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/checkFolder
'
,
data
:
"
path=
"
+
path
,
success
:
function
(
data
)
{
var
path
=
data
.
result
;
$
(
"
input#path
"
).
val
(
path
);
if
(
path
!==
""
)
{
$
(
"
#check
"
).
fadeIn
(
'
normal
'
);
}
else
{
$
(
"
#check
"
).
hide
();
}
}
});
return
""
;
}
function
selectFile
(
file
)
{
$
(
"
#info
"
).
empty
();
$
(
"
input#subfolder
"
).
val
(
file
);
if
(
method
===
"
open
"
)
{
$
(
"
#info
"
).
append
(
"
Selection:
"
+
file
);
checkFolder
(
file
);
}
else
{
if
(
$
(
"
input#software
"
).
val
()
!==
""
&&
$
(
"
input#software
"
).
val
().
match
(
/^
[\w\d
._
\-]
+$/
))
{
$
(
"
#info
"
).
append
(
"
New Software in:
"
+
file
+
$
(
"
input#software
"
).
val
());
}
else
{
$
(
"
#info
"
).
append
(
"
Selection:
"
+
file
);
}
}
return
;
}
if
(
method
!==
"
file
"
)
{
$
(
'
#fileTree
'
).
fileTree
({
root
:
workdir
,
script
:
$SCRIPT_ROOT
+
'
/openFolder
'
,
folderEvent
:
'
click
'
,
expandSpeed
:
750
,
collapseSpeed
:
750
,
multiFolder
:
false
,
selectFolder
:
true
},
function
(
file
)
{
selectFile
(
file
);
});
}
$
(
"
input#subfolder
"
).
val
(
""
);
$
(
"
#create
"
).
click
(
function
(){
repo_url
=
$
(
"
input#software
"
).
val
();
if
(
$
(
"
input#software
"
).
val
()
==
""
||
!
$
(
"
input#software
"
).
val
().
match
(
/^
[\w\d
._-
]
+$/
)){
$
(
"
#error
"
).
Popup
(
"
Invalid Software name
"
,
{
type
:
'
alert
'
,
duration
:
3000
})
$
(
"
#create
"
).
click
(
function
()
{
if
(
$
(
"
input#software
"
).
val
()
===
""
||
!
$
(
"
input#software
"
).
val
().
match
(
/^
[\w\d
._
\-]
+$/
))
{
$
(
"
#error
"
).
Popup
(
"
Invalid Software name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#subfolder
"
).
val
()
==
""
)
{
$
(
"
#error
"
).
Popup
(
"
Select the parent folder of your software!
"
,
{
type
:
'
alert
'
,
duration
:
3000
})
if
(
$
(
"
input#subfolder
"
).
val
()
===
""
)
{
$
(
"
#error
"
).
Popup
(
"
Select the parent folder of your software!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/createSoftware
'
,
data
:
"
folder=
"
+
$
(
"
input#subfolder
"
).
val
()
+
$
(
"
input#software
"
).
val
(),
success
:
function
(
data
){
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
})
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
return
false
;
});
$
(
"
#open
"
).
click
(
function
()
{
$
(
"
#open
"
).
click
(
function
()
{
$
(
"
#flash
"
).
fadeOut
(
'
normal
'
);
$
(
"
#flash
"
).
empty
();
$
(
"
#flash
"
).
fadeIn
(
'
normal
'
);
if
(
$
(
"
input#path
"
).
val
()
==
""
)
{
$
(
"
#error
"
).
Popup
(
"
Select a valid Software Release folder!
"
,
{
type
:
'
alert
'
,
duration
:
3000
})
if
(
$
(
"
input#path
"
).
val
()
===
""
)
{
$
(
"
#error
"
).
Popup
(
"
Select a valid Software Release folder!
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/setCurrentProject
'
,
data
:
"
path=
"
+
$
(
"
input#path
"
).
val
(),
success
:
function
(
data
){
if
(
data
.
code
==
1
){
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
})
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
'
/editSoftwareProfile
'
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
return
false
;
});
function
selectFile
(
file
){
$
(
"
#info
"
).
empty
();
$
(
"
input#subfolder
"
).
val
(
file
);
path
=
""
;
if
(
method
==
"
open
"
){
$
(
"
#info
"
).
append
(
"
Selection:
"
+
file
);
checkFolder
(
file
);
}
else
{
if
(
$
(
"
input#software
"
).
val
()
!=
""
&&
$
(
"
input#software
"
).
val
().
match
(
/^
[\w\d
._-
]
+$/
)){
$
(
"
#info
"
).
append
(
"
New Software in:
"
+
file
+
$
(
"
input#software
"
).
val
());
}
else
{
$
(
"
#info
"
).
append
(
"
Selection:
"
+
file
);
}
}
return
;
}
function
checkFolder
(
path
){
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/checkFolder
'
,
data
:
"
path=
"
+
path
,
success
:
function
(
data
){
var
path
=
data
.
result
;
$
(
"
input#path
"
).
val
(
path
);
if
(
path
!=
""
){
$
(
"
#check
"
).
fadeIn
(
'
normal
'
);
}
else
{
$
(
"
#check
"
).
hide
();
}
}
});
return
""
;
}
});
slapos/runner/static/js/scripts/repo.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
send
=
false
;
var
getStatus
;
/*jslint undef: true */
/*global $, document, $SCRIPT_ROOT */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
send
=
false
,
getStatus
;
function
loadBranch
(
branch
)
{
var
i
,
selected
;
$
(
"
#activebranch
"
).
empty
();
for
(
i
=
0
;
i
<
branch
.
length
;
i
+=
1
)
{
selected
=
(
branch
[
i
].
indexOf
(
'
*
'
)
===
0
)
?
"
selected
"
:
""
;
$
(
"
#activebranch
"
).
append
(
"
<option value='
"
+
branch
[
i
]
+
"
'
"
+
selected
+
"
>
"
+
branch
[
i
]
+
"
</option>
"
);
}
}
function
gitStatus
()
{
var
project
=
$
(
"
#project
"
).
val
(),
urldata
=
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
;
$
(
"
#status
"
).
empty
();
$
(
"
#push
"
).
hide
();
$
(
"
#flash
"
).
empty
();
if
(
project
===
""
)
{
$
(
"
#status
"
).
append
(
"
<h2>Please select one project...</h2><br/><br/>
"
);
$
(
"
#branchlist
"
).
hide
();
return
;
}
send
=
true
;
getStatus
=
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getProjectStatus
'
,
data
:
"
project=
"
+
urldata
,
success
:
function
(
data
)
{
var
message
;
if
(
data
.
code
===
1
)
{
$
(
"
#branchlist
"
).
show
();
$
(
"
#status
"
).
append
(
"
<h2>Your Repository status</h2>
"
);
message
=
data
.
result
.
split
(
'
\n
'
).
join
(
'
<br/>
'
);
//alert(message);
$
(
"
#status
"
).
append
(
"
<p>
"
+
message
+
"
</p>
"
);
if
(
data
.
dirty
)
{
$
(
"
#push
"
).
show
();
$
(
"
#status
"
).
append
(
"
<br/><h2>Display Diff for current Project</h2>
"
);
$
(
"
#status
"
).
append
(
"
<p style='font-size:15px;'>You have changes in your project.
"
+
"
<a href='
"
+
$SCRIPT_ROOT
+
"
/getProjectDiff/
"
+
encodeURI
(
project
)
+
"
'>Watch the diff</a></p>
"
);
}
loadBranch
(
data
.
branch
);
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
}
function
checkout
(
mode
)
{
if
(
$
(
"
input#branchname
"
).
val
()
===
""
||
$
(
"
input#branchname
"
).
val
()
===
"
Enter the branch name...
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please Enter the branch name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
var
project
=
$
(
"
#project
"
).
val
(),
branch
=
$
(
"
input#branchname
"
).
val
();
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/newBranch
'
,
data
:
{
project
:
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
,
name
:
branch
,
create
:
mode
},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
input#branchname
"
).
val
(
"
Enter the branch name...
"
);
gitStatus
();
$
(
"
#project
"
).
change
(
function
(){
if
(
send
){
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
}
}
});
return
false
;
}
gitStatus
();
$
(
"
#project
"
).
change
(
function
()
{
if
(
send
)
{
getStatus
.
abort
();
send
=
false
;
send
=
false
;
}
gitStatus
();
});
$
(
"
#activebranch
"
).
change
(
function
(){
var
branch
=
$
(
"
#activebranch
"
).
val
();
var
project
=
$
(
"
#project
"
).
val
();
$
(
"
#activebranch
"
).
change
(
function
()
{
var
branch
=
$
(
"
#activebranch
"
).
val
(),
project
=
$
(
"
#project
"
).
val
();
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/changeBranch
'
,
data
:
"
project=
"
+
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
+
"
&name=
"
+
branch
,
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
gitStatus
();
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
}
});
});
$
(
"
#addbranch
"
).
click
(
function
()
{
$
(
"
#addbranch
"
).
click
(
function
()
{
checkout
(
"
1
"
);
return
false
;
});
$
(
"
#docheckout
"
).
click
(
function
()
{
$
(
"
#docheckout
"
).
click
(
function
()
{
checkout
(
"
0
"
);
return
false
;
});
$
(
"
#commit
"
).
click
(
function
()
{
if
(
$
(
"
input#commitmsg
"
).
val
()
==
""
||
$
(
"
input#commitmsg
"
).
val
()
==
"
Enter message...
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please Enter the commit message
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#commit
"
).
click
(
function
()
{
if
(
$
(
"
input#commitmsg
"
).
val
()
=
==
""
||
$
(
"
input#commitmsg
"
).
val
()
===
"
Enter message...
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please Enter the commit message
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
send
)
{
if
(
send
)
{
return
false
;
}
send
=
true
;
...
...
@@ -52,19 +137,18 @@ $(document).ready( function() {
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/pushProjectFiles
'
,
data
:
{
project
:
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
,
msg
:
$
(
"
input#commitmsg
"
).
val
()},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
if
(
data
.
result
!=
""
){
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
if
(
data
.
result
!==
""
)
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
"
Commit done!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
}
else
$
(
"
#error
"
).
Popup
(
"
Commit done!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
gitStatus
();
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
}
$
(
"
#imgwaitting
"
).
hide
()
$
(
"
#imgwaitting
"
).
hide
();
$
(
"
#commit
"
).
empty
();
$
(
"
#commit
"
).
attr
(
"
value
"
,
"
Commit
"
);
send
=
false
;
...
...
@@ -72,8 +156,9 @@ $(document).ready( function() {
});
return
false
;
});
/*
$("#pullbranch").click(function
(){
$("#pullbranch").click(function
(){
if (send){
return false;
}
...
...
@@ -86,16 +171,15 @@ $(document).ready( function() {
type: "POST",
url: $SCRIPT_ROOT + '/pullProjectFiles',
data: "project=" + $("input#workdir").val() + "/" + project,
success: function
(data){
if
(data.code == 1){
success: function
(data){
if
(data.code == 1){
if (data.result != ""){
error(data.result);
}
else
error("Pull done!");
gitStatus();
}
else{
} else {
error(data.result);
}
$("#pullimgwaitting").hide()
...
...
@@ -106,75 +190,5 @@ $(document).ready( function() {
});
return false;
});*/
function
gitStatus
(){
var
project
=
$
(
"
#project
"
).
val
();
$
(
"
#status
"
).
empty
();
$
(
"
#push
"
).
hide
();
$
(
"
#flash
"
).
empty
();
if
(
project
==
""
){
$
(
"
#status
"
).
append
(
"
<h2>Please select one project...</h2><br/><br/>
"
);
$
(
"
#branchlist
"
).
hide
();
return
;
}
send
=
true
;
var
urldata
=
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
;
getStatus
=
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getProjectStatus
'
,
data
:
"
project=
"
+
urldata
,
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#branchlist
"
).
show
();
$
(
"
#status
"
).
append
(
"
<h2>Your Repository status</h2>
"
);
message
=
data
.
result
.
split
(
'
\n
'
).
join
(
'
<br/>
'
);
//alert(message);
$
(
"
#status
"
).
append
(
"
<p>
"
+
message
+
"
</p>
"
);
if
(
data
.
dirty
){
$
(
"
#push
"
).
show
();
$
(
"
#status
"
).
append
(
"
<br/><h2>Display Diff for current Project</h2>
"
);
$
(
"
#status
"
).
append
(
"
<p style='font-size:15px;'>You have changes in your project.
"
+
"
<a href='
"
+
$SCRIPT_ROOT
+
"
/getProjectDiff/
"
+
encodeURI
(
project
)
+
"
'>Watch the diff</a></p>
"
);
}
loadBranch
(
data
.
branch
);
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
}
function
checkout
(
mode
){
if
(
$
(
"
input#branchname
"
).
val
()
==
""
||
$
(
"
input#branchname
"
).
val
()
==
"
Enter the branch name...
"
){
$
(
"
#error
"
).
Popup
(
"
Please Enter the branch name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
var
project
=
$
(
"
#project
"
).
val
();
var
branch
=
$
(
"
input#branchname
"
).
val
();
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/newBranch
'
,
data
:
{
project
:
$
(
"
input#workdir
"
).
val
()
+
"
/
"
+
project
,
name
:
branch
,
create
:
mode
},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
input#branchname
"
).
val
(
"
Enter the branch name...
"
);
gitStatus
();
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
});
}
}
});
return
false
;
}
function
loadBranch
(
branch
){
$
(
"
#activebranch
"
).
empty
();
for
(
i
=
0
;
i
<
branch
.
length
;
i
++
){
selected
=
(
branch
[
i
].
indexOf
(
'
*
'
)
==
0
)?
"
selected
"
:
""
;
$
(
"
#activebranch
"
).
append
(
"
<option value='
"
+
branch
[
i
]
+
"
'
"
+
selected
+
"
>
"
+
branch
[
i
]
+
"
</option>
"
);
}
}
});
slapos/runner/static/js/scripts/softwareFolder.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
var
editor
=
ace
.
edit
(
"
editor
"
);
/*jslint undef: true */
/*global $, document, $SCRIPT_ROOT, ace */
/*global path: true */
/* vim: set et sts=4: */
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
var
editor
=
ace
.
edit
(
"
editor
"
),
CurrentMode
,
script
=
"
/readFolder
"
,
softwareDisplay
=
true
,
Mode
,
modes
,
projectDir
=
$
(
"
input#project
"
).
val
(),
workdir
=
$
(
"
input#workdir
"
).
val
(),
currentProject
=
workdir
+
"
/
"
+
projectDir
.
replace
(
workdir
,
""
).
split
(
'
/
'
)[
1
],
send
=
false
,
edit
=
false
;
function
setEditMode
(
file
)
{
var
i
,
CurrentMode
=
require
(
"
ace/mode/text
"
).
Mode
;
editor
.
getSession
().
setMode
(
new
CurrentMode
());
for
(
i
=
0
;
i
<
modes
.
length
;
i
+=
1
)
{
if
(
modes
[
i
].
extRe
.
test
(
file
))
{
editor
.
getSession
().
setMode
(
modes
[
i
].
mode
);
break
;
}
}
}
function
selectFile
(
file
)
{
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
file
);
$
(
"
input#subfolder
"
).
val
(
file
);
$
(
"
#md5sum
"
).
empty
();
path
=
""
;
send
=
false
;
edit
=
false
;
if
(
file
.
substr
(
-
1
)
!==
"
/
"
)
{
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getFileContent
'
,
data
:
{
file
:
file
},
success
:
function
(
data
)
{
var
name
,
start
;
if
(
data
.
code
===
1
)
{
$
(
"
#edit_info
"
).
empty
();
name
=
file
.
split
(
'
/
'
);
if
(
file
.
length
>
65
)
{
//substring title.
start
=
file
.
length
-
65
;
file
=
"
...
"
+
file
.
substring
(
file
.
indexOf
(
"
/
"
,
(
start
+
1
)));
}
$
(
"
#edit_info
"
).
append
(
"
Current file:
"
+
file
);
$
(
"
a#option
"
).
show
();
editor
.
getSession
().
setValue
(
data
.
result
);
setEditMode
(
name
[
name
.
length
-
1
]);
edit
=
true
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
}
else
{
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
append
(
"
No file selected
"
);
$
(
"
a#option
"
).
hide
();
editor
.
getSession
().
setValue
(
""
);
}
return
;
}
function
setDetailBox
()
{
var
state
=
$
(
"
#details_box
"
).
css
(
"
display
"
);
if
(
state
===
"
none
"
)
{
$
(
"
#details_box
"
).
slideDown
(
"
normal
"
);
$
(
"
#details_head
"
).
removeClass
(
"
hide
"
);
$
(
"
#details_head
"
).
addClass
(
"
show
"
);
}
else
{
$
(
"
#details_box
"
).
slideUp
(
"
normal
"
);
$
(
"
#details_head
"
).
removeClass
(
"
show
"
);
$
(
"
#details_head
"
).
addClass
(
"
hide
"
);
}
}
function
switchContent
()
{
var
root
=
projectDir
;
if
(
!
softwareDisplay
)
{
$
(
"
#switch
"
).
empty
();
$
(
"
#switch
"
).
append
(
"
Switch to Software files
"
);
root
=
currentProject
;
}
else
{
$
(
"
#switch
"
).
empty
();
$
(
"
#switch
"
).
append
(
"
Switch to Project files
"
);
}
$
(
'
#fileTree
'
).
fileTree
({
root
:
root
,
script
:
$SCRIPT_ROOT
+
script
,
folderEvent
:
'
click
'
,
expandSpeed
:
750
,
collapseSpeed
:
750
,
multiFolder
:
false
,
selectFolder
:
true
},
function
(
file
)
{
selectFile
(
file
);
});
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
"
Select directory or nothing for root directory...
"
);
$
(
"
input#subfolder
"
).
val
(
""
);
}
function
getmd5sum
()
{
var
file
=
$
(
"
input#subfolder
"
).
val
();
if
(
send
)
{
return
;
}
send
=
true
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getmd5sum
'
,
data
:
{
file
:
$
(
"
input#subfolder
"
).
val
()},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
#md5sum
"
).
empty
();
$
(
"
#md5sum
"
).
append
(
'
md5sum : <span>
'
+
data
.
result
+
'
</span>
'
);
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
}
function
setDevelop
(
developList
)
{
if
(
developList
===
null
||
developList
.
length
<=
0
)
{
return
;
}
editor
.
navigateFileStart
();
editor
.
find
(
'
buildout
'
,
{
caseSensitive
:
true
,
wholeWord
:
true
});
if
(
!
editor
.
getSelectionRange
().
isEmpty
())
{
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
//if (!editor.getSelectionRange().isEmpty()) {
//alert("found");
//}
//else{alert("no found");
//}
}
else
{
$
(
"
#error
"
).
Popup
(
"
Can not found part [buildout]! Please make sure that you have a cfg file
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
;
}
editor
.
navigateLineEnd
();
$
.
post
(
$SCRIPT_ROOT
+
"
/getPath
"
,
{
file
:
developList
.
join
(
"
#
"
)},
function
(
data
)
{
var
result
,
i
;
if
(
data
.
code
===
1
)
{
result
=
data
.
result
.
split
(
'
#
'
);
editor
.
insert
(
"
\n
develop =
\n\t
"
+
result
[
0
]
+
"
\n
"
);
for
(
i
=
1
;
i
<
result
.
length
;
i
+=
1
)
{
editor
.
insert
(
"
\t
"
+
result
[
i
]
+
"
\n
"
);
}
}
})
.
error
(
function
()
{})
.
complete
(
function
()
{});
editor
.
insert
(
"
\n
"
);
}
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
var
Cu
rentMode
=
require
(
"
ace/mode/text
"
).
Mode
;
editor
.
getSession
().
setMode
(
new
Cu
rentMode
());
Cur
rentMode
=
require
(
"
ace/mode/text
"
).
Mode
;
editor
.
getSession
().
setMode
(
new
Cur
rentMode
());
editor
.
getSession
().
setTabSize
(
2
);
editor
.
getSession
().
setUseSoftTabs
(
true
);
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
var
script
=
"
/readFolder
"
;
var
softwareDisplay
=
true
;
var
Mode
=
function
(
name
,
desc
,
clazz
,
extensions
)
{
Mode
=
function
(
name
,
desc
,
Clazz
,
extensions
)
{
this
.
name
=
name
;
this
.
desc
=
desc
;
this
.
clazz
=
c
lazz
;
this
.
mode
=
new
c
lazz
();
this
.
clazz
=
C
lazz
;
this
.
mode
=
new
C
lazz
();
this
.
mode
.
name
=
name
;
this
.
extRe
=
new
RegExp
(
"
^.*
\\
.(
"
+
extensions
.
join
(
"
|
"
)
+
"
)$
"
);
};
var
modes
=
[
new
Mode
(
"
php
"
,
"
PHP
"
,
require
(
"
ace/mode/php
"
).
Mode
,
[
"
php
"
,
"
in
"
,
"
inc
"
]),
modes
=
[
new
Mode
(
"
php
"
,
"
PHP
"
,
require
(
"
ace/mode/php
"
).
Mode
,
[
"
php
"
,
"
in
"
,
"
inc
"
]),
new
Mode
(
"
python
"
,
"
Python
"
,
require
(
"
ace/mode/python
"
).
Mode
,
[
"
py
"
]),
new
Mode
(
"
buildout
"
,
"
Python Buildout config
"
,
require
(
"
ace/mode/buildout
"
).
Mode
,
[
"
cfg
"
])
];
var
projectDir
=
$
(
"
input#project
"
).
val
();
var
workdir
=
$
(
"
input#workdir
"
).
val
();
var
currentProject
=
workdir
+
"
/
"
+
projectDir
.
replace
(
workdir
,
""
).
split
(
'
/
'
)[
1
];
var
send
=
false
;
var
edit
=
false
;
$
(
'
#fileTree
'
).
fileTree
({
root
:
projectDir
,
script
:
$SCRIPT_ROOT
+
script
,
folderEvent
:
'
click
'
,
expandSpeed
:
750
,
collapseSpeed
:
750
,
multiFolder
:
false
,
selectFolder
:
true
},
function
(
file
)
{
$
(
'
#fileTree
'
).
fileTree
({
root
:
projectDir
,
script
:
$SCRIPT_ROOT
+
script
,
folderEvent
:
'
click
'
,
expandSpeed
:
750
,
collapseSpeed
:
750
,
multiFolder
:
false
,
selectFolder
:
true
},
function
(
file
)
{
selectFile
(
file
);
});
setDetailBox
();
$
(
"
#add
"
).
click
(
function
(){
var
path
=
(
softwareDisplay
)?
projectDir
:
currentProject
;
if
(
send
)
return
false
;
if
(
$
(
"
input#file
"
).
val
()
==
""
||
$
(
"
input#file
"
).
val
()
==
"
Enter name here...
"
){
$
(
"
#error
"
).
Popup
(
"
Please enter your file or folder name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#add
"
).
click
(
function
()
{
var
path
=
softwareDisplay
?
projectDir
:
currentProject
;
if
(
send
)
{
return
false
;
}
if
(
$
(
"
input#file
"
).
val
()
===
""
||
$
(
"
input#file
"
).
val
()
===
"
Enter name here...
"
)
{
$
(
"
#error
"
).
Popup
(
"
Please enter your file or folder name
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
$
(
"
input#subfolder
"
).
val
()
!=
""
)
{
if
(
$
(
"
input#subfolder
"
).
val
()
!==
""
)
{
path
=
$
(
"
input#subfolder
"
).
val
();
}
path
=
path
+
"
/
"
+
$
(
"
input#file
"
).
val
();
...
...
@@ -50,8 +207,8 @@ $(document).ready( function() {
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/createFile
'
,
data
:
"
file=
"
+
path
+
"
&type=
"
+
$
(
"
#type
"
).
val
(),
success
:
function
(
data
)
{
if
(
data
.
code
==
1
)
{
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
switchContent
();
$
(
"
input#file
"
).
val
(
""
);
$
(
"
#flash
"
).
fadeOut
(
'
normal
'
);
...
...
@@ -59,9 +216,8 @@ $(document).ready( function() {
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
"
Select parent directory or nothing for root...
"
);
$
(
"
input#subfolder
"
).
val
(
""
);
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
...
...
@@ -69,23 +225,27 @@ $(document).ready( function() {
return
false
;
});
$
(
"
#save
"
).
click
(
function
(){
if
(
!
edit
){
$
(
"
#error
"
).
Popup
(
"
Please select the file to edit
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
$
(
"
#save
"
).
click
(
function
()
{
if
(
!
edit
)
{
$
(
"
#error
"
).
Popup
(
"
Please select the file to edit
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
false
;
}
if
(
send
)
{
return
false
;
}
if
(
send
)
return
false
;
send
=
true
;
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/saveFileContent
'
,
data
:
{
file
:
$
(
"
input#subfolder
"
).
val
(),
content
:
editor
.
getSession
().
getValue
()},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#error
"
).
Popup
(
"
File saved succefuly!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
data
:
{
file
:
$
(
"
input#subfolder
"
).
val
(),
content
:
editor
.
getSession
().
getValue
()
},
success
:
function
(
data
)
{
if
(
data
.
code
===
1
)
{
$
(
"
#error
"
).
Popup
(
"
File saved succefuly!
"
,
{
type
:
'
confirm
'
,
duration
:
3000
});
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
...
...
@@ -93,21 +253,21 @@ $(document).ready( function() {
return
false
;
});
$
(
"
#details_head
"
).
click
(
function
()
{
$
(
"
#details_head
"
).
click
(
function
()
{
setDetailBox
();
});
$
(
"
#switch
"
).
click
(
function
()
{
$
(
"
#switch
"
).
click
(
function
()
{
softwareDisplay
=
!
softwareDisplay
;
switchContent
();
return
false
;
});
$
(
"
#getmd5
"
).
click
(
function
()
{
$
(
"
#getmd5
"
).
click
(
function
()
{
getmd5sum
();
return
false
;
});
$
(
"
#clearselect
"
).
click
(
function
()
{
$
(
"
#clearselect
"
).
click
(
function
()
{
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
"
Select directory or nothing for root directory...
"
);
$
(
"
input#subfolder
"
).
val
(
""
);
...
...
@@ -118,158 +278,22 @@ $(document).ready( function() {
$
(
"
a#option
"
).
hide
();
return
false
;
});
$
(
"
#adddevelop
"
).
click
(
function
()
{
var
developList
=
new
Array
();
var
i
=
0
;
$
(
"
#plist li
"
).
each
(
function
(
index
)
{
$
(
"
#adddevelop
"
).
click
(
function
()
{
var
developList
=
[],
i
=
0
;
$
(
"
#plist li
"
).
each
(
function
(
index
)
{
var
elt
=
$
(
this
).
find
(
"
input:checkbox
"
);
if
(
elt
.
is
(
"
:checked
"
))
{
developList
[
i
]
=
workdir
+
"
/
"
+
elt
.
val
();
i
++
;
if
(
elt
.
is
(
"
:checked
"
))
{
developList
[
i
]
=
workdir
+
"
/
"
+
elt
.
val
();
i
+=
1
;
elt
.
attr
(
"
checked
"
,
false
);
}
});
if
(
developList
.
length
>
0
){
setDevelop
(
developList
);}
return
false
;
});
function
getmd5sum
(){
var
file
=
$
(
"
input#subfolder
"
).
val
();
if
(
send
)
return
;
send
=
true
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getmd5sum
'
,
data
:
{
file
:
$
(
"
input#subfolder
"
).
val
()},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#md5sum
"
).
empty
();
$
(
"
#md5sum
"
).
append
(
'
md5sum : <span>
'
+
data
.
result
+
'
</span>
'
);
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
if
(
developList
.
length
>
0
)
{
setDevelop
(
developList
);
}
function
switchContent
(){
var
root
=
projectDir
;
if
(
!
softwareDisplay
){
$
(
"
#switch
"
).
empty
();
$
(
"
#switch
"
).
append
(
"
Switch to Software files
"
);
root
=
currentProject
;
}
else
{
$
(
"
#switch
"
).
empty
();
$
(
"
#switch
"
).
append
(
"
Switch to Project files
"
);
}
$
(
'
#fileTree
'
).
fileTree
({
root
:
root
,
script
:
$SCRIPT_ROOT
+
script
,
folderEvent
:
'
click
'
,
expandSpeed
:
750
,
collapseSpeed
:
750
,
multiFolder
:
false
,
selectFolder
:
true
},
function
(
file
)
{
selectFile
(
file
);
return
false
;
});
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
"
Select directory or nothing for root directory...
"
);
$
(
"
input#subfolder
"
).
val
(
""
);
}
function
setDetailBox
(){
var
state
=
$
(
"
#details_box
"
).
css
(
"
display
"
);
if
(
state
==
"
none
"
){
$
(
"
#details_box
"
).
slideDown
(
"
normal
"
);
$
(
"
#details_head
"
).
removeClass
(
"
hide
"
);
$
(
"
#details_head
"
).
addClass
(
"
show
"
);
}
else
{
$
(
"
#details_box
"
).
slideUp
(
"
normal
"
);
$
(
"
#details_head
"
).
removeClass
(
"
show
"
);
$
(
"
#details_head
"
).
addClass
(
"
hide
"
);
}
}
function
selectFile
(
file
){
$
(
"
#info
"
).
empty
();
$
(
"
#info
"
).
append
(
file
);
$
(
"
input#subfolder
"
).
val
(
file
);
$
(
"
#md5sum
"
).
empty
();
path
=
""
;
send
=
false
;
edit
=
false
;
if
(
file
.
substr
(
-
1
)
!=
"
/
"
){
$
.
ajax
({
type
:
"
POST
"
,
url
:
$SCRIPT_ROOT
+
'
/getFileContent
'
,
data
:
{
file
:
file
},
success
:
function
(
data
){
if
(
data
.
code
==
1
){
$
(
"
#edit_info
"
).
empty
();
var
name
=
file
.
split
(
'
/
'
);
if
(
file
.
length
>
65
){
//substring title.
var
start
=
file
.
length
-
65
;
file
=
"
...
"
+
file
.
substring
(
file
.
indexOf
(
"
/
"
,
(
start
+
1
)));
}
$
(
"
#edit_info
"
).
append
(
"
Current file:
"
+
file
);
$
(
"
a#option
"
).
show
();
editor
.
getSession
().
setValue
(
data
.
result
);
setEditMode
(
name
[
name
.
length
-
1
]);
edit
=
true
;
}
else
{
$
(
"
#error
"
).
Popup
(
data
.
result
,
{
type
:
'
error
'
,
duration
:
5000
});
}
send
=
false
;
}
});
}
else
{
$
(
"
#edit_info
"
).
empty
();
$
(
"
#edit_info
"
).
append
(
"
No file selected
"
);
$
(
"
a#option
"
).
hide
();
editor
.
getSession
().
setValue
(
""
);
}
return
;
}
function
setEditMode
(
file
){
var
CurentMode
=
require
(
"
ace/mode/text
"
).
Mode
;
editor
.
getSession
().
setMode
(
new
CurentMode
());
for
(
var
i
=
0
;
i
<
modes
.
length
;
i
++
){
if
(
modes
[
i
].
extRe
.
test
(
file
)){
editor
.
getSession
().
setMode
(
modes
[
i
].
mode
);
set
=
true
;
break
;
}
}
}
function
setDevelop
(
developList
){
if
(
developList
==
null
||
developList
.
length
<=
0
)
return
;
editor
.
navigateFileStart
();
editor
.
find
(
'
buildout
'
,{
caseSensitive
:
true
,
wholeWord
:
true
});
if
(
!
editor
.
getSelectionRange
().
isEmpty
()){
//editor.find("",{caseSensitive: true,wholeWord: true,regExp: true});
//if(!editor.getSelectionRange().isEmpty()){
//alert("found");
//}
//else{alert("no found");
//}
}
else
{
$
(
"
#error
"
).
Popup
(
"
Can not found part [buildout]! Please make sure that you have a cfg file
"
,
{
type
:
'
alert
'
,
duration
:
3000
});
return
;
}
editor
.
navigateLineEnd
();
$
.
post
(
$SCRIPT_ROOT
+
"
/getPath
"
,
{
file
:
developList
.
join
(
"
#
"
)},
function
(
data
)
{
if
(
data
.
code
==
1
){
var
result
=
data
.
result
.
split
(
'
#
'
);
editor
.
insert
(
"
\n
develop =
\n\t
"
+
result
[
0
]
+
"
\n
"
);
for
(
var
i
=
1
;
i
<
result
.
length
;
i
++
)
editor
.
insert
(
"
\t
"
+
result
[
i
]
+
"
\n
"
);
}
})
.
error
(
function
()
{
})
.
complete
(
function
(){});
editor
.
insert
(
"
\n
"
);
}
});
slapos/runner/static/js/scripts/viewlog.js
View file @
5d5a0a86
$
(
document
).
ready
(
function
()
{
openedlogpage
=
$
(
"
input#type
"
).
val
();
updatelogBox
();
var
state
=
getCookie
(
"
autoUpdate
"
);
/*jslint undef: true */
/*global $, document, window, processState, getCookie, setCookie, setSpeed, $SCRIPT_ROOT */
/*global openedlogpage: true */
/* vim: set et sts=4: */
$
(
"
#logheader
"
).
click
(
function
(){
setupBox
();
});
$
(
"
#manual
"
).
change
(
function
(){
setCookie
(
"
autoUpdate
"
,
"
manual
"
);
if
(
$
(
"
input#type
"
).
val
()
==
"
instance
"
){
location
.
href
=
$SCRIPT_ROOT
+
"
/viewInstanceLog
"
;}
else
{
location
.
href
=
$SCRIPT_ROOT
+
"
/viewSoftwareLog
"
;}
});
$
(
"
#live
"
).
change
(
function
(){
updatelogBox
();
$
(
"
#logconfigbox
"
).
find
(
"
input:radio
"
).
attr
(
'
checked
'
,
false
);
$
(
"
#live
"
).
attr
(
'
checked
'
,
true
);
setSpeed
(
100
);
setCookie
(
"
autoUpdate
"
,
"
live
"
);
openedlogpage
=
$
(
"
input#type
"
).
val
();});
$
(
"
#slow
"
).
change
(
function
(){
updatelogBox
();
$
(
"
#logconfigbox
"
).
find
(
"
input:radio
"
).
attr
(
'
checked
'
,
false
);
$
(
"
#slow
"
).
attr
(
'
checked
'
,
true
);
setSpeed
(
2500
);
setCookie
(
"
autoUpdate
"
,
"
slow
"
);
openedlogpage
=
$
(
"
input#type
"
).
val
();});
if
(
state
){
$
(
"
#
"
+
state
).
attr
(
'
checked
'
,
true
);
updatelogBox
();
if
(
state
==
"
manual
"
){
openedlogpage
=
""
;
setSpeed
(
0
);
}
else
{
setSpeed
((
state
==
"
live
"
)?
100
:
2500
);}
}
else
{
$
(
"
#slow
"
).
attr
(
'
checked
'
,
true
);}
$
(
document
).
ready
(
function
()
{
"
use strict
"
;
function
setupBox
()
{
function
setupBox
()
{
var
state
=
$
(
"
#logconfigbox
"
).
css
(
"
display
"
);
if
(
state
==
"
none
"
)
{
if
(
state
===
"
none
"
)
{
$
(
"
#logconfigbox
"
).
slideDown
(
"
normal
"
);
$
(
"
#logheader
"
).
removeClass
(
"
hide
"
);
$
(
"
#logheader
"
).
addClass
(
"
show
"
);
}
else
{
}
else
{
$
(
"
#logconfigbox
"
).
slideUp
(
"
normal
"
);
$
(
"
#logheader
"
).
removeClass
(
"
show
"
);
$
(
"
#logheader
"
).
addClass
(
"
hide
"
);
}
}
function
updatelogBox
()
{
if
(
processState
==
"
Stopped
"
||
processState
==
"
Checking
"
||
$
(
"
#manual
"
).
is
(
"
:checked
"
))
{
function
updatelogBox
()
{
if
(
processState
===
"
Stopped
"
||
processState
===
"
Checking
"
||
$
(
"
#manual
"
).
is
(
"
:checked
"
))
{
$
(
"
#salpgridLog
"
).
hide
();
$
(
"
#manualLog
"
).
show
();
$
(
"
#manualLog
"
)
.
scrollTop
(
$
(
"
#manualLog
"
)[
0
].
scrollHeight
-
$
(
"
#manualLog
"
)
.
height
());
}
else
{
.
scrollTop
(
$
(
"
#manualLog
"
)[
0
].
scrollHeight
-
$
(
"
#manualLog
"
).
height
());
}
else
{
$
(
"
#salpgridLog
"
).
show
();
$
(
"
#manualLog
"
).
hide
();
}
}
openedlogpage
=
$
(
"
input#type
"
).
val
();
updatelogBox
();
var
state
=
getCookie
(
"
autoUpdate
"
);
$
(
"
#logheader
"
).
click
(
function
()
{
setupBox
();
});
$
(
"
#manual
"
).
change
(
function
()
{
setCookie
(
"
autoUpdate
"
,
"
manual
"
);
if
(
$
(
"
input#type
"
).
val
()
===
"
instance
"
)
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/viewInstanceLog
"
;
}
else
{
window
.
location
.
href
=
$SCRIPT_ROOT
+
"
/viewSoftwareLog
"
;
}
});
$
(
"
#live
"
).
change
(
function
()
{
updatelogBox
();
$
(
"
#logconfigbox
"
).
find
(
"
input:radio
"
).
attr
(
'
checked
'
,
false
);
$
(
"
#live
"
).
attr
(
'
checked
'
,
true
);
setSpeed
(
100
);
setCookie
(
"
autoUpdate
"
,
"
live
"
);
openedlogpage
=
$
(
"
input#type
"
).
val
();
});
$
(
"
#slow
"
).
change
(
function
()
{
updatelogBox
();
$
(
"
#logconfigbox
"
).
find
(
"
input:radio
"
).
attr
(
'
checked
'
,
false
);
$
(
"
#slow
"
).
attr
(
'
checked
'
,
true
);
setSpeed
(
2500
);
setCookie
(
"
autoUpdate
"
,
"
slow
"
);
openedlogpage
=
$
(
"
input#type
"
).
val
();
});
if
(
state
)
{
$
(
"
#
"
+
state
).
attr
(
'
checked
'
,
true
);
updatelogBox
();
if
(
state
===
"
manual
"
)
{
openedlogpage
=
""
;
setSpeed
(
0
);
}
else
{
setSpeed
((
state
===
"
live
"
)
?
100
:
2500
);
}
}
else
{
$
(
"
#slow
"
).
attr
(
'
checked
'
,
true
);
}
});
slapos/shacache/config.py
View file @
5d5a0a86
...
...
@@ -26,7 +26,7 @@ class NetworkcacheParser(OptionParser):
"""
def
__init__
(
self
,
usage
=
None
,
version
=
None
):
"""
Initialize all
options possible
s.
Initialize all
possible option
s.
"""
OptionParser
.
__init__
(
self
,
usage
=
usage
,
version
=
version
,
option_list
=
[
...
...
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