added calculation for battery level with mock data and adjusted the types
This commit is contained in:
parent
ff2d6c82c9
commit
644dd6394e
3 changed files with 57 additions and 25 deletions
|
@ -27,11 +27,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex align-items-center mb-2">
|
<div class="d-flex align-items-center mb-2">
|
||||||
<span class="mr-2">Battery:</span>
|
<span class="mr-2">Battery:</span>
|
||||||
<span>{{ node.battery }}%</span>
|
<span>{{ node.batteryCurrent }}%</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex align-items-center mb-2">
|
<div class="d-flex align-items-center mb-2">
|
||||||
<span class="mr-2">Runtime:</span>
|
<span class="mr-2">Runtime:</span>
|
||||||
<span>{{ node.runtime }} hours</span>
|
<span>{{ node.uptime }} hours</span>
|
||||||
</div>
|
</div>
|
||||||
</v-expansion-panel-text>
|
</v-expansion-panel-text>
|
||||||
</v-expansion-panel>
|
</v-expansion-panel>
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>Node/Name</th>
|
<th>Node/Name</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Latitude</th> <!-- Separate column for Latitude -->
|
<th>Latitude</th>
|
||||||
<th>Longitude</th> <!-- Separate column for Longitude -->
|
<th>Longitude</th>
|
||||||
<th>Battery</th>
|
<th>Battery</th>
|
||||||
<th>Gemessene - Temperatur</th>
|
<th>Gemessene - Temperatur</th>
|
||||||
<th>Laufzeit</th>
|
<th>Laufzeit</th>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ node.position.lat }}</td>
|
<td>{{ node.position.lat }}</td>
|
||||||
<td>{{ node.position.lng }}</td>
|
<td>{{ node.position.lng }}</td>
|
||||||
<td>{{ node.battery }}%</td>
|
<td>{{ calculateBatteryPercentage(node.batteryVoltage, node.minVoltage, node.maxVoltage) }}%</td>
|
||||||
<td>{{ node.temperature }}°C</td>
|
<td>{{ node.temperature }}°C</td>
|
||||||
<td>{{ node.runtime }}</td>
|
<td>{{ node.runtime }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -32,6 +32,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
//folgende Mockdaten rausnehmen und mit axios requests abfragen
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -40,7 +43,9 @@ export default {
|
||||||
name: "XXXX-XXXX-XXXX-XXXX",
|
name: "XXXX-XXXX-XXXX-XXXX",
|
||||||
status: "ONLINE",
|
status: "ONLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 98,
|
batteryVoltage: 3.9,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "12h 30m 12s",
|
runtime: "12h 30m 12s",
|
||||||
},
|
},
|
||||||
|
@ -48,7 +53,9 @@ export default {
|
||||||
name: "XXXX-XXXX-XXXX-XXXX",
|
name: "XXXX-XXXX-XXXX-XXXX",
|
||||||
status: "OFFLINE",
|
status: "OFFLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 19,
|
batteryVoltage: 3.2,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "30m",
|
runtime: "30m",
|
||||||
},
|
},
|
||||||
|
@ -56,7 +63,9 @@ export default {
|
||||||
name: "Localnode-3",
|
name: "Localnode-3",
|
||||||
status: "ONLINE",
|
status: "ONLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 66,
|
batteryVoltage: 3.7,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "12h 30m 12s",
|
runtime: "12h 30m 12s",
|
||||||
},
|
},
|
||||||
|
@ -64,7 +73,9 @@ export default {
|
||||||
name: "XXXX-XXXX-XXXX-XXXX",
|
name: "XXXX-XXXX-XXXX-XXXX",
|
||||||
status: "ONLINE",
|
status: "ONLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 79,
|
batteryVoltage: 3.8,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "12h 30m 12s",
|
runtime: "12h 30m 12s",
|
||||||
},
|
},
|
||||||
|
@ -72,7 +83,9 @@ export default {
|
||||||
name: "XXXX-XXXX-XXXX-XXXX",
|
name: "XXXX-XXXX-XXXX-XXXX",
|
||||||
status: "ONLINE",
|
status: "ONLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 10,
|
batteryVoltage: 3.1,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "12h 30m 12s",
|
runtime: "12h 30m 12s",
|
||||||
},
|
},
|
||||||
|
@ -80,7 +93,9 @@ export default {
|
||||||
name: "XXXX-XXXX-XXXX-XXXX",
|
name: "XXXX-XXXX-XXXX-XXXX",
|
||||||
status: "OFFLINE",
|
status: "OFFLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 0,
|
batteryVoltage: 3.0,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "12h 30m 12s",
|
runtime: "12h 30m 12s",
|
||||||
},
|
},
|
||||||
|
@ -88,36 +103,49 @@ export default {
|
||||||
name: "XXXX-XXXX-XXXX-XXXX",
|
name: "XXXX-XXXX-XXXX-XXXX",
|
||||||
status: "ONLINE",
|
status: "ONLINE",
|
||||||
position: { lat: 40.7128, lng: 74.0012 },
|
position: { lat: 40.7128, lng: 74.0012 },
|
||||||
battery: 56,
|
batteryVoltage: 3.6,
|
||||||
|
minVoltage: 3.0,
|
||||||
|
maxVoltage: 4.2,
|
||||||
temperature: 100,
|
temperature: 100,
|
||||||
runtime: "12h 30m 12s",
|
runtime: "12h 30m 12s",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
calculateBatteryPercentage(currentVoltage, minVoltage, maxVoltage) {
|
||||||
|
if (currentVoltage <= minVoltage) {
|
||||||
|
return 0;
|
||||||
|
} else if (currentVoltage >= maxVoltage) {
|
||||||
|
return 100;
|
||||||
|
} else {
|
||||||
|
return ((currentVoltage - minVoltage) / (maxVoltage - minVoltage) * 100).toFixed(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.table-container {
|
.table-container {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 0.5rem 1rem; /* Reduce top padding to 0.5rem */
|
padding: 0.5rem 1rem;
|
||||||
margin: 0 auto; /* Remove margin at the top, keep it centered horizontally */
|
margin: 0 auto;
|
||||||
width: 100%; /* Full width of parent */
|
width: 100%;
|
||||||
overflow-x: auto; /* Allow horizontal scroll if necessary */
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.responsive-table {
|
.responsive-table {
|
||||||
width: 100%; /* Full width */
|
width: 100%;
|
||||||
border-collapse: collapse; /* Ensure tight borders */
|
border-collapse: collapse;
|
||||||
margin: 0; /* Remove margin at the top of the table */
|
margin: 0;
|
||||||
table-layout: auto; /* Auto layout for slimmer columns */
|
table-layout: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.responsive-table th,
|
.responsive-table th,
|
||||||
.responsive-table td {
|
.responsive-table td {
|
||||||
padding: 0.5rem; /* Maintain slim padding */
|
padding: 0.5rem;
|
||||||
text-align: center; /* Center text */
|
text-align: center;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +154,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.responsive-table tr:nth-child(even) {
|
.responsive-table tr:nth-child(even) {
|
||||||
background-color: #f9f9f9; /* Striped rows */
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-online {
|
.status-online {
|
||||||
|
|
|
@ -5,8 +5,12 @@ export interface Node {
|
||||||
coordla: number;
|
coordla: number;
|
||||||
coordlong: number;
|
coordlong: number;
|
||||||
temperature: number;
|
temperature: number;
|
||||||
battery: number;
|
batteryMinimum: number;
|
||||||
runtime: number;
|
batteryCurrent: number;
|
||||||
|
batteryMaximum: number;
|
||||||
|
voltage: number;
|
||||||
|
uptime: number;
|
||||||
|
group: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NodeGroup {
|
export interface NodeGroup {
|
||||||
|
|
Loading…
Add table
Reference in a new issue