Add html key for catalog fetch count
This commit is contained in:
parent
9b72d2fbe4
commit
77a319fa8e
|
@ -2,7 +2,8 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="postgrest-root" content="http://localhost:3000">
|
<meta name="postgrest-root" content="http://10.4.0.96:3000">
|
||||||
|
<meta name="postgrest-fetch-count" content="1000">
|
||||||
<title>Chandlr</title>
|
<title>Chandlr</title>
|
||||||
<script language="javascript" src="./dist/build/chandlr/chandlr.jsexe/rts.js"></script>
|
<script language="javascript" src="./dist/build/chandlr/chandlr.jsexe/rts.js"></script>
|
||||||
<script language="javascript" src="./dist/build/chandlr/chandlr.jsexe/lib.js"></script>
|
<script language="javascript" src="./dist/build/chandlr/chandlr.jsexe/lib.js"></script>
|
||||||
|
|
19
src/Main.hs
19
src/Main.hs
|
@ -28,7 +28,7 @@ import Miso
|
||||||
--, MisoString (..)
|
--, MisoString (..)
|
||||||
)
|
)
|
||||||
import GHCJS.DOM (currentDocument)
|
import GHCJS.DOM (currentDocument)
|
||||||
import GHCJS.DOM.Types (toJSString, Element, JSString)
|
import GHCJS.DOM.Types (toJSString, fromJSString, Element, JSString)
|
||||||
import GHCJS.DOM.ParentNode (querySelector)
|
import GHCJS.DOM.ParentNode (querySelector)
|
||||||
import GHCJS.DOM.Element (getAttribute)
|
import GHCJS.DOM.Element (getAttribute)
|
||||||
import Servant.API
|
import Servant.API
|
||||||
|
@ -60,10 +60,16 @@ initialActionFromRoute model uri = either (const NoAction) id routing_result
|
||||||
h_thread board website board_thread_id _ = GetThread {..}
|
h_thread board website board_thread_id _ = GetThread {..}
|
||||||
|
|
||||||
|
|
||||||
initialModel :: JSString -> Model
|
initialModel
|
||||||
initialModel pgroot = Model
|
:: JSString
|
||||||
|
-> Int
|
||||||
|
-> Model
|
||||||
|
initialModel pgroot client_fetch_count = Model
|
||||||
{ gridModel = Grid.initialModel
|
{ gridModel = Grid.initialModel
|
||||||
, clientModel = Client.Model { Client.pgApiRoot = pgroot }
|
, clientModel = Client.Model
|
||||||
|
{ Client.pgApiRoot = pgroot
|
||||||
|
, Client.fetchCount = client_fetch_count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMetadata :: String -> IO (Maybe JSString)
|
getMetadata :: String -> IO (Maybe JSString)
|
||||||
|
@ -90,7 +96,10 @@ main = do
|
||||||
return . maybe "http://localhost:2000" id
|
return . maybe "http://localhost:2000" id
|
||||||
consoleLog pg_api_root
|
consoleLog pg_api_root
|
||||||
|
|
||||||
let initial_model = initialModel pg_api_root
|
pg_fetch_count <- getMetadata "postgrest-fetch-count" >>=
|
||||||
|
return . maybe 1000 (read . fromJSString)
|
||||||
|
|
||||||
|
let initial_model = initialModel pg_api_root pg_fetch_count
|
||||||
|
|
||||||
startApp App
|
startApp App
|
||||||
{ model = initial_model
|
{ model = initial_model
|
||||||
|
|
|
@ -39,6 +39,7 @@ data Interface a = Interface
|
||||||
|
|
||||||
data Model = Model
|
data Model = Model
|
||||||
{ pgApiRoot :: JSString
|
{ pgApiRoot :: JSString
|
||||||
|
, fetchCount :: Int
|
||||||
} deriving Eq
|
} deriving Eq
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,5 +66,9 @@ fetchLatest m iface = do
|
||||||
((pgApiRoot m) <> ("/rpc/fetch_catalog" :: JSString))
|
((pgApiRoot m) <> ("/rpc/fetch_catalog" :: JSString))
|
||||||
Http.POST
|
Http.POST
|
||||||
[("Content-Type", "application/json")]
|
[("Content-Type", "application/json")]
|
||||||
(Just $ FetchCatalogArgs { max_time = ct, max_row_read = 1000 })
|
( Just $ FetchCatalogArgs
|
||||||
|
{ max_time = ct
|
||||||
|
, max_row_read = fetchCount m
|
||||||
|
}
|
||||||
|
)
|
||||||
>>= return . (passAction iface) . Connect
|
>>= return . (passAction iface) . Connect
|
||||||
|
|
Loading…
Reference in New Issue