mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 19:08:26 +00:00
Remove old ui code in frontend
This commit is contained in:
@ -1,230 +0,0 @@
|
||||
module Page.CollectiveSettings.View exposing (view)
|
||||
|
||||
import Api.Model.TagCount exposing (TagCount)
|
||||
import Comp.CollectiveSettingsForm
|
||||
import Comp.SourceManage
|
||||
import Comp.UserManage
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.Icons as Icons
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Page.CollectiveSettings.Data exposing (..)
|
||||
import Util.Html exposing (classActive)
|
||||
import Util.Maybe
|
||||
import Util.Size
|
||||
|
||||
|
||||
view : Flags -> UiSettings -> Model -> Html Msg
|
||||
view flags settings model =
|
||||
div [ class "collectivesetting-page ui padded grid" ]
|
||||
[ div [ class "sixteen wide mobile four wide tablet four wide computer column" ]
|
||||
[ h4 [ class "ui top attached ablue-comp header" ]
|
||||
[ text "Collective"
|
||||
]
|
||||
, div [ class "ui attached fluid segment" ]
|
||||
[ div [ class "ui fluid vertical secondary menu" ]
|
||||
[ div
|
||||
[ classActive (model.currentTab == Just InsightsTab) "link icon item"
|
||||
, onClick (SetTab InsightsTab)
|
||||
]
|
||||
[ i [ class "chart bar outline icon" ] []
|
||||
, text "Insights"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just SourceTab) "link icon item"
|
||||
, onClick (SetTab SourceTab)
|
||||
]
|
||||
[ Icons.sourceIcon ""
|
||||
, text "Sources"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just SettingsTab) "link icon item"
|
||||
, onClick (SetTab SettingsTab)
|
||||
]
|
||||
[ i [ class "cog icon" ] []
|
||||
, text "Settings"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just UserTab) "link icon item"
|
||||
, onClick (SetTab UserTab)
|
||||
]
|
||||
[ i [ class "user icon" ] []
|
||||
, text "Users"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "sixteen wide mobile twelve wide tablet twelve wide computer column" ]
|
||||
[ div [ class "" ]
|
||||
(case model.currentTab of
|
||||
Just SourceTab ->
|
||||
viewSources flags settings model
|
||||
|
||||
Just UserTab ->
|
||||
viewUsers settings model
|
||||
|
||||
Just InsightsTab ->
|
||||
viewInsights flags model
|
||||
|
||||
Just SettingsTab ->
|
||||
viewSettings flags settings model
|
||||
|
||||
Nothing ->
|
||||
[]
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewInsights : Flags -> Model -> List (Html Msg)
|
||||
viewInsights flags model =
|
||||
let
|
||||
( coll, user ) =
|
||||
Maybe.map (\a -> ( a.collective, a.user )) flags.account
|
||||
|> Maybe.withDefault ( "", "" )
|
||||
in
|
||||
[ h1 [ class "ui header" ]
|
||||
[ i [ class "chart bar outline icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "Insights"
|
||||
]
|
||||
]
|
||||
, h2 [ class "ui sub header" ]
|
||||
[ div [ class "ui horizontal list" ]
|
||||
[ div
|
||||
[ class "item"
|
||||
, title "Collective"
|
||||
]
|
||||
[ i [ class "users circle icon" ] []
|
||||
, text coll
|
||||
]
|
||||
, div
|
||||
[ class "item"
|
||||
, title "User"
|
||||
]
|
||||
[ i [ class "user outline icon" ] []
|
||||
, text user
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "ui basic blue segment" ]
|
||||
[ h4 [ class "ui header" ]
|
||||
[ text "Items"
|
||||
]
|
||||
, div [ class "ui statistics" ]
|
||||
[ div [ class "ui statistic" ]
|
||||
[ div [ class "value" ]
|
||||
[ String.fromInt (model.insights.incomingCount + model.insights.outgoingCount) |> text
|
||||
]
|
||||
, div [ class "label" ]
|
||||
[ text "Items"
|
||||
]
|
||||
]
|
||||
, div [ class "ui statistic" ]
|
||||
[ div [ class "value" ]
|
||||
[ String.fromInt model.insights.incomingCount |> text
|
||||
]
|
||||
, div [ class "label" ]
|
||||
[ text "Incoming"
|
||||
]
|
||||
]
|
||||
, div [ class "ui statistic" ]
|
||||
[ div [ class "value" ]
|
||||
[ String.fromInt model.insights.outgoingCount |> text
|
||||
]
|
||||
, div [ class "label" ]
|
||||
[ text "Outgoing"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "ui basic blue segment" ]
|
||||
[ h4 [ class "ui header" ]
|
||||
[ text "Size"
|
||||
]
|
||||
, div [ class "ui statistics" ]
|
||||
[ div [ class "ui statistic" ]
|
||||
[ div [ class "value" ]
|
||||
[ toFloat model.insights.itemSize |> Util.Size.bytesReadable Util.Size.B |> text
|
||||
]
|
||||
, div [ class "label" ]
|
||||
[ text "Size"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "ui basic blue segment" ]
|
||||
[ h4 [ class "ui header" ]
|
||||
[ text "Tags"
|
||||
]
|
||||
, div [ class "ui statistics" ]
|
||||
(List.map makeTagStats
|
||||
(List.sortBy .count model.insights.tagCloud.items
|
||||
|> List.reverse
|
||||
)
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
makeTagStats : TagCount -> Html Msg
|
||||
makeTagStats nc =
|
||||
div [ class "ui statistic" ]
|
||||
[ div [ class "value" ]
|
||||
[ String.fromInt nc.count |> text
|
||||
]
|
||||
, div [ class "label" ]
|
||||
[ text nc.tag.name
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewSources : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewSources flags settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ Icons.sourceIcon ""
|
||||
, div [ class "content" ]
|
||||
[ text "Sources"
|
||||
]
|
||||
]
|
||||
, Html.map SourceMsg (Comp.SourceManage.view flags settings model.sourceModel)
|
||||
]
|
||||
|
||||
|
||||
viewUsers : UiSettings -> Model -> List (Html Msg)
|
||||
viewUsers settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui user icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "Users"
|
||||
]
|
||||
]
|
||||
, Html.map UserMsg (Comp.UserManage.view settings model.userModel)
|
||||
]
|
||||
|
||||
|
||||
viewSettings : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewSettings flags settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "cog icon" ] []
|
||||
, text "Collective Settings"
|
||||
]
|
||||
, div [ class "ui segment" ]
|
||||
[ Html.map SettingsFormMsg
|
||||
(Comp.CollectiveSettingsForm.view flags settings model.settingsModel)
|
||||
]
|
||||
, div
|
||||
[ classList
|
||||
[ ( "ui message", True )
|
||||
, ( "hidden", Util.Maybe.isEmpty model.submitResult )
|
||||
, ( "success", Maybe.map .success model.submitResult |> Maybe.withDefault False )
|
||||
, ( "error", Maybe.map .success model.submitResult |> Maybe.map not |> Maybe.withDefault False )
|
||||
]
|
||||
]
|
||||
[ Maybe.map .message model.submitResult
|
||||
|> Maybe.withDefault ""
|
||||
|> text
|
||||
]
|
||||
]
|
@ -1,395 +0,0 @@
|
||||
module Page.Home.View exposing (view)
|
||||
|
||||
import Api.Model.ItemSearch
|
||||
import Comp.FixedDropdown
|
||||
import Comp.ItemCardList
|
||||
import Comp.ItemDetail.MultiEditMenu
|
||||
import Comp.SearchMenu
|
||||
import Comp.SearchStatsView
|
||||
import Comp.YesNoDimmer
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.ItemSelection
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Page exposing (Page(..))
|
||||
import Page.Home.Data exposing (..)
|
||||
import Set
|
||||
import Util.Html
|
||||
|
||||
|
||||
view : Flags -> UiSettings -> Model -> Html Msg
|
||||
view flags settings model =
|
||||
let
|
||||
itemViewCfg =
|
||||
case model.viewMode of
|
||||
SelectView svm ->
|
||||
Comp.ItemCardList.ViewConfig
|
||||
model.scrollToCard
|
||||
(Data.ItemSelection.Active svm.ids)
|
||||
|
||||
_ ->
|
||||
Comp.ItemCardList.ViewConfig
|
||||
model.scrollToCard
|
||||
Data.ItemSelection.Inactive
|
||||
|
||||
selectAction =
|
||||
case model.viewMode of
|
||||
SelectView svm ->
|
||||
svm.action
|
||||
|
||||
_ ->
|
||||
NoneAction
|
||||
in
|
||||
div [ class "home-page ui padded grid" ]
|
||||
[ div
|
||||
[ classList
|
||||
[ ( "sixteen wide mobile six wide tablet four wide computer search-menu column"
|
||||
, True
|
||||
)
|
||||
, ( "invisible hidden", menuCollapsed model )
|
||||
]
|
||||
]
|
||||
[ div
|
||||
[ class "ui ablue-comp icon menu"
|
||||
]
|
||||
[ a
|
||||
[ class "borderless item"
|
||||
, href "#"
|
||||
, onClick ToggleSearchMenu
|
||||
, title "Hide menu"
|
||||
]
|
||||
[ i [ class "chevron left icon" ] []
|
||||
]
|
||||
, div [ class "right floated menu" ]
|
||||
[ a
|
||||
[ classList
|
||||
[ ( "borderless item", True )
|
||||
, ( "active", selectActive model )
|
||||
]
|
||||
, href "#"
|
||||
, title "Toggle select items"
|
||||
, onClick ToggleSelectView
|
||||
]
|
||||
[ i [ class "tasks icon" ] []
|
||||
]
|
||||
, a
|
||||
[ class "borderless item"
|
||||
, onClick ResetSearch
|
||||
, title "Reset form"
|
||||
, href "#"
|
||||
]
|
||||
[ i [ class "undo icon" ] []
|
||||
]
|
||||
, a
|
||||
[ class "borderless item"
|
||||
, onClick (DoSearch BasicSearch)
|
||||
, title "Run search query"
|
||||
, href "#"
|
||||
, disabled model.searchInProgress
|
||||
]
|
||||
[ i
|
||||
[ classList
|
||||
[ ( "search icon", not model.searchInProgress )
|
||||
, ( "loading spinner icon", model.searchInProgress )
|
||||
]
|
||||
]
|
||||
[]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "" ]
|
||||
(viewLeftMenu flags settings model)
|
||||
]
|
||||
, div
|
||||
[ classList
|
||||
[ ( "sixteen wide mobile ten wide tablet twelve wide computer column"
|
||||
, not (menuCollapsed model)
|
||||
)
|
||||
, ( "sixteen wide column", menuCollapsed model )
|
||||
, ( "item-card-list", True )
|
||||
]
|
||||
, id "item-card-list"
|
||||
]
|
||||
(List.concat
|
||||
[ viewBar flags model
|
||||
, case model.viewMode of
|
||||
SelectView svm ->
|
||||
[ Html.map DeleteSelectedConfirmMsg
|
||||
(Comp.YesNoDimmer.view2 (selectAction == DeleteSelected)
|
||||
deleteAllDimmer
|
||||
svm.deleteAllConfirm
|
||||
)
|
||||
]
|
||||
|
||||
_ ->
|
||||
[]
|
||||
, viewStats flags settings model
|
||||
, [ Html.map ItemCardListMsg
|
||||
(Comp.ItemCardList.view itemViewCfg settings model.itemListModel)
|
||||
]
|
||||
]
|
||||
)
|
||||
, div
|
||||
[ classList
|
||||
[ ( "sixteen wide column", True )
|
||||
, ( "hidden invisible", resultsBelowLimit settings model )
|
||||
]
|
||||
]
|
||||
[ div [ class "ui basic center aligned segment" ]
|
||||
[ button
|
||||
[ classList
|
||||
[ ( "ui basic tiny button", True )
|
||||
, ( "disabled", not model.moreAvailable )
|
||||
]
|
||||
, disabled (not model.moreAvailable || model.moreInProgress || model.searchInProgress)
|
||||
, title "Load more items"
|
||||
, href "#"
|
||||
, onClick LoadMore
|
||||
]
|
||||
[ if model.moreInProgress then
|
||||
i [ class "loading spinner icon" ] []
|
||||
|
||||
else
|
||||
i [ class "angle double down icon" ] []
|
||||
, if model.moreAvailable then
|
||||
text "Load more…"
|
||||
|
||||
else
|
||||
text "That's all"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewStats : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewStats _ settings model =
|
||||
if settings.searchStatsVisible then
|
||||
Comp.SearchStatsView.view model.searchStats
|
||||
|
||||
else
|
||||
[]
|
||||
|
||||
|
||||
viewLeftMenu : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewLeftMenu flags settings model =
|
||||
let
|
||||
searchMenu =
|
||||
[ Html.map SearchMenuMsg
|
||||
(Comp.SearchMenu.viewDrop model.dragDropData
|
||||
flags
|
||||
settings
|
||||
model.searchMenuModel
|
||||
)
|
||||
]
|
||||
in
|
||||
case model.viewMode of
|
||||
SelectView svm ->
|
||||
case svm.action of
|
||||
EditSelected ->
|
||||
let
|
||||
cfg_ =
|
||||
Comp.ItemDetail.MultiEditMenu.defaultViewConfig
|
||||
|
||||
cfg =
|
||||
{ cfg_
|
||||
| nameState = svm.saveNameState
|
||||
, customFieldState =
|
||||
\fId ->
|
||||
if Set.member fId svm.saveCustomFieldState then
|
||||
Comp.ItemDetail.MultiEditMenu.Saving
|
||||
|
||||
else
|
||||
Comp.ItemDetail.MultiEditMenu.SaveSuccess
|
||||
}
|
||||
in
|
||||
[ div [ class "ui dividing header" ]
|
||||
[ text "Multi-Edit"
|
||||
]
|
||||
, div [ class "ui info message" ]
|
||||
[ text "Note that a change here immediatly affects all selected items on the right!"
|
||||
]
|
||||
, Html.map EditMenuMsg
|
||||
(Comp.ItemDetail.MultiEditMenu.view cfg settings svm.editModel)
|
||||
]
|
||||
|
||||
_ ->
|
||||
searchMenu
|
||||
|
||||
_ ->
|
||||
searchMenu
|
||||
|
||||
|
||||
viewBar : Flags -> Model -> List (Html Msg)
|
||||
viewBar flags model =
|
||||
case model.viewMode of
|
||||
SimpleView ->
|
||||
[ viewSearchBar flags model ]
|
||||
|
||||
SearchView ->
|
||||
[]
|
||||
|
||||
SelectView svm ->
|
||||
[ viewActionBar flags svm model ]
|
||||
|
||||
|
||||
viewActionBar : Flags -> SelectViewModel -> Model -> Html Msg
|
||||
viewActionBar _ svm _ =
|
||||
let
|
||||
selectCount =
|
||||
Set.size svm.ids |> String.fromInt
|
||||
in
|
||||
div
|
||||
[ class "ui ablue-comp icon menu"
|
||||
]
|
||||
[ a
|
||||
[ classList
|
||||
[ ( "borderless item", True )
|
||||
, ( "active", svm.action == EditSelected )
|
||||
]
|
||||
, href "#"
|
||||
, title <| "Edit " ++ selectCount ++ " selected items"
|
||||
, onClick EditSelectedItems
|
||||
]
|
||||
[ i [ class "ui edit icon" ] []
|
||||
]
|
||||
, a
|
||||
[ classList
|
||||
[ ( "borderless item", True )
|
||||
, ( "active", svm.action == DeleteSelected )
|
||||
]
|
||||
, href "#"
|
||||
, title <| "Delete " ++ selectCount ++ " selected items"
|
||||
, onClick RequestDeleteSelected
|
||||
]
|
||||
[ i [ class "trash icon" ] []
|
||||
]
|
||||
, div [ class "right menu" ]
|
||||
[ a
|
||||
[ class "item"
|
||||
, href "#"
|
||||
, onClick SelectAllItems
|
||||
, title "Select all"
|
||||
]
|
||||
[ i [ class "check square outline icon" ] []
|
||||
]
|
||||
, a
|
||||
[ class "borderless item"
|
||||
, href "#"
|
||||
, title "Select none"
|
||||
, onClick SelectNoItems
|
||||
]
|
||||
[ i [ class "square outline icon" ] []
|
||||
]
|
||||
, div [ class "borderless label item" ]
|
||||
[ div [ class "ui circular purple icon label" ]
|
||||
[ text selectCount
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewSearchBar : Flags -> Model -> Html Msg
|
||||
viewSearchBar flags model =
|
||||
let
|
||||
searchTypeItem =
|
||||
Comp.FixedDropdown.Item
|
||||
model.searchTypeDropdownValue
|
||||
(searchTypeString model.searchTypeDropdownValue)
|
||||
|
||||
searchInput =
|
||||
Comp.SearchMenu.textSearchString
|
||||
model.searchMenuModel.textSearchModel
|
||||
|
||||
searchTypeClass =
|
||||
if flags.config.fullTextSearchEnabled then
|
||||
"compact"
|
||||
|
||||
else
|
||||
"hidden invisible"
|
||||
in
|
||||
div
|
||||
[ classList
|
||||
[ ( "invisible hidden", not (menuCollapsed model) )
|
||||
, ( "ui secondary stackable menu container", True )
|
||||
]
|
||||
]
|
||||
[ a
|
||||
[ classList
|
||||
[ ( "search-menu-toggle ui icon button", True )
|
||||
|
||||
-- , ( "primary", not (searchMenuFilled model) )
|
||||
-- , ( "secondary", searchMenuFilled model )
|
||||
]
|
||||
, onClick ToggleSearchMenu
|
||||
, href "#"
|
||||
, title "Open search menu"
|
||||
]
|
||||
[ i [ class "filter icon" ] []
|
||||
]
|
||||
, div [ class "right menu" ]
|
||||
[ div [ class "fitted item" ]
|
||||
[ div [ class "ui left icon right action input" ]
|
||||
[ -- i
|
||||
-- [ classList
|
||||
-- [ ( "search link icon", not model.searchInProgress )
|
||||
-- , ( "loading spinner icon", model.searchInProgress )
|
||||
-- ]
|
||||
-- , href "#"
|
||||
-- , onClick (DoSearch model.searchTypeDropdownValue)
|
||||
-- ]
|
||||
-- (if hasMoreSearch model then
|
||||
-- [ i [ class "icons search-corner-icons" ]
|
||||
-- [ i [ class "tiny blue circle icon" ] []
|
||||
-- ]
|
||||
-- ]
|
||||
-- else
|
||||
-- []
|
||||
-- )
|
||||
input
|
||||
[ type_ "text"
|
||||
, placeholder
|
||||
(case model.searchTypeDropdownValue of
|
||||
ContentOnlySearch ->
|
||||
"Content search…"
|
||||
|
||||
BasicSearch ->
|
||||
"Search in names…"
|
||||
)
|
||||
, onInput SetBasicSearch
|
||||
, Util.Html.onKeyUpCode KeyUpSearchbarMsg
|
||||
, Maybe.map value searchInput
|
||||
|> Maybe.withDefault (value "")
|
||||
]
|
||||
[]
|
||||
, Html.map SearchTypeMsg
|
||||
(Comp.FixedDropdown.viewStyled searchTypeClass
|
||||
(Just searchTypeItem)
|
||||
model.searchTypeDropdown
|
||||
)
|
||||
, a
|
||||
[ class "ui icon basic button"
|
||||
, href "#"
|
||||
, onClick ResetSearch
|
||||
, title "Reset search form"
|
||||
]
|
||||
[ i [ class "undo icon" ] []
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
deleteAllDimmer : Comp.YesNoDimmer.Settings
|
||||
deleteAllDimmer =
|
||||
{ message = "Really delete all selected items?"
|
||||
, headerIcon = "exclamation icon"
|
||||
, headerClass = "ui inverted icon header"
|
||||
, confirmButton = "Yes"
|
||||
, cancelButton = "No"
|
||||
, extraClass = "top aligned"
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
module Page.ItemDetail.View exposing (view)
|
||||
|
||||
import Comp.ItemDetail
|
||||
import Data.ItemNav exposing (ItemNav)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Page.ItemDetail.Data exposing (Model, Msg(..))
|
||||
|
||||
|
||||
view : ItemNav -> UiSettings -> Model -> Html Msg
|
||||
view inav settings model =
|
||||
div [ class "ui fluid container item-detail-page" ]
|
||||
[ Html.map ItemDetailMsg (Comp.ItemDetail.view inav settings model.detail)
|
||||
]
|
@ -1,112 +0,0 @@
|
||||
module Page.Login.View exposing (view)
|
||||
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onCheck, onInput, onSubmit)
|
||||
import Page exposing (Page(..))
|
||||
import Page.Login.Data exposing (..)
|
||||
|
||||
|
||||
view : Flags -> Model -> Html Msg
|
||||
view flags model =
|
||||
div [ class "login-page" ]
|
||||
[ div [ class "ui centered grid" ]
|
||||
[ div [ class "row" ]
|
||||
[ div [ class "sixteen wide mobile twelve wide tablet six wide computer column" ]
|
||||
[ div [ class "ui segment login-view" ]
|
||||
[ h1 [ class "ui center aligned icon header" ]
|
||||
[ img
|
||||
[ class "ui image"
|
||||
, src (flags.config.docspellAssetPath ++ "/img/logo-96.png")
|
||||
]
|
||||
[]
|
||||
, div [ class "content" ]
|
||||
[ text "Sign in to Docspell"
|
||||
]
|
||||
]
|
||||
, Html.form
|
||||
[ class "ui large error raised form segment"
|
||||
, onSubmit Authenticate
|
||||
, autocomplete False
|
||||
]
|
||||
[ div [ class "field" ]
|
||||
[ label [] [ text "Username" ]
|
||||
, div [ class "ui left icon input" ]
|
||||
[ input
|
||||
[ type_ "text"
|
||||
, autocomplete False
|
||||
, onInput SetUsername
|
||||
, value model.username
|
||||
, placeholder "Collective / Login"
|
||||
, autofocus True
|
||||
]
|
||||
[]
|
||||
, i [ class "user icon" ] []
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ label [] [ text "Password" ]
|
||||
, div [ class "ui left icon input" ]
|
||||
[ input
|
||||
[ type_ "password"
|
||||
, autocomplete False
|
||||
, onInput SetPassword
|
||||
, value model.password
|
||||
, placeholder "Password"
|
||||
]
|
||||
[]
|
||||
, i [ class "lock icon" ] []
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, onCheck (\_ -> ToggleRememberMe)
|
||||
, checked model.rememberMe
|
||||
]
|
||||
[]
|
||||
, label []
|
||||
[ text "Remember Me"
|
||||
]
|
||||
]
|
||||
]
|
||||
, button
|
||||
[ class "ui primary fluid button"
|
||||
, type_ "submit"
|
||||
]
|
||||
[ text "Login"
|
||||
]
|
||||
]
|
||||
, resultMessage model
|
||||
, div [ class "ui very basic right aligned segment" ]
|
||||
[ text "No account? "
|
||||
, a [ class "ui icon link", Page.href RegisterPage ]
|
||||
[ i [ class "user circle outline icon" ] []
|
||||
, text "Sign up!"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
resultMessage : Model -> Html Msg
|
||||
resultMessage model =
|
||||
case model.result of
|
||||
Just r ->
|
||||
if r.success then
|
||||
div [ class "ui success message" ]
|
||||
[ text "Login successful."
|
||||
]
|
||||
|
||||
else
|
||||
div [ class "ui error message" ]
|
||||
[ text r.message
|
||||
]
|
||||
|
||||
Nothing ->
|
||||
span [] []
|
@ -1,185 +0,0 @@
|
||||
module Page.ManageData.View exposing (view)
|
||||
|
||||
import Comp.CustomFieldManage
|
||||
import Comp.EquipmentManage
|
||||
import Comp.FolderManage
|
||||
import Comp.OrgManage
|
||||
import Comp.PersonManage
|
||||
import Comp.TagManage
|
||||
import Data.Fields
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.Icons as Icons
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Page.ManageData.Data exposing (..)
|
||||
import Util.Html exposing (classActive)
|
||||
|
||||
|
||||
view : Flags -> UiSettings -> Model -> Html Msg
|
||||
view flags settings model =
|
||||
div [ class "managedata-page ui padded grid" ]
|
||||
[ div [ class "sixteen wide mobile four wide tablet four wide computer column" ]
|
||||
[ h4 [ class "ui top attached ablue-comp header" ]
|
||||
[ text "Manage Data"
|
||||
]
|
||||
, div [ class "ui attached fluid segment" ]
|
||||
[ div [ class "ui fluid vertical secondary menu" ]
|
||||
[ div
|
||||
[ classActive (model.currentTab == Just TagTab) "link icon item"
|
||||
, onClick (SetTab TagTab)
|
||||
]
|
||||
[ Icons.tagIcon ""
|
||||
, text "Tag"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just EquipTab) "link icon item"
|
||||
, onClick (SetTab EquipTab)
|
||||
]
|
||||
[ Icons.equipmentIcon ""
|
||||
, text "Equipment"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just OrgTab) "link icon item"
|
||||
, onClick (SetTab OrgTab)
|
||||
]
|
||||
[ Icons.organizationIcon ""
|
||||
, text "Organization"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just PersonTab) "link icon item"
|
||||
, onClick (SetTab PersonTab)
|
||||
]
|
||||
[ Icons.personIcon ""
|
||||
, text "Person"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just FolderTab) "link icon item"
|
||||
, classList
|
||||
[ ( "invisible hidden"
|
||||
, Data.UiSettings.fieldHidden settings Data.Fields.Folder
|
||||
)
|
||||
]
|
||||
, onClick (SetTab FolderTab)
|
||||
]
|
||||
[ Icons.folderIcon ""
|
||||
, text "Folder"
|
||||
]
|
||||
, div
|
||||
[ classActive (model.currentTab == Just CustomFieldTab) "link icon item"
|
||||
, classList
|
||||
[ ( "invisible hidden"
|
||||
, Data.UiSettings.fieldHidden settings Data.Fields.CustomFields
|
||||
)
|
||||
]
|
||||
, onClick (SetTab CustomFieldTab)
|
||||
]
|
||||
[ Icons.customFieldIcon ""
|
||||
, text "Custom Fields"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "sixteen wide mobile twelve wide tablet twelve wide computer column" ]
|
||||
[ div [ class "" ]
|
||||
(case model.currentTab of
|
||||
Just TagTab ->
|
||||
viewTags model
|
||||
|
||||
Just EquipTab ->
|
||||
viewEquip model
|
||||
|
||||
Just OrgTab ->
|
||||
viewOrg settings model
|
||||
|
||||
Just PersonTab ->
|
||||
viewPerson settings model
|
||||
|
||||
Just FolderTab ->
|
||||
viewFolder flags settings model
|
||||
|
||||
Just CustomFieldTab ->
|
||||
viewCustomFields flags settings model
|
||||
|
||||
Nothing ->
|
||||
[]
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewCustomFields : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewCustomFields flags _ model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ Icons.customFieldIcon ""
|
||||
, div [ class "content" ]
|
||||
[ text "Custom Fields"
|
||||
]
|
||||
]
|
||||
, Html.map CustomFieldMsg (Comp.CustomFieldManage.view flags model.fieldManageModel)
|
||||
]
|
||||
|
||||
|
||||
viewFolder : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewFolder flags _ model =
|
||||
[ h2
|
||||
[ class "ui header"
|
||||
]
|
||||
[ Icons.folderIcon ""
|
||||
, div
|
||||
[ class "content"
|
||||
]
|
||||
[ text "Folders"
|
||||
]
|
||||
]
|
||||
, Html.map FolderMsg (Comp.FolderManage.view flags model.folderManageModel)
|
||||
]
|
||||
|
||||
|
||||
viewTags : Model -> List (Html Msg)
|
||||
viewTags model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ Icons.tagIcon ""
|
||||
, div [ class "content" ]
|
||||
[ text "Tags"
|
||||
]
|
||||
]
|
||||
, Html.map TagManageMsg (Comp.TagManage.view model.tagManageModel)
|
||||
]
|
||||
|
||||
|
||||
viewEquip : Model -> List (Html Msg)
|
||||
viewEquip model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ Icons.equipmentIcon ""
|
||||
, div [ class "content" ]
|
||||
[ text "Equipment"
|
||||
]
|
||||
]
|
||||
, Html.map EquipManageMsg (Comp.EquipmentManage.view model.equipManageModel)
|
||||
]
|
||||
|
||||
|
||||
viewOrg : UiSettings -> Model -> List (Html Msg)
|
||||
viewOrg settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ Icons.organizationIcon ""
|
||||
, div [ class "content" ]
|
||||
[ text "Organizations"
|
||||
]
|
||||
]
|
||||
, Html.map OrgManageMsg (Comp.OrgManage.view settings model.orgManageModel)
|
||||
]
|
||||
|
||||
|
||||
viewPerson : UiSettings -> Model -> List (Html Msg)
|
||||
viewPerson settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ Icons.personIcon ""
|
||||
, div [ class "content" ]
|
||||
[ text "Person"
|
||||
]
|
||||
]
|
||||
, Html.map PersonManageMsg (Comp.PersonManage.view settings model.personManageModel)
|
||||
]
|
@ -1,114 +0,0 @@
|
||||
module Page.NewInvite.View exposing (view)
|
||||
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput, onSubmit)
|
||||
import Page.NewInvite.Data exposing (..)
|
||||
|
||||
|
||||
view : Flags -> Model -> Html Msg
|
||||
view flags model =
|
||||
div [ class "newinvite-page" ]
|
||||
[ div [ class "ui centered grid" ]
|
||||
[ div [ class "row" ]
|
||||
[ div [ class "sixteen wide mobile fourteen wide tablet eight wide computer column" ]
|
||||
[ h1 [ class "ui cener aligned icon header" ]
|
||||
[ text "Create new invitations"
|
||||
]
|
||||
, inviteMessage flags
|
||||
, Html.form
|
||||
[ classList
|
||||
[ ( "ui large form raised segment", True )
|
||||
, ( "error", isFailed model.result )
|
||||
, ( "success", isSuccess model.result )
|
||||
]
|
||||
, onSubmit GenerateInvite
|
||||
]
|
||||
[ div [ class "required field" ]
|
||||
[ label [] [ text "New Invitation Password" ]
|
||||
, div [ class "ui left icon input" ]
|
||||
[ input
|
||||
[ type_ "password"
|
||||
, onInput SetPassword
|
||||
, value model.password
|
||||
, autofocus True
|
||||
]
|
||||
[]
|
||||
, i [ class "key icon" ] []
|
||||
]
|
||||
]
|
||||
, button
|
||||
[ class "ui primary button"
|
||||
, type_ "submit"
|
||||
]
|
||||
[ text "Submit"
|
||||
]
|
||||
, a [ class "ui right floated button", href "#", onClick Reset ]
|
||||
[ text "Reset"
|
||||
]
|
||||
, resultMessage model
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
resultMessage : Model -> Html Msg
|
||||
resultMessage model =
|
||||
div
|
||||
[ classList
|
||||
[ ( "ui message", True )
|
||||
, ( "error", isFailed model.result )
|
||||
, ( "success", isSuccess model.result )
|
||||
, ( "hidden", model.result == Empty )
|
||||
]
|
||||
]
|
||||
[ case model.result of
|
||||
Failed m ->
|
||||
div [ class "content" ]
|
||||
[ div [ class "header" ] [ text "Error" ]
|
||||
, p [] [ text m ]
|
||||
]
|
||||
|
||||
Success r ->
|
||||
div [ class "content" ]
|
||||
[ div [ class "header" ] [ text "Success" ]
|
||||
, p [] [ text r.message ]
|
||||
, p [] [ text "Invitation Key:" ]
|
||||
, pre []
|
||||
[ Maybe.withDefault "" r.key |> text
|
||||
]
|
||||
]
|
||||
|
||||
Empty ->
|
||||
span [] []
|
||||
]
|
||||
|
||||
|
||||
inviteMessage : Flags -> Html Msg
|
||||
inviteMessage flags =
|
||||
div
|
||||
[ classList
|
||||
[ ( "ui message", True )
|
||||
, ( "hidden", flags.config.signupMode /= "invite" )
|
||||
]
|
||||
]
|
||||
[ p []
|
||||
[ text
|
||||
"""Docspell requires an invite when signing up. You can
|
||||
create these invites here and send them to friends so
|
||||
they can signup with docspell."""
|
||||
]
|
||||
, p []
|
||||
[ text
|
||||
"""Each invite can only be used once. You'll need to
|
||||
create one key for each person you want to invite."""
|
||||
]
|
||||
, p []
|
||||
[ text
|
||||
"""Creating an invite requires providing the password
|
||||
from the configuration."""
|
||||
]
|
||||
]
|
@ -1,282 +0,0 @@
|
||||
module Page.Queue.View exposing (view)
|
||||
|
||||
import Api.Model.JobDetail exposing (JobDetail)
|
||||
import Api.Model.JobLogEvent exposing (JobLogEvent)
|
||||
import Comp.Progress
|
||||
import Comp.YesNoDimmer
|
||||
import Data.Priority
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Page.Queue.Data exposing (..)
|
||||
import Util.Time exposing (formatDateTime, formatIsoDateTime)
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
div [ class "queue-page ui grid container" ] <|
|
||||
List.concat
|
||||
[ case model.showLog of
|
||||
Just job ->
|
||||
[ renderJobLog job ]
|
||||
|
||||
Nothing ->
|
||||
List.map (renderProgressCard model) model.state.progress
|
||||
|> List.map (\el -> div [ class "row" ] [ div [ class "column" ] [ el ] ])
|
||||
, [ div [ class "two column row" ]
|
||||
[ renderWaiting model
|
||||
, renderCompleted model
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
renderJobLog : JobDetail -> Html Msg
|
||||
renderJobLog job =
|
||||
div [ class "ui fluid card" ]
|
||||
[ div [ class "content" ]
|
||||
[ i [ class "delete link icon", onClick QuitShowLog ] []
|
||||
, text job.name
|
||||
]
|
||||
, div [ class "content" ]
|
||||
[ div [ class "job-log" ]
|
||||
(List.map renderLogLine job.logs)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
renderWaiting : Model -> Html Msg
|
||||
renderWaiting model =
|
||||
div [ class "column" ]
|
||||
[ div [ class "ui center aligned basic segment" ]
|
||||
[ i [ class "ui large angle double up icon" ] []
|
||||
]
|
||||
, div [ class "ui centered cards" ]
|
||||
(List.map (renderInfoCard model) model.state.queued)
|
||||
]
|
||||
|
||||
|
||||
renderCompleted : Model -> Html Msg
|
||||
renderCompleted model =
|
||||
div [ class "column" ]
|
||||
[ div [ class "ui center aligned basic segment" ]
|
||||
[ i [ class "ui large angle double down icon" ] []
|
||||
]
|
||||
, div [ class "ui centered cards" ]
|
||||
(List.map (renderInfoCard model) model.state.completed)
|
||||
]
|
||||
|
||||
|
||||
renderProgressCard : Model -> JobDetail -> Html Msg
|
||||
renderProgressCard model job =
|
||||
div [ class "ui fluid card" ]
|
||||
[ Comp.Progress.topAttachedIndicating job.progress
|
||||
, Html.map (DimmerMsg job) (Comp.YesNoDimmer.view2 (model.cancelJobRequest == Just job.id) dimmerSettings model.deleteConfirm)
|
||||
, div [ class "content" ]
|
||||
[ div [ class "right floated meta" ]
|
||||
[ div [ class "ui label" ]
|
||||
[ text job.state
|
||||
, div [ class "detail" ]
|
||||
[ Maybe.withDefault "" job.worker |> text
|
||||
]
|
||||
]
|
||||
, div [ class "ui basic label" ]
|
||||
[ i [ class "clock icon" ] []
|
||||
, div [ class "detail" ]
|
||||
[ getDuration model job |> Maybe.withDefault "-:-" |> text
|
||||
]
|
||||
]
|
||||
]
|
||||
, i [ class "asterisk loading icon" ] []
|
||||
, text job.name
|
||||
]
|
||||
, div [ class "content" ]
|
||||
[ div [ class "job-log" ]
|
||||
(List.map renderLogLine job.logs)
|
||||
]
|
||||
, div [ class "meta" ]
|
||||
[ div [ class "right floated" ]
|
||||
[ button [ class "ui button", onClick (RequestCancelJob job) ]
|
||||
[ text "Cancel"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
renderLogLine : JobLogEvent -> Html Msg
|
||||
renderLogLine log =
|
||||
span [ class (String.toLower log.level) ]
|
||||
[ formatIsoDateTime log.time |> text
|
||||
, text ": "
|
||||
, text log.message
|
||||
, br [] []
|
||||
]
|
||||
|
||||
|
||||
isFinal : JobDetail -> Bool
|
||||
isFinal job =
|
||||
case job.state of
|
||||
"failed" ->
|
||||
True
|
||||
|
||||
"success" ->
|
||||
True
|
||||
|
||||
"cancelled" ->
|
||||
True
|
||||
|
||||
_ ->
|
||||
False
|
||||
|
||||
|
||||
dimmerSettings : Comp.YesNoDimmer.Settings
|
||||
dimmerSettings =
|
||||
let
|
||||
defaults =
|
||||
Comp.YesNoDimmer.defaultSettings
|
||||
in
|
||||
{ defaults | headerClass = "ui inverted header", headerIcon = "", message = "Cancel/Delete this job?" }
|
||||
|
||||
|
||||
renderInfoCard : Model -> JobDetail -> Html Msg
|
||||
renderInfoCard model job =
|
||||
let
|
||||
prio =
|
||||
Data.Priority.fromString job.priority
|
||||
|> Maybe.withDefault Data.Priority.Low
|
||||
in
|
||||
div
|
||||
[ classList
|
||||
[ ( "ui fluid card", True )
|
||||
, ( jobStateColor job, True )
|
||||
]
|
||||
]
|
||||
[ Html.map (DimmerMsg job) (Comp.YesNoDimmer.view2 (model.cancelJobRequest == Just job.id) dimmerSettings model.deleteConfirm)
|
||||
, div [ class "content" ]
|
||||
[ div [ class "right floated" ]
|
||||
[ if isFinal job || job.state == "stuck" then
|
||||
span [ onClick (ShowLog job) ]
|
||||
[ i [ class "file link icon", title "Show log" ] []
|
||||
]
|
||||
|
||||
else
|
||||
span [] []
|
||||
, i [ class "delete link icon", title "Remove", onClick (RequestCancelJob job) ] []
|
||||
]
|
||||
, if isFinal job then
|
||||
span [ class "invisible" ] []
|
||||
|
||||
else
|
||||
div [ class "right floated" ]
|
||||
[ div [ class "meta" ]
|
||||
[ getDuration model job |> Maybe.withDefault "-:-" |> text
|
||||
]
|
||||
]
|
||||
, i
|
||||
[ classList
|
||||
[ ( "check icon", job.state == "success" )
|
||||
, ( "redo icon", job.state == "stuck" )
|
||||
, ( "bolt icon", job.state == "failed" )
|
||||
, ( "meh outline icon", job.state == "canceled" )
|
||||
, ( "cog icon", not (isFinal job) && job.state /= "stuck" )
|
||||
]
|
||||
]
|
||||
[]
|
||||
, text job.name
|
||||
]
|
||||
, div [ class "content" ]
|
||||
[ div [ class "right floated" ]
|
||||
[ if isFinal job then
|
||||
div [ class ("ui basic label " ++ jobStateColor job) ]
|
||||
[ i [ class "clock icon" ] []
|
||||
, div [ class "detail" ]
|
||||
[ getDuration model job |> Maybe.withDefault "-:-" |> text
|
||||
]
|
||||
]
|
||||
|
||||
else
|
||||
span [ class "invisible" ] []
|
||||
, div [ class ("ui basic label " ++ jobStateColor job) ]
|
||||
[ text "Retries"
|
||||
, div [ class "detail" ]
|
||||
[ job.retries |> String.fromInt |> text
|
||||
]
|
||||
]
|
||||
, case job.state of
|
||||
"waiting" ->
|
||||
a
|
||||
[ class ("ui basic label " ++ jobStateColor job)
|
||||
, onClick (ChangePrio job.id (Data.Priority.next prio))
|
||||
, href "#"
|
||||
, title "Change priority of this job"
|
||||
]
|
||||
[ i [ class "sort numeric up icon" ] []
|
||||
, text "Prio"
|
||||
, div [ class "detail" ]
|
||||
[ code []
|
||||
[ Data.Priority.fromString job.priority
|
||||
|> Maybe.map Data.Priority.toName
|
||||
|> Maybe.withDefault job.priority
|
||||
|> text
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
_ ->
|
||||
div
|
||||
[ class ("ui basic label " ++ jobStateColor job)
|
||||
]
|
||||
[ text "Prio"
|
||||
, div [ class "detail" ]
|
||||
[ code []
|
||||
[ Data.Priority.fromString job.priority
|
||||
|> Maybe.map Data.Priority.toName
|
||||
|> Maybe.withDefault job.priority
|
||||
|> text
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, jobStateLabel job
|
||||
, div [ class "ui basic label" ]
|
||||
[ Util.Time.formatDateTime job.submitted |> text
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
jobStateColor : JobDetail -> String
|
||||
jobStateColor job =
|
||||
case job.state of
|
||||
"success" ->
|
||||
"green"
|
||||
|
||||
"failed" ->
|
||||
"red"
|
||||
|
||||
"canceled" ->
|
||||
"orange"
|
||||
|
||||
"stuck" ->
|
||||
"purple"
|
||||
|
||||
"scheduled" ->
|
||||
"blue"
|
||||
|
||||
"waiting" ->
|
||||
"grey"
|
||||
|
||||
_ ->
|
||||
""
|
||||
|
||||
|
||||
jobStateLabel : JobDetail -> Html Msg
|
||||
jobStateLabel job =
|
||||
let
|
||||
col =
|
||||
jobStateColor job
|
||||
in
|
||||
div [ class ("ui label " ++ col) ]
|
||||
[ text job.state
|
||||
]
|
@ -1,166 +0,0 @@
|
||||
module Page.Register.View exposing (view)
|
||||
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput, onSubmit)
|
||||
import Page exposing (Page(..))
|
||||
import Page.Register.Data exposing (..)
|
||||
|
||||
|
||||
view : Flags -> Model -> Html Msg
|
||||
view flags model =
|
||||
div [ class "register-page" ]
|
||||
[ div [ class "ui centered grid" ]
|
||||
[ div [ class "row" ]
|
||||
[ div [ class "sixteen wide mobile twelve wide tablet six wide computer column" ]
|
||||
[ div [ class "ui segment register-view" ]
|
||||
[ h1 [ class "ui cener aligned icon header" ]
|
||||
[ img
|
||||
[ class "ui image"
|
||||
, src (flags.config.docspellAssetPath ++ "/img/logo-96.png")
|
||||
]
|
||||
[]
|
||||
, div [ class "content" ]
|
||||
[ text "Sign up @ Docspell"
|
||||
]
|
||||
]
|
||||
, Html.form
|
||||
[ class "ui large error form raised segment"
|
||||
, onSubmit RegisterSubmit
|
||||
, autocomplete False
|
||||
]
|
||||
[ div [ class "required field" ]
|
||||
[ label [] [ text "Collective ID" ]
|
||||
, div [ class "ui left icon input" ]
|
||||
[ input
|
||||
[ type_ "text"
|
||||
, autocomplete False
|
||||
, onInput SetCollId
|
||||
, value model.collId
|
||||
, autofocus True
|
||||
]
|
||||
[]
|
||||
, i [ class "users icon" ] []
|
||||
]
|
||||
]
|
||||
, div [ class "required field" ]
|
||||
[ label [] [ text "User Login" ]
|
||||
, div [ class "ui left icon input" ]
|
||||
[ input
|
||||
[ type_ "text"
|
||||
, autocomplete False
|
||||
, onInput SetLogin
|
||||
, value model.login
|
||||
]
|
||||
[]
|
||||
, i [ class "user icon" ] []
|
||||
]
|
||||
]
|
||||
, div
|
||||
[ class "required field"
|
||||
]
|
||||
[ label [] [ text "Password" ]
|
||||
, div [ class "ui left icon action input" ]
|
||||
[ input
|
||||
[ type_ <|
|
||||
if model.showPass1 then
|
||||
"text"
|
||||
|
||||
else
|
||||
"password"
|
||||
, autocomplete False
|
||||
, onInput SetPass1
|
||||
, value model.pass1
|
||||
]
|
||||
[]
|
||||
, i [ class "lock icon" ] []
|
||||
, button [ class "ui icon button", onClick ToggleShowPass1 ]
|
||||
[ i [ class "eye icon" ] []
|
||||
]
|
||||
]
|
||||
]
|
||||
, div
|
||||
[ class "required field"
|
||||
]
|
||||
[ label [] [ text "Password (repeat)" ]
|
||||
, div [ class "ui left icon action input" ]
|
||||
[ input
|
||||
[ type_ <|
|
||||
if model.showPass2 then
|
||||
"text"
|
||||
|
||||
else
|
||||
"password"
|
||||
, autocomplete False
|
||||
, onInput SetPass2
|
||||
, value model.pass2
|
||||
]
|
||||
[]
|
||||
, i [ class "lock icon" ] []
|
||||
, button [ class "ui icon button", onClick ToggleShowPass2 ]
|
||||
[ i [ class "eye icon" ] []
|
||||
]
|
||||
]
|
||||
]
|
||||
, div
|
||||
[ classList
|
||||
[ ( "field", True )
|
||||
, ( "invisible", flags.config.signupMode /= "invite" )
|
||||
]
|
||||
]
|
||||
[ label [] [ text "Invitation Key" ]
|
||||
, div [ class "ui left icon input" ]
|
||||
[ input
|
||||
[ type_ "text"
|
||||
, autocomplete False
|
||||
, onInput SetInvite
|
||||
, model.invite |> Maybe.withDefault "" |> value
|
||||
]
|
||||
[]
|
||||
, i [ class "key icon" ] []
|
||||
]
|
||||
]
|
||||
, button
|
||||
[ class "ui primary button"
|
||||
, type_ "submit"
|
||||
]
|
||||
[ text "Submit"
|
||||
]
|
||||
]
|
||||
, resultMessage model
|
||||
, div [ class "ui very basic right aligned segment" ]
|
||||
[ text "Already signed up? "
|
||||
, a [ class "ui link", Page.href (LoginPage Nothing) ]
|
||||
[ i [ class "sign in icon" ] []
|
||||
, text "Sign in"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
resultMessage : Model -> Html Msg
|
||||
resultMessage model =
|
||||
case model.result of
|
||||
Just r ->
|
||||
if r.success then
|
||||
div [ class "ui success message" ]
|
||||
[ text "Registration successful."
|
||||
]
|
||||
|
||||
else
|
||||
div [ class "ui error message" ]
|
||||
[ text r.message
|
||||
]
|
||||
|
||||
Nothing ->
|
||||
if List.isEmpty model.errorMsg then
|
||||
span [ class "invisible" ] []
|
||||
|
||||
else
|
||||
div [ class "ui error message" ]
|
||||
(List.map (\s -> div [] [ text s ]) model.errorMsg)
|
@ -1,252 +0,0 @@
|
||||
module Page.Upload.View exposing (view)
|
||||
|
||||
import Comp.Dropzone
|
||||
import Comp.FixedDropdown
|
||||
import Comp.Progress
|
||||
import Dict
|
||||
import File exposing (File)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onCheck, onClick)
|
||||
import Page exposing (Page(..))
|
||||
import Page.Upload.Data exposing (..)
|
||||
import Util.File exposing (makeFileId)
|
||||
import Util.Maybe
|
||||
import Util.Size
|
||||
|
||||
|
||||
view : Maybe String -> Model -> Html Msg
|
||||
view mid model =
|
||||
div [ class "upload-page ui grid container" ]
|
||||
[ div [ class "row" ]
|
||||
[ div [ class "sixteen wide column" ]
|
||||
[ div [ class "ui top attached segment" ]
|
||||
[ renderForm model
|
||||
]
|
||||
, Html.map DropzoneMsg (Comp.Dropzone.view dropzoneSettings model.dropzone)
|
||||
, div [ class "ui bottom attached segment" ]
|
||||
[ a [ class "ui primary button", href "#", onClick SubmitUpload ]
|
||||
[ text "Submit"
|
||||
]
|
||||
, a [ class "ui secondary button", href "#", onClick Clear ]
|
||||
[ text "Reset"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, if isDone model && hasErrors model then
|
||||
renderErrorMsg model
|
||||
|
||||
else
|
||||
span [ class "invisible" ] []
|
||||
, if List.isEmpty model.files then
|
||||
span [] []
|
||||
|
||||
else if isSuccessAll model then
|
||||
renderSuccessMsg (Util.Maybe.nonEmpty mid) model
|
||||
|
||||
else
|
||||
renderUploads model
|
||||
]
|
||||
|
||||
|
||||
dropzoneSettings : Comp.Dropzone.Settings
|
||||
dropzoneSettings =
|
||||
let
|
||||
ds =
|
||||
Comp.Dropzone.defaultSettings
|
||||
in
|
||||
{ ds
|
||||
| classList =
|
||||
\m ->
|
||||
[ ( "ui attached blue placeholder segment dropzone", True )
|
||||
, ( "dragging", m.hover )
|
||||
, ( "disabled", not m.active )
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
renderErrorMsg : Model -> Html Msg
|
||||
renderErrorMsg _ =
|
||||
div [ class "row" ]
|
||||
[ div [ class "sixteen wide column" ]
|
||||
[ div [ class "ui large error message" ]
|
||||
[ h3 [ class "ui header" ]
|
||||
[ i [ class "meh outline icon" ] []
|
||||
, text "Some files failed to upload"
|
||||
]
|
||||
, text "There were errors uploading some files."
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
renderSuccessMsg : Bool -> Model -> Html Msg
|
||||
renderSuccessMsg public _ =
|
||||
div [ class "row" ]
|
||||
[ div [ class "sixteen wide column" ]
|
||||
[ div [ class "ui large success message" ]
|
||||
[ h3 [ class "ui header" ]
|
||||
[ i [ class "smile outline icon" ] []
|
||||
, text "All files uploaded"
|
||||
]
|
||||
, if public then
|
||||
p [] []
|
||||
|
||||
else
|
||||
p []
|
||||
[ text "Your files have been successfully uploaded. They are now being processed. Check the "
|
||||
, a [ class "ui link", Page.href HomePage ]
|
||||
[ text "Items page"
|
||||
]
|
||||
, text " later where the files will arrive eventually. Or go to the "
|
||||
, a [ class "ui link", Page.href QueuePage ]
|
||||
[ text "Processing Page"
|
||||
]
|
||||
, text " to view the current processing state."
|
||||
]
|
||||
, p []
|
||||
[ text "Click "
|
||||
, a [ class "ui link", href "#", onClick Clear ]
|
||||
[ text "Reset"
|
||||
]
|
||||
, text " to upload more files."
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
renderUploads : Model -> Html Msg
|
||||
renderUploads model =
|
||||
div [ class "row" ]
|
||||
[ div [ class "sixteen wide column" ]
|
||||
[ div [ class "ui basic segment" ]
|
||||
[ h2 [ class "ui header" ]
|
||||
[ text "Selected Files"
|
||||
]
|
||||
, div [ class "ui items" ] <|
|
||||
if model.singleItem then
|
||||
List.map (renderFileItem model (Just uploadAllTracker)) model.files
|
||||
|
||||
else
|
||||
List.map (renderFileItem model Nothing) model.files
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
getProgress : Model -> File -> Int
|
||||
getProgress model file =
|
||||
let
|
||||
key =
|
||||
if model.singleItem then
|
||||
uploadAllTracker
|
||||
|
||||
else
|
||||
makeFileId file
|
||||
in
|
||||
Dict.get key model.loading
|
||||
|> Maybe.withDefault 0
|
||||
|
||||
|
||||
renderFileItem : Model -> Maybe String -> File -> Html Msg
|
||||
renderFileItem model mtracker file =
|
||||
let
|
||||
name =
|
||||
File.name file
|
||||
|
||||
size =
|
||||
File.size file
|
||||
|> toFloat
|
||||
|> Util.Size.bytesReadable Util.Size.B
|
||||
in
|
||||
div [ class "item" ]
|
||||
[ i
|
||||
[ classList
|
||||
[ ( "large", True )
|
||||
, ( "file outline icon", isIdle model file )
|
||||
, ( "loading spinner icon", isLoading model file )
|
||||
, ( "green check icon", isCompleted model file )
|
||||
, ( "red bolt icon", isError model file )
|
||||
]
|
||||
]
|
||||
[]
|
||||
, div [ class "middle aligned content" ]
|
||||
[ div [ class "header" ]
|
||||
[ text name
|
||||
]
|
||||
, div [ class "right floated meta" ]
|
||||
[ text size
|
||||
]
|
||||
, div [ class "description" ]
|
||||
[ Comp.Progress.smallIndicating (getProgress model file)
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
renderForm : Model -> Html Msg
|
||||
renderForm model =
|
||||
div [ class "row" ]
|
||||
[ Html.form [ class "ui form" ]
|
||||
[ div [ class "grouped fields" ]
|
||||
[ div [ class "field" ]
|
||||
[ div [ class "ui radio checkbox" ]
|
||||
[ input
|
||||
[ type_ "radio"
|
||||
, checked model.incoming
|
||||
, onCheck (\_ -> ToggleIncoming)
|
||||
]
|
||||
[]
|
||||
, label [] [ text "Incoming" ]
|
||||
]
|
||||
]
|
||||
, div [ class "field" ]
|
||||
[ div [ class "ui radio checkbox" ]
|
||||
[ input
|
||||
[ type_ "radio"
|
||||
, checked (not model.incoming)
|
||||
, onCheck (\_ -> ToggleIncoming)
|
||||
]
|
||||
[]
|
||||
, label [] [ text "Outgoing" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "inline field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, checked model.singleItem
|
||||
, onCheck (\_ -> ToggleSingleItem)
|
||||
]
|
||||
[]
|
||||
, label [] [ text "All files are one single item" ]
|
||||
]
|
||||
]
|
||||
, div [ class "inline field" ]
|
||||
[ div [ class "ui checkbox" ]
|
||||
[ input
|
||||
[ type_ "checkbox"
|
||||
, checked model.skipDuplicates
|
||||
, onCheck (\_ -> ToggleSkipDuplicates)
|
||||
]
|
||||
[]
|
||||
, label [] [ text "Skip files already present in docspell" ]
|
||||
]
|
||||
]
|
||||
, div [ class "inline field" ]
|
||||
[ label [] [ text "Language:" ]
|
||||
, Html.map LanguageMsg
|
||||
(Comp.FixedDropdown.view
|
||||
(Maybe.map mkLanguageItem model.language)
|
||||
model.languageModel
|
||||
)
|
||||
, div [ class "small-info" ]
|
||||
[ text "Used for text extraction and analysis. The collective's "
|
||||
, text "default language is used if not specified here."
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
@ -1,185 +0,0 @@
|
||||
module Page.UserSettings.View exposing (view)
|
||||
|
||||
import Comp.ChangePasswordForm
|
||||
import Comp.EmailSettingsManage
|
||||
import Comp.ImapSettingsManage
|
||||
import Comp.NotificationManage
|
||||
import Comp.ScanMailboxManage
|
||||
import Comp.UiSettingsManage
|
||||
import Data.Flags exposing (Flags)
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Page.UserSettings.Data exposing (..)
|
||||
import Util.Html exposing (classActive)
|
||||
|
||||
|
||||
view : Flags -> UiSettings -> Model -> Html Msg
|
||||
view flags settings model =
|
||||
div [ class "usersetting-page ui padded grid" ]
|
||||
[ div [ class "sixteen wide mobile four wide tablet four wide computer column" ]
|
||||
[ h4 [ class "ui top attached ablue-comp header" ]
|
||||
[ text "User Settings"
|
||||
]
|
||||
, div [ class "ui attached fluid segment" ]
|
||||
[ div [ class "ui fluid vertical secondary menu" ]
|
||||
[ makeTab model ChangePassTab "Change Password" "user secret icon"
|
||||
, makeTab model EmailSettingsTab "E-Mail Settings (SMTP)" "mail icon"
|
||||
, makeTab model ImapSettingsTab "E-Mail Settings (IMAP)" "mail icon"
|
||||
, makeTab model NotificationTab "Notification Task" "bullhorn icon"
|
||||
, makeTab model ScanMailboxTab "Scan Mailbox Task" "envelope open outline icon"
|
||||
, makeTab model UiSettingsTab "UI Settings" "cog icon"
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "sixteen wide mobile twelve wide tablet twelve wide computer column" ]
|
||||
[ div [ class "" ]
|
||||
(case model.currentTab of
|
||||
Just ChangePassTab ->
|
||||
viewChangePassword model
|
||||
|
||||
Just EmailSettingsTab ->
|
||||
viewEmailSettings settings model
|
||||
|
||||
Just NotificationTab ->
|
||||
viewNotificationManage settings model
|
||||
|
||||
Just ImapSettingsTab ->
|
||||
viewImapSettings settings model
|
||||
|
||||
Just ScanMailboxTab ->
|
||||
viewScanMailboxManage settings model
|
||||
|
||||
Just UiSettingsTab ->
|
||||
viewUiSettings flags settings model
|
||||
|
||||
Nothing ->
|
||||
[]
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
makeTab : Model -> Tab -> String -> String -> Html Msg
|
||||
makeTab model tab header icon =
|
||||
a
|
||||
[ classActive (model.currentTab == Just tab) "link icon item"
|
||||
, onClick (SetTab tab)
|
||||
, href "#"
|
||||
]
|
||||
[ i [ class icon ] []
|
||||
, text header
|
||||
]
|
||||
|
||||
|
||||
viewUiSettings : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||
viewUiSettings flags settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "cog icon" ] []
|
||||
, text "UI Settings"
|
||||
]
|
||||
, p []
|
||||
[ text "These settings only affect the web ui. They are stored in the browser, "
|
||||
, text "so they are separated between browsers and devices."
|
||||
]
|
||||
, Html.map UiSettingsMsg
|
||||
(Comp.UiSettingsManage.view
|
||||
flags
|
||||
settings
|
||||
"ui segment"
|
||||
model.uiSettingsModel
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
viewEmailSettings : UiSettings -> Model -> List (Html Msg)
|
||||
viewEmailSettings settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "mail icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "E-Mail Settings (Smtp)"
|
||||
]
|
||||
]
|
||||
, Html.map EmailSettingsMsg (Comp.EmailSettingsManage.view settings model.emailSettingsModel)
|
||||
]
|
||||
|
||||
|
||||
viewImapSettings : UiSettings -> Model -> List (Html Msg)
|
||||
viewImapSettings settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "mail icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "E-Mail Settings (Imap)"
|
||||
]
|
||||
]
|
||||
, Html.map ImapSettingsMsg (Comp.ImapSettingsManage.view settings model.imapSettingsModel)
|
||||
]
|
||||
|
||||
|
||||
viewChangePassword : Model -> List (Html Msg)
|
||||
viewChangePassword model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui user secret icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "Change Password"
|
||||
]
|
||||
]
|
||||
, Html.map ChangePassMsg (Comp.ChangePasswordForm.view model.changePassModel)
|
||||
]
|
||||
|
||||
|
||||
viewNotificationManage : UiSettings -> Model -> List (Html Msg)
|
||||
viewNotificationManage settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui bullhorn icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "Notification"
|
||||
]
|
||||
]
|
||||
, p []
|
||||
[ text """
|
||||
Docspell can notify you once the due dates of your items
|
||||
come closer. Notification is done via e-mail. You need to
|
||||
provide a connection in your e-mail settings."""
|
||||
]
|
||||
, p []
|
||||
[ text "Docspell finds all items that are due in "
|
||||
, em [] [ text "Remind Days" ]
|
||||
, text " days and sends this list via e-mail."
|
||||
]
|
||||
, Html.map NotificationMsg
|
||||
(Comp.NotificationManage.view settings model.notificationModel)
|
||||
]
|
||||
|
||||
|
||||
viewScanMailboxManage : UiSettings -> Model -> List (Html Msg)
|
||||
viewScanMailboxManage settings model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui envelope open outline icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "Scan Mailbox"
|
||||
]
|
||||
]
|
||||
, p []
|
||||
[ text "Docspell can scan folders of your mailbox to import your mails. "
|
||||
, text "You need to provide a connection in "
|
||||
, text "your e-mail (imap) settings."
|
||||
]
|
||||
, p []
|
||||
[ text """
|
||||
Docspell goes through all configured folders and imports
|
||||
mails matching the search criteria. Mails are skipped if
|
||||
they were imported in a previous run and the corresponding
|
||||
items still exist. After submitting a mail into docspell,
|
||||
you can choose to move it to another folder, to delete it
|
||||
or to just leave it there. In the latter case you should
|
||||
adjust the schedule to avoid reading over the same mails
|
||||
again."""
|
||||
]
|
||||
, Html.map ScanMailboxMsg
|
||||
(Comp.ScanMailboxManage.view
|
||||
settings
|
||||
model.scanMailboxModel
|
||||
)
|
||||
]
|
Reference in New Issue
Block a user