Merge pull request #987 from gabrielburnworth/staging

Misc
pull/988/head
Rick Carlino 2018-09-14 15:46:10 -05:00 committed by GitHub
commit 76606073b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 60 additions and 38 deletions

View File

@ -37,7 +37,8 @@ export namespace ToolTips {
few sequences to verify that everything works as expected.`);
export const PIN_BINDINGS =
trim(`Assign a sequence to execute when a Raspberry Pi GPIO pin is activated.`);
trim(`Assign a sequence to execute when a Raspberry Pi GPIO pin is
activated.`);
export const PIN_BINDING_WARNING =
trim(`Warning: Binding to a pin without a physical button and
@ -49,10 +50,10 @@ export namespace ToolTips {
// Hardware Settings: Homing and Calibration
export const HOMING =
trim(`(Alpha) If encoders or end-stops are enabled, home axis (find zero).`);
trim(`If encoders or end-stops are enabled, home axis (find zero).`);
export const CALIBRATION =
trim(`(Alpha) If encoders or end-stops are enabled, home axis and determine
trim(`If encoders or end-stops are enabled, home axis and determine
maximum.`);
export const SET_ZERO_POSITION =
@ -107,8 +108,8 @@ export namespace ToolTips {
trim(`The number of motor steps required to move the axis one millimeter.`);
export const ALWAYS_POWER_MOTORS =
trim(`Keep power applied to motors. Prevents slipping from gravity in certain
situations.`);
trim(`Keep power applied to motors. Prevents slipping from gravity in
certain situations.`);
export const INVERT_MOTORS =
trim(`Invert direction of motor during calibration.`);
@ -118,23 +119,23 @@ export namespace ToolTips {
// Hardware Settings: Encoders and Endstops
export const ENABLE_ENCODERS =
trim(`(Alpha) Enable use of rotary encoders during calibration and homing.`);
trim(`Enable use of rotary encoders during calibration and homing.`);
export const ENCODER_POSITIONING =
trim(`[EXPERIMENTAL] Use encoders for positioning.`);
trim(`Use encoders for positioning.`);
export const INVERT_ENCODERS =
trim(`(Alpha) Reverse the direction of encoder position reading.`);
trim(`Reverse the direction of encoder position reading.`);
export const MAX_MISSED_STEPS =
trim(`(Alpha) Number of steps missed (determined by encoder) before motor is
trim(`Number of steps missed (determined by encoder) before motor is
considered to have stalled.`);
export const ENCODER_MISSED_STEP_DECAY =
trim(`(Alpha) Reduction to missed step total for every good step.`);
trim(`Reduction to missed step total for every good step.`);
export const ENCODER_SCALING =
trim(`(Alpha) encoder scaling factor = 10000 * (motor resolution * microsteps)
trim(`encoder scaling factor = 10000 * (motor resolution * microsteps)
/ (encoder resolution).`);
export const ENABLE_ENDSTOPS =
@ -254,6 +255,12 @@ export namespace ToolTips {
trim(`Snaps a photo using the device camera. Select the camera type on the
Device page.`);
export const MARK_AS =
trim(`The Mark As step allows FarmBot to programmatically edit the
properties of the UTM, plants, and weeds from within a sequence.
For example, you can mark a plant as "planted" during a seeding
sequence or delete a weed after removing it.`);
// Regimens
export const BULK_SCHEDULER =
trim(`Add sequences to your regimen by selecting a sequence from the
@ -522,8 +529,8 @@ export namespace Content {
click "+" in the Regimens panel to create a new one.`);
export const NO_PARAMETERS = trim(`Can't directly use this sequence in a
regimen. Consider wrapping it in a parent sequence that calls it via "execute"
instead."`);
regimen. Consider wrapping it in a parent sequence that calls it via
"execute" instead.`);
// Farm Designer
export const OUTSIDE_PLANTING_AREA =
@ -538,6 +545,10 @@ export namespace Content {
trim(`Click and drag to draw a point or use the inputs and press
update. Press CREATE POINT to save, or the back arrow to exit.`);
export const BOX_SELECT_DESCRIPTION =
trim(`Drag a box around the plants you would like to select.
Press the back arrow to exit.`);
// Farm Events
export const REGIMEN_TODAY_SKIPPED_ITEM_RISK =
trim(`You are scheduling a regimen to run today. Be aware that

View File

@ -97,7 +97,7 @@ export class Peripherals extends React.Component<PeripheralsProps, PeripheralSta
<button
className="fb-button gray"
onClick={this.toggle}
hidden={!!status && isEditing}>
disabled={!!status && isEditing}>
{!isEditing && t("Edit")}
{isEditing && t("Back")}
</button>

View File

@ -85,7 +85,7 @@ export class Sensors extends React.Component<SensorsProps, SensorState> {
<button
className="fb-button gray"
onClick={this.toggle}
hidden={!!status && isEditing}>
disabled={!!status && isEditing}>
{!isEditing && t("Edit")}
{isEditing && t("Back")}
</button>

View File

@ -27,7 +27,7 @@ describe("<WebcamPanel/>", () => {
wrapper.setState({ activeMenu: "edit" });
const text = allButtonText(wrapper);
expect(text.toLowerCase()).not.toContain("edit");
clickButton(wrapper, 2, "view");
clickButton(wrapper, 0, "back");
expect(wrapper.instance().state.activeMenu).toEqual("show");
});
});

View File

@ -30,9 +30,10 @@ export function Edit(props: WebcamPanelProps) {
return <Widget>
<WidgetHeader title="Edit" helpText={ToolTips.WEBCAM}>
<button
className="fb-button green"
onClick={props.init}>
<i className="fa fa-plus" />
className="fb-button gray"
disabled={unsaved.length > 0}
onClick={props.onToggle}>
{t("Back")}
</button>
<button
className="fb-button green"
@ -40,9 +41,9 @@ export function Edit(props: WebcamPanelProps) {
{t("Save")}{unsaved.length > 0 ? "*" : ""}
</button>
<button
className="fb-button gray"
onClick={props.onToggle}>
{t("View")}
className="fb-button green"
onClick={props.init}>
<i className="fa fa-plus" />
</button>
</WidgetHeader>
<div className="widget-body">

View File

@ -194,6 +194,9 @@ a {
cursor: pointer !important;
&.fa-gear {
color: $white;
&.dark {
color: $dark_gray;
}
}
}
@ -808,7 +811,8 @@ ul {
max-width: 250px;
h1 {
font-weight: 300;
font-size: 1.5rem;
font-size: 1.4rem;
line-height: 2rem;
}
li:before {
content: "";

View File

@ -50,8 +50,10 @@ describe("<FarmbotOsSettings/>", () => {
{...fakeProps()} />);
await expect(axios.get).toHaveBeenCalledWith(
expect.stringContaining("RELEASE_NOTES.md"));
expect(osSettings.instance().state.osReleaseNotesHeading)
.toEqual("FarmBot OS v6");
expect(osSettings.instance().state.osReleaseNotes)
.toEqual("# FarmBot OS v6\n* note");
.toEqual("* note");
});
it("doesn't fetch OS release notes", async () => {

View File

@ -37,7 +37,7 @@ const OS_RELEASE_NOTES_URL =
export class FarmbotOsSettings
extends React.Component<FarmbotOsProps, FarmbotOsState> {
state = { osReleaseNotes: "" };
state = { osReleaseNotesHeading: "", osReleaseNotes: "" };
componentDidMount() {
this.fetchReleaseNotes(OS_RELEASE_NOTES_URL,
@ -49,12 +49,12 @@ export class FarmbotOsSettings
axios
.get<string>(url)
.then(resp => {
const notes = resp.data
const osReleaseNotes = resp.data
.split("# v")
.filter(x => x.startsWith(osMajorVersion))[0]
.split("\n\n").join("\n");
const osReleaseNotes = "# FarmBot OS v" + notes;
this.setState({ osReleaseNotes });
.split("\n\n").slice(1).join("\n");
const osReleaseNotesHeading = "FarmBot OS v" + osMajorVersion;
this.setState({ osReleaseNotesHeading, osReleaseNotes });
})
.catch(() =>
this.setState({ osReleaseNotes: "Could not get release notes." }));
@ -142,6 +142,7 @@ export class FarmbotOsSettings
|| this.props.isValidFbosConfig}>
<FarmbotOsRow
bot={this.props.bot}
osReleaseNotesHeading={this.state.osReleaseNotesHeading}
osReleaseNotes={this.state.osReleaseNotes}
dispatch={this.props.dispatch}
sourceFbosConfig={sourceFbosConfig}

View File

@ -9,6 +9,7 @@ describe("<FarmbotOsRow/>", () => {
const fakeProps = (): FarmbotOsRowProps => {
return {
bot,
osReleaseNotesHeading: "",
osReleaseNotes: "",
dispatch: jest.fn(x => x(jest.fn(), fakeState)),
sourceFbosConfig: (x) => {

View File

@ -40,6 +40,7 @@ export function FarmbotOsRow(props: FarmbotOsRowProps) {
<i className="fa fa-caret-down" />
</p>
<div className="release-notes">
<h1>{props.osReleaseNotesHeading}</h1>
<Markdown>
{osReleaseNotes}
</Markdown>

View File

@ -45,6 +45,7 @@ export interface FactoryResetRowProps {
export interface FarmbotOsRowProps {
bot: BotState;
osReleaseNotesHeading: string;
osReleaseNotes: string;
dispatch: Function;
sourceFbosConfig: SourceFbosConfig;

View File

@ -160,6 +160,7 @@ export interface FarmbotOsProps {
}
export interface FarmbotOsState {
osReleaseNotesHeading: string;
osReleaseNotes: string;
}

View File

@ -7,7 +7,7 @@ import { PlantInventoryItem } from "./plant_inventory_item";
import { destroy } from "../../api/crud";
import { BackArrow } from "../../ui/index";
import { unselectPlant } from "../actions";
import { Actions } from "../../constants";
import { Actions, Content } from "../../constants";
import { TaggedPlant } from "../map/interfaces";
import { getPlants } from "../state_to_props";
@ -113,8 +113,7 @@ export class SelectPlants
</div>
<div className="panel-header-description">
{t("Drag a box around the plants you would like to select. " +
"Press the back arrow to exit.")}
{t(Content.BOX_SELECT_DESCRIPTION)}
</div>
</div>

View File

@ -91,7 +91,7 @@ export class FarmwareList
return <div>
<div className="farmware-settings-menu">
<Popover position={Position.BOTTOM_RIGHT}>
<i className="fa fa-gear" />
<i className="fa fa-gear dark" />
<FarmwareConfigMenu
show={this.props.showFirstParty}
dispatch={this.props.dispatch}

View File

@ -121,7 +121,7 @@ export function CreateAccount(props: CreateAccountProps) {
const RelevantForm = props.sent ? DidRegister : MustRegister;
return <Col xs={12} sm={5}>
<Widget>
<WidgetHeader title={"Create An Account"} />
<WidgetHeader title={t("Create An Account")} />
<RelevantForm {...props} />
</Widget>
</Col>;

View File

@ -35,7 +35,7 @@ export class MarkAs extends React.Component<StepParams, MarkAsState> {
return <StepWrapper>
<StepHeader
className={this.className}
helpText={ToolTips.WAIT}
helpText={ToolTips.MARK_AS}
currentSequence={this.props.currentSequence}
currentStep={this.props.currentStep}
dispatch={this.props.dispatch}

View File

@ -101,7 +101,7 @@ export class TosUpdate extends React.Component<Props, Partial<State>> {
logInit();
const body = t("Before logging in, you must agree to our latest Terms" +
" of Service and Privacy Policy");
log(body, "New Terms of Service");
log(body, t("New Terms of Service"));
}
render() {
@ -110,8 +110,8 @@ export class TosUpdate extends React.Component<Props, Partial<State>> {
<Widget>
<WidgetHeader title={
this.tosLoadOk
? "Agree to Terms of Service"
: "Problem Loading Terms of Service"} />
? t("Agree to Terms of Service")
: t("Problem Loading Terms of Service")} />
<WidgetBody>
{this.tosForm()}
</WidgetBody>