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

Show release version in Footer #4200

Merged
merged 10 commits into from
Nov 5, 2024
Merged
1 change: 0 additions & 1 deletion .github/workflows/deploy-catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- master
- selective-package-download
paths:
- '.github/workflows/deploy-catalog.yaml'
- 'catalog/**'
Expand Down
1 change: 1 addition & 0 deletions catalog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ where verb is one of

## Changes

- [Changed] Show stack release version in footer ([#4200](https://github.com/quiltdata/quilt/pull/4200))
- [Added] Selective package downloading ([#4173](https://github.com/quiltdata/quilt/pull/4173))
- [Added] Qurator Omni: initial public release ([#4032](https://github.com/quiltdata/quilt/pull/4032), [#4181](https://github.com/quiltdata/quilt/pull/4181))
- [Added] Admin: UI for configuring longitudinal queries (Tabulator) ([#4135](https://github.com/quiltdata/quilt/pull/4135), [#4164](https://github.com/quiltdata/quilt/pull/4164), [#4165](https://github.com/quiltdata/quilt/pull/4165))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import * as URLS from 'constants/urls'
import * as Notifications from 'containers/Notifications'
import * as CatalogSettings from 'utils/CatalogSettings'
import HashLink from 'utils/HashLink'
import * as NamedRoutes from 'utils/NamedRoutes'
import copyToClipboard from 'utils/clipboard'

Expand All @@ -36,42 +35,50 @@
const classes = useVersionStyles()
const { push } = Notifications.use()
const handleCopy = React.useCallback(() => {
copyToClipboard(process.env.REVISION_HASH)
copyToClipboard(cfg.stackVersion)

Check warning on line 38 in catalog/app/components/Footer/Footer.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Footer/Footer.tsx#L38

Added line #L38 was not covered by tests
push('Web catalog container hash has been copied to clipboard')
}, [push])
return (
<div>
<M.Typography
className={classes.revision}
onClick={handleCopy}
title="Copy product revision hash to clipboard"
variant="caption"
>
Revision: {process.env.REVISION_HASH.substring(0, 8)}
</M.Typography>
</div>
<M.Typography
className={classes.revision}
onClick={handleCopy}
title="Copy Platform release version to clipboard"
variant="caption"
>
Version: {cfg.stackVersion}
</M.Typography>
)
}

const FooterLogo = () => <Logo height="29px" width="76.5px" />

const NavLink = (props) => (
<M.Link
variant="button"
underline="none"
color="textPrimary"
component={props.to ? HashLink : undefined}
{...props}
/>
const NavLink = (props: M.LinkProps) => (

Check warning on line 55 in catalog/app/components/Footer/Footer.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Footer/Footer.tsx#L55

Added line #L55 was not covered by tests
<M.Link variant="button" underline="none" color="textPrimary" {...props} />
)

const NavSpacer = () => <M.Box ml={{ xs: 2, sm: 3 }} />

const NavIcon = ({ icon, ...props }) => (
<M.Box component="a" {...props}>
<M.Box component="img" height={18} src={icon} alt="" display="block" />
</M.Box>
)
const useNavIconStyles = M.makeStyles({

Check warning on line 61 in catalog/app/components/Footer/Footer.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Footer/Footer.tsx#L61

Added line #L61 was not covered by tests
root: {
display: 'block',
height: '18px',
},
})

interface NavIconProps extends M.BoxProps {
href: string
icon: string
target: string
}

const NavIcon = ({ icon, ...props }: NavIconProps) => {
const classes = useNavIconStyles()
return (

Check warning on line 76 in catalog/app/components/Footer/Footer.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Footer/Footer.tsx#L74-L76

Added lines #L74 - L76 were not covered by tests
<M.Box component="a" {...props}>
<img className={classes.root} src={icon} alt="" />
</M.Box>
)
}

const useStyles = M.makeStyles((t) => ({
root: {
Expand All @@ -80,7 +87,7 @@
'0px -12px 24px 0px rgba(25, 22, 59, 0.05)',
'0px -16px 40px 0px rgba(25, 22, 59, 0.07)',
'0px -24px 88px 0px rgba(25, 22, 59, 0.16)',
],
].join(', '),
height: 230,
paddingTop: t.spacing(6),
position: 'relative',
Expand Down Expand Up @@ -114,6 +121,9 @@
`,
},
},
logoLink: {
display: 'block',
},
}))

export default function Footer() {
Expand All @@ -137,9 +147,9 @@
<FooterLogo />
</a>
) : (
<M.Box component={Link} to={urls.home()} display="block">
<Link className={classes.logoLink} to={urls.home()}>

Check warning on line 150 in catalog/app/components/Footer/Footer.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/components/Footer/Footer.tsx#L150

Added line #L150 was not covered by tests
<FooterLogo />
</M.Box>
</Link>
)}
</M.Box>

Expand Down
2 changes: 1 addition & 1 deletion catalog/app/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function Layout({ bare = false, dark = false, children, pre }: LayoutProp
{!!pre && pre}
{!!children && <M.Box p={4}>{children}</M.Box>}
<M.Box flexGrow={1} />
{!!isHomepage && isHomepage.isExact && <Footer />}
{isHomepage?.isExact && <Footer />}
{bookmarks && <Bookmarks.Sidebar bookmarks={bookmarks} bucket={bucket} />}
</NavBar.Provider>
</Root>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PT from 'prop-types'
import React from 'react'
import * as M from '@material-ui/core'

Expand All @@ -8,7 +7,24 @@
},
}))

export default function Notification({ id, ttl, message, action, dismiss }) {
interface NotificationProps {
id: string
ttl?: number | null
message: React.ReactNode
action: {
onClick: () => void
label: React.ReactNode
}
dismiss: (id: string) => void
}

export default function Notification({
id,
ttl,
message,
action,
dismiss,
}: NotificationProps) {

Check warning on line 27 in catalog/app/containers/Notifications/Notification.tsx

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Notifications/Notification.tsx#L21-L27

Added lines #L21 - L27 were not covered by tests
const classes = useStyles()

const handleClose = React.useCallback(() => dismiss(id), [dismiss, id])
Expand Down Expand Up @@ -40,14 +56,3 @@
/>
)
}

Notification.propTypes = {
id: PT.string.isRequired,
ttl: PT.oneOf([null, PT.number.isRequired]),
message: PT.node.isRequired,
action: PT.shape({
label: PT.string.isRequired,
onClick: PT.func.isRequired,
}),
dismiss: PT.func.isRequired,
}
1 change: 1 addition & 0 deletions catalog/app/utils/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface ConfigJson {
qurator?: boolean

build_version?: string // not sure where this comes from
stackVersion: string
fiskus marked this conversation as resolved.
Show resolved Hide resolved
}

const ajv = new Ajv({ allErrors: true, removeAdditional: true })
Expand Down
4 changes: 1 addition & 3 deletions catalog/app/utils/Sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import * as Sentry from '@sentry/react'
import * as AuthSelectors from 'containers/Auth/selectors'
import type { Config } from 'utils/Config'

const RELEASE = `catalog@${process.env.REVISION_HASH}`

export function init(cfg: Config, history?: History) {
if (!cfg.sentryDSN) return false

Sentry.init({
dsn: cfg.sentryDSN,
release: RELEASE,
release: cfg.stackVersion,
environment: process.env.NODE_ENV === 'development' ? 'dev' : 'prod',
integrations: [
history
Expand Down
2 changes: 1 addition & 1 deletion catalog/app/utils/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function TrackingProvider({ userSelector, children }) {
origin: window.location.origin,
location,
user,
catalog_release: process.env.REVISION_HASH,
catalog_release: cfg.stackVersion,
}),
[location, user],
)
Expand Down
4 changes: 4 additions & 0 deletions catalog/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@
"qurator": {
"type": "boolean",
"description": "Enable Qurator AI Assistant (powered by Amazon Bedrock)"
},
"stackVersion": {
"type": "string",
"description": "Stack release version"
}
},
"required": [
fiskus marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
3 changes: 2 additions & 1 deletion catalog/config.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"serviceBucket": "${SERVICE_BUCKET}",
"mode": "${CATALOG_MODE}",
"chunkedChecksums": ${CHUNKED_CHECKSUMS},
"qurator": ${QURATOR}
"qurator": ${QURATOR},
"stackVersion": "${STACK_VERSION}"
fiskus marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 0 additions & 4 deletions catalog/internals/webpack/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const { execSync } = require('child_process')

const revisionHash = execSync('git rev-parse HEAD').toString()

class RevertPathOverwriteByPerspective {
apply(compiler) {
Expand Down Expand Up @@ -144,7 +141,6 @@ module.exports = (options) => ({
// NODE_ENV is exposed automatically based on the "mode" option
new webpack.EnvironmentPlugin({
LOGGER_REDUX: process.env.LOGGER_REDUX || 'enabled',
REVISION_HASH: revisionHash,
}),

new webpack.ProvidePlugin({
Expand Down