module Main exposing (..) import Html import MainMessages exposing (..) import MainModel exposing (..) import MainUpdate import MainView import Versions import ArrayBased.Messages import InputTable.Subscriptions import Navigation exposing (Location, newUrl) import RouteUrl exposing (..) import Decisions.Messages init : Flags -> ( Model, Cmd Msg ) init flags = let ( version, cmd ) = Versions.flagsToVersionAndCmd { version = flags.version , initialGetUrl = flags.initialGetUrl } in ( { version = version , postRowsUrl = flags.postRowsUrl , rowLink = flags.rowLink , rowsAreSelectable = flags.rowsAreSelectable , postVisibleColumnsUrl = flags.postVisibleColumnsUrl , currentPage = flags.currentPage , initialGetUrl = flags.initialGetUrl } , cmd ) type alias Flags = { version : String , initialGetUrl : String , postRowsUrl : String , rowLink : Maybe String , postVisibleColumnsUrl : String , rowsAreSelectable : Bool , currentPage : Int } -- VIEW view : Model -> Html.Html Msg view model = MainView.view model -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update = MainUpdate.update -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.map (MainMessages.ArrayBased << ArrayBased.Messages.Table) InputTable.Subscriptions.subscriptions delta2url : Model -> Model -> Maybe UrlChange delta2url oldModel newModel = Nothing location2messages : Location -> List Msg location2messages location = if String.contains "filterText=" location.search then [ Decisions (Decisions.Messages.HandleUrlQuery location.search) ] else [] -- MAIN main : RouteUrlProgram Flags Model Msg main = RouteUrl.programWithFlags { init = init , view = view , update = update , delta2url = delta2url , subscriptions = subscriptions , location2messages = location2messages }