Skip to content

Commit

Permalink
Add target to version information and show it on "About" page
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasKalbertodt committed Sep 19, 2023
1 parent cde40bd commit 75d745e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/src/http/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ impl Assets {
"buildDateUtc": crate::version::build_time_utc(),
"gitCommitHash": crate::version::git_commit_hash(),
"gitWasDirty": crate::version::git_was_dirty(),
"target": crate::version::target(),
}).to_string());
variables.insert("global-style".into(), config.theme.to_css());
variables.insert("auth".into(), json!({
Expand Down
7 changes: 6 additions & 1 deletion backend/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ pub(crate) fn git_was_dirty() -> bool {
build_info::GIT_DIRTY == Some(true)
}

pub(crate) fn target() -> &'static str {
build_info::TARGET
}

/// Returns a string containing all version-related information.
pub(crate) fn full() -> String {
format!(
"{} ({}{}), built {}",
"{} ({}{}), built {} ({})",
identifier(),
git_commit_hash(),
if git_was_dirty() { ", dirty" } else { "" },
build_time_utc(),
target(),
)
}
1 change: 1 addition & 0 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type VersionInfo = {
buildDateUtc: string;
gitCommitHash: string;
gitWasDirty: boolean;
target: string;
};

type UploadConfig = {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/routes/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ABOUT_PATH } from "./paths";
import { makeRoute } from "../rauta";
import { PageTitle } from "../layout/header/ui";
import { Breadcrumbs } from "../ui/Breadcrumbs";
import { COLORS } from "../color";


export const AboutRoute = makeRoute(url => {
Expand Down Expand Up @@ -56,6 +57,10 @@ const About: React.FC = () => {
<a href={`https://github.com/elan-ev/tobira/releases/tag/${version.identifier}`}>
Tobira <strong>{version.identifier}</strong>
</a>
{" "}
<span css={{ color: COLORS.neutral80, paddingLeft: 8 }}>
(<code css={{ fontSize: 13 }}>{version.target}</code>)
</span>
<br />
{"Git info: "}
<a href={`https://github.com/elan-ev/tobira/commit/${version.gitCommitHash}`}>
Expand Down

0 comments on commit 75d745e

Please sign in to comment.