From 4a0035b9ebc5872dc5facc2d7f28b043702406a5 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Mon, 24 Feb 2020 08:55:57 -0800 Subject: [PATCH] minor bug fixes --- frontend/css/farm_designer/farm_designer_panels.scss | 4 ++-- .../devices/components/fbos_settings/fbos_details.tsx | 9 ++++++--- frontend/devices/connectivity/connectivity.tsx | 7 +++++-- .../__tests__/list_and_label_support_test.tsx | 4 +++- frontend/devices/pin_bindings/list_and_label_support.tsx | 2 +- .../tools/__tests__/tool_slot_edit_components_test.tsx | 1 + frontend/farm_designer/tools/index.tsx | 6 ++++-- .../farm_designer/tools/tool_slot_edit_components.tsx | 7 +++++-- 8 files changed, 27 insertions(+), 13 deletions(-) diff --git a/frontend/css/farm_designer/farm_designer_panels.scss b/frontend/css/farm_designer/farm_designer_panels.scss index a915f1f5e..6c5a5614d 100644 --- a/frontend/css/farm_designer/farm_designer_panels.scss +++ b/frontend/css/farm_designer/farm_designer_panels.scss @@ -552,7 +552,7 @@ } .tool-slots-panel-content, .tools-panel-content { - max-height: calc(100vh - 15rem); + max-height: calc(100vh - 19rem); overflow-y: auto; overflow-x: hidden; .tool-search-item, @@ -582,7 +582,7 @@ } } i { - line-height: 2.5rem; + line-height: 2rem; } } svg { diff --git a/frontend/devices/components/fbos_settings/fbos_details.tsx b/frontend/devices/components/fbos_settings/fbos_details.tsx index c4b138cbd..10cee6822 100644 --- a/frontend/devices/components/fbos_settings/fbos_details.tsx +++ b/frontend/devices/components/fbos_settings/fbos_details.tsx @@ -55,21 +55,24 @@ export function ChipTemperatureDisplay( interface WiFiStrengthDisplayProps { wifiStrength: number | undefined; wifiStrengthPercent?: number | undefined; + extraInfo?: boolean; } /** WiFi signal strength display row: label, strength, indicator. */ export function WiFiStrengthDisplay( - { wifiStrength, wifiStrengthPercent }: WiFiStrengthDisplayProps + { wifiStrength, wifiStrengthPercent, extraInfo }: WiFiStrengthDisplayProps ): JSX.Element { const percent = wifiStrength ? Math.round(-0.0154 * wifiStrength ** 2 - 0.4 * wifiStrength + 98) : 0; const dbString = `${wifiStrength || 0}dBm`; const percentString = `${wifiStrengthPercent || percent}%`; + const numberDisplay = + extraInfo ? `${percentString} (${dbString})` : percentString; return

{t("WiFi strength")}: - {wifiStrength ? `${dbString} (${percentString})` : "N/A"} + {wifiStrength ? numberDisplay : "N/A"}

{wifiStrength &&
@@ -287,7 +290,7 @@ export function FbosDetails(props: FbosDetailsProps) { {isNumber(disk_usage) &&

{t("Disk usage")}: {disk_usage}%

} {isNumber(cpu_usage) &&

{t("CPU usage")}: {cpu_usage}%

} - @@ -42,7 +44,8 @@ export class Connectivity
- +
diff --git a/frontend/devices/pin_bindings/__tests__/list_and_label_support_test.tsx b/frontend/devices/pin_bindings/__tests__/list_and_label_support_test.tsx index 6742019cf..24a8443b6 100644 --- a/frontend/devices/pin_bindings/__tests__/list_and_label_support_test.tsx +++ b/frontend/devices/pin_bindings/__tests__/list_and_label_support_test.tsx @@ -1,4 +1,6 @@ -import { sortByNameAndPin, ButtonPin, getSpecialActionLabel } from "../list_and_label_support"; +import { + sortByNameAndPin, ButtonPin, getSpecialActionLabel +} from "../list_and_label_support"; import { PinBindingSpecialAction } from "farmbot/dist/resources/api_resources"; describe("sortByNameAndPin()", () => { diff --git a/frontend/devices/pin_bindings/list_and_label_support.tsx b/frontend/devices/pin_bindings/list_and_label_support.tsx index ddc7be7c6..5d803b118 100644 --- a/frontend/devices/pin_bindings/list_and_label_support.tsx +++ b/frontend/devices/pin_bindings/list_and_label_support.tsx @@ -92,7 +92,7 @@ export const reservedPiGPIO = piI2c0Pins; const GPIO_PIN_LABELS = (): { [x: number]: string } => ({ [ButtonPin.estop]: t("Button {{ num }}: E-STOP", { num: 1 }), [ButtonPin.unlock]: t("Button {{ num }}: UNLOCK", { num: 2 }), - [ButtonPin.btn3]: t("Button {{ num }})", { num: 3 }), + [ButtonPin.btn3]: t("Button {{ num }}", { num: 3 }), [ButtonPin.btn4]: t("Button {{ num }}", { num: 4 }), [ButtonPin.btn5]: t("Button {{ num }}", { num: 5 }), }); diff --git a/frontend/farm_designer/tools/__tests__/tool_slot_edit_components_test.tsx b/frontend/farm_designer/tools/__tests__/tool_slot_edit_components_test.tsx index e75dbf479..1ee855342 100644 --- a/frontend/farm_designer/tools/__tests__/tool_slot_edit_components_test.tsx +++ b/frontend/farm_designer/tools/__tests__/tool_slot_edit_components_test.tsx @@ -62,6 +62,7 @@ describe("", () => { onChange: jest.fn(), filterSelectedTool: false, isActive: jest.fn(), + filterActiveTools: true, }); it("renders", () => { diff --git a/frontend/farm_designer/tools/index.tsx b/frontend/farm_designer/tools/index.tsx index 3e4adbb4b..222c4face 100644 --- a/frontend/farm_designer/tools/index.tsx +++ b/frontend/farm_designer/tools/index.tsx @@ -137,7 +137,8 @@ export class RawTools extends React.Component { this.props.dispatch(save(this.props.device.uuid)); }} isActive={this.props.isActive} - filterSelectedTool={true} /> + filterSelectedTool={true} + filterActiveTools={false} />

{t("status")}: {toolStatus(this.toolVerificationValue)}

diff --git a/frontend/farm_designer/tools/tool_slot_edit_components.tsx b/frontend/farm_designer/tools/tool_slot_edit_components.tsx index cf63a55e1..903088e82 100644 --- a/frontend/farm_designer/tools/tool_slot_edit_components.tsx +++ b/frontend/farm_designer/tools/tool_slot_edit_components.tsx @@ -57,6 +57,7 @@ export interface ToolSelectionProps { onChange(update: { tool_id: number }): void; filterSelectedTool: boolean; isActive(id: number | undefined): boolean; + filterActiveTools: boolean; } export const ToolSelection = (props: ToolSelectionProps) => @@ -64,7 +65,8 @@ export const ToolSelection = (props: ToolSelectionProps) => list={([NULL_CHOICE] as DropDownItem[]).concat(props.tools .filter(tool => !props.filterSelectedTool || tool.body.id != props.selectedTool?.body.id) - .filter(tool => !props.isActive(tool.body.id)) + .filter(tool => !props.filterActiveTools + || !props.isActive(tool.body.id)) .map(tool => ({ label: tool.body.name || "untitled", value: tool.body.id || 0, @@ -100,7 +102,8 @@ export const ToolInputRow = (props: ToolInputRowProps) => selectedTool={props.selectedTool} onChange={props.onChange} isActive={props.isActive} - filterSelectedTool={false} /> + filterSelectedTool={false} + filterActiveTools={true} />
;