Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): Display version on login page #12009

Merged
merged 1 commit into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features
1. [11954](https://github.com/influxdata/influxdb/pull/11954): Add the ability to run a task manually from tasks page
1. [11990](https://github.com/influxdata/influxdb/pull/11990): Add the ability to select a custom time range in explorer and dashboard
1. [12009](https://github.com/influxdata/influxdb/pull/12009): Display the version information on the login page

### Bug Fixes

Expand Down
9 changes: 2 additions & 7 deletions ui/src/me/components/Resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import OrgsList from 'src/me/components/OrgsList'
import DashboardsList from 'src/me/components/DashboardsList'
import ResourceFetcher from 'src/shared/components/resource_fetcher'
import {Panel, SpinnerContainer, TechnoSpinner} from 'src/clockface'

// Constants
import {VERSION, GIT_SHA} from 'src/shared/constants'
import VersionInfo from 'src/shared/components/VersionInfo'

// APIs
import {getDashboards} from 'src/organizations/apis'
Expand Down Expand Up @@ -82,10 +80,7 @@ class ResourceLists extends PureComponent<Props> {
<Support />
</Panel.Body>
<Panel.Footer>
<p>
Version {VERSION}{' '}
{GIT_SHA && <code>({GIT_SHA.slice(0, 7)})</code>}
</p>
<VersionInfo />
</Panel.Footer>
</Panel>
</>
Expand Down
2 changes: 2 additions & 0 deletions ui/src/onboarding/containers/SigninPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import SigninForm from 'src/onboarding/components/SigninForm'
import {SpinnerContainer, TechnoSpinner} from 'src/clockface'
import {RemoteDataState} from 'src/types'
import Notifications from 'src/shared/components/notifications/Notifications'
import VersionInfo from 'src/shared/components/VersionInfo'

interface State {
status: RemoteDataState
Expand Down Expand Up @@ -50,6 +51,7 @@ class SigninPage extends PureComponent<WithRouterProps, State> {
<SplashPage.Header title="InfluxData" />
<SigninForm />
</SplashPage.Panel>
<VersionInfo widthPixels={300} />
</SplashPage>
</SpinnerContainer>
)
Expand Down
12 changes: 12 additions & 0 deletions ui/src/shared/components/VersionInfo.scss
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%);
}
34 changes: 34 additions & 0 deletions ui/src/shared/components/VersionInfo.test.tsx
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()
})
})
})
32 changes: 32 additions & 0 deletions ui/src/shared/components/VersionInfo.tsx
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 ui/src/shared/components/__snapshots__/VersionInfo.test.tsx.snap
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>
`;
8 changes: 7 additions & 1 deletion ui/src/shared/components/splash_page/SplashPage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
@include custom-scrollbar($g3-castle, $c-pool);
@include gradient-v($g3-castle, $g0-obsidian);
padding: $sidebar--width;

.version-info {
text-align: center;
padding: $ix-marg-b $ix-marg-b * 2;
}
}

.auth-image {
Expand Down Expand Up @@ -190,10 +195,11 @@


.auth-panel {
border-radius: $radius;
border-radius: $radius $radius 0 0;
background-color: $g3-castle;
padding: 32px;
text-align: center;

}

.auth-heading {
Expand Down