Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Titouan Soulard
slapos.core
Commits
b0d3766e
Commit
b0d3766e
authored
Jun 01, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge jquery.urlJS with vifib application
parent
cd8770e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
324 additions
and
339 deletions
+324
-339
jquery.urlJS/src/jquery.urljs.js
jquery.urlJS/src/jquery.urljs.js
+102
-105
vifib/index.html
vifib/index.html
+194
-194
vifib/static/js/core.js
vifib/static/js/core.js
+26
-40
vifib/static/js/urlHandler.js
vifib/static/js/urlHandler.js
+2
-0
No files found.
jquery.urlJS/src/jquery.urljs.js
View file @
b0d3766e
(
function
(
$
)
{
$
.
extend
({
'
use strict
'
;
router
:
{
$
.
extend
({
routes
:
{
router
:
{
list
:
[],
routes
:
{
current
:
null
,
list
:
[],
current
:
null
,
add
:
function
(
route
,
level
,
callback
,
context
)
{
add
:
function
(
route
,
level
,
callback
,
context
)
{
var
r
,
keys
,
i
;
var
r
,
keys
,
i
;
if
(
typeof
this
.
list
[
level
]
===
'
undefined
'
)
{
if
(
typeof
this
.
list
[
level
]
===
'
undefined
'
)
{
this
.
list
[
level
]
=
[];
this
.
list
[
level
]
=
[];
}
}
r
=
{
r
=
{
'
route
'
:
route
,
'
route
'
:
route
,
'
level
'
:
level
,
'
level
'
:
level
,
'
callback
'
:
function
(
params
)
{
'
callback
'
:
function
(
params
)
{
if
(
callback
!==
undefined
)
{
if
(
callback
!==
undefined
)
{
if
(
context
!==
undefined
)
{
if
(
context
===
undefined
)
{
callback
(
params
);
callback
(
params
);
}
else
{
}
else
{
callback
.
call
(
context
,
params
);
callback
.
call
(
context
,
params
);
}
}
}
}
,
}
},
},
i
=
this
.
list
[
level
].
length
;
this
.
list
[
level
][
i
]
=
r
;
},
},
i
=
this
.
list
[
level
].
length
;
this
.
list
[
level
][
i
]
=
r
;
},
clean
:
function
(
level
)
{
clean
:
function
(
level
)
{
this
.
list
=
this
.
list
.
slice
(
0
,
level
);
this
.
list
=
this
.
list
.
slice
(
0
,
level
);
},
},
cleanAll
:
function
()
{
cleanAll
:
function
()
{
this
.
list
=
this
.
list
.
slice
(
0
,
0
);
this
.
list
=
this
.
list
.
slice
(
0
,
0
);
},
},
search
:
function
(
hash
)
{
search
:
function
(
hash
)
{
var
stop
=
false
,
var
stop
=
false
,
i
=
0
,
j
=
0
,
i
=
0
,
j
=
0
,
regex
,
regex
,
result
,
result
,
extracted
;
extracted
;
while
((
stop
===
false
)
&&
(
i
<
this
.
list
.
length
))
{
while
((
stop
===
false
)
&&
(
i
<
this
.
list
.
length
))
{
j
=
0
;
j
=
0
;
while
((
stop
===
false
)
&&
(
j
<
this
.
list
[
i
].
length
))
{
while
((
stop
===
false
)
&&
(
j
<
this
.
list
[
i
].
length
))
{
extracted
=
$
.
router
.
extractKeys
(
this
.
list
[
i
][
j
].
route
);
extracted
=
$
.
router
.
extractKeys
(
this
.
list
[
i
][
j
].
route
);
regex
=
new
RegExp
(
'
^
'
+
extracted
.
regex
+
'
$
'
);
regex
=
new
RegExp
(
'
^
'
+
extracted
.
regex
+
'
$
'
);
if
(
regex
.
test
(
hash
.
route
))
{
if
(
regex
.
test
(
hash
.
route
))
{
result
=
regex
.
exec
(
hash
.
route
);
result
=
regex
.
exec
(
hash
.
route
);
stop
=
true
;
stop
=
true
;
result
.
shift
();
result
.
shift
();
for
(
var
k
=
0
;
k
<
result
.
length
;
k
+=
1
)
{
for
(
var
k
=
0
;
k
<
result
.
length
;
k
+=
1
)
{
hash
[
extracted
.
keys
[
k
]]
=
result
[
k
];
hash
[
extracted
.
keys
[
k
]]
=
result
[
k
];
}
this
.
current
=
this
.
list
[
i
][
j
];
this
.
list
[
i
][
j
].
callback
(
hash
);
}
}
j
+=
1
;
this
.
current
=
this
.
list
[
i
][
j
];
this
.
list
[
i
][
j
].
callback
(
hash
);
}
}
i
+=
1
;
j
+=
1
;
}
}
i
+=
1
;
}
}
},
}
},
extractKeys
:
function
(
regex
)
{
extractKeys
:
function
(
regex
)
{
var
re_key
=
new
RegExp
(
/:
(\w
+
)
/
),
var
re_key
=
new
RegExp
(
/:
(\w
+
)
/
),
keys
=
[],
keys
=
[],
result
;
result
;
while
(
re_key
.
test
(
regex
))
{
while
(
re_key
.
test
(
regex
))
{
result
=
re_key
.
exec
(
regex
);
result
=
re_key
.
exec
(
regex
);
keys
.
push
(
result
[
1
]);
keys
.
push
(
result
[
1
]);
regex
=
regex
.
replace
(
result
[
0
],
'
([^
\
/]+)
'
);
regex
=
regex
.
replace
(
result
[
0
],
'
([^
\
/]+)
'
);
}
}
return
{
'
regex
'
:
regex
,
'
keys
'
:
keys
}
return
{
'
regex
'
:
regex
,
'
keys
'
:
keys
}
},
},
deserialize
:
function
(
params
)
{
deserialize
:
function
(
params
)
{
var
result
=
{},
var
result
=
{},
p
,
p
,
params
=
params
.
split
(
'
&
'
);
params
=
params
.
split
(
'
&
'
);
while
(
params
.
length
)
{
while
(
params
.
length
)
{
p
=
params
.
shift
().
split
(
'
=
'
);
p
=
params
.
shift
().
split
(
'
=
'
);
if
(
p
[
0
]
!==
''
)
{
if
(
p
[
0
]
!==
''
)
{
if
(
p
.
length
===
2
)
{
if
(
p
.
length
===
2
)
{
result
[
p
[
0
]]
=
p
[
1
]
===
'
true
'
?
true
:
p
[
1
];
result
[
p
[
0
]]
=
p
[
1
]
===
'
true
'
?
true
:
p
[
1
];
}
else
{
}
else
{
result
[
p
[
0
]]
=
true
;
result
[
p
[
0
]]
=
true
;
}
}
}
}
}
return
result
;
}
},
return
result
;
},
serialize
:
function
(
obj
)
{
serialize
:
function
(
obj
)
{
return
$
.
param
(
obj
);
return
$
.
param
(
obj
);
},
},
parseHash
:
function
(
hashTag
)
{
parseHash
:
function
(
hashTag
)
{
var
re
=
new
RegExp
(
/
(?:
^#
([
a-zA-Z0-9
\/
_-
]
+
))(?:\?([
A-Za-z0-9
\/
&=_-
]
+
))?
/g
),
var
re
=
new
RegExp
(
/
(?:
^#
?
([
a-zA-Z0-9
\/
_-
]
+
))(?:\?([
A-Za-z0-9
\/
&=_-
]
+
))?
/g
),
groups
=
re
.
exec
(
hashTag
),
groups
=
re
.
exec
(
hashTag
),
r
,
params
=
{};
r
,
params
=
{};
groups
.
shift
();
groups
.
shift
();
// route
// route
r
=
groups
[
0
];
r
=
groups
[
0
];
// params
// params
if
(
groups
[
1
]
!==
undefined
)
{
if
(
groups
[
1
]
!==
undefined
)
{
params
=
this
.
deserialize
(
groups
[
1
]);
params
=
this
.
deserialize
(
groups
[
1
]);
}
}
return
params
.
length
===
0
?
{
'
route
'
:
r
}
:
$
.
extend
({
'
route
'
:
r
},
params
);
return
params
.
length
===
0
?
{
'
route
'
:
r
}
:
$
.
extend
({
'
route
'
:
r
},
params
);
},
},
hashHandler
:
function
()
{
hashHandler
:
function
()
{
var
hashTag
=
window
.
location
.
href
.
split
(
'
#
'
)[
1
],
var
hashTag
=
window
.
location
.
href
.
split
(
'
#
'
)[
1
],
hashInfo
=
this
.
parseHash
(
hashTag
);
hashInfo
=
$
.
router
.
parseHash
(
hashTag
);
this
.
routes
.
call
(
hashInfo
)
$
.
router
.
routes
.
search
(
hashInfo
)
},
},
}
}
});
});
$
(
window
).
bind
(
'
hashchange
'
,
$
.
router
.
hashchangeHandler
);
$
(
window
).
bind
(
'
hashchange
'
,
$
.
router
.
hashHandler
);
$
(
window
).
bind
(
'
load
'
,
$
.
router
.
hashchangeHandler
);
$
(
window
).
bind
(
'
load
'
,
$
.
router
.
hashHandler
);
}(
jQuery
));
vifib/index.html
View file @
b0d3766e
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<title></title>
<title></title>
<link
href=
"static/css/bootstrap.min.css"
rel=
"stylesheet"
/>
<link
href=
"static/css/bootstrap.min.css"
rel=
"stylesheet"
/>
<style
type=
"text/css"
media=
"screen"
>
<style
type=
"text/css"
media=
"screen"
>
[
class
*=
"span"
]
h3
{
text-align
:
center
;
}
[
class
*=
"span"
]
h3
{
text-align
:
center
;
}
.dashboard
{
text-align
:
center
;
}
.dashboard
{
text-align
:
center
;
}
.catalog-item
{
.catalog-item
{
display
:
inline-block
;
display
:
inline-block
;
padding
:
20px
30px
20px
30px
;
padding
:
20px
30px
20px
30px
;
...
@@ -34,40 +34,40 @@
...
@@ -34,40 +34,40 @@
color
:
white
;
color
:
white
;
opacity
:
1
;
opacity
:
1
;
}
}
</style>
</style>
<script
id=
"dashboard"
type=
"text/html"
>
<script
id=
"dashboard"
type=
"text/html"
>
<
div
class
=
"
row-fluid
"
>
<
div
class
=
"
row-fluid
"
>
<
div
class
=
"
span12
"
>
<
div
class
=
"
span12
"
>
<
div
id
=
"
carousel
"
class
=
"
carousel slide
"
>
<
div
id
=
"
carousel
"
class
=
"
carousel slide
"
>
<
div
class
=
"
carousel-inner
"
>
<
div
class
=
"
carousel-inner
"
>
<
div
class
=
"
item active
"
style
=
"
min-height: 200px; background-color: red
"
>
<
div
class
=
"
item active
"
style
=
"
min-height: 200px; background-color: red
"
>
image
1
image
1
<
div
class
=
"
carousel-caption
"
>
<
div
class
=
"
carousel-caption
"
>
<
h4
>
Order
online
applications
that
are
hosted
in
Vifib
'
s distributed cloud.</h4>
<
h4
>
Order
online
applications
that
are
hosted
in
Vifib
'
s distributed cloud.</h4>
</div>
</div>
</div>
</div>
<div class="item" style="min-height: 200px; background-color: green">
<div class="item" style="min-height: 200px; background-color: green">
image 2
image 2
<div class="carousel-caption">
<div class="carousel-caption">
<h4>Bring your own servers to the clouds and extend Vifib
'
s
distributed
cloud
with
your
own
machines
.
<
/h4
>
<h4>Bring your own servers to the clouds and extend Vifib
'
s
distributed
cloud
with
your
own
machines
.
<
/h4
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
row-fluid
"
>
<
div
class
=
"
row-fluid
"
>
<
div
class
=
"
span6 dashboard
"
>
<
div
class
=
"
span6 dashboard
"
>
<
h3
>
Get
a
Virtual
Machine
from
Vifib
for
1
€
/
month
<
/h3
>
<
h3
>
Get
a
Virtual
Machine
from
Vifib
for
1
€
/
month
<
/h3
>
<
a
class
=
"
btn btn-info
"
href
=
"
#/
"
>
Order
a
KVM
now
<
/a
>
<
a
class
=
"
btn btn-info
"
href
=
"
#/
"
>
Order
a
KVM
now
<
/a
>
<
/div
>
<
/div
>
<
div
class
=
"
span6 dashboard
"
>
<
div
class
=
"
span6 dashboard
"
>
<
h3
>
Explore
the
world
of
Vifib
provided
software
<
/h3
>
<
h3
>
Explore
the
world
of
Vifib
provided
software
<
/h3
>
<
a
class
=
"
btn btn-info
"
href
=
"
#/
"
>
Browse
the
Catalog
<
/a
>
<
a
class
=
"
btn btn-info
"
href
=
"
#/
"
>
Browse
the
Catalog
<
/a
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
</script>
</script>
<script
id=
"catalog.preview"
type=
"text/html"
>
<script
id=
"catalog.preview"
type=
"text/html"
>
<
h2
>
Brand
new
softwares
<
/h2
>
<
h2
>
Brand
new
softwares
<
/h2
>
...
@@ -100,40 +100,40 @@
...
@@ -100,40 +100,40 @@
<
/li
>
<
/li
>
</script>
</script>
<script
id=
"server.list"
type=
"text/html"
>
<script
id=
"server.list"
type=
"text/html"
>
<
article
>
<
article
>
<
table
class
=
"
table table-condensed
"
>
<
table
class
=
"
table table-condensed
"
>
<
caption
><
h2
>
Computers
list
<
/h2></
caption
>
<
caption
><
h2
>
Computers
list
<
/h2></
caption
>
<
tr
><
th
>
Name
<
/th><th>Reference</
th
><
th
>
State
<
/th></
tr
>
<
tr
><
th
>
Name
<
/th><th>Reference</
th
><
th
>
State
<
/th></
tr
>
<
tr
><
td
>
Couscous
<
/td><td>Comp-1</
td
><
td
><
span
class
=
"
label label-success
"
>
Started
<
/span></
td
><
/tr
>
<
tr
><
td
>
Couscous
<
/td><td>Comp-1</
td
><
td
><
span
class
=
"
label label-success
"
>
Started
<
/span></
td
><
/tr
>
<
tr
><
td
>
Merguez
<
/td><td>Comp-3</
td
><
td
><
span
class
=
"
label label-success
"
>
Started
<
/span></
td
><
/tr
>
<
tr
><
td
>
Merguez
<
/td><td>Comp-3</
td
><
td
><
span
class
=
"
label label-success
"
>
Started
<
/span></
td
><
/tr
>
<
tr
><
td
>
Plop
<
/td><td>Comp-5</
td
><
td
><
span
class
=
"
label label-important
"
>
Stopped
<
/span></
td
><
/tr
>
<
tr
><
td
>
Plop
<
/td><td>Comp-5</
td
><
td
><
span
class
=
"
label label-important
"
>
Stopped
<
/span></
td
><
/tr
>
<
/table
>
<
/table
>
<
/article
>
<
/article
>
</script>
</script>
<script
id=
"instance.list"
type=
"text/html"
>
<script
id=
"instance.list"
type=
"text/html"
>
<
table
class
=
"
table table-condensed
"
id
=
"
instance-table
"
>
<
table
class
=
"
table table-condensed
"
id
=
"
instance-table
"
>
<
caption
><
h2
>
Instances
list
<
/h2></
caption
>
<
caption
><
h2
>
Instances
list
<
/h2></
caption
>
<
/table
>
<
/table
>
</script>
</script>
<script
id=
"instance.list.elem"
type=
"text/html"
>
<script
id=
"instance.list.elem"
type=
"text/html"
>
<
td
><
a
href
=
"
{{ url }}
"
>
{{
title
}}
<
/a></
td
><
td
>
{{
status
}}
<
/td
>
<
td
><
a
href
=
"
{{ url }}
"
>
{{
title
}}
<
/a></
td
><
td
>
{{
status
}}
<
/td
>
</script>
</script>
<script
id=
"invoice.list"
type=
"text/html"
>
<script
id=
"invoice.list"
type=
"text/html"
>
<
article
>
<
article
>
<
table
class
=
"
table table-condensed
"
>
<
table
class
=
"
table table-condensed
"
>
<
caption
><
h2
>
Invoices
<
/h2></
caption
>
<
caption
><
h2
>
Invoices
<
/h2></
caption
>
<
tr
><
th
>
Number
<
/th><th>Total price</
th
><
th
>
Currency
<
/th><th>Payment</
th
><
/tr
>
<
tr
><
th
>
Number
<
/th><th>Total price</
th
><
th
>
Currency
<
/th><th>Payment</
th
><
/tr
>
<
tr
><
td
>
43
<
/td><td>1.0</
td
><
td
>
Euro
<
/td><td><span class="label label-warning">Waiting</
span
><
/td></
th
>
<
tr
><
td
>
43
<
/td><td>1.0</
td
><
td
>
Euro
<
/td><td><span class="label label-warning">Waiting</
span
><
/td></
th
>
<
tr
><
td
>
44
<
/td><td>0.0</
td
><
td
>
Euro
<
/td><td><span class="label label-success">Payed</
span
><
/td></
th
>
<
tr
><
td
>
44
<
/td><td>0.0</
td
><
td
>
Euro
<
/td><td><span class="label label-success">Payed</
span
><
/td></
th
>
<
tr
><
td
>
45
<
/td><td>1.0</
td
><
td
>
Euro
<
/td><td><span class="label label-success">Payed</
span
><
/td></
th
>
<
tr
><
td
>
45
<
/td><td>1.0</
td
><
td
>
Euro
<
/td><td><span class="label label-success">Payed</
span
><
/td></
th
>
<
tr
><
td
>
01
<
/td><td></
td
><
td
>
Euro
<
/td><td><span class="label label-important">Ongoing</
span
><
/td></
th
>
<
tr
><
td
>
01
<
/td><td></
td
><
td
>
Euro
<
/td><td><span class="label label-important">Ongoing</
span
><
/td></
th
>
<
/table
>
<
/table
>
<
/article
>
<
/article
>
</script>
</script>
<script
id=
"form.bang.instance"
type=
"text/html"
>
<script
id=
"form.bang.instance"
type=
"text/html"
>
<
form
class
=
"
form-horizontal
"
id
=
"
form-bang
"
>
<
form
class
=
"
form-horizontal
"
id
=
"
form-bang
"
>
...
@@ -144,40 +144,40 @@
...
@@ -144,40 +144,40 @@
<
/form
>
<
/form
>
</script>
</script>
<script
id=
"form.new.instance"
type=
"text/html"
>
<script
id=
"form.new.instance"
type=
"text/html"
>
<
article
>
<
article
>
<
form
class
=
"
form-horizontal
"
>
<
form
class
=
"
form-horizontal
"
>
<
fieldset
>
<
fieldset
>
<
legend
>
Request
a
new
instance
<
/legend
>
<
legend
>
Request
a
new
instance
<
/legend
>
<
div
class
=
"
control-group
"
>
<
div
class
=
"
control-group
"
>
<
label
class
=
"
control-label
"
>
Name
<
/label
>
<
label
class
=
"
control-label
"
>
Name
<
/label
>
<
div
class
=
"
controls
"
>
<
div
class
=
"
controls
"
>
<
input
type
=
"
text
"
class
=
"
input-large
"
required
name
=
"
title
"
/>
<
input
type
=
"
text
"
class
=
"
input-large
"
required
name
=
"
title
"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
control-group
"
>
<
div
class
=
"
control-group
"
>
<
label
class
=
"
control-label
"
>
Software
release
<
/label
>
<
label
class
=
"
control-label
"
>
Software
release
<
/label
>
<
div
class
=
"
controls
"
>
<
div
class
=
"
controls
"
>
<
input
type
=
"
text
"
class
=
"
input-xlarge
"
required
name
=
"
software_release
"
/>
<
input
type
=
"
text
"
class
=
"
input-xlarge
"
required
name
=
"
software_release
"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"
form-actions
"
>
<
div
class
=
"
form-actions
"
>
<
button
type
=
"
submit
"
class
=
"
btn btn-primary
"
name
=
"
submit
"
>
Request
<
/button
>
<
button
type
=
"
submit
"
class
=
"
btn btn-primary
"
name
=
"
submit
"
>
Request
<
/button
>
<
/div
>
<
/div
>
<
/fieldset
>
<
/fieldset
>
<
/form
>
<
/form
>
<
/article
>
<
/article
>
</script>
</script>
<script
id=
"auth"
type=
"text/html"
>
<script
id=
"auth"
type=
"text/html"
>
<
article
>
<
article
>
<
p
>
Authentification
needed
.
Are
you
agree
to
be
redirect
to
login
?
<
/p
>
<
p
>
Authentification
needed
.
Are
you
agree
to
be
redirect
to
login
?
<
/p
>
<
a
href
=
"
{{ host }}?response_type=token&client_id={{ client_id
}}&redirect_uri={{ redirect }}
"
>
Redirect
<
/a
>
<
a
href
=
"
{{ host }}?response_type=token&client_id={{ client_id
}}&redirect_uri={{ redirect }}
"
>
Redirect
<
/a
>
<
/article
>
<
/article
>
</script>
</script>
<script
id=
"instance"
type=
"text/html"
>
<script
id=
"instance"
type=
"text/html"
>
{{
!
Service
page
template
}}
{{
!
Service
page
template
}}
<
div
class
=
"
subnav
"
>
<
div
class
=
"
subnav
"
>
<
ul
class
=
"
nav nav-pills
"
>
<
ul
class
=
"
nav nav-pills
"
>
{{
#
actions
}}
{{
#
actions
}}
...
@@ -185,7 +185,7 @@
...
@@ -185,7 +185,7 @@
{{
/
actions
}}
{{
/
actions
}}
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
<
form
class
=
"
form-horizontal
"
id
=
"
instance-form
"
>
<
form
class
=
"
form-horizontal
"
id
=
"
instance-form
"
>
<
fieldset
>
<
fieldset
>
<
legend
>
<
legend
>
{{
title
}}
{{
title
}}
...
@@ -216,31 +216,31 @@
...
@@ -216,31 +216,31 @@
<
/div
>
<
/div
>
<
/fieldset
>
<
/fieldset
>
<
table
class
=
"
table
"
>
<
table
class
=
"
table
"
>
<
caption
>
Connection
parameters
<
/caption
>
<
caption
>
Connection
parameters
<
/caption
>
{{
#
parameter
}}
{{
#
parameter
}}
<
tr
><
td
>
{{
parameter
.
0
}}
<
/td><td></
td
><
/tr
>
<
tr
><
td
>
{{
parameter
.
0
}}
<
/td><td></
td
><
/tr
>
{{
/
parameter
}}
{{
/
parameter
}}
<
/table
>
<
/table
>
<
fieldset
>
<
fieldset
>
<
legend
>
<
legend
>
Parameter
XML
Parameter
XML
<
div
class
=
"
pull-right
"
>
<
div
class
=
"
pull-right
"
>
<
button
type
=
"
submit
"
class
=
"
btn btn-primary
"
>
Save
changes
<
/button
>
<
button
type
=
"
submit
"
class
=
"
btn btn-primary
"
>
Save
changes
<
/button
>
<
button
class
=
"
btn
"
>
Cancel
<
/button
>
<
button
class
=
"
btn
"
>
Cancel
<
/button
>
<
/div
>
<
/div
>
<
/legend
>
<
/legend
>
<
textarea
name
=
"
xml
"
style
=
"
width: 98%; height: 110px;
"
>
<
textarea
name
=
"
xml
"
style
=
"
width: 98%; height: 110px;
"
>
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<
?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?
>
<
instance
>
<
instance
>
<
parameter
id
=
"
nbd_ip
"
>
2
a01
:
e35
:
2
e27
:
460
:
e2cb
:
4
eff
:
fed9
:
48
dc
<
/parameter
>
<
parameter
id
=
"
nbd_ip
"
>
2
a01
:
e35
:
2
e27
:
460
:
e2cb
:
4
eff
:
fed9
:
48
dc
<
/parameter
>
<
parameter
id
=
"
nbd_port
"
>
1024
<
/parameter
>
<
parameter
id
=
"
nbd_port
"
>
1024
<
/parameter
>
<
/instance
>
<
/instance
>
<
/textarea
>
<
/textarea
>
<
/fieldset
>
<
/fieldset
>
<
/form
>
<
/form
>
</script>
</script>
<script
id=
"instance.stop_requested"
type=
"text/html"
>
<script
id=
"instance.stop_requested"
type=
"text/html"
>
<
div
class
=
"
btn-group
"
>
<
div
class
=
"
btn-group
"
>
...
@@ -262,87 +262,87 @@
...
@@ -262,87 +262,87 @@
<
button
class
=
"
btn btn-success disabled
"
disabled
=
"
disabled
"
id
=
"
startInstance
"
>
Started
<
/button
>
<
button
class
=
"
btn btn-success disabled
"
disabled
=
"
disabled
"
id
=
"
startInstance
"
>
Started
<
/button
>
<
/div
>
<
/div
>
</script>
</script>
<script
id=
"simple-form"
type=
"text/html"
>
<script
id=
"simple-form"
type=
"text/html"
>
<
form
class
=
"
form-inline
"
>
<
form
class
=
"
form-inline
"
>
<
fieldset
>
<
fieldset
>
<
div
class
=
"
input-append
"
>
<
div
class
=
"
input-append
"
>
<
input
required
class
=
"
span2
"
size
=
"
16
"
type
=
"
text
"
/>
<
input
required
class
=
"
span2
"
size
=
"
16
"
type
=
"
text
"
/>
<
button
class
=
"
btn
"
type
=
"
submit
"
>
Go
!<
/button
>
<
button
class
=
"
btn
"
type
=
"
submit
"
>
Go
!<
/button
>
<
/div
>
<
/div
>
<
/fieldset
>
<
/fieldset
>
<
/form
>
<
/form
>
</script>
</script>
<script
id=
"error"
type=
"text/html"
>
<script
id=
"error"
type=
"text/html"
>
<
div
class
=
"
alert alert-{{ state }}
"
>
<
div
class
=
"
alert alert-{{ state }}
"
>
<
a
class
=
"
close
"
data
-
dismiss
=
"
alert
"
href
=
"
#
"
>
×
<
/a
>
<
a
class
=
"
close
"
data
-
dismiss
=
"
alert
"
href
=
"
#
"
>
×
<
/a
>
<
h4
class
=
"
alert-heading
"
>
{{
state
}}
-
{{
date
}}
<
/h4
>
<
h4
class
=
"
alert-heading
"
>
{{
state
}}
-
{{
date
}}
<
/h4
>
{{
message
}}
{{
message
}}
<
/div
>
<
/div
>
</script>
</script>
</head>
</head>
<body>
<body>
<div
id=
"loading"
style=
"position: absolute; right: 20px; top: 20px;"
></div>
<div
id=
"loading"
style=
"position: absolute; right: 20px; top: 20px;"
></div>
<div
class=
"navbar"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<div
class=
"navbar-inner"
>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<div
class=
"span2"
>
<!--<a href="#" class="brand">Vifib</a>-->
<!--<a href="#" class="brand">Vifib</a>-->
<img
src=
"static/img/vifib_logo.gray.png"
style=
"max-height: 40px"
/>
<img
src=
"static/img/vifib_logo.gray.png"
style=
"max-height: 40px"
/>
</div>
</div>
<div
class=
"span10"
>
<div
class=
"span10"
>
<ul
class=
"nav"
>
<ul
class=
"nav"
>
<li><a
href=
"#/dashboard"
>
Dashboard
</a></li>
<li><a
href=
"#/dashboard"
>
Dashboard
</a></li>
<li><a
href=
"#/about"
>
About
</a></li>
<li><a
href=
"#/about"
>
About
</a></li>
<li><a
href=
"#/contact"
>
Contact
</a></li>
<li><a
href=
"#/contact"
>
Contact
</a></li>
</ul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span3"
>
<div
class=
"span3"
>
<div
class=
"well"
style=
"padding:0"
>
<div
class=
"well"
style=
"padding:0"
>
<ul
class=
"nav nav-list"
>
<ul
class=
"nav nav-list"
>
<li
class=
"nav-header"
>
Softwares
</li>
<li
class=
"nav-header"
>
Softwares
</li>
<li><a
href=
"#/catalog"
><i
class=
"icon-"
></i>
Browse catalog
</a></li>
<li><a
href=
"#/catalog"
><i
class=
"icon-"
></i>
Browse catalog
</a></li>
<li><a
href=
"#/catalog/all"
><i
class=
"icon-"
></i>
Softwares availables
</a></li>
<li><a
href=
"#/catalog/all"
><i
class=
"icon-"
></i>
Softwares availables
</a></li>
<li
class=
"nav-header"
>
Servers
</li>
<li
class=
"nav-header"
>
Servers
</li>
<li><a
href=
"#/computers"
><i
class=
"icon-list"
></i>
List all servers
</a></li>
<li><a
href=
"#/computers"
><i
class=
"icon-list"
></i>
List all servers
</a></li>
<li><a
href=
"#/computer"
><i
class=
"icon-plus-sign"
></i>
Add new server
</a></li>
<li><a
href=
"#/computer"
><i
class=
"icon-plus-sign"
></i>
Add new server
</a></li>
<li
class=
"nav-header"
>
Services
</li>
<li
class=
"nav-header"
>
Services
</li>
<li><a
href=
"#/instances"
><i
class=
"icon-list"
></i>
List all instances
</a></li>
<li><a
href=
"#/instances"
><i
class=
"icon-list"
></i>
List all instances
</a></li>
<li><a
href=
"#/instance"
><i
class=
"icon-plus-sign"
></i>
Add new instance
</a></li>
<li><a
href=
"#/instance"
><i
class=
"icon-plus-sign"
></i>
Add new instance
</a></li>
<li
class=
"nav-header"
>
Account
</li>
<li
class=
"nav-header"
>
Account
</li>
<li><a
href=
"#/invoices"
><i
class=
"icon-inbox"
></i>
Invoices
</a></li>
<li><a
href=
"#/invoices"
><i
class=
"icon-inbox"
></i>
Invoices
</a></li>
<li><a
href=
"#/settings"
><i
class=
"icon-cog"
></i>
Settings
</a></li>
<li><a
href=
"#/settings"
><i
class=
"icon-cog"
></i>
Settings
</a></li>
</ul>
</ul>
</div>
</div>
</div>
</div>
<section
class=
"span9"
id=
"main"
style=
"min-height: 200px"
>
<section
class=
"span9"
id=
"main"
style=
"min-height: 200px"
>
<!--Body content-->
<!--Body content-->
</section>
</section>
</div>
</div>
</div>
</div>
<script
type=
"text/javascript"
src=
"static/js/jquery-1.7.2.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/jquery-1.7.2.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/bootstrap-transition.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/bootstrap-transition.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/bootstrap-alert.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/bootstrap-alert.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/bootstrap-carousel.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/bootstrap-carousel.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/spin.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/spin.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/jquery-spin.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/jquery-spin.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/ICanHaz.min.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/ICanHaz.min.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/modernizr-2.5.3.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/modernizr-2.5.3.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/sinon-1.3.2.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/sinon-1.3.2.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/jquery.slapos.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/jquery.slapos.js"
></script>
<!--<script type="text/javascript" src="static/js/fake.js"></script>--
>
<script
type=
"text/javascript"
src=
"static/js/jquery.urljs.js"
></script
>
<script
type=
"text/javascript"
src=
"static/js/urlHandler.js"
></script
>
<!--<script type="text/javascript" src="static/js/fake.js"></script>--
>
<script
type=
"text/javascript"
src=
"static/js/core.js"
></script>
<script
type=
"text/javascript"
src=
"static/js/core.js"
></script>
</body>
</body>
</html>
</html>
vifib/static/js/core.js
View file @
b0d3766e
...
@@ -5,31 +5,7 @@
...
@@ -5,31 +5,7 @@
*/
*/
(
function
(
$
)
{
(
function
(
$
)
{
'
use strict
'
;
'
use strict
'
;
var
routes
=
{
var
getDate
=
function
()
{
'
/catalog
'
:
'
showCatalog
'
,
'
/catalog/all
'
:
'
showCatalogAll
'
,
'
/instance
'
:
'
requestInstance
'
,
'
/instance/:url
'
:
'
showInstance
'
,
'
/instance/:url/bang
'
:
'
showBangInstance
'
,
'
/computers
'
:
'
listComputers
'
,
'
/instances
'
:
'
listInstances
'
,
'
/invoices
'
:
'
listInvoices
'
,
'
/dashboard
'
:
'
showDashboard
'
},
router
=
function
(
e
,
d
)
{
var
$this
=
$
(
this
);
$
.
each
(
routes
,
function
(
pattern
,
callback
)
{
pattern
=
pattern
.
replace
(
/:
\w
+/g
,
'
([^
\
/]+)
'
);
var
regex
=
new
RegExp
(
'
^
'
+
pattern
+
'
$
'
),
result
=
regex
.
exec
(
d
);
if
(
result
)
{
result
.
shift
();
methods
[
callback
].
apply
(
$this
,
result
);
}
});
},
getDate
=
function
()
{
var
today
=
new
Date
();
var
today
=
new
Date
();
return
[
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDay
()].
join
(
'
/
'
)
+
return
[
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDay
()].
join
(
'
/
'
)
+
'
'
+
[
today
.
getHours
(),
today
.
getMinutes
(),
today
.
getSeconds
()].
join
(
'
:
'
);
'
'
+
[
today
.
getHours
(),
today
.
getMinutes
(),
today
.
getSeconds
()].
join
(
'
:
'
);
...
@@ -83,23 +59,33 @@
...
@@ -83,23 +59,33 @@
methods
=
{
methods
=
{
init
:
function
()
{
init
:
function
()
{
// Initialize slapos in this context
var
routes
=
[];
$
(
this
).
slapos
({
'
host
'
:
'
http://10.8.2.34:12006/erp5/portal_vifib_rest_api_v1
'
});
routes
[
0
]
=
[
var
$this
=
$
(
this
);
[
'
/catalog
'
,
methods
[
'
showCatalog
'
]],
// Bind Loading content
[
'
/catalog/all
'
,
methods
[
'
showCatalogAll
'
]],
$
(
'
#loading
'
).
ajaxStart
(
function
()
{
[
'
/instance
'
,
methods
[
'
requestInstance
'
]],
$
(
this
).
spin
(
spinOptions
);
[
'
/instance/:url
'
,
methods
[
'
showInstance
'
]],
}).
ajaxStop
(
function
()
{
[
'
/instance/:url/bang
'
,
methods
[
'
showBangInstance
'
]],
$
(
this
).
spin
(
false
);
[
'
/computers
'
,
methods
[
'
listComputers
'
]],
});
[
'
/instances
'
,
methods
[
'
listInstances
'
]],
// Bind to urlChange event
[
'
/invoices
'
,
methods
[
'
listInvoices
'
]],
[
'
/dashboard
'
,
methods
[
'
showDashboard
'
]]
];
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
$
.
subscribe
(
'
urlChange
'
,
function
(
e
,
d
)
{
// Initialize slapos in this context
router
.
call
(
$this
,
e
,
d
);
$
(
this
).
slapos
({
'
host
'
:
'
http://10.8.2.34:12006/erp5/portal_vifib_rest_api_v1
'
});
});
// Bind Loading content
$
.
subscribe
(
'
auth
'
,
function
(
e
,
d
)
{
$
(
'
#loading
'
).
ajaxStart
(
function
()
{
$
(
this
).
vifib
(
'
authenticate
'
,
d
);
$
(
this
).
spin
(
spinOptions
);
}).
ajaxStop
(
function
()
{
$
(
this
).
spin
(
false
);
});
});
for
(
var
level
=
0
;
level
<
routes
.
length
;
level
+=
1
)
{
for
(
var
i
=
0
;
i
<
routes
[
level
].
length
;
i
+=
1
)
{
var
r
=
routes
[
level
][
i
];
$
.
router
.
routes
.
add
(
r
[
0
],
level
,
r
[
1
],
$
(
this
));
}
}
});
});
},
},
...
...
vifib/static/js/urlHandler.js
View file @
b0d3766e
...
@@ -61,5 +61,7 @@ $.redirectHandler = function(e, url){ window.location.hash = $.genHash(url); };
...
@@ -61,5 +61,7 @@ $.redirectHandler = function(e, url){ window.location.hash = $.genHash(url); };
$
.
redirect
=
function
(
url
){
$
.
publish
(
'
redirect
'
,
[
url
]);
};
$
.
redirect
=
function
(
url
){
$
.
publish
(
'
redirect
'
,
[
url
]);
};
$
.
subscribe
(
'
redirect
'
,
$
.
redirectHandler
)
$
.
subscribe
(
'
redirect
'
,
$
.
redirectHandler
)
console
.
log
(
"
plop
"
)
$
(
window
).
bind
(
'
hashchange
'
,
$
.
hashHandler
);
$
(
window
).
bind
(
'
hashchange
'
,
$
.
hashHandler
);
$
(
window
).
bind
(
'
load
'
,
$
.
hashHandler
);
$
(
window
).
bind
(
'
load
'
,
$
.
hashHandler
);
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