From e5c2709e9c8a6e86fc6dbfe54101f5ac90b0d09a Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 11 Oct 2022 12:42:57 -0400 Subject: [PATCH 1/2] build(config): add build properties JSON file Easy build-time overriding of distribution URLs for bug trackers, mailing list, product name, etc. --- src/app/About/About.tsx | 3 ++- src/app/About/AboutDescription.tsx | 17 +++++++---------- src/app/build.json | 9 +++++++++ tsconfig.json | 3 ++- 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 src/app/build.json diff --git a/src/app/About/About.tsx b/src/app/About/About.tsx index 3ebb9cc87..580fa5d95 100644 --- a/src/app/About/About.tsx +++ b/src/app/About/About.tsx @@ -37,6 +37,7 @@ */ import React from 'react'; +import build from '@app/build.json'; import cryostatLogoHorizontal from '@app/assets/logo-cryostat-3-horizontal.svg'; import { BreadcrumbPage } from '@app/BreadcrumbPage/BreadcrumbPage'; import { AboutDescription, CRYOSTAT_TRADEMARK } from './AboutDescription'; @@ -47,7 +48,7 @@ export const About = () => { - + diff --git a/src/app/About/AboutDescription.tsx b/src/app/About/AboutDescription.tsx index 39a4cd3bc..6806a4fcd 100644 --- a/src/app/About/AboutDescription.tsx +++ b/src/app/About/AboutDescription.tsx @@ -38,6 +38,7 @@ import { Text, TextContent, TextList, TextListItem, TextVariants } from '@patternfly/react-core'; import React from 'react'; +import build from '@app/build.json'; import { ServiceContext } from '@app/Shared/Services/Services'; import { NotificationsContext } from '@app/Notifications/Notifications'; @@ -85,21 +86,21 @@ export const AboutDescription = () => { Homepage - + cryostat.io Bugs - + Known Issues  |  File a Report @@ -107,17 +108,13 @@ export const AboutDescription = () => { Mailing List - - Google Groups + + {build.mailingListName} Open Source License - + License diff --git a/src/app/build.json b/src/app/build.json new file mode 100644 index 000000000..6126ad4d6 --- /dev/null +++ b/src/app/build.json @@ -0,0 +1,9 @@ +{ + "productName": "Cryostat", + "homePageUrl": "https://cryostat.io", + "knownIssuesUrl": "https://github.com/cryostatio/cryostat/issues", + "fileIssueUrl": "https://github.com/cryostatio/cryostat/issues/new?labels=user+report,bug&body=Affects+__REPLACE_VERSION__", + "mailingListName": "Google Groups", + "mailingListUrl": "https://groups.google.com/g/cryostat-development", + "licenseUrl": "https://github.com/cryostatio/cryostat/blob/main/LICENSE" +} diff --git a/tsconfig.json b/tsconfig.json index 0e10e899f..74d7f1db5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,8 @@ "**/*.ts", "**/*.tsx", "**/*.jsx", - "**/*.js" + "**/*.js", + "**/*.json" ], "exclude": ["node_modules"] } From 94ff4e83b857a94bd6bd810c276fe1cd08f98efa Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Tue, 11 Oct 2022 15:45:57 -0400 Subject: [PATCH 2/2] commit hash URL can be overridden, is not a link if the URL string is empty --- src/app/About/AboutDescription.tsx | 26 +++++++++++++++++--------- src/app/build.json | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/app/About/AboutDescription.tsx b/src/app/About/AboutDescription.tsx index 6806a4fcd..fe629e0af 100644 --- a/src/app/About/AboutDescription.tsx +++ b/src/app/About/AboutDescription.tsx @@ -70,20 +70,28 @@ export const AboutDescription = () => { return result.groups?.describe || 'main'; }, [cryostatVersion, notificationsContext]); + const versionComponent = React.useMemo(() => { + if (build.commitHashUrl) { + return ( + + {cryostatVersion} + + ); + } else { + return {cryostatVersion}; + } + }, [build.commitHashUrl, cryostatCommitHash]); + return ( <> Version - - - {cryostatVersion} - - + {versionComponent} Homepage diff --git a/src/app/build.json b/src/app/build.json index 6126ad4d6..7c51a5b09 100644 --- a/src/app/build.json +++ b/src/app/build.json @@ -1,5 +1,6 @@ { "productName": "Cryostat", + "commitHashUrl": "https://github.com/cryostatio/cryostat/commits/__REPLACE_HASH__", "homePageUrl": "https://cryostat.io", "knownIssuesUrl": "https://github.com/cryostatio/cryostat/issues", "fileIssueUrl": "https://github.com/cryostatio/cryostat/issues/new?labels=user+report,bug&body=Affects+__REPLACE_VERSION__",