Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tv_panel
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hermod
tv_panel
Commits
5b51b961
Commit
5b51b961
authored
Feb 20, 2018
by
Aymeric Bernard
Browse files
Options
Downloads
Patches
Plain Diff
Get data from hermod.cs-campus.fr
parent
a6366815
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
front/display.js
+3
-0
3 additions, 0 deletions
front/display.js
front/index.html
+2
-2
2 additions, 2 deletions
front/index.html
server/index.js
+6
-38
6 additions, 38 deletions
server/index.js
with
11 additions
and
40 deletions
front/display.js
+
3
−
0
View file @
5b51b961
...
@@ -30,6 +30,9 @@ export default (data) => {
...
@@ -30,6 +30,9 @@ export default (data) => {
const
head
=
<
div
style
=
"
background-color:#F2F2FF; padding:10px
"
/>
;
const
head
=
<
div
style
=
"
background-color:#F2F2FF; padding:10px
"
/>
;
data
.
rows
data
.
rows
.
map
((
row
)
=>
{
.
map
((
row
)
=>
{
if
(
!
row
)
{
return
''
;
}
switch
(
row
.
type
)
{
switch
(
row
.
type
)
{
case
0
:
case
0
:
return
jsonTextToHtml
(
row
);
return
jsonTextToHtml
(
row
);
...
...
This diff is collapsed.
Click to expand it.
front/index.html
+
2
−
2
View file @
5b51b961
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
<html>
<html>
<head>
<head>
<title>
Socket IO test
</title>
<title>
Hermod TV Panel
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"style.css"
>
</head>
</head>
<body>
<body>
<p>
Date:
<p
style=
"color: #DDDDDD"
>
Date:
<span
id=
"date"
>
<span
id=
"date"
>
Not connected
Not connected
</span>
</span>
...
...
This diff is collapsed.
Click to expand it.
server/index.js
+
6
−
38
View file @
5b51b961
const
fetch
=
require
(
'
node-fetch
'
);
const
fetch
=
require
(
'
node-fetch
'
);
const
io
=
require
(
'
socket.io
'
)(
3000
);
const
io
=
require
(
'
socket.io
'
)(
3000
);
let
incr
=
0
;
io
.
of
(
'
/
'
).
on
(
'
connection
'
,
(
socket
)
=>
{
io
.
of
(
'
/
'
).
on
(
'
connection
'
,
(
socket
)
=>
{
fetch
(
'
http://hermod.cs-campus.fr/api/v1/screen/1
'
)
// Respond to date message with the date
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
socket
.
emit
(
'
message
'
,
res
));
socket
.
on
(
'
date
'
,
()
=>
{
socket
.
on
(
'
date
'
,
()
=>
{
socket
.
emit
(
'
date
'
,
{
date
:
Date
.
now
()
});
socket
.
emit
(
'
date
'
,
{
date
:
Date
.
now
()
});
});
});
// Respond to panel_data message by fetching the info from the server
socket
.
on
(
'
panel_data
'
,
()
=>
{
socket
.
on
(
'
panel_data
'
,
()
=>
{
socket
.
emit
(
fetch
(
'
http://hermod.cs-campus.fr/api/v1/screen/10
'
)
// TODO get the uid from a config
'
panel_data
'
,
.
then
(
rawRes
=>
rawRes
.
json
())
// Pour les tests, json en dur
.
then
(
res
=>
socket
.
emit
(
'
panel_data
'
,
res
))
{
.
catch
(
console
.
log
);
version
:
'
0.0.3
'
,
ttl
:
2000
,
rows
:
[
{
type
:
1
,
// 0 for "text", 1 for "text + image", 2 for "image"...
image
:
'
base_url
'
,
text
:
[
{
text
:
'
What I want to display
'
,
style
:
{
color
:
'
#440044
'
}
},
{
text
:
incr
.
toString
(),
style
:
{
color
:
'
#BB8800
'
,
fontWeight
:
'
bold
'
}
},
],
},
{
type
:
0
,
text
:
[
{
text
:
'
Some text
'
,
style
:
{
color
:
'
#440044
'
}
},
{
text
:
incr
.
toString
(),
style
:
{
color
:
'
#BB8800
'
,
fontWeight
:
'
bold
'
}
},
],
},
{
type
:
2
,
image
:
'
base_url
'
,
text
:
[{
text
:
'
Nope
'
}],
},
],
},
);
// Truc qui change juste pour voir si ça refresh
incr
+=
1
;
});
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment