Skip to content

Commit

Permalink
Merge branch 'main' into telemetry-depending-on-security
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Mar 7, 2022
2 parents 51b02f0 + 7ac8361 commit d15a542
Show file tree
Hide file tree
Showing 32 changed files with 880 additions and 606 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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Update multiple documents at once
<b>Signature:</b>

```typescript
bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<unknown>>;
bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<T>>;
```

## Parameters
Expand All @@ -20,7 +20,7 @@ bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<Saved

<b>Returns:</b>

Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;
Promise&lt;SavedObjectsBatchResponse&lt;T&gt;&gt;

The result of the update operation containing both failed and updated saved objects.

2 changes: 1 addition & 1 deletion src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ export class SavedObjectsClient {
}>) => Promise<{
resolved_objects: ResolvedSimpleSavedObject<T>[];
}>;
bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<unknown>>;
bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<T>>;
create: <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>>;
// Warning: (ae-forgotten-export) The symbol "SavedObjectsDeleteOptions" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "SavedObjectsClientContract" needs to be exported by the entry point index.d.ts
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ export class SavedObjectsClient {
return renameKeys<
PromiseType<ReturnType<SavedObjectsApi['bulkUpdate']>>,
SavedObjectsBatchResponse
>({ saved_objects: 'savedObjects' }, resp) as SavedObjectsBatchResponse;
>({ saved_objects: 'savedObjects' }, resp) as SavedObjectsBatchResponse<T>;
});
}

Expand Down
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
4 changes: 2 additions & 2 deletions test/functional/apps/management/_scripted_fields_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['settings']);

// FLAKY: https://github.com/elastic/kibana/issues/126027
describe.skip('filter scripted fields', function describeIndexTests() {
describe('filter scripted fields', function describeIndexTests() {
before(async function () {
// delete .kibana index and then wait for Kibana to re-create it
await browser.setWindowSize(1200, 800);
Expand Down Expand Up @@ -67,6 +66,7 @@ export default function ({ getService, getPageObjects }) {
expect(lang).to.be('painless');
}
});

await PageObjects.settings.clearScriptedFieldLanguageFilter('painless');

await PageObjects.settings.setScriptedFieldLanguageFilter('expression');
Expand Down
5 changes: 4 additions & 1 deletion test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ export class SettingsPageObject extends FtrService {
}

async setScriptedFieldLanguageFilter(language: string) {
await this.testSubjects.clickWhenNotDisabled('scriptedFieldLanguageFilterDropdown');
await this.retry.try(async () => {
await this.testSubjects.clickWhenNotDisabled('scriptedFieldLanguageFilterDropdown');
return await this.find.byCssSelector('div.euiPopover__panel-isOpen');
});
await this.testSubjects.existOrFail('scriptedFieldLanguageFilterDropdown-popover');
await this.testSubjects.existOrFail(`scriptedFieldLanguageFilterDropdown-option-${language}`);
await this.testSubjects.click(`scriptedFieldLanguageFilterDropdown-option-${language}`);
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 @@ -150,6 +150,7 @@ export function SavedViewsToolbarControls<ViewState>(props: Props<ViewState>) {
data-test-subj="savedViews-openPopover"
iconType="arrowDown"
iconSide="right"
color="text"
>
{currentView
? currentView.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { useCallback, useState, useEffect } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty, EuiSpacer } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/common';
import { useUiTracker } from '../../../../../../observability/public';
import { useWaffleOptionsContext } from '../hooks/use_waffle_options';
Expand Down Expand Up @@ -57,17 +57,6 @@ export const BottomDrawer: React.FC<{
{isOpen ? hideHistory : showHistory}
</ShowHideButton>
</EuiFlexItem>
<EuiFlexItem
grow={false}
style={{
position: 'relative',
minWidth: 400,
height: '16px',
}}
>
{children}
</EuiFlexItem>
<RightSideSpacer />
</BottomActionTopBar>
<EuiFlexGroup style={{ marginTop: 0 }}>
<Timeline isVisible={isOpen} interval={interval} yAxisFormatter={formatter} />
Expand Down Expand Up @@ -97,7 +86,3 @@ const BottomActionTopBar = euiStyled(EuiFlexGroup).attrs({
const ShowHideButton = euiStyled(EuiButtonEmpty).attrs({ size: 's' })`
width: 140px;
`;

const RightSideSpacer = euiStyled(EuiSpacer).attrs({ size: 'xs' })`
width: 140px;
`;
Loading

0 comments on commit d15a542

Please sign in to comment.