Add config types to TaggedResource union

pull/607/head
Rick Carlino 2018-01-08 14:41:58 -06:00
parent 1f564d6df2
commit 1f038e5747
7 changed files with 21 additions and 8 deletions

View File

@ -1,8 +1,8 @@
module Configs
class Update < Mutations::Command
required do
duck :target_klass, methods: []
duck :update_attrs, methods: [:[], :[]=]
duck :target_klass, methods: [:update_attributes!]
duck :update_attrs, methods: [:deep_symbolize_keys]
end
def execute

View File

@ -18,7 +18,7 @@ class Typescript
If you do need to change this file, first write a database migration,
then run `rake typescript:interfaces` */
interface <%= interface_name %> {
export interface <%= interface_name %> {
<% fields.each do |field| %> <%= field.head %>: <%= field.tail %>;
<% end %>}
END

View File

@ -5,7 +5,7 @@
If you do need to change this file, first write a database migration,
then run `rake typescript:interfaces` */
interface FbosConfig {
export interface FbosConfig {
id: number;
device_id: number;
created_at: string;

View File

@ -5,7 +5,7 @@
If you do need to change this file, first write a database migration,
then run `rake typescript:interfaces` */
interface FirmwareConfig {
export interface FirmwareConfig {
id: number;
device_id: number;
created_at: string;

View File

@ -5,7 +5,7 @@
If you do need to change this file, first write a database migration,
then run `rake typescript:interfaces` */
interface WebAppConfig {
export interface WebAppConfig {
id: number;
device_id: number;
created_at: string;

View File

@ -70,7 +70,10 @@ export function emptyState(): RestResources {
Regimen: [],
Sequence: [],
Tool: [],
User: []
User: [],
FbosConfig: [],
FirmwareConfig: [],
WebAppConfig: []
},
byKindAndId: {},
references: {}

View File

@ -17,6 +17,10 @@ import { Image } from "../farmware/images/interfaces";
import { betterCompact } from "../util";
import * as _ from "lodash";
import { WebcamFeed } from "../controls/interfaces";
import { FbosConfig } from "../config_storage/fbos_configs";
import { FirmwareConfig } from "../config_storage/firmware_configs";
import { WebAppConfig } from "../config_storage/web_app_configs";
export type ResourceName =
| "Crop"
| "Device"
@ -30,7 +34,10 @@ export type ResourceName =
| "Sequence"
| "Tool"
| "User"
| "WebcamFeed";
| "WebcamFeed"
| "FbosConfig"
| "FirmwareConfig"
| "WebAppConfig";
export interface TaggedResourceBase {
kind: ResourceName;
@ -95,6 +102,9 @@ export type TaggedFarmEvent = Resource<"FarmEvent", FarmEvent>;
export type TaggedImage = Resource<"Image", Image>;
export type TaggedLog = Resource<"Log", Log>;
export type TaggedPeripheral = Resource<"Peripheral", Peripheral>;
export type TaggedFbosConfig = Resource<"FbosConfig", FbosConfig>;
export type TaggedFirmwareConfig = Resource<"FirmwareConfig", FirmwareConfig>;
export type TaggedWebAppConfig = Resource<"WebAppConfig", WebAppConfig>;
type PointUnion = GenericPointer | PlantPointer | ToolSlotPointer;