on master help sign in
Keep selected category when updating ciphers (#32)
commit40dfa7d7d3d7b250c2ad2e7d0006ab58225a3307 authoriko <ilyakooo0@gmail.com> dateMon 21 Nov 2022, 16:24 (4 years ago) parentc707f22
2 files changed+20−7
frontend/Main.elm+3−6 frontend/Pages/Ciphers.elm+17−1
frontend/Main.elm+3−6
@@ -432,9 +432,6 @@ update msg model =
432432 _ ->
433433 False
434434 )
435−
436− pageModel =
437− Ciphers.init ciphersCallbacks ciphers
438435 in
439436 ( if ciphersShown then
440437 { model
@@ -443,8 +440,8 @@ update msg model =
443440 |> Nonempty.map
444441 (\x ->
445442 case x of
446− CiphersModel _ ->
447− CiphersModel pageModel
443+ CiphersModel pageModel ->
444+ CiphersModel (Ciphers.updateCiphers ciphers pageModel)
448445
449446 other ->
450447 other
@@ -452,7 +449,7 @@ update msg model =
452449 }
453450
454451 else
455− appendPageStack <| CiphersModel pageModel
452+ appendPageStack <| CiphersModel (Ciphers.init ciphersCallbacks ciphers)
456453 , Cmd.none
457454 )
458455
frontend/Pages/Ciphers.elm+17−1
@@ -1,4 +1,15 @@
1−module Pages.Ciphers exposing (Callbacks, Model, Msg, event, init, menuConfig, title, update, view)
1+module Pages.Ciphers exposing
2+ ( Callbacks
3+ , Model
4+ , Msg
5+ , event
6+ , init
7+ , menuConfig
8+ , title
9+ , update
10+ , updateCiphers
11+ , view
12+ )
213
314import Bridge
415import GlobalEvents
@@ -26,6 +37,11 @@ type alias Model emsg =
2637 }
2738
2839
40+updateCiphers : Bridge.Sub_LoadCiphers_List -> Model emsg -> Model emsg
41+updateCiphers ciphers model =
42+ { model | ciphers = ciphers }
43+
44+
2945type CiphersFilter
3046 = AllCiphers
3147 | SpecificCiphers Bridge.CipherType