Display frontend version (#3105)

* add git-revision-webpack-plugin

* configure git-revision-webpack-plugin

* add commit to footer

* rename version and commit to backendVersion and frontendVersion

* rename version and commit to backendVersion and frontendVersion

* disable lint error due to use of globals

* fix snapshot test

* read frontend version from VERSION file instead latest git revision

* directly require from version.json file instead of going through WebPack's DefinePlugin

* run snapshots
This commit is contained in:
Omer Lachish 2018-11-29 14:24:23 +02:00 committed by Arik Fraimovich
parent ecb8a5c244
commit 92728de04c
5 changed files with 11 additions and 3 deletions

View File

@ -3,3 +3,4 @@ VERSION=$(jq -r .version package.json)
FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM FULL_VERSION=$VERSION+b$CIRCLE_BUILD_NUM
sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '$FULL_VERSION'/" redash/__init__.py sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '$FULL_VERSION'/" redash/__init__.py
sed -i "s/dev/$CIRCLE_SHA1/" client/app/version.json

View File

@ -3,8 +3,10 @@ import PropTypes from 'prop-types';
import { react2angular } from 'react2angular'; import { react2angular } from 'react2angular';
import frontendVersion from '../version.json';
export function Footer({ clientConfig, currentUser }) { export function Footer({ clientConfig, currentUser }) {
const version = clientConfig.version; const backendVersion = clientConfig.version;
const newVersionAvailable = clientConfig.newVersionAvailable && currentUser.isAdmin; const newVersionAvailable = clientConfig.newVersionAvailable && currentUser.isAdmin;
const separator = ' \u2022 '; const separator = ' \u2022 ';
@ -19,7 +21,7 @@ export function Footer({ clientConfig, currentUser }) {
return ( return (
<div id="footer"> <div id="footer">
<a href="https://redash.io">Redash</a> {version} <a href="https://redash.io">Redash</a> {backendVersion} ({frontendVersion})
{newVersionString} {newVersionString}
{separator} {separator}
<a href="https://redash.io/help/">Documentation</a> <a href="https://redash.io/help/">Documentation</a>

View File

@ -11,6 +11,9 @@ exports[`Footer renders 1`] = `
</a> </a>
5.0.1 5.0.1
(
dev
)
<small> <small>
<a <a
href="https://version.redash.io/" href="https://version.redash.io/"

1
client/app/version.json Normal file
View File

@ -0,0 +1 @@
"dev"

View File

@ -10,6 +10,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
const LessPluginAutoPrefix = require("less-plugin-autoprefix"); const LessPluginAutoPrefix = require("less-plugin-autoprefix");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer") const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin; .BundleAnalyzerPlugin;
const path = require("path"); const path = require("path");
const isProduction = process.env.NODE_ENV === "production"; const isProduction = process.env.NODE_ENV === "production";