From 71350cacd5d64a7922c8847f2b243d5277970df5 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Mon, 22 Nov 2021 12:41:12 +0100 Subject: [PATCH] Show exact commit hash of Admin UI in interface (#1572) --- keycloak-theme/pom.xml | 14 ++++++++++++++ src/dashboard/Dashboard.tsx | 3 +++ src/dashboard/messages.ts | 1 + src/environment.ts | 3 +++ 4 files changed, 21 insertions(+) diff --git a/keycloak-theme/pom.xml b/keycloak-theme/pom.xml index 4c58b6242b..123e841afe 100644 --- a/keycloak-theme/pom.xml +++ b/keycloak-theme/pom.xml @@ -104,6 +104,19 @@ + + io.github.git-commit-id + git-commit-id-maven-plugin + 5.0.0 + + + + revision + + initialize + + + com.google.code.maven-replacer-plugin maven-replacer-plugin @@ -142,6 +155,7 @@ "resourceUrl": "${resourceUrl}", "masterRealm": "${masterRealm}", "resourceVersion": "${resourceVersion}", + "commitHash": "${git.commit.id}", "isRunningAsTheme": true } diff --git a/src/dashboard/Dashboard.tsx b/src/dashboard/Dashboard.tsx index 9d050fb543..d75eedf95a 100644 --- a/src/dashboard/Dashboard.tsx +++ b/src/dashboard/Dashboard.tsx @@ -160,6 +160,9 @@ const Dashboard = () => { + + {t("adminUiVersion", { version: environment.commitHash })} + ); diff --git a/src/dashboard/messages.ts b/src/dashboard/messages.ts index fa27882293..11ece0c7a5 100644 --- a/src/dashboard/messages.ts +++ b/src/dashboard/messages.ts @@ -13,5 +13,6 @@ export default { infoEnabledFeatures: "Something about what enabled features are.", infoDisabledFeatures: "Something about what disabled features are.", disabledFeatures: "Disabled features", + adminUiVersion: "Admin UI version: {{version}}", }, }; diff --git a/src/environment.ts b/src/environment.ts index 424afac9c7..147fcc4044 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -12,6 +12,8 @@ export type Environment = { masterRealm: string; /** The version hash of the auth sever. */ resourceVersion: string; + /** The hash of the commit the Admin UI was built on, useful to determine the exact version the user is running. */ + commitHash: string; /** Indicates if the application is running as a Keycloak theme. */ isRunningAsTheme: boolean; }; @@ -29,6 +31,7 @@ const defaultEnvironment: Environment = { resourceUrl: ".", masterRealm: "master", resourceVersion: "unknown", + commitHash: "unknown", isRunningAsTheme: false, };