#24 Add information about weather/warning
This commit is contained in:
parent
c4a23751c1
commit
9f9c8e63ef
@ -4,12 +4,15 @@
|
|||||||
### New Features
|
### New Features
|
||||||
* Add setting model to code
|
* Add setting model to code
|
||||||
* #19 grid automatisch generieren
|
* #19 grid automatisch generieren
|
||||||
|
* #24 Add information about weather/warning
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
* Add Correct Dispose Handling
|
* Add Correct Dispose Handling
|
||||||
|
* TimeCalculation now handle negative values correct
|
||||||
### Changes
|
### Changes
|
||||||
* Refactoring of all JS
|
* Refactoring of all JS
|
||||||
* Make only one request per second instead of four per AJAX
|
* Make only one request per second instead of four per AJAX
|
||||||
* Refactoring adminpannel and add settings.json
|
* Refactoring adminpannel and add settings.json
|
||||||
|
* New function in TimeCalculation, so you can not have negative Timespans
|
||||||
|
|
||||||
## 1.2.8
|
## 1.2.8
|
||||||
### New Features
|
### New Features
|
||||||
|
@ -107,6 +107,12 @@
|
|||||||
<Content Include="resources\css\icons\placeholder.png">
|
<Content Include="resources\css\icons\placeholder.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="resources\css\icons\storm-ac.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="resources\css\icons\storm-in.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="resources\icons\akku\0-4.png">
|
<Content Include="resources\icons\akku\0-4.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -48,18 +48,18 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
|
|||||||
public Warning(JsonData warning) {
|
public Warning(JsonData warning) {
|
||||||
this.Id = warning["id"].ToString();
|
this.Id = warning["id"].ToString();
|
||||||
this.From = warning["properties"]["SENT"].ToString();
|
this.From = warning["properties"]["SENT"].ToString();
|
||||||
this.Expires = warning["properties"]["EXPIRES"].ToString();
|
this.To = warning["properties"]["EXPIRES"].ToString();
|
||||||
this.Location = warning["properties"]["NAME"].ToString();
|
this.Location = warning["properties"]["NAME"].ToString();
|
||||||
this.Type = warning["properties"]["EVENT"].ToString();
|
this.Type = warning["properties"]["EVENT"].ToString();
|
||||||
this.Level = warning["properties"]["SEVERITY"].ToString();
|
this.Level = warning["properties"]["SEVERITY"].ToString().ToLower();
|
||||||
this.Headline = warning["properties"]["HEADLINE"].ToString();
|
this.Headline = warning["properties"]["HEADLINE"].ToString();
|
||||||
this.Body = warning["properties"]["DESCRIPTION"].ToString();
|
this.Body = warning["properties"]["DESCRIPTION"].ToString();
|
||||||
this.Instructions = warning["properties"]["INSTRUCTION"].ToString();
|
this.Instructions = warning["properties"]["INSTRUCTION"] != null ? warning["properties"]["INSTRUCTION"].ToString() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String Id { get; }
|
public String Id { get; }
|
||||||
public String From { get; }
|
public String From { get; }
|
||||||
public String Expires { get; }
|
public String To { get; }
|
||||||
public String Location { get; }
|
public String Location { get; }
|
||||||
public String Type { get; }
|
public String Type { get; }
|
||||||
public String Level { get; }
|
public String Level { get; }
|
||||||
|
@ -122,7 +122,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap {
|
|||||||
{ "panic", this.alarms },
|
{ "panic", this.alarms },
|
||||||
{ "cameracount", this.cameras },
|
{ "cameracount", this.cameras },
|
||||||
{ "crowdcount", this.crowds },
|
{ "crowdcount", this.crowds },
|
||||||
{ "weatherwarnings", this.weather }
|
{ "weatherwarnings", this.weather.Warnungen }
|
||||||
}, cont);
|
}, cont);
|
||||||
} else if (cont.Request.Url.PathAndQuery.StartsWith("/get60000")) {
|
} else if (cont.Request.Url.PathAndQuery.StartsWith("/get60000")) {
|
||||||
return SendJsonResponse(new Dictionary<String, Object>() {
|
return SendJsonResponse(new Dictionary<String, Object>() {
|
||||||
|
@ -65,6 +65,12 @@ object {
|
|||||||
#menucollumn .info {
|
#menucollumn .info {
|
||||||
background-image: url("icons/information.png");
|
background-image: url("icons/information.png");
|
||||||
}
|
}
|
||||||
|
#menucollumn .weather {
|
||||||
|
background-image: url("icons/storm-in.png");
|
||||||
|
}
|
||||||
|
#menucollumn .weather.ac {
|
||||||
|
background-image: url("icons/storm-ac.png");
|
||||||
|
}
|
||||||
|
|
||||||
#pannels {
|
#pannels {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -87,7 +93,7 @@ object {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#pannels #pannels_pos .item {
|
#pannels #pannels_pos .item {
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
}
|
}
|
||||||
#pannels #pannels_pos .item .color {
|
#pannels #pannels_pos .item .color {
|
||||||
float: left;
|
float: left;
|
||||||
@ -101,10 +107,10 @@ object {
|
|||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
#pannels #pannels_pos .item .icon img {
|
#pannels #pannels_pos .item .icon img {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
#pannels #pannels_pos .item .line1 .name {
|
#pannels #pannels_pos .item .line1 .name {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -203,6 +209,44 @@ object {
|
|||||||
margin-left: 70px;
|
margin-left: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pannels #pannels_weather {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem.minor {
|
||||||
|
background-color: #ffeb3b;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem.moderate {
|
||||||
|
background-color: #fb8c00;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem.severe {
|
||||||
|
background-color: #e53935;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem.extreme {
|
||||||
|
background-color: #880e4f;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem .head {
|
||||||
|
font-weight: bold;
|
||||||
|
display: block;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem .ort {
|
||||||
|
display: block;
|
||||||
|
text-align: right;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
#pannels #pannels_weather .alertitem .text {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#overlays #cameracount {
|
#overlays #cameracount {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
|
BIN
Lora-Map/resources/css/icons/storm-ac.png
Normal file
BIN
Lora-Map/resources/css/icons/storm-ac.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
Lora-Map/resources/css/icons/storm-in.png
Normal file
BIN
Lora-Map/resources/css/icons/storm-in.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -11,6 +11,7 @@
|
|||||||
<div id="bigmap"></div>
|
<div id="bigmap"></div>
|
||||||
<div id="menucollumn">
|
<div id="menucollumn">
|
||||||
<span class="pos" onclick="MenuObject.ShowHidePanel('pannels_pos');"></span>
|
<span class="pos" onclick="MenuObject.ShowHidePanel('pannels_pos');"></span>
|
||||||
|
<span class="weather" onclick="MenuObject.ShowHidePanel('pannels_weather');" id="menucol_weather_icon"></span>
|
||||||
<span class="admin" onclick="MenuObject.ShowHidePanel('pannels_admin');"></span>
|
<span class="admin" onclick="MenuObject.ShowHidePanel('pannels_admin');"></span>
|
||||||
<span class="info" onclick="MenuObject.ShowHidePanel('pannels_version');"></span>
|
<span class="info" onclick="MenuObject.ShowHidePanel('pannels_version');"></span>
|
||||||
</div>
|
</div>
|
||||||
@ -19,6 +20,9 @@
|
|||||||
<div id="pannels_info">
|
<div id="pannels_info">
|
||||||
<!-- Shows infos about selected device here, this will be cleand by js -->
|
<!-- Shows infos about selected device here, this will be cleand by js -->
|
||||||
</div>
|
</div>
|
||||||
|
<div id="pannels_weather">
|
||||||
|
<h1>Keine Gefahren</h1>
|
||||||
|
</div>
|
||||||
<div id="pannels_admin">
|
<div id="pannels_admin">
|
||||||
Teste Login...
|
Teste Login...
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
MarkerObject._ParseAJAXPanic(json["panic"]);
|
MarkerObject._ParseAJAXPanic(json["panic"]);
|
||||||
OverlayObject._ParseAJAXCount(json["cameracount"]);
|
OverlayObject._ParseAJAXCount(json["cameracount"]);
|
||||||
OverlayObject._ParseAJAXDensity(json["crowdcount"]);
|
OverlayObject._ParseAJAXDensity(json["crowdcount"]);
|
||||||
|
MenuObject._ParseAJAXWeatherAlerts(json["weatherwarnings"]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
get1000.open("GET", "/get1000", true);
|
get1000.open("GET", "/get1000", true);
|
||||||
@ -52,21 +53,29 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
TimeCalculation: function (timestr, type) {
|
TimeCalculation: function (timestr, type) {
|
||||||
if (type === "diffraw" || type === "difftext") {
|
if (type === "diffraw" || type === "difftext" || type === "difftextn") {
|
||||||
var diff = Math.round((Date.now() - Date.parse(timestr) - this._internalTimeOffset) / 1000);
|
var diff = Math.round((Date.now() - Date.parse(timestr) - this._internalTimeOffset) / 1000);
|
||||||
if (type === "diffraw") {
|
if (type === "diffraw") {
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
if (type === "difftextn" && diff < 0) {
|
||||||
|
diff = diff * -1;
|
||||||
|
}
|
||||||
|
var isneg = false;
|
||||||
|
if (diff < 0) {
|
||||||
|
isneg = true;
|
||||||
|
diff = diff * -1;
|
||||||
|
}
|
||||||
if (diff < 60) {
|
if (diff < 60) {
|
||||||
return diff + " s";
|
return (isneg ? "-" : "") + diff + " s";
|
||||||
}
|
}
|
||||||
if (diff < 60 * 60) {
|
if (diff < 60 * 60) {
|
||||||
return Math.floor(diff / 60) + " m";
|
return (isneg ? "-" : "") + Math.floor(diff / 60) + " m";
|
||||||
}
|
}
|
||||||
if (diff < 60 * 60 * 24) {
|
if (diff < 60 * 60 * 24) {
|
||||||
return Math.floor(diff / (60 * 60)) + " h";
|
return (isneg ? "-" : "") + Math.floor(diff / (60 * 60)) + " h";
|
||||||
}
|
}
|
||||||
return Math.floor(diff / (60 * 60 * 24)) + " d";
|
return (isneg ? "-" : "") + Math.floor(diff / (60 * 60 * 24)) + " d";
|
||||||
} else if (type === "str") {
|
} else if (type === "str") {
|
||||||
var date = new Date(Date.parse(timestr) + this._internalTimeOffset);
|
var date = new Date(Date.parse(timestr) + this._internalTimeOffset);
|
||||||
var str = date.toLocaleString();
|
var str = date.toLocaleString();
|
||||||
|
@ -163,5 +163,24 @@
|
|||||||
};
|
};
|
||||||
testadmin.open("GET", "/admin", true);
|
testadmin.open("GET", "/admin", true);
|
||||||
testadmin.send();
|
testadmin.send();
|
||||||
|
},
|
||||||
|
_ParseAJAXWeatherAlerts: function (json) {
|
||||||
|
if (json.length > 0) {
|
||||||
|
var html = "";
|
||||||
|
for (var i = 0; i < json.length; i++) {
|
||||||
|
var walert = json[i];
|
||||||
|
html += "<div class='alertitem " + walert.Level + "'>" +
|
||||||
|
"<span class='head'>" + walert.Headline + "</span>" +
|
||||||
|
"<span class='ort'>" + walert.Location + "</span>" +
|
||||||
|
"<span class='text'>" + walert.Body + (walert.Instructions != "" ? "<br><br>" + walert.Instructions : "") + "</span>" +
|
||||||
|
"<span class='time'><b>Von:</b> vor " + FunctionsObject.TimeCalculation(walert.From, "difftext") + " <b>Bis:</b> in " + FunctionsObject.TimeCalculation(walert.To, "difftextn") + "</span>" +
|
||||||
|
"</div>";
|
||||||
|
}
|
||||||
|
document.getElementById("pannels_weather").innerHTML = html;
|
||||||
|
document.getElementById("menucol_weather_icon").className = "weather ac";
|
||||||
|
} else {
|
||||||
|
document.getElementById("pannels_weather").innerHTML = "<h1>Keine Gefahren</h1>";
|
||||||
|
document.getElementById("menucol_weather_icon").className = "weather";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.Start();
|
}.Start();
|
Loading…
Reference in New Issue
Block a user