diff --git a/src/Pages/Script/Spinner.elm b/src/Pages/Script/Spinner.elm index 7f1db4992..ca014e7b6 100644 --- a/src/Pages/Script/Spinner.elm +++ b/src/Pages/Script/Spinner.elm @@ -1,4 +1,4 @@ -module Pages.Script.Spinner exposing (CompletionIcon(..), Options, Spinner, encodeCompletionIcon, options, runSteps, runTask, runTaskExisting, runTaskWithOptions, showStep, spinner, start, steps, withImmediateStart, withNamedAnimation, withOnCompletion, withStep) +module Pages.Script.Spinner exposing (CompletionIcon(..), Options, Spinner, encodeCompletionIcon, options, runSteps, runTask, runTaskExisting, runTaskWithOptions, showStep, spinner, start, steps, withImmediateStart, withNamedAnimation, withOnCompletion, withStep, withStepWithOptions) import BackendTask exposing (BackendTask) import BackendTask.Http @@ -308,6 +308,23 @@ withStep text backendTask steps_ = ) +withStepWithOptions : Options FatalError newValue -> (oldValue -> BackendTask FatalError newValue) -> Steps FatalError oldValue -> Steps FatalError newValue +withStepWithOptions options_ backendTask steps_ = + case steps_ of + Steps previousSteps -> + Steps + (BackendTask.map2 + (\pipelineValue newSpinner -> + runTaskExisting + newSpinner + (backendTask pipelineValue) + ) + previousSteps + (showStep options_) + |> BackendTask.andThen identity + ) + + runSteps : Steps FatalError value -> BackendTask FatalError value runSteps (Steps steps_) = steps_