Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into kibanathemeprovider…
Browse files Browse the repository at this point in the history
…-kibana-app-services
  • Loading branch information
shivindera committed Jan 10, 2022
2 parents 183e20a + 3c84b1b commit 47c8467
Show file tree
Hide file tree
Showing 67 changed files with 1,581 additions and 510 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"**/istanbul-lib-coverage": "^3.2.0",
"**/json-schema": "^0.4.0",
"**/minimist": "^1.2.5",
"**/node-forge": "^1.1.0",
"**/pdfkit/crypto-js": "4.0.0",
"**/react-syntax-highlighter": "^15.3.1",
"**/react-syntax-highlighter/**/highlight.js": "^10.4.1",
Expand Down Expand Up @@ -299,7 +300,7 @@
"mustache": "^2.3.2",
"nock": "12.0.3",
"node-fetch": "^2.6.1",
"node-forge": "^0.10.0",
"node-forge": "^1.1.0",
"nodemailer": "^6.6.2",
"normalize-path": "^3.0.0",
"object-hash": "^1.3.1",
Expand Down Expand Up @@ -623,7 +624,7 @@
"@types/nock": "^10.0.3",
"@types/node": "16.10.2",
"@types/node-fetch": "^2.5.7",
"@types/node-forge": "^0.10.10",
"@types/node-forge": "^1.0.0",
"@types/nodemailer": "^6.4.0",
"@types/normalize-path": "^3.0.0",
"@types/object-hash": "^1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/expressions/common/execution/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export class Execution<
inspectorAdapters.tables[name] = datatable;
},
isSyncColorsEnabled: () => execution.params.syncColors!,
...execution.params.extraContext,
...execution.executor.context,
getExecutionContext: () => execution.params.executionContext,
};

Expand Down
5 changes: 0 additions & 5 deletions src/plugins/expressions/common/executor/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@ export const defaultState: ExecutorState = {
export interface ExecutorPureTransitions {
addFunction: (state: ExecutorState) => (fn: ExpressionFunction) => ExecutorState;
addType: (state: ExecutorState) => (type: ExpressionType) => ExecutorState;
extendContext: (state: ExecutorState) => (extraContext: Record<string, unknown>) => ExecutorState;
}

export const pureTransitions: ExecutorPureTransitions = {
addFunction: (state) => (fn) => ({ ...state, functions: { ...state.functions, [fn.name]: fn } }),
addType: (state) => (type) => ({ ...state, types: { ...state.types, [type.name]: type } }),
extendContext: (state) => (extraContext) => ({
...state,
context: { ...state.context, ...extraContext },
}),
};

export interface ExecutorPureSelectors {
Expand Down
33 changes: 1 addition & 32 deletions src/plugins/expressions/common/executor/executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,36 +88,6 @@ describe('Executor', () => {
const executor = new Executor();
expect(executor.context).toEqual({});
});

test('can extend context', () => {
const executor = new Executor();
executor.extendContext({
foo: 'bar',
});
expect(executor.context).toEqual({
foo: 'bar',
});
});

test('can extend context multiple times with multiple keys', () => {
const executor = new Executor();
const abortSignal = {};
const env = {};

executor.extendContext({
foo: 'bar',
});
executor.extendContext({
abortSignal,
env,
});

expect(executor.context).toEqual({
foo: 'bar',
abortSignal,
env,
});
});
});

