How to use the farmbot.SpecialStatus.SAVED function in farmbot

To help you get started, we’ve selected a few farmbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FarmBot / Farmbot-Web-App / frontend / __test_support__ / user.ts View on Github external
import { User } from "farmbot/dist/resources/api_resources";
import { TaggedUser, SpecialStatus } from "farmbot";

export const user: User = {
  created_at: "2016-10-05T03:02:58.000Z",
  email: "farmbot1@farmbot.io",
  id: 2,
  name: "FarmBot 1",
  updated_at: "2017-08-04T19:53:29.724Z"
};

export const taggedUser: TaggedUser = {
  kind: "User",
  uuid: "1234-5678",
  specialStatus: SpecialStatus.SAVED,
  body: {
    created_at: "2016-10-05T03:02:58.000Z",
    email: "farmbot1@farmbot.io",
    id: 2,
    name: "FarmBot 1",
    updated_at: "2017-08-04T19:53:29.724Z"
  }
};
github FarmBot / Farmbot-Web-App / frontend / __test_support__ / fake_state / images.ts View on Github external
"device_id": 8,
      "attachment_processed_at": "2017-06-01T14:16:45.899Z",
      "updated_at": "2017-06-01T14:16:45.903Z",
      "created_at": "2017-06-01T14:14:22.747Z",
      "attachment_url": "imgur.com",
      "meta": {
        "x": 632,
        "y": 347,
        "z": 164
      }
    },
    "uuid": "Image.8.4"
  },
  {
    "kind": "Image",
    "specialStatus": SpecialStatus.SAVED,
    "body": {
      "id": 7,
      "device_id": 8,
      "attachment_processed_at": "2017-06-01T14:16:34.839Z",
      "updated_at": "2017-06-01T14:16:34.984Z",
      "created_at": "2017-06-01T14:14:22.726Z",
      "attachment_url": "imgur.com",
      "meta": {
        "x": 266,
        "y": 330,
        "z": 53
      }
    },
    "uuid": "Image.7.5"
  }
];
github FarmBot / Farmbot-Web-App / frontend / __test_support__ / resource_index_builder.ts View on Github external
};

export function fakeDevice(body: Partial = {}):
  TaggedDevice {

  return {
    "kind": "Device",
    "specialStatus": SpecialStatus.SAVED,
    "body": { ...DEFAULT_DEVICE_BODY, ...body },
    "uuid": "Device.415.0"
  };
}

const tr0: TaggedResource = {
  "kind": "Sequence",
  "specialStatus": SpecialStatus.SAVED,
  "body": {
    "id": 23,
    "name": "Goto 0, 0, 0",
    "color": "gray",
    "folder_id": undefined,
    "body": [
      {
        "kind": "move_absolute",
        "args": {
          "location": {
            "kind": "coordinate",
            "args": {
              "x": 0,
              "y": 0,
              "z": 0
            }
github FarmBot / Farmbot-Web-App / frontend / resources / reducer.ts View on Github external
.add(Actions.SAVE_RESOURCE_OK, (s, { payload }) => {
      indexUpsert(s.index, [payload], "ongoing");
      mutateSpecialStatus(payload.uuid, s.index, SpecialStatus.SAVED);
      return s;
    })
    .add(Actions.EDIT_RESOURCE, (s, { payload }) => {
github FarmBot / Farmbot-Web-App / webpack / resources / tagged_resources.ts View on Github external
export function getArrayStatus(i: TaggedResource[]): SpecialStatus {
  const r = betterCompact(_(i).map(x => x.specialStatus).uniq().value());
  if (r.length) {
    return (r.includes(SpecialStatus.SAVING)) ?
      SpecialStatus.SAVING : SpecialStatus.DIRTY;
  } else {
    return SpecialStatus.SAVED;
  }
}
github FarmBot / Farmbot-Web-App / frontend / resources / selectors_by_kind.ts View on Github external
const isSaved = (t: T) =>
  t.specialStatus === SpecialStatus.SAVED;
github FarmBot / Farmbot-Web-App / frontend / connectivity / auto_sync.ts View on Github external
(d: UpdateMqttData, uuid: string) => {
    const tr = asTaggedResource(d);
    tr.uuid = uuid;
    return overwrite(tr, tr.body, SpecialStatus.SAVED);
  };
github FarmBot / Farmbot-Web-App / frontend / resources / tagged_resources.ts View on Github external
export function getArrayStatus(i: TaggedResource[]): SpecialStatus {
  const r = betterCompact(chain(i).map(x => x.specialStatus).uniq().value());
  if (r.length) {
    return (r.includes(SpecialStatus.SAVING)) ?
      SpecialStatus.SAVING : SpecialStatus.DIRTY;
  } else {
    return SpecialStatus.SAVED;
  }
}
github FarmBot / Farmbot-Web-App / frontend / farm_designer / farm_events / edit_fe_form.tsx View on Github external
.then(() => {
        this.setState({ specialStatusLocal: SpecialStatus.SAVED });
        this.dispatch(maybeWarnAboutMissedTasks(this.props.farmEvent,
          () => alert(t(Content.REGIMEN_TODAY_SKIPPED_ITEM_RISK)), now));
        this.nextRunTimeActions(now);
        history.push("/app/designer/events");
      })
      .catch(() => {
github FarmBot / Farmbot-Web-App / webpack / resources / reducer.ts View on Github external
.add(Actions.SAVE_RESOURCE_OK, (s, { payload }) => {
      indexUpsert(s.index, [payload], "ongoing");
      mutateSpecialStatus(payload.uuid, s.index, SpecialStatus.SAVED);
      return s;
    })
    .add(Actions.EDIT_RESOURCE, (s, { payload }) => {