Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .buildkite/scripts/steps/storybooks/build_and_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const STORYBOOKS = [
'apm',
'canvas',
'ci_composite',
'cloud',
'codeeditor',
'custom_integrations',
'dashboard_enhanced',
Expand Down
123 changes: 105 additions & 18 deletions api_docs/cloud.devdocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@
"id": "cloud",
"client": {
"classes": [],
"functions": [],
"functions": [
{
"parentPluginId": "cloud",
"id": "def-public.Chat",
"type": "Function",
"tags": [],
"label": "Chat",
"description": [],
"signature": [
"() => JSX.Element"
],
"path": "x-pack/plugins/cloud/public/components/index.tsx",
"deprecated": false,
"children": [],
"returnComment": [],
"initialIsOpen": false
}
],
"interfaces": [
{
"parentPluginId": "cloud",
Expand All @@ -11,7 +28,7 @@
"tags": [],
"label": "CloudConfigType",
"description": [],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false,
"children": [
{
Expand All @@ -24,7 +41,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -37,7 +54,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -50,7 +67,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -63,7 +80,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -76,7 +93,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -89,7 +106,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -102,8 +119,78 @@
"signature": [
"{ enabled: boolean; org_id?: string | undefined; }"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
"parentPluginId": "cloud",
"id": "def-public.CloudConfigType.chat",
"type": "Object",
"tags": [],
"label": "chat",
"description": [],
"signature": [
"{ enabled: boolean; chatURL: string; }"
],
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
}
],
"initialIsOpen": false
},
{
"parentPluginId": "cloud",
"id": "def-public.CloudStart",
"type": "Interface",
"tags": [],
"label": "CloudStart",
"description": [],
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false,
"children": [
{
"parentPluginId": "cloud",
"id": "def-public.CloudStart.CloudContextProvider",
"type": "Function",
"tags": [],
"label": "CloudContextProvider",
"description": [
"\nA React component that provides a pre-wired `React.Context` which connects components to Cloud services."
],
"signature": [
"React.FunctionComponent<{}>"
],
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false,
"returnComment": [],
"children": [
{
"parentPluginId": "cloud",
"id": "def-public.CloudStart.CloudContextProvider.$1",
"type": "CompoundType",
"tags": [],
"label": "props",
"description": [],
"signature": [
"P & { children?: React.ReactNode; }"
],
"path": "node_modules/@types/react/index.d.ts",
"deprecated": false
},
{
"parentPluginId": "cloud",
"id": "def-public.CloudStart.CloudContextProvider.$2",
"type": "Any",
"tags": [],
"label": "context",
"description": [],
"signature": [
"any"
],
"path": "node_modules/@types/react/index.d.ts",
"deprecated": false
}
]
}
],
"initialIsOpen": false
Expand All @@ -119,7 +206,7 @@
"tags": [],
"label": "CloudSetup",
"description": [],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false,
"children": [
{
Expand All @@ -132,7 +219,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -145,7 +232,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -158,7 +245,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -171,7 +258,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -184,7 +271,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -197,7 +284,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -210,7 +297,7 @@
"signature": [
"string | undefined"
],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
},
{
Expand All @@ -220,7 +307,7 @@
"tags": [],
"label": "isCloudEnabled",
"description": [],
"path": "x-pack/plugins/cloud/public/plugin.ts",
"path": "x-pack/plugins/cloud/public/plugin.tsx",
"deprecated": false
}
],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
"json-stable-stringify": "^1.0.1",
"json-stringify-pretty-compact": "1.2.0",
"json-stringify-safe": "5.0.1",
"jsonwebtoken": "^8.3.0",
"jsts": "^1.6.2",
"kea": "^2.4.2",
"load-json-file": "^6.2.0",
Expand Down
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const storybookAliases = {
apm: 'x-pack/plugins/apm/.storybook',
canvas: 'x-pack/plugins/canvas/storybook',
ci_composite: '.ci/.storybook',
cloud: 'x-pack/plugins/cloud/.storybook',
codeeditor: 'src/plugins/kibana_react/public/code_editor/.storybook',
controls: 'src/plugins/controls/storybook',
custom_integrations: 'src/plugins/custom_integrations/storybook',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
jest.mock('jsonwebtoken', () => ({
sign: jest.fn(),
}));
// eslint-disable-next-line import/no-extraneous-dependencies

import jwt from 'jsonwebtoken';
import { Logger } from '../../../../../../src/core/server';
import { loggingSystemMock } from '../../../../../../src/core/server/mocks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
// eslint-disable-next-line import/no-extraneous-dependencies

import jwt, { Algorithm } from 'jsonwebtoken';
import { Logger } from '../../../../../../src/core/server';

Expand Down
35 changes: 35 additions & 0 deletions x-pack/plugins/cloud/.storybook/decorator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 React from 'react';
import { DecoratorFn } from '@storybook/react';
import { ServicesProvider, CloudServices } from '../public/services';

// TODO: move to a storybook implementation of the service using parameters.
const services: CloudServices = {
chat: {
enabled: true,
chatURL: 'https://elasticcloud-production-chat-us-east-1.s3.amazonaws.com/drift-iframe.html',
user: {
id: 'user-id',
email: '[email protected]',
// this doesn't affect chat appearance,
// but a user identity in Drift only
jwt: 'identity-jwt',
},
},
};

export const getCloudContextProvider: () => React.FC =
() =>
({ children }) =>
<ServicesProvider {...services}>{children}</ServicesProvider>;

export const getCloudContextDecorator: DecoratorFn = (storyFn) => {
const CloudContextProvider = getCloudContextProvider();
return <CloudContextProvider>{storyFn()}</CloudContextProvider>;
};
8 changes: 8 additions & 0 deletions x-pack/plugins/cloud/.storybook/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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 { getCloudContextDecorator, getCloudContextProvider } from './decorator';
10 changes: 10 additions & 0 deletions x-pack/plugins/cloud/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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 { defaultConfig } from '@kbn/storybook';

module.exports = defaultConfig;
Comment on lines +8 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
import { defaultConfig } from '@kbn/storybook';
module.exports = defaultConfig;
export { defaultConfig } from '@kbn/storybook';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FFR: Storybook crashes if you do this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? interesting

20 changes: 20 additions & 0 deletions x-pack/plugins/cloud/.storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 { addons } from '@storybook/addons';
import { create } from '@storybook/theming';
import { PANEL_ID } from '@storybook/addon-actions';

addons.setConfig({
theme: create({
base: 'light',
brandTitle: 'Cloud Storybook',
brandUrl: 'https://github.com/elastic/kibana/tree/main/x-pack/plugins/cloud',
}),
showPanel: true.valueOf,
selectedPanel: PANEL_ID,
});
11 changes: 11 additions & 0 deletions x-pack/plugins/cloud/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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 { addDecorator } from '@storybook/react';
import { getCloudContextDecorator } from './decorator';

addDecorator(getCloudContextDecorator);
1 change: 1 addition & 0 deletions x-pack/plugins/cloud/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

export const ELASTIC_SUPPORT_LINK = 'https://cloud.elastic.co/support';
export const GET_CHAT_USER_DATA_ROUTE_PATH = '/internal/cloud/chat_user';

/**
* This is the page for managing your snapshots on Cloud.
Expand Down
Loading