add a "Push" button

This commit is contained in:
Christian Lawson-Perfect 2025-02-09 20:28:54 +00:00
parent cf50e05c16
commit d836b98a70
2 changed files with 32 additions and 6 deletions

View file

@ -134,6 +134,7 @@ type Msg
| SetCommitMessage String
| JJCommit
| JJCommitResponse (Result Http.Error CommandResult)
| JJPush
init : JE.Value -> (Model, Cmd Msg)
init flags = (load_flags flags, reload_log)
@ -301,6 +302,11 @@ update msg model = case msg of
Ok (Ok res) -> { model | log = MakeResult res.stdout res.stderr } |> nocmd
Ok (Err errmsg) -> { model | log = MakeError errmsg } |> nocmd
Err err -> { model | log = HttpError err } |> nocmd
JJPush ->
update
(RunCommand "jj bookmark set main -r @- && jj git push -b main --allow-new")
model
NoOp -> (model, Cmd.none)
@ -493,12 +499,21 @@ main_nav model =
]
else
H.text ""
, H.button
[ HA.id "start-commit-button"
, HA.type_ "button"
, HE.onClick ShowCommitModal
]
[ H.text "Commit" ]
, H.p
[ HA.id "jj-buttons" ]
[ H.button
[ HA.id "start-commit-button"
, HA.type_ "button"
, HE.onClick ShowCommitModal
]
[ H.text "Commit" ]
, H.button
[ HA.id "jj-push-button"
, HA.type_ "button"
, HE.onClick JJPush
]
[ H.text "Push" ]
]
]
]