diff --git a/ui/src/onboarding/components/OnboardingSideBar.tsx b/ui/src/onboarding/components/OnboardingSideBar.tsx
index 7e88b5916c..fb479b831a 100644
--- a/ui/src/onboarding/components/OnboardingSideBar.tsx
+++ b/ui/src/onboarding/components/OnboardingSideBar.tsx
@@ -84,7 +84,7 @@ class OnboardingSideBar extends Component
{
)
}
- private get streamingButton(): JSX.Element {
+ private get addSourceButton(): JSX.Element {
const {onNewSourceClick} = this.props
return (
@@ -104,9 +104,9 @@ class OnboardingSideBar extends Component {
const {telegrafConfigID} = this.props
if (telegrafConfigID) {
- return [this.downloadButton, this.streamingButton]
+ return [this.downloadButton, this.addSourceButton]
}
- return [this.streamingButton]
+ return [this.addSourceButton]
}
private handleDownload = async () => {
diff --git a/ui/src/onboarding/components/__snapshots__/AdminStep.test.tsx.snap b/ui/src/onboarding/components/__snapshots__/AdminStep.test.tsx.snap
new file mode 100644
index 0000000000..9f8d225c6d
--- /dev/null
+++ b/ui/src/onboarding/components/__snapshots__/AdminStep.test.tsx.snap
@@ -0,0 +1,158 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Onboarding.Components.AdminStep renders 1`] = `
+
+
+ Setup Admin User
+
+
+ You will be able to create additional Users, Buckets and Organizations later
+
+
+
+
+
+
+
+`;
diff --git a/ui/src/onboarding/components/__snapshots__/CompletionStep.test.tsx.snap b/ui/src/onboarding/components/__snapshots__/CompletionStep.test.tsx.snap
new file mode 100644
index 0000000000..4344950f9f
--- /dev/null
+++ b/ui/src/onboarding/components/__snapshots__/CompletionStep.test.tsx.snap
@@ -0,0 +1,43 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Onboarding.Components.CompletionStep renders 1`] = `
+
+
+
+ Setup Complete!
+
+
+
+
+
+
+
+`;
diff --git a/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.test.tsx b/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.test.tsx
new file mode 100644
index 0000000000..db7473dbfe
--- /dev/null
+++ b/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.test.tsx
@@ -0,0 +1,177 @@
+// Libraries
+import React from 'react'
+import {shallow} from 'enzyme'
+
+// Components
+import {ConfigureDataSourceStep} from 'src/onboarding/components/configureStep/ConfigureDataSourceStep'
+import ConfigureDataSourceSwitcher from 'src/onboarding/components/configureStep/ConfigureDataSourceSwitcher'
+import {Button} from 'src/clockface'
+
+// Types
+import {DataLoaderType} from 'src/types/v2/dataLoaders'
+
+// Dummy Data
+import {
+ defaultOnboardingStepProps,
+ cpuTelegrafPlugin,
+ redisTelegrafPlugin,
+ diskTelegrafPlugin,
+} from 'mocks/dummyData'
+
+const setup = (override = {}) => {
+ const props = {
+ ...defaultOnboardingStepProps,
+ telegrafPlugins: [],
+ onSetActiveTelegrafPlugin: jest.fn(),
+ onUpdateTelegrafPluginConfig: jest.fn(),
+ onSetPluginConfiguration: jest.fn(),
+ type: DataLoaderType.Empty,
+ onAddConfigValue: jest.fn(),
+ onRemoveConfigValue: jest.fn(),
+ onSaveTelegrafConfig: jest.fn(),
+ authToken: '',
+ params: {
+ stepID: '3',
+ substepID: '0',
+ },
+ location: null,
+ router: null,
+ routes: [],
+ ...override,
+ }
+
+ return shallow()
+}
+
+describe('Onboarding.Components.ConfigureStep.ConfigureDataSourceStep', () => {
+ it('renders switcher and buttons', async () => {
+ const wrapper = setup()
+ const switcher = wrapper.find(ConfigureDataSourceSwitcher)
+ const buttons = wrapper.find(Button)
+
+ expect(wrapper.exists()).toBe(true)
+ expect(switcher.exists()).toBe(true)
+ expect(buttons.length).toBe(3)
+ })
+
+ describe('if type is not streaming', () => {
+ it('renders back and next buttons with correct text', () => {
+ const wrapper = setup({type: DataLoaderType.LineProtocol})
+ const backButton = wrapper.find('[data-test="back"]')
+ const nextButton = wrapper.find('[data-test="next"]')
+
+ expect(backButton.prop('text')).toBe('Back to Select Data Source Type')
+ expect(nextButton.prop('text')).toBe('Continue to Verify')
+ })
+ })
+
+ describe('if type is streaming', () => {
+ describe('if the substep is 0', () => {
+ it('renders back button with correct text', () => {
+ const wrapper = setup({
+ type: DataLoaderType.Streaming,
+ params: {stepID: '3', substepID: '0'},
+ })
+ const backButton = wrapper.find('[data-test="back"]')
+
+ expect(backButton.prop('text')).toBe('Back to Select Streaming Sources')
+ })
+
+ describe('when the back button is clicked', () => {
+ it('calls prop functions as expected', () => {
+ const onSetActiveTelegrafPlugin = jest.fn()
+ const onSetSubstepIndex = jest.fn()
+ const wrapper = setup({
+ type: DataLoaderType.Streaming,
+ telegrafPlugins: [cpuTelegrafPlugin],
+ params: {stepID: '3', substepID: '0'},
+ onSetActiveTelegrafPlugin,
+ onSetSubstepIndex,
+ })
+ const backButton = wrapper.find('[data-test="back"]')
+ backButton.simulate('click')
+
+ expect(onSetSubstepIndex).toBeCalledWith(2, 'streaming')
+ })
+ })
+ })
+
+ describe('if its the last stubstep', () => {
+ it('renders the next button with correct text', () => {
+ const wrapper = setup({
+ type: DataLoaderType.Streaming,
+ telegrafPlugins: [cpuTelegrafPlugin],
+ params: {stepID: '3', substepID: '1'},
+ })
+ const nextButton = wrapper.find('[data-test="next"]')
+
+ expect(nextButton.prop('text')).toBe('Continue to Verify')
+ })
+ })
+
+ describe('if its the neither the last or firt stubstep', () => {
+ it('renders the next and back buttons with correct text', () => {
+ const wrapper = setup({
+ type: DataLoaderType.Streaming,
+ telegrafPlugins: [
+ cpuTelegrafPlugin,
+ redisTelegrafPlugin,
+ diskTelegrafPlugin,
+ ],
+ params: {stepID: '3', substepID: '1'},
+ })
+ const nextButton = wrapper.find('[data-test="next"]')
+ const backButton = wrapper.find('[data-test="back"]')
+
+ expect(nextButton.prop('text')).toBe('Continue to Disk')
+ expect(backButton.prop('text')).toBe('Back to Cpu')
+ })
+
+ describe('when the back button is clicked', () => {
+ it('calls prop functions as expected', () => {
+ const onSetActiveTelegrafPlugin = jest.fn()
+ const onSetSubstepIndex = jest.fn()
+ const wrapper = setup({
+ type: DataLoaderType.Streaming,
+ telegrafPlugins: [
+ cpuTelegrafPlugin,
+ redisTelegrafPlugin,
+ diskTelegrafPlugin,
+ ],
+ params: {stepID: '3', substepID: '1'},
+ onSetActiveTelegrafPlugin,
+ onSetSubstepIndex,
+ })
+ const backButton = wrapper.find('[data-test="back"]')
+ backButton.simulate('click')
+
+ expect(onSetActiveTelegrafPlugin).toBeCalledWith('cpu')
+ expect(onSetSubstepIndex).toBeCalledWith(3, 0)
+ })
+ })
+
+ describe('when the next button is clicked', () => {
+ it('calls prop functions as expected', () => {
+ const onSetActiveTelegrafPlugin = jest.fn()
+ const onSetSubstepIndex = jest.fn()
+ const wrapper = setup({
+ type: DataLoaderType.Streaming,
+ telegrafPlugins: [
+ cpuTelegrafPlugin,
+ redisTelegrafPlugin,
+ diskTelegrafPlugin,
+ ],
+ params: {stepID: '3', substepID: '1'},
+ onSetActiveTelegrafPlugin,
+ onSetSubstepIndex,
+ })
+ const nextButton = wrapper.find('[data-test="next"]')
+ nextButton.simulate('click')
+
+ expect(onSetActiveTelegrafPlugin).toBeCalledWith('disk')
+ expect(onSetSubstepIndex).toBeCalledWith(3, 2)
+ })
+ })
+ })
+ })
+})
diff --git a/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.tsx b/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.tsx
index 3bcbddafae..16a8874cee 100644
--- a/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.tsx
+++ b/ui/src/onboarding/components/configureStep/ConfigureDataSourceStep.tsx
@@ -60,7 +60,7 @@ interface RouterProps {
type Props = OwnProps & WithRouterProps & RouterProps
@ErrorHandling
-class ConfigureDataSourceStep extends PureComponent {
+export class ConfigureDataSourceStep extends PureComponent {
constructor(props: Props) {
super(props)
}
@@ -108,17 +108,19 @@ class ConfigureDataSourceStep extends PureComponent {
{this.skipLink}
@@ -127,6 +129,48 @@ class ConfigureDataSourceStep extends PureComponent {
)
}
+ private get nextButtonText(): string {
+ const {
+ telegrafPlugins,
+ params: {substepID},
+ type,
+ } = this.props
+
+ const index = +substepID
+
+ if (type === DataLoaderType.Streaming) {
+ if (index + 1 > telegrafPlugins.length - 1) {
+ return 'Continue to Verify'
+ }
+ return `Continue to ${_.startCase(
+ _.get(telegrafPlugins, `${index + 1}.name`)
+ )}`
+ }
+
+ return 'Continue to Verify'
+ }
+
+ private get backButtonText(): string {
+ const {
+ telegrafPlugins,
+ params: {substepID},
+ type,
+ } = this.props
+
+ const index = +substepID
+
+ if (type === DataLoaderType.Streaming) {
+ if (index < 1) {
+ return 'Back to Select Streaming Sources'
+ }
+ return `Back to ${_.startCase(
+ _.get(telegrafPlugins, `${index - 1}.name`)
+ )}`
+ }
+
+ return 'Back to Select Data Source Type'
+ }
+
private get skipLink() {
return (