diff --git a/bar-status/index.html b/bar-status/index.html
index ab0af04..f5054f5 100644
--- a/bar-status/index.html
+++ b/bar-status/index.html
@@ -77,7 +77,7 @@
- bar status
+ bar status
club mate
diff --git a/c_lab-music/index.html b/c_lab-music/index.html
index 9fe5b10..d059840 100644
--- a/c_lab-music/index.html
+++ b/c_lab-music/index.html
@@ -104,7 +104,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/c_lab/index.html b/c_lab/index.html
index 6e000ba..18f17ef 100644
--- a/c_lab/index.html
+++ b/c_lab/index.html
@@ -93,7 +93,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/elements/currentstate.js b/elements/currentstate.js
index e2f757d..acd73c9 100644
--- a/elements/currentstate.js
+++ b/elements/currentstate.js
@@ -9,6 +9,8 @@ class CurrentState extends Component {
unknownword: props.string,
status: props.boolean,
statusknown: props.boolean,
+ recent: props.boolean,
+ showrecent: props.number,
interval: props.number,
};
@@ -33,17 +35,25 @@ class CurrentState extends Component {
}
fetchData() {
- const url = `http://openmct.cbrp3.c-base.org/telemetry/latest/${this.timeseries}`;
+ const url = `http://openmct.cbrp3.c-base.org/telemetry/latest/${this.timeseries}?timestamp=true`;
fetch(url)
.then(data => data.json())
.then((data) => {
if (data === null) {
this.statusknown = false;
this.status = false;
+ this.recent = false;
return;
}
- this.status = data;
+ this.status = data.value;
this.statusknown = true;
+ const now = new Date();
+ const changed = new Date(data.timestamp);
+ if (((now - changed) / 60000) < this.showrecent) {
+ this.recent = true;
+ } else {
+ this.recent = false;
+ }
});
}
@@ -53,9 +63,34 @@ class CurrentState extends Component {
root.removeChild(root.firstChild);
}
root.appendChild(render());
+ const styles = document.createElement('style');
+ styles.appendChild(document.createTextNode(`
+ @-webkit-keyframes animaterecenton {
+ from { background-color: #73d216; }
+ to { background-color: #3465a4; }
+ }
+ .animaterecenton {
+ -webkit-animation-name: animaterecenton;
+ -webkit-animation-duration: 0.5s;
+ -webkit-animation-iteration-count:infinite;
+ -webkit-animation-direction: alternate;
+ }
+ @-webkit-keyframes animaterecentoff {
+ from { background-color: #cc0000; }
+ to { background-color: #edd400; }
+ }
+ .animaterecentoff {
+ -webkit-animation-name: animaterecentoff;
+ -webkit-animation-duration: 0.5s;
+ -webkit-animation-iteration-count:infinite;
+ -webkit-animation-direction: alternate;
+ }
+ `));
+ root.appendChild(styles);
}
render({ status, statusknown, trueword, falseword, unknownword }) {
+ console.log(this.showrecent, this.recent);
const el = document.createElement('div');
el.style.width = '100%';
el.style.height = '100%';
@@ -73,11 +108,17 @@ class CurrentState extends Component {
if (trueword) {
content = `${content} ${trueword}`;
}
+ if (this.recent) {
+ el.className = 'animaterecenton';
+ }
} else {
el.style.backgroundColor = '#cc0000';
if (falseword) {
content = `${content} ${falseword}`;
}
+ if (this.recent) {
+ el.className = 'animaterecentoff';
+ }
}
el.innerHTML = content;
return el;
diff --git a/he2/index.html b/he2/index.html
index 56cb1c0..545478a 100644
--- a/he2/index.html
+++ b/he2/index.html
@@ -101,7 +101,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/life-support/index.html b/life-support/index.html
index eef8b6e..73b78e3 100644
--- a/life-support/index.html
+++ b/life-support/index.html
@@ -101,7 +101,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/mainhall-music/index.html b/mainhall-music/index.html
index c248535..82e280d 100644
--- a/mainhall-music/index.html
+++ b/mainhall-music/index.html
@@ -104,7 +104,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/mainhall/index.html b/mainhall/index.html
index ada9855..eed7564 100644
--- a/mainhall/index.html
+++ b/mainhall/index.html
@@ -92,7 +92,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/nerdarea-music/index.html b/nerdarea-music/index.html
index bf9dc36..999e9da 100644
--- a/nerdarea-music/index.html
+++ b/nerdarea-music/index.html
@@ -110,7 +110,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/nerdarea/index.html b/nerdarea/index.html
index 5c516d1..437d6d1 100644
--- a/nerdarea/index.html
+++ b/nerdarea/index.html
@@ -92,7 +92,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/robolab-music/index.html b/robolab-music/index.html
index da58a9a..a105567 100644
--- a/robolab-music/index.html
+++ b/robolab-music/index.html
@@ -110,7 +110,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/robolab/index.html b/robolab/index.html
index 2cc6ba8..db3d00b 100644
--- a/robolab/index.html
+++ b/robolab/index.html
@@ -85,7 +85,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/soundlab/index.html b/soundlab/index.html
index ec2768c..20c3044 100644
--- a/soundlab/index.html
+++ b/soundlab/index.html
@@ -96,7 +96,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/weltenbaulab-music/index.html b/weltenbaulab-music/index.html
index c1b3274..62189d0 100644
--- a/weltenbaulab-music/index.html
+++ b/weltenbaulab-music/index.html
@@ -104,7 +104,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/weltenbaulab/index.html b/weltenbaulab/index.html
index 0c223a6..17d1780 100644
--- a/weltenbaulab/index.html
+++ b/weltenbaulab/index.html
@@ -96,7 +96,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/workshop-music/index.html b/workshop-music/index.html
index 362f423..6c9643a 100644
--- a/workshop-music/index.html
+++ b/workshop-music/index.html
@@ -126,7 +126,7 @@
- bar
+ bar
berliner 1
berliner 2
diff --git a/workshop/index.html b/workshop/index.html
index 0e9791d..e6a439d 100644
--- a/workshop/index.html
+++ b/workshop/index.html
@@ -103,7 +103,7 @@
- bar
+ bar
berliner 1
berliner 2