From 1c32a7b315cb0228ea45fd3195d1f4dc92f25601 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Tue, 3 Apr 2018 16:49:21 -0500 Subject: [PATCH] New logs path --- config/routes.rb | 4 ++-- spec/controllers/api/logs/logs_spec.rb | 4 ++-- webpack/api/api.ts | 5 +++-- webpack/api/crud.ts | 2 +- webpack/sync/actions.ts | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 4cb7c54ac..791c03ef3 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,10 +28,10 @@ FarmBot::Application.routes.draw do web_app_config: [:destroy, :show, :update], }.to_a.map{|(name, only)| resource name, only: only} - resources :points, except: [] do post :search, on: :collection end + resources(:points, except: []) { post :search, on: :collection } resources :logs, except: [:update, :show] do - post :search, on: :collection + get :search, on: :collection end resource :users, except: [:index] do diff --git a/spec/controllers/api/logs/logs_spec.rb b/spec/controllers/api/logs/logs_spec.rb index 6154ea720..2a377c115 100644 --- a/spec/controllers/api/logs/logs_spec.rb +++ b/spec/controllers/api/logs/logs_spec.rb @@ -246,7 +246,7 @@ describe Api::LogsController do info_log: 3, fun_log: 3, debug_log: 3) - post :search + get :search expect(response.status).to eq(200) expect(json.length).to eq(examples.length) end @@ -267,7 +267,7 @@ describe Api::LogsController do info_log: 0, fun_log: 0, debug_log: 0) - post :search + get :search expect(response.status).to eq(200) expect(json.length).to eq(0) end diff --git a/webpack/api/api.ts b/webpack/api/api.ts index 43daec67a..c6b4cccbf 100644 --- a/webpack/api/api.ts +++ b/webpack/api/api.ts @@ -112,8 +112,9 @@ export class API { get pointsPath() { return `${this.baseUrl}/api/points/`; } /** /api/points/search */ get pointSearchPath() { return `${this.pointsPath}/search/`; } - /** /api/logs */ - get logsPath() { return `${this.baseUrl}/api/logs/`; } + /** Rather than returning ALL logs, returns a filtered subset. + * /api/logs/search */ + get filteredLogsPath() { return `${this.baseUrl}/api/logs/`; } /** /api/webcam_feed */ get webcamFeedPath() { return `${this.baseUrl}/api/webcam_feeds/`; } /** /api/web_app_config */ diff --git a/webpack/api/crud.ts b/webpack/api/crud.ts index f81ffa54f..706973052 100644 --- a/webpack/api/crud.ts +++ b/webpack/api/crud.ts @@ -218,7 +218,7 @@ export function urlFor(tag: ResourceName) { User: API.current.usersPath, Device: API.current.devicePath, Image: API.current.imagesPath, - Log: API.current.logsPath, + Log: API.current.filteredLogsPath, WebcamFeed: API.current.webcamFeedPath, FbosConfig: API.current.fbosConfigPath, WebAppConfig: API.current.webAppConfigPath, diff --git a/webpack/sync/actions.ts b/webpack/sync/actions.ts index 1b8961a7c..198cd9baf 100644 --- a/webpack/sync/actions.ts +++ b/webpack/sync/actions.ts @@ -47,7 +47,7 @@ export function fetchSyncData(dispatch: Function) { fetch("FirmwareConfig", API.current.firmwareConfigPath); fetch("FarmEvent", API.current.farmEventsPath); fetch("Image", API.current.imagesPath); - fetch("Log", API.current.logsPath); + fetch("Log", API.current.filteredLogsPath); fetch("Peripheral", API.current.peripheralsPath); fetch("Point", API.current.pointsPath); fetch("Regimen", API.current.regimensPath);