2017-06-29 12:54:02 -06:00
|
|
|
import { Everything } from "../../interfaces";
|
|
|
|
import { buildResourceIndex } from "../resource_index_builder";
|
2017-07-30 16:12:01 -06:00
|
|
|
import {
|
|
|
|
TaggedFarmEvent, TaggedSequence, TaggedRegimen, TaggedImage,
|
2017-08-24 22:37:24 -06:00
|
|
|
TaggedTool, TaggedToolSlotPointer, TaggedUser, TaggedWebcamFeed, TaggedPlantPointer
|
2017-07-30 16:12:01 -06:00
|
|
|
} from "../../resources/tagged_resources";
|
2017-07-26 13:30:22 -06:00
|
|
|
import { ExecutableType } from "../../farm_designer/interfaces";
|
2017-07-27 08:34:52 -06:00
|
|
|
import { fakeResource } from "../fake_resource";
|
2017-06-29 12:54:02 -06:00
|
|
|
|
|
|
|
export let resources: Everything["resources"] = buildResourceIndex();
|
2017-08-21 09:45:13 -06:00
|
|
|
let idCounter = 1;
|
2017-07-26 13:30:22 -06:00
|
|
|
|
2017-07-26 14:18:28 -06:00
|
|
|
export function fakeSequence(): TaggedSequence {
|
2017-07-27 08:34:52 -06:00
|
|
|
return fakeResource("sequences", {
|
|
|
|
args: { version: 4 },
|
|
|
|
id: 12,
|
|
|
|
color: "red",
|
|
|
|
name: "fake",
|
|
|
|
kind: "sequence",
|
|
|
|
body: []
|
|
|
|
});
|
2017-07-26 14:18:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export function fakeRegimen(): TaggedRegimen {
|
2017-07-27 08:34:52 -06:00
|
|
|
return fakeResource("regimens", {
|
|
|
|
name: "Foo",
|
|
|
|
color: "red",
|
|
|
|
regimen_items: []
|
|
|
|
});
|
2017-07-26 14:18:28 -06:00
|
|
|
}
|
|
|
|
|
2017-07-26 13:30:22 -06:00
|
|
|
export function fakeFarmEvent(exe_type: ExecutableType,
|
|
|
|
exe_id: number): TaggedFarmEvent {
|
2017-07-27 08:34:52 -06:00
|
|
|
return fakeResource("farm_events", {
|
|
|
|
"id": 21,
|
|
|
|
"start_time": "2017-05-22T05:00:00.000Z",
|
|
|
|
"end_time": "2017-05-30T05:00:00.000Z",
|
|
|
|
"repeat": 1,
|
|
|
|
"time_unit": "never",
|
|
|
|
"executable_id": exe_id,
|
|
|
|
"executable_type": exe_type,
|
|
|
|
"calendar": []
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function fakeImage(): TaggedImage {
|
|
|
|
return fakeResource("images", {
|
2017-08-21 09:45:13 -06:00
|
|
|
id: idCounter++,
|
2017-07-27 08:34:52 -06:00
|
|
|
device_id: 46,
|
|
|
|
attachment_processed_at: undefined,
|
|
|
|
updated_at: new Date().toISOString(),
|
|
|
|
created_at: new Date().toISOString(),
|
|
|
|
attachment_url: "https://i.redd.it/xz0e2kinm4cz.jpg",
|
|
|
|
meta: { x: 0, y: 0, z: 0 }
|
|
|
|
});
|
2017-07-26 13:30:22 -06:00
|
|
|
}
|
2017-07-30 16:12:01 -06:00
|
|
|
|
|
|
|
export function fakeTool(): TaggedTool {
|
|
|
|
return fakeResource("tools", {
|
|
|
|
name: "Foo"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-08-17 12:36:33 -06:00
|
|
|
export function fakeUser(): TaggedUser {
|
|
|
|
return fakeResource("users", {
|
2017-08-21 09:45:13 -06:00
|
|
|
id: idCounter++,
|
2017-08-17 12:36:33 -06:00
|
|
|
device_id: 789,
|
|
|
|
name: "Fake User 123",
|
|
|
|
email: "fake@fake.com",
|
|
|
|
created_at: "---",
|
|
|
|
updated_at: "---"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-30 16:12:01 -06:00
|
|
|
export function fakeToolSlot(): TaggedToolSlotPointer {
|
|
|
|
return fakeResource("points", {
|
|
|
|
name: "ToolSlot 1",
|
|
|
|
pointer_type: "ToolSlot",
|
|
|
|
tool_id: 1,
|
|
|
|
x: 10,
|
|
|
|
y: 10,
|
|
|
|
z: 10,
|
|
|
|
radius: 10,
|
|
|
|
meta: {}
|
|
|
|
});
|
|
|
|
}
|
2017-08-21 09:45:13 -06:00
|
|
|
|
2017-08-24 22:37:24 -06:00
|
|
|
export function fakePlant(): TaggedPlantPointer {
|
|
|
|
return fakeResource("points", {
|
|
|
|
name: "Strawberry Plant 1",
|
|
|
|
pointer_type: "Plant",
|
|
|
|
x: 100,
|
|
|
|
y: 200,
|
|
|
|
z: 0,
|
|
|
|
radius: 25,
|
|
|
|
meta: {},
|
|
|
|
openfarm_slug: "strawberry"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-08-21 09:45:13 -06:00
|
|
|
export function fakeWebcamFeed(): TaggedWebcamFeed {
|
|
|
|
return fakeResource("webcam_feed", {
|
|
|
|
id: idCounter++,
|
|
|
|
created_at: "---",
|
|
|
|
updated_at: "---",
|
|
|
|
url: "http://i.imgur.com/iAOUmEB.jpg"
|
|
|
|
});
|
|
|
|
}
|