mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Dashboard updates
This commit is contained in:
@ -713,4 +713,4 @@ initPage model_ page =
|
|||||||
( model, Cmd.none, Sub.none )
|
( model, Cmd.none, Sub.none )
|
||||||
|
|
||||||
DashboardPage ->
|
DashboardPage ->
|
||||||
( model, Cmd.none, Sub.none )
|
( model, Cmd.map DashboardMsg (Page.Dashboard.Data.reinitCmd model.flags), Sub.none )
|
||||||
|
@ -107,7 +107,7 @@ update flags msg model =
|
|||||||
Comp.ItemColumnDropdown.update lm model.columnModel
|
Comp.ItemColumnDropdown.update lm model.columnModel
|
||||||
|
|
||||||
selection =
|
selection =
|
||||||
Comp.ItemColumnDropdown.getSelected model.columnModel
|
Comp.ItemColumnDropdown.getSelected cm
|
||||||
|
|
||||||
data =
|
data =
|
||||||
model.data
|
model.data
|
||||||
|
@ -107,19 +107,23 @@ viewItems texts settings meta list =
|
|||||||
items =
|
items =
|
||||||
Data.Items.flatten list
|
Data.Items.flatten list
|
||||||
in
|
in
|
||||||
table [ class "w-full divide-y dark:divide-slate-500" ]
|
table [ class "w-full divide-y divide-y-2 dark:divide-slate-500" ]
|
||||||
(viewItemHead texts meta ++ [ tbody [] <| List.map (viewItemRow texts settings meta) items ])
|
(viewItemHead texts meta ++ [ tbody [ class "divide-y divide-dotted dark:divide-slate-500" ] <| List.map (viewItemRow texts settings meta) items ])
|
||||||
|
|
||||||
|
|
||||||
viewItemHead : Texts -> QueryData -> List (Html Msg)
|
viewItemHead : Texts -> QueryData -> List (Html Msg)
|
||||||
viewItemHead texts meta =
|
viewItemHead texts meta =
|
||||||
if not meta.showHeaders || meta.columns == [] then
|
let
|
||||||
|
( col1, cols ) =
|
||||||
|
getColumns meta
|
||||||
|
in
|
||||||
|
if not meta.showHeaders then
|
||||||
[]
|
[]
|
||||||
|
|
||||||
else
|
else
|
||||||
[ thead []
|
[ thead []
|
||||||
[ tr []
|
[ tr []
|
||||||
(List.map texts.itemColumn.header meta.columns
|
(List.map texts.itemColumn.header (col1 :: cols)
|
||||||
|> List.map (\n -> th [ class "text-left text-sm" ] [ text n ])
|
|> List.map (\n -> th [ class "text-left text-sm" ] [ text n ])
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -128,10 +128,10 @@ viewGeneral texts stats =
|
|||||||
List.length stats.concEquipStats
|
List.length stats.concEquipStats
|
||||||
|
|
||||||
mklabel name =
|
mklabel name =
|
||||||
div [ class "py-1 text-lg" ] [ text name ]
|
div [ class "py-0.5 text-lg" ] [ text name ]
|
||||||
|
|
||||||
value num =
|
value num =
|
||||||
div [ class "py-1 font-mono text-lg" ] [ text <| String.fromInt num ]
|
div [ class "py-0.5 font-mono text-lg" ] [ text <| String.fromInt num ]
|
||||||
in
|
in
|
||||||
div [ class "opacity-90" ]
|
div [ class "opacity-90" ]
|
||||||
[ div [ class "flex flex-row" ]
|
[ div [ class "flex flex-row" ]
|
||||||
|
@ -17,6 +17,7 @@ import Html.Events exposing (onCheck, onClick, onInput)
|
|||||||
import Html5.DragDrop as DD
|
import Html5.DragDrop as DD
|
||||||
import Messages.Comp.DashboardEdit exposing (Texts)
|
import Messages.Comp.DashboardEdit exposing (Texts)
|
||||||
import Styles as S
|
import Styles as S
|
||||||
|
import Util.Maybe
|
||||||
|
|
||||||
|
|
||||||
type alias Model =
|
type alias Model =
|
||||||
@ -145,7 +146,12 @@ update flags msg model =
|
|||||||
db_ =
|
db_ =
|
||||||
{ db | columns = Maybe.withDefault db.columns value }
|
{ db | columns = Maybe.withDefault db.columns value }
|
||||||
in
|
in
|
||||||
unit { model | columnsValue = value, columnsModel = cm, dashboard = db_ }
|
unit
|
||||||
|
{ model
|
||||||
|
| columnsValue = Util.Maybe.or [ value, model.columnsValue ]
|
||||||
|
, columnsModel = cm
|
||||||
|
, dashboard = db_
|
||||||
|
}
|
||||||
|
|
||||||
GapMsg lm ->
|
GapMsg lm ->
|
||||||
let
|
let
|
||||||
@ -158,7 +164,12 @@ update flags msg model =
|
|||||||
db_ =
|
db_ =
|
||||||
{ db | gap = Maybe.withDefault db.gap value }
|
{ db | gap = Maybe.withDefault db.gap value }
|
||||||
in
|
in
|
||||||
unit { model | gapModel = gm, gapValue = value, dashboard = db_ }
|
unit
|
||||||
|
{ model
|
||||||
|
| gapModel = gm
|
||||||
|
, gapValue = Util.Maybe.or [ value, model.gapValue ]
|
||||||
|
, dashboard = db_
|
||||||
|
}
|
||||||
|
|
||||||
ToggleNewBoxMenu ->
|
ToggleNewBoxMenu ->
|
||||||
unit { model | newBoxMenuOpen = not model.newBoxMenuOpen }
|
unit { model | newBoxMenuOpen = not model.newBoxMenuOpen }
|
||||||
|
@ -95,6 +95,9 @@ storedUiSettingsDecoder =
|
|||||||
|
|
||||||
maybeString =
|
maybeString =
|
||||||
Decode.maybe Decode.string
|
Decode.maybe Decode.string
|
||||||
|
|
||||||
|
def =
|
||||||
|
defaults
|
||||||
in
|
in
|
||||||
Decode.succeed StoredUiSettings
|
Decode.succeed StoredUiSettings
|
||||||
|> P.optional "itemSearchPageSize" maybeInt Nothing
|
|> P.optional "itemSearchPageSize" maybeInt Nothing
|
||||||
@ -106,19 +109,19 @@ storedUiSettingsDecoder =
|
|||||||
|> P.optional "searchMenuTagCount" maybeInt Nothing
|
|> P.optional "searchMenuTagCount" maybeInt Nothing
|
||||||
|> P.optional "searchMenuTagCatCount" maybeInt Nothing
|
|> P.optional "searchMenuTagCatCount" maybeInt Nothing
|
||||||
|> P.optional "formFields" (Decode.maybe <| Decode.list Decode.string) Nothing
|
|> P.optional "formFields" (Decode.maybe <| Decode.list Decode.string) Nothing
|
||||||
|> P.optional "itemDetailShortcuts" Decode.bool False
|
|> P.optional "itemDetailShortcuts" Decode.bool def.itemDetailShortcuts
|
||||||
|> P.optional "searchMenuVisible" Decode.bool False
|
|> P.optional "searchMenuVisible" Decode.bool def.searchMenuVisible
|
||||||
|> P.optional "editMenuVisible" Decode.bool False
|
|> P.optional "editMenuVisible" Decode.bool def.editMenuVisible
|
||||||
|> P.optional "cardPreviewSize" maybeString Nothing
|
|> P.optional "cardPreviewSize" maybeString Nothing
|
||||||
|> P.optional "cardTitleTemplate" maybeString Nothing
|
|> P.optional "cardTitleTemplate" maybeString Nothing
|
||||||
|> P.optional "cardSubtitleTemplate" maybeString Nothing
|
|> P.optional "cardSubtitleTemplate" maybeString Nothing
|
||||||
|> P.optional "searchStatsVisible" Decode.bool False
|
|> P.optional "searchStatsVisible" Decode.bool def.searchStatsVisible
|
||||||
|> P.optional "cardPreviewFullWidth" Decode.bool False
|
|> P.optional "cardPreviewFullWidth" Decode.bool def.cardPreviewFullWidth
|
||||||
|> P.optional "uiTheme" maybeString Nothing
|
|> P.optional "uiTheme" maybeString Nothing
|
||||||
|> P.optional "sideMenuVisible" Decode.bool False
|
|> P.optional "sideMenuVisible" Decode.bool def.sideMenuVisible
|
||||||
|> P.optional "powerSearchEnabled" Decode.bool False
|
|> P.optional "powerSearchEnabled" Decode.bool def.powerSearchEnabled
|
||||||
|> P.optional "uiLang" maybeString Nothing
|
|> P.optional "uiLang" maybeString Nothing
|
||||||
|> P.optional "itemSearchShowGroups" Decode.bool True
|
|> P.optional "itemSearchShowGroups" Decode.bool def.itemSearchShowGroups
|
||||||
|> P.optional "itemSearchArrange" maybeString Nothing
|
|> P.optional "itemSearchArrange" maybeString Nothing
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ gb =
|
|||||||
, uploadFiles = "Upload documents"
|
, uploadFiles = "Upload documents"
|
||||||
, editDashboard = "Edit Dashboard"
|
, editDashboard = "Edit Dashboard"
|
||||||
, dashboards = "Dashboards"
|
, dashboards = "Dashboards"
|
||||||
, predefinedMessage = "This dashboard is predefined one that cannot be deleted."
|
, predefinedMessage = "This dashboard is predefined one that cannot be deleted. It is replaced with the first one you save."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -106,5 +106,5 @@ de =
|
|||||||
, uploadFiles = "Dokumente hochladen"
|
, uploadFiles = "Dokumente hochladen"
|
||||||
, editDashboard = "Dashboard ändern"
|
, editDashboard = "Dashboard ändern"
|
||||||
, dashboards = "Dashboards"
|
, dashboards = "Dashboards"
|
||||||
, predefinedMessage = "Dieses Dashboard ist vordefiniert und kann nicht entfernt werden."
|
, predefinedMessage = "Dieses Dashboard ist vordefiniert und kann nicht entfernt werden. Es wird durch ein gespeichertes ersetzt."
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ module Page.Dashboard.Data exposing
|
|||||||
, isDashboardDefault
|
, isDashboardDefault
|
||||||
, isDashboardVisible
|
, isDashboardVisible
|
||||||
, isHomeContent
|
, isHomeContent
|
||||||
|
, reinitCmd
|
||||||
, reloadDashboardData
|
, reloadDashboardData
|
||||||
, reloadUiSettings
|
, reloadUiSettings
|
||||||
)
|
)
|
||||||
@ -111,6 +112,16 @@ init flags =
|
|||||||
|
|
||||||
initCmd : Flags -> Cmd Msg
|
initCmd : Flags -> Cmd Msg
|
||||||
initCmd flags =
|
initCmd flags =
|
||||||
|
makeInitCmd flags SetDefaultDashboard
|
||||||
|
|
||||||
|
|
||||||
|
reinitCmd : Flags -> Cmd Msg
|
||||||
|
reinitCmd flags =
|
||||||
|
makeInitCmd flags ReloadDashboardData
|
||||||
|
|
||||||
|
|
||||||
|
makeInitCmd : Flags -> Msg -> Cmd Msg
|
||||||
|
makeInitCmd flags nextMsg =
|
||||||
let
|
let
|
||||||
ignoreBookmarkError r =
|
ignoreBookmarkError r =
|
||||||
Result.withDefault Data.Bookmarks.empty r
|
Result.withDefault Data.Bookmarks.empty r
|
||||||
@ -118,7 +129,7 @@ initCmd flags =
|
|||||||
in
|
in
|
||||||
Cmd.batch
|
Cmd.batch
|
||||||
[ Api.getBookmarks flags ignoreBookmarkError
|
[ Api.getBookmarks flags ignoreBookmarkError
|
||||||
, Api.getAllDashboards flags (GetAllDashboardsResp (Just SetDefaultDashboard))
|
, Api.getAllDashboards flags (GetAllDashboardsResp (Just nextMsg))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import Messages.UiLanguage
|
|||||||
value : Texts -> Dashboard
|
value : Texts -> Dashboard
|
||||||
value texts =
|
value texts =
|
||||||
{ name = texts.default
|
{ name = texts.default
|
||||||
, columns = 2
|
, columns = 4
|
||||||
, gap = 2
|
, gap = 2
|
||||||
, boxes =
|
, boxes =
|
||||||
[ messageBox texts
|
[ messageBox texts
|
||||||
@ -48,7 +48,7 @@ messageBox texts =
|
|||||||
{ name = texts.welcomeName
|
{ name = texts.welcomeName
|
||||||
, visible = True
|
, visible = True
|
||||||
, decoration = False
|
, decoration = False
|
||||||
, colspan = 2
|
, colspan = 4
|
||||||
, content =
|
, content =
|
||||||
BoxMessage
|
BoxMessage
|
||||||
{ title = texts.welcomeTitle
|
{ title = texts.welcomeTitle
|
||||||
@ -62,7 +62,7 @@ newDocuments texts =
|
|||||||
{ name = texts.newDocsName
|
{ name = texts.newDocsName
|
||||||
, visible = True
|
, visible = True
|
||||||
, decoration = True
|
, decoration = True
|
||||||
, colspan = 1
|
, colspan = 2
|
||||||
, content =
|
, content =
|
||||||
BoxQuery
|
BoxQuery
|
||||||
{ query = SearchQueryString "inbox:yes"
|
{ query = SearchQueryString "inbox:yes"
|
||||||
@ -79,7 +79,7 @@ dueDocuments texts =
|
|||||||
{ name = texts.dueInDays 10
|
{ name = texts.dueInDays 10
|
||||||
, visible = True
|
, visible = True
|
||||||
, decoration = True
|
, decoration = True
|
||||||
, colspan = 1
|
, colspan = 2
|
||||||
, content =
|
, content =
|
||||||
BoxQuery
|
BoxQuery
|
||||||
{ query = SearchQueryString "due>today;-10d due<today;+10d"
|
{ query = SearchQueryString "due>today;-10d due<today;+10d"
|
||||||
@ -113,8 +113,8 @@ fieldStats : Box
|
|||||||
fieldStats =
|
fieldStats =
|
||||||
{ name = ""
|
{ name = ""
|
||||||
, visible = True
|
, visible = True
|
||||||
, decoration = True
|
, decoration = False
|
||||||
, colspan = 2
|
, colspan = 4
|
||||||
, content =
|
, content =
|
||||||
BoxStats
|
BoxStats
|
||||||
{ query = SearchQueryString ""
|
{ query = SearchQueryString ""
|
||||||
@ -128,7 +128,7 @@ upload =
|
|||||||
{ name = ""
|
{ name = ""
|
||||||
, visible = True
|
, visible = True
|
||||||
, decoration = True
|
, decoration = True
|
||||||
, colspan = 1
|
, colspan = 3
|
||||||
, content =
|
, content =
|
||||||
BoxUpload
|
BoxUpload
|
||||||
{ sourceId = Nothing
|
{ sourceId = Nothing
|
||||||
|
@ -307,11 +307,10 @@ doSearchDefaultCmd param model =
|
|||||||
|
|
||||||
createQuery : Model -> Maybe Q.ItemQuery
|
createQuery : Model -> Maybe Q.ItemQuery
|
||||||
createQuery model =
|
createQuery model =
|
||||||
Debug.log "query" <|
|
Q.and
|
||||||
Q.and
|
[ Comp.SearchMenu.getItemQuery model.searchMenuModel
|
||||||
[ Comp.SearchMenu.getItemQuery model.searchMenuModel
|
, Maybe.map Q.Fragment model.powerSearchInput.input
|
||||||
, Maybe.map Q.Fragment model.powerSearchInput.input
|
]
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
resultsBelowLimit : UiSettings -> Model -> Bool
|
resultsBelowLimit : UiSettings -> Model -> Bool
|
||||||
|
@ -109,7 +109,7 @@ update bookmarkId mId key flags texts settings msg model =
|
|||||||
}
|
}
|
||||||
|
|
||||||
result =
|
result =
|
||||||
if Debug.log "state" nextState.stateChange && not model.searchInProgress then
|
if nextState.stateChange && not model.searchInProgress then
|
||||||
doSearch (SearchParam flags BasicSearch settings.itemSearchPageSize 0 False) newModel
|
doSearch (SearchParam flags BasicSearch settings.itemSearchPageSize 0 False) newModel
|
||||||
|
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user