-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into query-diff-algorithm
- Loading branch information
Showing
25 changed files
with
506 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
x-pack/plugins/observability_solution/investigate_app/common/schema/create.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { investigationResponseSchema } from './investigation'; | ||
|
||
const createInvestigationParamsSchema = t.type({ | ||
body: t.type({ | ||
id: t.string, | ||
title: t.string, | ||
parameters: t.type({ | ||
timeRange: t.type({ from: t.number, to: t.number }), | ||
}), | ||
}), | ||
}); | ||
|
||
const createInvestigationResponseSchema = investigationResponseSchema; | ||
|
||
type CreateInvestigationInput = t.OutputOf<typeof createInvestigationParamsSchema.props.body>; // Raw payload sent by the frontend | ||
type CreateInvestigationParams = t.TypeOf<typeof createInvestigationParamsSchema.props.body>; // Parsed payload used by the backend | ||
type CreateInvestigationResponse = t.OutputOf<typeof createInvestigationResponseSchema>; // Raw response sent to the frontend | ||
|
||
export { createInvestigationParamsSchema, createInvestigationResponseSchema }; | ||
export type { CreateInvestigationInput, CreateInvestigationParams, CreateInvestigationResponse }; |
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/observability_solution/investigate_app/common/schema/find.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { investigationResponseSchema } from './investigation'; | ||
|
||
const findInvestigationsParamsSchema = t.partial({ | ||
query: t.partial({ | ||
page: t.string, | ||
perPage: t.string, | ||
}), | ||
}); | ||
|
||
const findInvestigationsResponseSchema = t.type({ | ||
page: t.number, | ||
perPage: t.number, | ||
total: t.number, | ||
results: t.array(investigationResponseSchema), | ||
}); | ||
|
||
type FindInvestigationsParams = t.TypeOf<typeof findInvestigationsParamsSchema.props.query>; // Parsed payload used by the backend | ||
type FindInvestigationsResponse = t.OutputOf<typeof findInvestigationsResponseSchema>; // Raw response sent to the frontend | ||
|
||
export { findInvestigationsParamsSchema, findInvestigationsResponseSchema }; | ||
export type { FindInvestigationsParams, FindInvestigationsResponse }; |
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/observability_solution/investigate_app/common/schema/get.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
import { investigationResponseSchema } from './investigation'; | ||
|
||
const getInvestigationParamsSchema = t.type({ | ||
path: t.type({ | ||
id: t.string, | ||
}), | ||
}); | ||
|
||
const getInvestigationResponseSchema = investigationResponseSchema; | ||
|
||
type GetInvestigationParams = t.TypeOf<typeof getInvestigationParamsSchema.props.path>; // Parsed payload used by the backend | ||
type GetInvestigationResponse = t.OutputOf<typeof getInvestigationResponseSchema>; // Raw response sent to the frontend | ||
|
||
export { getInvestigationParamsSchema, getInvestigationResponseSchema }; | ||
export type { GetInvestigationParams, GetInvestigationResponse }; |
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/observability_solution/investigate_app/common/schema/investigation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import * as t from 'io-ts'; | ||
|
||
const investigationResponseSchema = t.type({ | ||
id: t.string, | ||
title: t.string, | ||
createdAt: t.number, | ||
createdBy: t.string, | ||
parameters: t.type({ | ||
timeRange: t.type({ from: t.number, to: t.number }), | ||
}), | ||
}); | ||
|
||
type InvestigationResponse = t.OutputOf<typeof investigationResponseSchema>; | ||
|
||
export { investigationResponseSchema }; | ||
export type { InvestigationResponse }; |
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/observability_solution/investigate_app/server/models/investigation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const investigationSchema = t.type({ | ||
id: t.string, | ||
title: t.string, | ||
createdAt: t.number, | ||
createdBy: t.string, | ||
parameters: t.type({ | ||
timeRange: t.type({ from: t.number, to: t.number }), | ||
}), | ||
}); | ||
|
||
export type Investigation = t.TypeOf<typeof investigationSchema>; | ||
export type StoredInvestigation = t.OutputOf<typeof investigationSchema>; |
18 changes: 18 additions & 0 deletions
18
x-pack/plugins/observability_solution/investigate_app/server/models/pagination.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export interface Paginated<T> { | ||
total: number; | ||
page: number; | ||
perPage: number; | ||
results: T[]; | ||
} | ||
|
||
export interface Pagination { | ||
page: number; | ||
perPage: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
x-pack/plugins/observability_solution/investigate_app/server/saved_objects/investigation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { SavedObjectsType } from '@kbn/core-saved-objects-server'; | ||
import { SavedObject } from '@kbn/core/server'; | ||
import { StoredInvestigation } from '../models/investigation'; | ||
|
||
export const SO_INVESTIGATION_TYPE = 'investigation'; | ||
|
||
export const investigation: SavedObjectsType = { | ||
name: SO_INVESTIGATION_TYPE, | ||
hidden: false, | ||
namespaceType: 'multiple-isolated', | ||
switchToModelVersionAt: '8.10.0', | ||
mappings: { | ||
dynamic: false, | ||
properties: { | ||
id: { type: 'keyword' }, | ||
title: { type: 'text' }, | ||
}, | ||
}, | ||
management: { | ||
displayName: 'Investigation', | ||
importableAndExportable: false, | ||
getTitle(savedObject: SavedObject<StoredInvestigation>) { | ||
return `Investigation: [${savedObject.attributes.title}]`; | ||
}, | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
...ck/plugins/observability_solution/investigate_app/server/services/create_investigation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { CreateInvestigationInput, CreateInvestigationResponse } from '../../common/schema/create'; | ||
import { InvestigationRepository } from './investigation_repository'; | ||
|
||
export async function createInvestigation( | ||
params: CreateInvestigationInput, | ||
repository: InvestigationRepository | ||
): Promise<CreateInvestigationResponse> { | ||
const investigation = { ...params, createdAt: Date.now(), createdBy: 'elastic' }; | ||
await repository.save(investigation); | ||
|
||
return investigation; | ||
} |
Oops, something went wrong.