From f04c7c49f80b3c7f0906920e1fea3a70688baea8 Mon Sep 17 00:00:00 2001 From: Piotr Jurczynski <619650+pjurczynski@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:36:20 +0200 Subject: [PATCH] feat: add OS X ARM download url --- web/elm/src/Assets.elm | 3 ++ web/elm/src/Concourse/Cli.elm | 22 ++++++++- web/elm/tests/AssetsTests.elm | 5 ++ web/elm/tests/CliTests.elm | 2 + web/elm/tests/DashboardTests.elm | 11 ++++- web/elm/tests/PipelineTests.elm | 14 +++++- web/elm/tests/WelcomeCardTests.elm | 11 ++++- web/public/images/apple-arm-logo.svg | 74 ++++++++++++++++++++++++++++ 8 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 web/public/images/apple-arm-logo.svg diff --git a/web/elm/src/Assets.elm b/web/elm/src/Assets.elm index 0859366a93e..20d7b0fd8ce 100644 --- a/web/elm/src/Assets.elm +++ b/web/elm/src/Assets.elm @@ -114,6 +114,9 @@ toPath asset = OSX -> "apple" + OSXArm -> + "apple-arm" + Windows -> "windows" diff --git a/web/elm/src/Concourse/Cli.elm b/web/elm/src/Concourse/Cli.elm index 0e1ba5f21ab..0fefdabb335 100644 --- a/web/elm/src/Concourse/Cli.elm +++ b/web/elm/src/Concourse/Cli.elm @@ -6,11 +6,12 @@ import Url.Builder clis : List Cli clis = - [ OSX, Windows, Linux ] + [ OSX, OSXArm, Windows, Linux ] type Cli = OSX + | OSXArm | Windows | Linux @@ -23,15 +24,26 @@ downloadUrl cli = OSX -> "darwin" + OSXArm -> + "darwin" + Windows -> "windows" Linux -> "linux" + + archName = + case cli of + OSXArm -> + "arm" + + _ -> + "amd64" in Endpoints.Cli |> Endpoints.toString - [ Url.Builder.string "arch" "amd64" + [ Url.Builder.string "arch" archName , Url.Builder.string "platform" platformName ] @@ -44,6 +56,9 @@ label cli = OSX -> "OS X" + OSXArm -> + "OS X arm" + Windows -> "Windows" @@ -59,6 +74,9 @@ id cli = OSX -> "osx" + OSXArm -> + "osx-arm" + Windows -> "windows" diff --git a/web/elm/tests/AssetsTests.elm b/web/elm/tests/AssetsTests.elm index 12f3d4172ca..6e70b42ed72 100644 --- a/web/elm/tests/AssetsTests.elm +++ b/web/elm/tests/AssetsTests.elm @@ -24,6 +24,11 @@ toStringTests = CliIcon OSX |> toString |> Expect.equal "/public/images/apple-logo.svg" + , test "OSXArm" <| + \_ -> + CliIcon OSXArm + |> toString + |> Expect.equal "/public/images/apple-arm-logo.svg" , test "Windows" <| \_ -> CliIcon Windows diff --git a/web/elm/tests/CliTests.elm b/web/elm/tests/CliTests.elm index a2705ae21e0..adaedb66615 100644 --- a/web/elm/tests/CliTests.elm +++ b/web/elm/tests/CliTests.elm @@ -13,6 +13,7 @@ all = List.map downloadUrl clis |> Expect.equal [ "/api/v1/cli?arch=amd64&platform=darwin" + , "/api/v1/cli?arch=arm&platform=darwin" , "/api/v1/cli?arch=amd64&platform=windows" , "/api/v1/cli?arch=amd64&platform=linux" ] @@ -21,6 +22,7 @@ all = List.map label clis |> Expect.equal [ "Download OS X CLI" + , "Download OS X arm CLI" , "Download Windows CLI" , "Download Linux CLI" ] diff --git a/web/elm/tests/DashboardTests.elm b/web/elm/tests/DashboardTests.elm index 9e2b3a9fe53..c31b378d415 100644 --- a/web/elm/tests/DashboardTests.elm +++ b/web/elm/tests/DashboardTests.elm @@ -1690,7 +1690,7 @@ all = \_ -> cliIcons |> Expect.all - [ Query.count (Expect.equal 3) + [ Query.count (Expect.equal 4) , Query.index 0 >> Query.has [ attribute <| @@ -1703,9 +1703,16 @@ all = [ attribute <| Attr.attribute "aria-label" - "Download Windows CLI" + "Download OS X arm CLI" ] , Query.index 2 + >> Query.has + [ attribute <| + Attr.attribute + "aria-label" + "Download Windows CLI" + ] + , Query.index 3 >> Query.has [ attribute <| Attr.attribute diff --git a/web/elm/tests/PipelineTests.elm b/web/elm/tests/PipelineTests.elm index 0f68be46519..8dd74b44f73 100644 --- a/web/elm/tests/PipelineTests.elm +++ b/web/elm/tests/PipelineTests.elm @@ -354,7 +354,7 @@ all = >> Query.has [ style "background-image" <| Assets.backgroundImage <| - Just (Assets.CliIcon Windows) + Just (Assets.CliIcon OSXArm) , style "background-position" "50% 50%" , style "background-repeat" "no-repeat" , style "width" "12px" @@ -363,6 +363,18 @@ all = , attribute <| Attr.download "" ] , Query.index 2 + >> Query.has + [ style "background-image" <| + Assets.backgroundImage <| + Just (Assets.CliIcon Windows) + , style "background-position" "50% 50%" + , style "background-repeat" "no-repeat" + , style "width" "12px" + , style "height" "12px" + , style "display" "inline-block" + , attribute <| Attr.download "" + ] + , Query.index 3 >> Query.has [ style "background-image" <| Assets.backgroundImage <| diff --git a/web/elm/tests/WelcomeCardTests.elm b/web/elm/tests/WelcomeCardTests.elm index 898c0cdd356..7c3049bbdfa 100644 --- a/web/elm/tests/WelcomeCardTests.elm +++ b/web/elm/tests/WelcomeCardTests.elm @@ -224,7 +224,7 @@ hasWelcomeCard setup = , test "icons have descriptive ARIA labels" <| cliIcons >> Expect.all - [ Query.count (Expect.equal 3) + [ Query.count (Expect.equal 4) , Query.index 0 >> Query.has [ attribute <| @@ -237,9 +237,16 @@ hasWelcomeCard setup = [ attribute <| Attr.attribute "aria-label" - "Download Windows CLI" + "Download OS X arm CLI" ] , Query.index 2 + >> Query.has + [ attribute <| + Attr.attribute + "aria-label" + "Download Windows CLI" + ] + , Query.index 3 >> Query.has [ attribute <| Attr.attribute diff --git a/web/public/images/apple-arm-logo.svg b/web/public/images/apple-arm-logo.svg new file mode 100644 index 00000000000..cf4af2a40e1 --- /dev/null +++ b/web/public/images/apple-arm-logo.svg @@ -0,0 +1,74 @@ + +custom_apple_arm_logoCreated with Sketch Beta.custom_apple_arm_logo