Display attributes of flakes in a more expected way (#397)
This commit is contained in:
parent
3dfcf4fd45
commit
87851618b6
|
@ -174,6 +174,7 @@ viewResultItem channel _ show item =
|
||||||
case Html.Parser.run <| String.trim value of
|
case Html.Parser.run <| String.trim value of
|
||||||
Ok [ Html.Parser.Element "rendered-docbook" _ nodes ] ->
|
Ok [ Html.Parser.Element "rendered-docbook" _ nodes ] ->
|
||||||
Just <| Html.Parser.Util.toVirtualDom nodes
|
Just <| Html.Parser.Util.toVirtualDom nodes
|
||||||
|
|
||||||
Ok _ ->
|
Ok _ ->
|
||||||
Nothing
|
Nothing
|
||||||
|
|
||||||
|
@ -275,10 +276,12 @@ viewResultItem channel _ show item =
|
||||||
flakeOrNixpkgs =
|
flakeOrNixpkgs =
|
||||||
case ( item.source.flakeName, item.source.flake, item.source.flakeUrl ) of
|
case ( item.source.flakeName, item.source.flake, item.source.flakeUrl ) of
|
||||||
-- its a flake
|
-- its a flake
|
||||||
( Just name, Just ( _, module_ ), Just flakeUrl_ ) ->
|
( Just name, Just ( flake, attr ), Just flakeUrl_ ) ->
|
||||||
Just
|
Just
|
||||||
[ li []
|
[ li []
|
||||||
[ a [ href flakeUrl_ ] [ text name ]
|
[ a [ href flakeUrl_ ] [ text flake ]
|
||||||
|
, text "#"
|
||||||
|
, text attr
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,7 @@ viewResultItem channel showInstallDetails show item =
|
||||||
"mailto:" ++ email
|
"mailto:" ++ email
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
"#"
|
"#"
|
||||||
]
|
]
|
||||||
[ text "(mail)" ]
|
[ text "(mail)" ]
|
||||||
]
|
]
|
||||||
|
@ -398,7 +398,8 @@ viewResultItem channel showInstallDetails show item =
|
||||||
|
|
||||||
mailtoAllMaintainers maintainers =
|
mailtoAllMaintainers maintainers =
|
||||||
let
|
let
|
||||||
maintainerMails = List.filterMap (\m -> m.email) maintainers
|
maintainerMails =
|
||||||
|
List.filterMap (\m -> m.email) maintainers
|
||||||
in
|
in
|
||||||
li []
|
li []
|
||||||
[ a
|
[ a
|
||||||
|
@ -584,16 +585,27 @@ viewResultItem channel showInstallDetails show item =
|
||||||
isOpen =
|
isOpen =
|
||||||
Just item.source.attr_name == show
|
Just item.source.attr_name == show
|
||||||
|
|
||||||
flakeItem =
|
flakeOrNixpkgs =
|
||||||
Maybe.map Tuple.second item.source.flakeUrl
|
case ( item.source.flakeName, item.source.flakeUrl ) of
|
||||||
|> Maybe.map2
|
-- its a flake
|
||||||
(\name resolved ->
|
( Just name, Just ( flakeIdent, flakeUrl ) ) ->
|
||||||
[ li [ trapClick ]
|
[ a [ href flakeUrl ] [ text flakeIdent ]
|
||||||
[ createShortDetailsItem name resolved ]
|
, text "#"
|
||||||
|
, a
|
||||||
|
[ onClick toggle
|
||||||
|
, href ""
|
||||||
|
]
|
||||||
|
[ text item.source.attr_name ]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
[ a
|
||||||
|
[ onClick toggle
|
||||||
|
, href ""
|
||||||
]
|
]
|
||||||
)
|
[ text item.source.attr_name ]
|
||||||
item.source.flakeName
|
]
|
||||||
|> Maybe.withDefault []
|
|
||||||
in
|
in
|
||||||
li
|
li
|
||||||
[ class "package"
|
[ class "package"
|
||||||
|
@ -603,18 +615,7 @@ viewResultItem channel showInstallDetails show item =
|
||||||
([]
|
([]
|
||||||
|> List.append longerPackageDetails
|
|> List.append longerPackageDetails
|
||||||
|> List.append
|
|> List.append
|
||||||
[ ul [ class "search-result-button" ]
|
[ span [] flakeOrNixpkgs
|
||||||
(List.append
|
|
||||||
flakeItem
|
|
||||||
[ li []
|
|
||||||
[ a
|
|
||||||
[ onClick toggle
|
|
||||||
, href ""
|
|
||||||
]
|
|
||||||
[ text item.source.attr_name ]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
, div [] [ text <| Maybe.withDefault "" item.source.description ]
|
, div [] [ text <| Maybe.withDefault "" item.source.description ]
|
||||||
, shortPackageDetails
|
, shortPackageDetails
|
||||||
, Search.showMoreButton toggle isOpen
|
, Search.showMoreButton toggle isOpen
|
||||||
|
|
Loading…
Reference in a new issue