Skip to content

Commit

Permalink
Merge branch 'main' into test/unskip_timelines_cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
logeekal authored Oct 25, 2024
2 parents ef3025e + d1eb478 commit e413f03
Show file tree
Hide file tree
Showing 113 changed files with 13,078 additions and 744 deletions.
17 changes: 9 additions & 8 deletions .buildkite/scripts/steps/storybooks/build_and_upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,45 @@ const STORYBOOKS = [
'canvas',
'cases',
'cell_actions',
'coloring',
'chart_icons',
'cloud_security_posture_packages',
'coloring',
'content_management_examples',
'custom_integrations',
'dashboard_enhanced',
'dashboard',
'data',
'logs_explorer',
'embeddable',
'esql_editor',
'expression_error',
'expression_image',
'expression_metric',
'expression_repeat_image',
'expression_reveal_image',
'expression_shape',
'expression_tagcloud',
'management',
'fleet',
'grouping',
'home',
'infra',
'kibana_react',
'language_documentation_popover',
'lists',
'observability',
'logs_explorer',
'management',
'observability_ai_assistant',
'observability_inventory',
'observability_shared',
'observability',
'presentation',
'security_solution',
'random_sampling',
'security_solution_packages',
'security_solution',
'serverless',
'shared_ux',
'triggers_actions_ui',
'ui_actions_enhanced',
'language_documentation_popover',
'unified_search',
'random_sampling',
'esql_editor',
];

const GITHUB_CONTEXT = 'Build and Publish Storybooks';
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1911,10 +1911,10 @@ x-pack/plugins/osquery @elastic/security-defend-workflows
/x-pack/plugins/security_solution/public/detections/components/osquery @elastic/security-defend-workflows

# Cloud Defend
/x-pack/plugins/cloud_defend/ @elastic/kibana-cloud-security-posture
/x-pack/plugins/security_solution/public/cloud_defend @elastic/kibana-cloud-security-posture

# Cloud Security Posture
x-pack/packages/kbn-cloud-security-posture @elastic/kibana-cloud-security-posture
/x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.* @elastic/kibana-cloud-security-posture
/x-pack/plugins/security_solution/public/cloud_security_posture @elastic/kibana-cloud-security-posture
/x-pack/test/api_integration/apis/cloud_security_posture/ @elastic/kibana-cloud-security-posture
Expand Down
6 changes: 3 additions & 3 deletions docs/api/synthetics/params/edit-param.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ You must have `all` privileges for the *Synthetics* feature in the *{observabili
[[parameter-edit-request-body]]
==== Request body

The request body should contain the following attributes:
The request body can contain the following attributes, it can't be empty at least one attribute is required.:

`key`::
(Required, string) The key of the parameter.
(Optional, string) The key of the parameter.

`value`::
(Required, string) The updated value associated with the parameter.
(Optional, string) The updated value associated with the parameter.

`description`::
(Optional, string) The updated description of the parameter.
Expand Down
21 changes: 21 additions & 0 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,27 @@ export function getWebpackConfig(
},
},
},
{
test: /\.js$/,
include: /node_modules[\\\/]@dagrejs/,
use: {
loader: 'babel-loader',
options: {
envName: worker.dist ? 'production' : 'development',
presets: ['@babel/preset-env'], // Doesn't work with BABEL_PRESET
plugins: ['@babel/plugin-proposal-class-properties'],
},
},
},
{
test: /node_modules[\/\\]@?xyflow[\/\\].*.js$/,
loaders: 'babel-loader',
options: {
envName: worker.dist ? 'production' : 'development',
presets: [BABEL_PRESET],
plugins: ['@babel/plugin-transform-logical-assignment-operators'],
},
},
{
test: /\.(html|md|txt|tmpl)$/,
use: {
Expand Down
19 changes: 19 additions & 0 deletions packages/kbn-storybook/src/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,25 @@ export default ({ config: storybookConfig }: { config: Configuration }) => {
},
},
},
{
test: /\.js$/,
include: /node_modules[\\\/]@dagrejs/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'], // Doesn't work with @kbn/babel-preset/webpack_preset
plugins: ['@babel/plugin-proposal-class-properties'],
},
},
},
{
test: /node_modules[\/\\]@?xyflow[\/\\].*.js$/,
loaders: 'babel-loader',
options: {
presets: [require.resolve('@kbn/babel-preset/webpack_preset')],
plugins: ['@babel/plugin-transform-logical-assignment-operators'],
},
},
],
},
plugins: [new IgnoreNotFoundExportPlugin()],
Expand Down
11 changes: 5 additions & 6 deletions test/functional/apps/discover/group3/_lens_vis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return seriesType;
}