describe('execution', () => {
Expand All @@ -140,9 +110,8 @@ describe('Executor', () => {
});

test('Execution inherits context from Executor', () => {
const executor = new Executor();
const foo = {};
executor.extendContext({ foo });
const executor = new Executor({ context: { foo }, functions: {}, types: {} });
const execution = executor.createExecution('foo bar="baz"');

expect(execution.context).toHaveProperty('foo', foo);
Expand Down
11 changes: 1 addition & 10 deletions src/plugins/expressions/common/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ export class Executor<Context extends Record<string, unknown> = Record<string, u
};
}

public extendContext(extraContext: Record<string, unknown>) {
this.container.transitions.extendContext(extraContext);
}

public get context(): Record<string, unknown> {
return {
...(this.parent?.context ?? {}),
Expand Down Expand Up @@ -210,13 +206,8 @@ export class Executor<Context extends Record<string, unknown> = Record<string, u
params: ExpressionExecutionParams = {}
): Execution<Input, Output> {
const executionParams = {
params,
executor: this,
params: {
...params,
// for canvas we are passing this in,
// canvas should be refactored to not pass any extra context in
extraContext: this.context,
},
} as ExecutionParams;

if (typeof ast === 'string') executionParams.expression = ast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ export interface ExpressionExecutionParams {
inspectorAdapters?: Adapters;

executionContext?: KibanaExecutionContext;

extraContext?: object;
}

/**
Expand Down
10 changes: 0 additions & 10 deletions src/plugins/expressions/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,7 @@ export class ExpressionsPublicPlugin implements Plugin<ExpressionsSetup, Express

constructor(initializerContext: PluginInitializerContext) {}

private configureExecutor(core: CoreSetup) {
const { executor } = this.expressions;

executor.extendContext({
environment: 'client',
});
}

public setup(core: CoreSetup): ExpressionsSetup {
this.configureExecutor(core);

const { expressions } = this;
const { renderers } = expressions;

Expand Down
4 changes: 0 additions & 4 deletions src/plugins/expressions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export class ExpressionsServerPlugin
constructor(initializerContext: PluginInitializerContext) {}

public setup(core: CoreSetup): ExpressionsServerSetup {
this.expressions.executor.extendContext({
environment: 'server',
});

const setup = this.expressions.setup(pick(core, 'getStartServices'));

return Object.freeze(setup);
Expand Down
12 changes: 8 additions & 4 deletions test/functional/apps/discover/_discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after(async () => {
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
});
// FLAKY: https://github.com/elastic/kibana/issues/86602
describe.skip('query', function () {
describe('query', function () {
const queryName1 = 'Query # 1';

it('should show correct time range string by timepicker', async function () {
Expand Down Expand Up @@ -121,8 +120,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
return actualCount === expectedCount;
});
const prevRowData = await PageObjects.discover.getDocTableField(1);
log.debug(`The first timestamp value in doc table before brushing: ${prevRowData}`);
let prevRowData = '';
// to make sure the table is already rendered
await retry.try(async () => {
prevRowData = await PageObjects.discover.getDocTableField(1);
log.debug(`The first timestamp value in doc table before brushing: ${prevRowData}`);
});

await PageObjects.discover.brushHistogram();
await PageObjects.discover.waitUntilSearchingHasFinished();
await retry.waitFor('chart rendering complete after being brushed', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export type {
EncryptedSavedObjectTypeRegistration,
SavedObjectDescriptor,
AttributeToEncrypt,
} from './encrypted_saved_objects_service';
export { EncryptedSavedObjectsService, descriptorToArray } from './encrypted_saved_objects_service';
export { EncryptionError, EncryptionErrorOperation } from './encryption_error';
Expand Down
16 changes: 12 additions & 4 deletions x-pack/plugins/encrypted_saved_objects/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/
import { ConfigSchema } from './config';
import { EncryptedSavedObjectsPlugin } from './plugin';

export type { EncryptedSavedObjectTypeRegistration } from './crypto';
export { EncryptionError } from './crypto';
export type { EncryptedSavedObjectTypeRegistration, AttributeToEncrypt } from './crypto';
export { EncryptionError, EncryptionErrorOperation } from './crypto';
export type { EncryptedSavedObjectsPluginSetup, EncryptedSavedObjectsPluginStart } from './plugin';
export type { EncryptedSavedObjectsClient } from './saved_objects';
export type { IsMigrationNeededPredicate } from './create_migration';
export type {
EncryptedSavedObjectsClient,
EncryptedSavedObjectsClientOptions,
ClientInstanciator,
} from './saved_objects';
export type {
IsMigrationNeededPredicate,
CreateEncryptedSavedObjectsMigrationFn,
CreateEncryptedSavedObjectsMigrationFnOpts,
} from './create_migration';

export const config: PluginConfigDescriptor = {
schema: ConfigSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function AdvancedOptions(props: {
onClick: () => void;
showInPopover: boolean;
inlineElement: React.ReactElement | null;
helpPopup?: string | null;
}>;
}) {
const [popoverOpen, setPopoverOpen] = useState(false);
Expand Down
Loading

0 comments on commit 47c8467

Please sign in to comment.