-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: build layout and build_ page
- Loading branch information
Showing
16 changed files
with
564 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{-- | ||
SPDX-License-Identifier: Apache-2.0 | ||
--} | ||
|
||
|
||
module Layouts.Default.Build exposing (Model, Msg, Props, layout, map) | ||
|
||
import Components.Tabs | ||
import Effect exposing (Effect) | ||
import Html exposing (..) | ||
import Layout exposing (Layout) | ||
import Layouts.Default | ||
import RemoteData exposing (WebData) | ||
import Route exposing (Route) | ||
import Shared | ||
import Vela | ||
import View exposing (View) | ||
|
||
|
||
type alias Props contentMsg = | ||
{ org : String | ||
, repo : String | ||
, buildNumber : String | ||
, build : WebData Vela.Build | ||
, nil : List contentMsg | ||
} | ||
|
||
|
||
map : (msg1 -> msg2) -> Props msg1 -> Props msg2 | ||
map fn props = | ||
{ org = props.org | ||
, repo = props.repo | ||
, buildNumber = props.buildNumber | ||
, build = props.build | ||
, nil = List.map fn props.nil | ||
} | ||
|
||
|
||
layout : Props contentMsg -> Shared.Model -> Route () -> Layout (Layouts.Default.Props contentMsg) Model Msg contentMsg | ||
layout props shared route = | ||
Layout.new | ||
{ init = init shared | ||
, update = update | ||
, view = view props shared route | ||
, subscriptions = subscriptions | ||
} | ||
|> Layout.withParentProps | ||
{ navButtons = [] | ||
, utilButtons = [] | ||
} | ||
|
||
|
||
|
||
-- MODEL | ||
|
||
|
||
type alias Model = | ||
{} | ||
|
||
|
||
init : Shared.Model -> () -> ( Model, Effect Msg ) | ||
init shared _ = | ||
( {} | ||
, Effect.none | ||
) | ||
|
||
|
||
|
||
-- UPDATE | ||
|
||
|
||
type Msg | ||
= NoOp | ||
|
||
|
||
update : Msg -> Model -> ( Model, Effect Msg ) | ||
update msg model = | ||
case msg of | ||
NoOp -> | ||
( model | ||
, Effect.none | ||
) | ||
|
||
|
||
subscriptions : Model -> Sub Msg | ||
subscriptions model = | ||
Sub.none | ||
|
||
|
||
|
||
-- VIEW | ||
|
||
|
||
view : Props contentMsg -> Shared.Model -> Route () -> { toContentMsg : Msg -> contentMsg, content : View contentMsg, model : Model } -> View contentMsg | ||
view props shared route { toContentMsg, model, content } = | ||
{ title = props.org ++ "/" ++ props.repo ++ " #" ++ props.buildNumber | ||
, body = | ||
[ Html.text "build:layout->" | ||
, case props.build of | ||
RemoteData.Success build -> | ||
Html.text (Vela.statusToString build.status) | ||
|
||
_ -> | ||
Html.text "Loading..." | ||
, Html.div [] content.body | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.