|
1 | 1 | <template>
|
2 | 2 | <main class="home section">
|
3 |
| - <section class="container panel"> |
4 |
| - <p class="panel-heading ">🚧 Work in progress...</p> |
5 |
| - <div class="panel-block"> |
6 |
| - <div> |
7 |
| - <p> |
8 |
| - In the meantime, you can review your current configuration by using |
9 |
| - the <a href="/api/rawdata">/api/rawdata</a> endpoint. |
10 |
| - </p> |
11 |
| - <p> |
12 |
| - Also, please keep your <i class="fa fa-eye" /> on our |
13 |
| - <a href="https://docs.traefik.io/v2.0/operations/dashboard/" |
14 |
| - >documentation</a |
15 |
| - > |
16 |
| - to stay informed |
17 |
| - </p> |
| 3 | + <section class="container hero is-info"> |
| 4 | + <div class="hero-body"> |
| 5 | + <div class="container"> |
| 6 | + <h1 class="title"> |
| 7 | + 🚧 Work in progress... |
| 8 | + </h1> |
| 9 | + <h2 class="subtitle"> |
| 10 | + <p> |
| 11 | + In the meantime, you can review your current configuration by |
| 12 | + using the |
| 13 | + <a href="/api/rawdata" |
| 14 | + >/api/rawdata <i class="fas fa-external-link-alt" |
| 15 | + /></a> |
| 16 | + endpoint. |
| 17 | + </p> |
| 18 | + <p> |
| 19 | + Also, please keep your <i class="fa fa-eye" /> on our |
| 20 | + <a href="https://docs.traefik.io/v2.0/operations/dashboard/" |
| 21 | + >documentation<i class="fas fa-external-link-alt" |
| 22 | + /></a> |
| 23 | + to stay informed |
| 24 | + </p> |
| 25 | + </h2> |
18 | 26 | </div>
|
19 | 27 | </div>
|
20 | 28 | </section>
|
21 | 29 |
|
22 |
| - <section class="container panel" v-if="entrypoints.length"> |
23 |
| - <p class="panel-heading ">Entrypoints</p> |
24 |
| - <div class="panel-block"> |
| 30 | + <section class="container" v-if="entrypoints.length"> |
| 31 | + <p class="title is-4">Entrypoints</p> |
| 32 | + <div class="tile is-child box columns"> |
25 | 33 | <nav class="level" :style="{ flex: '1 1' }">
|
26 | 34 | <div
|
27 | 35 | class="level-item has-text-centered"
|
|
39 | 47 |
|
40 | 48 | <section class="container" v-if="overview.http">
|
41 | 49 | <p class="title is-4">HTTP</p>
|
42 |
| - <div class="tile is-child box columns is-height-limited"> |
| 50 | + <div class="tile is-child box columns"> |
43 | 51 | <div class="column is-4">
|
44 |
| - <canvas id="http-routers" /> |
| 52 | + <EntityStateDoughnut |
| 53 | + :entity="overview.http.routers" |
| 54 | + title="Routers" |
| 55 | + /> |
45 | 56 | </div>
|
46 | 57 | <div class="column is-4">
|
47 |
| - <canvas id="http-middlewares" /> |
| 58 | + <EntityStateDoughnut |
| 59 | + :entity="overview.http.middlewares" |
| 60 | + title="Middlewares" |
| 61 | + /> |
48 | 62 | </div>
|
49 | 63 | <div class="column is-4">
|
50 |
| - <canvas id="http-services" /> |
| 64 | + <EntityStateDoughnut |
| 65 | + :entity="overview.http.services" |
| 66 | + title="Services" |
| 67 | + /> |
51 | 68 | </div>
|
52 | 69 | </div>
|
53 | 70 | </section>
|
54 | 71 |
|
55 | 72 | <section class="container" v-if="overview.tcp">
|
56 | 73 | <p class="title is-4">TCP</p>
|
57 |
| - <div class="tile is-child box columns is-height-limited"> |
| 74 | + <div class="tile is-child box columns"> |
58 | 75 | <div class="column is-4">
|
59 |
| - <canvas id="tcp-routers" /> |
| 76 | + <EntityStateDoughnut :entity="overview.tcp.routers" title="Routers" /> |
60 | 77 | </div>
|
61 | 78 | <div class="column is-4">
|
62 |
| - <canvas id="tcp-services" /> |
| 79 | + <EntityStateDoughnut |
| 80 | + :entity="overview.tcp.services" |
| 81 | + title="Services" |
| 82 | + /> |
63 | 83 | </div>
|
64 | 84 | </div>
|
65 | 85 | </section>
|
66 | 86 |
|
67 |
| - <section class="container panel"> |
68 |
| - <p class="panel-heading">Features</p> |
69 |
| - <div class="panel-block"> |
| 87 | + <section class="container"> |
| 88 | + <p class="title is-4">Features</p> |
| 89 | + <div class="tile is-child box columns"> |
70 | 90 | <div class="tile is-ancestor">
|
71 |
| - <div |
72 |
| - class="tile is-parent" |
| 91 | + <Tile |
73 | 92 | v-for="(feature, key) of overview.features"
|
74 | 93 | :key="key"
|
75 |
| - > |
76 |
| - <div |
77 |
| - class="tile is-child notification" |
78 |
| - :class="{ 'is-success': feature, 'is-danger': !feature }" |
79 |
| - > |
80 |
| - <p class="title">{{ key }}</p> |
81 |
| - </div> |
82 |
| - </div> |
| 94 | + :title="key" |
| 95 | + :modifier="{ 'is-success': feature, 'is-danger': !feature }" |
| 96 | + /> |
| 97 | + </div> |
| 98 | + </div> |
| 99 | + </section> |
| 100 | + |
| 101 | + <section class="container"> |
| 102 | + <p class="title is-4">Providers</p> |
| 103 | + <div class="tile is-child box columns"> |
| 104 | + <div class="tile is-ancestor"> |
| 105 | + <Tile |
| 106 | + v-for="provider of overview.providers" |
| 107 | + :key="provider" |
| 108 | + :title="provider" |
| 109 | + :modifier="{ 'is-info': provider, 'is-3': provider }" |
| 110 | + /> |
83 | 111 | </div>
|
84 | 112 | </div>
|
85 | 113 | </section>
|
86 | 114 | </main>
|
87 | 115 | </template>
|
88 | 116 |
|
89 | 117 | <script>
|
90 |
| -import Chart from "chart.js"; |
91 |
| -
|
92 |
| -Chart.plugins.register({ |
93 |
| - afterDraw: function(chart) { |
94 |
| - if (chart.data.datasets[0].data.reduce((acc, it) => acc + it, 0) === 0) { |
95 |
| - var ctx = chart.chart.ctx; |
96 |
| - var width = chart.chart.width; |
97 |
| - var height = chart.chart.height |
98 |
| - chart.clear(); |
99 |
| -
|
100 |
| - ctx.save(); |
101 |
| - ctx.textAlign = 'center'; |
102 |
| - ctx.textBaseline = 'middle'; |
103 |
| - ctx.font = "16px normal 'Helvetica Nueue'"; |
104 |
| - ctx.fillText(`No ${chart.options.title.text}`, width / 2, height / 2); |
105 |
| - ctx.restore(); |
106 |
| - } |
107 |
| - } |
108 |
| -}); |
| 118 | +import Tile from "../components/Tile"; |
| 119 | +import EntityStateDoughnut from "../components/EntityStateDoughnut"; |
109 | 120 |
|
110 | 121 | export default {
|
111 | 122 | name: "home",
|
| 123 | + components: { |
| 124 | + Tile, |
| 125 | + EntityStateDoughnut |
| 126 | + }, |
112 | 127 | data: () => ({
|
113 | 128 | entrypoints: [],
|
114 | 129 | overview: {
|
115 |
| - features: [] |
116 |
| - }, |
117 |
| - charts: { |
118 |
| - http: { |
119 |
| - routers: null, |
120 |
| - middlewares: null, |
121 |
| - services: null |
122 |
| - }, |
123 |
| - tcp: { |
124 |
| - routers: null, |
125 |
| - services: null |
126 |
| - } |
| 130 | + features: [], |
| 131 | + providers: [] |
127 | 132 | },
|
128 | 133 | interval: null
|
129 | 134 | }),
|
130 | 135 | methods: {
|
131 |
| - buildDoughnutChart( |
132 |
| - selector, |
133 |
| - entity = { errors: 2, warnings: 2, total: 6 }, |
134 |
| - name |
135 |
| - ) { |
136 |
| - return new Chart(this.$el.querySelector(selector), { |
137 |
| - type: "doughnut", |
138 |
| - data: { |
139 |
| - datasets: [ |
140 |
| - { |
141 |
| - data: [ |
142 |
| - entity.errors, |
143 |
| - entity.warnings, |
144 |
| - entity.total - (entity.errors + entity.warnings) |
145 |
| - ], |
146 |
| - backgroundColor: [ |
147 |
| - "hsl(348, 100%, 61%)", |
148 |
| - "hsl(48, 100%, 67%)", |
149 |
| - "hsl(141, 71%, 48%)" |
150 |
| - ] |
151 |
| - } |
152 |
| - ], |
153 |
| - labels: ["errors", "warnings", "success"] |
154 |
| - }, |
155 |
| - options: { |
156 |
| - title: { |
157 |
| - display: true, |
158 |
| - text: name |
159 |
| - }, |
160 |
| - legend: { |
161 |
| - display: false |
162 |
| - } |
163 |
| - } |
164 |
| - }); |
165 |
| - }, |
166 | 136 | fetchOverview() {
|
167 | 137 | return fetch("/api/overview")
|
168 | 138 | .then(response => response.json())
|
169 |
| - .then(response => (this.overview = response)) |
170 |
| - .then(() => { |
171 |
| - this.charts = { |
172 |
| - http: { |
173 |
| - routers: this.buildDoughnutChart( |
174 |
| - "#http-routers", |
175 |
| - this.overview.http.routers, |
176 |
| - "Routers" |
177 |
| - ), |
178 |
| - middlewares: this.buildDoughnutChart( |
179 |
| - "#http-middlewares", |
180 |
| - this.overview.http.middlewares, |
181 |
| - "Middlewares" |
182 |
| - ), |
183 |
| - services: this.buildDoughnutChart( |
184 |
| - "#http-services", |
185 |
| - this.overview.http.services, |
186 |
| - "Services" |
187 |
| - ) |
188 |
| - }, |
189 |
| - tcp: { |
190 |
| - routers: this.buildDoughnutChart( |
191 |
| - "#tcp-routers", |
192 |
| - this.overview.tcp.routers, |
193 |
| - "Routers" |
194 |
| - ), |
195 |
| - services: this.buildDoughnutChart( |
196 |
| - "#tcp-services", |
197 |
| - this.overview.tcp.services, |
198 |
| - "Services" |
199 |
| - ) |
200 |
| - } |
201 |
| - }; |
202 |
| - }); |
| 139 | + .then(response => (this.overview = response)); |
203 | 140 | },
|
204 | 141 | fetchEntrypoints() {
|
205 | 142 | return fetch("/api/entrypoints")
|
|
0 commit comments