Readonly dashboard

This commit is contained in:
eikek
2022-01-26 21:22:51 +01:00
parent 67f1575707
commit 2c2b34cd89
29 changed files with 597 additions and 199 deletions

View File

@ -330,6 +330,9 @@ updateWithSub msg model =
if Page.isSearchPage model.page && isProcessItem then if Page.isSearchPage model.page && isProcessItem then
updateSearch texts Page.Search.Data.RefreshView newModel updateSearch texts Page.Search.Data.RefreshView newModel
else if Page.isDashboardPage model.page && isProcessItem then
updateDashboard texts Page.Dashboard.Data.reloadDashboard newModel
else else
( newModel, Cmd.none, Sub.none ) ( newModel, Cmd.none, Sub.none )

View File

@ -12,6 +12,7 @@ import App.Data exposing (..)
import Comp.Basic as B import Comp.Basic as B
import Data.Flags import Data.Flags
import Data.Icons as Icons import Data.Icons as Icons
import Data.UiSettings
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
@ -78,7 +79,11 @@ topNavUser auth model =
[ class S.infoMessageBase [ class S.infoMessageBase
, class "my-2 px-1 py-1 rounded-lg inline-block hover:opacity-50" , class "my-2 px-1 py-1 rounded-lg inline-block hover:opacity-50"
, classList [ ( "hidden", not model.showNewItemsArrived ) ] , 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 , onClick ToggleShowNewItemsArrived
] ]
[ i [ class "fa fa-exclamation-circle mr-1" ] [] [ i [ class "fa fa-exclamation-circle mr-1" ] []
@ -317,7 +322,7 @@ dataMenu texts _ model =
, dataPageLink model , dataPageLink model
(UploadPage Nothing) (UploadPage Nothing)
[] []
[ i [ class "fa fa-upload w-6" ] [] [ Icons.fileUploadIcon "w-6"
, span [ class "ml-1" ] , span [ class "ml-1" ]
[ text texts.uploadFiles [ text texts.uploadFiles
] ]
@ -358,9 +363,9 @@ dataMenu texts _ model =
] ]
, a , a
[ class dropdownItem [ class dropdownItem
, href "https://docspell.org/docs" , href Data.UiSettings.documentationSite
, target "_new" , target "_new"
, title "Opens https://docspell.org/docs" , title ("Opens " ++ Data.UiSettings.documentationSite)
] ]
[ Icons.documentationIcon "w-6" [ Icons.documentationIcon "w-6"
, span [ class "ml-1" ] [ text texts.help ] , span [ class "ml-1" ] [ text texts.help ]
@ -486,6 +491,7 @@ viewDashboard texts model =
(Dashboard.viewSidebar texts.dashboard (Dashboard.viewSidebar texts.dashboard
model.sidebarVisible model.sidebarVisible
model.flags model.flags
model.version
model.uiSettings model.uiSettings
model.dashboardModel model.dashboardModel
) )

View File

@ -1,4 +1,4 @@
module Comp.BoxQueryView exposing (..) module Comp.BoxQueryView exposing (Model, Msg, init, reloadData, update, view)
import Api import Api
import Api.Model.ItemLight exposing (ItemLight) import Api.Model.ItemLight exposing (ItemLight)
@ -32,6 +32,7 @@ type ViewResult
type Msg type Msg
= ItemsResp (Result Http.Error ItemLightList) = ItemsResp (Result Http.Error ItemLightList)
| ReloadData
init : Flags -> QueryData -> ( Model, Cmd Msg ) init : Flags -> QueryData -> ( Model, Cmd Msg )
@ -39,27 +40,30 @@ init flags data =
( { results = Loading ( { results = Loading
, meta = data , meta = data
} }
, case data.query of , dataCmd flags data
SearchQueryString q ->
Api.itemSearch flags (mkQuery q data) ItemsResp
SearchQueryBookmark bmId ->
Api.itemSearchBookmark flags (mkQuery bmId data) ItemsResp
) )
reloadData : Msg
reloadData =
ReloadData
--- Update --- Update
update : Msg -> Model -> ( Model, Cmd Msg ) update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Bool )
update msg model = update flags msg model =
case msg of case msg of
ItemsResp (Ok list) -> ItemsResp (Ok list) ->
( { model | results = Loaded list }, Cmd.none ) ( { model | results = Loaded list }, Cmd.none, False )
ItemsResp (Err err) -> 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 = viewEmpty texts =
div [ class "flex justify-center items-center h-full" ] div [ class "flex justify-center items-center h-full" ]
[ div [ class "px-4 py-4 text-center align-middle text-lg" ] [ 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 , text texts.noResults
] ]
] ]
@ -182,3 +186,13 @@ mkQuery q meta =
, searchMode = Just <| Data.SearchMode.asString Data.SearchMode.Normal , searchMode = Just <| Data.SearchMode.asString Data.SearchMode.Normal
, withDetails = Just meta.details , 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

View File

@ -1,4 +1,4 @@
module Comp.BoxSummaryView exposing (..) module Comp.BoxSummaryView exposing (Model, Msg, init, reloadData, update, view)
import Api import Api
import Api.Model.ItemQuery exposing (ItemQuery) import Api.Model.ItemQuery exposing (ItemQuery)
@ -17,7 +17,7 @@ import Util.List
type alias Model = type alias Model =
{ results : ViewResult { results : ViewResult
, show : SummaryShow , meta : SummaryData
} }
@ -29,34 +29,38 @@ type ViewResult
type Msg type Msg
= StatsResp (Result Http.Error SearchStats) = StatsResp (Result Http.Error SearchStats)
| ReloadData
init : Flags -> SummaryData -> ( Model, Cmd Msg ) init : Flags -> SummaryData -> ( Model, Cmd Msg )
init flags data = init flags data =
( { results = Loading ( { results = Loading
, show = data.show , meta = data
} }
, case data.query of , dataCmd flags data
SearchQueryString q ->
Api.itemSearchStats flags (mkQuery q) StatsResp
SearchQueryBookmark bmId ->
Api.itemSearchStatsBookmark flags (mkQuery bmId) StatsResp
) )
reloadData : Msg
reloadData =
ReloadData
--- Update --- Update
update : Msg -> Model -> ( Model, Cmd Msg ) update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Bool )
update msg model = update flags msg model =
case msg of case msg of
StatsResp (Ok stats) -> StatsResp (Ok stats) ->
( { model | results = Loaded stats }, Cmd.none ) ( { model | results = Loaded stats }, Cmd.none, False )
StatsResp (Err err) -> 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 -> Loaded stats ->
case model.show of viewStats texts model stats
Data.BoxContent.SummaryShowFields flag ->
Comp.SearchStatsView.view2
texts.statsView
flag
""
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 viewGeneral : Texts -> SearchStats -> Html Msg
@ -158,3 +167,13 @@ mkQuery query =
, searchMode = Nothing , searchMode = Nothing
, withDetails = 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

