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 )
|
||||
|
||||
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
|
||||
|
||||
selection =
|
||||
Comp.ItemColumnDropdown.getSelected model.columnModel
|
||||
Comp.ItemColumnDropdown.getSelected cm
|
||||
|
||||
data =
|
||||
model.data
|
||||
|
@ -107,19 +107,23 @@ viewItems texts settings meta list =
|
||||
items =
|
||||
Data.Items.flatten list
|
||||
in
|
||||
table [ class "w-full divide-y dark:divide-slate-500" ]
|
||||
(viewItemHead texts meta ++ [ tbody [] <| List.map (viewItemRow texts settings meta) items ])
|
||||
table [ class "w-full divide-y divide-y-2 dark:divide-slate-500" ]
|
||||
(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 meta =
|
||||
if not meta.showHeaders || meta.columns == [] then
|
||||
let
|
||||
( col1, cols ) =
|
||||
getColumns meta
|
||||
in
|
||||
if not meta.showHeaders then
|
||||
[]
|
||||
|
||||
else
|
||||
[ thead []
|
||||
[ 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 ])
|
||||
)
|
||||
]
|
||||
|
@ -128,10 +128,10 @@ viewGeneral texts stats =
|
||||
List.length stats.concEquipStats
|
||||
|
||||
mklabel name =
|
||||
div [ class "py-1 text-lg" ] [ text name ]
|
||||
div [ class "py-0.5 text-lg" ] [ text name ]
|
||||
|
||||
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
|
||||
div [ class "opacity-90" ]
|
||||
[ div [ class "flex flex-row" ]
|
||||
|
@ -17,6 +17,7 @@ import Html.Events exposing (onCheck, onClick, onInput)
|
||||
import Html5.DragDrop as DD
|
||||
import Messages.Comp.DashboardEdit exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Maybe
|
||||
|
||||
|
||||
type alias Model =
|
||||
@ -145,7 +146,12 @@ update flags msg model =
|
||||
db_ =
|
||||
{ db | columns = Maybe.withDefault db.columns value }
|
||||
in
|
||||
unit { model | columnsValue = value, columnsModel = cm, dashboard = db_ }
|
||||
unit
|
||||
{ model
|
||||
| columnsValue = Util.Maybe.or [ value, model.columnsValue ]
|
||||
, columnsModel = cm
|
||||
, dashboard = db_
|
||||
}
|
||||
|
||||
GapMsg lm ->
|
||||
let
|
||||
@ -158,7 +164,12 @@ update flags msg model =
|
||||
db_ =
|
||||
{ db | gap = Maybe.withDefault db.gap value }
|
||||
in
|
||||
unit { model | gapModel = gm, gapValue = value, dashboard = db_ }
|
||||
unit
|
||||
{ model
|
||||
| gapModel = gm
|
||||
, gapValue = Util.Maybe.or [ value, model.gapValue ]
|
||||
, dashboard = db_
|
||||
}
|
||||
|
||||
ToggleNewBoxMenu ->
|
||||
unit { model | newBoxMenuOpen = not model.newBoxMenuOpen }
|
||||
|
@ -95,6 +95,9 @@ storedUiSettingsDecoder =
|
||||
|
||||
maybeString =
|
||||
Decode.maybe Decode.string
|
||||
|
||||
def =
|
||||
defaults
|
||||
in
|
||||
Decode.succeed StoredUiSettings
|
||||
|> P.optional "itemSearchPageSize" maybeInt Nothing
|
||||
@ -106,19 +109,19 @@ storedUiSettingsDecoder =
|
||||
|> P.optional "searchMenuTagCount" maybeInt Nothing
|
||||
|> P.optional "searchMenuTagCatCount" maybeInt Nothing
|
||||
|> P.optional "formFields" (Decode.maybe <| Decode.list Decode.string) Nothing
|
||||
|> P.optional "itemDetailShortcuts" Decode.bool False
|
||||
|> P.optional "searchMenuVisible" Decode.bool False
|
||||
|> P.optional "editMenuVisible" Decode.bool False
|
||||
|> P.optional "itemDetailShortcuts" Decode.bool def.itemDetailShortcuts
|
||||
|> P.optional "searchMenuVisible" Decode.bool def.searchMenuVisible
|
||||
|> P.optional "editMenuVisible" Decode.bool def.editMenuVisible
|
||||
|> P.optional "cardPreviewSize" maybeString Nothing
|
||||
|> P.optional "cardTitleTemplate" maybeString Nothing
|
||||
|> P.optional "cardSubtitleTemplate" maybeString Nothing
|
||||
|> P.optional "searchStatsVisible" Decode.bool False
|
||||
|> P.optional "cardPreviewFullWidth" Decode.bool False
|
||||
|> P.optional "searchStatsVisible" Decode.bool def.searchStatsVisible
|
||||
|> P.optional "cardPreviewFullWidth" Decode.bool def.cardPreviewFullWidth
|
||||
|> P.optional "uiTheme" maybeString Nothing
|
||||
|> P.optional "sideMenuVisible" Decode.bool False
|
||||
|> P.optional "powerSearchEnabled" Decode.bool False
|
||||
|> P.optional "sideMenuVisible" Decode.bool def.sideMenuVisible
|
||||
|> P.optional "powerSearchEnabled" Decode.bool def.powerSearchEnabled
|
||||
|> P.optional "uiLang" maybeString Nothing
|
||||
|> P.optional "itemSearchShowGroups" Decode.bool True
|
||||
|> P.optional "itemSearchShowGroups" Decode.bool def.itemSearchShowGroups
|
||||
|> P.optional "itemSearchArrange" maybeString Nothing
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ gb =
|
||||
, uploadFiles = "Upload documents"
|
||||
, editDashboard = "Edit Dashboard"
|
||||
, 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"
|
||||
, editDashboard = "Dashboard ändern"
|
||||
, 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
|
||||
, isDashboardVisible
|
||||
, isHomeContent
|
||||
, reinitCmd
|
||||
, reloadDashboardData
|
||||
, reloadUiSettings
|
||||
)
|
||||
@ -111,6 +112,16 @@ init flags =
|
||||
|
||||
initCmd : Flags -> Cmd Msg
|
||||
initCmd flags =
|
||||
makeInitCmd flags SetDefaultDashboard
|
||||
|
||||
|
||||
reinitCmd : Flags -> Cmd Msg
|
||||
reinitCmd flags =
|
||||
makeInitCmd flags ReloadDashboardData
|
||||
|
||||
|
||||
makeInitCmd : Flags -> Msg -> Cmd Msg
|
||||
makeInitCmd flags nextMsg =
|
||||
let
|
||||
ignoreBookmarkError r =
|
||||
Result.withDefault Data.Bookmarks.empty r
|
||||
@ -118,7 +129,7 @@ initCmd flags =
|
||||
in
|
||||
Cmd.batch
|
||||
[ 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 =
|
||||
{ name = texts.default
|
||||
, columns = 2
|
||||
, columns = 4
|
||||
, gap = 2
|
||||
, boxes =
|
||||
[ messageBox texts
|
||||
@ -48,7 +48,7 @@ messageBox texts =
|
||||
{ name = texts.welcomeName
|
||||
, visible = True
|
||||
, decoration = False
|
||||
, colspan = 2
|
||||
, colspan = 4
|
||||
, content =
|
||||
BoxMessage
|
||||
{ title = texts.welcomeTitle
|
||||
@ -62,7 +62,7 @@ newDocuments texts =
|
||||
{ name = texts.newDocsName
|
||||
, visible = True
|
||||
, decoration = True
|
||||
, colspan = 1
|
||||
, colspan = 2
|
||||
, content =
|
||||
BoxQuery
|
||||
{ query = SearchQueryString "inbox:yes"
|
||||
@ -79,7 +79,7 @@ dueDocuments texts =
|
||||
{ name = texts.dueInDays 10
|
||||
, visible = True
|
||||
, decoration = True
|
||||
, colspan = 1
|
||||
, colspan = 2
|
||||
, content =
|
||||
BoxQuery
|
||||
{ query = SearchQueryString "due>today;-10d due<today;+10d"
|
||||
@ -113,8 +113,8 @@ fieldStats : Box
|
||||
fieldStats =
|
||||
{ name = ""
|
||||
, visible = True
|
||||
, decoration = True
|
||||
, colspan = 2
|
||||
, decoration = False
|
||||
, colspan = 4
|
||||
, content =
|
||||
BoxStats
|
||||
{ query = SearchQueryString ""
|
||||
@ -128,7 +128,7 @@ upload =
|
||||
{ name = ""
|
||||
, visible = True
|
||||
, decoration = True
|
||||
, colspan = 1
|
||||
, colspan = 3
|
||||
, content =
|
||||
BoxUpload
|
||||
{ sourceId = Nothing
|
||||
|
@ -307,11 +307,10 @@ doSearchDefaultCmd param model =
|
||||
|
||||
createQuery : Model -> Maybe Q.ItemQuery
|
||||
createQuery model =
|
||||
Debug.log "query" <|
|
||||
Q.and
|
||||
[ Comp.SearchMenu.getItemQuery model.searchMenuModel
|
||||
, Maybe.map Q.Fragment model.powerSearchInput.input
|
||||
]
|
||||
Q.and
|
||||
[ Comp.SearchMenu.getItemQuery model.searchMenuModel
|
||||
, Maybe.map Q.Fragment model.powerSearchInput.input
|
||||
]
|
||||
|
||||
|
||||
resultsBelowLimit : UiSettings -> Model -> Bool
|
||||
|
@ -109,7 +109,7 @@ update bookmarkId mId key flags texts settings msg model =
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
else
|
||||
|
Reference in New Issue
Block a user