-
Notifications
You must be signed in to change notification settings - Fork 113
Koala - New charge limit dialog #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
45ca65c
add charge limit dialog
Brett-S-OWB 69bf550
add toggle icon
Brett-S-OWB 0157705
switch case to update charge Limit based on charge mode
Brett-S-OWB 9aab8c6
Limit dialog - only modes instant, pv and eco clickable
Brett-S-OWB 846858a
stop event propagation for SoC edit buttons
Brett-S-OWB 92166b6
enable energy limit toggle for modes instant, pv and eco
Brett-S-OWB 39452d0
rename computed prop
Brett-S-OWB ab931b6
hide energy limit toggle when not required
Brett-S-OWB 3a01a84
Add tooltip - limit slider
Brett-S-OWB d943e3b
only show tool tip for relevant charge modes
Brett-S-OWB 7d54bde
Rename charge limits dialog - add slider attributes
Brett-S-OWB 962de2f
remove unused CSS class
Brett-S-OWB f062cec
Add slider props
Brett-S-OWB 507b17e
Remove unnecessary model-value update
Brett-S-OWB daf94d4
remove unnecassary prop
Brett-S-OWB 87c6676
Add dropdown button group for mobile
Brett-S-OWB 0beb670
remove unnecessary prop from slider
Brett-S-OWB c207070
Remove toggle, clickable slider always displayed
Brett-S-OWB 2a69bf4
Replace the SoC figure with info text if no SoC-Modul configured
Brett-S-OWB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
223 changes: 223 additions & 0 deletions
223
packages/modules/web_themes/koala/source/src/components/ChargePointChargeLimits.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,223 @@ | ||
| <template> | ||
| <q-dialog | ||
| v-model="visible" | ||
| :backdrop-filter="isSmallScreen ? '' : 'blur(4px)'" | ||
| > | ||
| <q-card class="card-width"> | ||
| <q-card-section> | ||
| <div class="row nowrap q-mb-sm"> | ||
| <div class="text-h6">Begrenzung</div> | ||
| <q-space /> | ||
| <q-btn icon="close" flat round dense v-close-popup /> | ||
| </div> | ||
| <q-separator class="q-mt-sm q-mb-sm" /> | ||
| <div v-if="isSmallScreen" class="row q-pt-md full-width"> | ||
| <q-btn-dropdown | ||
| class="col" | ||
| transition-show="scale" | ||
| transition-hide="scale" | ||
| transition-duration="500" | ||
| color="primary" | ||
| :label="currentLimitModeLabel" | ||
| size="md" | ||
| dropdown-icon="none" | ||
| cover | ||
| push | ||
| > | ||
| <q-list> | ||
| <template v-for="(mode, index) in limitModes" :key="mode.value"> | ||
| <q-item | ||
| clickable | ||
| v-close-popup | ||
| @click="limitMode.value = mode.value" | ||
| :active="limitMode.value === mode.value" | ||
| :disable="mode.value === 'soc' && !vehicleSocType" | ||
| active-class="bg-primary text-white" | ||
| > | ||
| <q-item-section class="text-center text-weight-bold"> | ||
| <q-item-label>{{ | ||
| mode.label.toLocaleUpperCase() | ||
| }}</q-item-label> | ||
| </q-item-section> | ||
| </q-item> | ||
| <q-separator v-if="index < limitModes.length - 1" /> | ||
| </template> | ||
| </q-list> | ||
| </q-btn-dropdown> | ||
| </div> | ||
| <div | ||
| v-else | ||
| class="row items-center justify-center q-ma-none q-pa-none no-wrap" | ||
| > | ||
| <q-btn-group class="col"> | ||
| <q-btn | ||
| v-for="mode in limitModes" | ||
| :key="mode.value" | ||
| :color="limitMode.value === mode.value ? 'primary' : 'grey'" | ||
| :label="mode.label" | ||
| :disable="mode.value === 'soc' && !vehicleSocType" | ||
| :outline="mode.value === 'soc' && !vehicleSocType" | ||
benderl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| size="sm" | ||
| class="col" | ||
| @click="limitMode.value = mode.value" | ||
| /> | ||
| </q-btn-group> | ||
| </div> | ||
| <SliderStandard | ||
| v-if="limitMode.value === 'soc'" | ||
| title="SoC-Limit für das Fahrzeug" | ||
| :min="5" | ||
| :max="100" | ||
| :step="5" | ||
| color="light-green-14" | ||
| :track-size="'1em'" | ||
| thumb-size="2.3em" | ||
| thumb-color="light-green-14" | ||
| unit="%" | ||
| v-model="limitSoC.value" | ||
| class="q-mt-md" | ||
| /> | ||
| <SliderStandard | ||
| v-if="limitMode.value === 'amount'" | ||
| title="Energie-Limit" | ||
| :min="1" | ||
| :max="50" | ||
| color="green-7" | ||
| :track-size="'1em'" | ||
| thumb-size="2.3em" | ||
| thumb-color="green-7" | ||
| unit="kWh" | ||
| v-model="limitEnergy.value" | ||
| class="q-mt-md" | ||
| /> | ||
| </q-card-section> | ||
| </q-card> | ||
| </q-dialog> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { Screen, QDialog } from 'quasar'; | ||
| import { useMqttStore } from 'src/stores/mqtt-store'; | ||
| import SliderStandard from './SliderStandard.vue'; | ||
| import { computed, ref, watch } from 'vue'; | ||
|
|
||
| const props = defineProps<{ | ||
| chargePointId: number; | ||
| modelValue: boolean; | ||
| }>(); | ||
|
|
||
| const emit = defineEmits<{ | ||
| 'update:model-value': [value: boolean]; | ||
| }>(); | ||
|
|
||
| const mqttStore = useMqttStore(); | ||
|
|
||
| const isSmallScreen = computed(() => Screen.lt.sm); | ||
| const tempValue = ref<boolean>(props.modelValue); | ||
|
|
||
| const limitModes = [ | ||
| { value: 'none', label: 'keine' }, | ||
| { value: 'soc', label: 'EV-SoC' }, | ||
| { value: 'amount', label: 'Energie' }, | ||
| ]; | ||
|
|
||
| const vehicleSocType = computed(() => | ||
| mqttStore.chargePointConnectedVehicleSocType(props.chargePointId), | ||
| )?.value; | ||
|
|
||
| const chargeMode = computed( | ||
| () => | ||
| mqttStore.chargePointConnectedVehicleChargeMode(props.chargePointId)?.value, | ||
| ); | ||
|
|
||
| const activeChargeLimitConfig = computed(() => { | ||
| switch (chargeMode.value) { | ||
| case 'instant_charging': | ||
| return { | ||
| mode: mqttStore.chargePointConnectedVehicleInstantChargeLimit( | ||
| props.chargePointId, | ||
| ), | ||
| soc: mqttStore.chargePointConnectedVehicleInstantChargeLimitSoC( | ||
| props.chargePointId, | ||
| ), | ||
| energy: mqttStore.chargePointConnectedVehicleInstantChargeLimitEnergy( | ||
| props.chargePointId, | ||
| ), | ||
| }; | ||
| case 'pv_charging': | ||
| return { | ||
| mode: mqttStore.chargePointConnectedVehiclePvChargeLimit( | ||
| props.chargePointId, | ||
| ), | ||
| soc: mqttStore.chargePointConnectedVehiclePvChargeLimitSoC( | ||
| props.chargePointId, | ||
| ), | ||
| energy: mqttStore.chargePointConnectedVehiclePvChargeLimitEnergy( | ||
| props.chargePointId, | ||
| ), | ||
| }; | ||
| case 'eco_charging': | ||
| return { | ||
| mode: mqttStore.chargePointConnectedVehicleEcoChargeLimit( | ||
| props.chargePointId, | ||
| ), | ||
| soc: mqttStore.chargePointConnectedVehicleEcoChargeLimitSoC( | ||
| props.chargePointId, | ||
| ), | ||
| energy: mqttStore.chargePointConnectedVehicleEcoChargeLimitEnergy( | ||
| props.chargePointId, | ||
| ), | ||
| }; | ||
| default: | ||
| return { | ||
| mode: ref('none'), | ||
| soc: ref(0), | ||
| energy: ref(0), | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| const limitMode = computed(() => activeChargeLimitConfig.value.mode); | ||
| const limitSoC = computed(() => activeChargeLimitConfig.value.soc); | ||
| const limitEnergy = computed(() => activeChargeLimitConfig.value.energy); | ||
|
|
||
| const visible = computed({ | ||
| get: () => tempValue.value, | ||
| set: (value) => { | ||
| tempValue.value = value; | ||
| emit('update:model-value', value); | ||
| }, | ||
| }); | ||
|
|
||
| const currentLimitModeLabel = computed( | ||
| () => limitModes.find((mode) => mode.value === limitMode.value.value)?.label, | ||
| ); | ||
|
|
||
| watch( | ||
| () => props.modelValue, | ||
| (value) => { | ||
| tempValue.value = value; | ||
| }, | ||
| ); | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| .card-width { | ||
| width: 25em; | ||
| } | ||
| .q-btn-group .q-btn { | ||
| min-width: 100px !important; | ||
| } | ||
|
|
||
| body.mobile .q-btn-group .q-btn { | ||
| padding: 4px 8px; | ||
| font-size: 12px !important; | ||
| min-height: 30px; | ||
| } | ||
|
|
||
| :deep(.q-btn-dropdown__arrow-container) { | ||
| width: 0; | ||
| padding: 0; | ||
| margin: 0; | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.