diff --git a/apps/koku-ui-hccm/build_deploy.sh b/.archive/build_deploy.sh similarity index 100% rename from apps/koku-ui-hccm/build_deploy.sh rename to .archive/build_deploy.sh diff --git a/apps/koku-ui-hccm/pr_check.sh b/.archive/pr_check.sh similarity index 100% rename from apps/koku-ui-hccm/pr_check.sh rename to .archive/pr_check.sh diff --git a/apps/koku-ui-hccm/fec.config.js b/apps/koku-ui-hccm/fec.config.js index 8a4a17cde..a032a56a4 100644 --- a/apps/koku-ui-hccm/fec.config.js +++ b/apps/koku-ui-hccm/fec.config.js @@ -1,6 +1,7 @@ // Based on https://github.com/RedHatInsights/frontend-components/blob/master/packages/config/src/bin/dev.webpack.config.ts const CopyWebpackPlugin = require('copy-webpack-plugin'); +const { GitRevisionPlugin } = require('git-revision-webpack-plugin'); const path = require('path'); const webpack = require('webpack'); const { dependencies, insights } = require('./package.json'); @@ -14,6 +15,7 @@ const stats = { colors: true, modules: false, }; +const gitRevisionPlugin = new GitRevisionPlugin(); // Show what files changed since last compilation class WatchRunPlugin { @@ -85,6 +87,11 @@ module.exports = { }, ], }), + gitRevisionPlugin, + new webpack.DefinePlugin({ + 'process.env.COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()), + 'process.env.BRANCH': JSON.stringify(gitRevisionPlugin.branch()), + }), ], resolve: { modules: [srcDir, path.resolve(__dirname, '../../node_modules')], diff --git a/apps/koku-ui-hccm/package.json b/apps/koku-ui-hccm/package.json index 30846caca..85000afd7 100644 --- a/apps/koku-ui-hccm/package.json +++ b/apps/koku-ui-hccm/package.json @@ -115,6 +115,7 @@ "@types/react-redux": "^7.1.34", "@types/react-router-dom": "^5.3.3", "copy-webpack-plugin": "^13.0.1", + "git-revision-webpack-plugin": "^5.0.0", "globals": "^16.5.0", "identity-obj-proxy": "^3.0.0", "ts-patch": "^3.3.0", diff --git a/apps/koku-ui-hccm/src/app.tsx b/apps/koku-ui-hccm/src/app.tsx index cd587cae6..65f0e9293 100644 --- a/apps/koku-ui-hccm/src/app.tsx +++ b/apps/koku-ui-hccm/src/app.tsx @@ -1,5 +1,6 @@ import './app.scss'; +import UiVersion from '@koku-ui/ui-lib/components/page/uiVersion'; import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'; import NotificationsProvider from '@redhat-cloud-services/frontend-components-notifications/NotificationsProvider'; import { createStore } from '@redhat-cloud-services/frontend-components-notifications/state'; @@ -37,6 +38,7 @@ const App = () => { + ); }; diff --git a/apps/koku-ui-hccm/src/routes.tsx b/apps/koku-ui-hccm/src/routes.tsx index 52b51c0da..92a3bf992 100644 --- a/apps/koku-ui-hccm/src/routes.tsx +++ b/apps/koku-ui-hccm/src/routes.tsx @@ -3,7 +3,7 @@ import { userAccess } from 'components/userAccess'; import React, { lazy, Suspense } from 'react'; import { Route, Routes as RouterRoutes } from 'react-router-dom'; -const NotFound = lazy(() => import(/* webpackChunkName: "NotFound" */ '@koku-ui/ui-lib/components/NotFound/NotFound')); +const NotFound = lazy(() => import(/* webpackChunkName: "NotFound" */ '@koku-ui/ui-lib/components/page/notFound')); const AwsBreakdown = lazy(() => import(/* webpackChunkName: "awsBreakdown" */ 'routes/details/awsBreakdown')); const AwsDetails = lazy(() => import(/* webpackChunkName: "awsDetails" */ 'routes/details/awsDetails')); const AzureBreakdown = lazy(() => import(/* webpackChunkName: "azureBreakdown" */ 'routes/details/azureBreakdown')); diff --git a/apps/koku-ui-onprem/src/components/App/App.tsx b/apps/koku-ui-onprem/src/components/App/App.tsx index 276ec0605..526bf2fcd 100644 --- a/apps/koku-ui-onprem/src/components/App/App.tsx +++ b/apps/koku-ui-onprem/src/components/App/App.tsx @@ -1,4 +1,4 @@ -import NotFound from '@koku-ui/ui-lib/components/NotFound/NotFound'; +import NotFound from '@koku-ui/ui-lib/components/page/notFound'; import React from 'react'; import { createBrowserRouter, RouterProvider } from 'react-router-dom'; diff --git a/apps/koku-ui-ros/build_deploy.sh b/apps/koku-ui-ros/build_deploy.sh deleted file mode 100755 index 779d1ee53..000000000 --- a/apps/koku-ui-ros/build_deploy.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# -------------------------------------------- -# Export vars for helper scripts to use -# -------------------------------------------- -# name of app-sre "application" folder this component lives in; needs to match for quay -export COMPONENT="hccm" -# IMAGE should match the quay repo set by app.yaml in app-interface -export IMAGE="quay.io/cloudservices/koku-ui-ros" -export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace -export APP_ROOT=$(pwd) -export NODE_BUILD_VERSION=22 -COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master - -set -exv -# source is preferred to | bash -s in this case to avoid a subshell -source <(curl -sSL $COMMON_BUILDER/src/frontend-build.sh) -BUILD_RESULTS=$? - -# Stubbed out for now -mkdir -p $WORKSPACE/artifacts -cat << EOF > $WORKSPACE/artifacts/junit-dummy.xml - - - -EOF - -# teardown_docker -exit $BUILD_RESULTS diff --git a/apps/koku-ui-ros/fec.config.js b/apps/koku-ui-ros/fec.config.js index ab10394d1..b8e8e1b39 100644 --- a/apps/koku-ui-ros/fec.config.js +++ b/apps/koku-ui-ros/fec.config.js @@ -1,6 +1,7 @@ // Based on https://github.com/RedHatInsights/frontend-components/blob/master/packages/config/src/bin/dev.webpack.config.ts const CopyWebpackPlugin = require('copy-webpack-plugin'); +const { GitRevisionPlugin } = require('git-revision-webpack-plugin'); const path = require('path'); const webpack = require('webpack'); const { dependencies, insights } = require('./package.json'); @@ -14,6 +15,7 @@ const stats = { colors: true, modules: false, }; +const gitRevisionPlugin = new GitRevisionPlugin(); // Show what files changed since last compilation class WatchRunPlugin { @@ -89,6 +91,11 @@ module.exports = { }, ], }), + gitRevisionPlugin, + new webpack.DefinePlugin({ + 'process.env.COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()), + 'process.env.BRANCH': JSON.stringify(gitRevisionPlugin.branch()), + }), ], resolve: { modules: [srcDir, path.resolve(__dirname, '../../node_modules')], diff --git a/apps/koku-ui-ros/package.json b/apps/koku-ui-ros/package.json index 5ce8f18d3..27c1d960a 100644 --- a/apps/koku-ui-ros/package.json +++ b/apps/koku-ui-ros/package.json @@ -110,6 +110,7 @@ "@types/react-router-dom": "^5.3.3", "copy-webpack-plugin": "^13.0.1", "globals": "^16.5.0", + "git-revision-webpack-plugin": "^5.0.0", "identity-obj-proxy": "^3.0.0", "jws": "^4.0.0", "ts-patch": "^3.3.0", diff --git a/apps/koku-ui-ros/pr_check.sh b/apps/koku-ui-ros/pr_check.sh deleted file mode 100755 index e3b4a1900..000000000 --- a/apps/koku-ui-ros/pr_check.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# -------------------------------------------- -# Export vars for helper scripts to use -# -------------------------------------------- -# name of app-sre "application" folder this component lives in; needs to match for quay -export COMPONENT="hccm" -# IMAGE should match the quay repo set by app.yaml in app-interface -export IMAGE="quay.io/cloudservices/koku-ui-ros" -export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace -export APP_ROOT=$(pwd) -export NODE_BUILD_VERSION=22 -COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master - -# -------------------------------------------- -# Options that must be configured by app owner -# -------------------------------------------- -IQE_PLUGINS="hccm" -IQE_MARKER_EXPRESSION="smoke" -IQE_FILTER_EXPRESSION="" - -set -exv -# source is preferred to | bash -s in this case to avoid a subshell -source <(curl -sSL $COMMON_BUILDER/src/frontend-build.sh) -BUILD_RESULTS=$? - -# Stubbed out for now -mkdir -p $WORKSPACE/artifacts -cat << EOF > $WORKSPACE/artifacts/junit-dummy.xml - - - -EOF - -# teardown_docker -exit $BUILD_RESULTS diff --git a/apps/koku-ui-ros/src/app.tsx b/apps/koku-ui-ros/src/app.tsx index cd587cae6..65f0e9293 100644 --- a/apps/koku-ui-ros/src/app.tsx +++ b/apps/koku-ui-ros/src/app.tsx @@ -1,5 +1,6 @@ import './app.scss'; +import UiVersion from '@koku-ui/ui-lib/components/page/uiVersion'; import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'; import NotificationsProvider from '@redhat-cloud-services/frontend-components-notifications/NotificationsProvider'; import { createStore } from '@redhat-cloud-services/frontend-components-notifications/state'; @@ -37,6 +38,7 @@ const App = () => { + ); }; diff --git a/apps/koku-ui-ros/src/fed-modules/optimizationsWrapper.tsx b/apps/koku-ui-ros/src/fed-modules/optimizationsWrapper.tsx index 58957a849..5f6936690 100644 --- a/apps/koku-ui-ros/src/fed-modules/optimizationsWrapper.tsx +++ b/apps/koku-ui-ros/src/fed-modules/optimizationsWrapper.tsx @@ -1,4 +1,5 @@ /* eslint-disable no-console */ +import UiVersion from '@koku-ui/ui-lib/components/page/uiVersion'; import IntlProvider from '@redhat-cloud-services/frontend-components-translations/Provider'; import { getLocale } from 'components/i18n'; import React from 'react'; @@ -7,6 +8,8 @@ import { rosStore } from 'store'; // eslint-disable-next-line no-restricted-imports import messages from '../../locales/data.json'; +// eslint-disable-next-line no-restricted-imports +import pkg from '../../package.json'; export interface OptimizationsWrapperOwnProps { children?: React.ReactNode; @@ -22,6 +25,7 @@ const OptimizationsWrapper: React.FC = ({ children }:
{children}
+
); diff --git a/apps/koku-ui-ros/src/routes.tsx b/apps/koku-ui-ros/src/routes.tsx index 48f662f19..f13346682 100644 --- a/apps/koku-ui-ros/src/routes.tsx +++ b/apps/koku-ui-ros/src/routes.tsx @@ -3,7 +3,7 @@ import { userAccess } from 'components/userAccess'; import React, { lazy, Suspense } from 'react'; import { Route, Routes as RouterRoutes } from 'react-router-dom'; -const NotFound = lazy(() => import(/* webpackChunkName: "NotFound" */ '@koku-ui/ui-lib/components/NotFound/NotFound')); +const NotFound = lazy(() => import(/* webpackChunkName: "NotFound" */ '@koku-ui/ui-lib/components/page/notFound')); const OptimizationsBadgeStaging = lazy( () => import(/* webpackChunkName: "recommendations" */ 'routes/staging/optimizations/optimizationsBadgeStaging') ); diff --git a/libs/ui-lib/src/components/NotFound/NotFound.tsx b/libs/ui-lib/src/components/NotFound/NotFound.tsx deleted file mode 100644 index 7d1241a4d..000000000 --- a/libs/ui-lib/src/components/NotFound/NotFound.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { MissingPage } from '@patternfly/react-component-groups/dist/esm/MissingPage'; -import { Card, CardBody, PageSection } from '@patternfly/react-core'; -import React from 'react'; - -const NotFound = () => { - return ( - - - - - - - - ); -}; - -export default NotFound; diff --git a/apps/koku-ui-hccm/src/routes/components/page/notFound/index.ts b/libs/ui-lib/src/components/page/notFound/index.ts similarity index 100% rename from apps/koku-ui-hccm/src/routes/components/page/notFound/index.ts rename to libs/ui-lib/src/components/page/notFound/index.ts diff --git a/apps/koku-ui-hccm/src/routes/components/page/notFound/notFound.tsx b/libs/ui-lib/src/components/page/notFound/notFound.tsx similarity index 100% rename from apps/koku-ui-hccm/src/routes/components/page/notFound/notFound.tsx rename to libs/ui-lib/src/components/page/notFound/notFound.tsx diff --git a/libs/ui-lib/src/components/page/uiVersion/index.ts b/libs/ui-lib/src/components/page/uiVersion/index.ts new file mode 100644 index 000000000..d7153db4e --- /dev/null +++ b/libs/ui-lib/src/components/page/uiVersion/index.ts @@ -0,0 +1,3 @@ +import UiVersion from './uiVersion'; + +export default UiVersion; diff --git a/libs/ui-lib/src/components/page/uiVersion/uiVersion.tsx b/libs/ui-lib/src/components/page/uiVersion/uiVersion.tsx new file mode 100644 index 000000000..c92515790 --- /dev/null +++ b/libs/ui-lib/src/components/page/uiVersion/uiVersion.tsx @@ -0,0 +1,14 @@ +import React from 'react'; + +interface UiVersionProps { + appName?: string; +} + +const UiVersion = ({ appName = '@koku-ui' }: UiVersionProps) => { + const branch = process.env.BRANCH ?? 'unknown-branch'; + const commithash = process.env.COMMITHASH ?? 'unknown-commithash'; + + return