Skip to content

Commit

Permalink
fix config and view files tab underlines (#4616)
Browse files Browse the repository at this point in the history
* fix config and view files tab underlines

* use cgr.dev/chainguard/apko

* override apko-image for deps action too

* add descriptions for actionlint

* use last working apko image
  • Loading branch information
Craig O'Donnell authored May 14, 2024
1 parent ea70c45 commit 0bd5479
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/actions/build-custom-image-with-apko/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ runs:
- uses: chainguard-images/actions/apko-publish@main
with:
apko-image: ghcr.io/wolfi-dev/apko@sha256:87b47283433066d19b71e1cb4401be8d04b7d51f4f4263fde1977c3043b9754f
config: ${{ inputs.context }}/apko.yaml
archs: amd64,arm64
tag: ${{ inputs.image-name }}
Expand Down
1 change: 1 addition & 0 deletions .github/actions/build-dep-image-with-apko/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ghcr.io/wolfi-dev/apko@sha256:87b47283433066d19b71e1cb4401be8d04b7d51f4f4263fde1977c3043b9754f
config: ${{ inputs.apko-config }}
archs: amd64,arm64
tag: ${{ inputs.image-name }}
Expand Down
1 change: 1 addition & 0 deletions .github/actions/kurl-addon-kots-generate/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Generate kURL Add-On
description: Generate kURL Add-On

inputs:
addon_version:
Expand Down
1 change: 1 addition & 0 deletions .github/actions/kurl-addon-kots-publish/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Publish kURL Add-On
description: Publish kURL Add-On

inputs:
addon_version:
Expand Down
1 change: 1 addition & 0 deletions .github/actions/kurl-addon-kots-test/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Test kURL Add-On
description: Test kURL Add-On

inputs:
addon_version:
Expand Down
7 changes: 4 additions & 3 deletions web/src/components/apps/AppDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -480,7 +481,7 @@ function AppDetailPage(props: Props) {
<Fragment>
<SubNavBar
className="flex"
activeTab={lastItem === params.slug ? "app" : lastItem}
activeTab={!lastItem ? "app" : lastItem}
app={selectedApp}
isVeleroInstalled={isVeleroInstalled}
isEmbeddedCluster={props.isEmbeddedCluster}
Expand Down
13 changes: 13 additions & 0 deletions web/src/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,4 +1046,17 @@ export const Utilities = {
}
return `${bucket}/${prefix}`;
},

getSubnavItemForRoute(route, appSlug) {
if (!route || !appSlug) {
return "";
}
const searchStr = `/app/${appSlug}/`;
const index = route.indexOf(searchStr);
if (index === -1) {
return "";
}
const path = route.substring(index + searchStr.length);
return path.split("/")[0];
},
};
39 changes: 39 additions & 0 deletions web/src/utilities/utilities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,43 @@ describe("Utilities", () => {
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");
});
});
});

0 comments on commit 0bd5479

Please sign in to comment.