View 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)
]

View File

@ -2,10 +2,12 @@ module Comp.BoxView exposing (..)
import Comp.BoxQueryView import Comp.BoxQueryView
import Comp.BoxSummaryView import Comp.BoxSummaryView
import Comp.BoxUploadView
import Data.Box exposing (Box) import Data.Box exposing (Box)
import Data.BoxContent exposing (BoxContent(..), MessageData) import Data.BoxContent exposing (BoxContent(..), MessageData)
import Data.Flags exposing (Flags) 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 Html.Attributes exposing (class, classList)
import Markdown import Markdown
import Messages.Comp.BoxView exposing (Texts) import Messages.Comp.BoxView exposing (Texts)
@ -15,12 +17,13 @@ import Styles as S
type alias Model = type alias Model =
{ box : Box { box : Box
, content : ContentModel , content : ContentModel
, reloading : Bool
} }
type ContentModel type ContentModel
= ContentMessage Data.BoxContent.MessageData = ContentMessage Data.BoxContent.MessageData
| ContentUpload (Maybe String) | ContentUpload Comp.BoxUploadView.Model
| ContentQuery Comp.BoxQueryView.Model | ContentQuery Comp.BoxQueryView.Model
| ContentSummary Comp.BoxSummaryView.Model | ContentSummary Comp.BoxSummaryView.Model
@ -28,6 +31,8 @@ type ContentModel
type Msg type Msg
= QueryMsg Comp.BoxQueryView.Msg = QueryMsg Comp.BoxQueryView.Msg
| SummaryMsg Comp.BoxSummaryView.Msg | SummaryMsg Comp.BoxSummaryView.Msg
| UploadMsg Comp.BoxUploadView.Msg
| ReloadData
init : Flags -> Box -> ( Model, Cmd Msg ) init : Flags -> Box -> ( Model, Cmd Msg )
@ -38,11 +43,17 @@ init flags box =
in in
( { box = box ( { box = box
, content = cm , content = cm
, reloading = False
} }
, cc , cc
) )
reloadData : Msg
reloadData =
ReloadData
contentInit : Flags -> BoxContent -> ( ContentModel, Cmd Msg ) contentInit : Flags -> BoxContent -> ( ContentModel, Cmd Msg )
contentInit flags content = contentInit flags content =
case content of case content of
@ -50,7 +61,11 @@ contentInit flags content =
( ContentMessage data, Cmd.none ) ( ContentMessage data, Cmd.none )
BoxUpload source -> BoxUpload source ->
( ContentUpload source, Cmd.none ) let
qm =
Comp.BoxUploadView.init source
in
( ContentUpload qm, Cmd.none )
BoxQuery data -> BoxQuery data ->
let let
@ -71,17 +86,20 @@ contentInit flags content =
--- Update --- Update
update : Msg -> Model -> ( Model, Cmd Msg ) update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
update msg model = update flags msg model =
case msg of case msg of
QueryMsg lm -> QueryMsg lm ->
case model.content of case model.content of
ContentQuery qm -> ContentQuery qm ->
let let
( cm, cc ) = ( cm, cc, reloading ) =
Comp.BoxQueryView.update lm qm Comp.BoxQueryView.update flags lm qm
in in
( { model | content = ContentQuery cm }, Cmd.map QueryMsg cc ) ( { model | content = ContentQuery cm, reloading = reloading }
, Cmd.map QueryMsg cc
, Sub.none
)
_ -> _ ->
unit model unit model
@ -90,43 +108,84 @@ update msg model =
case model.content of case model.content of
ContentSummary qm -> ContentSummary qm ->
let let
( cm, cc ) = ( cm, cc, reloading ) =
Comp.BoxSummaryView.update lm qm Comp.BoxSummaryView.update flags lm qm
in 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
unit : Model -> ( Model, Cmd Msg ) unit : Model -> ( Model, Cmd Msg, Sub Msg )
unit model = unit model =
( model, Cmd.none ) ( model, Cmd.none, Sub.none )
--- View --- View
view : Texts -> Model -> Html Msg view : Texts -> Flags -> UiSettings -> Model -> Html Msg
view texts model = view texts flags settings model =
div div
[ classList [ ( S.box ++ "rounded", model.box.decoration ) ] [ classList [ ( S.box ++ "rounded", model.box.decoration ) ]
, class (spanStyle model.box) , class (spanStyle model.box)
, class "relative h-full" , class "relative h-full"
, classList [ ( "hidden", not model.box.visible ) ] , classList [ ( "hidden", not model.box.visible ) ]
] ]
[ boxHeader model [ boxLoading model
, boxHeader model
, div [ class "px-2 py-1 h-5/6" ] , 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 -> Html Msg
boxHeader model = boxHeader model =
div 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 == "" ) ] , classList [ ( "hidden", not model.box.decoration || model.box.name == "" ) ]
] ]
[ div [ class "flex text-lg tracking-medium italic px-2" ] [ div [ class "flex text-lg tracking-medium italic px-2" ]
@ -135,14 +194,15 @@ boxHeader model =
] ]
boxContent : Texts -> Model -> Html Msg boxContent : Texts -> Flags -> UiSettings -> Model -> Html Msg
boxContent texts model = boxContent texts flags settings model =
case model.content of case model.content of
ContentMessage m -> ContentMessage m ->
messageContent m messageContent m
ContentUpload sourceId -> ContentUpload qm ->
Debug.todo "not implemented" Html.map UploadMsg
(Comp.BoxUploadView.view texts.uploadView flags settings qm)
ContentQuery qm -> ContentQuery qm ->
Html.map QueryMsg Html.map QueryMsg

View File

