Skip to content

Commit

Permalink
Merge branch 'master' into alerting/action-groups-i18n
Browse files Browse the repository at this point in the history
* master:
  [Canvas] Move sample data and feature registration to canvas np plugin (elastic#56564)
  instrument task manager with apm transactions (elastic#55356)
  displays Alert Instance state on Alert Details page (elastic#56842)
  Adding the Accessibility Statement to docs (elastic#57153)
  [Uptime] Remove redundant adapter function (elastic#56980)
  [SIEM][Detection Engine] Backend end-to-end tests
  [Uptime] Added tests for pages (elastic#56736)
  Updating to kind-of@6.0.3 (elastic#57367)
  • Loading branch information
gmmorris committed Feb 12, 2020
2 parents 17987e2 + 0dd8129 commit 2ac9e23
Show file tree
Hide file tree
Showing 182 changed files with 9,998 additions and 1,220 deletions.
65 changes: 65 additions & 0 deletions docs/accessibility.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[chapter]
[[accessibility]]
= Accessibility Statement for Kibana
++++
<titleabbrev>Accessibility</titleabbrev>
++++

Elastic is committed to ensuring digital accessibility for people with disabilities. We are continually improving the user experience, and strive toward ensuring our tools are usable by everyone.

[float]
[[accessibility-measures]]
== Measures to support accessibility
Elastic takes the following measures to ensure accessibility of Kibana:

* Maintains and incorporates an https://elastic.github.io/eui/[accessible component library].
* Provides continual accessibility training for our staff.
* Employs a third-party audit.

[float]
[[accessibility-conformance-status]]
== Conformance status
Kibana aims to meet https://www.w3.org/WAI/WCAG21/quickref/?currentsidebar=%23col_customize&levels=aaa&technologies=server%2Csmil%2Cflash%2Csl[WCAG 2.1 level AA] compliance. Currently, we can only claim to partially conform, meaning we do not fully meet all of the success criteria. However, we do try to take a broader view of accessibility, and go above and beyond the legal and regulatory standards to provide a good experience for all of our users.

[float]
[[accessibility-feedback]]
== Feedback
We welcome your feedback on the accessibility of Kibana. Please let us know if you encounter accessibility barriers on Kibana by either emailing us at accessibility@elastic.co or opening https://github.com/elastic/kibana/issues/new?labels=Project%3AAccessibility&template=Accessibility.md&title=%28Accessibility%29[an issue on GitHub].

[float]
[[accessibility-specs]]
== Technical specifications
Accessibility of Kibana relies on the following technologies to work with your web browser and any assistive technologies or plugins installed on your computer:

* HTML
* CSS
* JavaScript
* WAI-ARIA

[float]
[[accessibility-limitations-and-alternatives]]
== Limitations and alternatives
Despite our best efforts to ensure accessibility of Kibana, there are some limitations. Please https://github.com/elastic/kibana/issues/new?labels=Project%3AAccessibility&template=Accessibility.md&title=%28Accessibility%29[open an issue on GitHub] if you observe an issue not in this list.

Known limitations are in the following areas:

* *Charts*: We have a clear plan for the first steps of making charts accessible. We’ve opened this https://github.com/elastic/elastic-charts/issues/300[Charts accessibility ticket on GitHub] for tracking our progress.
* *Maps*: Maps might pose difficulties to users with vision disabilities. We welcome your input on making our maps accessible. Go to the https://github.com/elastic/kibana/issues/57271[Maps accessibility ticket on GitHub] to join the discussion and view our plans.
* *Tables*: Although generally accessible and marked-up as standard HTML tables with column headers, tables rarely make use of row headers and have poor captions. You will see incremental improvements as various applications adopt a new accessible component.
* *Color contrast*: Modern Kibana interfaces generally do not have color contrast issues. However, older code might fall below the recommended contrast levels. As we continue to update our code, this issue will phase out naturally.

To see individual tickets, view our https://github.com/elastic/kibana/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3AProject%3AAccessibility[GitHub issues with label "`Project:Accessibility`"].

[float]
[[accessibility-approach]]
== Assessment approach
Elastic assesses the accessibility of Kibana with the following approaches:

* *Self-evaluation*: Our employees are familiar with accessibility standards and review new designs and implemented features to confirm that they are accessible.
* *External evaluation*: We engage external contractors to help us conduct an independent assessment and generate a formal VPAT. Please email accessibility@elastic.co if you’d like a copy.
* *Automated evaluation*: We are starting to run https://www.deque.com/axe/[axe] on every page. See our current progress in the https://github.com/elastic/kibana/issues/51456[automated testing GitHub issue].

Manual testing largely focuses on screen reader support and is done on:

* VoiceOver on MacOS with Safari, Chrome and Edge
* NVDA on Windows with Chrome and Firefox
2 changes: 2 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ include::{asciidoc-dir}/../../shared/attributes.asciidoc[]

include::user/index.asciidoc[]

include::accessibility.asciidoc[]

include::limitations.asciidoc[]

include::release-notes/highlights.asciidoc[]
Expand Down
10 changes: 5 additions & 5 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88442,7 +88442,7 @@ module.exports = function kindOf(val) {
};

function ctorName(val) {
return val.constructor ? val.constructor.name : null;
return typeof val.constructor === 'function' ? val.constructor.name : null;
}

function isArray(val) {
Expand Down Expand Up @@ -88653,7 +88653,7 @@ module.exports = function kindOf(val) {
};

function ctorName(val) {
return val.constructor ? val.constructor.name : null;
return typeof val.constructor === 'function' ? val.constructor.name : null;
}

function isArray(val) {
Expand Down Expand Up @@ -88844,7 +88844,7 @@ module.exports = function kindOf(val) {
};

function ctorName(val) {
return val.constructor ? val.constructor.name : null;
return typeof val.constructor === 'function' ? val.constructor.name : null;
}

function isArray(val) {
Expand Down Expand Up @@ -101921,7 +101921,7 @@ module.exports = function kindOf(val) {
};

function ctorName(val) {
return val.constructor ? val.constructor.name : null;
return typeof val.constructor === 'function' ? val.constructor.name : null;
}

function isArray(val) {
Expand Down Expand Up @@ -104780,7 +104780,7 @@ module.exports = function kindOf(val) {
};

function ctorName(val) {
return val.constructor ? val.constructor.name : null;
return typeof val.constructor === 'function' ? val.constructor.name : null;
}

function isArray(val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
*/

import { SavedObjectAttributes } from 'kibana/server';
import { AlertActionParams } from '../server/types';

export interface IntervalSchedule extends SavedObjectAttributes {
interval: string;
}

export type AlertActionParams = SavedObjectAttributes;

export interface AlertAction {
group: string;
id: string;
Expand Down
24 changes: 24 additions & 0 deletions x-pack/legacy/plugins/alerting/common/alert_instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as t from 'io-ts';
import { DateFromString } from './date_from_string';

const metaSchema = t.partial({
lastScheduledActions: t.type({
group: t.string,
date: DateFromString,
}),
});
export type AlertInstanceMeta = t.TypeOf<typeof metaSchema>;

const stateSchema = t.record(t.string, t.unknown);
export type AlertInstanceState = t.TypeOf<typeof stateSchema>;

export const rawAlertInstance = t.partial({
state: stateSchema,
meta: metaSchema,
});
export type RawAlertInstance = t.TypeOf<typeof rawAlertInstance>;
26 changes: 26 additions & 0 deletions x-pack/legacy/plugins/alerting/common/alert_task_instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as t from 'io-ts';
import { rawAlertInstance } from './alert_instance';
import { DateFromString } from './date_from_string';

export const alertStateSchema = t.partial({
alertTypeState: t.record(t.string, t.unknown),
alertInstances: t.record(t.string, rawAlertInstance),
previousStartedAt: t.union([t.null, DateFromString]),
});

export type AlertTaskState = t.TypeOf<typeof alertStateSchema>;

export const alertParamsSchema = t.intersection([
t.type({
alertId: t.string,
}),
t.partial({
spaceId: t.string,
}),
]);
export type AlertTaskParams = t.TypeOf<typeof alertParamsSchema>;
28 changes: 28 additions & 0 deletions x-pack/legacy/plugins/alerting/common/date_from_string.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { DateFromString } from './date_from_string';
import { right, isLeft } from 'fp-ts/lib/Either';

describe('DateFromString', () => {
test('validated and parses a string into a Date', () => {
const date = new Date(1973, 10, 30);
expect(DateFromString.decode(date.toISOString())).toEqual(right(date));
});

test('validated and returns a failure for an actual Date', () => {
const date = new Date(1973, 10, 30);
expect(isLeft(DateFromString.decode(date))).toEqual(true);
});

test('validated and returns a failure for an invalid Date string', () => {
expect(isLeft(DateFromString.decode('1234-23-45'))).toEqual(true);
});

test('validated and returns a failure for a null value', () => {
expect(isLeft(DateFromString.decode(null))).toEqual(true);
});
});
26 changes: 26 additions & 0 deletions x-pack/legacy/plugins/alerting/common/date_from_string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import * as t from 'io-ts';
import { either } from 'fp-ts/lib/Either';

// represents a Date from an ISO string
export const DateFromString = new t.Type<Date, string, unknown>(
'DateFromString',
// detect the type
(value): value is Date => value instanceof Date,
(valueToDecode, context) =>
either.chain(
// validate this is a string
t.string.validate(valueToDecode, context),
// decode
value => {
const decoded = new Date(value);
return isNaN(decoded.getTime()) ? t.failure(valueToDecode, context) : t.success(decoded);
}
),
valueToEncode => valueToEncode.toISOString()
);
4 changes: 3 additions & 1 deletion x-pack/legacy/plugins/alerting/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

export * from './types';
export * from './alert';
export * from './alert_instance';
export * from './alert_task_instance';
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,22 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as t from 'io-ts';
import {
AlertInstanceMeta,
AlertInstanceState,
RawAlertInstance,
rawAlertInstance,
} from '../../common';

import { State, Context } from '../types';
import { DateFromString } from '../lib/types';
import { parseDuration } from '../lib';

interface ScheduledExecutionOptions {
actionGroup: string;
context: Context;
state: State;
}

const metaSchema = t.partial({
lastScheduledActions: t.type({
group: t.string,
date: DateFromString,
}),
});
type AlertInstanceMeta = t.TypeOf<typeof metaSchema>;

const stateSchema = t.record(t.string, t.unknown);
type AlertInstanceState = t.TypeOf<typeof stateSchema>;

export const rawAlertInstance = t.partial({
state: stateSchema,
meta: metaSchema,
});
export type RawAlertInstance = t.TypeOf<typeof rawAlertInstance>;

export type AlertInstances = Record<string, AlertInstance>;
export class AlertInstance {
private scheduledExecutionOptions?: ScheduledExecutionOptions;
private meta: AlertInstanceMeta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { AlertInstance, RawAlertInstance, rawAlertInstance } from './alert_instance';
export { AlertInstance } from './alert_instance';
export { createAlertInstanceFactory } from './create_alert_instance_factory';
3 changes: 2 additions & 1 deletion x-pack/legacy/plugins/alerting/server/alerts_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
AlertType,
IntervalSchedule,
SanitizedAlert,
AlertTaskState,
} from './types';
import { validateAlertTypeParams } from './lib';
import {
Expand All @@ -31,7 +32,7 @@ import {
} from '../../../../plugins/security/server';
import { EncryptedSavedObjectsPluginStart } from '../../../../plugins/encrypted_saved_objects/server';
import { TaskManagerStartContract } from '../../../../plugins/task_manager/server';
import { AlertTaskState, taskInstanceToAlertTaskInstance } from './task_runner/alert_task_instance';
import { taskInstanceToAlertTaskInstance } from './task_runner/alert_task_instance';

type NormalizedAlertAction = Omit<AlertAction, 'actionTypeId'>;
export type CreateAPIKeyResult =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,12 @@ import * as t from 'io-ts';
import { pipe } from 'fp-ts/lib/pipeable';
import { fold } from 'fp-ts/lib/Either';
import { ConcreteTaskInstance } from '../../../../../plugins/task_manager/server';
import { SanitizedAlert } from '../types';
import { DateFromString } from '../lib/types';
import { AlertInstance, rawAlertInstance } from '../alert_instance';
import { SanitizedAlert, AlertTaskState, alertParamsSchema, alertStateSchema } from '../../common';

export interface AlertTaskInstance extends ConcreteTaskInstance {
state: AlertTaskState;
}

export const alertStateSchema = t.partial({
alertTypeState: t.record(t.string, t.unknown),
alertInstances: t.record(t.string, rawAlertInstance),
previousStartedAt: t.union([t.null, DateFromString]),
});
export type AlertInstances = Record<string, AlertInstance>;
export type AlertTaskState = t.TypeOf<typeof alertStateSchema>;

const alertParamsSchema = t.intersection([
t.type({
alertId: t.string,
}),
t.partial({
spaceId: t.string,
}),
]);
export type AlertTaskParams = t.TypeOf<typeof alertParamsSchema>;

const enumerateErrorFields = (e: t.Errors) =>
`${e.map(({ context }) => context.map(({ key }) => key).join('.'))}`;

Expand Down
17 changes: 11 additions & 6 deletions x-pack/legacy/plugins/alerting/server/task_runner/task_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ import { SavedObject } from '../../../../../../src/core/server';
import { TaskRunnerContext } from './task_runner_factory';
import { ConcreteTaskInstance } from '../../../../../plugins/task_manager/server';
import { createExecutionHandler } from './create_execution_handler';
import { AlertInstance, createAlertInstanceFactory, RawAlertInstance } from '../alert_instance';
import { AlertInstance, createAlertInstanceFactory } from '../alert_instance';
import { getNextRunAt } from './get_next_run_at';
import { validateAlertTypeParams } from '../lib';
import { AlertType, RawAlert, IntervalSchedule, Services, AlertInfoParams } from '../types';
import { promiseResult, map, Resultable, asOk, asErr, resolveErr } from '../lib/result_type';
import {
AlertType,
RawAlert,
IntervalSchedule,
Services,
AlertInfoParams,
RawAlertInstance,
AlertTaskState,
AlertInstances,
taskInstanceToAlertTaskInstance,
} from './alert_task_instance';
} from '../types';
import { promiseResult, map, Resultable, asOk, asErr, resolveErr } from '../lib/result_type';
import { taskInstanceToAlertTaskInstance } from './alert_task_instance';
import { AlertInstances } from '../alert_instance/alert_instance';

const FALLBACK_RETRY_INTERVAL: IntervalSchedule = { interval: '5m' };

Expand Down
5 changes: 1 addition & 4 deletions x-pack/legacy/plugins/alerting/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { AlertInstance } from './alert_instance';
import { AlertTypeRegistry as OrigAlertTypeRegistry } from './alert_type_registry';
import { PluginSetupContract, PluginStartContract } from './plugin';
import { SavedObjectAttributes, SavedObjectsClientContract } from '../../../../../src/core/server';
import { Alert } from '../common';

import { Alert, AlertActionParams } from '../common';
export * from '../common';

export type State = Record<string, any>;
Expand Down Expand Up @@ -57,8 +56,6 @@ export interface AlertType {
executor: ({ services, params, state }: AlertExecutorOptions) => Promise<State | void>;
}

export type AlertActionParams = SavedObjectAttributes;

export interface RawAlertAction extends SavedObjectAttributes {
group: string;
actionRef: string;
Expand Down
Loading

0 comments on commit 2ac9e23

Please sign in to comment.