More cleanup of debug artifacts. NEXT: Documentation, coverage updates

pull/1048/head
Rick Carlino 2018-11-25 16:04:59 -06:00
parent 845f414fe8
commit 53b1f4132f
4 changed files with 9 additions and 23 deletions

View File

@ -94,16 +94,6 @@ if Rails.env == "development"
{time_offset:345900000, sequence_id:s[:id]}
])
Peripherals::Create.run!(device: u.device, pin: 13, label: "LED")
# 2.times do
# FarmEvents::Create.run!(
# device: u.device,
# start_time: Time.now + 1.hour,
# end_time: Date.today + ([*(DATE_RANGE_HI)].sample).days,
# time_unit: "daily",
# repeat: [*(DATE_RANGE_LO)].sample,
# executable_id: Sequence.where(device: u.device).order("RANDOM()").first.id,
# executable_type: "Sequence")
# end
WebcamFeeds::Create.run!(device: u.device,
name: "My Feed 1",
url: "https://nature.nps.gov/air/webcams/parks/yosecam/yose.jpg")

View File

@ -12,10 +12,6 @@ export function clickButton(
options?: { partial_match?: boolean, button_tag?: string }) {
const btnTag = options && options.button_tag ? options.button_tag : "button";
const button = wrapper.find(btnTag).at(position);
if (!button) {
throw new Error("Can't find button (" +
btnTag + ") at position " + position);
}
const expectedText = text.toLowerCase();
const actualText = button.text().toLowerCase();
options && options.partial_match

View File

@ -76,7 +76,7 @@ export const emptyState = (): RestResources => {
export let resourceReducer =
generateReducer<RestResources>(emptyState(), (s, a) => afterEach(s, a))
.add<TaggedResource>(Actions.SAVE_RESOURCE_OK, (s, { payload }) => {
indexUpsert(s.index, [payload], "one");
indexUpsert(s.index, [payload], "ongoing");
mutateSpecialStatus(payload.uuid, s.index, SpecialStatus.SAVED);
return s;
})
@ -93,17 +93,17 @@ export let resourceReducer =
const { uuid, update, specialStatus } = payload;
const original = findByUuid(s.index, uuid);
original.body = update;
indexUpsert(s.index, [original], "one");
indexUpsert(s.index, [original], "ongoing");
mutateSpecialStatus(uuid, s.index, specialStatus);
return s;
})
.add<SyncBodyContents<TaggedResource>>(Actions.RESOURCE_READY, (s, { payload }) => {
!s.loaded.includes(payload.kind) && s.loaded.push(payload.kind);
indexUpsert(s.index, payload.body, "many");
indexUpsert(s.index, payload.body, "initial");
return s;
})
.add<TaggedResource>(Actions.REFRESH_RESOURCE_OK, (s, { payload }) => {
indexUpsert(s.index, [payload], "one");
indexUpsert(s.index, [payload], "ongoing");
mutateSpecialStatus(payload.uuid, s.index);
return s;
})

View File

@ -143,7 +143,7 @@ export const INDEXERS: Indexer[] = [
];
type IndexerHook = Partial<Record<TaggedResource["kind"], Reindexer>>;
type Reindexer = (i: ResourceIndex, strategy: "one" | "many") => void;
type Reindexer = (i: ResourceIndex, strategy: "ongoing" | "initial") => void;
export function joinKindAndId(kind: ResourceName, id: number | undefined) {
return `${kind}.${id || 0}`;
@ -184,7 +184,7 @@ export const mutateSpecialStatus =
export function initResourceReducer(s: RestResources,
{ payload }: ReduxAction<TaggedResource>): RestResources {
indexUpsert(s.index, [payload], "one");
indexUpsert(s.index, [payload], "ongoing");
return s;
}
@ -192,7 +192,7 @@ const BEFORE_HOOKS: IndexerHook = {
Log(_index, strategy) {
// IMPLEMENTATION DETAIL: When the app downloads a *list* of logs, we
// replaces the entire logs collection.
(strategy === "many") &&
(strategy === "initial") &&
selectAllLogs(_index).map(log => indexRemove(_index, log));
},
};
@ -218,7 +218,7 @@ const ups = INDEXERS.map(x => x.up);
const downs = INDEXERS.map(x => x.down).reverse();
export const indexUpsert =
(db: ResourceIndex, resources: TaggedResource[], strategy: "one" | "many") => {
(db: ResourceIndex, resources: TaggedResource[], strategy: "ongoing" | "initial") => {
if (resources.length == 0) {
return;
}
@ -243,5 +243,5 @@ export function indexRemove(db: ResourceIndex, resource: TaggedResource) {
.map(callback => arrayWrap(resource).map(r => callback(r, db)));
// Finalize indexing (if needed)
const after = AFTER_HOOKS[resource.kind];
after && after(db, "one");
after && after(db, "ongoing");
}