Skip to content

Commit

Permalink
Merge pull request openWB#1021 from benderl/display-cards
Browse files Browse the repository at this point in the history
display theme cards
  • Loading branch information
benderl authored Jul 6, 2023
2 parents 0ecbf98 + e175570 commit d1ff779
Show file tree
Hide file tree
Showing 22 changed files with 2,695 additions and 2,091 deletions.
2,798 changes: 1,597 additions & 1,201 deletions packages/modules/display_themes/cards/source/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/modules/display_themes/cards/source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
"@vue/test-utils": "^2.2.4",
"eslint": "^8.30.0",
"eslint-plugin-vue": "^9.3.0",
"jsdom": "^21.1.0",
"jsdom": "^22.1.0",
"postcss": "^8.4.21",
"postcss-preset-env": "^8.0.1",
"postcss-preset-env": "^9.0.0",
"prettier": "^2.8.1",
"rollup-plugin-node-polyfills": "^0.2.1",
"sass": "^1.57.1",
"vite": "^4.0.3",
"vite-plugin-node-polyfills": "^0.7.0",
"vitest": "^0.28.3"
"vite-plugin-node-polyfills": "^0.9.0",
"vitest": "^0.32.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<script>
import ExtendedNumberInput from "@/components/ExtendedNumberInput.vue";
/* fontawesome */
import { library } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import {
faDeleteLeft as fasDeleteLeft,
faEraser as fasEraser,
} from "@fortawesome/free-solid-svg-icons";
/* add icons to the library */
library.add(fasDeleteLeft, fasEraser);
import { useMqttStore } from "@/stores/mqtt.js";
export default {
name: "ManualSocInput",
props: {
modelValue: { required: true, type: Boolean, default: false },
vehicleId: { required: true, type: Number, default: 0 },
},
data() {
return {
mqttStore: useMqttStore(),
newSoc: 0,
};
},
components: {
ExtendedNumberInput,
FontAwesomeIcon,
},
emits: ["update:modelValue"],
methods: {
enter(digit) {
let tempSoc = this.newSoc * 10 + digit;
if (tempSoc >= 0 && tempSoc <= 100) {
this.newSoc = tempSoc;
}
},
removeDigit() {
this.newSoc = Math.trunc(this.newSoc / 10);
},
clear() {
this.newSoc = 0;
},
close() {
this.$emit("update:modelValue", false);
this.newSoc = 0;
},
updateManualSoc() {
this.$root.sendTopicToBroker(
`openWB/vehicle/${this.vehicleId}/soc_module/configuration/soc_start`,
this.newSoc
);
this.close();
},
},
};
</script>

<template>
<Teleport to="body">
<i-modal
:modelValue="modelValue"
@update:modelValue="$emit('update:modelValue', $event)"
size="sm"
>
<template #header>
SoC für Fahrzeug "{{ mqttStore.getVehicleName(vehicleId) }}"
</template>
<i-container>
<i-row center class="_padding-bottom:1">
<i-column>
<extended-number-input
v-model="newSoc"
unit="%"
:min="0"
:max="100"
:step="1"
size="lg"
class="_text-align:center"
/>
</i-column>
</i-row>
<i-row center class="_padding-bottom:1">
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(1)"
>1</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(2)"
>2</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(3)"
>3</i-button
>
</i-column>
</i-row>
</i-container>
<i-container>
<i-row center class="_padding-bottom:1">
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(4)"
>4</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(5)"
>5</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(6)"
>6</i-button
>
</i-column>
</i-row>
</i-container>
<i-container>
<i-row center class="_padding-bottom:1">
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(7)"
>7</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(8)"
>8</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(9)"
>9</i-button
>
</i-column>
</i-row>
</i-container>
<i-container>
<i-row center class="_padding-bottom:1">
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="clear()">
<FontAwesomeIcon fixed-width :icon="['fas', 'fa-eraser']" />
</i-button>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="enter(0)"
>0</i-button
>
</i-column>
<i-column class="_flex-grow:0">
<i-button size="lg" class="numberButton" @click="removeDigit()">
<FontAwesomeIcon fixed-width :icon="['fas', 'fa-delete-left']" />
</i-button>
</i-column>
</i-row>
</i-container>
<template #footer>
<i-container>
<i-row>
<!-- charge point data on left side -->
<i-column>
<i-button color="danger" @click="close()"> Zurück </i-button>
</i-column>
<i-column class="_text-align:right">
<i-button color="success" @click="updateManualSoc()">
OK
</i-button>
</i-column>
</i-row>
</i-container>
</template>
</i-modal>
</Teleport>
</template>

<style scoped>
.numberButton {
min-width: 3em;
min-height: 3em;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export default {
</script>

<template>
<dash-board-card color="primary">
<dash-board-card
v-if="mqttStore.getChargePointIds.length > 0"
color="primary"
>
<template #headerLeft>
<font-awesome-icon fixed-width :icon="['fas', 'fa-charging-station']" />
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export default {
Übersicht
</nav-item>
<nav-item
v-if="mqttStore.getChargePointsEnabled"
v-if="
mqttStore.getChargePointsEnabled &&
mqttStore.getChargePointIds.length > 0
"
:to="{ name: 'charge-points' }"
>
Ladepunkte
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ export const useMqttStore = defineStore("mqtt", {
getVehicleList(state) {
return state.getWildcardTopics("openWB/vehicle/+/name");
},
getVehicleName(state) {
return (vehicleId) => {
return state.topics[`openWB/vehicle/${vehicleId}/name`];
};
},
getVehicleSocConfigured(state) {
return (vehicleId) => {
return (
Expand Down
Loading

0 comments on commit d1ff779

Please sign in to comment.