Add some static links to the dashboard

This commit is contained in:
eikek 2022-01-26 21:21:19 +01:00
parent e6775f77dc
commit 631450cb16
24 changed files with 736 additions and 146 deletions

View File

@ -14,7 +14,7 @@ import Api
import App.Data exposing (..)
import Browser exposing (UrlRequest(..))
import Browser.Navigation as Nav
import Data.Flags exposing (Flags)
import Data.Flags
import Data.ServerEvent exposing (ServerEvent(..))
import Data.UiSettings exposing (UiSettings)
import Data.UiTheme
@ -160,7 +160,7 @@ updateWithSub msg model =
updateItemDetail texts m model
DashboardMsg m ->
updateDashboard m model
updateDashboard texts m model
VersionResp (Ok info) ->
( { model | version = info }, Cmd.none, Sub.none )
@ -371,15 +371,15 @@ applyClientSettings texts model settings =
{ model | uiSettings = settings }
updateDashboard : Page.Dashboard.Data.Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
updateDashboard lmsg model =
updateDashboard : Messages -> Page.Dashboard.Data.Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
updateDashboard texts lmsg model =
let
( dbm, dbc ) =
Page.Dashboard.Update.update model.flags lmsg model.dashboardModel
( dbm, dbc, dbs ) =
Page.Dashboard.Update.update texts.dashboard model.flags lmsg model.dashboardModel
in
( { model | dashboardModel = dbm }
, Cmd.map DashboardMsg dbc
, Sub.none
, Sub.map DashboardMsg dbs
)

View File

