Update source form to specify folder

This commit is contained in:
Eike Kettner
2020-07-14 22:38:11 +02:00
parent 5b01c93711
commit ca5b7b999f
7 changed files with 245 additions and 86 deletions

View File

@ -2,7 +2,7 @@ module Page.CollectiveSettings.Data exposing
( Model
, Msg(..)
, Tab(..)
, emptyModel
, init
)
import Api.Model.BasicResult exposing (BasicResult)
@ -11,6 +11,7 @@ import Api.Model.ItemInsights exposing (ItemInsights)
import Comp.CollectiveSettingsForm
import Comp.SourceManage
import Comp.UserManage
import Data.Flags exposing (Flags)
import Http
@ -24,15 +25,21 @@ type alias Model =
}
emptyModel : Model
emptyModel =
{ currentTab = Just InsightsTab
, sourceModel = Comp.SourceManage.emptyModel
, userModel = Comp.UserManage.emptyModel
, settingsModel = Comp.CollectiveSettingsForm.init Api.Model.CollectiveSettings.empty
, insights = Api.Model.ItemInsights.empty
, submitResult = Nothing
}
init : Flags -> ( Model, Cmd Msg )
init flags =
let
( sm, sc ) =
Comp.SourceManage.init flags
in
( { currentTab = Just InsightsTab
, sourceModel = sm
, userModel = Comp.UserManage.emptyModel
, settingsModel = Comp.CollectiveSettingsForm.init Api.Model.CollectiveSettings.empty
, insights = Api.Model.ItemInsights.empty
, submitResult = Nothing
}
, Cmd.map SourceMsg sc
)
type Tab

View File

@ -59,7 +59,7 @@ view flags settings model =
[ div [ class "" ]
(case model.currentTab of
Just SourceTab ->
viewSources flags model
viewSources flags settings model
Just UserTab ->
viewUsers settings model
@ -153,15 +153,15 @@ makeTagStats nc =
]
viewSources : Flags -> Model -> List (Html Msg)
viewSources flags model =
viewSources : Flags -> UiSettings -> Model -> List (Html Msg)
viewSources flags settings model =
[ h2 [ class "ui header" ]
[ i [ class "ui upload icon" ] []
, div [ class "content" ]
[ text "Sources"
]
]
, Html.map SourceMsg (Comp.SourceManage.view flags model.sourceModel)
, Html.map SourceMsg (Comp.SourceManage.view flags settings model.sourceModel)
]