From 9c65a705a3eb9565abd0ce53b1ccb502375d369f Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Sat, 12 Jun 2021 16:15:18 +0200 Subject: [PATCH] LandingPage: Include link to current commit on GitHub --- config/dev.webpack.config.js | 6 +++++ config/prod.webpack.config.js | 6 +++++ config/test.webpack.config.js | 27 ----------------------- package.json | 4 ++++ src/Components/LandingPage/LandingPage.js | 15 ++++++++++++- 5 files changed, 30 insertions(+), 28 deletions(-) delete mode 100644 config/test.webpack.config.js diff --git a/config/dev.webpack.config.js b/config/dev.webpack.config.js index aaf7355b..5c4fc38d 100644 --- a/config/dev.webpack.config.js +++ b/config/dev.webpack.config.js @@ -1,4 +1,6 @@ +const { DefinePlugin } = require('webpack'); const { resolve } = require('path'); +const { GitRevisionPlugin } = require('git-revision-webpack-plugin'); const config = require('@redhat-cloud-services/frontend-components-config'); const { config: webpackConfig, plugins } = config({ rootFolder: resolve(__dirname, '../'), @@ -19,6 +21,10 @@ plugins.push( }) ); +plugins.push(new DefinePlugin({ + COMMITHASH: JSON.stringify((new GitRevisionPlugin()).commithash()), +})); + module.exports = { ...webpackConfig, plugins diff --git a/config/prod.webpack.config.js b/config/prod.webpack.config.js index 1bd9007e..8d53e092 100644 --- a/config/prod.webpack.config.js +++ b/config/prod.webpack.config.js @@ -1,4 +1,6 @@ +const { DefinePlugin } = require('webpack'); const { resolve } = require('path'); +const { GitRevisionPlugin } = require('git-revision-webpack-plugin'); const config = require('@redhat-cloud-services/frontend-components-config'); const { config: webpackConfig, plugins } = config({ rootFolder: resolve(__dirname, '../'), @@ -15,6 +17,10 @@ plugins.push( }) ); +plugins.push(new DefinePlugin({ + COMMITHASH: JSON.stringify((new GitRevisionPlugin()).commithash()), +})); + module.exports = { ...webpackConfig, plugins diff --git a/config/test.webpack.config.js b/config/test.webpack.config.js deleted file mode 100644 index 355b0e90..00000000 --- a/config/test.webpack.config.js +++ /dev/null @@ -1,27 +0,0 @@ -const { resolve } = require('path'); -const config = require('@redhat-cloud-services/frontend-components-config'); -const { config: webpackConfig, plugins } = config({ - rootFolder: resolve(__dirname, '../'), - debug: true, - port: 8002, - useFileHash: false, - skipChrome2: false, -}); - -console.log('CONFIG', config); - -plugins.push( - require('@redhat-cloud-services/frontend-components-config/federated-modules')({ - root: resolve(__dirname, '../'), - useFileHash: false, - moduleName: 'image_builder', - exposes: { - './RootApp': resolve(__dirname, '../src/AppEntry.js'), - }, - }) -); - -module.exports = { - ...webpackConfig, - plugins -}; diff --git a/package.json b/package.json index cdecab27..3151974b 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,9 @@ "!src/**/stories/*", "!src/entry-dev.js" ], + "globals": { + "COMMITHASH": "dummy" + }, "roots": [ "/src/" ], @@ -59,6 +62,7 @@ "eslint-plugin-jest-dom": "3.2.4", "eslint-plugin-react": "7.18.3", "eslint-plugin-testing-library": "3.10.0", + "git-revision-webpack-plugin": "5.0.0", "identity-obj-proxy": "3.0.0", "jest": "26.1.0", "npm-run-all": "4.1.5", diff --git a/src/Components/LandingPage/LandingPage.js b/src/Components/LandingPage/LandingPage.js index 23239349..87c8f2c4 100644 --- a/src/Components/LandingPage/LandingPage.js +++ b/src/Components/LandingPage/LandingPage.js @@ -1,10 +1,12 @@ +/* global COMMITHASH */ + import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; import { PageHeader, PageHeaderTitle } from '@redhat-cloud-services/frontend-components'; import { Button, Popover, TextContent, Text } from '@patternfly/react-core'; -import { ExternalLinkAltIcon, HelpIcon } from '@patternfly/react-icons'; +import { ExternalLinkAltIcon, GithubIcon, HelpIcon } from '@patternfly/react-icons'; import ImagesTable from '../ImagesTable/ImagesTable'; import './LandingPage.scss'; @@ -38,6 +40,17 @@ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/up "> Documentation +
+ }>