Skip to content

Commit

Permalink
Merge branch 'main' of github.com:elastic/kibana into implement/ftr-c…
Browse files Browse the repository at this point in the history
…cs-support
  • Loading branch information
spalger committed Mar 4, 2022
2 parents f5f675e + 9514e6b commit b561d19
Show file tree
Hide file tree
Showing 22 changed files with 228 additions and 137 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/add-to-imui-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Add to Infra Monitoring UI project
on:
issues:
types:
- labeled
jobs:
add_to_project:
runs-on: ubuntu-latest
if: |
contains(github.event.issue.labels.*.name, 'Team:Infra Monitoring UI') ||
contains(github.event.issue.labels.*.name, 'Feature:Stack Monitoring') ||
contains(github.event.issue.labels.*.name, 'Feature:Logs UI') ||
contains(github.event.issue.labels.*.name, 'Feature:Metrics UI')
steps:
- uses: octokit/graphql-action@v2.x
id: add_to_project
with:
headers: '{"GraphQL-Features": "projects_next_graphql"}'
query: |
mutation add_to_project($projectid:ID!,$contentid:ID!) {
addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
projectNextItem {
id
}
}
}
projectid: ${{ env.PROJECT_ID }}
contentid: ${{ github.event.issue.node_id }}
env:
PROJECT_ID: "PN_kwDOAGc3Zs1EEA"
GITHUB_TOKEN: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}
4 changes: 1 addition & 3 deletions .github/workflows/project-assigner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
{"label": "Feature:Canvas", "projectNumber": 38, "columnName": "Inbox"},
{"label": "Feature:Dashboard", "projectNumber": 68, "columnName": "Inbox"},
{"label": "Feature:Drilldowns", "projectNumber": 68, "columnName": "Inbox"},
{"label": "Feature:Input Controls", "projectNumber": 72, "columnName": "Inbox"},
{"label": "Team:Security", "projectNumber": 320, "columnName": "Awaiting triage", "projectScope": "org"},
{"label": "Team:Operations", "projectNumber": 314, "columnName": "Triage", "projectScope": "org"}
{"label": "Feature:Input Controls", "projectNumber": 72, "columnName": "Inbox"}
]
ghToken: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}
14 changes: 5 additions & 9 deletions src/core/server/ui_settings/settings/date_formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const getDateFormatSettings = (): Record<string, UiSettingsParams> => {
}),
value: 'MMM D, YYYY @ HH:mm:ss.SSS',
description: i18n.translate('core.ui_settings.params.dateFormatText', {
defaultMessage: 'When displaying a pretty formatted date, use this {formatLink}',
defaultMessage: 'The {formatLink} for pretty formatted dates.',
description:
'Part of composite text: core.ui_settings.params.dateFormatText + ' +
'core.ui_settings.params.dateFormat.optionsLinkText',
Expand All @@ -48,15 +48,11 @@ export const getDateFormatSettings = (): Record<string, UiSettingsParams> => {
},
'dateFormat:tz': {
name: i18n.translate('core.ui_settings.params.dateFormat.timezoneTitle', {
defaultMessage: 'Timezone for date formatting',
defaultMessage: 'Time zone',
}),
value: 'Browser',
description: i18n.translate('core.ui_settings.params.dateFormat.timezoneText', {
defaultMessage:
'Which timezone should be used. {defaultOption} will use the timezone detected by your browser.',
values: {
defaultOption: '"Browser"',
},
defaultMessage: 'The default time zone.',
}),
type: 'select',
options: timezones,
Expand Down Expand Up @@ -115,7 +111,7 @@ export const getDateFormatSettings = (): Record<string, UiSettingsParams> => {
}),
value: defaultWeekday,
description: i18n.translate('core.ui_settings.params.dateFormat.dayOfWeekText', {
defaultMessage: 'What day should weeks start on?',
defaultMessage: 'The day that starts the week.',
}),
type: 'select',
options: weekdays,
Expand All @@ -141,7 +137,7 @@ export const getDateFormatSettings = (): Record<string, UiSettingsParams> => {
}),
value: 'MMM D, YYYY @ HH:mm:ss.SSSSSSSSS',
description: i18n.translate('core.ui_settings.params.dateNanosFormatText', {
defaultMessage: 'Used for the {dateNanosLink} datatype of Elasticsearch',
defaultMessage: 'The format for {dateNanosLink} data.',
values: {
dateNanosLink:
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/date_nanos.html" target="_blank" rel="noopener noreferrer">' +
Expand Down
85 changes: 46 additions & 39 deletions src/plugins/dashboard/public/application/top_nav/editor_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export const EditorMenu = ({ dashboardContainer, createNewVisType }: Props) => {
};

const getEmbeddableFactoryMenuItem = (
factory: EmbeddableFactoryDefinition
factory: EmbeddableFactoryDefinition,
closePopover: () => void
): EuiContextMenuPanelItemDescriptor => {
const icon = factory?.getIconType ? factory.getIconType() : 'empty';

Expand All @@ -164,6 +165,7 @@ export const EditorMenu = ({ dashboardContainer, createNewVisType }: Props) => {
icon,
toolTipContent,
onClick: async () => {
closePopover();
if (trackUiMetric) {
trackUiMetric(METRIC_TYPE.CLICK, factory.type);
}
Expand Down Expand Up @@ -192,42 +194,47 @@ export const EditorMenu = ({ dashboardContainer, createNewVisType }: Props) => {
defaultMessage: 'Aggregation based',
});

const editorMenuPanels = [
{
id: 0,
items: [
...visTypeAliases.map(getVisTypeAliasMenuItem),
...Object.values(factoryGroupMap).map(({ id, appName, icon, panelId }) => ({
name: appName,
icon,
panel: panelId,
'data-test-subj': `dashboardEditorMenu-${id}Group`,
})),
...ungroupedFactories.map(getEmbeddableFactoryMenuItem),
...promotedVisTypes.map(getVisTypeMenuItem),
{
name: aggsPanelTitle,
icon: 'visualizeApp',
panel: aggBasedPanelID,
'data-test-subj': `dashboardEditorAggBasedMenuItem`,
},
...toolVisTypes.map(getVisTypeMenuItem),
],
},
{
id: aggBasedPanelID,
title: aggsPanelTitle,
items: aggsBasedVisTypes.map(getVisTypeMenuItem),
},
...Object.values(factoryGroupMap).map(
({ appName, panelId, factories: groupFactories }: FactoryGroup) => ({
id: panelId,
title: appName,
items: groupFactories.map(getEmbeddableFactoryMenuItem),
})
),
];

const getEditorMenuPanels = (closePopover: () => void) => {
return [
{
id: 0,
items: [
...visTypeAliases.map(getVisTypeAliasMenuItem),
...Object.values(factoryGroupMap).map(({ id, appName, icon, panelId }) => ({
name: appName,
icon,
panel: panelId,
'data-test-subj': `dashboardEditorMenu-${id}Group`,
})),
...ungroupedFactories.map((factory) => {
return getEmbeddableFactoryMenuItem(factory, closePopover);
}),
...promotedVisTypes.map(getVisTypeMenuItem),
{
name: aggsPanelTitle,
icon: 'visualizeApp',
panel: aggBasedPanelID,
'data-test-subj': `dashboardEditorAggBasedMenuItem`,
},
...toolVisTypes.map(getVisTypeMenuItem),
],
},
{
id: aggBasedPanelID,
title: aggsPanelTitle,
items: aggsBasedVisTypes.map(getVisTypeMenuItem),
},
...Object.values(factoryGroupMap).map(
({ appName, panelId, factories: groupFactories }: FactoryGroup) => ({
id: panelId,
title: appName,
items: groupFactories.map((factory) => {
return getEmbeddableFactoryMenuItem(factory, closePopover);
}),
})
),
];
};
return (
<SolutionToolbarPopover
ownFocus
Expand All @@ -239,10 +246,10 @@ export const EditorMenu = ({ dashboardContainer, createNewVisType }: Props) => {
panelPaddingSize="none"
data-test-subj="dashboardEditorMenuButton"
>
{() => (
{({ closePopover }: { closePopover: () => void }) => (
<EuiContextMenu
initialPanelId={0}
panels={editorMenuPanels}
panels={getEditorMenuPanels(closePopover)}
className={`dshSolutionToolbar__editorContextMenu ${
IS_DARK_THEME
? 'dshSolutionToolbar__editorContextMenu--dark'
Expand Down
16 changes: 14 additions & 2 deletions test/functional/apps/dashboard/create_and_add_embeddables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
});

it('ensure toolbar popover closes on add', async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.preserveCrossAppState();
await PageObjects.dashboard.loadSavedDashboard('few panels');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.switchToEditMode();
await dashboardAddPanel.clickEditorMenuButton();
await dashboardAddPanel.clickAddNewEmbeddableLink('LOG_STREAM_EMBEDDABLE');
await dashboardAddPanel.expectEditorMenuClosed();
});

describe('add new visualization link', () => {
before(async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.preserveCrossAppState();
await PageObjects.dashboard.loadSavedDashboard('few panels');
});

it('adds new visualization via the top nav link', async () => {
const originalPanelCount = await PageObjects.dashboard.getPanelCount();
await PageObjects.dashboard.switchToEditMode();
Expand Down
5 changes: 5 additions & 0 deletions test/functional/services/dashboard/add_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export class DashboardAddPanelService extends FtrService {
async clickEditorMenuButton() {
this.log.debug('DashboardAddPanel.clickEditorMenuButton');
await this.testSubjects.click('dashboardEditorMenuButton');
await this.testSubjects.existOrFail('dashboardEditorContextMenu');
}

async expectEditorMenuClosed() {
await this.testSubjects.missingOrFail('dashboardEditorContextMenu');
}

async clickAggBasedVisualizations() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ import { loginAndWaitForPageWithoutDateRange } from '../../tasks/login';

import { CASES_URL } from '../../urls/navigation';

describe('Cases', () => {
// Flaky: https://github.com/elastic/kibana/issues/69847
describe.skip('Cases', () => {
beforeEach(() => {
cleanKibana();
createTimeline(getCase1().timeline).then((response) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { loginAndWaitForPageWithoutDateRange } from '../../tasks/login';

import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation';

describe('Export rules', () => {
// Flaky https://github.com/elastic/kibana/issues/69849
describe.skip('Export rules', () => {
beforeEach(() => {
cleanKibana();
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ describe('Events Viewer', () => {

it('resets all fields in the events viewer when `Reset Fields` is clicked', () => {
const filterInput = 'host.geo.c';

filterFieldsBrowser(filterInput);
cy.get(HOST_GEO_COUNTRY_NAME_HEADER).should('not.exist');
addsHostGeoCountryNameToHeader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import { loginAndWaitForPage } from '../../tasks/login';
import { openTimelineUsingToggle } from '../../tasks/security_main';
import { openTimelineFieldsBrowser, populateTimeline } from '../../tasks/timeline';
import { ecsFieldMap } from '../../../../rule_registry/common/assets/field_maps/ecs_field_map';

import { HOSTS_URL } from '../../urls/navigation';

Expand Down Expand Up @@ -109,7 +110,27 @@ describe('Fields Browser', () => {

filterFieldsBrowser(filterInput);

cy.get(FIELDS_BROWSER_SELECTED_CATEGORY_COUNT).should('have.text', '5');
const fieldsThatMatchFilterInput = Object.keys(ecsFieldMap).filter((fieldName) => {
const dotDelimitedFieldParts = fieldName.split('.');
const fieldPartMatch = dotDelimitedFieldParts.filter((fieldPart) => {
const camelCasedStringsMatching = fieldPart
.split('_')
.some((part) => part.startsWith(filterInput));
if (fieldPart.startsWith(filterInput)) {
return true;
} else if (camelCasedStringsMatching) {
return true;
} else {
return false;
}
});
return fieldName.startsWith(filterInput) || fieldPartMatch.length > 0;
}).length;

cy.get(FIELDS_BROWSER_SELECTED_CATEGORY_COUNT).should(
'have.text',
fieldsThatMatchFilterInput
);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { waitsForEventsToBeLoaded } from '../../tasks/hosts/events';
import { removeColumn } from '../../tasks/timeline';

// TODO: Fix bug in persisting the columns of timeline
describe('persistent timeline', () => {
describe.skip('persistent timeline', () => {
beforeEach(() => {
cleanKibana();
loginAndWaitForPage(HOSTS_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export const changeRowsPerPageTo = (rowsCount: number) => {
cy.get(PAGINATION_POPOVER_BTN).click({ force: true });
cy.get(rowsPerPageSelector(rowsCount))
.pipe(($el) => $el.trigger('click'))
.should('not.be.visible');
.should('not.exist');
};

export const changeRowsPerPageTo100 = () => {
Expand Down
13 changes: 10 additions & 3 deletions x-pack/plugins/security_solution/cypress/tasks/fields_browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,24 @@ export const addsHostGeoContinentNameToTimeline = () => {
};

export const clearFieldsBrowser = () => {
cy.clock();
cy.get(FIELDS_BROWSER_FILTER_INPUT).type('{selectall}{backspace}');
cy.wait(0);
cy.tick(1000);
};

export const closeFieldsBrowser = () => {
cy.get(CLOSE_BTN).click({ force: true });
cy.get(FIELDS_BROWSER_FILTER_INPUT).should('not.exist');
};

export const filterFieldsBrowser = (fieldName: string) => {
cy.get(FIELDS_BROWSER_FILTER_INPUT)
.type(fieldName)
.should('not.have.class', 'euiFieldSearch-isLoading');
cy.clock();
cy.get(FIELDS_BROWSER_FILTER_INPUT).type(fieldName, { delay: 50 });
cy.wait(0);
cy.tick(1000);
// the text filter is debounced by 250 ms, wait 1s for changes to be applied
cy.get(FIELDS_BROWSER_FILTER_INPUT).should('not.have.class', 'euiFieldSearch-isLoading');
};

export const removesMessageField = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ export const FieldBrowserWrappedComponent = (props: FieldBrowserWrappedComponent
return (
<Provider store={store}>
<I18nProvider>
<StatefulFieldsBrowser
data-test-ref="steph-loves-this-fields-browser"
{...fieldsBrowseProps}
/>
<StatefulFieldsBrowser {...fieldsBrowseProps} />
</I18nProvider>
</Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const testProps = {
browserFields: mockBrowserFields,
filteredBrowserFields: mockBrowserFields,
searchInput: '',
appliedFilterInput: '',
isSearching: false,
onCategorySelected: jest.fn(),
onHide,
Expand Down Expand Up @@ -84,6 +85,7 @@ describe('FieldsBrowser', () => {
browserFields={mockBrowserFields}
filteredBrowserFields={mockBrowserFields}
searchInput={''}
appliedFilterInput={''}
isSearching={false}
onCategorySelected={jest.fn()}
onHide={jest.fn()}
Expand Down
Loading

0 comments on commit b561d19

Please sign in to comment.