Merge pull request #1715 from FarmBot/minor-fixes

Minor bug fixes and upgrades
days_ago
Rick Carlino 2020-02-24 10:19:51 -08:00 committed by GitHub
commit 8e0cf2603c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 25 deletions

View File

@ -552,7 +552,7 @@
} }
.tool-slots-panel-content, .tool-slots-panel-content,
.tools-panel-content { .tools-panel-content {
max-height: calc(100vh - 15rem); max-height: calc(100vh - 19rem);
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
.tool-search-item, .tool-search-item,
@ -582,7 +582,7 @@
} }
} }
i { i {
line-height: 2.5rem; line-height: 2rem;
} }
} }
svg { svg {

View File

@ -55,21 +55,24 @@ export function ChipTemperatureDisplay(
interface WiFiStrengthDisplayProps { interface WiFiStrengthDisplayProps {
wifiStrength: number | undefined; wifiStrength: number | undefined;
wifiStrengthPercent?: number | undefined; wifiStrengthPercent?: number | undefined;
extraInfo?: boolean;
} }
/** WiFi signal strength display row: label, strength, indicator. */ /** WiFi signal strength display row: label, strength, indicator. */
export function WiFiStrengthDisplay( export function WiFiStrengthDisplay(
{ wifiStrength, wifiStrengthPercent }: WiFiStrengthDisplayProps { wifiStrength, wifiStrengthPercent, extraInfo }: WiFiStrengthDisplayProps
): JSX.Element { ): JSX.Element {
const percent = wifiStrength const percent = wifiStrength
? Math.round(-0.0154 * wifiStrength ** 2 - 0.4 * wifiStrength + 98) ? Math.round(-0.0154 * wifiStrength ** 2 - 0.4 * wifiStrength + 98)
: 0; : 0;
const dbString = `${wifiStrength || 0}dBm`; const dbString = `${wifiStrength || 0}dBm`;
const percentString = `${wifiStrengthPercent || percent}%`; const percentString = `${wifiStrengthPercent || percent}%`;
const numberDisplay =
extraInfo ? `${percentString} (${dbString})` : percentString;
return <div className="wifi-strength-display"> return <div className="wifi-strength-display">
<p> <p>
<b>{t("WiFi strength")}: </b> <b>{t("WiFi strength")}: </b>
{wifiStrength ? `${dbString} (${percentString})` : "N/A"} {wifiStrength ? numberDisplay : "N/A"}
</p> </p>
{wifiStrength && {wifiStrength &&
<div className="percent-bar"> <div className="percent-bar">
@ -287,7 +290,7 @@ export function FbosDetails(props: FbosDetailsProps) {
{isNumber(disk_usage) && <p><b>{t("Disk usage")}: </b>{disk_usage}%</p>} {isNumber(disk_usage) && <p><b>{t("Disk usage")}: </b>{disk_usage}%</p>}
{isNumber(cpu_usage) && <p><b>{t("CPU usage")}: </b>{cpu_usage}%</p>} {isNumber(cpu_usage) && <p><b>{t("CPU usage")}: </b>{cpu_usage}%</p>}
<ChipTemperatureDisplay chip={target} temperature={soc_temp} /> <ChipTemperatureDisplay chip={target} temperature={soc_temp} />
<WiFiStrengthDisplay <WiFiStrengthDisplay extraInfo={true}
wifiStrength={wifi_level} wifiStrengthPercent={wifi_level_percent} /> wifiStrength={wifi_level} wifiStrengthPercent={wifi_level_percent} />
<VoltageDisplay chip={target} throttled={throttled} /> <VoltageDisplay chip={target} throttled={throttled} />
<BetaReleaseOptIn <BetaReleaseOptIn

View File

@ -31,7 +31,9 @@ export class Connectivity
render() { render() {
const { informational_settings } = this.props.bot.hardware; const { informational_settings } = this.props.bot.hardware;
const { soc_temp, wifi_level, throttled } = informational_settings; const {
soc_temp, wifi_level, throttled, wifi_level_percent
} = informational_settings;
return <div className="connectivity"> return <div className="connectivity">
<Row> <Row>
<Col md={12} lg={4}> <Col md={12} lg={4}>
@ -42,7 +44,8 @@ export class Connectivity
<div className="fbos-info"> <div className="fbos-info">
<label>{t("Raspberry Pi Info")}</label> <label>{t("Raspberry Pi Info")}</label>
<ChipTemperatureDisplay temperature={soc_temp} /> <ChipTemperatureDisplay temperature={soc_temp} />
<WiFiStrengthDisplay wifiStrength={wifi_level} /> <WiFiStrengthDisplay wifiStrength={wifi_level}
wifiStrengthPercent={wifi_level_percent} />
<VoltageDisplay throttled={throttled} /> <VoltageDisplay throttled={throttled} />
</div> </div>
<QosPanel pings={this.props.pings} /> <QosPanel pings={this.props.pings} />

View File

@ -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"; import { PinBindingSpecialAction } from "farmbot/dist/resources/api_resources";
describe("sortByNameAndPin()", () => { describe("sortByNameAndPin()", () => {

View File

@ -92,7 +92,7 @@ export const reservedPiGPIO = piI2c0Pins;
const GPIO_PIN_LABELS = (): { [x: number]: string } => ({ const GPIO_PIN_LABELS = (): { [x: number]: string } => ({
[ButtonPin.estop]: t("Button {{ num }}: E-STOP", { num: 1 }), [ButtonPin.estop]: t("Button {{ num }}: E-STOP", { num: 1 }),
[ButtonPin.unlock]: t("Button {{ num }}: UNLOCK", { num: 2 }), [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.btn4]: t("Button {{ num }}", { num: 4 }),
[ButtonPin.btn5]: t("Button {{ num }}", { num: 5 }), [ButtonPin.btn5]: t("Button {{ num }}", { num: 5 }),
}); });

View File

@ -62,6 +62,7 @@ describe("<ToolSelection />", () => {
onChange: jest.fn(), onChange: jest.fn(),
filterSelectedTool: false, filterSelectedTool: false,
isActive: jest.fn(), isActive: jest.fn(),
filterActiveTools: true,
}); });
it("renders", () => { it("renders", () => {

View File

@ -137,7 +137,8 @@ export class RawTools extends React.Component<ToolsProps, ToolsState> {
this.props.dispatch(save(this.props.device.uuid)); this.props.dispatch(save(this.props.device.uuid));
}} }}
isActive={this.props.isActive} isActive={this.props.isActive}
filterSelectedTool={true} /> filterSelectedTool={true}
filterActiveTools={false} />
<div className="tool-verification-status"> <div className="tool-verification-status">
<p>{t("status")}: {toolStatus(this.toolVerificationValue)}</p> <p>{t("status")}: {toolStatus(this.toolVerificationValue)}</p>
<button <button
@ -281,7 +282,8 @@ export const ToolSlotInventoryItem = (props: ToolSlotInventoryItemProps) => {
props.dispatch(save(props.toolSlot.uuid)); props.dispatch(save(props.toolSlot.uuid));
}} }}
isActive={props.isActive} isActive={props.isActive}
filterSelectedTool={false} /> filterSelectedTool={false}
filterActiveTools={true} />
</div> </div>
</Col> </Col>
<Col xs={4} className={"tool-slot-position-info"}> <Col xs={4} className={"tool-slot-position-info"}>

View File

@ -57,6 +57,7 @@ export interface ToolSelectionProps {
onChange(update: { tool_id: number }): void; onChange(update: { tool_id: number }): void;
filterSelectedTool: boolean; filterSelectedTool: boolean;
isActive(id: number | undefined): boolean; isActive(id: number | undefined): boolean;
filterActiveTools: boolean;
} }
export const ToolSelection = (props: ToolSelectionProps) => export const ToolSelection = (props: ToolSelectionProps) =>
@ -64,7 +65,8 @@ export const ToolSelection = (props: ToolSelectionProps) =>
list={([NULL_CHOICE] as DropDownItem[]).concat(props.tools list={([NULL_CHOICE] as DropDownItem[]).concat(props.tools
.filter(tool => !props.filterSelectedTool .filter(tool => !props.filterSelectedTool
|| tool.body.id != props.selectedTool?.body.id) || 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 => ({ .map(tool => ({
label: tool.body.name || "untitled", label: tool.body.name || "untitled",
value: tool.body.id || 0, value: tool.body.id || 0,
@ -100,7 +102,8 @@ export const ToolInputRow = (props: ToolInputRowProps) =>
selectedTool={props.selectedTool} selectedTool={props.selectedTool}
onChange={props.onChange} onChange={props.onChange}
isActive={props.isActive} isActive={props.isActive}
filterSelectedTool={false} /> filterSelectedTool={false}
filterActiveTools={true} />
</Col> </Col>
</Row> </Row>
</div>; </div>;

View File

@ -24,18 +24,18 @@
"author": "farmbot.io", "author": "farmbot.io",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/core": "7.8.3", "@babel/core": "7.8.4",
"@blueprintjs/core": "3.23.1", "@blueprintjs/core": "3.23.1",
"@blueprintjs/datetime": "3.15.2", "@blueprintjs/datetime": "3.15.2",
"@blueprintjs/select": "3.11.2", "@blueprintjs/select": "3.11.2",
"@types/enzyme": "3.10.4", "@types/enzyme": "3.10.5",
"@types/jest": "24.9.1", "@types/jest": "25.1.3",
"@types/lodash": "4.14.149", "@types/lodash": "4.14.149",
"@types/markdown-it": "0.0.9", "@types/markdown-it": "0.0.9",
"@types/moxios": "0.4.9", "@types/moxios": "0.4.9",
"@types/node": "13.5.0", "@types/node": "13.7.4",
"@types/promise-timeout": "1.3.0", "@types/promise-timeout": "1.3.0",
"@types/react": "16.9.19", "@types/react": "16.9.22",
"@types/react-color": "3.0.1", "@types/react-color": "3.0.1",
"@types/react-dom": "16.9.5", "@types/react-dom": "16.9.5",
"@types/react-redux": "7.1.7", "@types/react-redux": "7.1.7",
@ -46,7 +46,7 @@
"enzyme": "3.11.0", "enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2", "enzyme-adapter-react-16": "1.15.2",
"farmbot": "9.1.2", "farmbot": "9.1.2",
"i18next": "19.0.3", "i18next": "19.3.1",
"install": "0.13.0", "install": "0.13.0",
"lodash": "4.17.15", "lodash": "4.17.15",
"markdown-it": "10.0.0", "markdown-it": "10.0.0",
@ -54,7 +54,7 @@
"moment": "2.24.0", "moment": "2.24.0",
"moxios": "0.4.0", "moxios": "0.4.0",
"mqtt": "3.0.0", "mqtt": "3.0.0",
"npm": "6.13.6", "npm": "6.13.7",
"parcel-bundler": "1.12.4", "parcel-bundler": "1.12.4",
"promise-timeout": "1.3.0", "promise-timeout": "1.3.0",
"raf": "3.4.1", "raf": "3.4.1",
@ -63,7 +63,7 @@
"react-color": "2.18.0", "react-color": "2.18.0",
"react-dom": "16.12.0", "react-dom": "16.12.0",
"react-joyride": "2.2.1", "react-joyride": "2.2.1",
"react-redux": "7.1.3", "react-redux": "7.2.0",
"react-test-renderer": "16.12.0", "react-test-renderer": "16.12.0",
"react-transition-group": "4.3.0", "react-transition-group": "4.3.0",
"redux": "4.0.5", "redux": "4.0.5",
@ -71,10 +71,10 @@
"redux-thunk": "2.3.0", "redux-thunk": "2.3.0",
"sass-lint": "1.13.1", "sass-lint": "1.13.1",
"takeme": "0.11.3", "takeme": "0.11.3",
"ts-jest": "25.0.0", "ts-jest": "25.2.1",
"ts-lint": "4.5.1", "ts-lint": "4.5.1",
"tslint": "6.0.0", "tslint": "6.0.0",
"typescript": "3.7.5", "typescript": "3.8.2",
"which": "2.0.2" "which": "2.0.2"
}, },
"devDependencies": { "devDependencies": {
@ -83,7 +83,7 @@
"jest-junit": "10.0.0", "jest-junit": "10.0.0",
"jest-skipped-reporter": "0.0.5", "jest-skipped-reporter": "0.0.5",
"jshint": "2.11.0", "jshint": "2.11.0",
"madge": "3.6.0", "madge": "3.7.0",
"sass": "1.25.0" "sass": "1.25.0"
} }
} }

View File

@ -1,6 +1,5 @@
{ {
"compilerOptions": { "compilerOptions": {
"incremental": true,
"lib": [ "lib": [
"es7", "es7",
"dom", "dom",