Skip to content

Commit 6f59e98

Browse files
committed
Add timeline to UI
1 parent c287ab7 commit 6f59e98

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

ui/vue.html

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<head>
44
<title>{{.Title}}</title>
55
<meta charset="utf-8">
6-
<!-- <meta http-equiv="refresh" content="5"> -->
76
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
87
<link rel="shortcut icon" type="image/png" href="https://kubernetes.io/images/favicon.png">
9-
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet">
10-
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet">
8+
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
9+
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
10+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet">
1111
<style>
1212
[v-cloak] {
1313
display: none;
@@ -19,7 +19,7 @@
1919
<v-app dark>
2020
<v-content>
2121
<section>
22-
<v-parallax src="#" height="600" :class="info.color">
22+
<v-parallax id="parallax-hero" src="#" :class="info.color">
2323
<v-layout
2424
column
2525
align-center
@@ -41,6 +41,14 @@ <h1 class="white--text mb-2 display-1 text-xs-center">${ info.message }</h1>
4141
</v-badge>
4242
Ping
4343
</v-btn>
44+
45+
<template>
46+
<v-timeline>
47+
<v-timeline-item :color="tlColor1"><h3>${ tlName1 }</h3></v-timeline-item>
48+
<v-timeline-item :color="tlColor2"><h3 slot="opposite">${ tlName2 }</h3></v-timeline-item>
49+
</v-timeline>
50+
</template>
51+
4452
</v-layout>
4553
</v-parallax>
4654
</section>
@@ -49,7 +57,7 @@ <h1 class="white--text mb-2 display-1 text-xs-center">${ info.message }</h1>
4957
<v-flex xs12>
5058
<div class="white--text ml-3">
5159
Powered
52-
by <a class="white--text" href="https://github.com/stefanprodan/k8s-podinfo" target="_blank">podinfo</a>
60+
by <a class="white--text" href="https://github.com/stefanprodan/podinfo" target="_blank">podinfo</a>
5361
version ${ info.version } revision ${ info.revision }
5462
</div>
5563
</v-flex>
@@ -71,9 +79,17 @@ <h1 class="white--text mb-2 display-1 text-xs-center">${ info.message }</h1>
7179
info: {},
7280
timer: '',
7381
color: '',
74-
pings: 0
82+
pings: 0,
83+
calls: 0,
84+
tlName1: '',
85+
tlColor1: 'grey',
86+
tlName2: '',
87+
tlColor2: 'grey',
7588
}
7689
},
90+
mounted: function() {
91+
document.getElementById('parallax-hero').style.height = '100vh'
92+
},
7793
created: function() {
7894
this.getInfo();
7995
this.timer = setInterval(this.getInfo, 3000)
@@ -85,18 +101,31 @@ <h1 class="white--text mb-2 display-1 text-xs-center">${ info.message }</h1>
85101
xhr.open('GET', "api/info")
86102
xhr.onload = function () {
87103
data = JSON.parse(xhr.responseText)
88-
// reload page when the version changes
89104
if (self.info.version) {
90105
if (self.info.version != data.version) {
91106
console.log("New version", data.version)
92-
//window.location.reload()
93107
}
94108
}
95109
self.info = data
96110
self.info.color = parseInt(data.version.split('.').reverse()[0], 10) === 0
97111
? 'blue'
98112
: 'green'
99113
document.title = data.hostname
114+
115+
if ((self.calls % 2) === 0) {
116+
self.tlColor1 = parseInt(data.version.split('.').reverse()[0], 10) === 0
117+
? 'blue'
118+
: 'green'
119+
self.tlColor2 = 'grey'
120+
self.tlName1 = data.version
121+
} else {
122+
self.tlColor1 = 'grey'
123+
self.tlColor2 = parseInt(data.version.split('.').reverse()[0], 10) === 0
124+
? 'blue'
125+
: 'green'
126+
self.tlName2 = data.version
127+
}
128+
self.calls++
100129
}
101130
xhr.onerror = function() {
102131
console.log(xhr.responseText || 'Network request failed')

0 commit comments

Comments
 (0)