Skip to content

Commit

Permalink
Merge branch 'main' into load-action-speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jan 25, 2024
2 parents fa1b582 + 7284549 commit 1c07c24
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 32 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ node_repositories(
"https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v{version}/{filename}",
],
yarn_repositories = {
"1.22.19": ("yarn-v1.22.19.tar.gz", "yarn-v1.22.19", "732620bac8b1690d507274f025f3c6cfdc3627a84d9642e38a07452cc00e0f2e"),
"1.22.21": ("yarn-v1.22.21.tar.gz", "yarn-v1.22.21", "a55bb4e85405f5dfd6e7154a444e7e33ad305d7ca858bad8546e932a6688df08"),
},
yarn_version = "1.22.19",
yarn_version = "1.22.21",
yarn_urls = [
"https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}",
],
Expand Down
72 changes: 47 additions & 25 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;
const FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`;
const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`;
const OBSERVABILITY_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/`;
const APM_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/apm/`;
const SECURITY_SOLUTION_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/`;
const APP_SEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/app-search/${DOC_LINK_VERSION}/`;
Expand All @@ -38,6 +39,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
const MACHINE_LEARNING_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/`;
const SERVERLESS_DOCS = `${DOCS_WEBSITE_URL}serverless/`;
const SERVERLESS_ELASTICSEARCH_DOCS = `${SERVERLESS_DOCS}elasticsearch/`;
const SERVERLESS_OBSERVABILITY_DOCS = `${SERVERLESS_DOCS}observability/`;
const SEARCH_LABS_REPO = `${ELASTIC_GITHUB}elasticsearch-labs/`;
const isServerless = buildFlavor === 'serverless';

Expand All @@ -50,17 +52,27 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
},
apm: {
kibanaSettings: `${KIBANA_DOCS}apm-settings-in-kibana.html`,
supportedServiceMaps: `${KIBANA_DOCS}service-maps.html#service-maps-supported`,
customLinks: `${KIBANA_DOCS}custom-links.html`,
supportedServiceMaps: isServerless
? `${SERVERLESS_DOCS}apm-service-map#supported-apm-agents`
: `${KIBANA_DOCS}service-maps.html#service-maps-supported`,
customLinks: isServerless
? `${SERVERLESS_DOCS}apm-create-custom-links`
: `${KIBANA_DOCS}custom-links.html`,
droppedTransactionSpans: `${APM_DOCS}guide/${DOC_LINK_VERSION}/data-model-spans.html#data-model-dropped-spans`,
upgrading: `${APM_DOCS}guide/${DOC_LINK_VERSION}/upgrade.html`,
metaData: `${APM_DOCS}guide/${DOC_LINK_VERSION}/data-model-metadata.html`,
overview: `${APM_DOCS}guide/${DOC_LINK_VERSION}/apm-overview.html`,
tailSamplingPolicies: `${APM_DOCS}guide/${DOC_LINK_VERSION}/configure-tail-based-sampling.html`,
tailSamplingPolicies: isServerless
? `${SERVERLESS_DOCS}apm-transaction-sampling`
: `${OBSERVABILITY_DOCS}configure-tail-based-sampling.html`,
elasticAgent: `${APM_DOCS}guide/${DOC_LINK_VERSION}/upgrade-to-apm-integration.html`,
storageExplorer: `${KIBANA_DOCS}storage-explorer.html`,
spanCompression: `${APM_DOCS}guide/${DOC_LINK_VERSION}/span-compression.html`,
transactionSampling: `${APM_DOCS}guide/${DOC_LINK_VERSION}/sampling.html`,
spanCompression: isServerless
? `${SERVERLESS_DOCS}apm-compress-spans`
: `${OBSERVABILITY_DOCS}span-compression.html`,
transactionSampling: isServerless
? `${SERVERLESS_DOCS}apm-transaction-sampling`
: `${OBSERVABILITY_DOCS}sampling.html`,
indexLifecycleManagement: `${APM_DOCS}guide/${DOC_LINK_VERSION}/ilm-how-to.html`,
},
canvas: {
Expand Down Expand Up @@ -544,25 +556,35 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
tsvbIndexPatternMode: `${KIBANA_DOCS}tsvb.html#tsvb-index-pattern-mode`,
},
observability: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/index.html`,
infrastructureThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/infrastructure-threshold-alert.html`,
logsThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/logs-threshold-alert.html`,
metricsThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/metrics-threshold-alert.html`,
customThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/custom-threshold-alert.html`,
monitorStatus: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-status-alert.html`,
monitorUptime: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-uptime.html`,
tlsCertificate: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/tls-certificate-alert.html`,
uptimeDurationAnomaly: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/duration-anomaly-alert.html`,
monitorLogs: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-logs.html`,
analyzeMetrics: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/analyze-metrics.html`,
monitorUptimeSynthetics: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-uptime-synthetics.html`,
userExperience: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/user-experience.html`,
createAlerts: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/create-alerts.html`,
syntheticsAlerting: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetics-settings.html#synthetics-settings-alerting`,
syntheticsCommandReference: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetics-configuration.html#synthetics-configuration-playwright-options`,
syntheticsProjectMonitors: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetic-run-tests.html#synthetic-monitor-choose-project`,
syntheticsMigrateFromIntegration: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetics-migrate-from-integration.html`,
sloBurnRateRule: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/slo-burn-rate-alert.html`,
guide: isServerless
? `${SERVERLESS_OBSERVABILITY_DOCS}what-is-observability-serverless`
: `${OBSERVABILITY_DOCS}index.html`,
infrastructureThreshold: `${OBSERVABILITY_DOCS}infrastructure-threshold-alert.html`,
logsThreshold: `${OBSERVABILITY_DOCS}logs-threshold-alert.html`,
metricsThreshold: `${OBSERVABILITY_DOCS}metrics-threshold-alert.html`,
customThreshold: isServerless
? `${SERVERLESS_OBSERVABILITY_DOCS}create-custom-threshold-alert-rule`
: `${OBSERVABILITY_DOCS}custom-threshold-alert.html`,
monitorStatus: `${OBSERVABILITY_DOCS}monitor-status-alert.html`,
monitorUptime: `${OBSERVABILITY_DOCS}monitor-uptime.html`,
tlsCertificate: `${OBSERVABILITY_DOCS}tls-certificate-alert.html`,
uptimeDurationAnomaly: `${OBSERVABILITY_DOCS}duration-anomaly-alert.html`,
monitorLogs: `${OBSERVABILITY_DOCS}monitor-logs.html`,
analyzeMetrics: isServerless
? `${SERVERLESS_OBSERVABILITY_DOCS}infrastructure-monitoring`
: `${OBSERVABILITY_DOCS}analyze-metrics.html`,
monitorUptimeSynthetics: `${OBSERVABILITY_DOCS}monitor-uptime-synthetics.html`,
userExperience: `${OBSERVABILITY_DOCS}user-experience.html`,
createAlerts: isServerless
? `${SERVERLESS_OBSERVABILITY_DOCS}alerting`
: `${OBSERVABILITY_DOCS}create-alerts.html`,
syntheticsAlerting: `${OBSERVABILITY_DOCS}synthetics-settings.html#synthetics-settings-alerting`,
syntheticsCommandReference: `${OBSERVABILITY_DOCS}synthetics-configuration.html#synthetics-configuration-playwright-options`,
syntheticsProjectMonitors: `${OBSERVABILITY_DOCS}synthetic-run-tests.html#synthetic-monitor-choose-project`,
syntheticsMigrateFromIntegration: `${OBSERVABILITY_DOCS}synthetics-migrate-from-integration.html`,
sloBurnRateRule: isServerless
? `${SERVERLESS_OBSERVABILITY_DOCS}create-slo-burn-rate-alert-rule`
: `${OBSERVABILITY_DOCS}slo-burn-rate-alert.html`,
},
alerting: {
guide: isServerless
Expand Down Expand Up @@ -888,7 +910,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
apiKeyPrivileges: `${SERVERLESS_DOCS}api-keys#restrict-privileges`,
},
synthetics: {
featureRoles: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetics-feature-roles.html`,
featureRoles: `${OBSERVABILITY_DOCS}synthetics-feature-roles.html`,
},
telemetry: {
settings: `${KIBANA_DOCS}telemetry-settings-kbn.html`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { FindingsBaseURLQuery } from '../../common/types';
import { useBaseEsQuery, usePersistedQuery } from '../../common/hooks/use_cloud_posture_data_table';

const DEFAULT_PAGE_SIZE = 10;
const MAX_GROUPING_LEVELS = 3;
const DEFAULT_MAX_GROUPING_LEVELS = 3;

/*
Utility hook to handle the grouping logic of the cloud security components
Expand All @@ -35,6 +35,7 @@ export const useCloudSecurityGrouping = ({
groupStatsRenderer,
groupingLevel,
groupingLocalStorageKey,
maxGroupingLevels = DEFAULT_MAX_GROUPING_LEVELS,
}: {
dataView: DataView;
groupingTitle: string;
Expand All @@ -45,6 +46,7 @@ export const useCloudSecurityGrouping = ({
groupStatsRenderer?: GroupStatsRenderer<any>;
groupingLevel?: number;
groupingLocalStorageKey: string;
maxGroupingLevels?: number;
}) => {
const getPersistedDefaultQuery = usePersistedQuery(getDefaultQuery);
const { urlQuery, setUrlQuery } = useUrlQuery(getPersistedDefaultQuery);
Expand All @@ -65,7 +67,7 @@ export const useCloudSecurityGrouping = ({
defaultGroupingOptions,
fields: dataView.fields,
groupingId: groupingLocalStorageKey,
maxGroupingLevels: MAX_GROUPING_LEVELS,
maxGroupingLevels,
title: groupingTitle,
onGroupChange: () => {
setActivePageIndex(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const useLatestVulnerabilitiesGrouping = ({
groupPanelRenderer,
groupStatsRenderer,
groupingLocalStorageKey: LOCAL_STORAGE_VULNERABILITIES_GROUPING_KEY,
maxGroupingLevels: 1,
});

const groupingQuery = getGroupingQuery({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import useAsyncFn from 'react-use/lib/useAsyncFn';
import { CodeEditorField } from '@kbn/code-editor';
import { i18n } from '@kbn/i18n';
import { FormattedDate, FormattedMessage } from '@kbn/i18n-react';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useDarkMode, useKibana } from '@kbn/kibana-react-plugin/public';
import type { KibanaServerError } from '@kbn/kibana-utils-plugin/public';

import type { CategorizedApiKey } from './api_keys_grid_page';
Expand Down Expand Up @@ -146,6 +146,7 @@ export const ApiKeyFlyout: FunctionComponent<ApiKeyFlyoutProps> = ({
}) => {
const { euiTheme } = useEuiTheme();
const { services } = useKibana();
const isDarkMode = useDarkMode();
const { value: currentUser, loading: isLoadingCurrentUser } = useCurrentUser();
const [{ value: roles, loading: isLoadingRoles }, getRoles] = useAsyncFn(
() => new RolesAPIClient(services.http!).getRoles(),
Expand Down Expand Up @@ -662,6 +663,7 @@ export const ApiKeyFlyout: FunctionComponent<ApiKeyFlyoutProps> = ({
fullWidth
languageId="xjson"
height={200}
useDarkTheme={isDarkMode}
/>
</FormRow>
</EuiPanel>
Expand Down Expand Up @@ -749,6 +751,7 @@ export const ApiKeyFlyout: FunctionComponent<ApiKeyFlyoutProps> = ({
fullWidth
languageId="xjson"
height={200}
useDarkTheme={isDarkMode}
/>
</FormRow>
</>
Expand Down Expand Up @@ -833,6 +836,7 @@ export const ApiKeyFlyout: FunctionComponent<ApiKeyFlyoutProps> = ({
fullWidth
languageId="xjson"
height={200}
useDarkTheme={isDarkMode}
/>
</FormRow>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jest.mock('@kbn/kibana-react-plugin/public', () => ({
useKibana: jest.fn().mockReturnValue({
services: { docLinks: { links: { apis: { createRoleMapping: 'createRoleMappingLink' } } } },
}),
useDarkMode: jest.fn().mockReturnValue(false),
}));

describe('JSONRuleEditor', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import React, { Fragment, useState } from 'react';
import { CodeEditorField } from '@kbn/code-editor';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useDarkMode, useKibana } from '@kbn/kibana-react-plugin/public';
import { XJsonLang } from '@kbn/monaco';

import type { Rule } from '../../model';
Expand All @@ -30,6 +30,7 @@ interface Props {

export const JSONRuleEditor = (props: Props) => {
const docLinks = useKibana().services.docLinks!;
const isDarkMode = useDarkMode();
const [rawRules, setRawRules] = useState(
JSON.stringify(props.rules ? props.rules.toRaw() : {}, null, 2)
);
Expand Down Expand Up @@ -105,6 +106,7 @@ export const JSONRuleEditor = (props: Props) => {
onChange={onRulesChange}
fullWidth={true}
height="300px"
useDarkTheme={isDarkMode}
options={{
accessibilitySupport: 'off',
lineNumbers: 'on',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import type { KibanaFeature } from '@kbn/features-plugin/common';
import type { FeaturesPluginStart } from '@kbn/features-plugin/public';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';
import { reactRouterNavigate, useDarkMode } from '@kbn/kibana-react-plugin/public';
import type { Cluster } from '@kbn/remote-clusters-plugin/public';
import { REMOTE_CLUSTERS_PATH } from '@kbn/remote-clusters-plugin/public';
import type { Space, SpacesApiUi } from '@kbn/spaces-plugin/public';
Expand Down Expand Up @@ -304,6 +304,8 @@ export const EditRolePage: FunctionComponent<Props> = ({
history,
spacesApiUi,
}) => {
const isDarkMode = useDarkMode();

if (!dataViews) {
// The dataViews plugin is technically marked as an optional dependency because we don't need to pull it in for Anonymous pages (such
// as the login page). That said, it _is_ required for this page to function correctly, so we throw an error here if it's not available.
Expand Down Expand Up @@ -483,6 +485,7 @@ export const EditRolePage: FunctionComponent<Props> = ({
license={license}
docLinks={docLinks}
canUseRemoteIndices={featureCheckState.value?.canUseRemoteIndices}
isDarkMode={isDarkMode}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface Props {
indexPatterns: string[];
remoteClusters?: Cluster[];
canUseRemoteIndices?: boolean;
isDarkMode?: boolean;
}

export class ElasticsearchPrivileges extends Component<Props, {}> {
Expand Down Expand Up @@ -173,6 +174,7 @@ export class ElasticsearchPrivileges extends Component<Props, {}> {
onChange={onChange}
availableIndexPrivileges={builtinESPrivileges.index}
editable={editable}
isDarkMode={this.props.isDarkMode}
/>

{canUseRemoteIndices && (
Expand Down Expand Up @@ -208,6 +210,7 @@ export class ElasticsearchPrivileges extends Component<Props, {}> {
onChange={onChange}
availableIndexPrivileges={builtinESPrivileges.index}
editable={editable}
isDarkMode={this.props.isDarkMode}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface Props {
allowDocumentLevelSecurity: boolean;
allowFieldLevelSecurity: boolean;
validator: RoleValidator;
isDarkMode?: boolean;
}

interface State {
Expand Down Expand Up @@ -460,6 +461,7 @@ export class IndexPrivilegeForm extends Component<Props, State> {
)}
value={indexPrivilege.query ?? ''}
onChange={this.onQueryChange}
useDarkTheme={this.props.isDarkMode}
options={{
readOnly: this.props.isRoleReadOnly,
minimap: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface Props {
onChange: (role: Role) => void;
validator: RoleValidator;
editable?: boolean;
isDarkMode?: boolean;
}

interface State {
Expand Down Expand Up @@ -94,6 +95,7 @@ export class IndexPrivileges extends Component<Props, State> {
remoteClusters={remoteClusters}
onChange={this.onIndexPrivilegeChange(i)}
onDelete={this.onIndexPrivilegeDelete(i)}
isDarkMode={this.props.isDarkMode}
/>
))}
{this.props.editable && (
Expand Down

0 comments on commit 1c07c24

Please sign in to comment.