diff --git a/.gitignore b/.gitignore index e8e28dd..9940c37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.direnv ssg/dist-newstyle src/_cache src/_site diff --git a/src/ServicesTable.elm b/src/ServicesTable.elm index 8dc2906..bd884a7 100644 --- a/src/ServicesTable.elm +++ b/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)