github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/src/NotFound/NotFound.elm (about)

     1  module NotFound.NotFound exposing
     2      ( documentTitle
     3      , handleDelivery
     4      , init
     5      , subscriptions
     6      , tooltip
     7      , view
     8      )
     9  
    10  import Application.Models exposing (Session)
    11  import EffectTransformer exposing (ET)
    12  import Html exposing (Html)
    13  import Html.Attributes exposing (class, href, id, src)
    14  import Login.Login as Login
    15  import Message.Effects exposing (Effect(..))
    16  import Message.Message exposing (Message(..))
    17  import Message.Subscription
    18      exposing
    19          ( Delivery(..)
    20          , Interval(..)
    21          , Subscription(..)
    22          )
    23  import Message.TopLevelMessage exposing (TopLevelMessage(..))
    24  import NotFound.Model exposing (Model)
    25  import Routes
    26  import SideBar.SideBar as SideBar
    27  import Tooltip
    28  import Views.Styles
    29  import Views.TopBar as TopBar
    30  
    31  
    32  type alias Flags =
    33      { route : Routes.Route
    34      , notFoundImgSrc : String
    35      }
    36  
    37  
    38  init : Flags -> ( Model, List Effect )
    39  init flags =
    40      ( { notFoundImgSrc = flags.notFoundImgSrc
    41        , route = flags.route
    42        , isUserMenuExpanded = False
    43        }
    44      , []
    45      )
    46  
    47  
    48  documentTitle : String
    49  documentTitle =
    50      "Not Found"
    51  
    52  
    53  view : Session -> Model -> Html Message
    54  view session model =
    55      Html.div
    56          (id "page-including-top-bar" :: Views.Styles.pageIncludingTopBar)
    57          [ Html.div
    58              (id "top-bar-app" :: Views.Styles.topBar False)
    59              [ SideBar.hamburgerMenu session
    60              , TopBar.concourseLogo
    61              , TopBar.breadcrumbs model.route
    62              , Login.view session.userState model
    63              ]
    64          , Html.div
    65              (id "page-below-top-bar" :: Views.Styles.pageBelowTopBar model.route)
    66              [ SideBar.view session Nothing
    67              , Html.div [ class "notfound" ]
    68                  [ Html.div [ class "title" ] [ Html.text "404" ]
    69                  , Html.div [ class "reason" ] [ Html.text "this page was not found" ]
    70                  , Html.img [ src model.notFoundImgSrc ] []
    71                  , Html.div [ class "help-message" ]
    72                      [ Html.text "Not to worry, you can head"
    73                      , Html.br [] []
    74                      , Html.text "back to the "
    75                      , Html.a [ href "/" ] [ Html.text "home page" ]
    76                      ]
    77                  ]
    78              ]
    79          ]
    80  
    81  
    82  tooltip : Model -> a -> Maybe Tooltip.Tooltip
    83  tooltip _ _ =
    84      Nothing
    85  
    86  
    87  subscriptions : List Subscription
    88  subscriptions =
    89      [ OnClockTick FiveSeconds ]
    90  
    91  
    92  handleDelivery : Delivery -> ET Model
    93  handleDelivery delivery ( model, effects ) =
    94      case delivery of
    95          ClockTicked FiveSeconds _ ->
    96              ( model, effects ++ [ FetchAllPipelines ] )
    97  
    98          _ ->
    99              ( model, effects )