-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12009 from influxdata/feat/login-version
feat(ui): Display version on login page
- Loading branch information
Showing
8 changed files
with
120 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
VersionInfo | ||
----------------------------------------------------------------------------- | ||
*/ | ||
|
||
@import 'src/style/modules'; | ||
|
||
.version-info { | ||
border-radius: 0 0 $ix-radius $ix-radius; | ||
color: $g9-mountain; | ||
background-color: mix($g3-castle, $g2-kevlar, 50%); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Libraries | ||
import React from 'react' | ||
import {shallow} from 'enzyme' | ||
|
||
// Components | ||
import VersionInfo from 'src/shared/components/VersionInfo' | ||
|
||
const setup = (override = {}) => { | ||
const props = { | ||
...override, | ||
} | ||
|
||
const wrapper = shallow(<VersionInfo {...props} />) | ||
|
||
return {wrapper} | ||
} | ||
|
||
describe('VersionInfo', () => { | ||
it('renders correctly', () => { | ||
const {wrapper} = setup() | ||
|
||
expect(wrapper.exists()).toBe(true) | ||
expect(wrapper).toMatchSnapshot() | ||
}) | ||
|
||
describe('when width is specified', () => { | ||
it('renders corectly', () => { | ||
const {wrapper} = setup({widthPixels: 300}) | ||
|
||
expect(wrapper.exists()).toBe(true) | ||
expect(wrapper).toMatchSnapshot() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Libraries | ||
import React, {PureComponent} from 'react' | ||
|
||
// Constants | ||
import {VERSION, GIT_SHA} from 'src/shared/constants' | ||
|
||
// Styles | ||
import 'src/shared/components/VersionInfo.scss' | ||
|
||
interface Props { | ||
widthPixels?: number | ||
} | ||
|
||
class VersionInfo extends PureComponent<Props> { | ||
public render() { | ||
return ( | ||
<div className="version-info" style={this.style}> | ||
<p> | ||
Version {VERSION} {GIT_SHA && <code>({GIT_SHA.slice(0, 7)})</code>} | ||
</p> | ||
</div> | ||
) | ||
} | ||
|
||
private get style() { | ||
if (this.props.widthPixels) { | ||
return {width: `${this.props.widthPixels}px`} | ||
} | ||
} | ||
} | ||
|
||
export default VersionInfo |
30 changes: 30 additions & 0 deletions
30
ui/src/shared/components/__snapshots__/VersionInfo.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`VersionInfo renders correctly 1`] = ` | ||
<div | ||
className="version-info" | ||
> | ||
<p> | ||
Version | ||
2.0.0 | ||
</p> | ||
</div> | ||
`; | ||
|
||
exports[`VersionInfo when width is specified renders corectly 1`] = ` | ||
<div | ||
className="version-info" | ||
style={ | ||
Object { | ||
"width": "300px", | ||
} | ||
} | ||
> | ||
<p> | ||
Version | ||
2.0.0 | ||
</p> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters