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
Carlos Ramos Carreño
slapos.core
Commits
267dfdb0
Commit
267dfdb0
authored
Jul 24, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update desktop and tablet views
parent
6852c1d9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
218 additions
and
70 deletions
+218
-70
vifib/Makefile
vifib/Makefile
+6
-6
vifib/index.html
vifib/index.html
+1
-1
vifib/js/init.js
vifib/js/init.js
+7
-0
vifib/js/main.js
vifib/js/main.js
+11
-2
vifib/js/pages.desktop.js
vifib/js/pages.desktop.js
+79
-18
vifib/js/pages.js
vifib/js/pages.js
+37
-5
vifib/js/pages.mobile.js
vifib/js/pages.mobile.js
+7
-12
vifib/js/pages.tablet.js
vifib/js/pages.tablet.js
+67
-21
vifib/js/panels.js
vifib/js/panels.js
+1
-1
vifib/js/utils/fake.js
vifib/js/utils/fake.js
+2
-4
No files found.
vifib/Makefile
View file @
267dfdb0
...
@@ -3,16 +3,16 @@
...
@@ -3,16 +3,16 @@
NAME
=
build
NAME
=
build
TARBALL
=
vifib
.tar.gz
TARBALL
=
slapos
.tar.gz
DEVDIR
=
${NAME}
_dev
DEVDIR
=
${NAME}
_dev
RELDIR
=
${NAME}
RELDIR
=
${NAME}
JSDIR
=
js
JSDIR
=
js
DEVJS
=
vifib
.js
DEVJS
=
slapos
.js
DEVCSS
=
vifib
.css
DEVCSS
=
slapos
.css
FINALJS
=
vifib
.js
FINALJS
=
slapos
.js
FINALCSS
=
vifib
.css
FINALCSS
=
slapos
.css
all
:
dev release
all
:
dev release
...
@@ -132,7 +132,7 @@ ${DEVDIR}/tests/%_test.html.ok: ${DEVDIR}/tests/%_test.html ${DEVDIR}/tests/%_te
...
@@ -132,7 +132,7 @@ ${DEVDIR}/tests/%_test.html.ok: ${DEVDIR}/tests/%_test.html ${DEVDIR}/tests/%_te
#########################################
#########################################
clean
:
clean
:
@
echo
soft cleaning
@
echo
soft cleaning
rm
-rf
${DEVDIR}
/index.html
${DEVDIR}
/
vifib
.
*
${DEVDIR}
/js
rm
-rf
${DEVDIR}
/index.html
${DEVDIR}
/
slapos
.
*
${DEVDIR}
/js
cleanall
:
cleanall
:
@
echo
cleaning
@
echo
cleaning
rm
-rf
${DEVDIR}
${RELDIR}
$(TARBALL)
rm
-rf
${DEVDIR}
${RELDIR}
$(TARBALL)
vifib/index.html
View file @
267dfdb0
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<meta
http-equiv=
"content-type"
content=
"text/html; charset=utf-8"
>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css"
/>
<link
rel=
"stylesheet"
href=
"http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css"
/>
<script
src=
"
vifib
.js"
></script>
<script
src=
"
slapos
.js"
></script>
<style>
<style>
.ui-content
{
.ui-content
{
padding
:
0px
;
padding
:
0px
;
...
...
vifib/js/init.js
View file @
267dfdb0
...
@@ -12,6 +12,13 @@ $(document).bind("mobileinit", function () {
...
@@ -12,6 +12,13 @@ $(document).bind("mobileinit", function () {
// Google application id
// Google application id
'
ggappid
'
:
'
380290002359.apps.googleusercontent.com
'
'
ggappid
'
:
'
380290002359.apps.googleusercontent.com
'
});
});
// show loading during ajax request
$
(
document
).
ajaxStart
(
function
()
{
$
(
"
#loading
"
).
spin
(
spinOptions
);
}).
ajaxStop
(
function
()
{
$
(
"
#loading
"
).
spin
(
false
);
});
//$(document).slapos('store', 'host', '/fake');
//$(document).slapos('store', 'host', '/fake');
...
...
vifib/js/main.js
View file @
267dfdb0
'
use strict
'
;
'
use strict
'
;
var
getDevice
=
function
(
w
)
{
var
getDevice
=
function
(
w
)
{
return
'
mobile
'
;
if
(
w
<
500
)
{
if
(
w
<
500
)
{
return
'
mobile
'
;
return
'
mobile
'
;
}
}
...
@@ -24,7 +23,7 @@ $.vifib.devices = {
...
@@ -24,7 +23,7 @@ $.vifib.devices = {
$
(
'
body
'
)
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/login/google
'
)
.
route
(
'
add
'
,
'
/login/google
'
)
.
done
(
$
.
vifib
.
login
.
google
);
.
done
(
$
.
vifib
.
login
.
google
);
// when oogle send back the token, it reset hashtag from url
// when
G
oogle send back the token, it reset hashtag from url
$
(
'
body
'
)
$
(
'
body
'
)
.
route
(
'
add
'
,
'
access_token=<path:path>
'
)
.
route
(
'
add
'
,
'
access_token=<path:path>
'
)
.
done
(
$
.
vifib
.
login
.
googleRedirect
);
.
done
(
$
.
vifib
.
login
.
googleRedirect
);
...
@@ -42,6 +41,16 @@ $.vifib.devices = {
...
@@ -42,6 +41,16 @@ $.vifib.devices = {
$
(
'
body
'
)
$
(
'
body
'
)
.
route
(
'
add
'
,
''
)
.
route
(
'
add
'
,
''
)
.
done
(
$
.
vifib
.
tablet
.
overview
);
.
done
(
$
.
vifib
.
tablet
.
overview
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/login/facebook
'
)
.
done
(
$
.
vifib
.
login
.
facebook
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/login/google
'
)
.
done
(
$
.
vifib
.
login
.
google
);
// when Google send back the token, it reset hashtag from url
$
(
'
body
'
)
.
route
(
'
add
'
,
'
access_token=<path:path>
'
)
.
done
(
$
.
vifib
.
login
.
googleRedirect
);
$
(
'
body
'
)
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/overview
'
)
.
route
(
'
add
'
,
'
/overview
'
)
.
done
(
$
.
vifib
.
tablet
.
overview
);
.
done
(
$
.
vifib
.
tablet
.
overview
);
...
...
vifib/js/pages.desktop.js
View file @
267dfdb0
...
@@ -14,7 +14,7 @@ $.vifib.desktop = {
...
@@ -14,7 +14,7 @@ $.vifib.desktop = {
]}
]}
]);
]);
// header
// header
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Vifib
'
}));
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
SlapOs
'
}));
// rendering
// rendering
$
.
vifib
.
changepage
(
$
(
page
));
$
.
vifib
.
changepage
(
$
(
page
));
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
...
@@ -26,6 +26,16 @@ $.vifib.desktop = {
...
@@ -26,6 +26,16 @@ $.vifib.desktop = {
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/dashboard<path:url>
'
,
1
)
.
route
(
'
add
'
,
'
/dashboard<path:url>
'
,
1
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
dispatch
);
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
dispatch
);
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/login/facebook
'
,
1
)
.
done
(
$
.
vifib
.
login
.
facebook
);
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/login/google
'
,
1
)
.
done
(
$
.
vifib
.
login
.
google
);
// when Google send back the token, it reset hashtag from url
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
access_token=<path:path>
'
,
1
)
.
done
(
$
.
vifib
.
login
.
googleRedirect
);
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
1
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
1
)
.
fail
(
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
failed
)});
.
fail
(
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
failed
)});
...
@@ -69,10 +79,10 @@ $.vifib.desktop = {
...
@@ -69,10 +79,10 @@ $.vifib.desktop = {
overview
:
function
(
route
)
{
overview
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
library
,
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
library
,
{
most
:
[
most
:
[
{
url
:
'
#/library/software/id/fake/software_info/
k
vm
'
,
name
:
'
Kvm
'
},
{
url
:
'
#/library/software/id/fake/software_info/
K
vm
'
,
name
:
'
Kvm
'
},
],
],
newest
:
[
newest
:
[
{
url
:
'
#/library/software/id/fake/software_info/
html5
'
,
name
:
'
html5 AS
'
}
{
url
:
'
#/library/software/id/fake/software_info/
Html5as
'
,
name
:
'
html5 AS
'
}
]
]
});
});
},
},
...
@@ -93,7 +103,6 @@ $.vifib.desktop = {
...
@@ -93,7 +103,6 @@ $.vifib.desktop = {
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
simplelist
,
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
simplelist
,
{
links
:
[
links
:
[
{
url
:
'
#/dashboard/instance/list
'
,
name
:
'
Instances
'
},
{
url
:
'
#/dashboard/instance/list
'
,
name
:
'
Instances
'
},
{
url
:
'
#/dashboard/computer/list
'
,
name
:
'
Computers
'
}
]
]
});
});
$
(
'
#panel-2
'
)
$
(
'
#panel-2
'
)
...
@@ -103,39 +112,91 @@ $.vifib.desktop = {
...
@@ -103,39 +112,91 @@ $.vifib.desktop = {
.
route
(
'
add
'
,
'
/dashboard/instance/list
'
,
2
)
.
route
(
'
add
'
,
'
/dashboard/instance/list
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instancelist
);
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instancelist
);
$
(
'
#panel-2
'
)
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/id/<instid>
'
,
2
)
.
route
(
'
add
'
,
'
/dashboard/instance/request
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instancerequest
);
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/id<path:instid>
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instance
);
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instance
);
$
(
'
#panel-2
'
)
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/dashboard/
computer/list
'
,
2
)
.
route
(
'
add
'
,
'
/dashboard/
instance/start<path:instid>
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
computerlis
t
);
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instancestar
t
);
$
(
'
#panel-2
'
)
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/dashboard/computer/id/<compid>
'
,
2
)
.
route
(
'
add
'
,
'
/dashboard/instance/stop<path:instid>
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
computer
);
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instancestop
);
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/destroy<path:instid>
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
dashboard
.
instancedestroy
);
$
(
'
#panel-2
'
)
$
(
'
#panel-2
'
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
2
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
2
)
.
fail
(
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
failed
)});
.
fail
(
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
failed
)});
},
},
instancelist
:
function
(
route
)
{
instancelist
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
allinstance
);
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instancelist
);
$
.
vifib
.
instanceList
(
$
(
this
));
$
.
vifib
.
instanceList
(
$
(
this
));
},
},
instancerequest
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instancerequest
);
$
(
"
#instancerequest
"
).
submit
(
function
()
{
var
data
=
{
"
status
"
:
"
start_requested
"
,
"
slave
"
:
false
,
"
software_type
"
:
"
type_provided_by_the_software
"
,
};
$
.
extend
(
data
,
$
(
this
).
serializeObject
());
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
data
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/list
'
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
return
false
;
});
},
instance
:
function
(
instid
)
{
instance
:
function
(
instid
)
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
success
:
function
(
response
)
{
response
[
response
.
status
]
=
true
;
response
.
stop_url
=
'
#/dashboard/instance/stop
'
+
instid
;
response
.
start_url
=
'
#/dashboard/instance/start
'
+
instid
;
response
.
destroy_url
=
'
#/dashboard/instance/destroy
'
+
instid
;
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instance
,
response
);
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instance
,
response
);
}
}
});
});
},
},
computerlist
:
function
(
route
)
{
instancestop
:
function
(
instid
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
allcomputer
);
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
$
.
vifib
.
computerList
(
$
(
this
));
success
:
function
(
response
)
{
if
(
response
.
status
===
'
start_requested
'
)
{
response
.
status
=
'
stop_requested
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
},
},
computer
:
function
(
comp
id
)
{
instancestart
:
function
(
inst
id
)
{
$
(
this
).
slapos
(
'
computerInfo
'
,
comp
id
,
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
inst
id
,
{
success
:
function
(
response
)
{
success
:
function
(
response
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
computer
,
response
);
if
(
response
.
status
===
'
stop_requested
'
)
{
}
response
.
status
=
'
start_requested
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
});
}
}
,
}
}
};
};
vifib/js/pages.js
View file @
267dfdb0
...
@@ -33,19 +33,51 @@ $.vifib.login = {
...
@@ -33,19 +33,51 @@ $.vifib.login = {
}
}
$
.
vifib
.
statuscode
=
{
$
.
vifib
.
statuscode
=
{
400
:
function
(
jqxhr
,
textstatus
)
{
400
:
function
(
jqxhr
,
textstatus
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
badrequest
);
var
page
;
if
(
device
===
'
mobile
'
)
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
badrequest
);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
An error as occured
'
}));
page
.
append
(
$
.
vifib
.
footer
.
overview
);
$
.
vifib
.
changepage
(
$
(
page
));
}
else
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
badrequest
);
}
},
},
401
:
function
(
jqxhr
,
textstatus
)
{
401
:
function
(
jqxhr
,
textstatus
)
{
$
.
url
.
redirect
(
'
/login
'
);
$
.
url
.
redirect
(
'
/overview
'
);
},
},
402
:
function
(
jqxhr
,
textstatus
)
{
402
:
function
(
jqxhr
,
textstatus
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
payment
);
var
page
;
if
(
device
===
'
mobile
'
)
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
payment
);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
An error as occured
'
}));
page
.
append
(
$
.
vifib
.
footer
.
overview
);
$
.
vifib
.
changepage
(
$
(
page
));
}
else
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
payment
);
}
},
},
404
:
function
(
jqxhr
,
textstatus
)
{
404
:
function
(
jqxhr
,
textstatus
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
notfound
);
var
page
;
if
(
device
===
'
mobile
'
)
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
notfound
);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
An error as occured
'
}));
page
.
append
(
$
.
vifib
.
footer
.
overview
);
$
.
vifib
.
changepage
(
$
(
page
));
}
else
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
notfound
);
}
},
},
500
:
function
(
jqxhr
,
textstatus
)
{
500
:
function
(
jqxhr
,
textstatus
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
internalerror
);
var
page
;
if
(
device
===
'
mobile
'
)
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
internalerror
);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
An error as occured
'
}));
page
.
append
(
$
.
vifib
.
footer
.
overview
);
$
.
vifib
.
changepage
(
$
(
page
));
}
else
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
internalerror
);
}
},
},
}
}
$
.
vifib
.
softwareList
=
function
(
context
)
{
$
.
vifib
.
softwareList
=
function
(
context
)
{
...
...
vifib/js/pages.mobile.js
View file @
267dfdb0
...
@@ -9,7 +9,7 @@ $.vifib.mobile = {
...
@@ -9,7 +9,7 @@ $.vifib.mobile = {
// rendering
// rendering
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
login
);
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
login
);
// header
// header
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Vifib
'
}));
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
SlapOs
'
}));
// footer navbar
// footer navbar
page
.
append
(
$
.
vifib
.
footer
.
overview
);
page
.
append
(
$
.
vifib
.
footer
.
overview
);
// rendering
// rendering
...
@@ -33,10 +33,10 @@ $.vifib.mobile = {
...
@@ -33,10 +33,10 @@ $.vifib.mobile = {
overview
:
function
()
{
overview
:
function
()
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
library
,
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
library
,
{
most
:
[
most
:
[
{
url
:
'
#/library/software/id/fake/software_info/
k
vm
'
,
name
:
'
Kvm
'
},
{
url
:
'
#/library/software/id/fake/software_info/
K
vm
'
,
name
:
'
Kvm
'
},
],
],
newest
:
[
newest
:
[
{
url
:
'
#/library/software/id/fake/software_info/
html5
'
,
name
:
'
html5 AS
'
}
{
url
:
'
#/library/software/id/fake/software_info/
Html5
'
,
name
:
'
Html5as
'
}
]
]
});
});
// header
// header
...
@@ -63,7 +63,8 @@ $.vifib.mobile = {
...
@@ -63,7 +63,8 @@ $.vifib.mobile = {
page
.
append
(
$
.
vifib
.
footer
.
overview
);
page
.
append
(
$
.
vifib
.
footer
.
overview
);
// rendering
// rendering
$
.
vifib
.
changepage
(
$
(
page
));
$
.
vifib
.
changepage
(
$
(
page
));
}
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
});
},
},
all
:
function
()
{
all
:
function
()
{
...
@@ -97,12 +98,6 @@ $.vifib.mobile = {
...
@@ -97,12 +98,6 @@ $.vifib.mobile = {
$
(
'
body
'
)
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/destroy<path:instid>
'
,
1
)
.
route
(
'
add
'
,
'
/dashboard/instance/destroy<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
instancedestroy
);
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
instancedestroy
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/computer/list
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
computerlist
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/dashboard/computer/id/<compid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
.
computer
);
$
(
'
body
'
)
$
(
'
body
'
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
1
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
1
)
.
fail
(
$
.
vifib
.
mobile
.
nopage
);
.
fail
(
$
.
vifib
.
mobile
.
nopage
);
...
@@ -162,7 +157,7 @@ $.vifib.mobile = {
...
@@ -162,7 +157,7 @@ $.vifib.mobile = {
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
success
:
function
(
response
)
{
if
(
response
.
status
===
'
stop_requested
'
)
{
if
(
response
.
status
===
'
stop_requested
'
)
{
response
.
status
=
'
started
'
;
response
.
status
=
'
start
_request
ed
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
data
:
response
,
success
:
function
(
response
)
{
success
:
function
(
response
)
{
...
@@ -179,7 +174,7 @@ $.vifib.mobile = {
...
@@ -179,7 +174,7 @@ $.vifib.mobile = {
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
success
:
function
(
response
)
{
if
(
response
.
status
===
'
start_requested
'
)
{
if
(
response
.
status
===
'
start_requested
'
)
{
response
.
status
=
'
stop
p
ed
'
;
response
.
status
=
'
stop
_request
ed
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
data
:
response
,
success
:
function
(
response
)
{
success
:
function
(
response
)
{
...
...
vifib/js/pages.tablet.js
View file @
267dfdb0
...
@@ -10,7 +10,7 @@ $.vifib.tablet = {
...
@@ -10,7 +10,7 @@ $.vifib.tablet = {
]}
]}
]);
]);
// header
// header
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Vifib
'
}));
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
SlapOs
'
}));
// rendering
// rendering
$
.
vifib
.
changepage
(
$
(
page
));
$
.
vifib
.
changepage
(
$
(
page
));
},
},
...
@@ -47,8 +47,8 @@ $.vifib.tablet = {
...
@@ -47,8 +47,8 @@ $.vifib.tablet = {
},
},
overview
:
function
()
{
overview
:
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
library
,
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
library
,
{
most
:
[{
url
:
'
#/library/software/id/fake/software_info/
k
vm
'
,
name
:
'
Kvm
'
},],
most
:
[{
url
:
'
#/library/software/id/fake/software_info/
K
vm
'
,
name
:
'
Kvm
'
},],
newest
:
[{
url
:
'
#/library/software/id/fake/software_info/
html5
'
,
name
:
'
html5 AS
'
}]
newest
:
[{
url
:
'
#/library/software/id/fake/software_info/
Html5as
'
,
name
:
'
html5 AS
'
}]
});
});
},
},
software
:
function
(
softid
)
{
software
:
function
(
softid
)
{
...
@@ -78,7 +78,6 @@ $.vifib.tablet = {
...
@@ -78,7 +78,6 @@ $.vifib.tablet = {
{
url
:
'
#/library/
'
,
name
:
'
Library
'
},
{
url
:
'
#/library/
'
,
name
:
'
Library
'
},
{
url
:
'
http://packages.python.org/slapos.core/
'
,
name
:
'
Documentation
'
},
{
url
:
'
http://packages.python.org/slapos.core/
'
,
name
:
'
Documentation
'
},
{
url
:
'
#/dashboard/instance/list
'
,
name
:
'
Instances
'
},
{
url
:
'
#/dashboard/instance/list
'
,
name
:
'
Instances
'
},
{
url
:
'
#/dashboard/computer/list
'
,
name
:
'
Computers
'
}
]}
]}
]);
]);
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Dashboard
'
}));
page
.
prepend
(
Mustache
.
render
(
$
.
vifib
.
header
.
default
,
{
title
:
'
Dashboard
'
}));
...
@@ -90,25 +89,35 @@ $.vifib.tablet = {
...
@@ -90,25 +89,35 @@ $.vifib.tablet = {
.
route
(
'
add
'
,
'
/dashboard/instance/list
'
,
1
)
.
route
(
'
add
'
,
'
/dashboard/instance/list
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instancelist
);
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instancelist
);
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/id/<instid>
'
,
1
)
.
route
(
'
add
'
,
'
/dashboard/instance/request
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instancerequest
);
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/id<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instance
);
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instance
);
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/dashboard/computer/list
'
,
1
)
.
route
(
'
add
'
,
'
/dashboard/instance/start<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
computerlist
);
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instancestart
);
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/dashboard/instance/stop<path:instid>
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instancestop
);
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/dashboard/
computer/id/<comp
id>
'
,
1
)
.
route
(
'
add
'
,
'
/dashboard/
instance/destroy<path:inst
id>
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
computer
);
.
done
(
$
.
vifib
.
tablet
.
dashboard
.
instancedestroy
);
$
(
'
#panel-1
'
)
$
(
'
#panel-1
'
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
1
)
.
route
(
'
go
'
,
$
.
url
.
getPath
(),
1
)
.
fail
(
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
failed
)});
.
fail
(
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
failed
)});
},
},
instancelist
:
function
(
route
)
{
instancelist
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
allinstance
);
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instancelist
);
$
.
vifib
.
instanceList
(
$
(
this
));
$
.
vifib
.
instanceList
(
$
(
this
));
},
},
instance
:
function
(
instid
)
{
instance
:
function
(
instid
)
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
success
:
function
(
response
)
{
response
[
response
.
status
]
=
true
;
response
.
stop_url
=
'
#/dashboard/instance/stop
'
+
instid
;
response
.
start_url
=
'
#/dashboard/instance/start
'
+
instid
;
response
.
destroy_url
=
'
#/dashboard/instance/destroy
'
+
instid
;
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instance
,
response
);
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instance
,
response
);
},
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{
...
@@ -118,21 +127,58 @@ $.vifib.tablet = {
...
@@ -118,21 +127,58 @@ $.vifib.tablet = {
})
})
});
});
},
},
computerlist
:
function
(
route
)
{
instancerequest
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
allcomputer
);
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
instancerequest
);
$
.
vifib
.
computerList
(
$
(
this
));
$
(
"
#instancerequest
"
).
submit
(
function
()
{
var
data
=
{
"
status
"
:
"
start_requested
"
,
"
slave
"
:
false
,
"
software_type
"
:
"
type_provided_by_the_software
"
,
};
$
.
extend
(
data
,
$
(
this
).
serializeObject
());
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
data
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/list
'
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
return
false
;
});
},
},
computer
:
function
(
comp
id
)
{
instancestop
:
function
(
inst
id
)
{
$
(
this
).
slapos
(
'
computerInfo
'
,
comp
id
,
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
inst
id
,
{
success
:
function
(
response
)
{
success
:
function
(
response
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
computer
,
response
);
if
(
response
.
status
===
'
start_requested
'
)
{
response
.
status
=
'
stop_requested
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
}
},
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
404
:
function
(
jqxhr
,
textstatus
)
{
});
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
nocomputer
,
{
name
:
compid
});
},
instancestart
:
function
(
instid
)
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
if
(
response
.
status
===
'
stop_requested
'
)
{
response
.
status
=
'
start_requested
'
;
$
(
this
).
slapos
(
'
instanceRequest
'
,
{
data
:
response
,
success
:
function
(
response
)
{
$
.
url
.
redirect
(
'
/dashboard/instance/id
'
+
instid
);
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
})
}
}
})
},
statusCode
:
$
.
extend
(
false
,
$
.
vifib
.
statuscode
,
{})
});
});
}
}
,
}
}
};
};
vifib/js/panels.js
View file @
267dfdb0
...
@@ -207,7 +207,7 @@ $.vifib.panel = {
...
@@ -207,7 +207,7 @@ $.vifib.panel = {
}
}
$
.
vifib
.
header
=
{
$
.
vifib
.
header
=
{
default
:
'
<header data-role="header"><a href="#" data-icon="home" data-iconpos="notext"></a><h2>{{ title }}</h2><div id="loading" style="h"></div></header
>
'
default
:
'
<header data-role="header"><a href="#" data-icon="home" data-iconpos="notext"></a><h2>{{ title }}</h2></div></header><div id="loading" style="position: absolute; top: 20px; right: 20px;"></div
>
'
}
}
$
.
vifib
.
footer
=
{
$
.
vifib
.
footer
=
{
...
...
vifib/js/utils/fake.js
View file @
267dfdb0
...
@@ -103,10 +103,8 @@ fakeserver.respondWith("POST", '/fake/instance', function (xhr) {
...
@@ -103,10 +103,8 @@ fakeserver.respondWith("POST", '/fake/instance', function (xhr) {
inst
=
JSON
.
parse
(
xhr
.
requestBody
),
inst
=
JSON
.
parse
(
xhr
.
requestBody
),
iadd
=
{},
iadd
=
{},
ilist
=
instance_list
();
ilist
=
instance_list
();
if
(
instances
.
hasOwnProperty
(
inst
.
title
)
===
false
)
{
iadd
[
inst
.
title
]
=
inst
;
iadd
[
inst
.
title
]
=
inst
;
storejs
.
extend
(
'
instances
'
,
iadd
);
storejs
.
extend
(
'
instances
'
,
iadd
);
}
xhr
.
respond
(
201
,
{
'
Content-Type
'
:
'
application/json
'
},
JSON
.
stringify
({
xhr
.
respond
(
201
,
{
'
Content-Type
'
:
'
application/json
'
},
JSON
.
stringify
({
title
:
inst
.
title
,
title
:
inst
.
title
,
status
:
inst
.
status
status
:
inst
.
status
...
...
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