diff --git a/packages/console/package.json b/packages/console/package.json index b7e08bc16..25a04b341 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -1,6 +1,6 @@ { "name": "@flyteorg/console", - "version": "0.0.11", + "version": "0.0.12", "description": "Flyteconsole main app module", "main": "./dist/index.js", "module": "./lib/index.js", diff --git a/packages/console/src/components/Navigation/DefaultAppBarContent.tsx b/packages/console/src/components/Navigation/DefaultAppBarContent.tsx index 1b1bb1550..452a73460 100644 --- a/packages/console/src/components/Navigation/DefaultAppBarContent.tsx +++ b/packages/console/src/components/Navigation/DefaultAppBarContent.tsx @@ -1,9 +1,9 @@ +import * as React from 'react'; import { makeStyles, Theme } from '@material-ui/core/styles'; import classnames from 'classnames'; import { AppInfo, VersionInfo } from '@flyteorg/components'; import { FlyteLogo } from '@flyteorg/ui-atoms'; import { useCommonStyles } from 'components/common/styles'; -import * as React from 'react'; import { Link } from 'react-router-dom'; import { Routes } from 'routes/routes'; import { FeatureFlag, useFeatureFlag } from 'basics/FeatureFlags'; @@ -15,8 +15,6 @@ import { OnlyMine } from './OnlyMine'; import { FlyteNavItem } from './utils'; import t, { patternKey } from './strings'; -const { version: platformVersion } = require('../../../package.json'); - const useStyles = makeStyles((theme: Theme) => ({ spacer: { flexGrow: 1, @@ -33,6 +31,8 @@ interface DefaultAppBarProps { /** Renders the default content for the app bar, which is the logo and help links */ export const DefaultAppBarContent = (props: DefaultAppBarProps) => { + const [platformVersion, setPlatformVersion] = React.useState(''); + const [consoleVersion, setConsoleVersion] = React.useState(''); const commonStyles = useCommonStyles(); const styles = useStyles(); @@ -40,12 +40,28 @@ export const DefaultAppBarContent = (props: DefaultAppBarProps) => { const { adminVersion } = useAdminVersion(); const isGAEnabled = env.ENABLE_GA === 'true' && env.GA_TRACKING_ID !== ''; + React.useEffect(() => { + try { + const { version } = require('../../../../../website/package.json'); + const { version: packageVersion } = require('../../../package.json'); + + setPlatformVersion(version); + setConsoleVersion(packageVersion); + } catch { + /* no-op */ + } + }, []); const versions: VersionInfo[] = [ { name: t('versionConsoleUi'), version: platformVersion, url: `https://github.com/flyteorg/flyteconsole/releases/tag/v${platformVersion}`, }, + { + name: t('versionConsolePackage'), + version: consoleVersion, + url: `https://github.com/flyteorg/flyteconsole/tree/master/packages/console`, + }, { name: t('versionAdmin'), version: adminVersion, @@ -81,3 +97,5 @@ export const DefaultAppBarContent = (props: DefaultAppBarProps) => { > ); }; + +export default DefaultAppBarContent; diff --git a/packages/console/src/components/Navigation/NavBar.tsx b/packages/console/src/components/Navigation/NavBar.tsx index 4316699b9..8bb17ef96 100644 --- a/packages/console/src/components/Navigation/NavBar.tsx +++ b/packages/console/src/components/Navigation/NavBar.tsx @@ -1,11 +1,9 @@ +import * as React from 'react'; +import { Suspense, lazy } from 'react'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import { navBarContentId } from 'common/constants'; -import { COLOR_SPECTRUM } from 'components/Theme/colorSpectrum'; -import { whiteColor } from 'components/Theme/constants'; import { FlyteNavigation } from '@flyteorg/common'; -import * as React from 'react'; -import { DefaultAppBarContent } from './DefaultAppBarContent'; import { getFlyteNavigationData } from './utils'; export interface NavBarProps { @@ -13,16 +11,20 @@ export interface NavBarProps { navigationData?: FlyteNavigation; } +const DefaultAppBarContent = lazy(() => import('./DefaultAppBarContent')); + /** Contains all content in the top navbar of the application. */ export const NavBar = (props: NavBarProps) => { const navData = props.navigationData ?? getFlyteNavigationData(); const content = props.useCustomContent ? (
) : ( -