Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(about): enhance version string and bug tracker #271

Merged
merged 3 commits into from
Sep 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions src/app/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { IAppRoute, routes } from '@app/routes';
import { AboutModal, Alert, AlertGroup, AlertVariant, AlertActionCloseButton,
Button, Nav, NavItem, NavList, NotificationBadge, Page, PageHeader,
PageHeaderTools, PageHeaderToolsGroup, PageHeaderToolsItem, PageSidebar,
SkipToContent, Text, TextContent, TextList, TextListItem
SkipToContent, Text, TextContent, TextList, TextListItem, TextVariants
} from '@patternfly/react-core';
import { BellIcon, CogIcon, HelpIcon } from '@patternfly/react-icons';
import { map } from 'rxjs/operators';
Expand Down Expand Up @@ -72,7 +72,7 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({children}) => {
const [showSslErrorModal, setShowSslErrorModal] = React.useState(false);
const [aboutModalOpen, setAboutModalOpen] = React.useState(false);
const [isNotificationDrawerExpanded, setNotificationDrawerExpanded] = React.useState(false);
const [cryostatVersion, setCryostatVersion] = React.useState('unknown');
const [cryostatVersion, setCryostatVersion] = React.useState(undefined as string | undefined);
const [notifications, setNotifications] = React.useState([] as Notification[]);
const [unreadNotificationsCount, setUnreadNotificationsCount] = React.useState(0);
const [errorNotificationsCount, setErrorNotificationsCount] = React.useState(0);
Expand All @@ -90,6 +90,19 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({children}) => {
return () => sub.unsubscribe();
})

const cryostatCommitHash = React.useMemo(() => {
if (!cryostatVersion) {
return;
}
const expr = /^(?<describe>[a-zA-Z0-9-_.]+-[0-9]+-[a-z0-9]{9})(?:-dirty)?$/;
const result = cryostatVersion.match(expr);
if (!result) {
notificationsContext.warning('Cryostat Version Parse Failure', `Could not parse Cryostat version string '${cryostatVersion}'.`);
return 'main';
}
return result.groups?.describe || 'main';
}, [cryostatVersion]);

React.useEffect(() => {
const sub = notificationsContext.notifications().subscribe(setNotifications);
return () => sub.unsubscribe();
Expand Down Expand Up @@ -202,31 +215,45 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({children}) => {
Version
</TextListItem>
<TextListItem component="dd">
<Text>{cryostatVersion}</Text>
<Text
component={TextVariants.a}
target="_blank"
href={`https://github.com/cryostatio/cryostat/commits/${cryostatCommitHash}`}
>{cryostatVersion}</Text>
</TextListItem>
<TextListItem component="dt">
Homepage
</TextListItem>
<TextListItem component="dd">
<a href='https://cryostat.io'>cryostat.io</a>
<Text component={TextVariants.a} target="_blank" href='https://cryostat.io'>cryostat.io</Text>
</TextListItem>
<TextListItem component="dt">
Bug Reports
Bugs
</TextListItem>
<TextListItem component="dd">
<a href='https://github.com/cryostatio/cryostat/issues'>GitHub</a>
<Text>
<Text component={TextVariants.a} target="_blank" href='https://github.com/cryostatio/cryostat/issues'>Known Issues</Text>
&nbsp;|&nbsp;
<Text
component={TextVariants.a}
target="_blank"
href={`https://github.com/cryostatio/cryostat/issues/new?labels=user+report,bug&body=Affects+${cryostatVersion}`}
>
File a Report
</Text>
</Text>
</TextListItem>
<TextListItem component="dt">
Mailing List
</TextListItem>
<TextListItem component="dd">
<a href='https://groups.google.com/g/cryostat-development'>Google Groups</a>
<Text component={TextVariants.a} target="_blank" href='https://groups.google.com/g/cryostat-development'>Google Groups</Text>
</TextListItem>
<TextListItem component="dt">
Open Source License
</TextListItem>
<TextListItem component="dd">
<a href='https://github.com/cryostatio/cryostat/blob/main/LICENSE'>License</a>
<Text component={TextVariants.a} target="_blank" href='https://github.com/cryostatio/cryostat/blob/main/LICENSE'>License</Text>
</TextListItem>
</TextList>
</TextContent>
Expand Down