mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 10:29:34 +00:00
Refresh home page on item-process event
This commit is contained in:
parent
3e58d97f72
commit
42767e7732
@ -15,6 +15,7 @@ import App.Data exposing (..)
|
||||
import Browser exposing (UrlRequest(..))
|
||||
import Browser.Navigation as Nav
|
||||
import Data.Flags
|
||||
import Data.ServerEvent exposing (ServerEvent(..))
|
||||
import Data.UiSettings exposing (UiSettings)
|
||||
import Data.UiTheme
|
||||
import Messages exposing (Messages)
|
||||
@ -310,10 +311,20 @@ updateWithSub msg model =
|
||||
|
||||
ReceiveWsMessage data ->
|
||||
let
|
||||
_ =
|
||||
Debug.log "WS-msg" data
|
||||
se =
|
||||
Data.ServerEvent.fromString data
|
||||
in
|
||||
( model, Cmd.none, Sub.none )
|
||||
case se of
|
||||
Just ItemProcessed ->
|
||||
case model.page of
|
||||
HomePage ->
|
||||
updateHome texts Page.Home.Data.RefreshView model
|
||||
|
||||
_ ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
Nothing ->
|
||||
( model, Cmd.none, Sub.none )
|
||||
|
||||
|
||||
applyClientSettings : Messages -> Model -> UiSettings -> ( Model, Cmd Msg, Sub Msg )
|
||||
|
22
modules/webapp/src/main/elm/Data/ServerEvent.elm
Normal file
22
modules/webapp/src/main/elm/Data/ServerEvent.elm
Normal file
@ -0,0 +1,22 @@
|
||||
{-
|
||||
Copyright 2020 Eike K. & Contributors
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-}
|
||||
|
||||
|
||||
module Data.ServerEvent exposing (ServerEvent(..), fromString)
|
||||
|
||||
|
||||
type ServerEvent
|
||||
= ItemProcessed
|
||||
|
||||
|
||||
fromString : String -> Maybe ServerEvent
|
||||
fromString str =
|
||||
case String.toLower str of
|
||||
"item-processed" ->
|
||||
Just ItemProcessed
|
||||
|
||||
_ ->
|
||||
Nothing
|
@ -229,6 +229,7 @@ type Msg
|
||||
| PublishItemsMsg Comp.PublishItems.Msg
|
||||
| TogglePublishCurrentQueryView
|
||||
| PublishViewMsg Comp.PublishItems.Msg
|
||||
| RefreshView
|
||||
|
||||
|
||||
type SearchType
|
||||
|
@ -227,6 +227,22 @@ update mId key flags texts settings msg model =
|
||||
else
|
||||
doSearch param nm
|
||||
|
||||
RefreshView ->
|
||||
let
|
||||
param =
|
||||
{ flags = flags
|
||||
, searchType = model.lastSearchType
|
||||
, pageSize = settings.itemSearchPageSize
|
||||
, offset = model.searchOffset
|
||||
, scroll = False
|
||||
}
|
||||
in
|
||||
if model.searchInProgress then
|
||||
withSub ( model, Cmd.none )
|
||||
|
||||
else
|
||||
doSearch param model
|
||||
|
||||
ToggleSearchMenu ->
|
||||
let
|
||||
nextView =
|
||||
|
Loading…
x
Reference in New Issue
Block a user