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
Ophélie Gagnard
slapos.core
Commits
7f42bc1b
Commit
7f42bc1b
authored
Jun 01, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new routing system implemented
parent
b3ee8da5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
63 deletions
+72
-63
jquery.urlJS/src/jquery.urljs.js
jquery.urlJS/src/jquery.urljs.js
+5
-4
vifib/index.html
vifib/index.html
+42
-42
vifib/static/js/core.js
vifib/static/js/core.js
+20
-13
vifib/static/js/jquery.urljs.js
vifib/static/js/jquery.urljs.js
+5
-4
No files found.
jquery.urlJS/src/jquery.urljs.js
View file @
7f42bc1b
...
@@ -36,15 +36,16 @@ $.extend({
...
@@ -36,15 +36,16 @@ $.extend({
search
:
function
(
hash
)
{
search
:
function
(
hash
)
{
var
stop
=
false
,
var
stop
=
false
,
i
=
0
,
j
=
0
,
i
,
j
,
regex
,
regex
,
result
,
result
,
extracted
;
extracted
;
while
((
stop
===
false
)
&&
(
i
<
this
.
list
.
length
))
{
i
=
this
.
list
.
length
-
1
;
while
((
stop
===
false
)
&&
(
i
>=
0
))
{
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
;
...
@@ -57,7 +58,7 @@ $.extend({
...
@@ -57,7 +58,7 @@ $.extend({
}
}
j
+=
1
;
j
+=
1
;
}
}
i
+
=
1
;
i
-
=
1
;
}
}
}
}
},
},
...
...
vifib/index.html
View file @
7f42bc1b
...
@@ -281,56 +281,56 @@
...
@@ -281,56 +281,56 @@
{{
message
}}
{{
message
}}
<
/div
>
<
/div
>
</script>
</script>
</head>
<body>
<div
id=
"loading"
style=
"position: absolute; right: 20px; top: 20px;"
></div>
<script
id=
"root"
type=
"text/html"
>
<div
class=
"navbar"
>
<
div
id
=
"
loading
"
style
=
"
position: absolute; right: 20px; top: 20px;
"
><
/div
>
<div
class=
"navbar-inner"
>
<
div
class
=
"
navbar
"
>
<div
class=
"container-fluid"
>
<
div
class
=
"
navbar-inner
"
>
<div
class=
"row-fluid"
>
<
div
class
=
"
container-fluid
"
>
<div
class=
"span2"
>
<
div
class
=
"
row-fluid
"
>
<!--<a href="#" class="brand">Vifib</a>-->
<
div
class
=
"
span2
"
>
<img
src=
"static/img/vifib_logo.gray.png"
style=
"max-height: 40px"
/>
<!--<
a
href
=
"
#
"
class
=
"
brand
"
>
Vifib
<
/a>--
>
</div>
<
img
src
=
"
static/img/vifib_logo.gray.png
"
style
=
"
max-height: 40px
"
/>
<div
class=
"span10"
>
<
/div
>
<ul
class=
"nav"
>
<
div
class
=
"
span10
"
>
<li><a
href=
"#/dashboard"
>
Dashboard
</a></li>
<
ul
class
=
"
nav
"
>
<li><a
href=
"#/about"
>
About
</a></li>
<
li
><
a
href
=
"
#/dashboard
"
>
Dashboard
<
/a></
li
>
<li><a
href=
"#/contact"
>
Contact
</a></li>
<
li
><
a
href
=
"
#/about
"
>
About
<
/a></
li
>
</ul>
<
li
><
a
href
=
"
#/contact
"
>
Contact
<
/a></
li
>
<
/ul
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
</div>
<
div
class
=
"
container-fluid
"
>
<
div
class
=
"
row-fluid
"
>
<div
class=
"container-fluid"
>
<
div
class
=
"
span3
"
>
<div
class=
"row-fluid"
>
<
div
class
=
"
well
"
style
=
"
padding:0
"
>
<div
class=
"span3"
>
<
ul
class
=
"
nav nav-list
"
>
<div
class=
"well"
style=
"padding:0"
>
<
li
class
=
"
nav-header
"
>
Softwares
<
/li
>
<ul
class=
"nav nav-list"
>
<
li
><
a
href
=
"
#/catalog
"
><
i
class
=
"
icon-
"
><
/i>Browse catalog</
a
><
/li
>
<li
class=
"nav-header"
>
Softwares
</li>
<
li
><
a
href
=
"
#/catalog/all
"
><
i
class
=
"
icon-
"
><
/i>Softwares availables</
a
><
/li
>
<li><a
href=
"#/catalog"
><i
class=
"icon-"
></i>
Browse catalog
</a></li>
<
li
class
=
"
nav-header
"
>
Servers
<
/li
>
<li><a
href=
"#/catalog/all"
><i
class=
"icon-"
></i>
Softwares availables
</a></li>
<
li
><
a
href
=
"
#/computers
"
><
i
class
=
"
icon-list
"
><
/i>List all servers</
a
><
/li
>
<li
class=
"nav-header"
>
Servers
</li>
<
li
><
a
href
=
"
#/computer
"
><
i
class
=
"
icon-plus-sign
"
><
/i>Add new server</
a
><
/li
>
<li><a
href=
"#/computers"
><i
class=
"icon-list"
></i>
List all servers
</a></li>
<
li
class
=
"
nav-header
"
>
Services
<
/li
>
<li><a
href=
"#/computer"
><i
class=
"icon-plus-sign"
></i>
Add new server
</a></li>
<
li
><
a
href
=
"
#/instances
"
><
i
class
=
"
icon-list
"
><
/i>List all instances</
a
><
/li
>
<li
class=
"nav-header"
>
Services
</li>
<
li
><
a
href
=
"
#/instance
"
><
i
class
=
"
icon-plus-sign
"
><
/i>Add new instance</
a
><
/li
>
<li><a
href=
"#/instances"
><i
class=
"icon-list"
></i>
List all instances
</a></li>
<
li
class
=
"
nav-header
"
>
Account
<
/li
>
<li><a
href=
"#/instance"
><i
class=
"icon-plus-sign"
></i>
Add new instance
</a></li>
<
li
><
a
href
=
"
#/invoices
"
><
i
class
=
"
icon-inbox
"
><
/i>Invoices</
a
><
/li
>
<li
class=
"nav-header"
>
Account
</li>
<
li
><
a
href
=
"
#/settings
"
><
i
class
=
"
icon-cog
"
><
/i>Settings</
a
><
/li
>
<li><a
href=
"#/invoices"
><i
class=
"icon-inbox"
></i>
Invoices
</a></li>
<
/ul
>
<li><a
href=
"#/settings"
><i
class=
"icon-cog"
></i>
Settings
</a></li>
<
/div
>
</ul>
<
/div
>
<
/div
>
<
section
class
=
"
span9
"
id
=
"
main
"
style
=
"
min-height: 200px
"
>
<!--
Body
content
-->
<
/section
>
<
/div
>
<
/div
>
<section
class=
"span9"
id=
"main"
style=
"min-height: 200px"
>
<!--Body content-->
</section>
<
/div
>
<
/div
>
</div>
</script>
</head>
<body>
<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>
...
...
vifib/static/js/core.js
View file @
7f42bc1b
...
@@ -59,18 +59,18 @@
...
@@ -59,18 +59,18 @@
methods
=
{
methods
=
{
init
:
function
()
{
init
:
function
()
{
var
routes
=
[];
var
routes
=
[
[[
'
/
'
,
methods
[
'
showRoot
'
]]]
];
routes
[
0
]
=
[
//
routes[0] = [
[
'
/catalog
'
,
methods
[
'
showCatalog
'
]],
//
['/catalog', methods['showCatalog']],
[
'
/catalog/all
'
,
methods
[
'
showCatalogAll
'
]],
//
['/catalog/all', methods['showCatalogAll']],
[
'
/instance
'
,
methods
[
'
requestInstance
'
]],
//
['/instance', methods['requestInstance']],
[
'
/instance/:url
'
,
methods
[
'
showInstance
'
]],
//
['/instance/:url', methods['showInstance']],
[
'
/instance/:url/bang
'
,
methods
[
'
showBangInstance
'
]],
//
['/instance/:url/bang', methods['showBangInstance']],
[
'
/computers
'
,
methods
[
'
listComputers
'
]],
//
['/computers', methods['listComputers']],
[
'
/instances
'
,
methods
[
'
listInstances
'
]],
//
['/instances', methods['listInstances']],
[
'
/invoices
'
,
methods
[
'
listInvoices
'
]],
//
['/invoices', methods['listInvoices']],
[
'
/dashboard
'
,
methods
[
'
showDashboard
'
]]
//
['/dashboard', methods['showDashboard']]
];
//
];
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
// Initialize slapos in this context
// Initialize slapos in this context
$
(
this
).
slapos
({
'
host
'
:
'
http://10.8.2.34:12006/erp5/portal_vifib_rest_api_v1
'
});
$
(
this
).
slapos
({
'
host
'
:
'
http://10.8.2.34:12006/erp5/portal_vifib_rest_api_v1
'
});
...
@@ -89,6 +89,13 @@
...
@@ -89,6 +89,13 @@
});
});
},
},
showRoot
:
function
(
params
)
{
var
route
=
$
.
router
.
routes
.
current
,
nextLevel
=
route
.
level
+
1
;
$
(
this
).
vifib
(
'
render
'
,
'
root
'
);
$
.
router
.
routes
.
add
(
'
/catalog
'
,
nextLevel
,
methods
.
showCatalog
,
$
(
"
#main
"
));
},
genInstanceUrl
:
function
(
uri
)
{
genInstanceUrl
:
function
(
uri
)
{
return
$
.
genHash
([
'
instance
'
,
encodeURIComponent
(
uri
)]);
return
$
.
genHash
([
'
instance
'
,
encodeURIComponent
(
uri
)]);
},
},
...
@@ -457,4 +464,4 @@
...
@@ -457,4 +464,4 @@
};
};
}(
jQuery
));
}(
jQuery
));
$
(
'
#main
'
).
vifib
();
$
(
'
body
'
).
vifib
();
vifib/static/js/jquery.urljs.js
View file @
7f42bc1b
...
@@ -36,15 +36,16 @@ $.extend({
...
@@ -36,15 +36,16 @@ $.extend({
search
:
function
(
hash
)
{
search
:
function
(
hash
)
{
var
stop
=
false
,
var
stop
=
false
,
i
=
0
,
j
=
0
,
i
,
j
,
regex
,
regex
,
result
,
result
,
extracted
;
extracted
;
while
((
stop
===
false
)
&&
(
i
<
this
.
list
.
length
))
{
i
=
this
.
list
.
length
-
1
;
while
((
stop
===
false
)
&&
(
i
>=
0
))
{
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
;
...
@@ -57,7 +58,7 @@ $.extend({
...
@@ -57,7 +58,7 @@ $.extend({
}
}
j
+=
1
;
j
+=
1
;
}
}
i
+
=
1
;
i
-
=
1
;
}
}
}
}
},
},
...
...
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