Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
177f3d0
Completely remove Beats card
Oct 13, 2021
040a728
Added `category` for easily adding integration links and checking for…
Oct 13, 2021
3ea65dc
Example of simplified use in Security
Oct 13, 2021
03e8113
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 14, 2021
171f889
fix links and titles to cards
snide Oct 14, 2021
ac836c4
empty state card updates. change add data to add integrations
snide Oct 14, 2021
28c1fa3
analytics copy
snide Oct 14, 2021
6384a1a
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 14, 2021
7abd79f
feedback
snide Oct 14, 2021
9336c01
more link and test cleanup
snide Oct 14, 2021
20066a8
clean up the tutorial views and hide notices and tabs
snide Oct 14, 2021
3133485
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 14, 2021
d237571
jest
snide Oct 15, 2021
e061a7a
point to obs APM agents
snide Oct 15, 2021
b85ec15
i18n and other test fixes
snide Oct 15, 2021
013cf67
remove tests no longer needed
snide Oct 15, 2021
877d4ec
more consistant copy
snide Oct 15, 2021
cc0aecc
Merge remote-tracking branch 'upstream/master' into integrations/upda…
joshdover Oct 15, 2021
c58a8fa
fix jest tests mock
snide Oct 15, 2021
273552a
address feedback
snide Oct 15, 2021
1a34739
feedback
snide Oct 15, 2021
bd68272
Merge branch 'master' into integrations/update_links_and_permissions
kibanamachine Oct 18, 2021
961b599
remove data tutorial tests since tabs no longer exist
snide Oct 18, 2021
8b5b576
remove directory notice components
snide Oct 18, 2021
73d0e09
i18n fixes
snide Oct 18, 2021
c219990
a11 hack
snide Oct 18, 2021
a3a7125
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 18, 2021
9142b85
screenreader rather than hack
snide Oct 18, 2021
c99e038
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 18, 2021
54d9fb6
fix fleet/integrations link
snide Oct 18, 2021
9b052f0
Merge remote-tracking branch 'upstream/master' into integrations/upda…
snide Oct 18, 2021
50cd954
Disable welcome interstitial if no integrations access
joshdover Oct 18, 2021
6b9e641
Remove add data list view
joshdover Oct 18, 2021
605a703
Fix breadcrumbs in add data views
joshdover Oct 18, 2021
1667d1c
Add redirects from old add data views to integrations app
joshdover Oct 18, 2021
5abd0c8
Fix full page refreshes on Solution empty states
joshdover Oct 18, 2021
46c7fb0
Merge branch 'integrations/dover-fixes' of https://github.com/joshdov…
thomasneirynck Oct 19, 2021
4c26457
Merge branch 'master' of github.com:elastic/kibana into joshdover-int…
thomasneirynck Oct 19, 2021
fabaac2
remove unused translations
thomasneirynck Oct 19, 2021
4c69e46
Fix tests and address feedback
joshdover Oct 19, 2021
c129787
Merge remote-tracking branch 'upstream/master' into integrations/dove…
joshdover Oct 19, 2021
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

Large diffs are not rendered by default.

26 changes: 22 additions & 4 deletions src/plugins/home/public/application/components/home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { Home } from './home';

import { FeatureCatalogueCategory } from '../../services';
import { telemetryPluginMock } from '../../../../telemetry/public/mocks';
import { Welcome } from './welcome';

