Browse Source

Added links to source

master
Julien Marquet 3 years ago
parent
commit
6608bceeb5
  1. 1
      .gitignore
  2. 11
      src/ServicesTable.elm

1
.gitignore vendored

@ -1,3 +1,4 @@
.direnv
ssg/dist-newstyle
src/_cache
src/_site

11
src/ServicesTable.elm

@ -4,12 +4,14 @@ module ServicesTable exposing (main)
import List
import String exposing (fromInt)
import Browser
import Html exposing (Html, div, span, text, table, thead, tbody, tr, th, td)
import Html.Attributes exposing (class)
import Html exposing (Html, div, span, text, a, table, thead, tbody, tr, th, td)
import Html.Attributes exposing (class, href)
import Http
import Dict exposing (Dict)
import Json.Decode exposing (Decoder, map, map3, field, list, string, dict, keyValuePairs)
pinnedCommit = "2a5f9fcde65629554f39d683db02a98a6c054756"
type alias ServiceInfo =
{ fields : List String
, tests : List String
@ -98,9 +100,12 @@ renderTable info = table [ class "services-table", class "table-header-rotated"
[ thead [ class "info-thead" ] [ headers ]
, tbody [] (List.indexedMap renderLine info) ]
mkSourceLink : String -> Html Msg
mkSourceLink mod = a [ href <| "https://github.com/NixOS/nixpkgs/blob/" ++ pinnedCommit ++ String.dropLeft 7 mod ] [ text mod ]
renderLine : Int -> { name : String, fields : List String, tests : List String, mod : String } -> Html Msg
renderLine i {name, fields, tests, mod} = tr []
<| [ th [] [ text mod ], th [] [ text <| fromInt i ], th [] [ text name ] ]
<| [ th [] [ mkSourceLink mod ], th [] [ text <| fromInt i ], th [] [ text name ] ]
++ (List.map (\b -> td [class (if b then "cell-good" else "cell-bad")] [text (if b then "" else "")])
<| List.map (\field -> not <| List.member field fields) watchedFields)

Loading…
Cancel
Save