mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-02 09:05:08 +00:00
Allow the user to set time zone
Fix timezone handling for periodic tasks
This commit is contained in:
parent
6f7eafcebc
commit
9545431d59
@ -33,7 +33,7 @@ object EmptyTrashArgs {
|
|||||||
|
|
||||||
val taskName = Ident.unsafe("empty-trash")
|
val taskName = Ident.unsafe("empty-trash")
|
||||||
|
|
||||||
val defaultSchedule = CalEvent.unsafe("*-*-1/7 03:00:00")
|
val defaultSchedule = CalEvent.unsafe("*-*-1/7 03:00:00 UTC")
|
||||||
|
|
||||||
def periodicTaskId(coll: Ident): Ident =
|
def periodicTaskId(coll: Ident): Ident =
|
||||||
Ident.unsafe(s"docspell") / taskName / coll
|
Ident.unsafe(s"docspell") / taskName / coll
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
|
|
||||||
package docspell.common
|
package docspell.common
|
||||||
|
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.ZonedDateTime
|
|
||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
import java.time.{Instant, LocalDate, ZoneId}
|
import java.time.{Duration => _, _}
|
||||||
|
|
||||||
import cats.effect.Sync
|
import cats.effect.Sync
|
||||||
|
|
||||||
@ -57,7 +55,7 @@ case class Timestamp(value: Instant) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object Timestamp {
|
object Timestamp {
|
||||||
val UTC = ZoneId.of("UTC")
|
val UTC: ZoneId = ZoneOffset.UTC
|
||||||
|
|
||||||
val Epoch = Timestamp(Instant.EPOCH)
|
val Epoch = Timestamp(Instant.EPOCH)
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ docspell.joex {
|
|||||||
|
|
||||||
# When the house keeping tasks execute. Default is to run every
|
# When the house keeping tasks execute. Default is to run every
|
||||||
# week.
|
# week.
|
||||||
schedule = "Sun *-*-* 00:00:00"
|
schedule = "Sun *-*-* 00:00:00 UTC"
|
||||||
|
|
||||||
# This task removes invitation keys that have been created but not
|
# This task removes invitation keys that have been created but not
|
||||||
# used. The timespan here must be greater than the `invite-time'
|
# used. The timespan here must be greater than the `invite-time'
|
||||||
@ -209,8 +209,9 @@ docspell.joex {
|
|||||||
test-run = false
|
test-run = false
|
||||||
|
|
||||||
# When the update check should execute. Default is to run every
|
# When the update check should execute. Default is to run every
|
||||||
# week.
|
# week. You can specify a time zone identifier, like
|
||||||
schedule = "Sun *-*-* 00:00:00"
|
# 'Europe/Berlin' at the end.
|
||||||
|
schedule = "Sun *-*-* 00:00:00 UTC"
|
||||||
|
|
||||||
# An account id in form of `collective/user` (or just `user` if
|
# An account id in form of `collective/user` (or just `user` if
|
||||||
# collective and user name are the same). This user account must
|
# collective and user name are the same). This user account must
|
||||||
|
@ -566,7 +566,7 @@ updateCollSettings texts lmsg model =
|
|||||||
let
|
let
|
||||||
( lm, lc, ls ) =
|
( lm, lc, ls ) =
|
||||||
Page.CollectiveSettings.Update.update texts.collectiveSettings
|
Page.CollectiveSettings.Update.update texts.collectiveSettings
|
||||||
model.flags
|
(modelEnv model)
|
||||||
lmsg
|
lmsg
|
||||||
model.collSettingsModel
|
model.collSettingsModel
|
||||||
in
|
in
|
||||||
|
@ -18,6 +18,7 @@ import Api.Model.CalEventCheck exposing (CalEventCheck)
|
|||||||
import Api.Model.CalEventCheckResult exposing (CalEventCheckResult)
|
import Api.Model.CalEventCheckResult exposing (CalEventCheckResult)
|
||||||
import Data.CalEvent exposing (CalEvent)
|
import Data.CalEvent exposing (CalEvent)
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.Validated exposing (Validated(..))
|
import Data.Validated exposing (Validated(..))
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -109,8 +110,8 @@ isCheckError model =
|
|||||||
False
|
False
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Maybe CalEvent -> Msg -> Model -> ( Model, Cmd Msg, Maybe CalEvent )
|
update : Flags -> TimeZone -> Maybe CalEvent -> Msg -> Model -> ( Model, Cmd Msg, Maybe CalEvent )
|
||||||
update flags mev msg model =
|
update flags tz mev msg model =
|
||||||
let
|
let
|
||||||
ev =
|
ev =
|
||||||
Maybe.withDefault model.inner mev
|
Maybe.withDefault model.inner mev
|
||||||
@ -153,7 +154,7 @@ update flags mev msg model =
|
|||||||
( m
|
( m
|
||||||
, Cmd.none
|
, Cmd.none
|
||||||
, if res.success then
|
, if res.success then
|
||||||
Just event
|
Just { event | timeZone = tz }
|
||||||
|
|
||||||
else
|
else
|
||||||
Nothing
|
Nothing
|
||||||
|
@ -26,6 +26,7 @@ import Data.DropdownStyle as DS
|
|||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.ListType exposing (ListType)
|
import Data.ListType exposing (ListType)
|
||||||
import Data.TagOrder
|
import Data.TagOrder
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -111,8 +112,8 @@ getSettings model =
|
|||||||
model.schedule
|
model.schedule
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Cmd Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
GetTagsResp (Ok tl) ->
|
GetTagsResp (Ok tl) ->
|
||||||
let
|
let
|
||||||
@ -123,7 +124,7 @@ update flags msg model =
|
|||||||
lm =
|
lm =
|
||||||
Comp.Dropdown.SetOptions categories
|
Comp.Dropdown.SetOptions categories
|
||||||
in
|
in
|
||||||
update flags (CategoryListMsg lm) model
|
update flags tz (CategoryListMsg lm) model
|
||||||
|
|
||||||
GetTagsResp (Err _) ->
|
GetTagsResp (Err _) ->
|
||||||
( model, Cmd.none )
|
( model, Cmd.none )
|
||||||
@ -133,6 +134,7 @@ update flags msg model =
|
|||||||
( cm, cc, ce ) =
|
( cm, cc, ce ) =
|
||||||
Comp.CalEventInput.update
|
Comp.CalEventInput.update
|
||||||
flags
|
flags
|
||||||
|
tz
|
||||||
model.schedule
|
model.schedule
|
||||||
lmsg
|
lmsg
|
||||||
model.scheduleModel
|
model.scheduleModel
|
||||||
|
@ -26,6 +26,7 @@ import Comp.StringListInput
|
|||||||
import Data.DropdownStyle as DS
|
import Data.DropdownStyle as DS
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.Language exposing (Language)
|
import Data.Language exposing (Language)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -143,8 +144,8 @@ type Msg
|
|||||||
| PasswordMsg Comp.StringListInput.Msg
|
| PasswordMsg Comp.StringListInput.Msg
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Maybe CollectiveSettings )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Cmd Msg, Maybe CollectiveSettings )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
LangDropdownMsg m ->
|
LangDropdownMsg m ->
|
||||||
let
|
let
|
||||||
@ -207,7 +208,7 @@ update flags msg model =
|
|||||||
ClassifierSettingMsg lmsg ->
|
ClassifierSettingMsg lmsg ->
|
||||||
let
|
let
|
||||||
( cm, cc ) =
|
( cm, cc ) =
|
||||||
Comp.ClassifierSettingsForm.update flags lmsg model.classifierModel
|
Comp.ClassifierSettingsForm.update flags tz lmsg model.classifierModel
|
||||||
in
|
in
|
||||||
( { model
|
( { model
|
||||||
| classifierModel = cm
|
| classifierModel = cm
|
||||||
@ -219,7 +220,7 @@ update flags msg model =
|
|||||||
EmptyTrashMsg lmsg ->
|
EmptyTrashMsg lmsg ->
|
||||||
let
|
let
|
||||||
( cm, cc ) =
|
( cm, cc ) =
|
||||||
Comp.EmptyTrashForm.update flags lmsg model.emptyTrashModel
|
Comp.EmptyTrashForm.update flags tz lmsg model.emptyTrashModel
|
||||||
in
|
in
|
||||||
( { model
|
( { model
|
||||||
| emptyTrashModel = cm
|
| emptyTrashModel = cm
|
||||||
|
@ -29,6 +29,7 @@ import Data.CalEvent exposing (CalEvent)
|
|||||||
import Data.DropdownStyle as DS
|
import Data.DropdownStyle as DS
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.TagOrder
|
import Data.TagOrder
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Data.Validated exposing (Validated(..))
|
import Data.Validated exposing (Validated(..))
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
@ -237,8 +238,8 @@ withValidSettings mkcmd model =
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Action, Cmd Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Action, Cmd Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
ChannelMsg lm ->
|
ChannelMsg lm ->
|
||||||
let
|
let
|
||||||
@ -254,6 +255,7 @@ update flags msg model =
|
|||||||
let
|
let
|
||||||
( cm, cc, cs ) =
|
( cm, cc, cs ) =
|
||||||
Comp.CalEventInput.update flags
|
Comp.CalEventInput.update flags
|
||||||
|
tz
|
||||||
model.schedule
|
model.schedule
|
||||||
lmsg
|
lmsg
|
||||||
model.scheduleModel
|
model.scheduleModel
|
||||||
|
@ -20,6 +20,7 @@ import Comp.DueItemsTaskForm
|
|||||||
import Comp.DueItemsTaskList
|
import Comp.DueItemsTaskList
|
||||||
import Comp.MenuBar as MB
|
import Comp.MenuBar as MB
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -81,8 +82,8 @@ init flags =
|
|||||||
--- Update
|
--- Update
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Cmd Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
GetDataResp (Ok items) ->
|
GetDataResp (Ok items) ->
|
||||||
( { model
|
( { model
|
||||||
@ -126,7 +127,7 @@ update flags msg model =
|
|||||||
Just dm ->
|
Just dm ->
|
||||||
let
|
let
|
||||||
( mm, action, mc ) =
|
( mm, action, mc ) =
|
||||||
Comp.DueItemsTaskForm.update flags lm dm
|
Comp.DueItemsTaskForm.update flags tz lm dm
|
||||||
|
|
||||||
( model_, cmd_ ) =
|
( model_, cmd_ ) =
|
||||||
case action of
|
case action of
|
||||||
|
@ -19,6 +19,7 @@ import Comp.CalEventInput
|
|||||||
import Comp.IntField
|
import Comp.IntField
|
||||||
import Data.CalEvent exposing (CalEvent)
|
import Data.CalEvent exposing (CalEvent)
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -81,14 +82,15 @@ getSettings model =
|
|||||||
model.minAgeDays
|
model.minAgeDays
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Cmd Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
ScheduleMsg lmsg ->
|
ScheduleMsg lmsg ->
|
||||||
let
|
let
|
||||||
( cm, cc, ce ) =
|
( cm, cc, ce ) =
|
||||||
Comp.CalEventInput.update
|
Comp.CalEventInput.update
|
||||||
flags
|
flags
|
||||||
|
tz
|
||||||
model.schedule
|
model.schedule
|
||||||
lmsg
|
lmsg
|
||||||
model.scheduleModel
|
model.scheduleModel
|
||||||
|
@ -25,6 +25,7 @@ import Comp.MenuBar as MB
|
|||||||
import Comp.PowerSearchInput
|
import Comp.PowerSearchInput
|
||||||
import Data.CalEvent exposing (CalEvent)
|
import Data.CalEvent exposing (CalEvent)
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Data.Validated exposing (Validated(..))
|
import Data.Validated exposing (Validated(..))
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
@ -254,13 +255,14 @@ withValidSettings mkcmd model =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> UpdateResult
|
update : Flags -> TimeZone -> Msg -> Model -> UpdateResult
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
CalEventMsg lmsg ->
|
CalEventMsg lmsg ->
|
||||||
let
|
let
|
||||||
( cm, cc, cs ) =
|
( cm, cc, cs ) =
|
||||||
Comp.CalEventInput.update flags
|
Comp.CalEventInput.update flags
|
||||||
|
tz
|
||||||
model.schedule
|
model.schedule
|
||||||
lmsg
|
lmsg
|
||||||
model.scheduleModel
|
model.scheduleModel
|
||||||
|
@ -20,6 +20,7 @@ import Comp.MenuBar as MB
|
|||||||
import Comp.PeriodicQueryTaskForm
|
import Comp.PeriodicQueryTaskForm
|
||||||
import Comp.PeriodicQueryTaskList
|
import Comp.PeriodicQueryTaskList
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -81,8 +82,8 @@ init flags =
|
|||||||
--- Update
|
--- Update
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
GetDataResp (Ok items) ->
|
GetDataResp (Ok items) ->
|
||||||
( { model
|
( { model
|
||||||
@ -130,7 +131,7 @@ update flags msg model =
|
|||||||
let
|
let
|
||||||
--( mm, action, mc ) =
|
--( mm, action, mc ) =
|
||||||
result =
|
result =
|
||||||
Comp.PeriodicQueryTaskForm.update flags lm dm
|
Comp.PeriodicQueryTaskForm.update flags tz lm dm
|
||||||
|
|
||||||
( model_, cmd_ ) =
|
( model_, cmd_ ) =
|
||||||
case result.action of
|
case result.action of
|
||||||
|
@ -40,6 +40,7 @@ import Data.Flags exposing (Flags)
|
|||||||
import Data.FolderOrder
|
import Data.FolderOrder
|
||||||
import Data.Language exposing (Language)
|
import Data.Language exposing (Language)
|
||||||
import Data.TagOrder
|
import Data.TagOrder
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Data.Validated exposing (Validated(..))
|
import Data.Validated exposing (Validated(..))
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
@ -183,7 +184,7 @@ initWith flags s =
|
|||||||
|> Maybe.withDefault []
|
|> Maybe.withDefault []
|
||||||
|
|
||||||
( nm, _, nc ) =
|
( nm, _, nc ) =
|
||||||
update flags (ConnMsg (Comp.Dropdown.SetSelection imap)) im
|
update flags Data.TimeZone.utc (ConnMsg (Comp.Dropdown.SetSelection imap)) im
|
||||||
|
|
||||||
newSchedule =
|
newSchedule =
|
||||||
Data.CalEvent.fromEvent s.schedule
|
Data.CalEvent.fromEvent s.schedule
|
||||||
@ -354,13 +355,14 @@ withValidSettings mkAction model =
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Action, Cmd Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Action, Cmd Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
CalEventMsg lmsg ->
|
CalEventMsg lmsg ->
|
||||||
let
|
let
|
||||||
( cm, cc, cs ) =
|
( cm, cc, cs ) =
|
||||||
Comp.CalEventInput.update flags
|
Comp.CalEventInput.update flags
|
||||||
|
tz
|
||||||
model.schedule
|
model.schedule
|
||||||
lmsg
|
lmsg
|
||||||
model.scheduleModel
|
model.scheduleModel
|
||||||
@ -585,8 +587,8 @@ update flags msg model =
|
|||||||
( a, NoAction, b )
|
( a, NoAction, b )
|
||||||
in
|
in
|
||||||
Util.Update.andThen1
|
Util.Update.andThen1
|
||||||
[ update flags (FolderDropdownMsg opts) >> removeAction
|
[ update flags tz (FolderDropdownMsg opts) >> removeAction
|
||||||
, update flags (FolderDropdownMsg (Comp.Dropdown.SetSelection sel)) >> removeAction
|
, update flags tz (FolderDropdownMsg (Comp.Dropdown.SetSelection sel)) >> removeAction
|
||||||
]
|
]
|
||||||
model_
|
model_
|
||||||
|> addNoAction
|
|> addNoAction
|
||||||
|
@ -21,6 +21,7 @@ import Comp.MenuBar as MB
|
|||||||
import Comp.ScanMailboxForm
|
import Comp.ScanMailboxForm
|
||||||
import Comp.ScanMailboxList
|
import Comp.ScanMailboxList
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -82,8 +83,8 @@ init flags =
|
|||||||
--- Update
|
--- Update
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
update : Flags -> TimeZone -> Msg -> Model -> ( Model, Cmd Msg )
|
||||||
update flags msg model =
|
update flags tz msg model =
|
||||||
case msg of
|
case msg of
|
||||||
GetDataResp (Ok res) ->
|
GetDataResp (Ok res) ->
|
||||||
( { model
|
( { model
|
||||||
@ -127,7 +128,7 @@ update flags msg model =
|
|||||||
Just dm ->
|
Just dm ->
|
||||||
let
|
let
|
||||||
( mm, action, mc ) =
|
( mm, action, mc ) =
|
||||||
Comp.ScanMailboxForm.update flags lm dm
|
Comp.ScanMailboxForm.update flags tz lm dm
|
||||||
|
|
||||||
( model_, cmd_ ) =
|
( model_, cmd_ ) =
|
||||||
case action of
|
case action of
|
||||||
|
@ -19,6 +19,7 @@ import Api
|
|||||||
import Api.Model.TagList exposing (TagList)
|
import Api.Model.TagList exposing (TagList)
|
||||||
import Comp.BasicSizeField
|
import Comp.BasicSizeField
|
||||||
import Comp.ColorTagger
|
import Comp.ColorTagger
|
||||||
|
import Comp.Dropdown
|
||||||
import Comp.FieldListSelect
|
import Comp.FieldListSelect
|
||||||
import Comp.FixedDropdown
|
import Comp.FixedDropdown
|
||||||
import Comp.IntField
|
import Comp.IntField
|
||||||
@ -32,7 +33,7 @@ import Data.Flags exposing (Flags)
|
|||||||
import Data.ItemTemplate as IT exposing (ItemTemplate)
|
import Data.ItemTemplate as IT exposing (ItemTemplate)
|
||||||
import Data.Pdf exposing (PdfMode)
|
import Data.Pdf exposing (PdfMode)
|
||||||
import Data.TagOrder
|
import Data.TagOrder
|
||||||
import Data.TimeZone
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Data.UiSettings exposing (ItemPattern, StoredUiSettings, UiSettings)
|
import Data.UiSettings exposing (ItemPattern, StoredUiSettings, UiSettings)
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
@ -75,6 +76,7 @@ type alias Model =
|
|||||||
, powerSearchEnabled : Bool
|
, powerSearchEnabled : Bool
|
||||||
, uiLangModel : Comp.FixedDropdown.Model UiLanguage
|
, uiLangModel : Comp.FixedDropdown.Model UiLanguage
|
||||||
, uiLang : UiLanguage
|
, uiLang : UiLanguage
|
||||||
|
, timezoneDropdown : Comp.Dropdown.Model String
|
||||||
, openTabs : Set String
|
, openTabs : Set String
|
||||||
, defaults : UiSettings
|
, defaults : UiSettings
|
||||||
}
|
}
|
||||||
@ -170,6 +172,11 @@ initModel flags storedSettings defaults =
|
|||||||
, uiLang = settings.uiLang
|
, uiLang = settings.uiLang
|
||||||
, uiLangModel =
|
, uiLangModel =
|
||||||
Comp.FixedDropdown.init Messages.UiLanguage.all
|
Comp.FixedDropdown.init Messages.UiLanguage.all
|
||||||
|
, timezoneDropdown =
|
||||||
|
Comp.Dropdown.makeSingleList
|
||||||
|
{ options = Data.TimeZone.listAll
|
||||||
|
, selected = Just (Data.TimeZone.toName settings.timeZone)
|
||||||
|
}
|
||||||
, openTabs = Set.empty
|
, openTabs = Set.empty
|
||||||
, defaults = defaults
|
, defaults = defaults
|
||||||
}
|
}
|
||||||
@ -209,6 +216,7 @@ type Msg
|
|||||||
| TogglePowerSearch
|
| TogglePowerSearch
|
||||||
| UiLangMsg (Comp.FixedDropdown.Msg UiLanguage)
|
| UiLangMsg (Comp.FixedDropdown.Msg UiLanguage)
|
||||||
| PdfModeMsg (Comp.FixedDropdown.Msg PdfMode)
|
| PdfModeMsg (Comp.FixedDropdown.Msg PdfMode)
|
||||||
|
| TimeZoneMsg (Comp.Dropdown.Msg String)
|
||||||
| ToggleAllTabs
|
| ToggleAllTabs
|
||||||
| ResetTab AkkordionTab
|
| ResetTab AkkordionTab
|
||||||
|
|
||||||
@ -599,6 +607,27 @@ update flags sett msg model =
|
|||||||
in
|
in
|
||||||
( { nm | openTabs = model.openTabs }, Just newSettings )
|
( { nm | openTabs = model.openTabs }, Just newSettings )
|
||||||
|
|
||||||
|
TimeZoneMsg lm ->
|
||||||
|
let
|
||||||
|
( tm, tcmd ) =
|
||||||
|
Comp.Dropdown.update lm model.timezoneDropdown
|
||||||
|
|
||||||
|
tz =
|
||||||
|
if Comp.Dropdown.isDropdownChangeMsg lm then
|
||||||
|
Comp.Dropdown.getSelected tm |> List.head
|
||||||
|
|
||||||
|
else
|
||||||
|
sett.timeZone
|
||||||
|
|
||||||
|
newSett =
|
||||||
|
if sett.timeZone == tz then
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
else
|
||||||
|
Just { sett | timeZone = tz }
|
||||||
|
in
|
||||||
|
( { model | timezoneDropdown = tm }, newSett )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- View2
|
--- View2
|
||||||
@ -670,6 +699,9 @@ settingFormTabs texts flags _ model =
|
|||||||
[ i [ class "fa fa-eraser mr-1" ] []
|
[ i [ class "fa fa-eraser mr-1" ] []
|
||||||
, text texts.resetLabel
|
, text texts.resetLabel
|
||||||
]
|
]
|
||||||
|
|
||||||
|
uiSettings =
|
||||||
|
Data.UiSettings.defaults
|
||||||
in
|
in
|
||||||
[ { name = akkordionTabName GeneralTab
|
[ { name = akkordionTabName GeneralTab
|
||||||
, title = texts.general
|
, title = texts.general
|
||||||
@ -695,6 +727,22 @@ settingFormTabs texts flags _ model =
|
|||||||
model.uiLangModel
|
model.uiLangModel
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
, div [ class "mb-4" ]
|
||||||
|
[ label [ class S.inputLabel ] [ text "Timezone" ]
|
||||||
|
, Html.map TimeZoneMsg
|
||||||
|
(Comp.Dropdown.view2
|
||||||
|
{ makeOption = \s -> { text = s, additional = "" }
|
||||||
|
, placeholder = ""
|
||||||
|
, labelColor = \_ -> \_ -> ""
|
||||||
|
, style = DS.mainStyle
|
||||||
|
}
|
||||||
|
uiSettings
|
||||||
|
model.timezoneDropdown
|
||||||
|
)
|
||||||
|
, span [ class "opacity-75 text-sm" ]
|
||||||
|
[ text "Used to format date-time values."
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
, { name = akkordionTabName SearchTab
|
, { name = akkordionTabName SearchTab
|
||||||
|
@ -12,6 +12,7 @@ module Data.CalEvent exposing
|
|||||||
, makeEvent
|
, makeEvent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
import Data.TimeZone exposing (TimeZone)
|
||||||
import Util.Maybe
|
import Util.Maybe
|
||||||
|
|
||||||
|
|
||||||
@ -22,12 +23,13 @@ type alias CalEvent =
|
|||||||
, day : String
|
, day : String
|
||||||
, hour : String
|
, hour : String
|
||||||
, minute : String
|
, minute : String
|
||||||
|
, timeZone : TimeZone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
everyMonth : CalEvent
|
everyMonth : CalEvent
|
||||||
everyMonth =
|
everyMonth =
|
||||||
CalEvent Nothing "*" "*" "01" "00" "00"
|
CalEvent Nothing "*" "*" "01" "00" "00" Data.TimeZone.utc
|
||||||
|
|
||||||
|
|
||||||
makeEvent : CalEvent -> String
|
makeEvent : CalEvent -> String
|
||||||
@ -43,6 +45,8 @@ makeEvent ev =
|
|||||||
++ ev.hour
|
++ ev.hour
|
||||||
++ ":"
|
++ ":"
|
||||||
++ ev.minute
|
++ ev.minute
|
||||||
|
++ " "
|
||||||
|
++ Data.TimeZone.toName ev.timeZone
|
||||||
in
|
in
|
||||||
case ev.weekday of
|
case ev.weekday of
|
||||||
Just wd ->
|
Just wd ->
|
||||||
@ -60,18 +64,40 @@ fromEvent str =
|
|||||||
|
|
||||||
parts =
|
parts =
|
||||||
String.split " " str
|
String.split " " str
|
||||||
|
|
||||||
|
foldChanges : List (CalEvent -> Maybe CalEvent) -> Maybe CalEvent
|
||||||
|
foldChanges list =
|
||||||
|
List.foldl (\fmc -> \c -> Maybe.andThen fmc c) (Just init) list
|
||||||
in
|
in
|
||||||
case parts of
|
case parts of
|
||||||
wd :: date :: time :: [] ->
|
wd :: date :: time :: tz :: [] ->
|
||||||
Maybe.andThen
|
foldChanges
|
||||||
(fromDate date)
|
[ fromWeekDays wd
|
||||||
(fromTime time init)
|
, fromDate date
|
||||||
|> Maybe.map (withWeekday wd)
|
, fromTime time
|
||||||
|
, fromTimeZone tz
|
||||||
|
]
|
||||||
|
|
||||||
|
a :: b :: c :: [] ->
|
||||||
|
if startsWithWeekday a then
|
||||||
|
foldChanges
|
||||||
|
[ fromWeekDays a
|
||||||
|
, fromDate b
|
||||||
|
, fromTime c
|
||||||
|
]
|
||||||
|
|
||||||
|
else
|
||||||
|
foldChanges
|
||||||
|
[ fromDate a
|
||||||
|
, fromTime b
|
||||||
|
, fromTimeZone c
|
||||||
|
]
|
||||||
|
|
||||||
date :: time :: [] ->
|
date :: time :: [] ->
|
||||||
Maybe.andThen
|
foldChanges
|
||||||
(fromDate date)
|
[ fromDate date
|
||||||
(fromTime time init)
|
, fromTime time
|
||||||
|
]
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
Nothing
|
Nothing
|
||||||
@ -109,6 +135,31 @@ fromTime time ev =
|
|||||||
Nothing
|
Nothing
|
||||||
|
|
||||||
|
|
||||||
|
fromTimeZone : String -> CalEvent -> Maybe CalEvent
|
||||||
|
fromTimeZone tzStr ev =
|
||||||
|
Data.TimeZone.get tzStr
|
||||||
|
|> Maybe.map (\tz -> { ev | timeZone = tz })
|
||||||
|
|
||||||
|
|
||||||
|
fromWeekDays : String -> CalEvent -> Maybe CalEvent
|
||||||
|
fromWeekDays str ce =
|
||||||
|
if startsWithWeekday str then
|
||||||
|
Just (withWeekday str ce)
|
||||||
|
|
||||||
|
else
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
|
||||||
withWeekday : String -> CalEvent -> CalEvent
|
withWeekday : String -> CalEvent -> CalEvent
|
||||||
withWeekday wd ev =
|
withWeekday wd ev =
|
||||||
{ ev | weekday = Util.Maybe.fromString wd }
|
{ ev | weekday = Util.Maybe.fromString wd }
|
||||||
|
|
||||||
|
|
||||||
|
weekDays : List String
|
||||||
|
weekDays =
|
||||||
|
[ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ]
|
||||||
|
|
||||||
|
|
||||||
|
startsWithWeekday : String -> Bool
|
||||||
|
startsWithWeekday str =
|
||||||
|
List.any (\a -> String.startsWith a str) weekDays
|
||||||
|
@ -12,13 +12,14 @@ import Comp.CollectiveSettingsForm
|
|||||||
import Comp.ShareManage
|
import Comp.ShareManage
|
||||||
import Comp.SourceManage
|
import Comp.SourceManage
|
||||||
import Comp.UserManage
|
import Comp.UserManage
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Environment as Env
|
||||||
|
import Data.Flags
|
||||||
import Messages.Page.CollectiveSettings exposing (Texts)
|
import Messages.Page.CollectiveSettings exposing (Texts)
|
||||||
import Page.CollectiveSettings.Data exposing (..)
|
import Page.CollectiveSettings.Data exposing (..)
|
||||||
|
|
||||||
|
|
||||||
update : Texts -> Flags -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
update : Texts -> Env.Update -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||||
update texts flags msg model =
|
update texts env msg model =
|
||||||
case msg of
|
case msg of
|
||||||
SetTab t ->
|
SetTab t ->
|
||||||
let
|
let
|
||||||
@ -27,45 +28,45 @@ update texts flags msg model =
|
|||||||
in
|
in
|
||||||
case t of
|
case t of
|
||||||
SourceTab ->
|
SourceTab ->
|
||||||
update texts flags (SourceMsg Comp.SourceManage.LoadSources) m
|
update texts env (SourceMsg Comp.SourceManage.LoadSources) m
|
||||||
|
|
||||||
UserTab ->
|
UserTab ->
|
||||||
update texts flags (UserMsg Comp.UserManage.LoadUsers) m
|
update texts env (UserMsg Comp.UserManage.LoadUsers) m
|
||||||
|
|
||||||
InsightsTab ->
|
InsightsTab ->
|
||||||
update texts flags Init m
|
update texts env Init m
|
||||||
|
|
||||||
SettingsTab ->
|
SettingsTab ->
|
||||||
update texts flags Init m
|
update texts env Init m
|
||||||
|
|
||||||
ShareTab ->
|
ShareTab ->
|
||||||
update texts flags (ShareMsg Comp.ShareManage.loadShares) m
|
update texts env (ShareMsg Comp.ShareManage.loadShares) m
|
||||||
|
|
||||||
SourceMsg m ->
|
SourceMsg m ->
|
||||||
let
|
let
|
||||||
( m2, c2 ) =
|
( m2, c2 ) =
|
||||||
Comp.SourceManage.update flags m model.sourceModel
|
Comp.SourceManage.update env.flags m model.sourceModel
|
||||||
in
|
in
|
||||||
( { model | sourceModel = m2 }, Cmd.map SourceMsg c2, Sub.none )
|
( { model | sourceModel = m2 }, Cmd.map SourceMsg c2, Sub.none )
|
||||||
|
|
||||||
ShareMsg lm ->
|
ShareMsg lm ->
|
||||||
let
|
let
|
||||||
( sm, sc, ss ) =
|
( sm, sc, ss ) =
|
||||||
Comp.ShareManage.update texts.shareManage flags lm model.shareModel
|
Comp.ShareManage.update texts.shareManage env.flags lm model.shareModel
|
||||||
in
|
in
|
||||||
( { model | shareModel = sm }, Cmd.map ShareMsg sc, Sub.map ShareMsg ss )
|
( { model | shareModel = sm }, Cmd.map ShareMsg sc, Sub.map ShareMsg ss )
|
||||||
|
|
||||||
UserMsg m ->
|
UserMsg m ->
|
||||||
let
|
let
|
||||||
( m2, c2 ) =
|
( m2, c2 ) =
|
||||||
Comp.UserManage.update flags m model.userModel
|
Comp.UserManage.update env.flags m model.userModel
|
||||||
in
|
in
|
||||||
( { model | userModel = m2 }, Cmd.map UserMsg c2, Sub.none )
|
( { model | userModel = m2 }, Cmd.map UserMsg c2, Sub.none )
|
||||||
|
|
||||||
SettingsFormMsg m ->
|
SettingsFormMsg m ->
|
||||||
let
|
let
|
||||||
( m2, c2, msett ) =
|
( m2, c2, msett ) =
|
||||||
Comp.CollectiveSettingsForm.update flags m model.settingsModel
|
Comp.CollectiveSettingsForm.update env.flags env.settings.timeZone m model.settingsModel
|
||||||
|
|
||||||
cmd =
|
cmd =
|
||||||
case msett of
|
case msett of
|
||||||
@ -73,7 +74,7 @@ update texts flags msg model =
|
|||||||
Cmd.none
|
Cmd.none
|
||||||
|
|
||||||
Just sett ->
|
Just sett ->
|
||||||
Api.setCollectiveSettings flags sett SubmitResp
|
Api.setCollectiveSettings env.flags sett SubmitResp
|
||||||
in
|
in
|
||||||
( { model | settingsModel = m2, formState = InitialState }
|
( { model | settingsModel = m2, formState = InitialState }
|
||||||
, Cmd.batch [ cmd, Cmd.map SettingsFormMsg c2 ]
|
, Cmd.batch [ cmd, Cmd.map SettingsFormMsg c2 ]
|
||||||
@ -83,8 +84,8 @@ update texts flags msg model =
|
|||||||
Init ->
|
Init ->
|
||||||
( { model | formState = InitialState }
|
( { model | formState = InitialState }
|
||||||
, Cmd.batch
|
, Cmd.batch
|
||||||
[ Api.getInsights flags GetInsightsResp
|
[ Api.getInsights env.flags GetInsightsResp
|
||||||
, Api.getCollectiveSettings flags CollectiveSettingsResp
|
, Api.getCollectiveSettings env.flags CollectiveSettingsResp
|
||||||
]
|
]
|
||||||
, Sub.none
|
, Sub.none
|
||||||
)
|
)
|
||||||
@ -98,7 +99,7 @@ update texts flags msg model =
|
|||||||
CollectiveSettingsResp (Ok data) ->
|
CollectiveSettingsResp (Ok data) ->
|
||||||
let
|
let
|
||||||
( cm, cc ) =
|
( cm, cc ) =
|
||||||
Comp.CollectiveSettingsForm.init flags data
|
Comp.CollectiveSettingsForm.init env.flags data
|
||||||
in
|
in
|
||||||
( { model | settingsModel = cm }
|
( { model | settingsModel = cm }
|
||||||
, Cmd.map SettingsFormMsg cc
|
, Cmd.map SettingsFormMsg cc
|
||||||
|
@ -270,7 +270,7 @@ update texts settings navKey flags msg model =
|
|||||||
PeriodicQuery pqm ->
|
PeriodicQuery pqm ->
|
||||||
let
|
let
|
||||||
( pqm_, pqc, pqs ) =
|
( pqm_, pqc, pqs ) =
|
||||||
Comp.PeriodicQueryTaskManage.update flags lm pqm
|
Comp.PeriodicQueryTaskManage.update flags settings.timeZone lm pqm
|
||||||
in
|
in
|
||||||
( { model | content = PeriodicQuery pqm_ }
|
( { model | content = PeriodicQuery pqm_ }
|
||||||
, Cmd.map PeriodicQueryMsg pqc
|
, Cmd.map PeriodicQueryMsg pqc
|
||||||
|
@ -161,7 +161,7 @@ update flags settings msg model =
|
|||||||
NotificationMsg lm ->
|
NotificationMsg lm ->
|
||||||
let
|
let
|
||||||
( m2, c2 ) =
|
( m2, c2 ) =
|
||||||
Comp.DueItemsTaskManage.update flags lm model.notificationModel
|
Comp.DueItemsTaskManage.update flags settings.timeZone lm model.notificationModel
|
||||||
in
|
in
|
||||||
{ model = { model | notificationModel = m2 }
|
{ model = { model | notificationModel = m2 }
|
||||||
, cmd = Cmd.map NotificationMsg c2
|
, cmd = Cmd.map NotificationMsg c2
|
||||||
@ -172,7 +172,7 @@ update flags settings msg model =
|
|||||||
ScanMailboxMsg lm ->
|
ScanMailboxMsg lm ->
|
||||||
let
|
let
|
||||||
( m2, c2 ) =
|
( m2, c2 ) =
|
||||||
Comp.ScanMailboxManage.update flags lm model.scanMailboxModel
|
Comp.ScanMailboxManage.update flags settings.timeZone lm model.scanMailboxModel
|
||||||
in
|
in
|
||||||
{ model = { model | scanMailboxModel = m2 }
|
{ model = { model | scanMailboxModel = m2 }
|
||||||
, cmd = Cmd.map ScanMailboxMsg c2
|
, cmd = Cmd.map ScanMailboxMsg c2
|
||||||
@ -227,7 +227,7 @@ update flags settings msg model =
|
|||||||
PeriodicQueryMsg lm ->
|
PeriodicQueryMsg lm ->
|
||||||
let
|
let
|
||||||
( pqm, pqc, pqs ) =
|
( pqm, pqc, pqs ) =
|
||||||
Comp.PeriodicQueryTaskManage.update flags lm model.periodicQueryModel
|
Comp.PeriodicQueryTaskManage.update flags settings.timeZone lm model.periodicQueryModel
|
||||||
in
|
in
|
||||||
{ model = { model | periodicQueryModel = pqm }
|
{ model = { model | periodicQueryModel = pqm }
|
||||||
, cmd = Cmd.map PeriodicQueryMsg pqc
|
, cmd = Cmd.map PeriodicQueryMsg pqc
|
||||||
|
@ -48,7 +48,7 @@ let
|
|||||||
wakeup-period = "10 minutes";
|
wakeup-period = "10 minutes";
|
||||||
};
|
};
|
||||||
house-keeping = {
|
house-keeping = {
|
||||||
schedule = "Sun *-*-* 00:00:00";
|
schedule = "Sun *-*-* 00:00:00 UTC";
|
||||||
cleanup-invites = {
|
cleanup-invites = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
older-than = "30 days";
|
older-than = "30 days";
|
||||||
@ -70,7 +70,7 @@ let
|
|||||||
update-check = {
|
update-check = {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
test-run = false;
|
test-run = false;
|
||||||
schedule = "Sun *-*-* 00:00:00";
|
schedule = "Sun *-*-* 00:00:00 UTC";
|
||||||
sender-account = "";
|
sender-account = "";
|
||||||
smtp-id = "";
|
smtp-id = "";
|
||||||
recipients = [];
|
recipients = [];
|
||||||
|
@ -114,7 +114,7 @@ docspell.joex {
|
|||||||
retry-delay = "10 seconds"
|
retry-delay = "10 seconds"
|
||||||
}
|
}
|
||||||
house-keeping {
|
house-keeping {
|
||||||
schedule = "*-*-* 01:00:00"
|
schedule = "*-*-* 01:00:00 UTC"
|
||||||
cleanup-invites = {
|
cleanup-invites = {
|
||||||
older-than = "10 days"
|
older-than = "10 days"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user