feat(lite): show version in UI (#5844)

This commit is contained in:
Pierre Donias
2021-07-15 16:02:08 +02:00
parent cf642cd720
commit 17c4b5cbe7
2 changed files with 10 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import Cookies from 'js-cookie'
import React from 'react'
import styled from 'styled-components'
import { IntlProvider } from 'react-intl'
import { HashRouter as Router, Switch, Route, Link } from 'react-router-dom'
import { Map } from 'immutable'
@@ -14,6 +15,13 @@ import StyleGuide from './StyleGuide/index'
import TabConsole from './TabConsole'
import XapiConnection, { ObjectsByType, Vm } from '../libs/xapi'
const Version = styled.div`
position: fixed;
right: 0;
bottom: 0;
opacity: .5;
`
interface ParentState {
objectsByType: ObjectsByType
xapi: XapiConnection
@@ -147,6 +155,7 @@ const App = withState<State, Props, Effects, Computed, ParentState, ParentEffect
</Router>
</>
)}
<Version>v{process.env.NPM_VERSION}</Version>
</IntlProvider>
)
)

View File

@@ -58,7 +58,7 @@ module.exports = {
template: resolveApp('public/index.html'),
favicon: resolveApp('public/favicon.ico'),
}),
new webpack.EnvironmentPlugin({ XAPI_HOST: '' }),
new webpack.EnvironmentPlugin({ XAPI_HOST: '', NPM_VERSION: require('./package.json').version }),
new (require('node-polyfill-webpack-plugin'))(),
].filter(Boolean),
}