@ -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 Comp.BoxView
import Data.Box exposing (Box) import Data.Box exposing (Box)
import Data.Dashboard exposing (Dashboard) import Data.Dashboard exposing (Dashboard)
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings)
import Dict exposing (Dict) import Dict exposing (Dict)
import Html exposing (Html, div) import Html exposing (Html, div)
import Html.Attributes exposing (class) import Html.Attributes exposing (class)
import Messages.Comp.DashboardView exposing (Texts) import Messages.Comp.DashboardView exposing (Texts)
import Util.Update
type alias Model = type alias Model =
@ -18,6 +20,7 @@ type alias Model =
type Msg type Msg
= BoxMsg Int Comp.BoxView.Msg = BoxMsg Int Comp.BoxView.Msg
| ReloadData
init : Flags -> Dashboard -> ( Model, Cmd Msg ) init : Flags -> Dashboard -> ( Model, Cmd Msg )
@ -37,49 +40,64 @@ init flags db =
) )
reloadData : Msg
reloadData =
ReloadData
--- Update --- Update
update : Msg -> Model -> ( Model, Cmd Msg ) update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
update msg model = update flags msg model =
case msg of case msg of
BoxMsg index lm -> BoxMsg index lm ->
case Dict.get index model.boxModels of case Dict.get index model.boxModels of
Just bm -> Just bm ->
let let
( cm, cc ) = ( cm, cc, cs ) =
Comp.BoxView.update lm bm Comp.BoxView.update flags lm bm
in in
( { model | boxModels = Dict.insert index cm model.boxModels } ( { model | boxModels = Dict.insert index cm model.boxModels }
, Cmd.map (BoxMsg index) cc , Cmd.map (BoxMsg index) cc
, Sub.map (BoxMsg index) cs
) )
Nothing -> Nothing ->
unit model 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 = unit model =
( model, Cmd.none ) ( model, Cmd.none, Sub.none )
--- View --- View
view : Texts -> Model -> Html Msg view : Texts -> Flags -> UiSettings -> Model -> Html Msg
view texts model = view texts flags settings model =
div div
[ class (gridStyle model.dashboard) [ 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 -> Flags -> UiSettings -> Int -> Comp.BoxView.Model -> Html Msg
viewBox texts index box = viewBox texts flags settings index box =
Html.map (BoxMsg index) Html.map (BoxMsg index)
(Comp.BoxView.view texts.boxView box) (Comp.BoxView.view texts.boxView flags settings box)

View File

@ -3,8 +3,6 @@
SPDX-License-Identifier: AGPL-3.0-or-later SPDX-License-Identifier: AGPL-3.0-or-later
-} -}
-- inspired from here: https://ellie-app.com/3T5mNms7SwKa1 -- inspired from here: https://ellie-app.com/3T5mNms7SwKa1
@ -132,15 +130,21 @@ filterMime model files =
--- View2 --- View2
view2 : Texts -> Model -> Html Msg type alias ViewSettings =
view2 texts model = { light : Bool
}
view2 : Texts -> ViewSettings -> Model -> Html Msg
view2 texts cfg model =
div div
[ classList [ classList
[ ( "bg-opacity-100 bg-blue-100 dark:bg-sky-800", model.state.hover ) [ ( "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 ) , ( "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 , onDragEnter DragEnter
, onDragOver DragEnter , onDragOver DragEnter
, onDragLeave DragLeave , onDragLeave DragLeave
@ -168,7 +172,10 @@ view2 texts model =
, attrs = [ href "#" ] , attrs = [ href "#" ]
, disabled = not model.state.active , 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 [ text texts.selectInfo
] ]
] ]

View File

@ -24,6 +24,11 @@ import Util.Size
view : Texts -> Model -> Html Msg view : Texts -> Model -> Html Msg
view texts model = view texts model =
let
dropzoneCfg =
{ light = True
}
in
div div
[ classList [ classList
[ ( "hidden", not model.addFilesOpen ) [ ( "hidden", not model.addFilesOpen )
@ -35,7 +40,7 @@ view texts model =
[ text texts.addMoreFilesToItem [ text texts.addMoreFilesToItem
] ]
, Html.map AddFilesMsg , 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" ] , div [ class "flex flex-row space-x-2 mt-2" ]
[ button [ button
[ class S.primaryButton [ class S.primaryButton

View File

@ -294,47 +294,57 @@ setErrored model fileid =
--- View --- View
view : Texts -> Maybe String -> Flags -> UiSettings -> Model -> Html Msg type alias ViewSettings =
view texts mid _ _ model = { showForm : Bool
div , sourceId : Maybe String
[ id "content" , lightForm : Bool
, 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
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 else
(Comp.Dropzone.view2 texts.dropzone model.dropzone) 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" ] [ text texts.basics.submit
[ a ]
[ class Styles.primaryButton , a
, href "#" [ class Styles.secondaryButton
, onClick SubmitUpload , class "ml-2"
] , href "#"
[ text texts.basics.submit , onClick Clear
] ]
, a [ text texts.reset
[ 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
] ]

View File

@ -43,6 +43,7 @@ module Data.Icons exposing
, editNotesIcon , editNotesIcon
, equipment , equipment
, equipmentIcon , equipmentIcon
, fileUploadIcon
, folder , folder
, folderIcon , folderIcon
, gotifyIcon , gotifyIcon
@ -160,6 +161,16 @@ source2 =
"fa fa-upload" "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 : String -> Html msg
sourceIcon2 classes = sourceIcon2 classes =
i [ class (source2 ++ " " ++ classes) ] [] i [ class (source2 ++ " " ++ classes) ] []

View File

@ -16,6 +16,7 @@ module Data.UiSettings exposing
, catColorFg2 , catColorFg2
, catColorString2 , catColorString2
, defaults , defaults
, documentationSite
, fieldHidden , fieldHidden
, fieldVisible , fieldVisible
, getUiLanguage , getUiLanguage
@ -455,6 +456,11 @@ getUiLanguage flags settings default =
default default
documentationSite : String
documentationSite =
"https://docspell.org/docs"
--- Helpers --- Helpers

View File

@ -45,6 +45,10 @@ type alias Texts =
, customFields : String , customFields : String
, direction : String , direction : String
, folderNotOwnerWarning : 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 from any search now. Use a folder where you are a member of to make this
item visible. This message will disappear then. 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 Nutze lieber einen Ordner, dem Du als Mitglied zugeordnet bist. Diese
Nachricht verschwindet dann. Nachricht verschwindet dann.
""" """
, shares = "Freigaben"
, sources = "Quellen"
, periodicQueries = "Periodische Abfragen"
, notificationHooks = "Webhooks"
} }

View 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"
}

View File

@ -2,11 +2,13 @@ module Messages.Comp.BoxView exposing (Texts, de, gb)
import Messages.Comp.BoxQueryView import Messages.Comp.BoxQueryView
import Messages.Comp.BoxSummaryView import Messages.Comp.BoxSummaryView
import Messages.Comp.BoxUploadView
type alias Texts = type alias Texts =
{ queryView : Messages.Comp.BoxQueryView.Texts { queryView : Messages.Comp.BoxQueryView.Texts
, summaryView : Messages.Comp.BoxSummaryView.Texts , summaryView : Messages.Comp.BoxSummaryView.Texts
, uploadView : Messages.Comp.BoxUploadView.Texts
} }
@ -14,6 +16,7 @@ gb : Texts
gb = gb =
{ queryView = Messages.Comp.BoxQueryView.gb { queryView = Messages.Comp.BoxQueryView.gb
, summaryView = Messages.Comp.BoxSummaryView.gb , summaryView = Messages.Comp.BoxSummaryView.gb
, uploadView = Messages.Comp.BoxUploadView.gb
} }
@ -21,4 +24,5 @@ de : Texts
de = de =
{ queryView = Messages.Comp.BoxQueryView.de { queryView = Messages.Comp.BoxQueryView.de
, summaryView = Messages.Comp.BoxSummaryView.de , summaryView = Messages.Comp.BoxSummaryView.de
, uploadView = Messages.Comp.BoxUploadView.de
} }

View File

@ -29,10 +29,8 @@ type alias Texts =
, httpError : Http.Error -> String , httpError : Http.Error -> String
, collectiveSettings : String , collectiveSettings : String
, insights : String , insights : String
, sources : String
, settings : String , settings : String
, users : String , users : String
, shares : String
, user : String , user : String
, collective : String , collective : String
, size : String , size : String
@ -51,10 +49,8 @@ gb =
, httpError = Messages.Comp.HttpError.gb , httpError = Messages.Comp.HttpError.gb
, collectiveSettings = "Collective Settings" , collectiveSettings = "Collective Settings"
, insights = "Insights" , insights = "Insights"
, sources = "Sources"
, settings = "Settings" , settings = "Settings"
, users = "Users" , users = "Users"
, shares = "Shares"
, user = "User" , user = "User"
, collective = "Collective" , collective = "Collective"
, size = "Size" , size = "Size"
@ -73,10 +69,8 @@ de =
, httpError = Messages.Comp.HttpError.de , httpError = Messages.Comp.HttpError.de
, collectiveSettings = "Kollektiveinstellungen" , collectiveSettings = "Kollektiveinstellungen"
, insights = "Statistiken" , insights = "Statistiken"
, sources = "Quellen"
, settings = "Einstellungen" , settings = "Einstellungen"
, users = "Benutzer" , users = "Benutzer"
, shares = "Freigaben"
, user = "Benutzer" , user = "Benutzer"
, collective = "Kollektiv" , collective = "Kollektiv"
, size = "Größe" , size = "Größe"

View File

@ -1,5 +1,6 @@
module Messages.Page.Dashboard exposing (Texts, de, gb) module Messages.Page.Dashboard exposing (Texts, de, gb)
import Messages.Basics
import Messages.Comp.BookmarkChooser import Messages.Comp.BookmarkChooser
import Messages.Comp.DashboardView import Messages.Comp.DashboardView
import Messages.Comp.EquipmentManage import Messages.Comp.EquipmentManage
@ -11,11 +12,13 @@ import Messages.Comp.PersonManage
import Messages.Comp.ShareManage import Messages.Comp.ShareManage
import Messages.Comp.SourceManage import Messages.Comp.SourceManage
import Messages.Comp.TagManage import Messages.Comp.TagManage
import Messages.Comp.UploadForm
import Messages.Page.DefaultDashboard import Messages.Page.DefaultDashboard
type alias Texts = type alias Texts =
{ bookmarkChooser : Messages.Comp.BookmarkChooser.Texts { basics : Messages.Basics.Texts
, bookmarkChooser : Messages.Comp.BookmarkChooser.Texts
, notificationHookManage : Messages.Comp.NotificationHookManage.Texts , notificationHookManage : Messages.Comp.NotificationHookManage.Texts
, periodicQueryManage : Messages.Comp.PeriodicQueryTaskManage.Texts , periodicQueryManage : Messages.Comp.PeriodicQueryTaskManage.Texts
, sourceManage : Messages.Comp.SourceManage.Texts , sourceManage : Messages.Comp.SourceManage.Texts
@ -25,14 +28,23 @@ type alias Texts =
, equipManage : Messages.Comp.EquipmentManage.Texts , equipManage : Messages.Comp.EquipmentManage.Texts
, tagManage : Messages.Comp.TagManage.Texts , tagManage : Messages.Comp.TagManage.Texts
, folderManage : Messages.Comp.FolderManage.Texts , folderManage : Messages.Comp.FolderManage.Texts
, uploadForm : Messages.Comp.UploadForm.Texts
, dashboard : Messages.Comp.DashboardView.Texts , dashboard : Messages.Comp.DashboardView.Texts
, defaultDashboard : Messages.Page.DefaultDashboard.Texts , defaultDashboard : Messages.Page.DefaultDashboard.Texts
, manage : String
, dashboardLink : String
, bookmarks : String
, misc : String
, settings : String
, documentation : String
, uploadFiles : String
} }
gb : Texts gb : Texts
gb = gb =
{ bookmarkChooser = Messages.Comp.BookmarkChooser.gb { basics = Messages.Basics.gb
, bookmarkChooser = Messages.Comp.BookmarkChooser.gb
, notificationHookManage = Messages.Comp.NotificationHookManage.gb , notificationHookManage = Messages.Comp.NotificationHookManage.gb
, periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.gb , periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.gb
, sourceManage = Messages.Comp.SourceManage.gb , sourceManage = Messages.Comp.SourceManage.gb
@ -42,14 +54,23 @@ gb =
, equipManage = Messages.Comp.EquipmentManage.gb , equipManage = Messages.Comp.EquipmentManage.gb
, tagManage = Messages.Comp.TagManage.gb , tagManage = Messages.Comp.TagManage.gb
, folderManage = Messages.Comp.FolderManage.gb , folderManage = Messages.Comp.FolderManage.gb
, uploadForm = Messages.Comp.UploadForm.gb
, dashboard = Messages.Comp.DashboardView.gb , dashboard = Messages.Comp.DashboardView.gb
, defaultDashboard = Messages.Page.DefaultDashboard.gb , defaultDashboard = Messages.Page.DefaultDashboard.gb
, manage = "Manage"
, dashboardLink = "Dasbhoard"
, bookmarks = "Bookmarks"
, misc = "Misc"
, settings = "Settings"
, documentation = "Documentation"
, uploadFiles = "Upload documents"
} }
de : Texts de : Texts
de = de =
{ bookmarkChooser = Messages.Comp.BookmarkChooser.de { basics = Messages.Basics.de
, bookmarkChooser = Messages.Comp.BookmarkChooser.de
, notificationHookManage = Messages.Comp.NotificationHookManage.de , notificationHookManage = Messages.Comp.NotificationHookManage.de
, periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.de , periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.de
, sourceManage = Messages.Comp.SourceManage.de , sourceManage = Messages.Comp.SourceManage.de
@ -59,6 +80,14 @@ de =
, equipManage = Messages.Comp.EquipmentManage.de , equipManage = Messages.Comp.EquipmentManage.de
, tagManage = Messages.Comp.TagManage.de , tagManage = Messages.Comp.TagManage.de
, folderManage = Messages.Comp.FolderManage.de , folderManage = Messages.Comp.FolderManage.de
, uploadForm = Messages.Comp.UploadForm.de
, dashboard = Messages.Comp.DashboardView.de , dashboard = Messages.Comp.DashboardView.de
, defaultDashboard = Messages.Page.DefaultDashboard.de , defaultDashboard = Messages.Page.DefaultDashboard.de
, manage = "Managen"
, dashboardLink = "Dasbhoard"
, bookmarks = "Bookmarks"
, misc = "Anderes"
, settings = "Einstellungen"
, documentation = "Dokumentation"
, uploadFiles = "Dokumente hochladen"
} }

View File

@ -1,6 +1,8 @@
module Messages.Page.DefaultDashboard exposing (Texts, de, gb) module Messages.Page.DefaultDashboard exposing (Texts, de, gb)
import Data.Fields exposing (Field)
import Messages.Basics import Messages.Basics
import Messages.Data.Fields
type alias Texts = type alias Texts =
@ -29,7 +31,7 @@ gb =
, welcomeBody = "Docspell keeps your documents organized." , welcomeBody = "Docspell keeps your documents organized."
, summaryName = "Summary" , summaryName = "Summary"
, dueInDays = \n -> "Due in " ++ String.fromInt n ++ " days" , dueInDays = \n -> "Due in " ++ String.fromInt n ++ " days"
, dueHeaderColumns = dueHeaderCols b , dueHeaderColumns = dueHeaderCols b Messages.Data.Fields.gb
, newDocsName = "New Documents" , newDocsName = "New Documents"
} }
@ -48,10 +50,10 @@ de =
, summaryName = "Zahlen" , summaryName = "Zahlen"
, dueInDays = \n -> "Fällig in " ++ String.fromInt n ++ " Tagen" , dueInDays = \n -> "Fällig in " ++ String.fromInt n ++ " Tagen"
, newDocsName = "Neue Dokumente" , newDocsName = "Neue Dokumente"
, dueHeaderColumns = dueHeaderCols b , dueHeaderColumns = dueHeaderCols b Messages.Data.Fields.de
} }
dueHeaderCols : Messages.Basics.Texts -> List String dueHeaderCols : Messages.Basics.Texts -> (Field -> String) -> List String
dueHeaderCols b = dueHeaderCols b d =
[ b.name, b.correspondent, b.date ] [ b.name, b.correspondent, d Data.Fields.DueDate ]

View File

@ -11,6 +11,7 @@ module Messages.Page.UserSettings exposing
, gb , gb
) )
import Messages.Basics
import Messages.Comp.ChangePasswordForm import Messages.Comp.ChangePasswordForm
import Messages.Comp.DueItemsTaskManage import Messages.Comp.DueItemsTaskManage
import Messages.Comp.EmailSettingsManage import Messages.Comp.EmailSettingsManage
@ -24,7 +25,8 @@ import Messages.Comp.UiSettingsManage
type alias Texts = type alias Texts =
{ changePasswordForm : Messages.Comp.ChangePasswordForm.Texts { basics : Messages.Basics.Texts
, changePasswordForm : Messages.Comp.ChangePasswordForm.Texts
, uiSettingsManage : Messages.Comp.UiSettingsManage.Texts , uiSettingsManage : Messages.Comp.UiSettingsManage.Texts
, emailSettingsManage : Messages.Comp.EmailSettingsManage.Texts , emailSettingsManage : Messages.Comp.EmailSettingsManage.Texts
, imapSettingsManage : Messages.Comp.ImapSettingsManage.Texts , imapSettingsManage : Messages.Comp.ImapSettingsManage.Texts
@ -46,8 +48,6 @@ type alias Texts =
, scanMailboxInfo1 : String , scanMailboxInfo1 : String
, scanMailboxInfo2 : String , scanMailboxInfo2 : String
, otpMenu : String , otpMenu : String
, webhooks : String
, genericQueries : String
, dueItems : String , dueItems : String
, notificationInfoText : String , notificationInfoText : String
, webhookInfoText : String , webhookInfoText : String
@ -60,7 +60,8 @@ type alias Texts =
gb : Texts gb : Texts
gb = gb =
{ changePasswordForm = Messages.Comp.ChangePasswordForm.gb { basics = Messages.Basics.gb
, changePasswordForm = Messages.Comp.ChangePasswordForm.gb
, uiSettingsManage = Messages.Comp.UiSettingsManage.gb , uiSettingsManage = Messages.Comp.UiSettingsManage.gb
, emailSettingsManage = Messages.Comp.EmailSettingsManage.gb , emailSettingsManage = Messages.Comp.EmailSettingsManage.gb
, imapSettingsManage = Messages.Comp.ImapSettingsManage.gb , imapSettingsManage = Messages.Comp.ImapSettingsManage.gb
@ -96,8 +97,6 @@ gb =
adjust the schedule to avoid reading over the same mails adjust the schedule to avoid reading over the same mails
again.""" again."""
, otpMenu = "Two Factor Authentication" , otpMenu = "Two Factor Authentication"
, webhooks = "Webhooks"
, genericQueries = "Generic Queries"
, dueItems = "Due Items Query" , dueItems = "Due Items Query"
, notificationInfoText = """ , notificationInfoText = """
@ -125,7 +124,8 @@ must be created before.
de : Texts de : Texts
de = de =
{ changePasswordForm = Messages.Comp.ChangePasswordForm.de { basics = Messages.Basics.de
, changePasswordForm = Messages.Comp.ChangePasswordForm.de
, uiSettingsManage = Messages.Comp.UiSettingsManage.de , uiSettingsManage = Messages.Comp.UiSettingsManage.de
, emailSettingsManage = Messages.Comp.EmailSettingsManage.de , emailSettingsManage = Messages.Comp.EmailSettingsManage.de
, imapSettingsManage = Messages.Comp.ImapSettingsManage.de , imapSettingsManage = Messages.Comp.ImapSettingsManage.de
@ -161,8 +161,6 @@ E-Mail-Einstellungen (IMAP) notwendig."""
gleichen E-Mails möglichst nicht noch einmal eingelesen gleichen E-Mails möglichst nicht noch einmal eingelesen
werden.""" werden."""
, otpMenu = "Zwei-Faktor-Authentifizierung" , otpMenu = "Zwei-Faktor-Authentifizierung"
, webhooks = "Webhooks"
, genericQueries = "Periodische Abfragen"
, dueItems = "Fällige Dokumente" , dueItems = "Fällige Dokumente"
, notificationInfoText = """ , notificationInfoText = """

View File

@ -13,6 +13,7 @@ module Page exposing
, goto , goto
, hasSidebar , hasSidebar
, href , href
, isDashboardPage
, isOpen , isOpen
, isSearchPage , isSearchPage
, isSecured , isSecured
@ -153,6 +154,16 @@ isSearchPage page =
False False
isDashboardPage : Page -> Bool
isDashboardPage page =
case page of
DashboardPage ->
True
_ ->
False
pageName : Page -> String pageName : Page -> String
pageName page = pageName page =
case page of case page of

View File

@ -59,7 +59,7 @@ viewSidebar texts visible _ _ model =
[ Icons.sourceIcon2 "" [ Icons.sourceIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text texts.sources ] [ text texts.basics.sources ]
] ]
, a , a
[ href "#" [ href "#"
@ -70,7 +70,7 @@ viewSidebar texts visible _ _ model =
[ Icons.shareIcon "" [ Icons.shareIcon ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text texts.shares ] [ text texts.basics.shares ]
] ]
, a , a
[ href "#" [ href "#"
@ -238,7 +238,7 @@ viewSources texts flags settings model =
] ]
[ Icons.sourceIcon2 "" [ Icons.sourceIcon2 ""
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text texts.sources [ text texts.basics.sources
] ]
] ]
, Html.map SourceMsg (Comp.SourceManage.view2 texts.sourceManage flags settings model.sourceModel) , Html.map SourceMsg (Comp.SourceManage.view2 texts.sourceManage flags settings model.sourceModel)
@ -253,7 +253,7 @@ viewShares texts settings flags model =
] ]
[ Icons.shareIcon "" [ Icons.shareIcon ""
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text texts.shares [ text texts.basics.shares
] ]
] ]
, Html.map ShareMsg (Comp.ShareManage.view texts.shareManage settings flags model.shareModel) , Html.map ShareMsg (Comp.ShareManage.view texts.shareManage settings flags model.shareModel)

View File

@ -27,6 +27,7 @@ import Comp.PersonManage
import Comp.ShareManage import Comp.ShareManage
import Comp.SourceManage import Comp.SourceManage
import Comp.TagManage import Comp.TagManage
import Comp.UploadForm
import Data.Bookmarks exposing (AllBookmarks) import Data.Bookmarks exposing (AllBookmarks)
import Data.Dashboard exposing (Dashboard) import Data.Dashboard exposing (Dashboard)
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
@ -73,7 +74,7 @@ initCmd flags =
reloadDashboard : Msg reloadDashboard : Msg
reloadDashboard = reloadDashboard =
InitDashboard ReloadDashboardData
reloadUiSettings : Msg reloadUiSettings : Msg
@ -93,6 +94,7 @@ type Msg
| EquipmentMsg Comp.EquipmentManage.Msg | EquipmentMsg Comp.EquipmentManage.Msg
| TagMsg Comp.TagManage.Msg | TagMsg Comp.TagManage.Msg
| FolderMsg Comp.FolderManage.Msg | FolderMsg Comp.FolderManage.Msg
| UploadMsg Comp.UploadForm.Msg
| DashboardMsg Comp.DashboardView.Msg | DashboardMsg Comp.DashboardView.Msg
| InitNotificationHook | InitNotificationHook
| InitDashboard | InitDashboard
@ -104,6 +106,8 @@ type Msg
| InitEquipment | InitEquipment
| InitTags | InitTags
| InitFolder | InitFolder
| InitUpload
| ReloadDashboardData
type Content type Content
@ -117,3 +121,4 @@ type Content
| Equipment Comp.EquipmentManage.Model | Equipment Comp.EquipmentManage.Model
| Tags Comp.TagManage.Model | Tags Comp.TagManage.Model
| Folder Comp.FolderManage.Model | Folder Comp.FolderManage.Model
| Upload Comp.UploadForm.Model

View File

@ -17,9 +17,10 @@ value texts =
, columns = 2 , columns = 2
, boxes = , boxes =
[ messageBox texts [ messageBox texts
, summary2 , fieldStats
, newDocuments texts , newDocuments texts
, dueDocuments texts , dueDocuments texts
, upload
, summary texts , summary texts
] ]
} }
@ -107,8 +108,8 @@ summary texts =
} }
summary2 : Box fieldStats : Box
summary2 = fieldStats =
{ name = "" { name = ""
, visible = True , visible = True
, decoration = True , decoration = True
@ -119,3 +120,14 @@ summary2 =
, show = SummaryShowFields False , show = SummaryShowFields False
} }
} }
upload : Box
upload =
{ name = ""
, visible = True
, decoration = True
, colspan = 1
, content =
BoxUpload Nothing
}

View File

@ -1,6 +1,8 @@
module Page.Dashboard.SideMenu exposing (view) module Page.Dashboard.SideMenu exposing (view)
import Api.Model.VersionInfo exposing (VersionInfo)
import Comp.BookmarkChooser import Comp.BookmarkChooser
import Data.Flags exposing (Flags)
import Data.Icons as Icons import Data.Icons as Icons
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Html exposing (Attribute, Html, a, div, h3, span, text) 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 import Styles as S
view : Texts -> UiSettings -> SideMenuModel -> Html Msg view : Texts -> VersionInfo -> UiSettings -> SideMenuModel -> Html Msg
view texts _ model = view texts versionInfo _ model =
div [ class "flex flex-col" ] div [ class "flex flex-col flex-grow" ]
[ div [ class "mt-2" ] [ div [ class "mt-2" ]
[ menuLink [ onClick InitDashboard, href "#" ] (Icons.dashboardIcon "") "Dashboard" [ menuLink [ onClick InitDashboard, href "#" ] (Icons.dashboardIcon "") texts.dashboardLink
, menuLink [ Page.href (SearchPage Nothing) ] (Icons.searchIcon "") "Items" , menuLink [ Page.href (SearchPage Nothing) ] (Icons.searchIcon "") texts.basics.items
] ]
, h3 , h3
[ class S.header3 [ class S.header3
, class "italic mt-3" , class "italic mt-3"
] ]
[ text "Bookmarks" [ text texts.bookmarks
] ]
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ Html.map BookmarkMsg [ Html.map BookmarkMsg
@ -38,29 +40,44 @@ view texts _ model =
[ class S.header3 [ class S.header3
, class "italic mt-3" , class "italic mt-3"
] ]
[ text "Manage" [ text texts.settings
] ]
, div [ class "ml-2 mb-2" ] , div [ class "ml-2 mb-2" ]
[ menuLink [ onClick InitOrganization, href "#" ] (Icons.organizationIcon "") "Organization" [ menuLink [ onClick InitNotificationHook, href "#" ] (Icons.notificationHooksIcon "") texts.basics.notificationHooks
, menuLink [ onClick InitPerson, href "#" ] (Icons.personIcon "") "Person" , menuLink [ onClick InitPeriodicQuery, href "#" ] (Icons.periodicTasksIcon "") texts.basics.periodicQueries
, menuLink [ onClick InitEquipment, href "#" ] (Icons.equipmentIcon "") "Equipment" , menuLink [ onClick InitSource, href "#" ] (Icons.sourceIcon2 "") texts.basics.sources
, menuLink [ onClick InitTags, href "#" ] (Icons.tagsIcon "") "Tags" , menuLink [ onClick InitShare, href "#" ] (Icons.shareIcon "") texts.basics.shares
, 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"
] ]
, h3 , h3
[ class S.header3 [ class S.header3
, class "italic mt-3" , 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" ] , 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
]
] ]
] ]

View File

@ -19,6 +19,7 @@ import Comp.PersonManage
import Comp.ShareManage import Comp.ShareManage
import Comp.SourceManage import Comp.SourceManage
import Comp.TagManage import Comp.TagManage
import Comp.UploadForm
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Messages.Page.Dashboard exposing (Texts) import Messages.Page.Dashboard exposing (Texts)
@ -26,6 +27,7 @@ import Page exposing (Page(..))
import Page.Dashboard.Data exposing (..) import Page.Dashboard.Data exposing (..)
import Page.Dashboard.DefaultDashboard import Page.Dashboard.DefaultDashboard
import Set import Set
import Styles exposing (content)
update : Texts -> UiSettings -> Nav.Key -> Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg ) 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 -> InitDashboard ->
let case model.content of
board = Home _ ->
Page.Dashboard.DefaultDashboard.getDefaultDashboard flags settings update texts settings navKey flags ReloadDashboardData model
( dm, dc ) = _ ->
Comp.DashboardView.init flags board let
in board =
( { model | content = Home dm }, Cmd.map DashboardMsg dc, Sub.none ) 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 -> InitNotificationHook ->
let let
@ -131,6 +138,13 @@ update texts settings navKey flags msg model =
in in
( { model | content = Folder fm }, Cmd.map FolderMsg fc, Sub.none ) ( { 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 -> NotificationHookMsg lm ->
case model.content of case model.content of
Webhook nhm -> Webhook nhm ->
@ -245,18 +259,37 @@ update texts settings navKey flags msg model =
_ -> _ ->
unit 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 -> DashboardMsg lm ->
case model.content of case model.content of
Home m -> Home m ->
let let
( dm, dc ) = ( dm, dc, ds ) =
Comp.DashboardView.update lm m Comp.DashboardView.update flags lm m
in 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 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 : Model -> ( Model, Cmd Msg, Sub Msg )
unit m = unit m =

View File

@ -7,6 +7,7 @@
module Page.Dashboard.View exposing (viewContent, viewSidebar) module Page.Dashboard.View exposing (viewContent, viewSidebar)
import Api.Model.VersionInfo exposing (VersionInfo)
import Comp.DashboardView import Comp.DashboardView
import Comp.EquipmentManage import Comp.EquipmentManage
import Comp.FolderManage import Comp.FolderManage
@ -17,6 +18,7 @@ import Comp.PersonManage
import Comp.ShareManage import Comp.ShareManage
import Comp.SourceManage import Comp.SourceManage
import Comp.TagManage import Comp.TagManage
import Comp.UploadForm
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
@ -27,15 +29,15 @@ import Page.Dashboard.SideMenu as SideMenu
import Styles as S import Styles as S
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg viewSidebar : Texts -> Bool -> Flags -> VersionInfo -> UiSettings -> Model -> Html Msg
viewSidebar texts visible _ settings model = viewSidebar texts visible flags versionInfo settings model =
div div
[ id "sidebar" [ id "sidebar"
, class S.sidebar , class S.sidebar
, class S.sidebarBg , class S.sidebarBg
, classList [ ( "hidden", not visible ) ] , 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 [ case model.content of
Home m -> Home m ->
Html.map DashboardMsg Html.map DashboardMsg
(Comp.DashboardView.view texts.dashboard m) (Comp.DashboardView.view texts.dashboard flags settings m)
Webhook m -> Webhook m ->
viewHookManage texts settings m viewHookManage texts settings m
@ -76,6 +78,9 @@ viewContent texts flags settings model =
Folder m -> Folder m ->
viewFolder texts flags m viewFolder texts flags m
Upload m ->
viewUplod texts flags settings m
] ]
@ -83,11 +88,29 @@ viewContent texts flags settings model =
--- Helpers --- 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 -> Comp.FolderManage.Model -> Html Msg
viewFolder texts flags model = viewFolder texts flags model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Folder" [ text texts.basics.folder
] ]
, Html.map FolderMsg <| , Html.map FolderMsg <|
Comp.FolderManage.view2 texts.folderManage flags model Comp.FolderManage.view2 texts.folderManage flags model
@ -98,7 +121,7 @@ viewTags : Texts -> UiSettings -> Comp.TagManage.Model -> Html Msg
viewTags texts settings model = viewTags texts settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Tags" [ text texts.basics.tags
] ]
, Html.map TagMsg <| , Html.map TagMsg <|
Comp.TagManage.view2 texts.tagManage settings model Comp.TagManage.view2 texts.tagManage settings model
@ -109,7 +132,7 @@ viewEquipment : Texts -> Comp.EquipmentManage.Model -> Html Msg
viewEquipment texts model = viewEquipment texts model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Equipment" [ text texts.basics.equipment
] ]
, Html.map EquipmentMsg <| , Html.map EquipmentMsg <|
Comp.EquipmentManage.view2 texts.equipManage model Comp.EquipmentManage.view2 texts.equipManage model
@ -120,7 +143,7 @@ viewPerson : Texts -> UiSettings -> Comp.PersonManage.Model -> Html Msg
viewPerson texts settings model = viewPerson texts settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Person" [ text texts.basics.person
] ]
, Html.map PersonMsg <| , Html.map PersonMsg <|
Comp.PersonManage.view2 texts.personManage settings model Comp.PersonManage.view2 texts.personManage settings model
@ -131,7 +154,7 @@ viewOrganization : Texts -> UiSettings -> Comp.OrgManage.Model -> Html Msg
viewOrganization texts settings model = viewOrganization texts settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Organizations" [ text texts.basics.organization
] ]
, Html.map OrganizationMsg <| , Html.map OrganizationMsg <|
Comp.OrgManage.view2 texts.organizationManage settings model 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 = viewShare texts flags settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Shares" [ text texts.basics.shares
] ]
, Html.map ShareMsg <| , Html.map ShareMsg <|
Comp.ShareManage.view texts.shareManage settings flags model 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 = viewSource texts flags settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Sources" [ text texts.basics.sources
] ]
, Html.map SourceMsg <| , Html.map SourceMsg <|
Comp.SourceManage.view2 texts.sourceManage flags settings model Comp.SourceManage.view2 texts.sourceManage flags settings model
@ -164,7 +187,7 @@ viewPeriodicQuery : Texts -> UiSettings -> Comp.PeriodicQueryTaskManage.Model ->
viewPeriodicQuery texts settings model = viewPeriodicQuery texts settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Periodic Queries" [ text texts.basics.periodicQueries
] ]
, Html.map PeriodicQueryMsg <| , Html.map PeriodicQueryMsg <|
Comp.PeriodicQueryTaskManage.view texts.periodicQueryManage settings model Comp.PeriodicQueryTaskManage.view texts.periodicQueryManage settings model
@ -175,7 +198,7 @@ viewHookManage : Texts -> UiSettings -> Comp.NotificationHookManage.Model -> Htm
viewHookManage texts settings model = viewHookManage texts settings model =
div [] div []
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Notification Hooks" [ text texts.basics.notificationHooks
] ]
, Html.map NotificationHookMsg <| , Html.map NotificationHookMsg <|
Comp.NotificationHookManage.view texts.notificationHookManage settings model Comp.NotificationHookManage.view texts.notificationHookManage settings model

View File

@ -15,6 +15,7 @@ import Html.Attributes exposing (..)
import Messages.Page.Upload exposing (Texts) import Messages.Page.Upload exposing (Texts)
import Page exposing (Page(..)) import Page exposing (Page(..))
import Page.Upload.Data exposing (..) import Page.Upload.Data exposing (..)
import Styles
viewSidebar : Maybe String -> Bool -> Flags -> UiSettings -> Model -> Html Msg 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 -> Maybe String -> Flags -> UiSettings -> Model -> Html Msg
viewContent texts sourceId flags settings model = viewContent texts sourceId flags settings model =
Html.map UploadMsg let
(Comp.UploadForm.view texts.uploadForm sourceId flags settings model.uploadForm) 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)
]

View File

@ -97,7 +97,7 @@ viewSidebar texts visible _ _ model =
[ i [ class "fa fa-bell" ] [] [ i [ class "fa fa-bell" ] []
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text texts.webhooks ] [ text texts.basics.notificationHooks ]
] ]
, a , a
[ href "#" [ href "#"
@ -119,7 +119,7 @@ viewSidebar texts visible _ _ model =
[ i [ class "fa fa-history" ] [] [ i [ class "fa fa-history" ] []
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text texts.genericQueries ] [ text texts.basics.periodicQueries ]
] ]
] ]
] ]
@ -396,7 +396,7 @@ viewNotificationInfo texts settings model =
[ i [ class "fa fa-bell" ] [] [ i [ class "fa fa-bell" ] []
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text texts.webhooks ] [ text texts.basics.notificationHooks ]
] ]
, div [ class "ml-3 text-sm opacity-50" ] , div [ class "ml-3 text-sm opacity-50" ]
[ text texts.webhookInfoText [ text texts.webhookInfoText
@ -426,7 +426,7 @@ viewNotificationInfo texts settings model =
[ Icons.periodicTasksIcon "" [ Icons.periodicTasksIcon ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text texts.genericQueries ] [ text texts.basics.periodicQueries ]
] ]
, div [ class "ml-3 text-sm opacity-50" ] , div [ class "ml-3 text-sm opacity-50" ]
[ text texts.periodicQueryInfoText [ text texts.periodicQueryInfoText
@ -465,7 +465,7 @@ viewNotificationQueries texts settings model =
] ]
[ i [ class "fa fa-history" ] [] [ i [ class "fa fa-history" ] []
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text texts.genericQueries [ text texts.basics.periodicQueries
] ]
] ]
, Markdown.toHtml [ class "opacity-80 text-lg mb-3 markdown-preview" ] texts.periodicQueryInfoText , 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" ] [] [ i [ class "fa fa-bell" ] []
, div [ class "ml-3" ] , div [ class "ml-3" ]
[ text texts.webhooks [ text texts.basics.notificationHooks
] ]
] ]
, Markdown.toHtml [ class "opacity-80 text-lg mb-3 markdown-preview" ] texts.webhookInfoText , Markdown.toHtml [ class "opacity-80 text-lg mb-3 markdown-preview" ] texts.webhookInfoText

View File

@ -253,7 +253,7 @@ deleteLabel =
link : String link : String
link = 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 inputErrorBorder : String