mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-02-15 20:33:26 +00:00
Readonly dashboard
This commit is contained in:
parent
67f1575707
commit
2c2b34cd89
@ -330,6 +330,9 @@ updateWithSub msg model =
|
||||
if Page.isSearchPage model.page && isProcessItem then
|
||||
updateSearch texts Page.Search.Data.RefreshView newModel
|
||||
|
||||
else if Page.isDashboardPage model.page && isProcessItem then
|
||||
updateDashboard texts Page.Dashboard.Data.reloadDashboard newModel
|
||||
|
||||
else
|
||||
( newModel, Cmd.none, Sub.none )
|
||||
|
||||
|
@ -12,6 +12,7 @@ import App.Data exposing (..)
|
||||
import Comp.Basic as B
|
||||
import Data.Flags
|
||||
import Data.Icons as Icons
|
||||
import Data.UiSettings
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
@ -78,7 +79,11 @@ topNavUser auth model =
|
||||
[ class S.infoMessageBase
|
||||
, class "my-2 px-1 py-1 rounded-lg inline-block hover:opacity-50"
|
||||
, classList [ ( "hidden", not model.showNewItemsArrived ) ]
|
||||
, Page.href (SearchPage Nothing)
|
||||
, if Page.isSearchPage model.page || Page.isDashboardPage model.page then
|
||||
href "#"
|
||||
|
||||
else
|
||||
Page.href (SearchPage Nothing)
|
||||
, onClick ToggleShowNewItemsArrived
|
||||
]
|
||||
[ i [ class "fa fa-exclamation-circle mr-1" ] []
|
||||
@ -317,7 +322,7 @@ dataMenu texts _ model =
|
||||
, dataPageLink model
|
||||
(UploadPage Nothing)
|
||||
[]
|
||||
[ i [ class "fa fa-upload w-6" ] []
|
||||
[ Icons.fileUploadIcon "w-6"
|
||||
, span [ class "ml-1" ]
|
||||
[ text texts.uploadFiles
|
||||
]
|
||||
@ -358,9 +363,9 @@ dataMenu texts _ model =
|
||||
]
|
||||
, a
|
||||
[ class dropdownItem
|
||||
, href "https://docspell.org/docs"
|
||||
, href Data.UiSettings.documentationSite
|
||||
, target "_new"
|
||||
, title "Opens https://docspell.org/docs"
|
||||
, title ("Opens " ++ Data.UiSettings.documentationSite)
|
||||
]
|
||||
[ Icons.documentationIcon "w-6"
|
||||
, span [ class "ml-1" ] [ text texts.help ]
|
||||
@ -486,6 +491,7 @@ viewDashboard texts model =
|
||||
(Dashboard.viewSidebar texts.dashboard
|
||||
model.sidebarVisible
|
||||
model.flags
|
||||
model.version
|
||||
model.uiSettings
|
||||
model.dashboardModel
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Comp.BoxQueryView exposing (..)
|
||||
module Comp.BoxQueryView exposing (Model, Msg, init, reloadData, update, view)
|
||||
|
||||
import Api
|
||||
import Api.Model.ItemLight exposing (ItemLight)
|
||||
@ -32,6 +32,7 @@ type ViewResult
|
||||
|
||||
type Msg
|
||||
= ItemsResp (Result Http.Error ItemLightList)
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> QueryData -> ( Model, Cmd Msg )
|
||||
@ -39,27 +40,30 @@ init flags data =
|
||||
( { results = Loading
|
||||
, meta = data
|
||||
}
|
||||
, case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearch flags (mkQuery q data) ItemsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchBookmark flags (mkQuery bmId data) ItemsResp
|
||||
, dataCmd flags data
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Bool )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
ItemsResp (Ok list) ->
|
||||
( { model | results = Loaded list }, Cmd.none )
|
||||
( { model | results = Loaded list }, Cmd.none, False )
|
||||
|
||||
ItemsResp (Err err) ->
|
||||
( { model | results = Failed err }, Cmd.none )
|
||||
( { model | results = Failed err }, Cmd.none, False )
|
||||
|
||||
ReloadData ->
|
||||
( model, dataCmd flags model.meta, True )
|
||||
|
||||
|
||||
|
||||
@ -154,7 +158,7 @@ viewEmpty : Texts -> Html Msg
|
||||
viewEmpty texts =
|
||||
div [ class "flex justify-center items-center h-full" ]
|
||||
[ div [ class "px-4 py-4 text-center align-middle text-lg" ]
|
||||
[ i [ class "fa fa-eraser mr-2" ] []
|
||||
[ i [ class "fa fa-smile font-thin mr-2" ] []
|
||||
, text texts.noResults
|
||||
]
|
||||
]
|
||||
@ -182,3 +186,13 @@ mkQuery q meta =
|
||||
, searchMode = Just <| Data.SearchMode.asString Data.SearchMode.Normal
|
||||
, withDetails = Just meta.details
|
||||
}
|
||||
|
||||
|
||||
dataCmd : Flags -> QueryData -> Cmd Msg
|
||||
dataCmd flags data =
|
||||
case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearch flags (mkQuery q data) ItemsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchBookmark flags (mkQuery bmId data) ItemsResp
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Comp.BoxSummaryView exposing (..)
|
||||
module Comp.BoxSummaryView exposing (Model, Msg, init, reloadData, update, view)
|
||||
|
||||
import Api
|
||||
import Api.Model.ItemQuery exposing (ItemQuery)
|
||||
@ -17,7 +17,7 @@ import Util.List
|
||||
|
||||
type alias Model =
|
||||
{ results : ViewResult
|
||||
, show : SummaryShow
|
||||
, meta : SummaryData
|
||||
}
|
||||
|
||||
|
||||
@ -29,34 +29,38 @@ type ViewResult
|
||||
|
||||
type Msg
|
||||
= StatsResp (Result Http.Error SearchStats)
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> SummaryData -> ( Model, Cmd Msg )
|
||||
init flags data =
|
||||
( { results = Loading
|
||||
, show = data.show
|
||||
, meta = data
|
||||
}
|
||||
, case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearchStats flags (mkQuery q) StatsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchStatsBookmark flags (mkQuery bmId) StatsResp
|
||||
, dataCmd flags data
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Bool )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
StatsResp (Ok stats) ->
|
||||
( { model | results = Loaded stats }, Cmd.none )
|
||||
( { model | results = Loaded stats }, Cmd.none, False )
|
||||
|
||||
StatsResp (Err err) ->
|
||||
( { model | results = Failed err }, Cmd.none )
|
||||
( { model | results = Failed err }, Cmd.none, False )
|
||||
|
||||
ReloadData ->
|
||||
( model, dataCmd flags model.meta, True )
|
||||
|
||||
|
||||
|
||||
@ -85,16 +89,21 @@ view texts model =
|
||||
]
|
||||
|
||||
Loaded stats ->
|
||||
case model.show of
|
||||
Data.BoxContent.SummaryShowFields flag ->
|
||||
Comp.SearchStatsView.view2
|
||||
texts.statsView
|
||||
flag
|
||||
""
|
||||
stats
|
||||
viewStats texts model stats
|
||||
|
||||
SummaryShowGeneral ->
|
||||
viewGeneral texts stats
|
||||
|
||||
viewStats : Texts -> Model -> SearchStats -> Html Msg
|
||||
viewStats texts model stats =
|
||||
case model.meta.show of
|
||||
SummaryShowFields flag ->
|
||||
Comp.SearchStatsView.view2
|
||||
texts.statsView
|
||||
flag
|
||||
""
|
||||
stats
|
||||
|
||||
SummaryShowGeneral ->
|
||||
viewGeneral texts stats
|
||||
|
||||
|
||||
viewGeneral : Texts -> SearchStats -> Html Msg
|
||||
@ -158,3 +167,13 @@ mkQuery query =
|
||||
, searchMode = Nothing
|
||||
, withDetails = Nothing
|
||||
}
|
||||
|
||||
|
||||
dataCmd : Flags -> SummaryData -> Cmd Msg
|
||||
dataCmd flags data =
|
||||
case data.query of
|
||||
SearchQueryString q ->
|
||||
Api.itemSearchStats flags (mkQuery q) StatsResp
|
||||
|
||||
SearchQueryBookmark bmId ->
|
||||
Api.itemSearchStatsBookmark flags (mkQuery bmId) StatsResp
|
||||
|
62
modules/webapp/src/main/elm/Comp/BoxUploadView.elm
Normal file
62
modules/webapp/src/main/elm/Comp/BoxUploadView.elm
Normal file
@ -0,0 +1,62 @@
|
||||
module Comp.BoxUploadView exposing (..)
|
||||
|
||||
import Comp.UploadForm
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (Html, div)
|
||||
import Html.Attributes exposing (class)
|
||||
import Messages.Comp.BoxUploadView exposing (Texts)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ uploadForm : Comp.UploadForm.Model
|
||||
, sourceId : Maybe String
|
||||
}
|
||||
|
||||
|
||||
type Msg
|
||||
= UploadMsg Comp.UploadForm.Msg
|
||||
|
||||
|
||||
init : Maybe String -> Model
|
||||
init sourceId =
|
||||
{ uploadForm = Comp.UploadForm.init
|
||||
, sourceId = sourceId
|
||||
}
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
UploadMsg lm ->
|
||||
let
|
||||
( um, uc, us ) =
|
||||
Comp.UploadForm.update model.sourceId flags lm model.uploadForm
|
||||
in
|
||||
( { model | uploadForm = um }
|
||||
, Cmd.map UploadMsg uc
|
||||
, Sub.map UploadMsg us
|
||||
)
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts flags settings model =
|
||||
let
|
||||
viewCfg =
|
||||
{ sourceId = model.sourceId
|
||||
, showForm = False
|
||||
, lightForm = True
|
||||
}
|
||||
in
|
||||
div [ class "" ]
|
||||
[ Html.map UploadMsg
|
||||
(Comp.UploadForm.view texts.uploadForm viewCfg flags settings model.uploadForm)
|
||||
]
|
@ -2,10 +2,12 @@ module Comp.BoxView exposing (..)
|
||||
|
||||
import Comp.BoxQueryView
|
||||
import Comp.BoxSummaryView
|
||||
import Comp.BoxUploadView
|
||||
import Data.Box exposing (Box)
|
||||
import Data.BoxContent exposing (BoxContent(..), MessageData)
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (Html, div, text)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (Html, div, i, text)
|
||||
import Html.Attributes exposing (class, classList)
|
||||
import Markdown
|
||||
import Messages.Comp.BoxView exposing (Texts)
|
||||
@ -15,12 +17,13 @@ import Styles as S
|
||||
type alias Model =
|
||||
{ box : Box
|
||||
, content : ContentModel
|
||||
, reloading : Bool
|
||||
}
|
||||
|
||||
|
||||
type ContentModel
|
||||
= ContentMessage Data.BoxContent.MessageData
|
||||
| ContentUpload (Maybe String)
|
||||
| ContentUpload Comp.BoxUploadView.Model
|
||||
| ContentQuery Comp.BoxQueryView.Model
|
||||
| ContentSummary Comp.BoxSummaryView.Model
|
||||
|
||||
@ -28,6 +31,8 @@ type ContentModel
|
||||
type Msg
|
||||
= QueryMsg Comp.BoxQueryView.Msg
|
||||
| SummaryMsg Comp.BoxSummaryView.Msg
|
||||
| UploadMsg Comp.BoxUploadView.Msg
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> Box -> ( Model, Cmd Msg )
|
||||
@ -38,11 +43,17 @@ init flags box =
|
||||
in
|
||||
( { box = box
|
||||
, content = cm
|
||||
, reloading = False
|
||||
}
|
||||
, cc
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
contentInit : Flags -> BoxContent -> ( ContentModel, Cmd Msg )
|
||||
contentInit flags content =
|
||||
case content of
|
||||
@ -50,7 +61,11 @@ contentInit flags content =
|
||||
( ContentMessage data, Cmd.none )
|
||||
|
||||
BoxUpload source ->
|
||||
( ContentUpload source, Cmd.none )
|
||||
let
|
||||
qm =
|
||||
Comp.BoxUploadView.init source
|
||||
in
|
||||
( ContentUpload qm, Cmd.none )
|
||||
|
||||
BoxQuery data ->
|
||||
let
|
||||
@ -71,17 +86,20 @@ contentInit flags content =
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
QueryMsg lm ->
|
||||
case model.content of
|
||||
ContentQuery qm ->
|
||||
let
|
||||
( cm, cc ) =
|
||||
Comp.BoxQueryView.update lm qm
|
||||
( cm, cc, reloading ) =
|
||||
Comp.BoxQueryView.update flags lm qm
|
||||
in
|
||||
( { model | content = ContentQuery cm }, Cmd.map QueryMsg cc )
|
||||
( { model | content = ContentQuery cm, reloading = reloading }
|
||||
, Cmd.map QueryMsg cc
|
||||
, Sub.none
|
||||
)
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
@ -90,43 +108,84 @@ update msg model =
|
||||
case model.content of
|
||||
ContentSummary qm ->
|
||||
let
|
||||
( cm, cc ) =
|
||||
Comp.BoxSummaryView.update lm qm
|
||||
( cm, cc, reloading ) =
|
||||
Comp.BoxSummaryView.update flags lm qm
|
||||
in
|
||||
( { model | content = ContentSummary cm }, Cmd.map SummaryMsg cc )
|
||||
( { model | content = ContentSummary cm, reloading = reloading }
|
||||
, Cmd.map SummaryMsg cc
|
||||
, Sub.none
|
||||
)
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
UploadMsg lm ->
|
||||
case model.content of
|
||||
ContentUpload qm ->
|
||||
let
|
||||
( cm, cc, cs ) =
|
||||
Comp.BoxUploadView.update flags lm qm
|
||||
in
|
||||
( { model | content = ContentUpload cm }
|
||||
, Cmd.map UploadMsg cc
|
||||
, Sub.map UploadMsg cs
|
||||
)
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
ReloadData ->
|
||||
case model.content of
|
||||
ContentQuery _ ->
|
||||
update flags (QueryMsg Comp.BoxQueryView.reloadData) model
|
||||
|
||||
ContentSummary _ ->
|
||||
update flags (SummaryMsg Comp.BoxSummaryView.reloadData) model
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg )
|
||||
unit : Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
unit model =
|
||||
( model, Cmd.none )
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Model -> Html Msg
|
||||
view texts model =
|
||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts flags settings model =
|
||||
div
|
||||
[ classList [ ( S.box ++ "rounded", model.box.decoration ) ]
|
||||
, class (spanStyle model.box)
|
||||
, class "relative h-full"
|
||||
, classList [ ( "hidden", not model.box.visible ) ]
|
||||
]
|
||||
[ boxHeader model
|
||||
[ boxLoading model
|
||||
, boxHeader model
|
||||
, div [ class "px-2 py-1 h-5/6" ]
|
||||
[ boxContent texts model
|
||||
[ boxContent texts flags settings model
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
boxLoading : Model -> Html Msg
|
||||
boxLoading model =
|
||||
if not model.reloading then
|
||||
div [ class "hidden" ] []
|
||||
|
||||
else
|
||||
div [ class "absolute right-0 top-1 h-6 w-6" ]
|
||||
[ i [ class "fa fa-spinner animate-spin" ] []
|
||||
]
|
||||
|
||||
|
||||
boxHeader : Model -> Html Msg
|
||||
boxHeader model =
|
||||
div
|
||||
[ class "border-b dark:border-slate-500 flex flex-row py-1 bg-blue-50 dark:bg-slate-700 rounded-t"
|
||||
[ class "flex flex-row py-1 bg-blue-50 dark:bg-slate-700 rounded-t"
|
||||
, classList [ ( "hidden", not model.box.decoration || model.box.name == "" ) ]
|
||||
]
|
||||
[ div [ class "flex text-lg tracking-medium italic px-2" ]
|
||||
@ -135,14 +194,15 @@ boxHeader model =
|
||||
]
|
||||
|
||||
|
||||
boxContent : Texts -> Model -> Html Msg
|
||||
boxContent texts model =
|
||||
boxContent : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
boxContent texts flags settings model =
|
||||
case model.content of
|
||||
ContentMessage m ->
|
||||
messageContent m
|
||||
|
||||
ContentUpload sourceId ->
|
||||
Debug.todo "not implemented"
|
||||
ContentUpload qm ->
|
||||
Html.map UploadMsg
|
||||
(Comp.BoxUploadView.view texts.uploadView flags settings qm)
|
||||
|
||||
ContentQuery qm ->
|
||||
Html.map QueryMsg
|
||||
|
@ -1,13 +1,15 @@
|
||||
module Comp.DashboardView exposing (Model, Msg, init, update, view, viewBox)
|
||||
module Comp.DashboardView exposing (Model, Msg, init, reloadData, update, view, viewBox)
|
||||
|
||||
import Comp.BoxView
|
||||
import Data.Box exposing (Box)
|
||||
import Data.Dashboard exposing (Dashboard)
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Dict exposing (Dict)
|
||||
import Html exposing (Html, div)
|
||||
import Html.Attributes exposing (class)
|
||||
import Messages.Comp.DashboardView exposing (Texts)
|
||||
import Util.Update
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -18,6 +20,7 @@ type alias Model =
|
||||
|
||||
type Msg
|
||||
= BoxMsg Int Comp.BoxView.Msg
|
||||
| ReloadData
|
||||
|
||||
|
||||
init : Flags -> Dashboard -> ( Model, Cmd Msg )
|
||||
@ -37,49 +40,64 @@ init flags db =
|
||||
)
|
||||
|
||||
|
||||
reloadData : Msg
|
||||
reloadData =
|
||||
ReloadData
|
||||
|
||||
|
||||
|
||||
--- Update
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
update flags msg model =
|
||||
case msg of
|
||||
BoxMsg index lm ->
|
||||
case Dict.get index model.boxModels of
|
||||
Just bm ->
|
||||
let
|
||||
( cm, cc ) =
|
||||
Comp.BoxView.update lm bm
|
||||
( cm, cc, cs ) =
|
||||
Comp.BoxView.update flags lm bm
|
||||
in
|
||||
( { model | boxModels = Dict.insert index cm model.boxModels }
|
||||
, Cmd.map (BoxMsg index) cc
|
||||
, Sub.map (BoxMsg index) cs
|
||||
)
|
||||
|
||||
Nothing ->
|
||||
unit model
|
||||
|
||||
ReloadData ->
|
||||
let
|
||||
updateAll =
|
||||
List.map (\index -> BoxMsg index Comp.BoxView.reloadData) (Dict.keys model.boxModels)
|
||||
|> List.map (\m -> update flags m)
|
||||
|> Util.Update.andThen2
|
||||
in
|
||||
updateAll model
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg )
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
unit model =
|
||||
( model, Cmd.none )
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Model -> Html Msg
|
||||
view texts model =
|
||||
view : Texts -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts flags settings model =
|
||||
div
|
||||
[ class (gridStyle model.dashboard)
|
||||
]
|
||||
(List.indexedMap (viewBox texts) <| Dict.values model.boxModels)
|
||||
(List.indexedMap (viewBox texts flags settings) <| Dict.values model.boxModels)
|
||||
|
||||
|
||||
viewBox : Texts -> Int -> Comp.BoxView.Model -> Html Msg
|
||||
viewBox texts index box =
|
||||
viewBox : Texts -> Flags -> UiSettings -> Int -> Comp.BoxView.Model -> Html Msg
|
||||
viewBox texts flags settings index box =
|
||||
Html.map (BoxMsg index)
|
||||
(Comp.BoxView.view texts.boxView box)
|
||||
(Comp.BoxView.view texts.boxView flags settings box)
|
||||
|
||||
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-}
|
||||
|
||||
|
||||
-- inspired from here: https://ellie-app.com/3T5mNms7SwKa1
|
||||
|
||||
|
||||
@ -132,15 +130,21 @@ filterMime model files =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
type alias ViewSettings =
|
||||
{ light : Bool
|
||||
}
|
||||
|
||||
|
||||
view2 : Texts -> ViewSettings -> Model -> Html Msg
|
||||
view2 texts cfg model =
|
||||
div
|
||||
[ classList
|
||||
[ ( "bg-opacity-100 bg-blue-100 dark:bg-sky-800", model.state.hover )
|
||||
, ( "bg-blue-100 dark:bg-sky-900 bg-opacity-50", not model.state.hover )
|
||||
, ( "bg-indigo-100 dark:bg-sky-900 bg-opacity-50", not model.state.hover )
|
||||
, ( "disabled", not model.state.active )
|
||||
]
|
||||
, class "flex flex-col justify-center items-center py-2 md:py-12 border-0 border-t-2 border-blue-500 dark:border-sky-500 dropzone"
|
||||
, class "flex flex-col justify-center items-center py-2 md:py-12 dropzone"
|
||||
, classList [ ( " border-0 border-t-2 border-blue-500 dark:border-sky-500", not cfg.light ) ]
|
||||
, onDragEnter DragEnter
|
||||
, onDragOver DragEnter
|
||||
, onDragLeave DragLeave
|
||||
@ -168,7 +172,10 @@ view2 texts model =
|
||||
, attrs = [ href "#" ]
|
||||
, disabled = not model.state.active
|
||||
}
|
||||
, div [ class "text-center opacity-75 text-sm mt-4" ]
|
||||
, div
|
||||
[ class "text-center opacity-75 text-sm mt-4"
|
||||
, classList [ ( "hidden", cfg.light ) ]
|
||||
]
|
||||
[ text texts.selectInfo
|
||||
]
|
||||
]
|
||||
|
@ -24,6 +24,11 @@ import Util.Size
|
||||
|
||||
view : Texts -> Model -> Html Msg
|
||||
view texts model =
|
||||
let
|
||||
dropzoneCfg =
|
||||
{ light = True
|
||||
}
|
||||
in
|
||||
div
|
||||
[ classList
|
||||
[ ( "hidden", not model.addFilesOpen )
|
||||
@ -35,7 +40,7 @@ view texts model =
|
||||
[ text texts.addMoreFilesToItem
|
||||
]
|
||||
, Html.map AddFilesMsg
|
||||
(Comp.Dropzone.view2 texts.dropzone model.addFilesModel)
|
||||
(Comp.Dropzone.view2 texts.dropzone dropzoneCfg model.addFilesModel)
|
||||
, div [ class "flex flex-row space-x-2 mt-2" ]
|
||||
[ button
|
||||
[ class S.primaryButton
|
||||
|
@ -294,47 +294,57 @@ setErrored model fileid =
|
||||
--- View
|
||||
|
||||
|
||||
view : Texts -> Maybe String -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts mid _ _ model =
|
||||
div
|
||||
[ id "content"
|
||||
, class Styles.content
|
||||
]
|
||||
[ div [ class "container mx-auto" ]
|
||||
[ div [ class "px-0 flex flex-col" ]
|
||||
[ div [ class "py-4" ]
|
||||
[ if mid == Nothing then
|
||||
renderForm texts model
|
||||
type alias ViewSettings =
|
||||
{ showForm : Bool
|
||||
, sourceId : Maybe String
|
||||
, lightForm : Bool
|
||||
}
|
||||
|
||||
else
|
||||
span [ class "hidden" ] []
|
||||
|
||||
view : Texts -> ViewSettings -> Flags -> UiSettings -> Model -> Html Msg
|
||||
view texts viewCfg _ _ model =
|
||||
let
|
||||
showForm =
|
||||
viewCfg.sourceId == Nothing && viewCfg.showForm
|
||||
|
||||
dropzoneCfg =
|
||||
{ light = viewCfg.lightForm
|
||||
}
|
||||
in
|
||||
div [ class "mx-auto" ]
|
||||
[ div [ class "px-0 flex flex-col" ]
|
||||
[ if showForm then
|
||||
div [ class "mb-4" ]
|
||||
[ renderForm texts model
|
||||
]
|
||||
, div [ class "py-0" ]
|
||||
[ Html.map DropzoneMsg
|
||||
(Comp.Dropzone.view2 texts.dropzone model.dropzone)
|
||||
|
||||
else
|
||||
span [ class "hidden" ] []
|
||||
, div [ class "py-0" ]
|
||||
[ Html.map DropzoneMsg
|
||||
(Comp.Dropzone.view2 texts.dropzone dropzoneCfg model.dropzone)
|
||||
]
|
||||
, div [ class "py-4" ]
|
||||
[ a
|
||||
[ class Styles.primaryButton
|
||||
, href "#"
|
||||
, onClick SubmitUpload
|
||||
]
|
||||
, div [ class "py-4" ]
|
||||
[ a
|
||||
[ class Styles.primaryButton
|
||||
, href "#"
|
||||
, onClick SubmitUpload
|
||||
]
|
||||
[ text texts.basics.submit
|
||||
]
|
||||
, a
|
||||
[ class Styles.secondaryButton
|
||||
, class "ml-2"
|
||||
, href "#"
|
||||
, onClick Clear
|
||||
]
|
||||
[ text texts.reset
|
||||
]
|
||||
[ text texts.basics.submit
|
||||
]
|
||||
, a
|
||||
[ class Styles.secondaryButton
|
||||
, class "ml-2"
|
||||
, href "#"
|
||||
, onClick Clear
|
||||
]
|
||||
[ text texts.reset
|
||||
]
|
||||
]
|
||||
, renderErrorMsg texts model
|
||||
, renderSuccessMsg texts (Util.Maybe.nonEmpty mid) model
|
||||
, renderUploads texts model
|
||||
]
|
||||
, renderErrorMsg texts model
|
||||
, renderSuccessMsg texts (Util.Maybe.nonEmpty viewCfg.sourceId) model
|
||||
, renderUploads texts model
|
||||
]
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ module Data.Icons exposing
|
||||
, editNotesIcon
|
||||
, equipment
|
||||
, equipmentIcon
|
||||
, fileUploadIcon
|
||||
, folder
|
||||
, folderIcon
|
||||
, gotifyIcon
|
||||
@ -160,6 +161,16 @@ source2 =
|
||||
"fa fa-upload"
|
||||
|
||||
|
||||
fileUpload : String
|
||||
fileUpload =
|
||||
"fa fa-file-upload"
|
||||
|
||||
|
||||
fileUploadIcon : String -> Html msg
|
||||
fileUploadIcon classes =
|
||||
i [ class classes, class fileUpload ] []
|
||||
|
||||
|
||||
sourceIcon2 : String -> Html msg
|
||||
sourceIcon2 classes =
|
||||
i [ class (source2 ++ " " ++ classes) ] []
|
||||
|
@ -16,6 +16,7 @@ module Data.UiSettings exposing
|
||||
, catColorFg2
|
||||
, catColorString2
|
||||
, defaults
|
||||
, documentationSite
|
||||
, fieldHidden
|
||||
, fieldVisible
|
||||
, getUiLanguage
|
||||
@ -455,6 +456,11 @@ getUiLanguage flags settings default =
|
||||
default
|
||||
|
||||
|
||||
documentationSite : String
|
||||
documentationSite =
|
||||
"https://docspell.org/docs"
|
||||
|
||||
|
||||
|
||||
--- Helpers
|
||||
|
||||
|
@ -45,6 +45,10 @@ type alias Texts =
|
||||
, customFields : String
|
||||
, direction : String
|
||||
, folderNotOwnerWarning : String
|
||||
, shares : String
|
||||
, sources : String
|
||||
, periodicQueries : String
|
||||
, notificationHooks : String
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +91,10 @@ You are **not a member** of this folder. This item will be **hidden**
|
||||
from any search now. Use a folder where you are a member of to make this
|
||||
item visible. This message will disappear then.
|
||||
"""
|
||||
, shares = "Shares"
|
||||
, sources = "Sources"
|
||||
, periodicQueries = "Periodic Queries"
|
||||
, notificationHooks = "Webhooks"
|
||||
}
|
||||
|
||||
|
||||
@ -130,4 +138,8 @@ URL hochgeladen werden, sind für dich in der Suche *nicht* sichtbar.
|
||||
Nutze lieber einen Ordner, dem Du als Mitglied zugeordnet bist. Diese
|
||||
Nachricht verschwindet dann.
|
||||
"""
|
||||
, shares = "Freigaben"
|
||||
, sources = "Quellen"
|
||||
, periodicQueries = "Periodische Abfragen"
|
||||
, notificationHooks = "Webhooks"
|
||||
}
|
||||
|
23
modules/webapp/src/main/elm/Messages/Comp/BoxUploadView.elm
Normal file
23
modules/webapp/src/main/elm/Messages/Comp/BoxUploadView.elm
Normal file
@ -0,0 +1,23 @@
|
||||
module Messages.Comp.BoxUploadView exposing (Texts, de, gb)
|
||||
|
||||
import Messages.Comp.UploadForm
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ uploadForm : Messages.Comp.UploadForm.Texts
|
||||
, moreOptions : String
|
||||
}
|
||||
|
||||
|
||||
gb : Texts
|
||||
gb =
|
||||
{ uploadForm = Messages.Comp.UploadForm.gb
|
||||
, moreOptions = "More options…"
|
||||
}
|
||||
|
||||
|
||||
de : Texts
|
||||
de =
|
||||
{ uploadForm = Messages.Comp.UploadForm.de
|
||||
, moreOptions = "More options…"
|
||||
}
|
@ -2,11 +2,13 @@ module Messages.Comp.BoxView exposing (Texts, de, gb)
|
||||
|
||||
import Messages.Comp.BoxQueryView
|
||||
import Messages.Comp.BoxSummaryView
|
||||
import Messages.Comp.BoxUploadView
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ queryView : Messages.Comp.BoxQueryView.Texts
|
||||
, summaryView : Messages.Comp.BoxSummaryView.Texts
|
||||
, uploadView : Messages.Comp.BoxUploadView.Texts
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +16,7 @@ gb : Texts
|
||||
gb =
|
||||
{ queryView = Messages.Comp.BoxQueryView.gb
|
||||
, summaryView = Messages.Comp.BoxSummaryView.gb
|
||||
, uploadView = Messages.Comp.BoxUploadView.gb
|
||||
}
|
||||
|
||||
|
||||
@ -21,4 +24,5 @@ de : Texts
|
||||
de =
|
||||
{ queryView = Messages.Comp.BoxQueryView.de
|
||||
, summaryView = Messages.Comp.BoxSummaryView.de
|
||||
, uploadView = Messages.Comp.BoxUploadView.de
|
||||
}
|
||||
|
@ -29,10 +29,8 @@ type alias Texts =
|
||||
, httpError : Http.Error -> String
|
||||
, collectiveSettings : String
|
||||
, insights : String
|
||||
, sources : String
|
||||
, settings : String
|
||||
, users : String
|
||||
, shares : String
|
||||
, user : String
|
||||
, collective : String
|
||||
, size : String
|
||||
@ -51,10 +49,8 @@ gb =
|
||||
, httpError = Messages.Comp.HttpError.gb
|
||||
, collectiveSettings = "Collective Settings"
|
||||
, insights = "Insights"
|
||||
, sources = "Sources"
|
||||
, settings = "Settings"
|
||||
, users = "Users"
|
||||
, shares = "Shares"
|
||||
, user = "User"
|
||||
, collective = "Collective"
|
||||
, size = "Size"
|
||||
@ -73,10 +69,8 @@ de =
|
||||
, httpError = Messages.Comp.HttpError.de
|
||||
, collectiveSettings = "Kollektiveinstellungen"
|
||||
, insights = "Statistiken"
|
||||
, sources = "Quellen"
|
||||
, settings = "Einstellungen"
|
||||
, users = "Benutzer"
|
||||
, shares = "Freigaben"
|
||||
, user = "Benutzer"
|
||||
, collective = "Kollektiv"
|
||||
, size = "Größe"
|
||||
|
@ -1,5 +1,6 @@
|
||||
module Messages.Page.Dashboard exposing (Texts, de, gb)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.Comp.BookmarkChooser
|
||||
import Messages.Comp.DashboardView
|
||||
import Messages.Comp.EquipmentManage
|
||||
@ -11,11 +12,13 @@ import Messages.Comp.PersonManage
|
||||
import Messages.Comp.ShareManage
|
||||
import Messages.Comp.SourceManage
|
||||
import Messages.Comp.TagManage
|
||||
import Messages.Comp.UploadForm
|
||||
import Messages.Page.DefaultDashboard
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ bookmarkChooser : Messages.Comp.BookmarkChooser.Texts
|
||||
{ basics : Messages.Basics.Texts
|
||||
, bookmarkChooser : Messages.Comp.BookmarkChooser.Texts
|
||||
, notificationHookManage : Messages.Comp.NotificationHookManage.Texts
|
||||
, periodicQueryManage : Messages.Comp.PeriodicQueryTaskManage.Texts
|
||||
, sourceManage : Messages.Comp.SourceManage.Texts
|
||||
@ -25,14 +28,23 @@ type alias Texts =
|
||||
, equipManage : Messages.Comp.EquipmentManage.Texts
|
||||
, tagManage : Messages.Comp.TagManage.Texts
|
||||
, folderManage : Messages.Comp.FolderManage.Texts
|
||||
, uploadForm : Messages.Comp.UploadForm.Texts
|
||||
, dashboard : Messages.Comp.DashboardView.Texts
|
||||
, defaultDashboard : Messages.Page.DefaultDashboard.Texts
|
||||
, manage : String
|
||||
, dashboardLink : String
|
||||
, bookmarks : String
|
||||
, misc : String
|
||||
, settings : String
|
||||
, documentation : String
|
||||
, uploadFiles : String
|
||||
}
|
||||
|
||||
|
||||
gb : Texts
|
||||
gb =
|
||||
{ bookmarkChooser = Messages.Comp.BookmarkChooser.gb
|
||||
{ basics = Messages.Basics.gb
|
||||
, bookmarkChooser = Messages.Comp.BookmarkChooser.gb
|
||||
, notificationHookManage = Messages.Comp.NotificationHookManage.gb
|
||||
, periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.gb
|
||||
, sourceManage = Messages.Comp.SourceManage.gb
|
||||
@ -42,14 +54,23 @@ gb =
|
||||
, equipManage = Messages.Comp.EquipmentManage.gb
|
||||
, tagManage = Messages.Comp.TagManage.gb
|
||||
, folderManage = Messages.Comp.FolderManage.gb
|
||||
, uploadForm = Messages.Comp.UploadForm.gb
|
||||
, dashboard = Messages.Comp.DashboardView.gb
|
||||
, defaultDashboard = Messages.Page.DefaultDashboard.gb
|
||||
, manage = "Manage"
|
||||
, dashboardLink = "Dasbhoard"
|
||||
, bookmarks = "Bookmarks"
|
||||
, misc = "Misc"
|
||||
, settings = "Settings"
|
||||
, documentation = "Documentation"
|
||||
, uploadFiles = "Upload documents"
|
||||
}
|
||||
|
||||
|
||||
de : Texts
|
||||
de =
|
||||
{ bookmarkChooser = Messages.Comp.BookmarkChooser.de
|
||||
{ basics = Messages.Basics.de
|
||||
, bookmarkChooser = Messages.Comp.BookmarkChooser.de
|
||||
, notificationHookManage = Messages.Comp.NotificationHookManage.de
|
||||
, periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.de
|
||||
, sourceManage = Messages.Comp.SourceManage.de
|
||||
@ -59,6 +80,14 @@ de =
|
||||
, equipManage = Messages.Comp.EquipmentManage.de
|
||||
, tagManage = Messages.Comp.TagManage.de
|
||||
, folderManage = Messages.Comp.FolderManage.de
|
||||
, uploadForm = Messages.Comp.UploadForm.de
|
||||
, dashboard = Messages.Comp.DashboardView.de
|
||||
, defaultDashboard = Messages.Page.DefaultDashboard.de
|
||||
, manage = "Managen"
|
||||
, dashboardLink = "Dasbhoard"
|
||||
, bookmarks = "Bookmarks"
|
||||
, misc = "Anderes"
|
||||
, settings = "Einstellungen"
|
||||
, documentation = "Dokumentation"
|
||||
, uploadFiles = "Dokumente hochladen"
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Messages.Page.DefaultDashboard exposing (Texts, de, gb)
|
||||
|
||||
import Data.Fields exposing (Field)
|
||||
import Messages.Basics
|
||||
import Messages.Data.Fields
|
||||
|
||||
|
||||
type alias Texts =
|
||||
@ -29,7 +31,7 @@ gb =
|
||||
, welcomeBody = "Docspell keeps your documents organized."
|
||||
, summaryName = "Summary"
|
||||
, dueInDays = \n -> "Due in " ++ String.fromInt n ++ " days"
|
||||
, dueHeaderColumns = dueHeaderCols b
|
||||
, dueHeaderColumns = dueHeaderCols b Messages.Data.Fields.gb
|
||||
, newDocsName = "New Documents"
|
||||
}
|
||||
|
||||
@ -48,10 +50,10 @@ de =
|
||||
, summaryName = "Zahlen"
|
||||
, dueInDays = \n -> "Fällig in " ++ String.fromInt n ++ " Tagen"
|
||||
, newDocsName = "Neue Dokumente"
|
||||
, dueHeaderColumns = dueHeaderCols b
|
||||
, dueHeaderColumns = dueHeaderCols b Messages.Data.Fields.de
|
||||
}
|
||||
|
||||
|
||||
dueHeaderCols : Messages.Basics.Texts -> List String
|
||||
dueHeaderCols b =
|
||||
[ b.name, b.correspondent, b.date ]
|
||||
dueHeaderCols : Messages.Basics.Texts -> (Field -> String) -> List String
|
||||
dueHeaderCols b d =
|
||||
[ b.name, b.correspondent, d Data.Fields.DueDate ]
|
||||
|
@ -11,6 +11,7 @@ module Messages.Page.UserSettings exposing
|
||||
, gb
|
||||
)
|
||||
|
||||
import Messages.Basics
|
||||
import Messages.Comp.ChangePasswordForm
|
||||
import Messages.Comp.DueItemsTaskManage
|
||||
import Messages.Comp.EmailSettingsManage
|
||||
@ -24,7 +25,8 @@ import Messages.Comp.UiSettingsManage
|
||||
|
||||
|
||||
type alias Texts =
|
||||
{ changePasswordForm : Messages.Comp.ChangePasswordForm.Texts
|
||||
{ basics : Messages.Basics.Texts
|
||||
, changePasswordForm : Messages.Comp.ChangePasswordForm.Texts
|
||||
, uiSettingsManage : Messages.Comp.UiSettingsManage.Texts
|
||||
, emailSettingsManage : Messages.Comp.EmailSettingsManage.Texts
|
||||
, imapSettingsManage : Messages.Comp.ImapSettingsManage.Texts
|
||||
@ -46,8 +48,6 @@ type alias Texts =
|
||||
, scanMailboxInfo1 : String
|
||||
, scanMailboxInfo2 : String
|
||||
, otpMenu : String
|
||||
, webhooks : String
|
||||
, genericQueries : String
|
||||
, dueItems : String
|
||||
, notificationInfoText : String
|
||||
, webhookInfoText : String
|
||||
@ -60,7 +60,8 @@ type alias Texts =
|
||||
|
||||
gb : Texts
|
||||
gb =
|
||||
{ changePasswordForm = Messages.Comp.ChangePasswordForm.gb
|
||||
{ basics = Messages.Basics.gb
|
||||
, changePasswordForm = Messages.Comp.ChangePasswordForm.gb
|
||||
, uiSettingsManage = Messages.Comp.UiSettingsManage.gb
|
||||
, emailSettingsManage = Messages.Comp.EmailSettingsManage.gb
|
||||
, imapSettingsManage = Messages.Comp.ImapSettingsManage.gb
|
||||
@ -96,8 +97,6 @@ gb =
|
||||
adjust the schedule to avoid reading over the same mails
|
||||
again."""
|
||||
, otpMenu = "Two Factor Authentication"
|
||||
, webhooks = "Webhooks"
|
||||
, genericQueries = "Generic Queries"
|
||||
, dueItems = "Due Items Query"
|
||||
, notificationInfoText = """
|
||||
|
||||
@ -125,7 +124,8 @@ must be created before.
|
||||
|
||||
de : Texts
|
||||
de =
|
||||
{ changePasswordForm = Messages.Comp.ChangePasswordForm.de
|
||||
{ basics = Messages.Basics.de
|
||||
, changePasswordForm = Messages.Comp.ChangePasswordForm.de
|
||||
, uiSettingsManage = Messages.Comp.UiSettingsManage.de
|
||||
, emailSettingsManage = Messages.Comp.EmailSettingsManage.de
|
||||
, imapSettingsManage = Messages.Comp.ImapSettingsManage.de
|
||||
@ -161,8 +161,6 @@ E-Mail-Einstellungen (IMAP) notwendig."""
|
||||
gleichen E-Mails möglichst nicht noch einmal eingelesen
|
||||
werden."""
|
||||
, otpMenu = "Zwei-Faktor-Authentifizierung"
|
||||
, webhooks = "Webhooks"
|
||||
, genericQueries = "Periodische Abfragen"
|
||||
, dueItems = "Fällige Dokumente"
|
||||
, notificationInfoText = """
|
||||
|
||||
|
@ -13,6 +13,7 @@ module Page exposing
|
||||
, goto
|
||||
, hasSidebar
|
||||
, href
|
||||
, isDashboardPage
|
||||
, isOpen
|
||||
, isSearchPage
|
||||
, isSecured
|
||||
@ -153,6 +154,16 @@ isSearchPage page =
|
||||
False
|
||||
|
||||
|
||||
isDashboardPage : Page -> Bool
|
||||
isDashboardPage page =
|
||||
case page of
|
||||
DashboardPage ->
|
||||
True
|
||||
|
||||
_ ->
|
||||
False
|
||||
|
||||
|
||||
pageName : Page -> String
|
||||
pageName page =
|
||||
case page of
|
||||
|
@ -59,7 +59,7 @@ viewSidebar texts visible _ _ model =
|
||||
[ Icons.sourceIcon2 ""
|
||||
, span
|
||||
[ class "ml-3" ]
|
||||
[ text texts.sources ]
|
||||
[ text texts.basics.sources ]
|
||||
]
|
||||
, a
|
||||
[ href "#"
|
||||
@ -70,7 +70,7 @@ viewSidebar texts visible _ _ model =
|
||||
[ Icons.shareIcon ""
|
||||
, span
|
||||
[ class "ml-3" ]
|
||||
[ text texts.shares ]
|
||||
[ text texts.basics.shares ]
|
||||
]
|
||||
, a
|
||||
[ href "#"
|
||||
@ -238,7 +238,7 @@ viewSources texts flags settings model =
|
||||
]
|
||||
[ Icons.sourceIcon2 ""
|
||||
, div [ class "ml-3" ]
|
||||
[ text texts.sources
|
||||
[ text texts.basics.sources
|
||||
]
|
||||
]
|
||||
, Html.map SourceMsg (Comp.SourceManage.view2 texts.sourceManage flags settings model.sourceModel)
|
||||
@ -253,7 +253,7 @@ viewShares texts settings flags model =
|
||||
]
|
||||
[ Icons.shareIcon ""
|
||||
, div [ class "ml-3" ]
|
||||
[ text texts.shares
|
||||
[ text texts.basics.shares
|
||||
]
|
||||
]
|
||||
, Html.map ShareMsg (Comp.ShareManage.view texts.shareManage settings flags model.shareModel)
|
||||
|
@ -27,6 +27,7 @@ import Comp.PersonManage
|
||||
import Comp.ShareManage
|
||||
import Comp.SourceManage
|
||||
import Comp.TagManage
|
||||
import Comp.UploadForm
|
||||
import Data.Bookmarks exposing (AllBookmarks)
|
||||
import Data.Dashboard exposing (Dashboard)
|
||||
import Data.Flags exposing (Flags)
|
||||
@ -73,7 +74,7 @@ initCmd flags =
|
||||
|
||||
reloadDashboard : Msg
|
||||
reloadDashboard =
|
||||
InitDashboard
|
||||
ReloadDashboardData
|
||||
|
||||
|
||||
reloadUiSettings : Msg
|
||||
@ -93,6 +94,7 @@ type Msg
|
||||
| EquipmentMsg Comp.EquipmentManage.Msg
|
||||
| TagMsg Comp.TagManage.Msg
|
||||
| FolderMsg Comp.FolderManage.Msg
|
||||
| UploadMsg Comp.UploadForm.Msg
|
||||
| DashboardMsg Comp.DashboardView.Msg
|
||||
| InitNotificationHook
|
||||
| InitDashboard
|
||||
@ -104,6 +106,8 @@ type Msg
|
||||
| InitEquipment
|
||||
| InitTags
|
||||
| InitFolder
|
||||
| InitUpload
|
||||
| ReloadDashboardData
|
||||
|
||||
|
||||
type Content
|
||||
@ -117,3 +121,4 @@ type Content
|
||||
| Equipment Comp.EquipmentManage.Model
|
||||
| Tags Comp.TagManage.Model
|
||||
| Folder Comp.FolderManage.Model
|
||||
| Upload Comp.UploadForm.Model
|
||||
|
@ -17,9 +17,10 @@ value texts =
|
||||
, columns = 2
|
||||
, boxes =
|
||||
[ messageBox texts
|
||||
, summary2
|
||||
, fieldStats
|
||||
, newDocuments texts
|
||||
, dueDocuments texts
|
||||
, upload
|
||||
, summary texts
|
||||
]
|
||||
}
|
||||
@ -107,8 +108,8 @@ summary texts =
|
||||
}
|
||||
|
||||
|
||||
summary2 : Box
|
||||
summary2 =
|
||||
fieldStats : Box
|
||||
fieldStats =
|
||||
{ name = ""
|
||||
, visible = True
|
||||
, decoration = True
|
||||
@ -119,3 +120,14 @@ summary2 =
|
||||
, show = SummaryShowFields False
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
upload : Box
|
||||
upload =
|
||||
{ name = ""
|
||||
, visible = True
|
||||
, decoration = True
|
||||
, colspan = 1
|
||||
, content =
|
||||
BoxUpload Nothing
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
module Page.Dashboard.SideMenu exposing (view)
|
||||
|
||||
import Api.Model.VersionInfo exposing (VersionInfo)
|
||||
import Comp.BookmarkChooser
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.Icons as Icons
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (Attribute, Html, a, div, h3, span, text)
|
||||
@ -12,18 +14,18 @@ import Page.Dashboard.Data exposing (Msg(..), SideMenuModel)
|
||||
import Styles as S
|
||||
|
||||
|
||||
view : Texts -> UiSettings -> SideMenuModel -> Html Msg
|
||||
view texts _ model =
|
||||
div [ class "flex flex-col" ]
|
||||
view : Texts -> VersionInfo -> UiSettings -> SideMenuModel -> Html Msg
|
||||
view texts versionInfo _ model =
|
||||
div [ class "flex flex-col flex-grow" ]
|
||||
[ div [ class "mt-2" ]
|
||||
[ menuLink [ onClick InitDashboard, href "#" ] (Icons.dashboardIcon "") "Dashboard"
|
||||
, menuLink [ Page.href (SearchPage Nothing) ] (Icons.searchIcon "") "Items"
|
||||
[ menuLink [ onClick InitDashboard, href "#" ] (Icons.dashboardIcon "") texts.dashboardLink
|
||||
, menuLink [ Page.href (SearchPage Nothing) ] (Icons.searchIcon "") texts.basics.items
|
||||
]
|
||||
, h3
|
||||
[ class S.header3
|
||||
, class "italic mt-3"
|
||||
]
|
||||
[ text "Bookmarks"
|
||||
[ text texts.bookmarks
|
||||
]
|
||||
, div [ class "ml-2" ]
|
||||
[ Html.map BookmarkMsg
|
||||
@ -38,29 +40,44 @@ view texts _ model =
|
||||
[ class S.header3
|
||||
, class "italic mt-3"
|
||||
]
|
||||
[ text "Manage"
|
||||
[ text texts.settings
|
||||
]
|
||||
, div [ class "ml-2 mb-2" ]
|
||||
[ menuLink [ onClick InitOrganization, href "#" ] (Icons.organizationIcon "") "Organization"
|
||||
, menuLink [ onClick InitPerson, href "#" ] (Icons.personIcon "") "Person"
|
||||
, menuLink [ onClick InitEquipment, href "#" ] (Icons.equipmentIcon "") "Equipment"
|
||||
, menuLink [ onClick InitTags, href "#" ] (Icons.tagsIcon "") "Tags"
|
||||
, menuLink [ onClick InitFolder, href "#" ] (Icons.folderIcon "") "Folder"
|
||||
]
|
||||
, div [ class "ml-2" ]
|
||||
[ menuLink [ onClick InitNotificationHook, href "#" ] (Icons.notificationHooksIcon "") "Webhooks"
|
||||
, menuLink [ onClick InitPeriodicQuery, href "#" ] (Icons.periodicTasksIcon "") "Periodic Queries"
|
||||
, menuLink [ onClick InitSource, href "#" ] (Icons.sourceIcon2 "") "Sources"
|
||||
, menuLink [ onClick InitShare, href "#" ] (Icons.shareIcon "") "Shares"
|
||||
[ menuLink [ onClick InitNotificationHook, href "#" ] (Icons.notificationHooksIcon "") texts.basics.notificationHooks
|
||||
, menuLink [ onClick InitPeriodicQuery, href "#" ] (Icons.periodicTasksIcon "") texts.basics.periodicQueries
|
||||
, menuLink [ onClick InitSource, href "#" ] (Icons.sourceIcon2 "") texts.basics.sources
|
||||
, menuLink [ onClick InitShare, href "#" ] (Icons.shareIcon "") texts.basics.shares
|
||||
]
|
||||
, h3
|
||||
[ class S.header3
|
||||
, class "italic mt-3"
|
||||
]
|
||||
[ text "Misc"
|
||||
[ text texts.manage
|
||||
]
|
||||
, div [ class "ml-2 mb-2" ]
|
||||
[ menuLink [ onClick InitOrganization, href "#" ] (Icons.organizationIcon "") texts.basics.organization
|
||||
, menuLink [ onClick InitPerson, href "#" ] (Icons.personIcon "") texts.basics.person
|
||||
, menuLink [ onClick InitEquipment, href "#" ] (Icons.equipmentIcon "") texts.basics.equipment
|
||||
, menuLink [ onClick InitTags, href "#" ] (Icons.tagsIcon "") texts.basics.tags
|
||||
, menuLink [ onClick InitFolder, href "#" ] (Icons.folderIcon "") texts.basics.folder
|
||||
]
|
||||
, h3
|
||||
[ class S.header3
|
||||
, class "italic mt-3"
|
||||
]
|
||||
[ text texts.misc
|
||||
]
|
||||
, div [ class "ml-2" ]
|
||||
[ menuLink [ href "#", target "_blank" ] (Icons.documentationIcon "") "Documentation"
|
||||
[ menuLink [ onClick InitUpload, href "#" ] (Icons.fileUploadIcon "") texts.uploadFiles
|
||||
]
|
||||
, div [ class "mt-2 opacity-75" ]
|
||||
[ menuLink [ href Data.UiSettings.documentationSite, target "_blank" ] (Icons.documentationIcon "") texts.documentation
|
||||
]
|
||||
, div [ class "flex flex-grow items-end" ]
|
||||
[ div [ class "text-center text-xs w-full opacity-50" ]
|
||||
[ text "Docspell "
|
||||
, text versionInfo.version
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -19,6 +19,7 @@ import Comp.PersonManage
|
||||
import Comp.ShareManage
|
||||
import Comp.SourceManage
|
||||
import Comp.TagManage
|
||||
import Comp.UploadForm
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Messages.Page.Dashboard exposing (Texts)
|
||||
@ -26,6 +27,7 @@ import Page exposing (Page(..))
|
||||
import Page.Dashboard.Data exposing (..)
|
||||
import Page.Dashboard.DefaultDashboard
|
||||
import Set
|
||||
import Styles exposing (content)
|
||||
|
||||
|
||||
update : Texts -> UiSettings -> Nav.Key -> Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
@ -59,14 +61,19 @@ update texts settings navKey flags msg model =
|
||||
)
|
||||
|
||||
InitDashboard ->
|
||||
let
|
||||
board =
|
||||
Page.Dashboard.DefaultDashboard.getDefaultDashboard flags settings
|
||||
case model.content of
|
||||
Home _ ->
|
||||
update texts settings navKey flags ReloadDashboardData model
|
||||
|
||||
( dm, dc ) =
|
||||
Comp.DashboardView.init flags board
|
||||
in
|
||||
( { model | content = Home dm }, Cmd.map DashboardMsg dc, Sub.none )
|
||||
_ ->
|
||||
let
|
||||
board =
|
||||
Page.Dashboard.DefaultDashboard.getDefaultDashboard flags settings
|
||||
|
||||
( dm, dc ) =
|
||||
Comp.DashboardView.init flags board
|
||||
in
|
||||
( { model | content = Home dm }, Cmd.map DashboardMsg dc, Sub.none )
|
||||
|
||||
InitNotificationHook ->
|
||||
let
|
||||
@ -131,6 +138,13 @@ update texts settings navKey flags msg model =
|
||||
in
|
||||
( { model | content = Folder fm }, Cmd.map FolderMsg fc, Sub.none )
|
||||
|
||||
InitUpload ->
|
||||
let
|
||||
um =
|
||||
Comp.UploadForm.init
|
||||
in
|
||||
( { model | content = Upload um }, Cmd.none, Sub.none )
|
||||
|
||||
NotificationHookMsg lm ->
|
||||
case model.content of
|
||||
Webhook nhm ->
|
||||
@ -245,18 +259,37 @@ update texts settings navKey flags msg model =
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
UploadMsg lm ->
|
||||
case model.content of
|
||||
Upload m ->
|
||||
let
|
||||
( um, uc, us ) =
|
||||
Comp.UploadForm.update Nothing flags lm m
|
||||
in
|
||||
( { model | content = Upload um }, Cmd.map UploadMsg uc, Sub.map UploadMsg us )
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
DashboardMsg lm ->
|
||||
case model.content of
|
||||
Home m ->
|
||||
let
|
||||
( dm, dc ) =
|
||||
Comp.DashboardView.update lm m
|
||||
( dm, dc, ds ) =
|
||||
Comp.DashboardView.update flags lm m
|
||||
in
|
||||
( { model | content = Home dm }, Cmd.map DashboardMsg dc, Sub.none )
|
||||
( { model | content = Home dm }, Cmd.map DashboardMsg dc, Sub.map DashboardMsg ds )
|
||||
|
||||
_ ->
|
||||
unit model
|
||||
|
||||
ReloadDashboardData ->
|
||||
let
|
||||
lm =
|
||||
DashboardMsg Comp.DashboardView.reloadData
|
||||
in
|
||||
update texts settings navKey flags lm model
|
||||
|
||||
|
||||
unit : Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
unit m =
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
module Page.Dashboard.View exposing (viewContent, viewSidebar)
|
||||
|
||||
import Api.Model.VersionInfo exposing (VersionInfo)
|
||||
import Comp.DashboardView
|
||||
import Comp.EquipmentManage
|
||||
import Comp.FolderManage
|
||||
@ -17,6 +18,7 @@ import Comp.PersonManage
|
||||
import Comp.ShareManage
|
||||
import Comp.SourceManage
|
||||
import Comp.TagManage
|
||||
import Comp.UploadForm
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
@ -27,15 +29,15 @@ import Page.Dashboard.SideMenu as SideMenu
|
||||
import Styles as S
|
||||
|
||||
|
||||
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg
|
||||
viewSidebar texts visible _ settings model =
|
||||
viewSidebar : Texts -> Bool -> Flags -> VersionInfo -> UiSettings -> Model -> Html Msg
|
||||
viewSidebar texts visible flags versionInfo settings model =
|
||||
div
|
||||
[ id "sidebar"
|
||||
, class S.sidebar
|
||||
, class S.sidebarBg
|
||||
, classList [ ( "hidden", not visible ) ]
|
||||
]
|
||||
[ SideMenu.view texts settings model.sideMenu
|
||||
[ SideMenu.view texts versionInfo settings model.sideMenu
|
||||
]
|
||||
|
||||
|
||||
@ -48,7 +50,7 @@ viewContent texts flags settings model =
|
||||
[ case model.content of
|
||||
Home m ->
|
||||
Html.map DashboardMsg
|
||||
(Comp.DashboardView.view texts.dashboard m)
|
||||
(Comp.DashboardView.view texts.dashboard flags settings m)
|
||||
|
||||
Webhook m ->
|
||||
viewHookManage texts settings m
|
||||
@ -76,6 +78,9 @@ viewContent texts flags settings model =
|
||||
|
||||
Folder m ->
|
||||
viewFolder texts flags m
|
||||
|
||||
Upload m ->
|
||||
viewUplod texts flags settings m
|
||||
]
|
||||
|
||||
|
||||
@ -83,11 +88,29 @@ viewContent texts flags settings model =
|
||||
--- Helpers
|
||||
|
||||
|
||||
viewUplod : Texts -> Flags -> UiSettings -> Comp.UploadForm.Model -> Html Msg
|
||||
viewUplod texts flags settings model =
|
||||
let
|
||||
viewCfg =
|
||||
{ showForm = True
|
||||
, sourceId = Nothing
|
||||
, lightForm = False
|
||||
}
|
||||
in
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text texts.uploadFiles
|
||||
]
|
||||
, Html.map UploadMsg <|
|
||||
Comp.UploadForm.view texts.uploadForm viewCfg flags settings model
|
||||
]
|
||||
|
||||
|
||||
viewFolder : Texts -> Flags -> Comp.FolderManage.Model -> Html Msg
|
||||
viewFolder texts flags model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Folder"
|
||||
[ text texts.basics.folder
|
||||
]
|
||||
, Html.map FolderMsg <|
|
||||
Comp.FolderManage.view2 texts.folderManage flags model
|
||||
@ -98,7 +121,7 @@ viewTags : Texts -> UiSettings -> Comp.TagManage.Model -> Html Msg
|
||||
viewTags texts settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Tags"
|
||||
[ text texts.basics.tags
|
||||
]
|
||||
, Html.map TagMsg <|
|
||||
Comp.TagManage.view2 texts.tagManage settings model
|
||||
@ -109,7 +132,7 @@ viewEquipment : Texts -> Comp.EquipmentManage.Model -> Html Msg
|
||||
viewEquipment texts model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Equipment"
|
||||
[ text texts.basics.equipment
|
||||
]
|
||||
, Html.map EquipmentMsg <|
|
||||
Comp.EquipmentManage.view2 texts.equipManage model
|
||||
@ -120,7 +143,7 @@ viewPerson : Texts -> UiSettings -> Comp.PersonManage.Model -> Html Msg
|
||||
viewPerson texts settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Person"
|
||||
[ text texts.basics.person
|
||||
]
|
||||
, Html.map PersonMsg <|
|
||||
Comp.PersonManage.view2 texts.personManage settings model
|
||||
@ -131,7 +154,7 @@ viewOrganization : Texts -> UiSettings -> Comp.OrgManage.Model -> Html Msg
|
||||
viewOrganization texts settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Organizations"
|
||||
[ text texts.basics.organization
|
||||
]
|
||||
, Html.map OrganizationMsg <|
|
||||
Comp.OrgManage.view2 texts.organizationManage settings model
|
||||
@ -142,7 +165,7 @@ viewShare : Texts -> Flags -> UiSettings -> Comp.ShareManage.Model -> Html Msg
|
||||
viewShare texts flags settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Shares"
|
||||
[ text texts.basics.shares
|
||||
]
|
||||
, Html.map ShareMsg <|
|
||||
Comp.ShareManage.view texts.shareManage settings flags model
|
||||
@ -153,7 +176,7 @@ viewSource : Texts -> Flags -> UiSettings -> Comp.SourceManage.Model -> Html Msg
|
||||
viewSource texts flags settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Sources"
|
||||
[ text texts.basics.sources
|
||||
]
|
||||
, Html.map SourceMsg <|
|
||||
Comp.SourceManage.view2 texts.sourceManage flags settings model
|
||||
@ -164,7 +187,7 @@ viewPeriodicQuery : Texts -> UiSettings -> Comp.PeriodicQueryTaskManage.Model ->
|
||||
viewPeriodicQuery texts settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Periodic Queries"
|
||||
[ text texts.basics.periodicQueries
|
||||
]
|
||||
, Html.map PeriodicQueryMsg <|
|
||||
Comp.PeriodicQueryTaskManage.view texts.periodicQueryManage settings model
|
||||
@ -175,7 +198,7 @@ viewHookManage : Texts -> UiSettings -> Comp.NotificationHookManage.Model -> Htm
|
||||
viewHookManage texts settings model =
|
||||
div []
|
||||
[ h1 [ class S.header1 ]
|
||||
[ text "Notification Hooks"
|
||||
[ text texts.basics.notificationHooks
|
||||
]
|
||||
, Html.map NotificationHookMsg <|
|
||||
Comp.NotificationHookManage.view texts.notificationHookManage settings model
|
||||
|
@ -15,6 +15,7 @@ import Html.Attributes exposing (..)
|
||||
import Messages.Page.Upload exposing (Texts)
|
||||
import Page exposing (Page(..))
|
||||
import Page.Upload.Data exposing (..)
|
||||
import Styles
|
||||
|
||||
|
||||
viewSidebar : Maybe String -> Bool -> Flags -> UiSettings -> Model -> Html Msg
|
||||
@ -28,5 +29,18 @@ viewSidebar _ _ _ _ _ =
|
||||
|
||||
viewContent : Texts -> Maybe String -> Flags -> UiSettings -> Model -> Html Msg
|
||||
viewContent texts sourceId flags settings model =
|
||||
Html.map UploadMsg
|
||||
(Comp.UploadForm.view texts.uploadForm sourceId flags settings model.uploadForm)
|
||||
let
|
||||
viewCfg =
|
||||
{ sourceId = sourceId
|
||||
, showForm = True
|
||||
, lightForm = False
|
||||
}
|
||||
in
|
||||
div
|
||||
[ id "content"
|
||||
, class Styles.content
|
||||
, class "mt-4"
|
||||
]
|
||||
[ Html.map UploadMsg
|
||||
(Comp.UploadForm.view texts.uploadForm viewCfg flags settings model.uploadForm)
|
||||
]
|
||||
|
@ -97,7 +97,7 @@ viewSidebar texts visible _ _ model =
|
||||
[ i [ class "fa fa-bell" ] []
|
||||
, span
|
||||
[ class "ml-3" ]
|
||||
[ text texts.webhooks ]
|
||||
[ text texts.basics.notificationHooks ]
|
||||
]
|
||||
, a
|
||||
[ href "#"
|
||||
@ -119,7 +119,7 @@ viewSidebar texts visible _ _ model =
|
||||
[ i [ class "fa fa-history" ] []
|
||||
, span
|
||||
[ class "ml-3" ]
|
||||
[ text texts.genericQueries ]
|
||||
[ text texts.basics.periodicQueries ]
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -396,7 +396,7 @@ viewNotificationInfo texts settings model =
|
||||
[ i [ class "fa fa-bell" ] []
|
||||
, span
|
||||
[ class "ml-3" ]
|
||||
[ text texts.webhooks ]
|
||||
[ text texts.basics.notificationHooks ]
|
||||
]
|
||||
, div [ class "ml-3 text-sm opacity-50" ]
|
||||
[ text texts.webhookInfoText
|
||||
@ -426,7 +426,7 @@ viewNotificationInfo texts settings model =
|
||||
[ Icons.periodicTasksIcon ""
|
||||
, span
|
||||
[ class "ml-3" ]
|
||||
[ text texts.genericQueries ]
|
||||
[ text texts.basics.periodicQueries ]
|
||||
]
|
||||
, div [ class "ml-3 text-sm opacity-50" ]
|
||||
[ text texts.periodicQueryInfoText
|
||||
@ -465,7 +465,7 @@ viewNotificationQueries texts settings model =
|
||||
]
|
||||
[ i [ class "fa fa-history" ] []
|
||||
, div [ class "ml-3" ]
|
||||
[ text texts.genericQueries
|
||||
[ text texts.basics.periodicQueries
|
||||
]
|
||||
]
|
||||
, Markdown.toHtml [ class "opacity-80 text-lg mb-3 markdown-preview" ] texts.periodicQueryInfoText
|
||||
@ -485,7 +485,7 @@ viewNotificationHooks texts settings model =
|
||||
]
|
||||
[ i [ class "fa fa-bell" ] []
|
||||
, div [ class "ml-3" ]
|
||||
[ text texts.webhooks
|
||||
[ text texts.basics.notificationHooks
|
||||
]
|
||||
]
|
||||
, Markdown.toHtml [ class "opacity-80 text-lg mb-3 markdown-preview" ] texts.webhookInfoText
|
||||
|
@ -253,7 +253,7 @@ deleteLabel =
|
||||
|
||||
link : String
|
||||
link =
|
||||
" text-blue-400 hover:text-blue-500 dark:text-sky-200 dark:hover:text-sky-100 cursor-pointer "
|
||||
" text-blue-600 hover:text-blue-500 dark:text-sky-200 dark:hover:text-sky-100 cursor-pointer "
|
||||
|
||||
|
||||
inputErrorBorder : String
|
||||
|
Loading…
Reference in New Issue
Block a user