mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[DX] Prettier v2.2 (#83899)
* update prettier with ts version support * mute type-error * run prettier on codebase * fix examples * fix errors after master merged
This commit is contained in:
parent
df4f4758fa
commit
95861a0fb0
172 changed files with 896 additions and 953 deletions
|
@ -127,9 +127,10 @@ export class BookEmbeddableFactoryDefinition
|
|||
|
||||
private async unwrapMethod(savedObjectId: string): Promise<BookSavedObjectAttributes> {
|
||||
const { savedObjectsClient } = await this.getStartServices();
|
||||
const savedObject: SimpleSavedObject<BookSavedObjectAttributes> = await savedObjectsClient.get<
|
||||
BookSavedObjectAttributes
|
||||
>(this.type, savedObjectId);
|
||||
const savedObject: SimpleSavedObject<BookSavedObjectAttributes> = await savedObjectsClient.get<BookSavedObjectAttributes>(
|
||||
this.type,
|
||||
savedObjectId
|
||||
);
|
||||
return { ...savedObject.attributes };
|
||||
}
|
||||
|
||||
|
@ -163,9 +164,9 @@ export class BookEmbeddableFactoryDefinition
|
|||
|
||||
private async getAttributeService() {
|
||||
if (!this.attributeService) {
|
||||
this.attributeService = (await this.getStartServices()).getAttributeService<
|
||||
BookSavedObjectAttributes
|
||||
>(this.type, {
|
||||
this.attributeService = (
|
||||
await this.getStartServices()
|
||||
).getAttributeService<BookSavedObjectAttributes>(this.type, {
|
||||
saveMethod: this.saveMethod.bind(this),
|
||||
unwrapMethod: this.unwrapMethod.bind(this),
|
||||
checkForDuplicateTitle: this.checkForDuplicateTitleMethod.bind(this),
|
||||
|
|
|
@ -510,7 +510,7 @@
|
|||
"@types/pdfmake": "^0.1.15",
|
||||
"@types/pegjs": "^0.10.1",
|
||||
"@types/pngjs": "^3.4.0",
|
||||
"@types/prettier": "^2.0.2",
|
||||
"@types/prettier": "^2.1.5",
|
||||
"@types/pretty-ms": "^5.0.0",
|
||||
"@types/prop-types": "^15.7.3",
|
||||
"@types/proper-lockfile": "^3.0.1",
|
||||
|
@ -626,7 +626,7 @@
|
|||
"enzyme-adapter-utils": "^1.13.0",
|
||||
"enzyme-to-json": "^3.4.4",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-config-prettier": "^6.15.0",
|
||||
"eslint-import-resolver-node": "0.3.2",
|
||||
"eslint-import-resolver-webpack": "0.11.1",
|
||||
"eslint-module-utils": "2.5.0",
|
||||
|
@ -762,7 +762,7 @@
|
|||
"postcss": "^7.0.32",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-prefix-selector": "^1.7.2",
|
||||
"prettier": "^2.1.1",
|
||||
"prettier": "^2.2.0",
|
||||
"pretty-ms": "5.0.0",
|
||||
"proxyquire": "1.8.0",
|
||||
"querystring": "^0.2.0",
|
||||
|
|
|
@ -196,6 +196,7 @@ function getSnapshotState(file: string, test: Test, updateSnapshots: boolean) {
|
|||
path.join(dirname + `/__snapshots__/` + filename.replace(path.extname(filename), '.snap')),
|
||||
{
|
||||
updateSnapshot: updateSnapshots ? 'all' : 'new',
|
||||
// @ts-expect-error
|
||||
getPrettier: () => prettier,
|
||||
getBabelTraverse: () => babelTraverse,
|
||||
}
|
||||
|
|
|
@ -57,7 +57,9 @@ let coreContext: CoreContext;
|
|||
const logger = loggingSystemMock.create();
|
||||
|
||||
let mockClusterClientInstance: ReturnType<typeof elasticsearchClientMock.createCustomClusterClient>;
|
||||
let mockLegacyClusterClientInstance: ReturnType<typeof elasticsearchServiceMock.createLegacyCustomClusterClient>;
|
||||
let mockLegacyClusterClientInstance: ReturnType<
|
||||
typeof elasticsearchServiceMock.createLegacyCustomClusterClient
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
env = Env.createDefault(REPO_ROOT, getEnvOptions());
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
import { SavedObjectMigrationContext } from './types';
|
||||
import { SavedObjectsMigrationLogger } from './core';
|
||||
|
||||
export const createSavedObjectsMigrationLoggerMock = (): jest.Mocked<
|
||||
SavedObjectsMigrationLogger
|
||||
> => {
|
||||
export const createSavedObjectsMigrationLoggerMock = (): jest.Mocked<SavedObjectsMigrationLogger> => {
|
||||
const mock = {
|
||||
debug: jest.fn(),
|
||||
info: jest.fn(),
|
||||
|
|
|
@ -217,9 +217,8 @@ describe('SavedObjectsService', () => {
|
|||
await soService.setup(setupDeps);
|
||||
soService.start(createStartDeps());
|
||||
expect(migratorInstanceMock.runMigrations).toHaveBeenCalledTimes(0);
|
||||
((setupDeps.elasticsearch.esNodesCompatibility$ as any) as BehaviorSubject<
|
||||
NodesVersionCompatibility
|
||||
>).next({
|
||||
((setupDeps.elasticsearch
|
||||
.esNodesCompatibility$ as any) as BehaviorSubject<NodesVersionCompatibility>).next({
|
||||
isCompatible: true,
|
||||
incompatibleNodes: [],
|
||||
warningNodes: [],
|
||||
|
|
|
@ -66,9 +66,7 @@ describe('SavedObjectsRepository#createRepository', () => {
|
|||
});
|
||||
|
||||
const migrator = mockKibanaMigrator.create({ types: typeRegistry.getAllTypes() });
|
||||
const RepositoryConstructor = (SavedObjectsRepository as unknown) as jest.Mock<
|
||||
SavedObjectsRepository
|
||||
>;
|
||||
const RepositoryConstructor = (SavedObjectsRepository as unknown) as jest.Mock<SavedObjectsRepository>;
|
||||
|
||||
beforeEach(() => {
|
||||
RepositoryConstructor.mockClear();
|
||||
|
|
|
@ -368,20 +368,21 @@ export class LegacyCoreEditor implements CoreEditor {
|
|||
|
||||
// disable standard context based autocompletion.
|
||||
// @ts-ignore
|
||||
ace.define('ace/autocomplete/text_completer', ['require', 'exports', 'module'], function (
|
||||
require: any,
|
||||
exports: any
|
||||
) {
|
||||
exports.getCompletions = function (
|
||||
innerEditor: any,
|
||||
session: any,
|
||||
pos: any,
|
||||
prefix: any,
|
||||
callback: any
|
||||
) {
|
||||
callback(null, []);
|
||||
};
|
||||
});
|
||||
ace.define(
|
||||
'ace/autocomplete/text_completer',
|
||||
['require', 'exports', 'module'],
|
||||
function (require: any, exports: any) {
|
||||
exports.getCompletions = function (
|
||||
innerEditor: any,
|
||||
session: any,
|
||||
pos: any,
|
||||
prefix: any,
|
||||
callback: any
|
||||
) {
|
||||
callback(null, []);
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const langTools = ace.acequire('ace/ext/language_tools');
|
||||
|
||||
|
|
|
@ -84,90 +84,93 @@ describe('Integration', () => {
|
|||
changeListener: function () {},
|
||||
}; // mimic auto complete
|
||||
|
||||
senseEditor.autocomplete._test.getCompletions(senseEditor, null, cursor, '', function (
|
||||
err,
|
||||
terms
|
||||
) {
|
||||
if (testToRun.assertThrows) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
senseEditor.autocomplete._test.getCompletions(
|
||||
senseEditor,
|
||||
null,
|
||||
cursor,
|
||||
'',
|
||||
function (err, terms) {
|
||||
if (testToRun.assertThrows) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (testToRun.no_context) {
|
||||
expect(!terms || terms.length === 0).toBeTruthy();
|
||||
} else {
|
||||
expect(terms).not.toBeNull();
|
||||
expect(terms.length).toBeGreaterThan(0);
|
||||
}
|
||||
|
||||
if (!terms || terms.length === 0) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
if (testToRun.autoCompleteSet) {
|
||||
const expectedTerms = _.map(testToRun.autoCompleteSet, function (t) {
|
||||
if (typeof t !== 'object') {
|
||||
t = { name: t };
|
||||
}
|
||||
return t;
|
||||
});
|
||||
if (terms.length !== expectedTerms.length) {
|
||||
expect(_.map(terms, 'name')).toEqual(_.map(expectedTerms, 'name'));
|
||||
if (testToRun.no_context) {
|
||||
expect(!terms || terms.length === 0).toBeTruthy();
|
||||
} else {
|
||||
const filteredActualTerms = _.map(terms, function (actualTerm, i) {
|
||||
const expectedTerm = expectedTerms[i];
|
||||
const filteredTerm = {};
|
||||
_.each(expectedTerm, function (v, p) {
|
||||
filteredTerm[p] = actualTerm[p];
|
||||
});
|
||||
return filteredTerm;
|
||||
});
|
||||
expect(filteredActualTerms).toEqual(expectedTerms);
|
||||
expect(terms).not.toBeNull();
|
||||
expect(terms.length).toBeGreaterThan(0);
|
||||
}
|
||||
}
|
||||
|
||||
const context = terms[0].context;
|
||||
const {
|
||||
cursor: { lineNumber, column },
|
||||
} = testToRun;
|
||||
senseEditor.autocomplete._test.addReplacementInfoToContext(
|
||||
context,
|
||||
{ lineNumber, column },
|
||||
terms[0].value
|
||||
);
|
||||
if (!terms || terms.length === 0) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
function ac(prop, propTest) {
|
||||
if (typeof testToRun[prop] !== 'undefined') {
|
||||
if (propTest) {
|
||||
propTest(context[prop], testToRun[prop], prop);
|
||||
if (testToRun.autoCompleteSet) {
|
||||
const expectedTerms = _.map(testToRun.autoCompleteSet, function (t) {
|
||||
if (typeof t !== 'object') {
|
||||
t = { name: t };
|
||||
}
|
||||
return t;
|
||||
});
|
||||
if (terms.length !== expectedTerms.length) {
|
||||
expect(_.map(terms, 'name')).toEqual(_.map(expectedTerms, 'name'));
|
||||
} else {
|
||||
expect(context[prop]).toEqual(testToRun[prop]);
|
||||
const filteredActualTerms = _.map(terms, function (actualTerm, i) {
|
||||
const expectedTerm = expectedTerms[i];
|
||||
const filteredTerm = {};
|
||||
_.each(expectedTerm, function (v, p) {
|
||||
filteredTerm[p] = actualTerm[p];
|
||||
});
|
||||
return filteredTerm;
|
||||
});
|
||||
expect(filteredActualTerms).toEqual(expectedTerms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function posCompare(actual, expected) {
|
||||
expect(actual.lineNumber).toEqual(expected.lineNumber + lineOffset);
|
||||
expect(actual.column).toEqual(expected.column);
|
||||
}
|
||||
const context = terms[0].context;
|
||||
const {
|
||||
cursor: { lineNumber, column },
|
||||
} = testToRun;
|
||||
senseEditor.autocomplete._test.addReplacementInfoToContext(
|
||||
context,
|
||||
{ lineNumber, column },
|
||||
terms[0].value
|
||||
);
|
||||
|
||||
function rangeCompare(actual, expected, name) {
|
||||
posCompare(actual.start, expected.start, name + '.start');
|
||||
posCompare(actual.end, expected.end, name + '.end');
|
||||
}
|
||||
function ac(prop, propTest) {
|
||||
if (typeof testToRun[prop] !== 'undefined') {
|
||||
if (propTest) {
|
||||
propTest(context[prop], testToRun[prop], prop);
|
||||
} else {
|
||||
expect(context[prop]).toEqual(testToRun[prop]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ac('prefixToAdd');
|
||||
ac('suffixToAdd');
|
||||
ac('addTemplate');
|
||||
ac('textBoxPosition', posCompare);
|
||||
ac('rangeToReplace', rangeCompare);
|
||||
done();
|
||||
});
|
||||
function posCompare(actual, expected) {
|
||||
expect(actual.lineNumber).toEqual(expected.lineNumber + lineOffset);
|
||||
expect(actual.column).toEqual(expected.column);
|
||||
}
|
||||
|
||||
function rangeCompare(actual, expected, name) {
|
||||
posCompare(actual.start, expected.start, name + '.start');
|
||||
posCompare(actual.end, expected.end, name + '.end');
|
||||
}
|
||||
|
||||
ac('prefixToAdd');
|
||||
ac('suffixToAdd');
|
||||
ac('addTemplate');
|
||||
ac('textBoxPosition', posCompare);
|
||||
ac('rangeToReplace', rangeCompare);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -179,9 +179,7 @@ export class DashboardPlugin
|
|||
core: CoreSetup<StartDependencies, DashboardStart>,
|
||||
{ share, uiActions, embeddable, home, urlForwarding, data, usageCollection }: SetupDependencies
|
||||
): DashboardSetup {
|
||||
this.dashboardFeatureFlagConfig = this.initializerContext.config.get<
|
||||
DashboardFeatureFlagConfig
|
||||
>();
|
||||
this.dashboardFeatureFlagConfig = this.initializerContext.config.get<DashboardFeatureFlagConfig>();
|
||||
const expandPanelAction = new ExpandPanelAction();
|
||||
uiActions.registerAction(expandPanelAction);
|
||||
uiActions.attachAction(CONTEXT_MENU_TRIGGER, expandPanelAction.id);
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
import { AggConfig, IAggConfig, AggConfigSerialized } from '../agg_config';
|
||||
import { BaseParamType } from './base';
|
||||
|
||||
export class AggParamType<TAggConfig extends IAggConfig = IAggConfig> extends BaseParamType<
|
||||
TAggConfig
|
||||
> {
|
||||
export class AggParamType<
|
||||
TAggConfig extends IAggConfig = IAggConfig
|
||||
> extends BaseParamType<TAggConfig> {
|
||||
makeAgg: (agg: TAggConfig, state?: AggConfigSerialized) => TAggConfig;
|
||||
allowedAggs: string[] = [];
|
||||
|
||||
|
|
|
@ -28,10 +28,9 @@ export function callClient(
|
|||
fetchHandlers: FetchHandlers
|
||||
) {
|
||||
// Correlate the options with the request that they're associated with
|
||||
const requestOptionEntries: Array<[
|
||||
SearchRequest,
|
||||
ISearchOptions
|
||||
]> = searchRequests.map((request, i) => [request, requestsOptions[i]]);
|
||||
const requestOptionEntries: Array<
|
||||
[SearchRequest, ISearchOptions]
|
||||
> = searchRequests.map((request, i) => [request, requestsOptions[i]]);
|
||||
const requestOptionsMap = new Map<SearchRequest, ISearchOptions>(requestOptionEntries);
|
||||
const requestResponseMap = new Map<SearchRequest, Promise<SearchResponse<any>>>();
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
import { EmbeddablePersistableStateService } from './types';
|
||||
|
||||
export const createEmbeddablePersistableStateServiceMock = (): jest.Mocked<
|
||||
EmbeddablePersistableStateService
|
||||
> => {
|
||||
export const createEmbeddablePersistableStateServiceMock = (): jest.Mocked<EmbeddablePersistableStateService> => {
|
||||
return {
|
||||
inject: jest.fn((state, references) => state),
|
||||
extract: jest.fn((state) => ({ state, references: [] })),
|
||||
|
|
|
@ -244,9 +244,10 @@ export abstract class Container<
|
|||
|
||||
private createNewExplicitEmbeddableInput<
|
||||
TEmbeddableInput extends EmbeddableInput = EmbeddableInput,
|
||||
TEmbeddable extends IEmbeddable<TEmbeddableInput, EmbeddableOutput> = IEmbeddable<
|
||||
TEmbeddableInput
|
||||
>
|
||||
TEmbeddable extends IEmbeddable<
|
||||
TEmbeddableInput,
|
||||
EmbeddableOutput
|
||||
> = IEmbeddable<TEmbeddableInput>
|
||||
>(
|
||||
id: string,
|
||||
factory: EmbeddableFactory<TEmbeddableInput, any, TEmbeddable>,
|
||||
|
|
|
@ -58,9 +58,9 @@ describe('<FormDataProvider />', () => {
|
|||
|
||||
expect(onFormData.mock.calls.length).toBe(1);
|
||||
|
||||
const [formDataInitial] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
const [formDataInitial] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(formDataInitial).toEqual({
|
||||
name: 'Initial value',
|
||||
|
@ -77,9 +77,9 @@ describe('<FormDataProvider />', () => {
|
|||
|
||||
expect(onFormData).toBeCalledTimes(2);
|
||||
|
||||
const [formDataUpdated] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
const [formDataUpdated] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(formDataUpdated).toEqual({
|
||||
name: 'updated value',
|
||||
|
@ -135,9 +135,9 @@ describe('<FormDataProvider />', () => {
|
|||
|
||||
expect(onFormData.mock.calls.length).toBe(2);
|
||||
|
||||
const [formDataUpdated] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
const [formDataUpdated] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(formDataUpdated).toEqual({
|
||||
name: 'updated value',
|
||||
|
@ -236,9 +236,9 @@ describe('<FormDataProvider />', () => {
|
|||
|
||||
expect(onFormData.mock.calls.length).toBe(2); // 2 as the form "isValid" change caused a re-render
|
||||
|
||||
const [formData] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
const [formData] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(formData).toEqual({
|
||||
name: 'updated value',
|
||||
|
|
|
@ -54,9 +54,9 @@ describe('<UseField />', () => {
|
|||
|
||||
setup();
|
||||
|
||||
const [{ data }] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
const [{ data }] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(data.internal).toEqual({
|
||||
name: 'John',
|
||||
|
|
|
@ -255,9 +255,9 @@ describe('useForm() hook', () => {
|
|||
setInputValue('usernameField', 'John');
|
||||
});
|
||||
|
||||
[{ data, isValid }] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
[{ data, isValid }] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(data.internal).toEqual({ user: { name: 'John' } });
|
||||
// Transform name to uppercase as decalred in our serializer func
|
||||
|
@ -305,9 +305,9 @@ describe('useForm() hook', () => {
|
|||
|
||||
expect(onFormData.mock.calls.length).toBe(1);
|
||||
|
||||
const [{ data }] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters<
|
||||
OnUpdateHandler
|
||||
>;
|
||||
const [{ data }] = onFormData.mock.calls[
|
||||
onFormData.mock.calls.length - 1
|
||||
] as Parameters<OnUpdateHandler>;
|
||||
|
||||
expect(data.internal).toEqual({
|
||||
title: defaultValue.title,
|
||||
|
|
|
@ -45,9 +45,9 @@ export type InferFunctionDefinition<
|
|||
: never;
|
||||
|
||||
// Shortcut for inferring args from a function definition.
|
||||
type FunctionArgs<FnDef extends AnyExpressionFunctionDefinition> = InferFunctionDefinition<
|
||||
FnDef
|
||||
>['arguments'];
|
||||
type FunctionArgs<
|
||||
FnDef extends AnyExpressionFunctionDefinition
|
||||
> = InferFunctionDefinition<FnDef>['arguments'];
|
||||
|
||||
// Gets a list of possible arg names for a given function.
|
||||
type FunctionArgName<FnDef extends AnyExpressionFunctionDefinition> = {
|
||||
|
|
|
@ -359,9 +359,12 @@ export class Execution<
|
|||
|
||||
// Check for missing required arguments.
|
||||
for (const argDef of Object.values(argDefs)) {
|
||||
const { aliases, default: argDefault, name: argName, required } = argDef as ArgumentType<
|
||||
any
|
||||
> & { name: string };
|
||||
const {
|
||||
aliases,
|
||||
default: argDefault,
|
||||
name: argName,
|
||||
required,
|
||||
} = argDef as ArgumentType<any> & { name: string };
|
||||
if (
|
||||
typeof argDefault !== 'undefined' ||
|
||||
!required ||
|
||||
|
|
|
@ -68,9 +68,9 @@ export class ExpressionRenderHandler {
|
|||
this.onRenderError = onRenderError || defaultRenderErrorHandler;
|
||||
|
||||
this.renderSubject = new Rx.BehaviorSubject(null as any | null);
|
||||
this.render$ = this.renderSubject.asObservable().pipe(filter((_) => _ !== null)) as Observable<
|
||||
any
|
||||
>;
|
||||
this.render$ = this.renderSubject
|
||||
.asObservable()
|
||||
.pipe(filter((_) => _ !== null)) as Observable<any>;
|
||||
|
||||
this.updateSubject = new Rx.Subject();
|
||||
this.update$ = this.updateSubject.asObservable();
|
||||
|
|
|
@ -25,10 +25,12 @@ export const [getNotifications, setNotifications] = createGetterSetter<Notificat
|
|||
'Notifications'
|
||||
);
|
||||
|
||||
export const [getRenderersRegistry, setRenderersRegistry] = createGetterSetter<
|
||||
ExpressionRendererRegistry
|
||||
>('Renderers registry');
|
||||
export const [
|
||||
getRenderersRegistry,
|
||||
setRenderersRegistry,
|
||||
] = createGetterSetter<ExpressionRendererRegistry>('Renderers registry');
|
||||
|
||||
export const [getExpressionsService, setExpressionsService] = createGetterSetter<
|
||||
ExpressionsService
|
||||
>('ExpressionsService');
|
||||
export const [
|
||||
getExpressionsService,
|
||||
setExpressionsService,
|
||||
] = createGetterSetter<ExpressionsService>('ExpressionsService');
|
||||
|
|
|
@ -129,9 +129,9 @@ export class StepIndexPattern extends Component<StepIndexPatternProps, StepIndex
|
|||
}
|
||||
|
||||
fetchExistingIndexPatterns = async () => {
|
||||
const { savedObjects } = await this.context.services.savedObjects.client.find<
|
||||
IndexPatternAttributes
|
||||
>({
|
||||
const {
|
||||
savedObjects,
|
||||
} = await this.context.services.savedObjects.client.find<IndexPatternAttributes>({
|
||||
type: 'index-pattern',
|
||||
fields: ['title'],
|
||||
perPage: 10000,
|
||||
|
|
|
@ -44,9 +44,12 @@ const newFieldPlaceholder = i18n.translate(
|
|||
|
||||
export const CreateEditField = withRouter(
|
||||
({ indexPattern, mode, fieldName, history }: CreateEditFieldProps) => {
|
||||
const { uiSettings, chrome, notifications, data } = useKibana<
|
||||
IndexPatternManagmentContext
|
||||
>().services;
|
||||
const {
|
||||
uiSettings,
|
||||
chrome,
|
||||
notifications,
|
||||
data,
|
||||
} = useKibana<IndexPatternManagmentContext>().services;
|
||||
const spec =
|
||||
mode === 'edit' && fieldName
|
||||
? indexPattern.fields.getByName(fieldName)?.spec
|
||||
|
|
|
@ -74,9 +74,11 @@ const filterPlaceholder = i18n.translate(
|
|||
);
|
||||
|
||||
export function Tabs({ indexPattern, saveIndexPattern, fields, history, location }: TabsProps) {
|
||||
const { uiSettings, indexPatternManagementStart, docLinks } = useKibana<
|
||||
IndexPatternManagmentContext
|
||||
>().services;
|
||||
const {
|
||||
uiSettings,
|
||||
indexPatternManagementStart,
|
||||
docLinks,
|
||||
} = useKibana<IndexPatternManagmentContext>().services;
|
||||
const [fieldFilter, setFieldFilter] = useState<string>('');
|
||||
const [indexedFieldTypeFilter, setIndexedFieldTypeFilter] = useState<string>('');
|
||||
const [scriptedFieldLanguageFilter, setScriptedFieldLanguageFilter] = useState<string>('');
|
||||
|
|
|
@ -36,9 +36,7 @@ interface StaticLookupItem {
|
|||
index: number;
|
||||
}
|
||||
|
||||
export class StaticLookupFormatEditor extends DefaultFormatEditor<
|
||||
StaticLookupFormatEditorFormatParams
|
||||
> {
|
||||
export class StaticLookupFormatEditor extends DefaultFormatEditor<StaticLookupFormatEditorFormatParams> {
|
||||
static formatId = 'static_lookup';
|
||||
onLookupChange = (newLookupParams: { value?: string; key?: string }, index: number) => {
|
||||
const lookupEntries = [...this.props.formatParams.lookupEntries];
|
||||
|
|
|
@ -47,9 +47,7 @@ export interface IndexPatternManagmentContext {
|
|||
getMlCardState: () => MlCardState;
|
||||
}
|
||||
|
||||
export type IndexPatternManagmentContextValue = KibanaReactContextValue<
|
||||
IndexPatternManagmentContext
|
||||
>;
|
||||
export type IndexPatternManagmentContextValue = KibanaReactContextValue<IndexPatternManagmentContext>;
|
||||
|
||||
export enum MlCardState {
|
||||
HIDDEN,
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
|
||||
import { Injectable, IDirectiveFactory, IScope, IAttributes, IController } from 'angular';
|
||||
|
||||
export const createTopNavDirective: Injectable<IDirectiveFactory<
|
||||
IScope,
|
||||
JQLite,
|
||||
IAttributes,
|
||||
IController
|
||||
>>;
|
||||
export const createTopNavDirective: Injectable<
|
||||
IDirectiveFactory<IScope, JQLite, IAttributes, IController>
|
||||
>;
|
||||
export const createTopNavHelper: (
|
||||
options: unknown
|
||||
) => Injectable<IDirectiveFactory<IScope, JQLite, IAttributes, IController>>;
|
||||
|
|
|
@ -76,30 +76,30 @@ export function PaginateDirectiveProvider($parse, $compile) {
|
|||
self.init = function () {
|
||||
self.perPage = _.parseInt(self.perPage) || $scope[self.perPageProp];
|
||||
|
||||
$scope.$watchMulti(['paginate.perPage', self.perPageProp, self.otherWidthGetter], function (
|
||||
vals,
|
||||
oldVals
|
||||
) {
|
||||
const intChanges = vals[0] !== oldVals[0];
|
||||
$scope.$watchMulti(
|
||||
['paginate.perPage', self.perPageProp, self.otherWidthGetter],
|
||||
function (vals, oldVals) {
|
||||
const intChanges = vals[0] !== oldVals[0];
|
||||
|
||||
if (intChanges) {
|
||||
if (!setPerPage(self.perPage)) {
|
||||
// if we are not able to set the external value,
|
||||
// render now, otherwise wait for the external value
|
||||
// to trigger the watcher again
|
||||
self.renderList();
|
||||
if (intChanges) {
|
||||
if (!setPerPage(self.perPage)) {
|
||||
// if we are not able to set the external value,
|
||||
// render now, otherwise wait for the external value
|
||||
// to trigger the watcher again
|
||||
self.renderList();
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
self.perPage = _.parseInt(self.perPage) || $scope[self.perPageProp];
|
||||
if (self.perPage == null) {
|
||||
self.perPage = ALL;
|
||||
return;
|
||||
}
|
||||
self.perPage = _.parseInt(self.perPage) || $scope[self.perPageProp];
|
||||
if (self.perPage == null) {
|
||||
self.perPage = ALL;
|
||||
return;
|
||||
}
|
||||
|
||||
self.renderList();
|
||||
});
|
||||
self.renderList();
|
||||
}
|
||||
);
|
||||
|
||||
$scope.$watch('page', self.changePage);
|
||||
$scope.$watchCollection(self.getList, function (list) {
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
import { Injectable, IDirectiveFactory, IScope, IAttributes, IController } from 'angular';
|
||||
|
||||
export const KbnAccessibleClickProvider: Injectable<IDirectiveFactory<
|
||||
IScope,
|
||||
JQLite,
|
||||
IAttributes,
|
||||
IController
|
||||
>>;
|
||||
export const KbnAccessibleClickProvider: Injectable<
|
||||
IDirectiveFactory<IScope, JQLite, IAttributes, IController>
|
||||
>;
|
||||
|
|
|
@ -51,9 +51,9 @@ export async function rollDailyData(logger: Logger, savedObjectsClient?: ISavedO
|
|||
let toCreate: Map<string, ApplicationUsageDailyWithVersion>;
|
||||
do {
|
||||
toCreate = new Map();
|
||||
const { saved_objects: rawApplicationUsageTransactional } = await savedObjectsClient.find<
|
||||
ApplicationUsageTransactional
|
||||
>({
|
||||
const {
|
||||
saved_objects: rawApplicationUsageTransactional,
|
||||
} = await savedObjectsClient.find<ApplicationUsageTransactional>({
|
||||
type: SAVED_OBJECTS_TRANSACTIONAL_TYPE,
|
||||
perPage: 1000, // Process 1000 at a time as a compromise of speed and overload
|
||||
});
|
||||
|
|
|
@ -36,9 +36,10 @@ import {
|
|||
} from './types';
|
||||
import { createGetterSetter } from '../../kibana_utils/public';
|
||||
|
||||
const [getSectionsServiceStartPrivate, setSectionsServiceStartPrivate] = createGetterSetter<
|
||||
ManagementSectionsStartPrivate
|
||||
>('SectionsServiceStartPrivate');
|
||||
const [
|
||||
getSectionsServiceStartPrivate,
|
||||
setSectionsServiceStartPrivate,
|
||||
] = createGetterSetter<ManagementSectionsStartPrivate>('SectionsServiceStartPrivate');
|
||||
|
||||
export { getSectionsServiceStartPrivate };
|
||||
|
||||
|
|
|
@ -216,9 +216,9 @@ describe('Saved Object', () => {
|
|||
|
||||
return createInitializedSavedObject({ type: 'dashboard', id: 'myId' }).then(
|
||||
(savedObject) => {
|
||||
stubSavedObjectsClientCreate({ id: 'myId' } as SimpleSavedObject<
|
||||
SavedObjectAttributes
|
||||
>);
|
||||
stubSavedObjectsClientCreate({
|
||||
id: 'myId',
|
||||
} as SimpleSavedObject<SavedObjectAttributes>);
|
||||
|
||||
return savedObject.save({ confirmOverwrite: false }).then(() => {
|
||||
expect(startMock.overlays.openModal).not.toHaveBeenCalled();
|
||||
|
|
|
@ -25,9 +25,7 @@ export interface SavedObjectsManagementServiceRegistryEntry {
|
|||
title: string;
|
||||
}
|
||||
|
||||
export type ISavedObjectsManagementServiceRegistry = PublicMethodsOf<
|
||||
SavedObjectsManagementServiceRegistry
|
||||
>;
|
||||
export type ISavedObjectsManagementServiceRegistry = PublicMethodsOf<SavedObjectsManagementServiceRegistry>;
|
||||
|
||||
export class SavedObjectsManagementServiceRegistry {
|
||||
private readonly registry = new Map<string, SavedObjectsManagementServiceRegistryEntry>();
|
||||
|
|
|
@ -60,9 +60,9 @@ describe('NumberRow', () => {
|
|||
|
||||
test('should call onChange', () => {
|
||||
const comp = shallow(<NumberRow {...defaultProps} />);
|
||||
comp.find('EuiFieldNumber').prop('onChange')!({ target: { value: '5' } } as React.ChangeEvent<
|
||||
HTMLInputElement
|
||||
>);
|
||||
comp.find('EuiFieldNumber').prop('onChange')!({
|
||||
target: { value: '5' },
|
||||
} as React.ChangeEvent<HTMLInputElement>);
|
||||
|
||||
expect(defaultProps.onChange).lastCalledWith({ id: defaultProps.model.id, value: '5' });
|
||||
});
|
||||
|
|
|
@ -27,6 +27,7 @@ export const [getIndexPatterns, setIndexPatterns] = createGetterSetter<IndexPatt
|
|||
|
||||
export const [getDataSearch, setDataSearch] = createGetterSetter<ISearchStart>('Search');
|
||||
|
||||
export const [getSavedObjectsClient, setSavedObjectsClient] = createGetterSetter<
|
||||
SavedObjectsClientContract
|
||||
>('SavedObjectsClient');
|
||||
export const [
|
||||
getSavedObjectsClient,
|
||||
setSavedObjectsClient,
|
||||
] = createGetterSetter<SavedObjectsClientContract>('SavedObjectsClient');
|
||||
|
|
|
@ -113,27 +113,24 @@ export default new Chainable('legend', {
|
|||
defaultMessage: 'Set the position and style of the legend on the plot',
|
||||
}),
|
||||
fn: function legendFn(args) {
|
||||
return alter(args, function (
|
||||
eachSeries,
|
||||
position,
|
||||
columns,
|
||||
showTime = true,
|
||||
timeFormat = DEFAULT_TIME_FORMAT
|
||||
) {
|
||||
eachSeries._global = eachSeries._global || {};
|
||||
eachSeries._global.legend = eachSeries._global.legend || {};
|
||||
eachSeries._global.legend.noColumns = columns;
|
||||
eachSeries._global.legend.showTime = showTime;
|
||||
eachSeries._global.legend.timeFormat = timeFormat;
|
||||
return alter(
|
||||
args,
|
||||
function (eachSeries, position, columns, showTime = true, timeFormat = DEFAULT_TIME_FORMAT) {
|
||||
eachSeries._global = eachSeries._global || {};
|
||||
eachSeries._global.legend = eachSeries._global.legend || {};
|
||||
eachSeries._global.legend.noColumns = columns;
|
||||
eachSeries._global.legend.showTime = showTime;
|
||||
eachSeries._global.legend.timeFormat = timeFormat;
|
||||
|
||||
if (position === false) {
|
||||
eachSeries._global.legend.show = false;
|
||||
eachSeries._global.legend.showTime = false;
|
||||
} else {
|
||||
eachSeries._global.legend.position = position;
|
||||
if (position === false) {
|
||||
eachSeries._global.legend.show = false;
|
||||
eachSeries._global.legend.showTime = false;
|
||||
} else {
|
||||
eachSeries._global.legend.position = position;
|
||||
}
|
||||
|
||||
return eachSeries;
|
||||
}
|
||||
|
||||
return eachSeries;
|
||||
});
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -106,86 +106,79 @@ export default new Chainable('yaxis', {
|
|||
'Configures a variety of y-axis options, the most important likely being the ability to add an Nth (eg 2nd) y-axis',
|
||||
}),
|
||||
fn: function yaxisFn(args) {
|
||||
return alter(args, function (
|
||||
eachSeries,
|
||||
yaxis,
|
||||
min,
|
||||
max,
|
||||
position,
|
||||
label,
|
||||
color,
|
||||
units,
|
||||
tickDecimals
|
||||
) {
|
||||
yaxis = yaxis || 1;
|
||||
return alter(
|
||||
args,
|
||||
function (eachSeries, yaxis, min, max, position, label, color, units, tickDecimals) {
|
||||
yaxis = yaxis || 1;
|
||||
|
||||
eachSeries.yaxis = yaxis;
|
||||
eachSeries._global = eachSeries._global || {};
|
||||
eachSeries.yaxis = yaxis;
|
||||
eachSeries._global = eachSeries._global || {};
|
||||
|
||||
eachSeries._global.yaxes = eachSeries._global.yaxes || [];
|
||||
eachSeries._global.yaxes[yaxis - 1] = eachSeries._global.yaxes[yaxis - 1] || {};
|
||||
eachSeries._global.yaxes = eachSeries._global.yaxes || [];
|
||||
eachSeries._global.yaxes[yaxis - 1] = eachSeries._global.yaxes[yaxis - 1] || {};
|
||||
|
||||
const myAxis = eachSeries._global.yaxes[yaxis - 1];
|
||||
myAxis.position = position || (yaxis % 2 ? 'left' : 'right');
|
||||
myAxis.min = min;
|
||||
myAxis.max = max;
|
||||
myAxis.axisLabelFontSizePixels = 11;
|
||||
myAxis.axisLabel = label;
|
||||
myAxis.axisLabelColour = color;
|
||||
myAxis.axisLabelUseCanvas = true;
|
||||
const myAxis = eachSeries._global.yaxes[yaxis - 1];
|
||||
myAxis.position = position || (yaxis % 2 ? 'left' : 'right');
|
||||
myAxis.min = min;
|
||||
myAxis.max = max;
|
||||
myAxis.axisLabelFontSizePixels = 11;
|
||||
myAxis.axisLabel = label;
|
||||
myAxis.axisLabelColour = color;
|
||||
myAxis.axisLabelUseCanvas = true;
|
||||
|
||||
if (tickDecimals) {
|
||||
myAxis.tickDecimals = tickDecimals < 0 ? 0 : tickDecimals;
|
||||
}
|
||||
|
||||
if (units) {
|
||||
const unitTokens = units.split(':');
|
||||
const unitType = unitTokens[0];
|
||||
if (!tickFormatters[unitType]) {
|
||||
throw new Error(
|
||||
i18n.translate(
|
||||
'timelion.serverSideErrors.yaxisFunction.notSupportedUnitTypeErrorMessage',
|
||||
{
|
||||
defaultMessage: '{units} is not a supported unit type.',
|
||||
values: { units },
|
||||
}
|
||||
)
|
||||
);
|
||||
if (tickDecimals) {
|
||||
myAxis.tickDecimals = tickDecimals < 0 ? 0 : tickDecimals;
|
||||
}
|
||||
if (unitType === 'currency') {
|
||||
const threeLetterCode = /^[A-Za-z]{3}$/;
|
||||
const currency = unitTokens[1];
|
||||
if (currency && !threeLetterCode.test(currency)) {
|
||||
|
||||
if (units) {
|
||||
const unitTokens = units.split(':');
|
||||
const unitType = unitTokens[0];
|
||||
if (!tickFormatters[unitType]) {
|
||||
throw new Error(
|
||||
i18n.translate(
|
||||
'timelion.serverSideErrors.yaxisFunction.notValidCurrencyFormatErrorMessage',
|
||||
'timelion.serverSideErrors.yaxisFunction.notSupportedUnitTypeErrorMessage',
|
||||
{
|
||||
defaultMessage: 'Currency must be a three letter code',
|
||||
defaultMessage: '{units} is not a supported unit type.',
|
||||
values: { units },
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (unitType === 'currency') {
|
||||
const threeLetterCode = /^[A-Za-z]{3}$/;
|
||||
const currency = unitTokens[1];
|
||||
if (currency && !threeLetterCode.test(currency)) {
|
||||
throw new Error(
|
||||
i18n.translate(
|
||||
'timelion.serverSideErrors.yaxisFunction.notValidCurrencyFormatErrorMessage',
|
||||
{
|
||||
defaultMessage: 'Currency must be a three letter code',
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
myAxis.units = {
|
||||
type: unitType,
|
||||
prefix: unitTokens[1] || '',
|
||||
suffix: unitTokens[2] || '',
|
||||
};
|
||||
myAxis.units = {
|
||||
type: unitType,
|
||||
prefix: unitTokens[1] || '',
|
||||
suffix: unitTokens[2] || '',
|
||||
};
|
||||
|
||||
if (unitType === 'percent') {
|
||||
// jquery.flot uses axis.tickDecimals to generate tick values
|
||||
// need 2 extra decimal places to preserve precision when percent shifts value to left
|
||||
myAxis.units.tickDecimalsShift = 2;
|
||||
if (tickDecimals) {
|
||||
myAxis.tickDecimals += myAxis.units.tickDecimalsShift;
|
||||
} else {
|
||||
myAxis.tickDecimals = myAxis.units.tickDecimalsShift;
|
||||
if (unitType === 'percent') {
|
||||
// jquery.flot uses axis.tickDecimals to generate tick values
|
||||
// need 2 extra decimal places to preserve precision when percent shifts value to left
|
||||
myAxis.units.tickDecimalsShift = 2;
|
||||
if (tickDecimals) {
|
||||
myAxis.tickDecimals += myAxis.units.tickDecimalsShift;
|
||||
} else {
|
||||
myAxis.tickDecimals = myAxis.units.tickDecimalsShift;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return eachSeries;
|
||||
});
|
||||
return eachSeries;
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -24,9 +24,8 @@ import { VisTypeAlias } from '../vis_types';
|
|||
|
||||
describe('saved_visualizations', () => {
|
||||
function testProps() {
|
||||
const savedObjects = coreMock.createStart().savedObjects.client as jest.Mocked<
|
||||
SavedObjectsClientContract
|
||||
>;
|
||||
const savedObjects = coreMock.createStart().savedObjects
|
||||
.client as jest.Mocked<SavedObjectsClientContract>;
|
||||
(savedObjects.find as jest.Mock).mockImplementation(() => ({
|
||||
total: 0,
|
||||
savedObjects: [],
|
||||
|
|
|
@ -83,9 +83,10 @@ export const [getExpressions, setExpressions] = createGetterSetter<ExpressionsSt
|
|||
|
||||
export const [getUiActions, setUiActions] = createGetterSetter<UiActionsStart>('UiActions');
|
||||
|
||||
export const [getSavedVisualizationsLoader, setSavedVisualizationsLoader] = createGetterSetter<
|
||||
SavedVisualizationsLoader
|
||||
>('SavedVisualisationsLoader');
|
||||
export const [
|
||||
getSavedVisualizationsLoader,
|
||||
setSavedVisualizationsLoader,
|
||||
] = createGetterSetter<SavedVisualizationsLoader>('SavedVisualisationsLoader');
|
||||
|
||||
export const [getAggs, setAggs] = createGetterSetter<DataPublicPluginStart['search']['aggs']>(
|
||||
'AggConfigs'
|
||||
|
|
|
@ -64,10 +64,9 @@ const DEFAULT_THRESHOLDS: AlwaysFiringParams['thresholds'] = {
|
|||
large: 10000,
|
||||
};
|
||||
|
||||
export const AlwaysFiringExpression: React.FunctionComponent<AlertTypeParamsExpressionProps<
|
||||
AlwaysFiringParams,
|
||||
AlertsContextValue
|
||||
>> = ({ alertParams, setAlertParams, actionGroups, defaultActionGroupId }) => {
|
||||
export const AlwaysFiringExpression: React.FunctionComponent<
|
||||
AlertTypeParamsExpressionProps<AlwaysFiringParams, AlertsContextValue>
|
||||
> = ({ alertParams, setAlertParams, actionGroups, defaultActionGroupId }) => {
|
||||
const {
|
||||
instances = DEFAULT_INSTANCES_TO_GENERATE,
|
||||
thresholds = pick(DEFAULT_THRESHOLDS, defaultActionGroupId),
|
||||
|
|
|
@ -155,9 +155,11 @@ export class ActionsClient {
|
|||
'update'
|
||||
);
|
||||
}
|
||||
const { attributes, references, version } = await this.unsecuredSavedObjectsClient.get<
|
||||
RawAction
|
||||
>('action', id);
|
||||
const {
|
||||
attributes,
|
||||
references,
|
||||
version,
|
||||
} = await this.unsecuredSavedObjectsClient.get<RawAction>('action', id);
|
||||
const { actionTypeId } = attributes;
|
||||
const { name, config, secrets } = action;
|
||||
const actionType = this.actionTypeRegistry.get(actionTypeId);
|
||||
|
|
|
@ -64,9 +64,9 @@ describe('ensureAuthorized', () => {
|
|||
|
||||
test('ensures the user has privileges to use the operation on the Actions Saved Object type', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const actionsAuthorization = new ActionsAuthorization({
|
||||
request,
|
||||
|
@ -105,9 +105,9 @@ describe('ensureAuthorized', () => {
|
|||
|
||||
test('ensures the user has privileges to execute an Actions Saved Object type', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const actionsAuthorization = new ActionsAuthorization({
|
||||
request,
|
||||
|
@ -156,9 +156,9 @@ describe('ensureAuthorized', () => {
|
|||
|
||||
test('throws if user lacks the required privieleges', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const actionsAuthorization = new ActionsAuthorization({
|
||||
request,
|
||||
|
@ -198,9 +198,9 @@ describe('ensureAuthorized', () => {
|
|||
|
||||
test('exempts users from requiring privileges to execute actions when authorizationMode is Legacy', async () => {
|
||||
const { authorization, authentication } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const actionsAuthorization = new ActionsAuthorization({
|
||||
request,
|
||||
|
|
|
@ -454,9 +454,11 @@ export class AlertsClient {
|
|||
let attributes: RawAlert;
|
||||
|
||||
try {
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<
|
||||
RawAlert
|
||||
>('alert', id, { namespace: this.namespace });
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<RawAlert>(
|
||||
'alert',
|
||||
id,
|
||||
{ namespace: this.namespace }
|
||||
);
|
||||
apiKeyToInvalidate = decryptedAlert.attributes.apiKey;
|
||||
taskIdToRemove = decryptedAlert.attributes.scheduledTaskId;
|
||||
attributes = decryptedAlert.attributes;
|
||||
|
@ -505,9 +507,11 @@ export class AlertsClient {
|
|||
let alertSavedObject: SavedObject<RawAlert>;
|
||||
|
||||
try {
|
||||
alertSavedObject = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<
|
||||
RawAlert
|
||||
>('alert', id, { namespace: this.namespace });
|
||||
alertSavedObject = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<RawAlert>(
|
||||
'alert',
|
||||
id,
|
||||
{ namespace: this.namespace }
|
||||
);
|
||||
} catch (e) {
|
||||
// We'll skip invalidating the API key since we failed to load the decrypted saved object
|
||||
this.logger.error(
|
||||
|
@ -636,9 +640,11 @@ export class AlertsClient {
|
|||
let version: string | undefined;
|
||||
|
||||
try {
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<
|
||||
RawAlert
|
||||
>('alert', id, { namespace: this.namespace });
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<RawAlert>(
|
||||
'alert',
|
||||
id,
|
||||
{ namespace: this.namespace }
|
||||
);
|
||||
apiKeyToInvalidate = decryptedAlert.attributes.apiKey;
|
||||
attributes = decryptedAlert.attributes;
|
||||
version = decryptedAlert.version;
|
||||
|
@ -707,9 +713,11 @@ export class AlertsClient {
|
|||
let version: string | undefined;
|
||||
|
||||
try {
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<
|
||||
RawAlert
|
||||
>('alert', id, { namespace: this.namespace });
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<RawAlert>(
|
||||
'alert',
|
||||
id,
|
||||
{ namespace: this.namespace }
|
||||
);
|
||||
apiKeyToInvalidate = decryptedAlert.attributes.apiKey;
|
||||
attributes = decryptedAlert.attributes;
|
||||
version = decryptedAlert.version;
|
||||
|
@ -789,9 +797,11 @@ export class AlertsClient {
|
|||
let version: string | undefined;
|
||||
|
||||
try {
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<
|
||||
RawAlert
|
||||
>('alert', id, { namespace: this.namespace });
|
||||
const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser<RawAlert>(
|
||||
'alert',
|
||||
id,
|
||||
{ namespace: this.namespace }
|
||||
);
|
||||
apiKeyToInvalidate = decryptedAlert.attributes.apiKey;
|
||||
attributes = decryptedAlert.attributes;
|
||||
version = decryptedAlert.version;
|
||||
|
|
|
@ -378,9 +378,7 @@ describe('create()', () => {
|
|||
"scheduledTaskId": "task-123",
|
||||
}
|
||||
`);
|
||||
const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked<
|
||||
ActionsClient
|
||||
>;
|
||||
const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked<ActionsClient>;
|
||||
expect(actionsClient.isActionTypeEnabled).toHaveBeenCalledWith('test', { notifyUsage: true });
|
||||
});
|
||||
|
||||
|
@ -702,9 +700,7 @@ describe('create()', () => {
|
|||
test('throws error if loading actions fails', async () => {
|
||||
const data = getMockData();
|
||||
// Reset from default behaviour
|
||||
const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked<
|
||||
ActionsClient
|
||||
>;
|
||||
const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked<ActionsClient>;
|
||||
actionsClient.getBulk.mockReset();
|
||||
actionsClient.getBulk.mockRejectedValueOnce(new Error('Test Error'));
|
||||
alertsClientParams.getActionsClient.mockResolvedValue(actionsClient);
|
||||
|
|
|
@ -328,9 +328,7 @@ describe('update()', () => {
|
|||
"version": "123",
|
||||
}
|
||||
`);
|
||||
const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked<
|
||||
ActionsClient
|
||||
>;
|
||||
const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked<ActionsClient>;
|
||||
expect(actionsClient.isActionTypeEnabled).toHaveBeenCalledWith('test', { notifyUsage: true });
|
||||
expect(actionsClient.isActionTypeEnabled).toHaveBeenCalledWith('test2', { notifyUsage: true });
|
||||
});
|
||||
|
|
|
@ -68,9 +68,9 @@ const actionsAuthorization = actionsAuthorizationMock.create();
|
|||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
alertsClientFactoryParams.actions = actionsMock.createStart();
|
||||
(alertsClientFactoryParams.actions as jest.Mocked<
|
||||
ActionsStartContract
|
||||
>).getActionsAuthorizationWithRequest.mockReturnValue(actionsAuthorization);
|
||||
(alertsClientFactoryParams.actions as jest.Mocked<ActionsStartContract>).getActionsAuthorizationWithRequest.mockReturnValue(
|
||||
actionsAuthorization
|
||||
);
|
||||
alertsClientFactoryParams.getSpaceId.mockReturnValue('default');
|
||||
alertsClientFactoryParams.spaceIdToNamespace.mockReturnValue('default');
|
||||
});
|
||||
|
|
|
@ -240,9 +240,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('ensures the user has privileges to execute the specified type, operation and consumer', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const alertAuthorization = new AlertsAuthorization({
|
||||
request,
|
||||
|
@ -283,9 +283,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('ensures the user has privileges to execute the specified type and operation without consumer when consumer is alerts', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const alertAuthorization = new AlertsAuthorization({
|
||||
request,
|
||||
|
@ -326,9 +326,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('ensures the user has privileges to execute the specified type, operation and producer when producer is different from consumer', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -377,9 +377,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('throws if user lacks the required privieleges for the consumer', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const alertAuthorization = new AlertsAuthorization({
|
||||
request,
|
||||
|
@ -428,9 +428,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('throws if user lacks the required privieleges for the producer', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const alertAuthorization = new AlertsAuthorization({
|
||||
request,
|
||||
|
@ -479,9 +479,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('throws if user lacks the required privieleges for both consumer and producer', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
const alertAuthorization = new AlertsAuthorization({
|
||||
request,
|
||||
|
@ -594,9 +594,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('creates a filter based on the privileged types', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -625,9 +625,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('creates an `ensureAlertTypeIsAuthorized` function which throws if type is unauthorized', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -686,9 +686,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('creates an `ensureAlertTypeIsAuthorized` function which is no-op if type is authorized', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -736,9 +736,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('creates an `logSuccessfulAuthorization` function which logs every authorized type', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -913,9 +913,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('augments a list of types with consumers under which the operation is authorized', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -1001,9 +1001,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('authorizes user under the Alerts consumer when they are authorized by the producer', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -1062,9 +1062,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('augments a list of types with consumers under which multiple operations are authorized', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
@ -1174,9 +1174,9 @@ describe('AlertsAuthorization', () => {
|
|||
|
||||
test('omits types which have no consumers under which the operation is authorized', async () => {
|
||||
const { authorization } = mockSecurity();
|
||||
const checkPrivileges: jest.MockedFunction<ReturnType<
|
||||
typeof authorization.checkPrivilegesDynamicallyWithRequest
|
||||
>> = jest.fn();
|
||||
const checkPrivileges: jest.MockedFunction<
|
||||
ReturnType<typeof authorization.checkPrivilegesDynamicallyWithRequest>
|
||||
> = jest.fn();
|
||||
authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges);
|
||||
checkPrivileges.mockResolvedValueOnce({
|
||||
username: 'some-user',
|
||||
|
|
|
@ -202,9 +202,10 @@ async function invalidateApiKeys(
|
|||
let totalInvalidated = 0;
|
||||
await Promise.all(
|
||||
apiKeysToInvalidate.saved_objects.map(async (apiKeyObj) => {
|
||||
const decryptedApiKey = await encryptedSavedObjectsClient.getDecryptedAsInternalUser<
|
||||
InvalidatePendingApiKey
|
||||
>('api_key_pending_invalidation', apiKeyObj.id);
|
||||
const decryptedApiKey = await encryptedSavedObjectsClient.getDecryptedAsInternalUser<InvalidatePendingApiKey>(
|
||||
'api_key_pending_invalidation',
|
||||
apiKeyObj.id
|
||||
);
|
||||
const apiKeyId = decryptedApiKey.attributes.apiKeyId;
|
||||
const response = await invalidateAPIKey({ id: apiKeyId }, securityPluginSetup);
|
||||
if (response.apiKeysEnabled === true && response.result.error_count > 0) {
|
||||
|
|
|
@ -14,9 +14,7 @@ import { partiallyUpdateAlert, PartiallyUpdateableAlertAttributes } from './part
|
|||
import { savedObjectsClientMock } from '../../../../../src/core/server/mocks';
|
||||
|
||||
const MockSavedObjectsClientContract = savedObjectsClientMock.create();
|
||||
const MockISavedObjectsRepository = (MockSavedObjectsClientContract as unknown) as jest.Mocked<
|
||||
ISavedObjectsRepository
|
||||
>;
|
||||
const MockISavedObjectsRepository = (MockSavedObjectsClientContract as unknown) as jest.Mocked<ISavedObjectsRepository>;
|
||||
|
||||
describe('partially_update_alert', () => {
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -23,9 +23,7 @@ import { useUrlParams } from '../../hooks/useUrlParams';
|
|||
import { APIReturnType } from '../../services/rest/createCallApmApi';
|
||||
import { units } from '../../style/variables';
|
||||
|
||||
export type AnomalyDetectionApiResponse = APIReturnType<
|
||||
'GET /api/apm/settings/anomaly-detection'
|
||||
>;
|
||||
export type AnomalyDetectionApiResponse = APIReturnType<'GET /api/apm/settings/anomaly-detection'>;
|
||||
|
||||
const DEFAULT_DATA = { jobs: [], hasLegacyJobs: false };
|
||||
|
||||
|
|
|
@ -55,9 +55,7 @@ const TransactionLinkName = styled.div`
|
|||
`;
|
||||
|
||||
interface Props {
|
||||
errorGroup: APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/errors/{groupId}'
|
||||
>;
|
||||
errorGroup: APIReturnType<'GET /api/apm/services/{serviceName}/errors/{groupId}'>;
|
||||
urlParams: IUrlParams;
|
||||
location: Location;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,7 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi';
|
|||
import { asRelativeDateTimeRange } from '../../../../../common/utils/formatters';
|
||||
import { useTheme } from '../../../../hooks/useTheme';
|
||||
|
||||
type ErrorDistributionAPIResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/errors/distribution'
|
||||
>;
|
||||
type ErrorDistributionAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/errors/distribution'>;
|
||||
|
||||
interface FormattedBucket {
|
||||
x0: number;
|
||||
|
|
|
@ -48,9 +48,7 @@ const Culprit = styled.div`
|
|||
font-family: ${fontFamilyCode};
|
||||
`;
|
||||
|
||||
type ErrorGroupListAPIResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/errors'
|
||||
>;
|
||||
type ErrorGroupListAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/errors'>;
|
||||
|
||||
interface Props {
|
||||
items: ErrorGroupListAPIResponse;
|
||||
|
|
|
@ -61,9 +61,9 @@ export function EmbeddedMapComponent() {
|
|||
MapEmbeddable | ErrorEmbeddable | undefined
|
||||
>();
|
||||
|
||||
const embeddableRoot: React.RefObject<HTMLDivElement> = useRef<
|
||||
HTMLDivElement
|
||||
>(null);
|
||||
const embeddableRoot: React.RefObject<HTMLDivElement> = useRef<HTMLDivElement>(
|
||||
null
|
||||
);
|
||||
|
||||
const {
|
||||
services: { embeddable: embeddablePlugin },
|
||||
|
|
|
@ -45,7 +45,9 @@ function ServiceNodeOverview({ serviceName }: ServiceNodeOverviewProps) {
|
|||
const { uiFilters, urlParams } = useUrlParams();
|
||||
const { start, end } = urlParams;
|
||||
|
||||
const localFiltersConfig: React.ComponentProps<typeof LocalUIFilters> = useMemo(
|
||||
const localFiltersConfig: React.ComponentProps<
|
||||
typeof LocalUIFilters
|
||||
> = useMemo(
|
||||
() => ({
|
||||
filterNames: ['host', 'containerId', 'podName'],
|
||||
params: {
|
||||
|
|
|
@ -17,9 +17,7 @@ import { LicensePrompt } from '../../../shared/LicensePrompt';
|
|||
import { useLicense } from '../../../../hooks/useLicense';
|
||||
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
|
||||
|
||||
export type AnomalyDetectionApiResponse = APIReturnType<
|
||||
'GET /api/apm/settings/anomaly-detection'
|
||||
>;
|
||||
export type AnomalyDetectionApiResponse = APIReturnType<'GET /api/apm/settings/anomaly-detection'>;
|
||||
|
||||
const DEFAULT_VALUE: AnomalyDetectionApiResponse = {
|
||||
jobs: [],
|
||||
|
|
|
@ -33,13 +33,9 @@ import { unit } from '../../../../style/variables';
|
|||
import { ChartContainer } from '../../../shared/charts/chart_container';
|
||||
import { EmptyMessage } from '../../../shared/EmptyMessage';
|
||||
|
||||
type TransactionDistributionAPIResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups/distribution'
|
||||
>;
|
||||
type TransactionDistributionAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>;
|
||||
|
||||
type DistributionApiResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups/distribution'
|
||||
>;
|
||||
type DistributionApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>;
|
||||
|
||||
type DistributionBucket = DistributionApiResponse['buckets'][0];
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@ import { MaybeViewTraceLink } from './MaybeViewTraceLink';
|
|||
import { TransactionTabs } from './TransactionTabs';
|
||||
import { IWaterfall } from './WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers';
|
||||
|
||||
type DistributionApiResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups/distribution'
|
||||
>;
|
||||
type DistributionApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>;
|
||||
|
||||
type DistributionBucket = DistributionApiResponse['buckets'][0];
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi';
|
|||
import { MockApmPluginContextWrapper } from '../../../../context/ApmPluginContext/MockApmPluginContext';
|
||||
import { TransactionList } from './';
|
||||
|
||||
type TransactionGroup = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups'
|
||||
>['items'][0];
|
||||
type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>['items'][0];
|
||||
|
||||
export default {
|
||||
title: 'app/TransactionOverview/TransactionList',
|
||||
|
|
|
@ -20,9 +20,7 @@ import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt';
|
|||
import { EmptyMessage } from '../../../shared/EmptyMessage';
|
||||
import { TransactionDetailLink } from '../../../shared/Links/apm/TransactionDetailLink';
|
||||
|
||||
type TransactionGroup = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups'
|
||||
>['items'][0];
|
||||
type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>['items'][0];
|
||||
|
||||
// Truncate both the link and the child span (the tooltip anchor.) The link so
|
||||
// it doesn't overflow, and the anchor so we get the ellipsis.
|
||||
|
|
|
@ -96,7 +96,9 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
|
|||
status: transactionListStatus,
|
||||
} = useTransactionList(urlParams);
|
||||
|
||||
const localFiltersConfig: React.ComponentProps<typeof LocalUIFilters> = useMemo(
|
||||
const localFiltersConfig: React.ComponentProps<
|
||||
typeof LocalUIFilters
|
||||
> = useMemo(
|
||||
() => ({
|
||||
filterNames: [
|
||||
'transactionResult',
|
||||
|
|
|
@ -99,7 +99,9 @@ export function ServiceInventory() {
|
|||
useTrackPageview({ app: 'apm', path: 'services_overview' });
|
||||
useTrackPageview({ app: 'apm', path: 'services_overview', delay: 15000 });
|
||||
|
||||
const localFiltersConfig: React.ComponentProps<typeof LocalUIFilters> = useMemo(
|
||||
const localFiltersConfig: React.ComponentProps<
|
||||
typeof LocalUIFilters
|
||||
> = useMemo(
|
||||
() => ({
|
||||
filterNames: ['host', 'agentName'],
|
||||
projection: Projection.services,
|
||||
|
|
|
@ -34,7 +34,9 @@ export function ServiceMetrics({
|
|||
const { data, status } = useServiceMetricCharts(urlParams, agentName);
|
||||
const { start, end } = urlParams;
|
||||
|
||||
const localFiltersConfig: React.ComponentProps<typeof LocalUIFilters> = useMemo(
|
||||
const localFiltersConfig: React.ComponentProps<
|
||||
typeof LocalUIFilters
|
||||
> = useMemo(
|
||||
() => ({
|
||||
filterNames: ['host', 'containerId', 'podName', 'serviceVersion'],
|
||||
params: {
|
||||
|
|
|
@ -36,9 +36,7 @@ import { ImpactBar } from '../../../shared/ImpactBar';
|
|||
import { ServiceOverviewTable } from '../service_overview_table';
|
||||
|
||||
type ServiceTransactionGroupItem = ValuesType<
|
||||
APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/overview_transaction_groups'
|
||||
>['transactionGroups']
|
||||
APIReturnType<'GET /api/apm/services/{serviceName}/overview_transaction_groups'>['transactionGroups']
|
||||
>;
|
||||
|
||||
interface Props {
|
||||
|
|
|
@ -13,9 +13,7 @@ import { toQuery, fromQuery } from '../components/shared/Links/url_helpers';
|
|||
import { maybe } from '../../common/utils/maybe';
|
||||
import { APIReturnType } from '../services/rest/createCallApmApi';
|
||||
|
||||
type APIResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups/distribution'
|
||||
>;
|
||||
type APIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>;
|
||||
|
||||
const INITIAL_DATA = {
|
||||
buckets: [] as APIResponse['buckets'],
|
||||
|
|
|
@ -10,9 +10,7 @@ import { IUrlParams } from '../context/UrlParamsContext/types';
|
|||
import { APIReturnType } from '../services/rest/createCallApmApi';
|
||||
import { useFetcher } from './useFetcher';
|
||||
|
||||
type TransactionsAPIResponse = APIReturnType<
|
||||
'GET /api/apm/services/{serviceName}/transaction_groups'
|
||||
>;
|
||||
type TransactionsAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>;
|
||||
|
||||
const DEFAULT_RESPONSE: Partial<TransactionsAPIResponse> = {
|
||||
items: undefined,
|
||||
|
|
|
@ -10,9 +10,7 @@ import { ESResponse } from './fetcher';
|
|||
|
||||
type IBucket = ReturnType<typeof getBucket>;
|
||||
function getBucket(
|
||||
bucket: Required<
|
||||
ESResponse
|
||||
>['aggregations']['ml_avg_response_times']['buckets'][0]
|
||||
bucket: Required<ESResponse>['aggregations']['ml_avg_response_times']['buckets'][0]
|
||||
) {
|
||||
return {
|
||||
x: bucket.key,
|
||||
|
|
|
@ -42,9 +42,7 @@ export function timeseriesTransformer({
|
|||
};
|
||||
}
|
||||
|
||||
type TransactionResultBuckets = Required<
|
||||
ESResponse
|
||||
>['aggregations']['transaction_results']['buckets'];
|
||||
type TransactionResultBuckets = Required<ESResponse>['aggregations']['transaction_results']['buckets'];
|
||||
|
||||
export function getTpmBuckets({
|
||||
transactionResultBuckets = [],
|
||||
|
@ -86,9 +84,7 @@ export function getTpmBuckets({
|
|||
);
|
||||
}
|
||||
|
||||
type ResponseTimeBuckets = Required<
|
||||
ESResponse
|
||||
>['aggregations']['response_times']['buckets'];
|
||||
type ResponseTimeBuckets = Required<ESResponse>['aggregations']['response_times']['buckets'];
|
||||
|
||||
function getResponseTime(responseTimeBuckets: ResponseTimeBuckets = []) {
|
||||
return responseTimeBuckets.reduce(
|
||||
|
|
|
@ -37,9 +37,10 @@ export function initializeUpdateCustomElementRoute(deps: RouteInitializerDeps) {
|
|||
|
||||
const now = new Date().toISOString();
|
||||
|
||||
const customElementObject = await context.core.savedObjects.client.get<
|
||||
CustomElementAttributes
|
||||
>(CUSTOM_ELEMENT_TYPE, id);
|
||||
const customElementObject = await context.core.savedObjects.client.get<CustomElementAttributes>(
|
||||
CUSTOM_ELEMENT_TYPE,
|
||||
id
|
||||
);
|
||||
|
||||
await context.core.savedObjects.client.create<CustomElementAttributes>(
|
||||
CUSTOM_ELEMENT_TYPE,
|
||||
|
|
|
@ -46,9 +46,9 @@ describe('GET case', () => {
|
|||
);
|
||||
|
||||
const response = await routeHandler(theContext, request, kibanaResponseFactory);
|
||||
const savedObject = (mockCases.find((s) => s.id === 'mock-id-1') as unknown) as SavedObject<
|
||||
ESCaseAttributes
|
||||
>;
|
||||
const savedObject = (mockCases.find(
|
||||
(s) => s.id === 'mock-id-1'
|
||||
) as unknown) as SavedObject<ESCaseAttributes>;
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.payload).toEqual(
|
||||
flattenCaseSavedObject({
|
||||
|
|
|
@ -11,9 +11,8 @@ import { createConnectedBackgroundSessionIndicator } from './connected_backgroun
|
|||
import { BehaviorSubject } from 'rxjs';
|
||||
import { ISessionService } from '../../../../../../../src/plugins/data/public';
|
||||
|
||||
const sessionService = dataPluginMock.createStartContract().search.session as jest.Mocked<
|
||||
ISessionService
|
||||
>;
|
||||
const sessionService = dataPluginMock.createStartContract().search
|
||||
.session as jest.Mocked<ISessionService>;
|
||||
|
||||
test("shouldn't show indicator in case no active search session", async () => {
|
||||
const BackgroundSessionIndicator = createConnectedBackgroundSessionIndicator({ sessionService });
|
||||
|
|
|
@ -9,14 +9,16 @@ import { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_obje
|
|||
|
||||
it('correctly determines attribute properties', () => {
|
||||
const attributes = ['attr#1', 'attr#2', 'attr#3', 'attr#4'];
|
||||
const cases: Array<[
|
||||
EncryptedSavedObjectTypeRegistration,
|
||||
{
|
||||
shouldBeEncrypted: boolean[];
|
||||
shouldBeExcludedFromAAD: boolean[];
|
||||
shouldBeStripped: boolean[];
|
||||
}
|
||||
]> = [
|
||||
const cases: Array<
|
||||
[
|
||||
EncryptedSavedObjectTypeRegistration,
|
||||
{
|
||||
shouldBeEncrypted: boolean[];
|
||||
shouldBeExcludedFromAAD: boolean[];
|
||||
shouldBeStripped: boolean[];
|
||||
}
|
||||
]
|
||||
> = [
|
||||
[
|
||||
{
|
||||
type: 'so-type',
|
||||
|
|
|
@ -19,9 +19,7 @@ export interface UIExtensionsStorage {
|
|||
* UI Component Extension is used on the pages displaying the ability to edit an
|
||||
* Integration Policy
|
||||
*/
|
||||
export type PackagePolicyEditExtensionComponent = ComponentType<
|
||||
PackagePolicyEditExtensionComponentProps
|
||||
>;
|
||||
export type PackagePolicyEditExtensionComponent = ComponentType<PackagePolicyEditExtensionComponentProps>;
|
||||
|
||||
export interface PackagePolicyEditExtensionComponentProps {
|
||||
/** The current integration policy being edited */
|
||||
|
@ -51,9 +49,7 @@ export interface PackagePolicyEditExtension {
|
|||
* UI Component Extension is used on the pages displaying the ability to Create an
|
||||
* Integration Policy
|
||||
*/
|
||||
export type PackagePolicyCreateExtensionComponent = ComponentType<
|
||||
PackagePolicyCreateExtensionComponentProps
|
||||
>;
|
||||
export type PackagePolicyCreateExtensionComponent = ComponentType<PackagePolicyCreateExtensionComponentProps>;
|
||||
|
||||
export interface PackagePolicyCreateExtensionComponentProps {
|
||||
/** The integration policy being created */
|
||||
|
|
|
@ -35,9 +35,9 @@ import * as AgentService from '../../services/agents';
|
|||
import * as APIKeyService from '../../services/api_keys';
|
||||
import { appContextService } from '../../services/app_context';
|
||||
|
||||
export const getAgentHandler: RequestHandler<TypeOf<
|
||||
typeof GetOneAgentRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const getAgentHandler: RequestHandler<
|
||||
TypeOf<typeof GetOneAgentRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
try {
|
||||
const agent = await AgentService.getAgent(soClient, request.params.agentId);
|
||||
|
@ -94,9 +94,9 @@ export const getAgentEventsHandler: RequestHandler<
|
|||
}
|
||||
};
|
||||
|
||||
export const deleteAgentHandler: RequestHandler<TypeOf<
|
||||
typeof DeleteAgentRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const deleteAgentHandler: RequestHandler<
|
||||
TypeOf<typeof DeleteAgentRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
try {
|
||||
await AgentService.deleteAgent(soClient, request.params.agentId);
|
||||
|
|
|
@ -70,9 +70,9 @@ export const getAgentPoliciesHandler: RequestHandler<
|
|||
}
|
||||
};
|
||||
|
||||
export const getOneAgentPolicyHandler: RequestHandler<TypeOf<
|
||||
typeof GetOneAgentPolicyRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const getOneAgentPolicyHandler: RequestHandler<
|
||||
TypeOf<typeof GetOneAgentPolicyRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
try {
|
||||
const agentPolicy = await agentPolicyService.get(soClient, request.params.agentPolicyId);
|
||||
|
|
|
@ -60,9 +60,9 @@ export const postEnrollmentApiKeyHandler: RequestHandler<
|
|||
}
|
||||
};
|
||||
|
||||
export const deleteEnrollmentApiKeyHandler: RequestHandler<TypeOf<
|
||||
typeof DeleteEnrollmentAPIKeyRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const deleteEnrollmentApiKeyHandler: RequestHandler<
|
||||
TypeOf<typeof DeleteEnrollmentAPIKeyRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
try {
|
||||
await APIKeyService.deleteEnrollmentApiKey(soClient, request.params.keyId);
|
||||
|
@ -80,9 +80,9 @@ export const deleteEnrollmentApiKeyHandler: RequestHandler<TypeOf<
|
|||
}
|
||||
};
|
||||
|
||||
export const getOneEnrollmentApiKeyHandler: RequestHandler<TypeOf<
|
||||
typeof GetOneEnrollmentAPIKeyRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const getOneEnrollmentApiKeyHandler: RequestHandler<
|
||||
TypeOf<typeof GetOneEnrollmentAPIKeyRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
try {
|
||||
const apiKey = await APIKeyService.getEnrollmentAPIKey(soClient, request.params.keyId);
|
||||
|
|
|
@ -246,9 +246,9 @@ export const installPackageByUploadHandler: RequestHandler<
|
|||
}
|
||||
};
|
||||
|
||||
export const deletePackageHandler: RequestHandler<TypeOf<
|
||||
typeof DeletePackageRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const deletePackageHandler: RequestHandler<
|
||||
TypeOf<typeof DeletePackageRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
try {
|
||||
const { pkgkey } = request.params;
|
||||
const savedObjectsClient = context.core.savedObjects.client;
|
||||
|
|
|
@ -29,9 +29,9 @@ export const getOutputsHandler: RequestHandler = async (context, request, respon
|
|||
}
|
||||
};
|
||||
|
||||
export const getOneOuputHandler: RequestHandler<TypeOf<
|
||||
typeof GetOneOutputRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const getOneOuputHandler: RequestHandler<
|
||||
TypeOf<typeof GetOneOutputRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
try {
|
||||
const output = await outputService.get(soClient, request.params.outputId);
|
||||
|
|
|
@ -41,9 +41,9 @@ export const getPackagePoliciesHandler: RequestHandler<
|
|||
}
|
||||
};
|
||||
|
||||
export const getOnePackagePolicyHandler: RequestHandler<TypeOf<
|
||||
typeof GetOnePackagePolicyRequestSchema.params
|
||||
>> = async (context, request, response) => {
|
||||
export const getOnePackagePolicyHandler: RequestHandler<
|
||||
TypeOf<typeof GetOnePackagePolicyRequestSchema.params>
|
||||
> = async (context, request, response) => {
|
||||
const soClient = context.core.savedObjects.client;
|
||||
const { packagePolicyId } = request.params;
|
||||
const notFoundResponse = () =>
|
||||
|
|
|
@ -298,9 +298,9 @@ describe('test transform install', () => {
|
|||
(getInstallationObject as jest.MockedFunction<
|
||||
typeof getInstallationObject
|
||||
>).mockReturnValueOnce(
|
||||
Promise.resolve(({ attributes: { installed_es: [] } } as unknown) as SavedObject<
|
||||
Installation
|
||||
>)
|
||||
Promise.resolve(({
|
||||
attributes: { installed_es: [] },
|
||||
} as unknown) as SavedObject<Installation>)
|
||||
);
|
||||
legacyScopedClusterClient.callAsCurrentUser = jest.fn();
|
||||
await installTransform(
|
||||
|
|
|
@ -33,7 +33,9 @@ const expectedResults = (...ids: string[]) => ids.map((id) => expect.objectConta
|
|||
describe('POST /internal/global_search/find', () => {
|
||||
let server: SetupServerReturn['server'];
|
||||
let httpSetup: SetupServerReturn['httpSetup'];
|
||||
let globalSearchHandlerContext: ReturnType<typeof globalSearchPluginMock.createRouteHandlerContext>;
|
||||
let globalSearchHandlerContext: ReturnType<
|
||||
typeof globalSearchPluginMock.createRouteHandlerContext
|
||||
>;
|
||||
|
||||
beforeEach(async () => {
|
||||
({ server, httpSetup } = await setupServer(pluginId));
|
||||
|
|
|
@ -173,9 +173,9 @@ describe('applicationResultProvider', () => {
|
|||
|
||||
// test scheduler doesnt play well with promises. need to workaround by passing
|
||||
// an observable instead. Behavior with promise is asserted in previous tests of the suite
|
||||
const applicationPromise = (hot('a', { a: application }) as unknown) as Promise<
|
||||
ApplicationStart
|
||||
>;
|
||||
const applicationPromise = (hot('a', {
|
||||
a: application,
|
||||
}) as unknown) as Promise<ApplicationStart>;
|
||||
|
||||
const provider = createApplicationResultProvider(applicationPromise);
|
||||
|
||||
|
@ -198,9 +198,9 @@ describe('applicationResultProvider', () => {
|
|||
|
||||
// test scheduler doesnt play well with promises. need to workaround by passing
|
||||
// an observable instead. Behavior with promise is asserted in previous tests of the suite
|
||||
const applicationPromise = (hot('a', { a: application }) as unknown) as Promise<
|
||||
ApplicationStart
|
||||
>;
|
||||
const applicationPromise = (hot('a', {
|
||||
a: application,
|
||||
}) as unknown) as Promise<ApplicationStart>;
|
||||
|
||||
const provider = createApplicationResultProvider(applicationPromise);
|
||||
|
||||
|
|
|
@ -164,9 +164,9 @@ describe('settings', () => {
|
|||
});
|
||||
|
||||
it('should set advanced settings', () => {
|
||||
input('Sample size').prop('onChange')!({ target: { valueAsNumber: 13 } } as React.ChangeEvent<
|
||||
HTMLInputElement
|
||||
>);
|
||||
input('Sample size').prop('onChange')!({
|
||||
target: { valueAsNumber: 13 },
|
||||
} as React.ChangeEvent<HTMLInputElement>);
|
||||
|
||||
expect(dispatchSpy).toHaveBeenCalledWith(
|
||||
updateSettings(
|
||||
|
|
|
@ -15,9 +15,9 @@ interface MatchParams {
|
|||
componentTemplateName?: string;
|
||||
}
|
||||
|
||||
export const ComponentTemplateListContainer: React.FunctionComponent<RouteComponentProps<
|
||||
MatchParams
|
||||
>> = ({
|
||||
export const ComponentTemplateListContainer: React.FunctionComponent<
|
||||
RouteComponentProps<MatchParams>
|
||||
> = ({
|
||||
match: {
|
||||
params: { componentTemplateName },
|
||||
},
|
||||
|
|
|
@ -45,9 +45,10 @@ interface Props {
|
|||
}
|
||||
|
||||
export const MappingsEditor = React.memo(({ onChange, value, indexSettings }: Props) => {
|
||||
const { parsedDefaultValue, multipleMappingsDeclared } = useMemo<
|
||||
MappingsEditorParsedMetadata
|
||||
>(() => {
|
||||
const {
|
||||
parsedDefaultValue,
|
||||
multipleMappingsDeclared,
|
||||
} = useMemo<MappingsEditorParsedMetadata>(() => {
|
||||
const mappingsDefinition = extractMappingsDefinition(value);
|
||||
|
||||
if (mappingsDefinition === null) {
|
||||
|
|
|
@ -11,10 +11,9 @@ import {
|
|||
missingMlSetupPrivilegesDescription,
|
||||
} from './missing_privileges_messages';
|
||||
|
||||
export const MissingSetupPrivilegesToolTip: React.FC<Omit<
|
||||
PropsOf<EuiToolTip>,
|
||||
'content' | 'title'
|
||||
>> = (props) => (
|
||||
export const MissingSetupPrivilegesToolTip: React.FC<
|
||||
Omit<PropsOf<EuiToolTip>, 'content' | 'title'>
|
||||
> = (props) => (
|
||||
<EuiToolTip
|
||||
{...props}
|
||||
content={missingMlSetupPrivilegesDescription}
|
||||
|
|
|
@ -20,6 +20,4 @@ export const createKibanaContextForPlugin = (core: CoreStart, pluginsStart: Infr
|
|||
...pluginsStart,
|
||||
});
|
||||
|
||||
export const useKibanaContextForPlugin = useKibana as () => KibanaReactContextValue<
|
||||
PluginKibanaContextValue
|
||||
>;
|
||||
export const useKibanaContextForPlugin = useKibana as () => KibanaReactContextValue<PluginKibanaContextValue>;
|
||||
|
|
|
@ -37,9 +37,10 @@ export const useLogEntryCategoriesResults = ({
|
|||
}) => {
|
||||
const { services } = useKibanaContextForPlugin();
|
||||
const [topLogEntryCategories, setTopLogEntryCategories] = useState<TopLogEntryCategories>([]);
|
||||
const [logEntryCategoryDatasets, setLogEntryCategoryDatasets] = useState<
|
||||
LogEntryCategoryDatasets
|
||||
>([]);
|
||||
const [
|
||||
logEntryCategoryDatasets,
|
||||
setLogEntryCategoryDatasets,
|
||||
] = useState<LogEntryCategoryDatasets>([]);
|
||||
|
||||
const [getTopLogEntryCategoriesRequest, getTopLogEntryCategories] = useTrackedPromise(
|
||||
{
|
||||
|
|
|
@ -284,9 +284,10 @@ export const useLogEntryAnomaliesResults = ({
|
|||
);
|
||||
|
||||
// Anomalies datasets
|
||||
const [logEntryAnomaliesDatasets, setLogEntryAnomaliesDatasets] = useState<
|
||||
LogEntryAnomaliesDatasets
|
||||
>([]);
|
||||
const [
|
||||
logEntryAnomaliesDatasets,
|
||||
setLogEntryAnomaliesDatasets,
|
||||
] = useState<LogEntryAnomaliesDatasets>([]);
|
||||
|
||||
const [getLogEntryAnomaliesDatasetsRequest, getLogEntryAnomaliesDatasets] = useTrackedPromise(
|
||||
{
|
||||
|
|
|
@ -35,10 +35,9 @@ export function prependDatasourceExpression(
|
|||
if (datasourceExpressions.length === 0 || visualizationExpression === null) {
|
||||
return null;
|
||||
}
|
||||
const parsedDatasourceExpressions: Array<[
|
||||
string,
|
||||
Ast
|
||||
]> = datasourceExpressions.map(([layerId, expr]) => [
|
||||
const parsedDatasourceExpressions: Array<
|
||||
[string, Ast]
|
||||
> = datasourceExpressions.map(([layerId, expr]) => [
|
||||
layerId,
|
||||
typeof expr === 'string' ? fromExpression(expr) : expr,
|
||||
]);
|
||||
|
|
|
@ -18,15 +18,11 @@ import { DimensionEditor } from './dimension_editor';
|
|||
import { DateRange } from '../../../common';
|
||||
import { getOperationSupportMatrix } from './operation_support';
|
||||
|
||||
export type IndexPatternDimensionTriggerProps = DatasourceDimensionTriggerProps<
|
||||
IndexPatternPrivateState
|
||||
> & {
|
||||
export type IndexPatternDimensionTriggerProps = DatasourceDimensionTriggerProps<IndexPatternPrivateState> & {
|
||||
uniqueLabel: string;
|
||||
};
|
||||
|
||||
export type IndexPatternDimensionEditorProps = DatasourceDimensionEditorProps<
|
||||
IndexPatternPrivateState
|
||||
> & {
|
||||
export type IndexPatternDimensionEditorProps = DatasourceDimensionEditorProps<IndexPatternPrivateState> & {
|
||||
uiSettings: IUiSettingsClient;
|
||||
storage: IStorageWrapper;
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
|
|
|
@ -218,18 +218,18 @@ const removeInvalidAccessors: SavedObjectMigrationFn<
|
|||
if (newDoc.attributes.visualizationType === 'lnsXY') {
|
||||
const datasourceLayers = newDoc.attributes.state.datasourceStates.indexpattern.layers || {};
|
||||
const xyState = newDoc.attributes.state.visualization;
|
||||
(newDoc.attributes as LensDocShapePre710<
|
||||
XYStatePost77
|
||||
>).state.visualization.layers = xyState.layers.map((layer: XYLayerPre77) => {
|
||||
const layerId = layer.layerId;
|
||||
const datasource = datasourceLayers[layerId];
|
||||
return {
|
||||
...layer,
|
||||
xAccessor: datasource?.columns[layer.xAccessor] ? layer.xAccessor : undefined,
|
||||
splitAccessor: datasource?.columns[layer.splitAccessor] ? layer.splitAccessor : undefined,
|
||||
accessors: layer.accessors.filter((accessor) => !!datasource?.columns[accessor]),
|
||||
};
|
||||
});
|
||||
(newDoc.attributes as LensDocShapePre710<XYStatePost77>).state.visualization.layers = xyState.layers.map(
|
||||
(layer: XYLayerPre77) => {
|
||||
const layerId = layer.layerId;
|
||||
const datasource = datasourceLayers[layerId];
|
||||
return {
|
||||
...layer,
|
||||
xAccessor: datasource?.columns[layer.xAccessor] ? layer.xAccessor : undefined,
|
||||
splitAccessor: datasource?.columns[layer.splitAccessor] ? layer.splitAccessor : undefined,
|
||||
accessors: layer.accessors.filter((accessor) => !!datasource?.columns[accessor]),
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
return newDoc;
|
||||
};
|
||||
|
|
|
@ -47,9 +47,7 @@ export const getExceptionListItemSchemaMock = (): ExceptionListItemSchema => ({
|
|||
* This is useful for end to end tests where we remove the auto generated parts for comparisons
|
||||
* such as created_at, updated_at, and id.
|
||||
*/
|
||||
export const getExceptionListItemResponseMockWithoutAutoGeneratedValues = (): Partial<
|
||||
ExceptionListItemSchema
|
||||
> => ({
|
||||
export const getExceptionListItemResponseMockWithoutAutoGeneratedValues = (): Partial<ExceptionListItemSchema> => ({
|
||||
comments: [],
|
||||
created_by: ELASTIC_USER,
|
||||
description: DESCRIPTION,
|
||||
|
|
|
@ -60,9 +60,7 @@ export const getTrustedAppsListSchemaMock = (): ExceptionListSchema => {
|
|||
* This is useful for end to end tests where we remove the auto generated parts for comparisons
|
||||
* such as created_at, updated_at, and id.
|
||||
*/
|
||||
export const getExceptionResponseMockWithoutAutoGeneratedValues = (): Partial<
|
||||
ExceptionListSchema
|
||||
> => ({
|
||||
export const getExceptionResponseMockWithoutAutoGeneratedValues = (): Partial<ExceptionListSchema> => ({
|
||||
created_by: ELASTIC_USER,
|
||||
description: DESCRIPTION,
|
||||
immutable: IMMUTABLE,
|
||||
|
|
|
@ -87,9 +87,9 @@ const importList = async ({
|
|||
list_id,
|
||||
type,
|
||||
signal,
|
||||
}: ApiParams & ImportListItemSchemaEncoded & ImportListItemQuerySchemaEncoded): Promise<
|
||||
ListSchema
|
||||
> => {
|
||||
}: ApiParams &
|
||||
ImportListItemSchemaEncoded &
|
||||
ImportListItemQuerySchemaEncoded): Promise<ListSchema> => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file as Blob);
|
||||
|
||||
|
|
|
@ -47,9 +47,7 @@ class MockDynamicStyleProperty {
|
|||
const defaultProps = {
|
||||
iconPaletteId: 'filledShapes',
|
||||
onChange: () => {},
|
||||
styleProperty: (new MockDynamicStyleProperty() as unknown) as IDynamicStyleProperty<
|
||||
IconDynamicOptions
|
||||
>,
|
||||
styleProperty: (new MockDynamicStyleProperty() as unknown) as IDynamicStyleProperty<IconDynamicOptions>,
|
||||
isCustomOnly: false,
|
||||
};
|
||||
|
||||
|
|
|
@ -65,9 +65,10 @@ interface Props {
|
|||
}
|
||||
|
||||
export const SupportedFieldsMessage: FC<Props> = ({ jobType }) => {
|
||||
const [sourceIndexContainsSupportedFields, setSourceIndexContainsSupportedFields] = useState<
|
||||
boolean
|
||||
>(true);
|
||||
const [
|
||||
sourceIndexContainsSupportedFields,
|
||||
setSourceIndexContainsSupportedFields,
|
||||
] = useState<boolean>(true);
|
||||
const [sourceIndexFieldsCheckFailed, setSourceIndexFieldsCheckFailed] = useState<boolean>(false);
|
||||
const { fields } = newJobCapsService;
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ describe('AnomalySwimlaneEmbeddableFactory', () => {
|
|||
} as AnomalySwimlaneEmbeddableInput);
|
||||
|
||||
// assert
|
||||
const mockCalls = ((AnomalySwimlaneEmbeddable as unknown) as jest.Mock<
|
||||
AnomalySwimlaneEmbeddable
|
||||
>).mock.calls[0];
|
||||
const mockCalls = ((AnomalySwimlaneEmbeddable as unknown) as jest.Mock<AnomalySwimlaneEmbeddable>)
|
||||
.mock.calls[0];
|
||||
const input = mockCalls[0];
|
||||
const createServices = mockCalls[1];
|
||||
|
||||
|
|
|
@ -99,28 +99,31 @@ function createLocalStateModule(
|
|||
) {
|
||||
angular
|
||||
.module('monitoring/State', ['monitoring/Private'])
|
||||
.service('globalState', function (
|
||||
Private: IPrivate,
|
||||
$rootScope: ng.IRootScopeService,
|
||||
$location: ng.ILocationService
|
||||
) {
|
||||
function GlobalStateProvider(this: any) {
|
||||
const state = new GlobalState(query, toasts, $rootScope, $location, this);
|
||||
const initialState: any = state.getState();
|
||||
for (const key in initialState) {
|
||||
if (!initialState.hasOwnProperty(key)) {
|
||||
continue;
|
||||
.service(
|
||||
'globalState',
|
||||
function (
|
||||
Private: IPrivate,
|
||||
$rootScope: ng.IRootScopeService,
|
||||
$location: ng.ILocationService
|
||||
) {
|
||||
function GlobalStateProvider(this: any) {
|
||||
const state = new GlobalState(query, toasts, $rootScope, $location, this);
|
||||
const initialState: any = state.getState();
|
||||
for (const key in initialState) {
|
||||
if (!initialState.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
this[key] = initialState[key];
|
||||
}
|
||||
this[key] = initialState[key];
|
||||
this.save = () => {
|
||||
const newState = { ...this };
|
||||
delete newState.save;
|
||||
state.setState(newState);
|
||||
};
|
||||
}
|
||||
this.save = () => {
|
||||
const newState = { ...this };
|
||||
delete newState.save;
|
||||
state.setState(newState);
|
||||
};
|
||||
return Private(GlobalStateProvider);
|
||||
}
|
||||
return Private(GlobalStateProvider);
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function createMonitoringAppServices() {
|
||||
|
|
|
@ -9,10 +9,9 @@ import { cryptoFactory } from '../../lib';
|
|||
import { CreateJobFn, CreateJobFnFactory } from '../../types';
|
||||
import { IndexPatternSavedObject, JobParamsCSV, TaskPayloadCSV } from './types';
|
||||
|
||||
export const createJobFnFactory: CreateJobFnFactory<CreateJobFn<
|
||||
JobParamsCSV,
|
||||
TaskPayloadCSV
|
||||
>> = function createJobFactoryFn(reporting, parentLogger) {
|
||||
export const createJobFnFactory: CreateJobFnFactory<
|
||||
CreateJobFn<JobParamsCSV, TaskPayloadCSV>
|
||||
> = function createJobFactoryFn(reporting, parentLogger) {
|
||||
const logger = parentLogger.clone([CSV_JOB_TYPE, 'create-job']);
|
||||
|
||||
const config = reporting.getConfig();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue