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

[Fleet] Swap Fleet Server tabs to EuiButtonGroup #132274

Merged
merged 3 commits into from
May 17, 2022
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
10 changes: 9 additions & 1 deletion x-pack/plugins/fleet/cypress/integration/fleet_startup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ describe('Fleet startup', () => {
cy.getBySel('fleetServerFlyoutTab-advanced').click();
cy.getBySel('createFleetServerPolicyBtn').click();

// Wait until the success callout is shown before navigating away
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure how these cypress tests were working before these changes, but they should be good now.

cy.getBySel('agentPolicyCreateStatusCallOut')
.should('exist')
.and('have.class', 'euiCallOut--success');

// verify policy is created and has fleet server and system package
verifyPolicy('Fleet Server policy 1', ['Fleet Server', 'System']);

Expand All @@ -90,7 +95,10 @@ describe('Fleet startup', () => {
cy.getBySel('agentPolicyDropdown');

// verify fleet server enroll command contains created policy id
cy.getBySel('fleetServerHostInput').type('https://localhost:8220');
cy.getBySel('fleetServerHostInput')
.getBySel('comboBoxSearchInput')
.type('https://localhost:8220');

cy.getBySel('fleetServerAddHostBtn').click();
cy.getBySel('fleetServerGenerateServiceTokenBtn').click();
cy.get('.euiCodeBlock__code').contains('--fleet-server-policy=fleet-server-policy');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

import React, { useState } from 'react';
import {
EuiButtonGroup,
EuiFlexGroup,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutHeader,
EuiLink,
EuiSpacer,
EuiTab,
EuiTabs,
EuiText,
EuiTitle,
} from '@elastic/eui';
Expand All @@ -41,14 +40,16 @@ const useFleetServerTabs = () => {

const quickStartTab = {
id: 'quickStart',
name: 'Quick Start',
label: 'Quick Start',
content: <QuickStartTab />,
'data-test-subj': 'fleetServerFlyoutTab-quickStart',
};

const advancedTab = {
id: 'advanced',
name: 'Advanced',
label: 'Advanced',
content: <AdvancedTab />,
'data-test-subj': 'fleetServerFlyoutTab-advanced',
};

const currentTabContent =
Expand All @@ -60,7 +61,7 @@ const useFleetServerTabs = () => {
const Header: React.FunctionComponent<{
isFlyout?: boolean;
currentTab: string;
tabs: Array<{ id: string; name: string; content: React.ReactNode }>;
tabs: Array<{ id: string; label: string; content: React.ReactNode }>;
onTabClick: (id: string) => void;
}> = ({ isFlyout = false, currentTab: currentTabId, tabs, onTabClick }) => {
const { docLinks } = useStartServices();
Expand Down Expand Up @@ -99,21 +100,16 @@ const Header: React.FunctionComponent<{
/>
</EuiText>

<EuiSpacer size="m" />
<EuiSpacer size="xl" />

<EuiTabs style={{ marginBottom: isFlyout ? '-25px' : '' }}>
{tabs.map((tab) => (
<EuiTab
key={`fleetServerFlyoutTab-${tab.id}`}
data-test-subj={`fleetServerFlyoutTab-${tab.id}`}
id={tab.id}
isSelected={tab.id === currentTabId}
onClick={() => onTabClick(tab.id)}
>
{tab.name}
</EuiTab>
))}
</EuiTabs>
<EuiButtonGroup
legend="Fleet Server instructions"
isFullWidth
options={tabs}
idSelected={currentTabId}
onChange={(id) => onTabClick(id)}
style={{ maxWidth: '500px' }}
/>
</>
);
};
Expand Down