Refresh item after addon is done

This commit is contained in:
eikek
2022-05-18 00:23:46 +02:00
parent 5abbe92f2b
commit 29a5894884
15 changed files with 123 additions and 19 deletions

View File

@ -76,7 +76,7 @@ view texts model =
, a
[ class S.successMessageLink
, href "#"
, onClick ReloadItem
, onClick (ReloadItem False)
]
[ text texts.refreshNow
]

View File

@ -281,7 +281,7 @@ initSelectViewModel =
type Msg
= ToggleMenu
| ReloadItem
| ReloadItem Bool
| Init
| SetItem ItemDetail
| SetActiveAttachment Int

View File

@ -387,12 +387,22 @@ update inav env msg model =
resultModel
{ model | menuOpen = not model.menuOpen }
ReloadItem ->
ReloadItem withFile ->
if model.item.id == "" then
resultModel model
else
resultModelCmd ( model, Api.itemDetail env.flags model.item.id GetItemResp )
resultModelCmd
( model
, Cmd.batch
[ Api.itemDetail env.flags model.item.id GetItemResp
, if withFile then
Ports.refreshFileView "ds-pdf-view-iframe"
else
Cmd.none
]
)
FolderDropdownMsg m ->
let
@ -1002,7 +1012,7 @@ update inav env msg model =
DeleteAttachResp (Ok res) ->
if res.success then
update inav env ReloadItem model
update inav env (ReloadItem False) model
else
resultModel model