Skip to content

Commit

Permalink
Allow electric poles to not be planned in web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
joelverhagen committed Jan 17, 2024
1 parent 0e8e197 commit 9c55e07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/vue/src/components/ElectricPoleForm.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<template>
<fieldset class="border p-3 mb-3">
<legend>Electric poles</legend>
<CustomizeSelect custom-label="Entity" label="Entity" idPrefix="electric-pole"
<div class="form-check">
<input type="checkbox" class="form-check-input" id="add-electric-poles" v-model="addElectricPoles">
<label class="form-check-label" for="add-electric-poles">Add electric poles</label>
</div>
<CustomizeSelect v-if="addElectricPoles" custom-label="Entity" label="Entity" idPrefix="electric-pole"
:showAdvancedOptions="showAdvancedOptions" :defaultValue="electricPoleEntityName"
:defaultIsCustom="electricPoleIsCustom" v-model="electricPoleEntityName" v-model:isCustom="electricPoleIsCustom">
<option value="small-electric-pole">Small electric pole</option>
<option value="medium-electric-pole">Medium electric pole</option>
<option value="big-electric-pole">Big electric pole</option>
<option value="substation">Substation</option>
</CustomizeSelect>
<div class="row" v-show="showAdvancedOptions">
<div class="row" v-show="showAdvancedOptions && addElectricPoles">
<div class="col-lg-4 mt-3">
<label class="form-label" for="electric-pole-wire-reach">Wire reach</label>
<input type="text" pattern="\d+(\.\d+)" min="1" max="99" class="form-control" id="electric-pole-wire-reach"
Expand Down Expand Up @@ -57,6 +61,7 @@ export default {
data() {
return pick(
storeToRefs(useOilFieldStore()),
'addElectricPoles',
'electricPoleEntityName',
'electricPoleIsCustom',
'electricPoleWidth',
Expand Down
2 changes: 1 addition & 1 deletion src/vue/src/lib/OilFieldPlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type RequestPropertyGetters = {

const requestPropertyGetters: RequestPropertyGetters = {
addBeacons: (state) => state.addBeacons,
addElectricPoles: (_) => true,
addElectricPoles: (state) => state.addElectricPoles,
addFbeOffset: (_) => false,
beaconEntityName: (state) => state.beaconEntityName.trim(),
beaconHeight: (state) => state.beaconHeight,
Expand Down
2 changes: 2 additions & 0 deletions src/vue/src/stores/OilFieldStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const defaults = {
pumpjackModule: 'productivity-module-3',
pumpjackModuleIsCustom: false,
addBeacons: true,
addElectricPoles: true,
overlapBeacons: true,
beaconModule: 'speed-module-3',
beaconModuleIsCustom: false,
Expand Down Expand Up @@ -51,6 +52,7 @@ const storeToQuery: StoreToQuery = {
pumpjackModule: 'pumpMod',
pumpjackModuleIsCustom: 'pumpModCust',
addBeacons: 'beacons',
addElectricPoles: 'poles',
overlapBeacons: 'overlapBeacons',
beaconModule: 'beaconMod',
beaconModuleIsCustom: 'beaconModCust',
Expand Down

0 comments on commit 9c55e07

Please sign in to comment.