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
Jérome Perrin
slapos.core
Commits
11f65d61
Commit
11f65d61
authored
Jul 18, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First stable demo version (Library)
Only authentication by facebook with mobile format works
parent
c46e6e98
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
98 additions
and
70 deletions
+98
-70
vifib/Makefile
vifib/Makefile
+9
-1
vifib/js/jquery.slapos.js
vifib/js/jquery.slapos.js
+10
-9
vifib/js/main.js
vifib/js/main.js
+21
-7
vifib/js/pages.desktop.js
vifib/js/pages.desktop.js
+4
-5
vifib/js/pages.js
vifib/js/pages.js
+24
-17
vifib/js/pages.mobile.js
vifib/js/pages.mobile.js
+3
-3
vifib/js/pages.tablet.js
vifib/js/pages.tablet.js
+3
-3
vifib/js/panels.js
vifib/js/panels.js
+1
-6
vifib/js/render.js
vifib/js/render.js
+2
-1
vifib/js/utils/fake.js
vifib/js/utils/fake.js
+21
-18
No files found.
vifib/Makefile
View file @
11f65d61
...
...
@@ -10,12 +10,20 @@ JSDIR = js
FINALJS
=
vifib.js
FINALCSS
=
vifib.css
all
:
test
release
all
:
dev
release
#########################################
# Dev environment
#########################################
# Emulate server responses with sinonjs
fake
:
dev ${DEVDIR}/js/fake.js
cat
$(CATJSFILES)
${DEVDIR}
/js/fake.js
>
${DEVDIR}
/
$(FINALJS)
${DEVDIR}/js/fake.js
:
js/utils/fake.js
@
mkdir
-p
$
(
@D
)
cp
$<
$@
# Sort files for concatenation
CATJSFILES
=
${DEVDIR}
/lib/jquery.js
${DEVDIR}
/lib/sinon.js
${DEVDIR}
/lib/mustache.js
${DEVDIR}
/lib/spin.js
${DEVDIR}
/lib/modernizr.js
${DEVDIR}
/lib/swipe.js
${DEVDIR}
/js/jquery.slapos.js
${DEVDIR}
/js/init.js
${DEVDIR}
/lib/jquery-mobile.js
${DEVDIR}
/js/url.js
${DEVDIR}
/js/route.js
${DEVDIR}
/js/main.js
${DEVDIR}
/js/render.js
${DEVDIR}
/js/panels.js
${DEVDIR}
/js/pages.js
${DEVDIR}
/js/pages.mobile.js
${DEVDIR}
/js/pages.tablet.js
${DEVDIR}
/js/pages.desktop.js
...
...
vifib/js/jquery.slapos.js
View file @
11f65d61
...
...
@@ -121,17 +121,18 @@
return
$
(
this
).
slapos
(
'
request
'
,
'
GET
'
,
''
,
args
);
},
//
softwareList: function (args) {
//return $(this).slapos('request', '
', args);
//
},
softwareList
:
function
(
args
)
{
return
$
(
this
).
slapos
(
'
request
'
,
'
GET
'
,
'
/software
'
,
args
);
},
//softwareInfo: function (url, args) {
//return $(this).slapos('request', '', args);
//},
softwareInfo
:
function
(
url
,
args
)
{
$
.
extend
(
args
,
{
url
:
url
});
return
$
(
this
).
slapos
(
'
request
'
,
'
GET
'
,
''
,
args
);
},
//
computerList: function (args) {
//
return $(this).slapos('request', '', args);
//
},
computerList
:
function
(
args
)
{
return
$
(
this
).
slapos
(
'
request
'
,
''
,
args
);
},
computerInfo
:
function
(
url
,
args
)
{
$
.
extend
(
args
,
{
url
:
url
});
...
...
vifib/js/main.js
View file @
11f65d61
'
use strict
'
;
var
getDevice
=
function
(
w
)
{
return
'
mobile
'
;
if
(
w
<
600
)
{
if
(
w
<
500
)
{
return
'
mobile
'
;
}
if
(
w
<
1281
)
{
if
(
w
<
900
)
{
return
'
tablet
'
;
}
return
'
desktop
'
;
...
...
@@ -15,9 +14,15 @@ var body = $("body");
$
.
vifib
.
devices
=
{
"
mobile
"
:
function
(
url
)
{
if
(
$
.
vifib
.
isauthenticated
())
{
$
(
'
body
'
)
.
route
(
'
add
'
,
''
)
.
done
(
$
.
vifib
.
mobile
.
dashboard
);
}
else
{
$
(
'
body
'
)
.
route
(
'
add
'
,
''
)
.
done
(
$
.
vifib
.
mobile
.
overview
);
}
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/login/facebook
'
)
.
done
(
$
.
vifib
.
login
.
facebook
);
...
...
@@ -59,7 +64,16 @@ $.vifib.devices = {
}
$
.
vifib
.
isauthenticated
=
function
()
{
return
true
;
var
token_type
=
$
(
document
).
slapos
(
'
store
'
,
'
token_type
'
);
if
(
$
(
document
).
slapos
(
'
access_token
'
)
===
undefined
||
token_type
===
undefined
)
{
return
false
;
}
if
(
token_type
===
'
Google
'
)
{
}
else
if
(
token_type
===
'
Facebook
'
)
{
}
return
false
;
}
$
.
vifib
.
startrouter
=
function
()
{
...
...
vifib/js/pages.desktop.js
View file @
11f65d61
...
...
@@ -32,7 +32,7 @@ $.vifib.desktop = {
},
overview
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
carousel
);
if
(
Modernizr
.
csstransforms
)
{
if
(
Modernizr
.
csstransforms
)
{
window
.
mySwipe
=
new
Swipe
(
document
.
getElementById
(
'
slider
'
),
{
speed
:
800
,
auto
:
4000
,
...
...
@@ -40,7 +40,6 @@ $.vifib.desktop = {
});
}
$
.
vifib
.
replacepanel
(
$
(
'
#panel-2
'
),
$
.
vifib
.
panel
.
login
);
window
.
mySwipe
.
begin
();
},
library
:
{
dispatch
:
function
(
route
)
{
...
...
@@ -58,7 +57,7 @@ $.vifib.desktop = {
.
route
(
'
add
'
,
'
/library/
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
library
.
overview
);
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/library/software/
<
softid>
'
,
2
)
.
route
(
'
add
'
,
'
/library/software/
id<path:
softid>
'
,
2
)
.
done
(
$
.
vifib
.
desktop
.
library
.
software
);
$
(
'
#panel-2
'
)
.
route
(
'
add
'
,
'
/library/all
'
,
2
)
...
...
@@ -70,10 +69,10 @@ $.vifib.desktop = {
overview
:
function
(
route
)
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
library
,
{
most
:
[
{
url
:
'
#/library/software/kvm
'
,
name
:
'
Kvm
'
},
{
url
:
'
#/library/software/
id/fake/software_info/
kvm
'
,
name
:
'
Kvm
'
},
],
newest
:
[
{
url
:
'
#/library/software/html5
'
,
name
:
'
html5 AS
'
}
{
url
:
'
#/library/software/
id/fake/software_info/
html5
'
,
name
:
'
html5 AS
'
}
]
});
},
...
...
vifib/js/pages.js
View file @
11f65d61
...
...
@@ -17,7 +17,6 @@ $.vifib.login = {
'
&redirect_uri=
'
+
encodeURIComponent
(
redirect
)
+
'
&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email++https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
'
+
'
&response_type=token
'
;
console
.
log
(
ggurl
);
$
(
document
).
slapos
(
'
store
'
,
'
token_type
'
,
'
Google
'
);
window
.
location
.
href
=
ggurl
;
}
...
...
@@ -54,19 +53,37 @@ $.vifib.softwareList = function (context) {
});
});
}
$
.
vifib
.
instanceList
=
function
(
context
)
{
var
list
;
return
context
.
each
(
function
()
{
list
=
$
(
this
).
find
(
'
ul
'
);
$
(
this
).
slapos
(
'
instanceList
'
,
{
success
:
function
(
response
)
{
$
.
each
(
response
.
list
,
function
(
index
,
inst
)
{
var
row
=
$
.
vifib
.
fillRowInstance
(
$
(
'
<li></li>
'
),
inst
);
list
.
append
(
row
);
});
$
.
when
(
$
.
vifib
.
fillRowInstance
(
list
,
$
(
'
<li></li>
'
),
response
.
list
[
0
])
).
then
(
function
()
{
list
.
listview
(
'
refresh
'
);
}
});
//$.when.apply($(this), $.map(response.list, function (inst) {
//$.vifib.fillRowInstance(list, $('<li></li>'), inst);
//})).done(function (a, b, c) {
//console.log(arguments);
//list.listview('refresh');
//});
},
});
});
}
$
.
vifib
.
fillRowInstance
=
function
(
list
,
row
,
instid
)
{
return
row
.
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
$
.
extend
(
response
,
{
insturl
:
'
#/dashboard/instance/id
'
+
instid
});
$
(
this
).
html
(
Mustache
.
render
(
$
.
vifib
.
panel
.
rowinstance
,
response
));
},
complete
:
function
(
jqxhr
,
textstatus
)
{
list
.
append
(
$
(
this
));
}
});
}
$
.
vifib
.
computerList
=
function
(
context
)
{
...
...
@@ -88,22 +105,12 @@ $.vifib.fillRowSoftware = function (context, softid) {
return
context
.
each
(
function
()
{
$
(
this
).
slapos
(
'
softwareInfo
'
,
softid
,
{
success
:
function
(
response
)
{
$
.
extend
(
response
,
{
softurl
:
'
#/library/software/
'
+
softid
});
$
.
extend
(
response
,
{
softurl
:
'
#/library/software/
id
'
+
softid
});
$
(
this
).
html
(
Mustache
.
render
(
$
.
vifib
.
panel
.
rowsoftware
,
response
));
}
});
})
}
$
.
vifib
.
fillRowInstance
=
function
(
context
,
instid
)
{
return
context
.
each
(
function
()
{
$
(
this
).
slapos
(
'
instanceInfo
'
,
instid
,
{
success
:
function
(
response
)
{
$
.
extend
(
response
,
{
insturl
:
'
#/dashboard/instance/id
'
+
instid
});
$
(
this
).
html
(
Mustache
.
render
(
$
.
vifib
.
panel
.
rowinstance
,
response
));
}
});
})
}
$
.
vifib
.
fillRowComputer
=
function
(
context
,
compid
)
{
return
context
.
each
(
function
()
{
$
(
this
).
slapos
(
'
computerInfo
'
,
compid
,
{
...
...
vifib/js/pages.mobile.js
View file @
11f65d61
...
...
@@ -21,7 +21,7 @@ $.vifib.mobile = {
.
route
(
'
add
'
,
'
/library/
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
library
.
overview
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/library/software/
<
softid>
'
,
1
)
.
route
(
'
add
'
,
'
/library/software/
id<path:
softid>
'
,
1
)
.
done
(
$
.
vifib
.
mobile
.
library
.
software
);
$
(
'
body
'
)
.
route
(
'
add
'
,
'
/library/all
'
,
1
)
...
...
@@ -33,10 +33,10 @@ $.vifib.mobile = {
overview
:
function
()
{
page
=
$
.
vifib
.
onepanel
(
$
.
vifib
.
panel
.
library
,
{
most
:
[
{
url
:
'
#/library/software/kvm
'
,
name
:
'
Kvm
'
},
{
url
:
'
#/library/software/
id/fake/software_info/
kvm
'
,
name
:
'
Kvm
'
},
],
newest
:
[
{
url
:
'
#/library/software/html5
'
,
name
:
'
html5 AS
'
}
{
url
:
'
#/library/software/
id/fake/software_info/
html5
'
,
name
:
'
html5 AS
'
}
]
});
// header
...
...
vifib/js/pages.tablet.js
View file @
11f65d61
...
...
@@ -36,7 +36,7 @@ $.vifib.tablet = {
.
route
(
'
add
'
,
'
/library/
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
library
.
overview
);
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/library/software/
<
softid>
'
,
1
)
.
route
(
'
add
'
,
'
/library/software/
id<path:
softid>
'
,
1
)
.
done
(
$
.
vifib
.
tablet
.
library
.
software
);
$
(
'
#panel-1
'
)
.
route
(
'
add
'
,
'
/library/all
'
,
1
)
...
...
@@ -47,8 +47,8 @@ $.vifib.tablet = {
},
overview
:
function
()
{
$
.
vifib
.
replacepanel
(
$
(
this
),
$
.
vifib
.
panel
.
library
,
{
most
:
[{
url
:
'
#/library/software/kvm
'
,
name
:
'
Kvm
'
},],
newest
:
[{
url
:
'
#/library/software/html5
'
,
name
:
'
html5 AS
'
}]
most
:
[{
url
:
'
#/library/software/
id/fake/software_info/
kvm
'
,
name
:
'
Kvm
'
},],
newest
:
[{
url
:
'
#/library/software/
id/fake/software_info/
html5
'
,
name
:
'
html5 AS
'
}]
});
},
software
:
function
(
softid
)
{
...
...
vifib/js/panels.js
View file @
11f65d61
...
...
@@ -142,12 +142,7 @@ $.vifib.panel = {
'
</ul>
'
+
'
</article>
'
,
rowinstance
:
'
<a href="{{ insturl }}">
'
+
'
{{# thumb_url }}
'
+
'
<img src="{{ thumb_url }}">
'
+
'
{{/ thumb_url }}
'
+
'
{{ instance_id }}
'
+
'
</a>
'
,
'
<a href="{{ insturl }}">{{ title }}</a>
'
,
computer
:
'
<article>
'
+
'
<h2>{{ computer_id }}</h2>
'
+
...
...
vifib/js/render.js
View file @
11f65d61
...
...
@@ -19,7 +19,8 @@ $.vifib.threepanel = function (panels, data) {
}
$
.
vifib
.
replacepanel
=
function
(
context
,
panel
,
data
)
{
context
.
html
(
Mustache
.
render
(
panel
,
data
)).
trigger
(
'
pagecreate
'
);
context
.
html
(
Mustache
.
render
(
panel
,
data
));
$
(
'
:jqmData(role=page)
'
).
trigger
(
'
pagecreate
'
);
}
$
.
vifib
.
makecontent
=
function
(
panels
,
data
)
{
...
...
vifib/js/utils/fake.js
View file @
11f65d61
...
...
@@ -14,7 +14,7 @@ var comp = {
};
var
inst
=
{
instance_id
:
"
INST-1
"
,
title
:
"
INST-1
"
,
status
:
"
stop_requested
"
,
software_release
:
"
http://example.com/example.cfg
"
,
software_type
:
"
type_provided_by_the_software
"
,
...
...
@@ -59,7 +59,8 @@ var software_list = {
var
instance_list
=
{
list
:
[
'
/fake/instance_info/kvm
'
'
/fake/instance_info/kvm
'
,
'
/fake/instance_info/kvm
'
,
]
};
...
...
@@ -110,3 +111,5 @@ $.ajax = function(url, options){
fakeserver
.
respond
();
return
result
;
};
$
(
document
).
slapos
(
'
store
'
,
'
host
'
,
'
/fake
'
);
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