Mercurial > bottledash
comparison views/bottledash_view.tpl @ 28:af280057d5fa
enhanced the design
author | sean |
---|---|
date | Fri, 14 Aug 2015 13:11:34 +0200 |
parents | 05e5441c5160 |
children | a43fa30655e9 |
comparison
equal
deleted
inserted
replaced
27:030352fbf3ab | 28:af280057d5fa |
---|---|
25 "Freitag", "Samstag", "Sonntag")[today.weekday()] | 25 "Freitag", "Samstag", "Sonntag")[today.weekday()] |
26 month_name = ("Januar", "Februar", "März", "Aprill", "Mai", | 26 month_name = ("Januar", "Februar", "März", "Aprill", "Mai", |
27 "Juni", "Juli", "August", "September", "Oktober", | 27 "Juni", "Juli", "August", "September", "Oktober", |
28 "November", "Dezember")[today.month-1] | 28 "November", "Dezember")[today.month-1] |
29 | 29 |
30 number_of_rows = 2 | 30 number_of_rows = settings["rows"] |
31 | 31 |
32 ################# | 32 ################# |
33 # viewport size # | 33 # viewport size # |
34 ################# | 34 ################# |
35 vp_size = "17px" | 35 vp_size = "4vw" |
36 | |
36 #if len(tiles) <= 2: | 37 #if len(tiles) <= 2: |
37 # vp_size = "6vw" | 38 # vp_size = "6vw" |
38 #elif len(tiles) >2 and len(tiles) <=4 : | 39 #elif len(tiles) >2 and len(tiles) <=4 : |
39 # vp_size = "5vw" | 40 # vp_size = "5vw" |
40 #elif len(tiles) >4 and len(tiles) <=6 : | 41 #elif len(tiles) >4 and len(tiles) <=6 : |
57 height: 100%; | 58 height: 100%; |
58 %end | 59 %end |
59 } | 60 } |
60 | 61 |
61 .statusmon{ | 62 .statusmon{ |
62 color: white; | |
63 font-size: {{vp_size}}; | 63 font-size: {{vp_size}}; |
64 } | 64 } |
65 | 65 |
66 .chart{ | 66 .chart{ |
67 font-size: {{vp_size}}; | 67 font-size: {{vp_size}}; |
78 var global_height; | 78 var global_height; |
79 var tile_width; | 79 var tile_width; |
80 var tile_height; | 80 var tile_height; |
81 | 81 |
82 var tiles = document.getElementsByClassName("tile"); | 82 var tiles = document.getElementsByClassName("tile"); |
83 var border_width = 1; | 83 var border_width = 2 ; |
84 var space_between_tiles = 8; | 84 var space_between_tiles = 8; |
85 | 85 |
86 var mon_tile_ips = []; | 86 var mon_tile_ips = []; |
87 | 87 |
88 | 88 |
138 } | 138 } |
139 | 139 |
140 function check_server_state_loop() { | 140 function check_server_state_loop() { |
141 for (var i = 0; i < mon_tile_ips.length; i++) { | 141 for (var i = 0; i < mon_tile_ips.length; i++) { |
142 var state = check_server_state(mon_tile_ips[i]) | 142 var state = check_server_state(mon_tile_ips[i]) |
143 if (state == "UPALERT" || state == "UP") { | 143 if (state == "UPALERT" || state == "UP" || state == "wait") { |
144 set_mon_tile_status(mon_tile_ips[i], "active") | 144 set_mon_tile_status(mon_tile_ips[i], "active") |
145 } else { | 145 } else { |
146 set_mon_tile_status(mon_tile_ips[i], "dead") | 146 set_mon_tile_status(mon_tile_ips[i], "dead") |
147 } | 147 } |
148 } | 148 } |
171 for tile in tiles : | 171 for tile in tiles : |
172 type = "" | 172 type = "" |
173 tile_content = "" | 173 tile_content = "" |
174 status = "" | 174 status = "" |
175 uid = "" | 175 uid = "" |
176 add_style = "" | |
176 | 177 |
177 if tile["type"] == "mon" : | 178 if tile["type"] == "mon" : |
178 type = "statusmon" | 179 type = "statusmon" |
179 tile_content = tile["source"] | |
180 uid = tile["source"] | 180 uid = tile["source"] |
181 if tile["status"] == "up" : | 181 status = "unclear" |
182 status = "active" | 182 add_style = "display:table" |
183 else : | 183 |
184 status = "dead" | 184 tile_content = """ |
185 end | 185 <div class = "tilecontent"> |
186 {} | |
187 </div> | |
188 """.format(tile["source"]) | |
186 | 189 |
187 elif tile["type"] == "web_view" : | 190 elif tile["type"] == "web_view" : |
188 type = tile["type"] | 191 type = tile["type"] |
189 uid = tile["div_name"] | 192 uid = tile["div_name"] |
190 tile_content = web_view.make_chart(tile["script"], tile["div_name"]) | 193 tile_content = web_view.make_chart(tile["script"], tile["div_name"]) |
191 end | 194 end |
192 %> | 195 %> |
193 | 196 |
194 <div class = "tile {{type}} {{status}}" id = {{uid}}> | 197 <div class = "tile {{type}} {{status}}" id = {{uid}} style = {{add_style}}> |
195 {{!tile_content}} | 198 {{!tile_content}} |
196 </div> | 199 </div> |
197 | 200 |
198 % end | 201 % end |
199 </div> | 202 </div> |