// Failing: See https://github.com/elastic/kibana/issues/197342
describe.skip('discover lens vis', function () {
describe('discover lens vis', function () {
before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
Expand Down Expand Up @@ -616,8 +615,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await getCurrentVisTitle()).to.be('Pie');
await testSubjects.existOrFail('partitionVisChart');

await discover.chooseLensSuggestion('barVerticalStacked');
await changeVisShape('Line');
await discover.chooseLensSuggestion('waffle');
await changeVisShape('Treemap');

await testSubjects.existOrFail('unsavedChangesBadge');
await discover.saveUnsavedChanges();
Expand All @@ -626,8 +625,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await discover.waitUntilSearchingHasFinished();

await testSubjects.missingOrFail('unsavedChangesBadge');
expect(await getCurrentVisTitle()).to.be('Line');
await testSubjects.existOrFail('xyVisChart');
expect(await getCurrentVisTitle()).to.be('Treemap');
await testSubjects.existOrFail('partitionVisChart');
});

it('should close lens flyout on revert changes', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

{
"id": "@kbn/cloud-security-posture-common",
"owner": "@elastic/kibana-cloud-security-posture",
"type": "shared-common"
}
"id": "@kbn/cloud-security-posture-common",
"owner": "@elastic/kibana-cloud-security-posture",
"type": "shared-common"
}
14 changes: 7 additions & 7 deletions x-pack/packages/kbn-cloud-security-posture/common/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@kbn/cloud-security-posture-common",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0",
"description": "Shared components for cloud security posture, both client and server side",
"sideEffects": false
}
"name": "@kbn/cloud-security-posture-common",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0",
"description": "Shared components for cloud security posture, both client and server side",
"sideEffects": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export const groupNodeDataSchema = schema.allOf([
export const labelNodeDataSchema = schema.allOf([
nodeBaseDataSchema,
schema.object({
source: schema.string(),
target: schema.string(),
shape: schema.literal('label'),
parentId: schema.maybe(schema.string()),
color: colorSchema,
Expand All @@ -82,8 +80,6 @@ export const labelNodeDataSchema = schema.allOf([
export const edgeDataSchema = schema.object({
id: schema.string(),
source: schema.string(),
sourceShape: nodeShapeSchema,
target: schema.string(),
targetShape: nodeShapeSchema,
color: colorSchema,
});
99 changes: 96 additions & 3 deletions x-pack/packages/kbn-cloud-security-posture/graph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,104 @@ security solution plugin.

## How to use this

Standalone examples will follow. In the meantime check out storybook to view the graph's progress.
### Step 1: Import the Component

## The most important public api members
First, import the `Graph` component into your desired file.

- GraphComponent itself (comming soon..)
```tsx
import { Graph } from '@kbn/cloud-security-posture-graph';
```

### Step 2: Prepare the Data

Create the nodes and edges data models. These should follow the `NodeViewModel` and `EdgeViewModel` interfaces.

```tsx
const nodes: NodeViewModel[] = [
{
id: 'node1',
label: 'Node 1',
color: 'primary',
shape: 'ellipse',
icon: 'user',
},
{
id: 'node2',
label: 'Node 2',
color: 'primary',
shape: 'hexagon',
icon: 'questionInCircle',
},
];

const edges: EdgeViewModel[] = [
{
id: 'edge1',
source: 'node1',
target: 'node2',
color: 'primary',
},
];
```

### Step 3: Render the Component

Use the `Graph` component in your JSX/TSX, passing the nodes, edges, and interactivity flag as props.

```tsx
<Graph nodes={nodes} edges={edges} interactive={true} />
```

### Example Usage

Here is a complete example of how to use the `Graph` component in a React component.

```tsx
import React from 'react';
import { Graph } from '@kbn/cloud-security-posture-graph';
import type { NodeViewModel, EdgeViewModel } from '@kbn/cloud-security-posture-graph';

const App: React.FC = () => {
const nodes: NodeViewModel[] = [
{
id: 'node1',
label: 'Node 1',
color: 'primary',
shape: 'ellipse',
icon: 'user',
},
{
id: 'node2',
label: 'Node 2',
color: 'primary',
shape: 'hexagon',
icon: 'questionInCircle',
},
];

const edges: EdgeViewModel[] = [
{
id: 'edge1',
source: 'node1',
target: 'node2',
color: 'primary',
},
];

return (
<div>
<h1>Graph Visualization</h1>
<Graph nodes={nodes} edges={edges} interactive={true} />
</div>
);
};

export default App;
```

### Storybook Example

You can also see how the `Graph` component is used in the Storybook file `graph_layout.stories.tsx`.

### Extras

Expand Down
2 changes: 2 additions & 0 deletions x-pack/packages/kbn-cloud-security-posture/graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export * from './src/components';
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ module.exports = {
preset: '@kbn/test',
roots: ['<rootDir>/x-pack/packages/kbn-cloud-security-posture/graph'],
rootDir: '../../../..',
setupFiles: ['jest-canvas-mock'],
setupFilesAfterEnv: ['<rootDir>/x-pack/packages/kbn-cloud-security-posture/graph/setup_tests.ts'],
};
4 changes: 2 additions & 2 deletions x-pack/packages/kbn-cloud-security-posture/graph/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "shared-browser",
"id": "@kbn/cloud-security-posture-graph",
"owner": "@elastic/kibana-cloud-security-posture"
"owner": "@elastic/kibana-cloud-security-posture",
"type": "shared-browser"
}
13 changes: 13 additions & 0 deletions x-pack/packages/kbn-cloud-security-posture/graph/setup_tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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.
*/

// eslint-disable-next-line @kbn/imports/no_boundary_crossing
import { mockReactFlow } from './src/components/mock/react_flow';
// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';

mockReactFlow();
Loading

0 comments on commit e413f03

Please sign in to comment.