From 8e39fb999f9fab6649515ce6fc3ca660b34eec1f Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Mon, 13 May 2024 20:26:56 +0000 Subject: [PATCH 1/5] fix config and view files tab underlines --- web/src/components/apps/AppDetailPage.tsx | 7 ++-- web/src/utilities/utilities.js | 13 ++++++++ web/src/utilities/utilities.test.js | 39 +++++++++++++++++++++++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/web/src/components/apps/AppDetailPage.tsx b/web/src/components/apps/AppDetailPage.tsx index 1fe2c41284..bc3443c1e4 100644 --- a/web/src/components/apps/AppDetailPage.tsx +++ b/web/src/components/apps/AppDetailPage.tsx @@ -425,8 +425,9 @@ function AppDetailPage(props: Props) { updateCallback: refetchData, }; - const lastItem = location.pathname.substring( - location.pathname.lastIndexOf("/") + 1 + const lastItem = Utilities.getSubnavItemForRoute( + location.pathname, + params.slug ); return ( @@ -480,7 +481,7 @@ function AppDetailPage(props: Props) { { expect(Utilities.snapshotLocationStr(undefined, undefined)).toBe(""); }); }); + + describe("getSubnavItemForRoute", () => { + it("should return an empty string if there is no route", () => { + expect(Utilities.getSubnavItemForRoute(undefined, "my-app")).toBe(""); + }); + + it("should return an empty string if there is no app slug", () => { + expect( + Utilities.getSubnavItemForRoute("/app/my-app/config", undefined) + ).toBe(""); + }); + + it("should return an empty string if there is no subnav item", () => { + expect(Utilities.getSubnavItemForRoute("/app/my-app/", "my-app")).toBe( + "" + ); + }); + + it("should return the subnav item for the route", () => { + expect( + Utilities.getSubnavItemForRoute("/app/my-app/config", "my-app") + ).toBe("config"); + }); + + it("should return the subnav item for the route with a subpath", () => { + expect( + Utilities.getSubnavItemForRoute("/app/my-app/config/1", "my-app") + ).toBe("config"); + }); + + it("should return the subnav item for the route with multiple subpaths", () => { + expect( + Utilities.getSubnavItemForRoute( + "/app/my-app/troubleshoot/analyze/abcdefg", + "my-app" + ) + ).toBe("troubleshoot"); + }); + }); }); From ce4d8f9a7c3da8850be83e8f76b4b30093733a9e Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Mon, 13 May 2024 20:51:39 +0000 Subject: [PATCH 2/5] use cgr.dev/chainguard/apko --- .github/actions/build-custom-image-with-apko/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/build-custom-image-with-apko/action.yml b/.github/actions/build-custom-image-with-apko/action.yml index d31e09cd5f..b602a5baf7 100644 --- a/.github/actions/build-custom-image-with-apko/action.yml +++ b/.github/actions/build-custom-image-with-apko/action.yml @@ -49,6 +49,7 @@ runs: - uses: chainguard-images/actions/apko-publish@main with: + apko-image: cgr.dev/chainguard/apko:latest config: ${{ inputs.context }}/apko.yaml archs: amd64,arm64 tag: ${{ inputs.image-name }} From ede91600ff2546dafd94f48e33cd464db0a99a07 Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Mon, 13 May 2024 21:01:50 +0000 Subject: [PATCH 3/5] override apko-image for deps action too --- .github/actions/build-dep-image-with-apko/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/build-dep-image-with-apko/action.yml b/.github/actions/build-dep-image-with-apko/action.yml index 7f234ca742..15e6eaf4e1 100644 --- a/.github/actions/build-dep-image-with-apko/action.yml +++ b/.github/actions/build-dep-image-with-apko/action.yml @@ -43,6 +43,7 @@ runs: - uses: chainguard-images/actions/apko-publish@main if: ${{ inputs.overwrite == 'true' || steps.check-image-exists.outputs.image-exists == 'false' }} with: + apko-image: cgr.dev/chainguard/apko:latest config: ${{ inputs.apko-config }} archs: amd64,arm64 tag: ${{ inputs.image-name }} From 331e9a402c4ff958f9d1893833911375a32ef6a0 Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Mon, 13 May 2024 21:05:40 +0000 Subject: [PATCH 4/5] add descriptions for actionlint --- .github/actions/kurl-addon-kots-generate/action.yml | 1 + .github/actions/kurl-addon-kots-publish/action.yml | 1 + .github/actions/kurl-addon-kots-test/action.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/actions/kurl-addon-kots-generate/action.yml b/.github/actions/kurl-addon-kots-generate/action.yml index b1c914cef3..ace922704e 100644 --- a/.github/actions/kurl-addon-kots-generate/action.yml +++ b/.github/actions/kurl-addon-kots-generate/action.yml @@ -1,4 +1,5 @@ name: Generate kURL Add-On +description: Generate kURL Add-On inputs: addon_version: diff --git a/.github/actions/kurl-addon-kots-publish/action.yml b/.github/actions/kurl-addon-kots-publish/action.yml index 8838089ae3..93bd23945d 100644 --- a/.github/actions/kurl-addon-kots-publish/action.yml +++ b/.github/actions/kurl-addon-kots-publish/action.yml @@ -1,4 +1,5 @@ name: Publish kURL Add-On +description: Publish kURL Add-On inputs: addon_version: diff --git a/.github/actions/kurl-addon-kots-test/action.yml b/.github/actions/kurl-addon-kots-test/action.yml index aa429be372..91fb5eb0c3 100644 --- a/.github/actions/kurl-addon-kots-test/action.yml +++ b/.github/actions/kurl-addon-kots-test/action.yml @@ -1,4 +1,5 @@ name: Test kURL Add-On +description: Test kURL Add-On inputs: addon_version: From 361b9e80c04bbde6db213c92793341317ddedcfb Mon Sep 17 00:00:00 2001 From: Craig O'Donnell Date: Mon, 13 May 2024 21:21:55 +0000 Subject: [PATCH 5/5] use last working apko image --- .github/actions/build-custom-image-with-apko/action.yml | 2 +- .github/actions/build-dep-image-with-apko/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-custom-image-with-apko/action.yml b/.github/actions/build-custom-image-with-apko/action.yml index b602a5baf7..f01b27572e 100644 --- a/.github/actions/build-custom-image-with-apko/action.yml +++ b/.github/actions/build-custom-image-with-apko/action.yml @@ -49,7 +49,7 @@ runs: - uses: chainguard-images/actions/apko-publish@main with: - apko-image: cgr.dev/chainguard/apko:latest + apko-image: ghcr.io/wolfi-dev/apko@sha256:87b47283433066d19b71e1cb4401be8d04b7d51f4f4263fde1977c3043b9754f config: ${{ inputs.context }}/apko.yaml archs: amd64,arm64 tag: ${{ inputs.image-name }} diff --git a/.github/actions/build-dep-image-with-apko/action.yml b/.github/actions/build-dep-image-with-apko/action.yml index 15e6eaf4e1..658f350bc8 100644 --- a/.github/actions/build-dep-image-with-apko/action.yml +++ b/.github/actions/build-dep-image-with-apko/action.yml @@ -43,7 +43,7 @@ runs: - uses: chainguard-images/actions/apko-publish@main if: ${{ inputs.overwrite == 'true' || steps.check-image-exists.outputs.image-exists == 'false' }} with: - apko-image: cgr.dev/chainguard/apko:latest + apko-image: ghcr.io/wolfi-dev/apko@sha256:87b47283433066d19b71e1cb4401be8d04b7d51f4f4263fde1977c3043b9754f config: ${{ inputs.apko-config }} archs: amd64,arm64 tag: ${{ inputs.image-name }}