@ -11,6 +11,7 @@ import Api.Model.AuthResult exposing (AuthResult)
import App.Data exposing (..)
import Comp.Basic as B
import Data.Flags
import Data.Icons as Icons
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
@ -299,7 +300,7 @@ dataMenu texts _ model =
, dataPageLink model
SearchPage
[]
[ i [ class "fa fa-search w-6" ] []
[ Icons.searchIcon "w-6"
, span [ class "ml-1" ]
[ text texts.items
]
@ -307,7 +308,7 @@ dataMenu texts _ model =
, dataPageLink model
ManageDataPage
[]
[ i [ class "fa fa-cubes w-6" ] []
[ Icons.metadataIcon "w-6"
, span [ class "ml-1" ]
[ text texts.manageData
]
@ -361,7 +362,7 @@ dataMenu texts _ model =
, target "_new"
, title "Opens https://docspell.org/docs"
]
[ i [ class "fa fa-question-circle w-6" ] []
[ Icons.documentationIcon "w-6"
, span [ class "ml-1" ] [ text texts.help ]
, span [ class "float-right" ]
[ i [ class "fa fa-external-link-alt w-6" ] []

View File

@ -16,6 +16,7 @@ module Comp.BookmarkChooser exposing
, isEmptySelection
, update
, view
, viewWith
)
import Api.Model.BookmarkedQuery exposing (BookmarkedQuery)
@ -114,19 +115,31 @@ update msg model current =
--- View
view : Texts -> Model -> Selection -> Html Msg
view texts model selection =
type alias ViewSettings =
{ showUser : Bool
, showCollective : Bool
, showShares : Bool
}
viewWith : ViewSettings -> Texts -> Model -> Selection -> Html Msg
viewWith cfg texts model selection =
let
( user, coll ) =
List.partition .personal model.all.bookmarks
in
div [ class "flex flex-col" ]
[ userBookmarks texts user selection
, collBookmarks texts coll selection
, shares texts model selection
[ userBookmarks cfg.showUser texts user selection
, collBookmarks cfg.showCollective texts coll selection
, shares cfg.showShares texts model selection
]
view : Texts -> Model -> Selection -> Html Msg
view =
viewWith { showUser = True, showCollective = True, showShares = True }
titleDiv : String -> Html msg
titleDiv label =
div [ class "text-sm opacity-75 py-0.5 italic" ]
@ -136,11 +149,11 @@ titleDiv label =
]
userBookmarks : Texts -> List BookmarkedQuery -> Selection -> Html Msg
userBookmarks texts model sel =
userBookmarks : Bool -> Texts -> List BookmarkedQuery -> Selection -> Html Msg
userBookmarks visible texts model sel =
div
[ class "mb-2"
, classList [ ( "hidden", model == [] ) ]
, classList [ ( "hidden", model == [] || not visible ) ]
]
[ titleDiv texts.userLabel
, div [ class "flex flex-col space-y-2 md:space-y-1" ]
@ -148,11 +161,11 @@ userBookmarks texts model sel =
]
collBookmarks : Texts -> List BookmarkedQuery -> Selection -> Html Msg
collBookmarks texts model sel =
collBookmarks : Bool -> Texts -> List BookmarkedQuery -> Selection -> Html Msg
collBookmarks visible texts model sel =
div
[ class "mb-2"
, classList [ ( "hidden", [] == model ) ]
, classList [ ( "hidden", [] == model || not visible ) ]
]
[ titleDiv texts.collectiveLabel
, div [ class "flex flex-col space-y-2 md:space-y-1" ]
@ -160,15 +173,15 @@ collBookmarks texts model sel =
]
shares : Texts -> Model -> Selection -> Html Msg
shares texts model sel =
shares : Bool -> Texts -> Model -> Selection -> Html Msg
shares visible texts model sel =
let
bms =
List.map shareToBookmark model.all.shares
in
div
[ class ""
, classList [ ( "hidden", List.isEmpty bms ) ]
, classList [ ( "hidden", List.isEmpty bms || not visible ) ]
]
[ titleDiv texts.shareLabel
, div [ class "flex flex-col space-y-2 md:space-y-1" ]

View File

@ -712,10 +712,10 @@ formHeading texts classes model =
(\_ -> texts.addCustomFieldHeader)
headIcon =
fold (\_ -> Icons.tagIcon2 "mr-2")
(\_ -> Icons.personIcon2 "mr-2")
(\_ -> Icons.organizationIcon2 "mr-2")
(\_ -> Icons.equipmentIcon2 "mt-2")
fold (\_ -> Icons.tagIcon "mr-2")
(\_ -> Icons.personIcon "mr-2")
(\_ -> Icons.organizationIcon "mr-2")
(\_ -> Icons.equipmentIcon "mt-2")
(\_ -> Icons.customFieldIcon2 "mr-2")
in
div [ class classes ]
@ -738,10 +738,10 @@ viewModal2 texts settings mm =
(\_ -> texts.addCustomFieldHeader)
headIcon =
fold (\_ -> Icons.tagIcon2 "mr-2")
(\_ -> Icons.personIcon2 "mr-2")
(\_ -> Icons.organizationIcon2 "mr-2")
(\_ -> Icons.equipmentIcon2 "mt-2")
fold (\_ -> Icons.tagIcon "mr-2")
(\_ -> Icons.personIcon "mr-2")
(\_ -> Icons.organizationIcon "mr-2")
(\_ -> Icons.equipmentIcon "mt-2")
(\_ -> Icons.customFieldIcon2 "mr-2")
in
div

View File

@ -9,6 +9,7 @@ module Comp.EquipmentManage exposing
( Model
, Msg(..)
, emptyModel
, init
, update
, view2
)
@ -70,6 +71,11 @@ emptyModel =
}
init : Flags -> ( Model, Cmd Msg )
init flags =
( emptyModel, Api.getEquipments flags emptyModel.query emptyModel.order EquipmentResp )
type Msg
= TableMsg Comp.EquipmentTable.Msg
| FormMsg Comp.EquipmentForm.Msg

View File

@ -418,7 +418,7 @@ viewRow texts cfg settings flags model item =
, class "hover:opacity-60"
, title texts.basics.folder
]
[ Icons.folderIcon2 "mr-2"
[ Icons.folderIcon "mr-2"
, Comp.LinkTarget.makeFolderLink item
[ ( "hover:opacity-60", True ) ]
SetLinkTarget
@ -592,7 +592,7 @@ metaDataContent2 texts settings item =
, class "hover:opacity-60"
, title texts.basics.folder
]
[ Icons.folderIcon2 "mr-2"
[ Icons.folderIcon "mr-2"
, Comp.LinkTarget.makeFolderLink item
[ ( "hover:opacity-60", True ) ]
SetLinkTarget

View File

@ -298,7 +298,7 @@ formTabs texts flags settings model =
[ optional [ Data.Fields.CorrOrg ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.organizationIcon2 "mr-2"
[ Icons.organizationIcon "mr-2"
, text texts.basics.organization
, addIconLink texts.addNewOrg StartCorrOrgModal
, editIconLink texts.editOrg model.corrOrgModel StartEditCorrOrgModal
@ -314,7 +314,7 @@ formTabs texts flags settings model =
, optional [ Data.Fields.CorrPerson ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.personIcon2 "mr-2"
[ Icons.personIcon "mr-2"
, text texts.basics.person
, addIconLink texts.addNewCorrespondentPerson StartCorrPersonModal
, editIconLink texts.editPerson
@ -348,7 +348,7 @@ formTabs texts flags settings model =
[ optional [ Data.Fields.ConcPerson ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.personIcon2 "mr-2"
[ Icons.personIcon "mr-2"
, text texts.basics.person
, addIconLink texts.addNewConcerningPerson StartConcPersonModal
, editIconLink texts.editPerson
@ -366,7 +366,7 @@ formTabs texts flags settings model =
, optional [ Data.Fields.ConcEquip ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.equipmentIcon2 "mr-2"
[ Icons.equipmentIcon "mr-2"
, text texts.basics.equipment
, addIconLink texts.addNewEquipment StartEquipModal
, editIconLink texts.editEquipment

View File

@ -98,7 +98,7 @@ view texts settings model =
[ class itemStyle
, title texts.basics.folder
]
[ Icons.folderIcon2 "mr-2"
[ Icons.folderIcon "mr-2"
, Comp.LinkTarget.makeFolderLink model.item
[ ( linkStyle, True ) ]
SetLinkTarget

View File

@ -735,7 +735,7 @@ renderEditForm2 texts flags cfg settings model =
, body =
[ div [ class "field" ]
[ label [ class S.inputLabel ]
[ Icons.tagsIcon2 ""
[ Icons.tagsIcon ""
, text texts.basics.tags
, a
[ class "float-right"
@ -841,7 +841,7 @@ renderEditForm2 texts flags cfg settings model =
[ optional [ Data.Fields.CorrOrg ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.organizationIcon2 ""
[ Icons.organizationIcon ""
, span [ class "ml-2" ]
[ text texts.basics.organization
]
@ -856,7 +856,7 @@ renderEditForm2 texts flags cfg settings model =
, optional [ Data.Fields.CorrPerson ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.personIcon2 ""
[ Icons.personIcon ""
, span [ class "ml-2" ]
[ text texts.basics.person
]
@ -878,7 +878,7 @@ renderEditForm2 texts flags cfg settings model =
[ optional [ Data.Fields.ConcPerson ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.personIcon2 ""
[ Icons.personIcon ""
, span [ class "ml-2" ]
[ text texts.basics.person ]
]
@ -887,7 +887,7 @@ renderEditForm2 texts flags cfg settings model =
, optional [ Data.Fields.ConcEquip ] <|
div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ Icons.equipmentIcon2 ""
[ Icons.equipmentIcon ""
, span [ class "ml-2" ]
[ text texts.basics.equipment ]
]

View File

@ -9,6 +9,7 @@ module Comp.OrgManage exposing
( Model
, Msg(..)
, emptyModel
, init
, update
, view2
)
@ -71,6 +72,11 @@ emptyModel =
}
init : Flags -> ( Model, Cmd Msg )
init flags =
( emptyModel, Api.getOrganizations flags emptyModel.query emptyModel.order OrgResp )
type Msg
= TableMsg Comp.OrgTable.Msg
| FormMsg Comp.OrgForm.Msg

View File

@ -9,6 +9,7 @@ module Comp.PersonManage exposing
( Model
, Msg(..)
, emptyModel
, init
, update
, view2
)
@ -72,6 +73,11 @@ emptyModel =
}
init : Flags -> ( Model, Cmd Msg )
init flags =
( emptyModel, Api.getPersons flags emptyModel.query emptyModel.order PersonResp )
type Msg
= TableMsg Comp.PersonTable.Msg
| FormMsg Comp.PersonForm.Msg

View File

@ -85,6 +85,7 @@ init flags =
, Cmd.batch
[ Cmd.map FormMsg fc
, Cmd.map MailMsg mc
, Api.getShares flags "" True LoadSharesResp
]
)

View File

@ -69,6 +69,7 @@ init flags =
[ Cmd.map FormMsg fc
, Ports.initClipboard appClipboardData
, Ports.initClipboard apiClipboardData
, Api.getSources flags SourceResp
]
)

View File

@ -9,6 +9,7 @@ module Comp.TagManage exposing
( Model
, Msg(..)
, emptyModel
, init
, update
, view2
)
@ -73,6 +74,11 @@ emptyModel =
}
init : Flags -> ( Model, Cmd Msg )
init flags =
( emptyModel, Api.getTags flags emptyModel.query emptyModel.order (TagResp emptyModel.query) )
type Msg
= TableMsg Comp.TagTable.Msg
| FormMsg Comp.TagForm.Msg

View File

@ -546,7 +546,7 @@ viewTagItem2 ddm settings model tag =
Data.UiSettings.tagColorFg2 tag.tag settings
icon =
getIcon2 state color I.tagIcon2
getIcon2 state color I.tagIcon
dropActive =
DD.getDropId ddm == Just (DD.Tag tag.tag.id)
@ -587,7 +587,7 @@ viewCategoryItem2 settings model cat =
Data.UiSettings.catColorFg2 settings cat.name
icon =
getIcon2 state color I.tagsIcon2
getIcon2 state color I.tagsIcon
in
a
[ class "flex flex-row items-center"

View File

@ -25,6 +25,7 @@ module Data.Icons exposing
, customFieldTypeIcon
, customFieldTypeIconString
, customFieldTypeIconString2
, dashboardIcon
, date
, date2
, dateIcon
@ -33,6 +34,7 @@ module Data.Icons exposing
, direction2
, directionIcon
, directionIcon2
, documentationIcon
, dueDate
, dueDate2
, dueDateIcon
@ -40,24 +42,22 @@ module Data.Icons exposing
, editNotes
, editNotesIcon
, equipment
, equipment2
, equipmentIcon
, equipmentIcon2
, folder
, folder2
, folderIcon
, folderIcon2
, gotifyIcon
, itemDatesIcon
, matrixIcon
, metadata
, metadataIcon
, notificationHooks
, notificationHooksIcon
, organization
, organization2
, organizationIcon
, organizationIcon2
, periodicTasks
, periodicTasksIcon
, person
, person2
, personIcon
, personIcon2
, search
, searchIcon
, share
@ -67,11 +67,9 @@ module Data.Icons exposing
, source2
, sourceIcon2
, tag
, tag2
, tagIcon
, tagIcon2
, tags2
, tagsIcon2
, tags
, tagsIcon
, trash
, trashIcon
)
@ -83,6 +81,56 @@ import Svg
import Svg.Attributes as SA
documentation : String
documentation =
"fa fa-question-circle"
documentationIcon : String -> Html msg
documentationIcon classes =
i [ class classes, class documentation ] []
dashboard : String
dashboard =
"fa fa-house-user"
dashboardIcon : String -> Html msg
dashboardIcon classes =
i [ class classes, class dashboard ] []
periodicTasks : String
periodicTasks =
"fa fa-history"
periodicTasksIcon : String -> Html msg
periodicTasksIcon classes =
i [ class classes, class periodicTasks ] []
notificationHooks : String
notificationHooks =
"fa fa-comment font-thin"
notificationHooksIcon : String -> Html msg
notificationHooksIcon classes =
i [ class classes, class notificationHooks ] []
metadata : String
metadata =
"fa fa-cubes"
metadataIcon : String -> Html msg
metadataIcon classes =
i [ class classes, class metadata ] []
trash : String
trash =
"fa fa-trash-alt text-red-500 dark:text-orange-600"
@ -203,7 +251,7 @@ customFieldIcon2 classes =
search : String
search =
"search icon"
"fa fa-search"
searchIcon : String -> Html msg
@ -213,11 +261,6 @@ searchIcon classes =
folder : String
folder =
"folder outline icon"
folder2 : String
folder2 =
"fa fa-folder font-thin "
@ -226,11 +269,6 @@ folderIcon classes =
i [ class (folder ++ " " ++ classes) ] []
folderIcon2 : String -> Html msg
folderIcon2 classes =
i [ class (folder2 ++ " " ++ classes) ] []
concerned : String
concerned =
"crosshairs icon"
@ -361,11 +399,6 @@ showQrIcon classes =
tag : String
tag =
"tag icon"
tag2 : String
tag2 =
"fa fa-tag"
@ -374,19 +407,14 @@ tagIcon classes =
i [ class (tag ++ " " ++ classes) ] []
tagIcon2 : String -> Html msg
tagIcon2 classes =
i [ class (tag2 ++ " " ++ classes) ] []
tags2 : String
tags2 =
tags : String
tags =
"fa fa-tags"
tagsIcon2 : String -> Html msg
tagsIcon2 classes =
i [ class (tags2 ++ " " ++ classes) ] []
tagsIcon : String -> Html msg
tagsIcon classes =
i [ class (tags ++ " " ++ classes) ] []
direction : String
@ -411,11 +439,6 @@ directionIcon2 classes =
person : String
person =
"user icon"
person2 : String
person2 =
"fa fa-user"
@ -424,18 +447,8 @@ personIcon classes =
i [ class (person ++ " " ++ classes) ] []
personIcon2 : String -> Html msg
personIcon2 classes =
i [ class (person2 ++ " " ++ classes) ] []
organization : String
organization =
"factory icon"
organization2 : String
organization2 =
"fa fa-industry"
@ -444,18 +457,8 @@ organizationIcon classes =
i [ class (organization ++ " " ++ classes) ] []
organizationIcon2 : String -> Html msg
organizationIcon2 classes =
i [ class (organization2 ++ " " ++ classes) ] []
equipment : String
equipment =
"box icon"
equipment2 : String
equipment2 =
"fa fa-box"
@ -464,11 +467,6 @@ equipmentIcon classes =
i [ class (equipment ++ " " ++ classes) ] []
equipmentIcon2 : String -> Html msg
equipmentIcon2 classes =
i [ class (equipment2 ++ " " ++ classes) ] []
matrixIcon : String -> Html msg
matrixIcon classes =
Svg.svg

View File

@ -1,15 +1,56 @@
module Messages.Page.Dashboard exposing (Texts, de, gb)
import Messages.Comp.BookmarkChooser
import Messages.Comp.EquipmentManage
import Messages.Comp.FolderManage
import Messages.Comp.NotificationHookManage
import Messages.Comp.OrgManage
import Messages.Comp.PeriodicQueryTaskManage
import Messages.Comp.PersonManage
import Messages.Comp.ShareManage
import Messages.Comp.SourceManage
import Messages.Comp.TagManage
type alias Texts =
{}
{ bookmarkChooser : Messages.Comp.BookmarkChooser.Texts
, notificationHookManage : Messages.Comp.NotificationHookManage.Texts
, periodicQueryManage : Messages.Comp.PeriodicQueryTaskManage.Texts
, sourceManage : Messages.Comp.SourceManage.Texts
, shareManage : Messages.Comp.ShareManage.Texts
, organizationManage : Messages.Comp.OrgManage.Texts
, personManage : Messages.Comp.PersonManage.Texts
, equipManage : Messages.Comp.EquipmentManage.Texts
, tagManage : Messages.Comp.TagManage.Texts
, folderManage : Messages.Comp.FolderManage.Texts
}
gb : Texts
gb =
{}
{ bookmarkChooser = Messages.Comp.BookmarkChooser.gb
, notificationHookManage = Messages.Comp.NotificationHookManage.gb
, periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.gb
, sourceManage = Messages.Comp.SourceManage.gb
, shareManage = Messages.Comp.ShareManage.gb
, organizationManage = Messages.Comp.OrgManage.gb
, personManage = Messages.Comp.PersonManage.gb
, equipManage = Messages.Comp.EquipmentManage.gb
, tagManage = Messages.Comp.TagManage.gb
, folderManage = Messages.Comp.FolderManage.gb
}
de : Texts
de =
{}
{ bookmarkChooser = Messages.Comp.BookmarkChooser.de
, notificationHookManage = Messages.Comp.NotificationHookManage.de
, periodicQueryManage = Messages.Comp.PeriodicQueryTaskManage.de
, sourceManage = Messages.Comp.SourceManage.de
, shareManage = Messages.Comp.ShareManage.de
, organizationManage = Messages.Comp.OrgManage.de
, personManage = Messages.Comp.PersonManage.de
, equipManage = Messages.Comp.EquipmentManage.de
, tagManage = Messages.Comp.TagManage.de
, folderManage = Messages.Comp.FolderManage.de
}

View File

@ -6,22 +6,92 @@
module Page.Dashboard.Data exposing
( Model
( Content(..)
, Model
, Msg(..)
, SideMenuModel
, init
)
import Api
import Comp.BookmarkChooser
import Comp.EquipmentManage
import Comp.FolderManage
import Comp.NotificationHookManage
import Comp.OrgManage
import Comp.PeriodicQueryTaskManage
import Comp.PersonManage
import Comp.ShareManage
import Comp.SourceManage
import Comp.TagManage
import Data.Bookmarks exposing (AllBookmarks)
import Data.Flags exposing (Flags)
type alias SideMenuModel =
{ bookmarkChooser : Comp.BookmarkChooser.Model
}
type alias Model =
{}
{ sideMenu : SideMenuModel
, content : Content
}
init : Flags -> ( Model, Cmd Msg )
init flags =
( {}, Cmd.none )
( { sideMenu =
{ bookmarkChooser = Comp.BookmarkChooser.init Data.Bookmarks.empty
}
, content = NoContent
}
, initCmd flags
)
initCmd : Flags -> Cmd Msg
initCmd flags =
let
ignoreBookmarkError r =
Result.withDefault Data.Bookmarks.empty r
|> GetBookmarksResp
in
Api.getBookmarks flags ignoreBookmarkError
type Msg
= Init
= GetBookmarksResp AllBookmarks
| BookmarkMsg Comp.BookmarkChooser.Msg
| NotificationHookMsg Comp.NotificationHookManage.Msg
| PeriodicQueryMsg Comp.PeriodicQueryTaskManage.Msg
| SourceMsg Comp.SourceManage.Msg
| ShareMsg Comp.ShareManage.Msg
| OrganizationMsg Comp.OrgManage.Msg
| PersonMsg Comp.PersonManage.Msg
| EquipmentMsg Comp.EquipmentManage.Msg
| TagMsg Comp.TagManage.Msg
| FolderMsg Comp.FolderManage.Msg
| InitNotificationHook
| InitDashboard
| InitPeriodicQuery
| InitSource
| InitShare
| InitOrganization
| InitPerson
| InitEquipment
| InitTags
| InitFolder
type Content
= NoContent
| Webhook Comp.NotificationHookManage.Model
| PeriodicQuery Comp.PeriodicQueryTaskManage.Model
| Source Comp.SourceManage.Model
| Share Comp.ShareManage.Model
| Organization Comp.OrgManage.Model
| Person Comp.PersonManage.Model
| Equipment Comp.EquipmentManage.Model
| Tags Comp.TagManage.Model
| Folder Comp.FolderManage.Model

View File

@ -0,0 +1,80 @@
module Page.Dashboard.SideMenu exposing (view)
import Comp.BookmarkChooser
import Data.Icons as Icons
import Data.UiSettings exposing (UiSettings)
import Html exposing (Attribute, Html, a, div, h3, span, text)
import Html.Attributes exposing (class, href, target)
import Html.Events exposing (onClick)
import Messages.Page.Dashboard exposing (Texts)
import Page exposing (Page(..))
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" ]
[ div [ class "mt-2" ]
[ menuLink [ onClick InitDashboard, href "#" ] (Icons.dashboardIcon "") "Dashboard"
, menuLink [ Page.href SearchPage ] (Icons.searchIcon "") "Items"
]
, h3
[ class S.header3
, class "italic mt-3"
]
[ text "Bookmarks"
]
, div [ class "ml-2" ]
[ Html.map BookmarkMsg
(Comp.BookmarkChooser.viewWith
{ showUser = True, showCollective = True, showShares = False }
texts.bookmarkChooser
model.bookmarkChooser
Comp.BookmarkChooser.emptySelection
)
]
, h3
[ class S.header3
, class "italic mt-3"
]
[ text "Manage"
]
, 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"
]
, h3
[ class S.header3
, class "italic mt-3"
]
[ text "Misc"
]
, div [ class "ml-2" ]
[ menuLink [ href "#", target "_blank" ] (Icons.documentationIcon "") "Documentation"
]
]
menuLink : List (Attribute Msg) -> Html Msg -> String -> Html Msg
menuLink attrs icon label =
a
(attrs
++ [ class "my-1"
, class "flex flex-row items-center rounded px-1 py-1 hover:bg-blue-100 dark:hover:bg-slate-600"
]
)
[ icon
, span [ class "ml-2" ]
[ text label
]
]

View File

@ -7,12 +7,229 @@
module Page.Dashboard.Update exposing (update)
import Comp.BookmarkChooser
import Comp.EquipmentManage
import Comp.FolderManage
import Comp.NotificationHookManage
import Comp.OrgManage
import Comp.PeriodicQueryTaskManage
import Comp.PersonManage
import Comp.ShareManage
import Comp.SourceManage
import Comp.TagManage
import Data.Flags exposing (Flags)
import Messages.Page.Dashboard exposing (Texts)
import Page.Dashboard.Data exposing (..)
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
update flags msg model =
update : Texts -> Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
update texts flags msg model =
case msg of
Init ->
( model, Cmd.none )
GetBookmarksResp list ->
let
sideMenu =
model.sideMenu
in
unit
{ model | sideMenu = { sideMenu | bookmarkChooser = Comp.BookmarkChooser.init list } }
BookmarkMsg lm ->
let
sideMenu =
model.sideMenu
( bm, sel ) =
Comp.BookmarkChooser.update
lm
sideMenu.bookmarkChooser
Comp.BookmarkChooser.emptySelection
in
( { model | sideMenu = { sideMenu | bookmarkChooser = bm } }
, Cmd.none
, Sub.none
)
InitDashboard ->
( { model | content = NoContent }, Cmd.none, Sub.none )
InitNotificationHook ->
let
( nhm, nhc ) =
Comp.NotificationHookManage.init flags
in
( { model | content = Webhook nhm }, Cmd.map NotificationHookMsg nhc, Sub.none )
InitPeriodicQuery ->
let
( pqm, pqc ) =
Comp.PeriodicQueryTaskManage.init flags
in
( { model | content = PeriodicQuery pqm }, Cmd.map PeriodicQueryMsg pqc, Sub.none )
InitSource ->
let
( sm, sc ) =
Comp.SourceManage.init flags
in
( { model | content = Source sm }, Cmd.map SourceMsg sc, Sub.none )
InitShare ->
let
( sm, sc ) =
Comp.ShareManage.init flags
in
( { model | content = Share sm }, Cmd.map ShareMsg sc, Sub.none )
InitOrganization ->
let
( om, oc ) =
Comp.OrgManage.init flags
in
( { model | content = Organization om }, Cmd.map OrganizationMsg oc, Sub.none )
InitPerson ->
let
( pm, pc ) =
Comp.PersonManage.init flags
in
( { model | content = Person pm }, Cmd.map PersonMsg pc, Sub.none )
InitEquipment ->
let
( em, ec ) =
Comp.EquipmentManage.init flags
in
( { model | content = Equipment em }, Cmd.map EquipmentMsg ec, Sub.none )
InitTags ->
let
( tm, tc ) =
Comp.TagManage.init flags
in
( { model | content = Tags tm }, Cmd.map TagMsg tc, Sub.none )
InitFolder ->
let
( fm, fc ) =
Comp.FolderManage.init flags
in
( { model | content = Folder fm }, Cmd.map FolderMsg fc, Sub.none )
NotificationHookMsg lm ->
case model.content of
Webhook nhm ->
let
( nhm_, nhc ) =
Comp.NotificationHookManage.update flags lm nhm
in
( { model | content = Webhook nhm_ }, Cmd.map NotificationHookMsg nhc, Sub.none )
_ ->
unit model
PeriodicQueryMsg lm ->
case model.content of
PeriodicQuery pqm ->
let
( pqm_, pqc, pqs ) =
Comp.PeriodicQueryTaskManage.update flags lm pqm
in
( { model | content = PeriodicQuery pqm_ }
, Cmd.map PeriodicQueryMsg pqc
, Sub.map PeriodicQueryMsg pqs
)
_ ->
unit model
SourceMsg lm ->
case model.content of
Source m ->
let
( sm, sc ) =
Comp.SourceManage.update flags lm m
in
( { model | content = Source sm }, Cmd.map SourceMsg sc, Sub.none )
_ ->
unit model
ShareMsg lm ->
case model.content of
Share m ->
let
( sm, sc, subs ) =
Comp.ShareManage.update texts.shareManage flags lm m
in
( { model | content = Share sm }
, Cmd.map ShareMsg sc
, Sub.map ShareMsg subs
)
_ ->
unit model
OrganizationMsg lm ->
case model.content of
Organization m ->
let
( om, oc ) =
Comp.OrgManage.update flags lm m
in
( { model | content = Organization om }, Cmd.map OrganizationMsg oc, Sub.none )
_ ->
unit model
PersonMsg lm ->
case model.content of
Person m ->
let
( pm, pc ) =
Comp.PersonManage.update flags lm m
in
( { model | content = Person pm }, Cmd.map PersonMsg pc, Sub.none )
_ ->
unit model
EquipmentMsg lm ->
case model.content of
Equipment m ->
let
( em, ec ) =
Comp.EquipmentManage.update flags lm m
in
( { model | content = Equipment em }, Cmd.map EquipmentMsg ec, Sub.none )
_ ->
unit model
TagMsg lm ->
case model.content of
Tags m ->
let
( tm, tc ) =
Comp.TagManage.update flags lm m
in
( { model | content = Tags tm }, Cmd.map TagMsg tc, Sub.none )
_ ->
unit model
FolderMsg lm ->
case model.content of
Folder m ->
let
( fm, fc ) =
Comp.FolderManage.update flags lm m
in
( { model | content = Folder fm }, Cmd.map FolderMsg fc, Sub.none )
_ ->
unit model
unit : Model -> ( Model, Cmd Msg, Sub Msg )
unit m =
( m, Cmd.none, Sub.none )

View File

@ -7,6 +7,15 @@
module Page.Dashboard.View exposing (viewContent, viewSidebar)
import Comp.EquipmentManage
import Comp.FolderManage
import Comp.NotificationHookManage
import Comp.OrgManage
import Comp.PeriodicQueryTaskManage
import Comp.PersonManage
import Comp.ShareManage
import Comp.SourceManage
import Comp.TagManage
import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
@ -14,25 +23,159 @@ import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Messages.Page.Dashboard exposing (Texts)
import Page.Dashboard.Data exposing (..)
import Page.Dashboard.SideMenu as SideMenu
import Styles as S
viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg
viewSidebar texts visible _ _ model =
viewSidebar texts visible _ settings model =
div
[ id "sidebar"
, class S.sidebar
, class S.sidebarBg
, classList [ ( "hidden", not visible ) ]
]
[ div [ class "" ]
[ h1 [ class S.header1 ]
[ text "sidebar"
]
]
[ SideMenu.view texts settings model.sideMenu
]
viewContent : Texts -> Flags -> UiSettings -> Model -> Html Msg
viewContent texts _ _ model =
div [] []
viewContent texts flags settings model =
div
[ id "content"
, class S.content
]
[ case model.content of
NoContent ->
div [] []
Webhook m ->
viewHookManage texts settings m
PeriodicQuery m ->
viewPeriodicQuery texts settings m
Source m ->
viewSource texts flags settings m
Share m ->
viewShare texts flags settings m
Organization m ->
viewOrganization texts settings m
Person m ->
viewPerson texts settings m
Equipment m ->
viewEquipment texts m
Tags m ->
viewTags texts settings m
Folder m ->
viewFolder texts flags m
]
--- Helpers
viewFolder : Texts -> Flags -> Comp.FolderManage.Model -> Html Msg
viewFolder texts flags model =
div []
[ h1 [ class S.header1 ]
[ text "Folder"
]
, Html.map FolderMsg <|
Comp.FolderManage.view2 texts.folderManage flags model
]
viewTags : Texts -> UiSettings -> Comp.TagManage.Model -> Html Msg
viewTags texts settings model =
div []
[ h1 [ class S.header1 ]
[ text "Tags"
]
, Html.map TagMsg <|
Comp.TagManage.view2 texts.tagManage settings model
]
viewEquipment : Texts -> Comp.EquipmentManage.Model -> Html Msg
viewEquipment texts model =
div []
[ h1 [ class S.header1 ]
[ text "Equipment"
]
, Html.map EquipmentMsg <|
Comp.EquipmentManage.view2 texts.equipManage model
]
viewPerson : Texts -> UiSettings -> Comp.PersonManage.Model -> Html Msg
viewPerson texts settings model =
div []
[ h1 [ class S.header1 ]
[ text "Person"
]
, Html.map PersonMsg <|
Comp.PersonManage.view2 texts.personManage settings model
]
viewOrganization : Texts -> UiSettings -> Comp.OrgManage.Model -> Html Msg
viewOrganization texts settings model =
div []
[ h1 [ class S.header1 ]
[ text "Organizations"
]
, Html.map OrganizationMsg <|
Comp.OrgManage.view2 texts.organizationManage settings model
]
viewShare : Texts -> Flags -> UiSettings -> Comp.ShareManage.Model -> Html Msg
viewShare texts flags settings model =
div []
[ h1 [ class S.header1 ]
[ text "Shares"
]
, Html.map ShareMsg <|
Comp.ShareManage.view texts.shareManage settings flags model
]
viewSource : Texts -> Flags -> UiSettings -> Comp.SourceManage.Model -> Html Msg
viewSource texts flags settings model =
div []
[ h1 [ class S.header1 ]
[ text "Sources"
]
, Html.map SourceMsg <|
Comp.SourceManage.view2 texts.sourceManage flags settings model
]
viewPeriodicQuery : Texts -> UiSettings -> Comp.PeriodicQueryTaskManage.Model -> Html Msg
viewPeriodicQuery texts settings model =
div []
[ h1 [ class S.header1 ]
[ text "Periodic Queries"
]
, Html.map PeriodicQueryMsg <|
Comp.PeriodicQueryTaskManage.view texts.periodicQueryManage settings model
]
viewHookManage : Texts -> UiSettings -> Comp.NotificationHookManage.Model -> Html Msg
viewHookManage texts settings model =
div []
[ h1 [ class S.header1 ]
[ text "Notification Hooks"
]
, Html.map NotificationHookMsg <|
Comp.NotificationHookManage.view texts.notificationHookManage settings model
]

View File

@ -46,7 +46,7 @@ viewSidebar texts visible _ settings model =
, class S.sidebarLink
, menuEntryActive model TagTab
]
[ Icons.tagIcon2 ""
[ Icons.tagIcon ""
, span
[ class "ml-3" ]
[ text texts.basics.tags
@ -58,7 +58,7 @@ viewSidebar texts visible _ settings model =
, menuEntryActive model EquipTab
, class S.sidebarLink
]
[ Icons.equipmentIcon2 ""
[ Icons.equipmentIcon ""
, span
[ class "ml-3" ]
[ text texts.basics.equipment
@ -70,7 +70,7 @@ viewSidebar texts visible _ settings model =
, menuEntryActive model OrgTab
, class S.sidebarLink
]
[ Icons.organizationIcon2 ""
[ Icons.organizationIcon ""
, span
[ class "ml-3" ]
[ text texts.basics.organization
@ -82,7 +82,7 @@ viewSidebar texts visible _ settings model =
, menuEntryActive model PersonTab
, class S.sidebarLink
]
[ Icons.personIcon2 ""
[ Icons.personIcon ""
, span
[ class "ml-3" ]
[ text texts.basics.person
@ -99,7 +99,7 @@ viewSidebar texts visible _ settings model =
, menuEntryActive model FolderTab
, class S.sidebarLink
]
[ Icons.folderIcon2 ""
[ Icons.folderIcon ""
, span
[ class "ml-3" ]
[ text texts.basics.folder
@ -186,7 +186,7 @@ viewTags texts settings model =
[ class S.header1
, class "inline-flex items-center"
]
[ Icons.tagIcon2 ""
[ Icons.tagIcon ""
, div [ class "ml-2" ]
[ text texts.basics.tags
]
@ -206,7 +206,7 @@ viewEquip texts model =
[ class S.header1
, class "inline-flex items-center"
]
[ Icons.equipmentIcon2 ""
[ Icons.equipmentIcon ""
, div [ class "ml-2" ]
[ text texts.basics.equipment
]
@ -224,7 +224,7 @@ viewOrg texts settings model =
[ class S.header1
, class "inline-flex items-center"
]
[ Icons.organizationIcon2 ""
[ Icons.organizationIcon ""
, div [ class "ml-2" ]
[ text texts.basics.organization
]
@ -243,7 +243,7 @@ viewPerson texts settings model =
[ class S.header1
, class "inline-flex items-center"
]
[ Icons.personIcon2 ""
[ Icons.personIcon ""
, div [ class "ml-2" ]
[ text texts.basics.person
]
@ -262,7 +262,7 @@ viewFolder texts flags _ model =
[ class S.header1
, class "inline-flex items-center"
]
[ Icons.folderIcon2 ""
[ Icons.folderIcon ""
, div
[ class "ml-2"
]

View File

@ -143,7 +143,7 @@ itemData texts flags model shareId itemId =
]
, div [ class boxStyle ]
[ div [ class headerStyle ]
[ Icons.tagsIcon2 "mr-2 ml-2"
[ Icons.tagsIcon "mr-2 ml-2"
, text texts.tagsAndFields
]
, div [ class "flex flex-row items-center flex-wrap font-medium my-1" ]

View File

@ -18,6 +18,7 @@ import Comp.PeriodicQueryTaskManage
import Comp.ScanMailboxManage
import Comp.UiSettingsManage
import Data.Flags exposing (Flags)
import Data.Icons as Icons
import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
@ -78,7 +79,7 @@ viewSidebar texts visible _ _ model =
, menuEntryActive model NotificationTab
, class S.sidebarLink
]
[ i [ class "fa fa-comment font-thin" ] []
[ Icons.notificationHooksIcon ""
, span
[ class "ml-3" ]
[ text texts.notifications ]
@ -422,7 +423,7 @@ viewNotificationInfo texts settings model =
, onClick (SetTab NotificationQueriesTab)
, class S.link
]
[ i [ class "fa fa-history" ] []
[ Icons.periodicTasksIcon ""
, span
[ class "ml-3" ]
[ text texts.genericQueries ]