Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Jan 3, 2025
1 parent fd1c274 commit c8071a5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 46 deletions.
4 changes: 2 additions & 2 deletions src/elm/Pages/Org_/Repo_/Build_/Pipeline.elm
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ update shared route msg model =
case response of
Ok ( _, expandedPipeline ) ->
let
p =
basePipeline =
RemoteData.withDefault Vela.defaultPipelineConfig model.pipeline
in
( { model
| pipeline =
RemoteData.succeed
{ p
{ basePipeline
| rawData = ""
, decodedData = expandedPipeline
}
Expand Down
75 changes: 31 additions & 44 deletions src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,11 @@ type alias PipelineConfig =
}


defaultPipelineConfig : PipelineConfig
defaultPipelineConfig =
PipelineConfig "" "" "" "" "" "" False False False False False False [] "" "" Dict.empty


type alias Template =
{ link : String
, name : String
Expand All @@ -1144,27 +1149,6 @@ type alias Templates =
Dict String Template


defaultPipelineConfig : PipelineConfig
defaultPipelineConfig =
PipelineConfig
""
""
""
""
""
""
False
False
False
False
False
False
[]
""
""
Dict.empty


lineNumberWarningfromWarningString : String -> ( Maybe Int, String )
lineNumberWarningfromWarningString warning =
case String.split ":" warning of
Expand Down Expand Up @@ -1202,32 +1186,35 @@ decodePipelineConfig =
|> optional "warnings"
(Json.Decode.list string
|> Json.Decode.andThen
(\warnings ->
Json.Decode.succeed
(List.foldl
(\warning dict ->
case lineNumberWarningfromWarningString warning of
( Just line, w ) ->
Dict.update line
(\maybeWarnings ->
case maybeWarnings of
Just existingWarnings ->
Just (w :: existingWarnings)

Nothing ->
Just [ w ]
)
dict

_ ->
dict
)
Dict.empty
warnings
decodeAndCollapsePipelineWarnings
)
Dict.empty


decodeAndCollapsePipelineWarnings : List String -> Json.Decode.Decoder (Dict Int (List String))
decodeAndCollapsePipelineWarnings warnings =
Json.Decode.succeed
(List.foldl
(\warning dict ->
case lineNumberWarningfromWarningString warning of
( Just line, w ) ->
Dict.update line
(\maybeWarnings ->
case maybeWarnings of
Just existingWarnings ->
Just (w :: existingWarnings)

Nothing ->
Just [ w ]
)
)
dict

_ ->
dict
)
Dict.empty
warnings
)


decodePipelineExpand : Json.Decode.Decoder String
Expand Down

0 comments on commit c8071a5

Please sign in to comment.