Skip to content

Commit

Permalink
Merge pull request #12843 from influxdata/feat/export-copy-button
Browse files Browse the repository at this point in the history
Add copy button to export overlays
  • Loading branch information
ischolten authored Mar 22, 2019
2 parents 8196a00 + 95b005e commit 9277a76
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 562 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
1. [12706](https://github.com/influxdata/influxdb/pull/12706): Add ability to add variable to script from the side menu.
1. [12791](https://github.com/influxdata/influxdb/pull/12791): Use time range for metaqueries in Data Explorer and Cell Editor Overlay
1. [12827](https://github.com/influxdata/influxdb/pull/12827): Fix screen tearing bug in Raw Data View
1. [12843](https://github.com/influxdata/influxdb/pull/12843): Add copy to clipboard button to export overlays

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class VerifyCollectorStep extends PureComponent<Props> {
const {
telegrafConfigID,
bucket,
notify,
org,
onDecrementCurrentStepIndex,
onExit,
Expand All @@ -53,7 +52,6 @@ export class VerifyCollectorStep extends PureComponent<Props> {
</div>
<DataStreaming
org={org}
notify={notify}
bucket={bucket}
token={token}
configID={telegrafConfigID}
Expand Down
12 changes: 2 additions & 10 deletions ui/src/dataLoaders/components/verifyStep/DataStreaming.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import DataListening from 'src/dataLoaders/components/verifyStep/DataListening'
// Decorator
import {ErrorHandling} from 'src/shared/decorators/errors'

// Types
import {NotificationAction} from 'src/types'

interface Props {
notify: NotificationAction
bucket: string
org: string
configID: string
Expand All @@ -23,15 +19,11 @@ interface Props {
@ErrorHandling
class DataStreaming extends PureComponent<Props> {
public render() {
const {token, configID, bucket, notify} = this.props
const {token, configID, bucket} = this.props

return (
<div className="streaming">
<TelegrafInstructions
notify={notify}
token={token}
configID={configID}
/>
<TelegrafInstructions token={token} configID={configID} />

<DataListening bucket={bucket} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ let wrapper

const setup = (override = {}) => {
const props = {
notify: jest.fn(),
token: '',
configID: '',
...override,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
// Components
import CodeSnippet from 'src/shared/components/CodeSnippet'

// Types
import {NotificationAction} from 'src/types'

export interface Props {
notify: NotificationAction
token: string
configID: string
}

@ErrorHandling
class TelegrafInstructions extends PureComponent<Props> {
public render() {
const {notify, token, configID} = this.props
const {token, configID} = this.props
const exportToken = `export INFLUX_TOKEN=${token || ''}`
const configScript = `telegraf --config ${
this.origin
Expand All @@ -46,13 +42,13 @@ class TelegrafInstructions extends PureComponent<Props> {
copy the following command to your terminal window to set an
environment variable with your token.
</p>
<CodeSnippet copyText={exportToken} notify={notify} label="CLI" />
<CodeSnippet copyText={exportToken} label="CLI" />
<h6>3. Start Telegraf</h6>
<p>
Finally, you can run the following command to start the Telegraf agent
running on your machine.
</p>
<CodeSnippet copyText={configScript} notify={notify} label="CLI" />
<CodeSnippet copyText={configScript} label="CLI" />
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ exports[`TelegrafInstructions matches snapshot 1`] = `
<CodeSnippet
copyText="export INFLUX_TOKEN="
label="CLI"
notify={[MockFunction]}
/>
<h6>
3. Start Telegraf
Expand All @@ -39,7 +38,6 @@ exports[`TelegrafInstructions matches snapshot 1`] = `
<CodeSnippet
copyText="telegraf --config http://localhost/api/v2/telegrafs/"
label="CLI"
notify={[MockFunction]}
/>
</div>
`;
4 changes: 2 additions & 2 deletions ui/src/me/components/account/ViewTokenOverlay.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Libraries
import React from 'react'
import {mount} from 'enzyme'
import {shallow} from 'enzyme'

// Components
import ViewTokenOverlay from 'src/me/components/account/ViewTokenOverlay'
Expand All @@ -14,7 +14,7 @@ const setup = (override?) => {
...override,
}

const wrapper = mount(<ViewTokenOverlay {...props} />)
const wrapper = shallow(<ViewTokenOverlay {...props} />)

return {wrapper}
}
Expand Down
3 changes: 1 addition & 2 deletions ui/src/me/components/account/ViewTokenOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ interface Props {
export default class ViewTokenOverlay extends PureComponent<Props> {
public render() {
const {description} = this.props.auth
const {onNotify} = this.props

const permissions = this.permissions

return (
<Overlay.Container>
<Overlay.Heading title={description} onDismiss={this.handleDismiss} />
<Overlay.Body>
<CodeSnippet copyText={this.props.auth.token} notify={onNotify} />
<CodeSnippet copyText={this.props.auth.token} />
<PermissionsWidget
mode={PermissionsWidgetMode.Read}
heightPixels={500}
Expand Down
Loading

0 comments on commit 9277a76

Please sign in to comment.