Skip to content

Commit

Permalink
Merge branch 'main' into histogram-on-histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed May 3, 2022
2 parents 844ce3d + 0558903 commit c146309
Show file tree
Hide file tree
Showing 161 changed files with 3,096 additions and 627 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Import saved objects from given stream. See the [options](./kibana-plugin-core-s
<b>Signature:</b>

```typescript
import({ readStream, createNewCopies, namespace, overwrite, }: SavedObjectsImportOptions): Promise<SavedObjectsImportResponse>;
import({ readStream, createNewCopies, namespace, overwrite, refresh, }: SavedObjectsImportOptions): Promise<SavedObjectsImportResponse>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| { readStream, createNewCopies, namespace, overwrite, } | SavedObjectsImportOptions | |
| { readStream, createNewCopies, namespace, overwrite, refresh, } | SavedObjectsImportOptions | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export declare class SavedObjectsImporter

| Method | Modifiers | Description |
| --- | --- | --- |
| [import({ readStream, createNewCopies, namespace, overwrite, })](./kibana-plugin-core-server.savedobjectsimporter.import.md) | | Import saved objects from given stream. See the [options](./kibana-plugin-core-server.savedobjectsimportoptions.md) for more detailed information. |
| [import({ readStream, createNewCopies, namespace, overwrite, refresh, })](./kibana-plugin-core-server.savedobjectsimporter.import.md) | | Import saved objects from given stream. See the [options](./kibana-plugin-core-server.savedobjectsimportoptions.md) for more detailed information. |
| [resolveImportErrors({ readStream, createNewCopies, namespace, retries, })](./kibana-plugin-core-server.savedobjectsimporter.resolveimporterrors.md) | | Resolve and return saved object import errors. See the [options](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.md) for more detailed information. |

Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export interface SavedObjectsImportOptions
| [namespace?](./kibana-plugin-core-server.savedobjectsimportoptions.namespace.md) | string | <i>(Optional)</i> if specified, will import in given namespace, else will import as global object |
| [overwrite](./kibana-plugin-core-server.savedobjectsimportoptions.overwrite.md) | boolean | If true, will override existing object if present. Note: this has no effect when used with the <code>createNewCopies</code> option. |
| [readStream](./kibana-plugin-core-server.savedobjectsimportoptions.readstream.md) | Readable | The stream of [saved objects](./kibana-plugin-core-server.savedobject.md) to import |
| [refresh?](./kibana-plugin-core-server.savedobjectsimportoptions.refresh.md) | boolean \| 'wait\_for' | <i>(Optional)</i> Refresh setting, defaults to <code>wait_for</code> |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsImportOptions](./kibana-plugin-core-server.savedobjectsimportoptions.md) &gt; [refresh](./kibana-plugin-core-server.savedobjectsimportoptions.refresh.md)

## SavedObjectsImportOptions.refresh property

Refresh setting, defaults to `wait_for`

<b>Signature:</b>

```typescript
refresh?: boolean | 'wait_for';
```
4 changes: 4 additions & 0 deletions src/core/server/saved_objects/import/import_saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export interface ImportSavedObjectsOptions {
objectLimit: number;
/** If true, will override existing object if present. Note: this has no effect when used with the `createNewCopies` option. */
overwrite: boolean;
/** Refresh setting, defaults to `wait_for` */
refresh?: boolean | 'wait_for';
/** {@link SavedObjectsClientContract | client} to use to perform the import operation */
savedObjectsClient: SavedObjectsClientContract;
/** The registry of all known saved object types */
Expand Down Expand Up @@ -62,6 +64,7 @@ export async function importSavedObjectsFromStream({
typeRegistry,
importHooks,
namespace,
refresh,
}: ImportSavedObjectsOptions): Promise<SavedObjectsImportResponse> {
let errorAccumulator: SavedObjectsImportFailure[] = [];
const supportedTypes = typeRegistry.getImportableAndExportableTypes().map((type) => type.name);
Expand Down Expand Up @@ -141,6 +144,7 @@ export async function importSavedObjectsFromStream({
importStateMap,
overwrite,
namespace,
refresh,
};
const createSavedObjectsResult = await createSavedObjects(createSavedObjectsParams);
errorAccumulator = [...errorAccumulator, ...createSavedObjectsResult.errors];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface CreateSavedObjectsParams<T> {
importStateMap: ImportStateMap;
namespace?: string;
overwrite?: boolean;
refresh?: boolean | 'wait_for';
}
export interface CreateSavedObjectsResult<T> {
createdObjects: Array<CreatedObject<T>>;
Expand All @@ -35,6 +36,7 @@ export const createSavedObjects = async <T>({
importStateMap,
namespace,
overwrite,
refresh,
}: CreateSavedObjectsParams<T>): Promise<CreateSavedObjectsResult<T>> => {
// filter out any objects that resulted in errors
const errorSet = accumulatedErrors.reduce(
Expand Down Expand Up @@ -87,6 +89,7 @@ export const createSavedObjects = async <T>({
const bulkCreateResponse = await savedObjectsClient.bulkCreate(objectsToCreate, {
namespace,
overwrite,
refresh,
});
expectedResults = bulkCreateResponse.saved_objects;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ export class SavedObjectsImporter {
createNewCopies,
namespace,
overwrite,
refresh,
}: SavedObjectsImportOptions): Promise<SavedObjectsImportResponse> {
return importSavedObjectsFromStream({
readStream,
createNewCopies,
namespace,
overwrite,
refresh,
objectLimit: this.#importSizeLimit,
savedObjectsClient: this.#savedObjectsClient,
typeRegistry: this.#typeRegistry,
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/saved_objects/import/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export interface SavedObjectsImportOptions {
namespace?: string;
/** If true, will create new copies of import objects, each with a random `id` and undefined `originId`. */
createNewCopies: boolean;
/** Refresh setting, defaults to `wait_for` */
refresh?: boolean | 'wait_for';
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,7 @@ export class SavedObjectsImporter {
typeRegistry: ISavedObjectTypeRegistry;
importSizeLimit: number;
});
import({ readStream, createNewCopies, namespace, overwrite, }: SavedObjectsImportOptions): Promise<SavedObjectsImportResponse>;
import({ readStream, createNewCopies, namespace, overwrite, refresh, }: SavedObjectsImportOptions): Promise<SavedObjectsImportResponse>;
resolveImportErrors({ readStream, createNewCopies, namespace, retries, }: SavedObjectsResolveImportErrorsOptions): Promise<SavedObjectsImportResponse>;
}

Expand Down Expand Up @@ -2604,6 +2604,7 @@ export interface SavedObjectsImportOptions {
namespace?: string;
overwrite: boolean;
readStream: Readable;
refresh?: boolean | 'wait_for';
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { chartPluginMock } from '@kbn/charts-plugin/public/mocks';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks';
import type { Datatable } from '@kbn/expressions-plugin/public';
import { shallow, mount } from 'enzyme';
import { shallow } from 'enzyme';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { act } from 'react-dom/test-utils';
import PartitionVisComponent, { PartitionVisComponentProps } from './partition_vis_component';
Expand Down Expand Up @@ -143,7 +144,7 @@ describe('PartitionVisComponent', function () {
});

it('renders the legend toggle component', async () => {
const component = mount(<PartitionVisComponent {...wrapperProps} />);
const component = mountWithIntl(<PartitionVisComponent {...wrapperProps} />);
await actWithTimeout(async () => {
await component.update();
});
Expand All @@ -154,7 +155,7 @@ describe('PartitionVisComponent', function () {
});

it('hides the legend if the legend toggle is clicked', async () => {
const component = mount(<PartitionVisComponent {...wrapperProps} />);
const component = mountWithIntl(<PartitionVisComponent {...wrapperProps} />);
await actWithTimeout(async () => {
await component.update();
});
Expand Down Expand Up @@ -233,7 +234,7 @@ describe('PartitionVisComponent', function () {
],
} as unknown as Datatable;
const newProps = { ...wrapperProps, visData: newVisData };
const component = mount(<PartitionVisComponent {...newProps} />);
const component = mountWithIntl(<PartitionVisComponent {...newProps} />);
expect(findTestSubject(component, 'partitionVisEmptyValues').text()).toEqual(
'No results found'
);
Expand Down Expand Up @@ -264,7 +265,7 @@ describe('PartitionVisComponent', function () {
],
} as unknown as Datatable;
const newProps = { ...wrapperProps, visData: newVisData };
const component = mount(<PartitionVisComponent {...newProps} />);
const component = mountWithIntl(<PartitionVisComponent {...newProps} />);
expect(findTestSubject(component, 'partitionVisNegativeValues').text()).toEqual(
"Pie chart can't render with negative values."
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ describe('XYChart component', () => {
onClickValue,
onSelectRange,
syncColors: false,
syncTooltips: false,
useLegacyTimeAxis: false,
eventAnnotationService: eventAnnotationServiceMock,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
BarSeriesProps,
LineSeriesProps,
ColorVariant,
Placement,
} from '@elastic/charts';
import { IconType } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -99,6 +100,7 @@ export type XYChartRenderProps = XYChartProps & {
onSelectRange: (data: BrushEvent['data']) => void;
renderMode: RenderMode;
syncColors: boolean;
syncTooltips: boolean;
eventAnnotationService: EventAnnotationServiceType;
};

Expand Down Expand Up @@ -144,6 +146,7 @@ export function XYChart({
onSelectRange,
interactive = true,
syncColors,
syncTooltips,
useLegacyTimeAxis,
}: XYChartRenderProps) {
const {
Expand Down Expand Up @@ -520,6 +523,9 @@ export function XYChart({
<Chart ref={chartRef}>
<Settings
onPointerUpdate={handleCursorUpdate}
externalPointerEvents={{
tooltip: { visible: syncTooltips, placement: Placement.Right },
}}
debugState={window._echDebugStateFlag ?? false}
showLegend={
legend.isVisible && !legend.showSingleSeries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const getXyChartRenderer = ({
onSelectRange={onSelectRange}
renderMode={handlers.getRenderMode()}
syncColors={handlers.isSyncColorsEnabled()}
syncTooltips={handlers.isSyncTooltipsEnabled()}
/>
</div>{' '}
</I18nProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface InheritedChildInput extends IndexSignature {
id: string;
searchSessionId?: string;
syncColors?: boolean;
syncTooltips?: boolean;
executionContext?: KibanaExecutionContext;
}

Expand Down Expand Up @@ -314,6 +315,7 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
filters,
searchSessionId,
syncColors,
syncTooltips,
executionContext,
} = this.input;
let combinedFilters = filters;
Expand All @@ -330,6 +332,7 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
id,
searchSessionId,
syncColors,
syncTooltips,
executionContext,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class DashboardContainerFactoryDefinition
isFullScreenMode: false,
useMargins: true,
syncColors: true,
syncTooltips: true,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const getDashboardState = (state?: Partial<DashboardState>): DashboardState => {
hidePanelTitles: false,
useMargins: true,
syncColors: false,
syncTooltips: false,
},
panels: {
panel_1: {
Expand Down Expand Up @@ -97,6 +98,7 @@ describe('Dashboard state diff function', () => {
hidePanelTitles: false,
useMargins: false,
syncColors: false,
syncTooltips: false,
},
})
).toEqual(['options']);
Expand All @@ -108,6 +110,7 @@ describe('Dashboard state diff function', () => {
options: {
useMargins: true,
syncColors: undefined,
syncTooltips: undefined,
} as unknown as DashboardOptions,
})
).toEqual([]);
Expand Down
Loading

0 comments on commit c146309

Please sign in to comment.