Skip to content

Commit f374849

Browse files
authored
Plan UI: always show settings (#26488)
1 parent 91edce9 commit f374849

File tree

6 files changed

+33
-8
lines changed

6 files changed

+33
-8
lines changed

assets/js/components/ChargingPlans/PlanStrategy.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<template>
22
<div class="strategy-wrapper" :class="{ open: show }">
33
<div class="strategy-content">
4-
<div class="row">
4+
<div v-if="disabled" class="row mb-4">
5+
<div class="small text-muted">
6+
<strong class="text-primary">{{ $t("general.note") }}</strong>
7+
{{ $t("main.chargingPlan.strategyDisabledDescription") }}
8+
</div>
9+
</div>
10+
<div v-else class="row">
511
<div class="col-12 col-sm-6 col-lg-3 offset-lg-3 mb-3">
612
<div class="row">
713
<label :for="formId('continuous')" class="col-form-label col-5 col-sm-12">
@@ -68,6 +74,7 @@ export default defineComponent({
6874
show: Boolean,
6975
precondition: { type: Number, default: 0 },
7076
continuous: { type: Boolean, default: false },
77+
disabled: Boolean,
7178
},
7279
emits: ["update"],
7380
data() {

assets/js/components/ChargingPlans/PlansSettings.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
<span v-else-if="alreadyReached">{{ $t("main.targetCharge.goalReached") }}</span>
4545
<span v-else>{{ nextPlanTitle }}</span>
4646
<button
47-
v-if="showStrategy"
4847
type="button"
4948
class="btn btn-sm"
5049
:class="strategyOpen ? 'btn-secondary' : 'evcc-gray'"
@@ -57,8 +56,8 @@
5756
</div>
5857
</h5>
5958
<ChargingPlanStrategy
60-
v-if="showStrategy"
6159
v-bind="chargingPlanStrategyProps"
60+
:disabled="strategyDisabled"
6261
:show="strategyOpen"
6362
@update="updatePlanStrategy"
6463
/>
@@ -173,11 +172,12 @@ export default defineComponent({
173172
nextPlanTitle(): string {
174173
return `${this.$t("main.targetCharge.nextPlan")} #${this.nextPlanId}`;
175174
},
176-
showStrategy(): boolean {
177-
// only show option if planner forecast has different values
175+
strategyDisabled(): boolean {
176+
// options only make sense if there are variable prices
177+
// TODO: make this logic more robust (api fails, missing data)
178178
const slots = this.forecast?.planner || [];
179179
const values = new Set(slots.map(({ value }) => value));
180-
return values.size > 1;
180+
return values.size <= 1;
181181
},
182182
},
183183
watch: {

i18n/de.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,9 @@
760760
"solar": "Solar"
761761
}
762762
},
763+
"general": {
764+
"note": "Hinweis:"
765+
},
763766
"header": {
764767
"about": "Über",
765768
"blog": "Blog",
@@ -893,6 +896,7 @@
893896
"repeating": "wiederholend",
894897
"repeatingPlans": "Wiederholende Pläne",
895898
"selectAll": "Alle wählen",
899+
"strategyDisabledDescription": "Das Laden startet so spät wie möglich und wird rechtzeitig zur Abfahrt abgeschlossen. Mit dynamischen Netzpreisen oder einem CO₂-Tarif stehen hier weitere Optionen zur Verfügung.",
896900
"strategySettings": "Strategie-Einstellungen",
897901
"time": "Zeit",
898902
"title": "Plan",

i18n/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,9 @@
762762
"solar": "Solar"
763763
}
764764
},
765+
"general": {
766+
"note": "Note:"
767+
},
765768
"header": {
766769
"about": "About",
767770
"blog": "Blog",
@@ -895,6 +898,7 @@
895898
"repeating": "repeating",
896899
"repeatingPlans": "Repeating plans",
897900
"selectAll": "Select all",
901+
"strategyDisabledDescription": "Charging starts as late as possible to finish just in time for departure. With dynamic grid prices or CO₂ tariff, more options are available here.",
898902
"strategySettings": "Strategy settings",
899903
"time": "Time",
900904
"title": "Plan",

tests/evcc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const BINARY = "./evcc";
1212
const IS_CI = !!process.env["GITHUB_ACTIONS"];
1313
const LOG_ENABLED = !IS_CI;
1414

15+
console.log(
16+
"REMINDER: Playwright tests run against the ./evcc binary. Rebuild with 'make ui build' after application changes."
17+
);
18+
1519
// sometimes evcc startup fails due to infra issues in runner ususally fixed by retry. allowing some fails to avoid github annotations clutter
1620
let allowedStartupFails = IS_CI ? 2 : 0;
1721

@@ -105,6 +109,7 @@ async function _start(config?: string, flags: string | string[] = []) {
105109
const configArgs = config ? ["--config", config.includes("/") ? config : `tests/${config}`] : [];
106110
const port = workerPort();
107111
const ocpp = ocppPort();
112+
108113
log(`wait until port ${port} is available`);
109114
// wait for port to be available
110115
await waitOn({ resources: [`tcp:${port}`], reverse: true, log: LOG_ENABLED });

tests/plan.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,13 @@ test.describe("plan strategy", async () => {
687687
await lp1.getByTestId("charging-plan").getByRole("button", { name: "none" }).click();
688688
const modal = page.getByTestId("charging-plan-modal");
689689
await expect(modal.getByTestId("static-plan-active")).toBeVisible();
690-
// Strategy toggle should not be visible when no dynamic tariff exists
691-
await expect(modal.getByRole("button", { name: "Strategy settings" })).not.toBeVisible();
690+
691+
// Strategy toggle should be visible but expand to show informational note only
692+
await expect(modal.getByRole("button", { name: "Strategy settings" })).toBeVisible();
693+
await modal.getByRole("button", { name: "Strategy settings" }).click();
694+
await expect(modal.getByLabel("Optimization")).not.toBeVisible();
695+
await expect(modal.getByLabel("Late Charging")).not.toBeVisible();
696+
await expect(modal).toContainText("just in time for departure");
692697
});
693698

694699
test("visible and functional on mobile", async ({ page }) => {

0 commit comments

Comments
 (0)