let mockHasIntegrationsPermission = true;
jest.mock('../kibana_services', () => ({
getServices: () => ({
getBasePath: () => 'path',
Expand All @@ -22,6 +24,13 @@ jest.mock('../kibana_services', () => ({
chrome: {
setBreadcrumbs: () => {},
},
application: {
capabilities: {
navLinks: {
integrations: mockHasIntegrationsPermission,
},
},
},
}),
}));

Expand All @@ -35,6 +44,7 @@ describe('home', () => {
let defaultProps: HomeProps;

beforeEach(() => {
mockHasIntegrationsPermission = true;
defaultProps = {
directories: [],
solutions: [],
Expand Down Expand Up @@ -182,7 +192,7 @@ describe('home', () => {

expect(defaultProps.localStorage.getItem).toHaveBeenCalledTimes(1);

expect(component).toMatchSnapshot();
expect(component.find(Welcome).exists()).toBe(true);
});

test('stores skip welcome setting if skipped', async () => {
Expand All @@ -196,7 +206,7 @@ describe('home', () => {

expect(defaultProps.localStorage.setItem).toHaveBeenCalledWith('home:welcome:show', 'false');

expect(component).toMatchSnapshot();
expect(component.find(Welcome).exists()).toBe(false);
});

test('should show the normal home page if loading fails', async () => {
Expand All @@ -205,15 +215,23 @@ describe('home', () => {
const hasUserIndexPattern = jest.fn(() => Promise.reject('Doh!'));
const component = await renderHome({ hasUserIndexPattern });

expect(component).toMatchSnapshot();
expect(component.find(Welcome).exists()).toBe(false);
});

test('should show the normal home page if welcome screen is disabled locally', async () => {
defaultProps.localStorage.getItem = jest.fn(() => 'false');

const component = await renderHome();

expect(component).toMatchSnapshot();
expect(component.find(Welcome).exists()).toBe(false);
});

test("should show the normal home page if user doesn't have access to integrations", async () => {
mockHasIntegrationsPermission = false;

const component = await renderHome();

expect(component.find(Welcome).exists()).toBe(false);
});
});

Expand Down
8 changes: 4 additions & 4 deletions src/plugins/home/public/application/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export class Home extends Component<HomeProps, State> {
constructor(props: HomeProps) {
super(props);

const isWelcomeEnabled = !(
getServices().homeConfig.disableWelcomeScreen ||
props.localStorage.getItem(KEY_ENABLE_WELCOME) === 'false'
);
const isWelcomeEnabled =
!getServices().homeConfig.disableWelcomeScreen &&
getServices().application.capabilities.navLinks.integrations &&
props.localStorage.getItem(KEY_ENABLE_WELCOME) !== 'false';

const body = document.querySelector('body')!;
body.classList.add('isHomPage');
Expand Down
12 changes: 11 additions & 1 deletion src/plugins/home/public/application/components/home_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import { getTutorial } from '../load_tutorials';
import { replaceTemplateStrings } from './tutorial/replace_template_strings';
import { getServices } from '../kibana_services';

const REDIRECT_TO_INTEGRATIONS_TAB_IDS = ['all', 'logging', 'metrics', 'security'];

export function HomeApp({ directories, solutions }) {
const {
application,
savedObjectsClient,
getBasePath,
addBasePath,
Expand All @@ -30,10 +33,17 @@ export function HomeApp({ directories, solutions }) {
const isCloudEnabled = environment.cloud;

const renderTutorialDirectory = (props) => {
// Redirect to integrations app unless a specific tab that is still supported was specified.
const tabId = props.match.params.tab;
if (!tabId || REDIRECT_TO_INTEGRATIONS_TAB_IDS.includes(tabId)) {
application.navigateToApp('integrations', { replace: true });
return null;
}
Comment thread
joshdover marked this conversation as resolved.

return (
<TutorialDirectory
addBasePath={addBasePath}
openTab={props.match.params.tab}
openTab={tabId}
isCloudEnabled={isCloudEnabled}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ const INSTRUCTIONS_TYPE = {
ON_PREM_ELASTIC_CLOUD: 'onPremElasticCloud',
};

const homeTitle = i18n.translate('home.breadcrumbs.homeTitle', { defaultMessage: 'Home' });
const addDataTitle = i18n.translate('home.breadcrumbs.addDataTitle', {
defaultMessage: 'Add data',
const integrationsTitle = i18n.translate('home.breadcrumbs.integrationsAppTitle', {
defaultMessage: 'Integrations',
});

class TutorialUi extends React.Component {
Expand Down Expand Up @@ -80,12 +79,8 @@ class TutorialUi extends React.Component {

getServices().chrome.setBreadcrumbs([
{
text: homeTitle,
href: '#/',
},
{
text: addDataTitle,
href: '#/tutorial_directory',
text: integrationsTitle,
href: this.props.addBasePath('/app/integrations/browse'),
},
{
text: tutorial ? tutorial.name : this.props.tutorialId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import { getServices } from '../kibana_services';
import { KibanaPageTemplate } from '../../../../kibana_react/public';
import { getTutorials } from '../load_tutorials';

const ALL_TAB_ID = 'all';
const SAMPLE_DATA_TAB_ID = 'sampleData';

const homeTitle = i18n.translate('home.breadcrumbs.homeTitle', { defaultMessage: 'Home' });
const addDataTitle = i18n.translate('home.breadcrumbs.addDataTitle', {
defaultMessage: 'Add data',
const integrationsTitle = i18n.translate('home.breadcrumbs.integrationsAppTitle', {
defaultMessage: 'Integrations',
});

class TutorialDirectoryUi extends React.Component {
Expand All @@ -48,7 +46,7 @@ class TutorialDirectoryUi extends React.Component {
})),
];

let openTab = ALL_TAB_ID;
let openTab = SAMPLE_DATA_TAB_ID;
if (
props.openTab &&
this.tabs.some((tab) => {
Expand All @@ -72,10 +70,9 @@ class TutorialDirectoryUi extends React.Component {

getServices().chrome.setBreadcrumbs([
{
text: homeTitle,
href: '#/',
text: integrationsTitle,
href: this.props.addBasePath(`/app/integrations/browse`),
},
{ text: addDataTitle },
]);

const tutorialConfigs = await getTutorials();
Expand Down Expand Up @@ -155,6 +152,15 @@ class TutorialDirectoryUi extends React.Component {
renderTabContent = () => {
const tab = this.tabs.find(({ id }) => id === this.state.selectedTabId);
if (tab?.content) {
getServices().chrome.setBreadcrumbs([
{
text: integrationsTitle,
href: this.props.addBasePath(`/app/integrations/browse`),
},
{
text: tab.name,
},
]);
return tab.content;
}

Expand All @@ -163,7 +169,7 @@ class TutorialDirectoryUi extends React.Component {
{this.state.tutorialCards
.filter((tutorial) => {
return (
this.state.selectedTabId === ALL_TAB_ID ||
this.state.selectedTabId === SAMPLE_DATA_TAB_ID ||
this.state.selectedTabId === tutorial.category
);
})
Expand Down
Loading