Skip to content

Commit

Permalink
Merge branch 'main' into connector-types-plugin-split-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 28, 2022
2 parents 766e85f + 13b283a commit 845e3be
Show file tree
Hide file tree
Showing 60 changed files with 1,049 additions and 1,512 deletions.
22 changes: 22 additions & 0 deletions x-pack/plugins/actions/server/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ describe('config validation', () => {
`);
});

test('validates proxyUrl', () => {
const proxyUrl = 'https://test.com';
const badProxyUrl = 'bad url';
let validated: ActionsConfig;

validated = configSchema.validate({ proxyUrl });
expect(validated.proxyUrl).toEqual(proxyUrl);
expect(getValidatedConfig(mockLogger, validated).proxyUrl).toEqual(proxyUrl);
expect(mockLogger.warn.mock.calls).toMatchInlineSnapshot(`Array []`);

validated = configSchema.validate({ proxyUrl: badProxyUrl });
expect(validated.proxyUrl).toEqual(badProxyUrl);
expect(getValidatedConfig(mockLogger, validated).proxyUrl).toEqual(badProxyUrl);
expect(mockLogger.warn.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
"The confguration xpack.actions.proxyUrl: bad url is invalid.",
],
]
`);
});

// Most of the customHostSettings tests are in ./lib/custom_host_settings.test.ts
// but this one seemed more relevant for this test suite, since url is the one
// required property.
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/actions/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ export type ActionsConfig = TypeOf<typeof configSchema>;
export function getValidatedConfig(logger: Logger, originalConfig: ActionsConfig): ActionsConfig {
const proxyBypassHosts = originalConfig.proxyBypassHosts;
const proxyOnlyHosts = originalConfig.proxyOnlyHosts;
const proxyUrl = originalConfig.proxyUrl;

if (proxyUrl) {
try {
new URL(proxyUrl);
} catch (err) {
logger.warn(`The confguration xpack.actions.proxyUrl: ${proxyUrl} is invalid.`);
}
}

if (proxyBypassHosts && proxyOnlyHosts) {
logger.warn(
Expand Down
12 changes: 1 addition & 11 deletions x-pack/plugins/cases/common/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export type Case = Omit<SnakeToCamelCase<CaseResponse>, 'comments'> & { comments
export type Cases = Omit<SnakeToCamelCase<CasesFindResponse>, 'cases'> & { cases: Case[] };
export type CasesStatus = SnakeToCamelCase<CasesStatusResponse>;
export type CasesMetrics = SnakeToCamelCase<CasesMetricsResponse>;
export type CaseUpdateRequest = SnakeToCamelCase<CasePatchRequest>;

export interface ResolvedCase {
case: Case;
Expand Down Expand Up @@ -133,12 +134,6 @@ export interface ApiProps {
signal: AbortSignal;
}

export interface BulkUpdateStatus {
status: string;
id: string;
version: string;
}

export interface ActionLicense {
id: string;
name: string;
Expand All @@ -147,11 +142,6 @@ export interface ActionLicense {
enabledInLicense: boolean;
}

export interface DeleteCase {
id: string;
title: string;
}

export interface FieldMappings {
id: string;
title?: string;
Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/cases/public/common/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const CANCEL = i18n.translate('xpack.cases.caseView.cancel', {
export const DELETE_CASE = (quantity: number = 1) =>
i18n.translate('xpack.cases.confirmDeleteCase.deleteCase', {
values: { quantity },
defaultMessage: `Delete {quantity, plural, =1 {case} other {cases}}`,
defaultMessage: `Delete {quantity, plural, =1 {case} other {{quantity} cases}}`,
});

export const NAME = i18n.translate('xpack.cases.caseView.name', {
Expand Down Expand Up @@ -296,3 +296,9 @@ export const READ_ACTIONS_PERMISSIONS_ERROR_MSG = i18n.translate(
'You do not have permission to view connectors. If you would like to view connectors, contact your Kibana administrator.',
}
);

export const DELETED_CASES = (totalCases: number) =>
i18n.translate('xpack.cases.containers.deletedCases', {
values: { totalCases },
defaultMessage: 'Deleted {totalCases, plural, =1 {case} other {{totalCases} cases}}',
});
Loading

0 comments on commit 845e3be

Please sign in to comment.