on master help sign in
update Index.elm to only use exactDeps for packages
8c77df4Evan Czaplicki
reactor/src/Index.elm+27−20
@@ -64,7 +64,7 @@ decoder =
64 (D.field "dirs" (D.list D.string))
64 (D.field "dirs" (D.list D.string))
65 (D.field "files" (D.list fileDecoder))
65 (D.field "files" (D.list fileDecoder))
66 (D.field "readme" (D.nullable D.string))
66 (D.field "readme" (D.nullable D.string))
67− (D.field "project" (D.nullable Project.decoder))
67+ (D.field "outline" (D.nullable Project.decoder))
68 (D.field "exactDeps" (D.dict Version.decoder))
68 (D.field "exactDeps" (D.dict Version.decoder))
69
69
70
70
@@ -219,10 +219,10 @@ viewDeps exactDeps project =
219 dependencies =
219 dependencies =
220 case project of
220 case project of
221 Project.Application info ->
221 Project.Application info ->
222− List.map (viewDependency exactDeps) info.depsDirect
222+ List.map viewVersion info.depsDirect
223
223
224 Project.Package info ->
224 Project.Package info ->
225− List.map (viewDependency exactDeps) info.deps
225+ List.map (viewConstraint exactDeps) info.deps
226 in
226 in
227 Skeleton.box
227 Skeleton.box
228 { title = "Dependencies"
228 { title = "Dependencies"
@@ -237,10 +237,10 @@ viewTestDeps exactDeps project =
237 dependencies =
237 dependencies =
238 case project of
238 case project of
239 Project.Application info ->
239 Project.Application info ->
240− List.map (viewDependency exactDeps) info.testDepsDirect
240+ List.map viewVersion info.testDepsDirect
241
241
242 Project.Package info ->
242 Project.Package info ->
243− List.map (viewDependency exactDeps) info.testDeps
243+ List.map (viewConstraint exactDeps) info.testDeps
244 in
244 in
245 Skeleton.box
245 Skeleton.box
246 { title = "Test Dependencies"
246 { title = "Test Dependencies"
@@ -249,24 +249,31 @@ viewTestDeps exactDeps project =
249 }
249 }
250
250
251
251
252−viewDependency : ExactDeps -> (Package.Name, vsn) -> List (Html msg)
252+viewVersion : (Package.Name, Version.Version) -> List (Html msg)
253−viewDependency exactDeps (pkg, _) =
253+viewVersion (pkg, version) =
254− case Dict.get (Package.toString pkg) exactDeps of
255− Nothing ->
256− [ div [ style "float" "left" ]
254+ [ div [ style "float" "left" ]
257− [ Icon.package
255+ [ Icon.package
258− , text (Package.toString pkg)
256+ , a [ href (toPackageUrl pkg version) ] [ text (Package.toString pkg) ]
259− ]
260− , div [ style "float" "right" ] [ text "???" ]
261 ]
257 ]
258+ , div [ style "float" "right" ] [ text (Version.toString version) ]
259+ ]
262
260
263− Just version ->
261+
262+viewConstraint : ExactDeps -> (Package.Name, constraint) -> List (Html msg)
263+viewConstraint exactDeps (packageName, _) =
264+ let
265+ pkg = Package.toString packageName
266+ vsn =
267+ case Dict.get pkg exactDeps of
268+ Just v -> Version.toString v
269+ Nothing -> "???"
270+ in
264− [ div [ style "float" "left" ]
271+ [ div [ style "float" "left" ]
265− [ Icon.package
272+ [ Icon.package
266− , a [ href (toPackageUrl pkg version) ] [ text (Package.toString pkg) ]
273+ , text pkg
267− ]
268− , div [ style "float" "right" ] [ text (Version.toString version) ]
269 ]
274 ]
275+ , div [ style "float" "right" ] [ text vsn ]
276+ ]
270
277
271
278
272toPackageUrl : Package.Name -> Version.Version -> String
279toPackageUrl : Package.Name -> Version.Version -> String