Skip to content

Commit

Permalink
power_manager: Fix display of phases on the status page
Browse files Browse the repository at this point in the history
Only show the phases if the device is capable of phase switching itself, i.e., WARP3 or EMv1.
If the power manager is enabled on WARP1/WARP2 without phase switching, don't show the phases.
  • Loading branch information
MattiasTF committed Nov 26, 2024
1 parent ea5fae6 commit 509e66a
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions software/web/src/modules/power_manager/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,38 +187,38 @@ export class PowerManagerStatus extends Component {
</FormRow>
: null}

{API.hasFeature("phase_switch") && (API.get_unchecked("evse/management_enabled") == null || !API.get_unchecked("evse/management_enabled").enabled) ?
<FormRow label={__("power_manager.status.phase_switching")}>
<ButtonGroup className="flex-wrap m-n1" style="width: calc(100% + 0.5rem);">
<Button
style="display: flex;align-items: center;justify-content: center;"
className="m-1 rounded-left rounded-right"
variant={!ll_state.is_3phase ? "success" : "primary"}
disabled={!ll_state.is_3phase || state.external_control != 0}
onClick={() => this.change_phase(1)}>
{state.external_control != 3 ? (!ll_state.is_3phase ? <CheckCircle size="20"/> : <Circle size="20"/>) : <Spinner size="sm" animation="grow" />} <span>&nbsp;&nbsp;</span><span>{__("power_manager.status.single_phase")}</span>
</Button>
<Button
style="display: flex;align-items: center;justify-content: center;"
className="m-1 rounded-left rounded-right"
variant={ll_state.is_3phase ? "success" : "primary"}
disabled={ll_state.is_3phase || state.external_control != 0}
onClick={() => this.change_phase(3)}>
{state.external_control != 3 ? (ll_state.is_3phase ? <CheckCircle size="20"/> : <Circle size="20"/>) : <Spinner size="sm" animation="grow" />} <span>&nbsp;&nbsp;</span><span>{__("power_manager.status.three_phase")}</span>
</Button>
</ButtonGroup>
</FormRow>
: (API.get('power_manager/config').enabled || (API.hasFeature("phase_switch") && API.get_unchecked("evse/management_enabled")?.enabled) ?
<FormRow label={__("power_manager.status.phase_switching")}>
<IndicatorGroup
value={!ll_state.is_3phase ? 0 : 1}
items={[
["primary", __("power_manager.status.single_phase")],
["primary", __("power_manager.status.three_phase")],
]} />
</FormRow>
: undefined)
}
{API.get_unchecked("evse/hardware_configuration")?.evse_version >= 30 || API.get_unchecked("energy_manager/config")?.contactor_installed ?
API.hasFeature("phase_switch") && (API.get_unchecked("evse/management_enabled") == null || !API.get_unchecked("evse/management_enabled").enabled) ?
<FormRow label={__("power_manager.status.phase_switching")}>
<ButtonGroup className="flex-wrap m-n1" style="width: calc(100% + 0.5rem);">
<Button
style="display: flex;align-items: center;justify-content: center;"
className="m-1 rounded-left rounded-right"
variant={!ll_state.is_3phase ? "success" : "primary"}
disabled={!ll_state.is_3phase || state.external_control != 0}
onClick={() => this.change_phase(1)}>
{state.external_control != 3 ? (!ll_state.is_3phase ? <CheckCircle size="20"/> : <Circle size="20"/>) : <Spinner size="sm" animation="grow" />} <span>&nbsp;&nbsp;</span><span>{__("power_manager.status.single_phase")}</span>
</Button>
<Button
style="display: flex;align-items: center;justify-content: center;"
className="m-1 rounded-left rounded-right"
variant={ll_state.is_3phase ? "success" : "primary"}
disabled={ll_state.is_3phase || state.external_control != 0}
onClick={() => this.change_phase(3)}>
{state.external_control != 3 ? (ll_state.is_3phase ? <CheckCircle size="20"/> : <Circle size="20"/>) : <Spinner size="sm" animation="grow" />} <span>&nbsp;&nbsp;</span><span>{__("power_manager.status.three_phase")}</span>
</Button>
</ButtonGroup>
</FormRow>
:
<FormRow label={__("power_manager.status.phase_switching")}>
<IndicatorGroup
value={!ll_state.is_3phase ? 0 : 1}
items={[
["primary", __("power_manager.status.single_phase")],
["primary", __("power_manager.status.three_phase")],
]} />
</FormRow>
: undefined}

{this.generate_config_error_labels(state.config_error_flags)}
</StatusSection>
Expand Down

0 comments on commit 509e66a

Please sign in to comment.