Skip to content

Commit

Permalink
Update dashboard to use Cozystack API
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed Dec 23, 2024
1 parent c1ca19d commit 25c3031
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 3,558 deletions.
6 changes: 3 additions & 3 deletions packages/system/dashboard/images/dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ RUN wget -O- https://github.com/vmware-tanzu/kubeapps/archive/refs/tags/v${VERSI

COPY apple-touch-icon.png favicon-16x16.png favicon-32x32.png favicon.ico mstile-144x144.png mstile-150x150.png mstile-310x150.png mstile-310x310.png mstile-70x70.png safari-pinned-tab.svg public/

COPY release-url.diff /patches/release-url.diff
RUN patch -p2 < /patches/release-url.diff

RUN sed -i 's/opacity: 0.05;/display: none;/g' src/components/InfoCard/InfoCard.scss
RUN sed -i 's/"Kubeapps",/"Cozystack",/' lang/en.json
RUN sed -i 's/Kubeapps/Cozystack/g' public/site.webmanifest
RUN sed -i 's/Welcome To Kubeapps/Welcome To Cozystack/g' ./src/components/LoginForm/LoginForm.tsx ./src/components/AppList/AppListGrid.tsx ./src/components/AppList/AppList.test.tsx
RUN sed -i src/components/DeploymentForm/DeploymentForm.tsx \
-e '/const handleDeploy/i \ const packageName = packageId ? packageId.split("/").pop() : "";' \
-e '/releaseName,$/ s|releaseName,|packageName + "-" + releaseName,|'
RUN sed -i '/by VMware/,/ \.$/d' src/components/Header/Menu.tsx
RUN sed -i '/height: 4em;/ s/4em/4.5em/' src/components/Header/Header.scss
RUN sed -i '/background-image/ s|base64,[^"]\+|base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgd2lkdGg9IjUyMSIKICAgaGVpZ2h0PSIxODUiCiAgIHZpZXdCb3g9IjAgMCA1MjEgMTg1IgogICBmaWxsPSJub25lIgogICB2ZXJzaW9u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TkgOS43ODA3LC0zLjk2MDI4IDE2LjAyMTIsLTMuOTYwMjggNC4zODAzLDAgOC40MzA1LDAuNjkwMDQ4IDEyLjE1MDgsMi4wNzAxNCAzLjcyMDMsMS4zODAxIDYuODQwNSwzLjM5MDI0IDkuMzYwNiw2LjAzMDQyIGwgLTIuODgwMiw2LjAzMDQ0IGMgLTIuNzYwMSwtMi41ODAyIC01LjY0MDMsLTQuNDQwMzMgLTguNjQwNiwtNS41ODA0MSAtMi45NDAyLC0xLjIwMDA4IC02LjIxMDQsLTEuODAwMTIgLTkuODEwNiwtMS44MDAxMiAtNy4xNDA1LDAgLTEyLjYwMDksMi4yNTAxNSAtMTYuMzgxMiw2Ljc1MDQzIC0zLjc4MDIyLDQuNTAwMyAtNS42NzAzNDk3LDEwLjgzMDggLTUuNjcwMzQ5NywxOC45OTEzIDAsOC4xNjA2IDEuODkwMTI5NywxNC41MjEgNS42NzAzNDk3LDE5LjA4MTQgMy43ODAzLDQuNTAwMyA5LjI0MDcsNi43NTA0IDE2LjM4MTIsNi43NTA0IDMuNjAwMiwwIDYuODcwNCwtMC41NyA5LjgxMDYsLTEuNzEwMSAzLjAwMDMsLTEuMjAwMSA1Ljg4MDUsLTMuMDkwMiA4LjY0MDYsLTUuNjcwNCBsIDIuODgwMiw2LjAzMDQgYyAtMi41MjAxLDIuNTgwMiAtNS42NDAzLDQuNTkwNCAtOS4zNjA2LDYuMDMwNSAtMy43MjAzLDEuMzggLTcuNzcwNSwyLjA3MDEgLTEyLjE1MDgsMi4wNzAxIHoiCiAgICAgZmlsbD0iI2ZmZmZmZiIKICAgICBpZD0icGF0aDk1NiIgLz4KPC9zdmc+Cg==|' src/components/Header/Header.scss
Expand Down
34 changes: 34 additions & 0 deletions packages/system/dashboard/images/dashboard/release-url.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/dashboard/src/shared/url.ts b/dashboard/src/shared/url.ts
index 7918652b0..64c3435af 100644
--- a/dashboard/src/shared/url.ts
+++ b/dashboard/src/shared/url.ts
@@ -36,7 +36,7 @@ export const app = {
return `${app.apps.list(
pkgCluster,
pkgNamespace,
- )}/${pkgPluginName}/${pkgPluginVersion}/${pkgId}`;
+ )}/${pkgPluginName}/${pkgPluginVersion}/${encodeURIComponent(pkgId)}`;
},
upgrade: (ref: InstalledPackageReference) => `${app.apps.get(ref)}/upgrade`,
upgradeTo: (ref: InstalledPackageReference, version?: string) =>
diff --git a/dashboard/src/components/DeploymentForm/DeploymentForm.tsx b/dashboard/src/components/DeploymentForm/DeploymentForm.tsx
index 7ccb77b5d..589f72b65 100644
--- a/dashboard/src/components/DeploymentForm/DeploymentForm.tsx
+++ b/dashboard/src/components/DeploymentForm/DeploymentForm.tsx
@@ -144,13 +144,15 @@ export default function DeploymentForm() {
);
setDeploying(false);
if (deployed) {
+ const chartParts = packageId?.split("/") || [];
+ const kind = chartParts[chartParts.length - 1];
push(
// Redirect to the installed package, note that the cluster/ns are the ones passed
// in the URL, not the ones from the package.
url.app.apps.get({
context: { cluster: targetCluster, namespace: targetNamespace },
plugin: pluginObj,
- identifier: releaseName,
+ identifier: `${kind}%2F${releaseName}`,
} as AvailablePackageReference),
);
}
13 changes: 2 additions & 11 deletions packages/system/dashboard/images/kubeapps-apis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
# syntax = docker/dockerfile:1

FROM alpine as source
ARG VERSION=v2.12.0
ARG COMMIT_REF=bcf015b116061cd1b07ed3cb533bb689423087c8
RUN apk add --no-cache patch
WORKDIR /source
RUN wget -O- https://github.com/vmware-tanzu/kubeapps/archive/refs/tags/${VERSION}.tar.gz | tar xzf - --strip-components=1
COPY fluxcd.diff /patches/fluxcd.diff
COPY labels.diff /patches/labels.diff
COPY reconcile-strategy.diff /patches/reconcile-strategy.diff
COPY dashboard-resource.diff /patches/dashboard-resource.diff
RUN patch -p1 < /patches/fluxcd.diff
RUN patch -p1 < /patches/labels.diff
RUN patch -p1 < /patches/reconcile-strategy.diff
RUN patch -p1 < /patches/dashboard-resource.diff
RUN wget -O- https://github.com/aenix-io/kubeapps/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1

FROM bitnami/golang:1.23.4 AS builder
WORKDIR /go/src/github.com/vmware-tanzu/kubeapps
Expand Down Expand Up @@ -45,7 +37,6 @@ RUN curl -sSL "https://github.com/bufbuild/buf/releases/download/v$BUF_VERSION/b
# TODO: Remove and instead use built-in gRPC container probes once we're supporting >= 1.24 only. https://kubernetes.io/blog/2022/05/13/grpc-probes-now-in-beta/
RUN curl -sSL "https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH}" -o "/bin/grpc_health_probe" && chmod +x "/bin/grpc_health_probe"


# With the trick below, Go's build cache is kept between builds.
# https://github.com/golang/go/issues/27719#issuecomment-514747274
RUN --mount=type=cache,target=/go/pkg/mod \
Expand Down
155 changes: 0 additions & 155 deletions packages/system/dashboard/images/kubeapps-apis/dashboard-resource.diff

This file was deleted.

Loading

0 comments on commit 25c3031

Please sign in to comment.