Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/shared-ux/markdown/mocks/storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class MarkdownStorybookMock extends AbstractStorybookMock<
};
}

getServices() {
getServices(): MarkdownProps {
return { ...this.getProps() };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ export default function ({
// will simulate autocomplete on 'GET /a/b/' with a filter by index
return {
tokenPath: context.urlTokenPath?.slice(0, -1),
predicate: (term: any) => term.meta === 'index',
predicate: (term: ReturnType<typeof addMetaToTermsList>[0]) => term.meta === 'index',
};
} else {
// will do nothing special
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export async function getApmServiceSummary({
start,
end,
serviceName,
environment,
}),
getAnomalies({
serviceName,
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/asset_manager/server/routes/assets/hosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ export function hostsRoutes<T extends RequestHandlerContext>({
async (context, req, res) => {
const { from = 'now-24h', to = 'now' } = req.query || {};
const esClient = await getEsClientFromContext(context);
const coreContext = await context.core;
const soClient = coreContext.savedObjects.client;

try {
const response = await assetAccessor.getHosts({
from: datemath.parse(from)!.toISOString(),
to: datemath.parse(to)!.toISOString(),
esClient,
soClient,
});

return res.ok({ body: response });
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ interface PluginsSetup {
usageCollection?: UsageCollectionSetup;
}

interface PluginsStart {
export interface PluginsStart {
data: DataPluginStart;
security: SecurityPluginStart;
spaces?: SpacesPluginStart;
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/ml/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import type { MlPluginSetup, MlPluginStart } from './plugin';
const createSetupContract = (): jest.Mocked<MlPluginSetup> => {
return {
locator: sharePluginMock.createLocator(),
// TODO: Fix with proper mock (cc: @arnautov)
elasticModels: undefined as any,
};
};

Expand Down
16 changes: 12 additions & 4 deletions x-pack/plugins/ml/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { take } from 'rxjs/operators';

import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import type { ManagementSetup } from '@kbn/management-plugin/public';
import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public';
import type { LocatorPublic, SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { HomePublicPluginSetup } from '@kbn/home-plugin/public';
import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public';
Expand Down Expand Up @@ -54,12 +54,13 @@ import {
MlSharedServices,
} from './application/services/get_shared_ml_services';
import { registerManagementSection } from './application/management';
import { MlLocatorDefinition, type MlLocator } from './locator';
import { MlLocatorDefinition, MlLocatorParams, type MlLocator } from './locator';
import { setDependencyCache } from './application/util/dependency_cache';
import { registerHomeFeature } from './register_home_feature';
import { isFullLicense, isMlEnabled } from '../common/license';
import { ML_APP_ROUTE, PLUGIN_ICON_SOLUTION, PLUGIN_ID } from '../common/constants/app';
import type { MlCapabilities } from './shared';
import { ElasticModels } from './application/services/elastic_models_service';

export interface MlStartDependencies {
dataViewEditor: DataViewEditorStart;
Expand Down Expand Up @@ -118,7 +119,10 @@ export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
this.isServerless = initializerContext.env.packageInfo.buildFlavor === 'serverless';
}

setup(core: MlCoreSetup, pluginsSetup: MlSetupDependencies) {
setup(
core: MlCoreSetup,
pluginsSetup: MlSetupDependencies
): { locator?: LocatorPublic<MlLocatorParams>; elasticModels?: ElasticModels } {
this.sharedMlServices = getMlSharedServices(core.http);

core.application.register({
Expand Down Expand Up @@ -247,10 +251,14 @@ export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {

return {
locator: this.locator,
elasticModels: this.sharedMlServices.elasticModels,
};
}

start(core: CoreStart, deps: MlStartDependencies) {
start(
core: CoreStart,
deps: MlStartDependencies
): { locator?: LocatorPublic<MlLocatorParams>; elasticModels?: ElasticModels } {
setDependencyCache({
docLinks: core.docLinks!,
basePath: core.http.basePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function InstallElasticAgent() {
useState<ElasticAgentPlatform>('linux-tar');

const enforcedDatasetName =
integration === dataset ? dataset : `${integration}.${dataset}`;
(integration === dataset ? dataset : `${integration}.${dataset}`) || '';

async function onContinue() {
await singleDatasetLocator!.navigate({
Expand Down Expand Up @@ -113,7 +113,7 @@ export function InstallElasticAgent() {
return callApi('POST /internal/observability_onboarding/logs/flow', {
params: {
body: {
name: datasetName,
name: datasetName || '',
type: 'logFiles',
state: {
datasetName,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability_onboarding/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ObservabilityOnboardingPluginStart,
} from './plugin';

export { OBSERVABILITY_ONBOARDING_LOCATOR } from './locators/onboarding_locator/locator_definition';
export type { OBSERVABILITY_ONBOARDING_LOCATOR } from './locators/onboarding_locator/locator_definition';
export type { ObservabilityOnboardingLocatorParams } from './locators/onboarding_locator/types';

export interface ConfigSchema {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
OBSERVABILITY_ONBOARDING_LOCATOR,
} from '@kbn/deeplinks-observability/locators';

export type { OBSERVABILITY_ONBOARDING_LOCATOR } from '@kbn/deeplinks-observability/locators';

export class ObservabilityOnboardingLocatorDefinition
implements LocatorDefinition<ObservabilityOnboardingLocatorParams>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
import type { LocatorPublic } from '@kbn/share-plugin/public';
import type { ObservabilityOnboardingLocatorParams } from '@kbn/deeplinks-observability/locators';

export type { ObservabilityOnboardingLocatorParams } from '@kbn/deeplinks-observability/locators';
export type ObservabilityOnboardingLocator =
LocatorPublic<ObservabilityOnboardingLocatorParams>;
9 changes: 6 additions & 3 deletions x-pack/plugins/osquery/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"include": [
"**/*",
"../cypress.config.ts",
"../serverless_cypress.config.ts",
"../../../test_serverless/shared/lib"
],
"exclude": [
"target/**/*"
"target/**/*",
"../serverless_cypress.config.ts"
],
"compilerOptions": {
"outDir": "target/types",
Expand All @@ -19,6 +19,9 @@
"resolveJsonModule": true,
},
"kbn_references": [
{
"path": "../../../test_serverless/tsconfig.json"
},
"@kbn/cypress-config",
// cypress projects that are nested inside of other ts project use code
// from the parent ts project in ways that can't be automatically deteceted
Expand All @@ -31,4 +34,4 @@
"@kbn/fleet-plugin",
"@kbn/cases-plugin",
]
}
}
3 changes: 1 addition & 2 deletions x-pack/plugins/reporting/server/lib/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export class ReportingStore {
private readonly indexPrefix: string; // config setting of index prefix in system index name
private readonly indexInterval: string; // config setting of index prefix: how often to poll for pending work
private client?: ElasticsearchClient;
private ilmPolicyManager?: IlmPolicyManager;
config: ReportingCore['config'];

constructor(private reportingCore: ReportingCore, private logger: Logger) {
Expand All @@ -107,7 +106,7 @@ export class ReportingStore {

private async getIlmPolicyManager() {
const client = await this.getClient();
return (this.ilmPolicyManager = IlmPolicyManager.create({ client }));
return IlmPolicyManager.create({ client });
}

private async createIndex(indexName: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ import * as timelineMarkdownPlugin from './timeline';
import * as osqueryMarkdownPlugin from './osquery';
import * as insightMarkdownPlugin from './insight';

export const {
uiPlugins: nonStatefulUiPlugins,
parsingPlugins,
processingPlugins,
} = {
uiPlugins: getDefaultEuiMarkdownUiPlugins(),
parsingPlugins: getDefaultEuiMarkdownParsingPlugins(),
processingPlugins: getDefaultEuiMarkdownProcessingPlugins(),
};
export const nonStatefulUiPlugins = getDefaultEuiMarkdownUiPlugins();
export const parsingPlugins = getDefaultEuiMarkdownParsingPlugins();
export const processingPlugins = getDefaultEuiMarkdownProcessingPlugins();

export const platinumOnlyPluginTokens = [insightMarkdownPlugin.insightPrefix];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { PREFIX } from '../../shared/test_ids';

export const ANALYZER_GRAPH_TEST_ID = `${PREFIX}AnalyzerGraph` as const;
export const SESSION_VIEW_TEST_ID = `${PREFIX}SessionView` as const;
export const SESSION_VIEW_ERROR_TEST_ID = `${PREFIX}SessionViewError` as const;

/* Insights tab */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { pick } from 'lodash';
import type { CyIndexEndpointHosts } from '../../../tasks/index_endpoint_hosts';
import { indexEndpointHosts } from '../../../tasks/index_endpoint_hosts';
import { login, ROLE } from '../../../tasks/login';
import { login, ROLE, type ROLE_KEYS } from '../../../tasks/login';
import { ensurePolicyDetailsPageAuthzAccess } from '../../../screens/policy_details';
import type { EndpointArtifactPageId } from '../../../screens';
import {
Expand Down Expand Up @@ -63,7 +63,7 @@ describe(
});

// roles `t1_analyst` and `t2_analyst` are very similar with exception of one page
(['t1_analyst', `t2_analyst`] as ROLE[]).forEach((roleName) => {
(['t1_analyst', `t2_analyst`] as ROLE_KEYS[]).forEach((roleName) => {
describe(`for role: ${roleName}`, () => {
const deniedPages = allPages.filter((page) => page.id !== 'endpointList');

Expand Down Expand Up @@ -350,7 +350,7 @@ describe(
});
});

(['platform_engineer', 'endpoint_policy_manager'] as ROLE[]).forEach((roleName) => {
(['platform_engineer', 'endpoint_policy_manager'] as ROLE_KEYS[]).forEach((roleName) => {
describe(`for role: ${roleName}`, () => {
const artifactPagesFullAccess = [
pageById.trustedApps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { CyIndexEndpointHosts } from '../../../tasks/index_endpoint_hosts';
import { indexEndpointHosts } from '../../../tasks/index_endpoint_hosts';
import { login, ROLE } from '../../../tasks/login';
import { login, ROLE, type ROLE_KEYS } from '../../../tasks/login';
import type { EndpointArtifactPageId } from '../../../screens';
import {
getNoPrivilegesPage,
Expand Down Expand Up @@ -55,7 +55,7 @@ describe(
});

// roles `t1_analyst` and `t2_analyst` are the same as far as endpoint access
(['t1_analyst', `t2_analyst`] as ROLE[]).forEach((roleName) => {
(['t1_analyst', `t2_analyst`] as ROLE_KEYS[]).forEach((roleName) => {
describe(`for role: ${roleName}`, () => {
const deniedPages = allPages.filter((page) => page.id !== 'endpointList');

Expand Down Expand Up @@ -238,7 +238,7 @@ describe(

// Endpoint Operations Manager, Endpoint Policy Manager and Platform Engineer currently have the same level of access
(
['platform_engineer', `endpoint_operations_analyst`, 'endpoint_policy_manager'] as ROLE[]
['platform_engineer', `endpoint_operations_analyst`, 'endpoint_policy_manager'] as ROLE_KEYS[]
).forEach((roleName) => {
describe(`for role: ${roleName}`, () => {
const artifactPagesFullAccess = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ROLE = Object.freeze<Record<SecurityTestUser, SecurityTestUser>>({
elastic_serverless: 'elastic_serverless',
system_indices_superuser: 'system_indices_superuser',
});
export type ROLE_KEYS = keyof typeof ROLE;

interface CyLoginTask {
(user?: SecurityTestUser): ReturnType<typeof sendApiLoginRequest>;
Expand Down Expand Up @@ -94,7 +95,9 @@ const sendApiLoginRequest = (
const basicProvider = loginState.body.selector.providers.find(
(provider) => provider.type === 'basic'
);

if (!basicProvider) {
throw new Error(`basicProvider was not found`);
}
return request({
url: loginUrl,
method: 'POST',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ import type { Services } from '../services';
export const mockServices: Services = {
...coreMock.createStart(),
securitySolution: securitySolutionMock.createStart(),
// TODO: contact @machadoum Pablo Machado
// eslint-disable-next-line @typescript-eslint/no-explicit-any
licensing: undefined as any,
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

import { SecurityPageName } from '@kbn/security-solution-plugin/common';
import type {
MessageUpsellings,
PageUpsellings,
SectionUpsellings,
UpsellingMessageId,
UpsellingSectionId,
UpsellingService,
} from '@kbn/security-solution-upselling/service';
import type { MessageUpsellings } from '@kbn/security-solution-upselling/service/types';
import type { ILicense, LicenseType } from '@kbn/licensing-plugin/public';
import React, { lazy } from 'react';
import { UPGRADE_INVESTIGATION_GUIDE } from '@kbn/security-solution-upselling/messages';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* 2.0.
*/

import type { AppFeatureKey } from '@kbn/security-solution-plugin/common';
import type { AppFeatureKeyType } from '@kbn/security-solution-features/keys';
import { PLI_APP_FEATURES } from '../../../common/pli/pli_config';

export const getProductTypeByPLI = (requiredPLI: AppFeatureKey): string | null => {
export const getProductTypeByPLI = (requiredPLI: AppFeatureKeyType): string | null => {
if (PLI_APP_FEATURES.security.essentials.includes(requiredPLI)) {
return 'Security Essentials';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import { EuiEmptyPrompt, EuiIcon } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import React from 'react';
import type { AppFeatureKey } from '@kbn/security-solution-plugin/common';
import type { AppFeatureKeyType } from '@kbn/security-solution-features/keys';
import { getProductTypeByPLI } from '../hooks/use_product_type_by_pli';

const OsqueryResponseActionsUpsellingSection: React.FC<{ requiredPLI: AppFeatureKey }> = React.memo(
({ requiredPLI }) => {
const OsqueryResponseActionsUpsellingSection: React.FC<{ requiredPLI: AppFeatureKeyType }> =
React.memo(({ requiredPLI }) => {
const productTypeRequired = getProductTypeByPLI(requiredPLI);

return (
Expand All @@ -38,8 +38,7 @@ const OsqueryResponseActionsUpsellingSection: React.FC<{ requiredPLI: AppFeature
}
/>
);
}
);
});

OsqueryResponseActionsUpsellingSection.displayName = 'OsqueryResponseActionsUpsellingSection';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import React from 'react';
import { EuiEmptyPrompt, EuiIcon } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import type { AppFeatureKey } from '@kbn/security-solution-plugin/common';
import type { AppFeatureKeyType } from '@kbn/security-solution-features/keys';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import { getProductTypeByPLI } from '../hooks/use_product_type_by_pli';

const ThreatIntelligencePaywall: React.FC<{ requiredPLI: AppFeatureKey }> = React.memo(
const ThreatIntelligencePaywall: React.FC<{ requiredPLI: AppFeatureKeyType }> = React.memo(
function PaywallComponent({ requiredPLI }) {
const productTypeRequired = getProductTypeByPLI(requiredPLI);

Expand Down
12 changes: 6 additions & 6 deletions x-pack/plugins/serverless_search/public/layout/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import type { ServerlessPluginStart } from '@kbn/serverless/public';
import type { CloudStart } from '@kbn/cloud-plugin/public';

// Hiding this until page is in a better space
const _connectorItem = {
link: 'serverlessConnectors',
title: i18n.translate('xpack.serverlessSearch.nav.connectors', {
defaultMessage: 'Connectors',
}),
};
// const _connectorItem = {
// link: 'serverlessConnectors',
// title: i18n.translate('xpack.serverlessSearch.nav.connectors', {
// defaultMessage: 'Connectors',
// }),
// };

const navigationTree: NavigationTreeDefinition = {
body: [
Expand Down
Loading