Skip to content

Commit

Permalink
Merge branch 'accessibility' of github.com:rasroh/kibana into accessi…
Browse files Browse the repository at this point in the history
…bility
  • Loading branch information
rashmivkulkarni committed Mar 31, 2020
2 parents bad3da9 + e16430d commit 6d0dd82
Show file tree
Hide file tree
Showing 106 changed files with 1,605 additions and 776 deletions.
2 changes: 1 addition & 1 deletion docs/canvas/canvas-elements.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ By default, most of the elements you create use demo data until you change the d

* *{es} SQL* — Access your data in {es} using SQL syntax. For information about SQL syntax, refer to {ref}/sql-spec.html[SQL language].

* *{es} raw data* — Access your raw data in {es} without the use of aggregations. Use {es} raw data when you have low volume datasets, or to plot exact, non-aggregated values.
* *{es} documents* &mdash; Access your data in {es} without using aggregations. To use, select an index and fields, and optionally enter a query using the <<lucene-query,Lucene Query Syntax>>. Use the *{es} documents* data source when you have low volume datasets, to view raw documents, or to plot exact, non-aggregated values on a chart.

* *Timelion* &mdash; Access your time series data using <<timelion,Timelion>> queries. To use Timelion queries, you can enter a query using the <<lucene-query,Lucene Query Syntax>>.

Expand Down
4 changes: 1 addition & 3 deletions examples/alerting_example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true,
"resolveJsonModule": true
"outDir": "./target"
},
"include": [
"index.ts",
Expand Down
5 changes: 5 additions & 0 deletions packages/elastic-datemath/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# datemath

Datemath string parser used in Kibana. This is published to NPM for use in a limited number of locations outside of Kibana, but is not regularly updated and may get seriously out of date.

If you file an issue in elastic/kibana we can probably update it for you if needed, though you probably shouldn't depend on this package for anything important.
3 changes: 0 additions & 3 deletions packages/elastic-datemath/readme.md

This file was deleted.

8 changes: 8 additions & 0 deletions src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ echo " -- TEST_ES_SNAPSHOT_VERSION='$TEST_ES_SNAPSHOT_VERSION'"
echo " -- installing node.js dependencies"
yarn kbn bootstrap --prefer-offline

###
### Download es snapshots
###
echo " -- downloading es snapshot"
node scripts/es snapshot --download-only;
node scripts/es snapshot --license=oss --download-only;


###
### verify no git modifications
###
Expand Down
3 changes: 0 additions & 3 deletions test/scripts/jenkins_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ node scripts/build_kibana_platform_plugins \
# doesn't persist, also set in kibanaPipeline.groovy
export KBN_NP_PLUGINS_BUILT=true

echo " -> downloading es snapshot"
node scripts/es snapshot --license=oss --download-only;

echo " -> Ensuring all functional tests are in a ciGroup"
yarn run grunt functionalTests:ensureAllTestsInCiGroup;

Expand Down
3 changes: 0 additions & 3 deletions test/scripts/jenkins_xpack_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ node scripts/build_kibana_platform_plugins \
# doesn't persist, also set in kibanaPipeline.groovy
export KBN_NP_PLUGINS_BUILT=true

echo " -> downloading es snapshot"
node scripts/es snapshot --download-only;

echo " -> Ensuring all functional tests are in a ciGroup"
cd "$XPACK_DIR"
node scripts/functional_tests --assert-none-excluded \
Expand Down
25 changes: 25 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ declare module '*.html' {
export default template;
}

declare module '*.png' {
const content: string;
// eslint-disable-next-line import/no-default-export
export default content;
}

declare module '*.svg' {
const content: string;
// eslint-disable-next-line import/no-default-export
export default content;
}

// allow JSON files to be imported directly without lint errors
// see: https://github.com/palantir/tslint/issues/1264#issuecomment-228433367
// and: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts
declare module '*.json' {
const json: any;
// eslint-disable-next-line import/no-default-export
export default json;
}

type MethodKeysOf<T> = {
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
}[keyof T];
Expand All @@ -37,3 +58,7 @@ type DeeplyMockedKeys<T> = {
: DeeplyMockedKeys<T[P]>;
} &
T;

type Writable<T> = {
-readonly [K in keyof T]: T[K];
};
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"xpack.features": "plugins/features",
"xpack.fileUpload": "plugins/file_upload",
"xpack.graph": ["legacy/plugins/graph", "plugins/graph"],
"xpack.grokDebugger": "legacy/plugins/grokdebugger",
"xpack.grokDebugger": "plugins/grokdebugger",
"xpack.idxMgmt": "plugins/index_management",
"xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management",
"xpack.infra": "plugins/infra",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { monitoring } from './legacy/plugins/monitoring';
import { reporting } from './legacy/plugins/reporting';
import { security } from './legacy/plugins/security';
import { tilemap } from './legacy/plugins/tilemap';
import { grokdebugger } from './legacy/plugins/grokdebugger';
import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { logstash } from './legacy/plugins/logstash';
import { beats } from './legacy/plugins/beats_management';
Expand Down Expand Up @@ -44,7 +43,6 @@ module.exports = function(kibana) {
spaces(kibana),
security(kibana),
tilemap(kibana),
grokdebugger(kibana),
dashboardMode(kibana),
logstash(kibana),
beats(kibana),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ export function ServiceDetails({ tab }: Props) {
const canSaveAlerts = !!plugin.core.application.capabilities.apm[
'alerting:save'
];
const isAlertingPluginEnabled = 'alerting' in plugin.plugins;

const isAlertingAvailable = canReadAlerts || canSaveAlerts;
const isAlertingAvailable =
isAlertingPluginEnabled && (canReadAlerts || canSaveAlerts);

return (
<div>
Expand Down
28 changes: 15 additions & 13 deletions x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,49 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ApmRoute } from '@elastic/apm-rum-react';
import { i18n } from '@kbn/i18n';
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Router, Switch } from 'react-router-dom';
import { ApmRoute } from '@elastic/apm-rum-react';
import styled from 'styled-components';
import { i18n } from '@kbn/i18n';
import { AlertType } from '../../../../../plugins/apm/common/alert_types';
import {
CoreSetup,
CoreStart,
Plugin,
PluginInitializerContext
} from '../../../../../../src/core/public';
import { featureCatalogueEntry } from './featureCatalogueEntry';
import { DataPublicPluginSetup } from '../../../../../../src/plugins/data/public';
import { HomePublicPluginSetup } from '../../../../../../src/plugins/home/public';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { PluginSetupContract as AlertingPluginPublicSetup } from '../../../../../plugins/alerting/public';
import { AlertType } from '../../../../../plugins/apm/common/alert_types';
import { LicensingPluginSetup } from '../../../../../plugins/licensing/public';
import {
AlertsContextProvider,
TriggersAndActionsUIPublicPluginSetup
} from '../../../../../plugins/triggers_actions_ui/public';
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
import { routes } from '../components/app/Main/route_config';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs';
import { ErrorRateAlertTrigger } from '../components/shared/ErrorRateAlertTrigger';
import { TransactionDurationAlertTrigger } from '../components/shared/TransactionDurationAlertTrigger';
import { ApmPluginContext } from '../context/ApmPluginContext';
import { LicenseProvider } from '../context/LicenseContext';
import { LoadingIndicatorProvider } from '../context/LoadingIndicatorContext';
import { LocationProvider } from '../context/LocationContext';
import { MatchedRouteProvider } from '../context/MatchedRouteContext';
import { UrlParamsProvider } from '../context/UrlParamsContext';
import { createCallApmApi } from '../services/rest/createCallApmApi';
import { createStaticIndexPattern } from '../services/rest/index_pattern';
import { px, unit, units } from '../style/variables';
import { history } from '../utils/history';
import { featureCatalogueEntry } from './featureCatalogueEntry';
import { getConfigFromInjectedMetadata } from './getConfigFromInjectedMetadata';
import { setHelpExtension } from './setHelpExtension';
import { toggleAppLinkInNav } from './toggleAppLinkInNav';
import { setReadonlyBadge } from './updateBadge';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
import {
TriggersAndActionsUIPublicPluginSetup,
AlertsContextProvider
} from '../../../../../plugins/triggers_actions_ui/public';
import { ErrorRateAlertTrigger } from '../components/shared/ErrorRateAlertTrigger';
import { TransactionDurationAlertTrigger } from '../components/shared/TransactionDurationAlertTrigger';
import { createCallApmApi } from '../services/rest/createCallApmApi';

export const REACT_APP_ROOT_ID = 'react-apm-root';

Expand Down Expand Up @@ -75,6 +76,7 @@ export type ApmPluginSetup = void;
export type ApmPluginStart = void;

export interface ApmPluginSetupDeps {
alerting?: AlertingPluginPublicSetup;
data: DataPublicPluginSetup;
home: HomePublicPluginSetup;
licensing: LicensingPluginSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { openSans } from '../../../common/lib/fonts';
import header from './header.png';
import { AdvancedSettings } from '../../../public/lib/kibana_advanced_settings';
import { getAdvancedSettings } from '../../../public/lib/kibana_advanced_settings';

import { ElementFactory } from '../../../types';
export const metric: ElementFactory = () => ({
Expand All @@ -23,6 +23,6 @@ export const metric: ElementFactory = () => ({
| metric "Countries"
metricFont={font size=48 family="${openSans.value}" color="#000000" align="center" lHeight=48}
labelFont={font size=14 family="${openSans.value}" color="#000000" align="center"}
metricFormat="${AdvancedSettings.get('format:number:defaultPattern')}"
metricFormat="${getAdvancedSettings().get('format:number:defaultPattern')}"
| render`,
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
*/

import React from 'react';
import { AdvancedSettings } from '../../../../public/lib/kibana_advanced_settings';
import { getAdvancedSettings } from '../../../../public/lib/kibana_advanced_settings';
import { TimeFilter as Component, Props } from './time_filter';

export const TimeFilter = (props: Props) => {
const customQuickRanges = (AdvancedSettings.get('timepicker:quickRanges') || []).map(
const customQuickRanges = (getAdvancedSettings().get('timepicker:quickRanges') || []).map(
({ from, to, display }: { from: string; to: string; display: string }) => ({
start: from,
end: to,
label: display,
})
);

const customDateFormat = AdvancedSettings.get('dateFormat');
const customDateFormat = getAdvancedSettings().get('dateFormat');

return (
<Component {...props} commonlyUsedRanges={customQuickRanges} dateFormat={customDateFormat} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
import { compose, withProps } from 'recompose';
import moment from 'moment';
import { DateFormatArgInput as Component, Props as ComponentProps } from './date_format';
import { AdvancedSettings } from '../../../../public/lib/kibana_advanced_settings';
import { getAdvancedSettings } from '../../../../public/lib/kibana_advanced_settings';
// @ts-ignore untyped local lib
import { templateFromReactComponent } from '../../../../public/lib/template_from_react_component';
import { ArgumentFactory } from '../../../../types/arguments';
import { ArgumentStrings } from '../../../../i18n';

const { DateFormat: strings } = ArgumentStrings;

const formatMap = {
DEFAULT: AdvancedSettings.get('dateFormat'),
NANOS: AdvancedSettings.get('dateNanosFormat'),
const getFormatMap = () => ({
DEFAULT: getAdvancedSettings().get('dateFormat'),
NANOS: getAdvancedSettings().get('dateNanosFormat'),
ISO8601: '',
LOCAL_LONG: 'LLLL',
LOCAL_SHORT: 'LLL',
LOCAL_DATE: 'l',
LOCAL_TIME_WITH_SECONDS: 'LTS',
};
});

const now = moment();

const dateFormats = Object.values(formatMap).map(format => ({
const dateFormats = Object.values(getFormatMap()).map(format => ({
value: format,
text: moment.utc(now).format(format),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,36 @@

import { compose, withProps } from 'recompose';
import { NumberFormatArgInput as Component, Props as ComponentProps } from './number_format';
import { AdvancedSettings } from '../../../../public/lib/kibana_advanced_settings';
import { getAdvancedSettings } from '../../../../public/lib/kibana_advanced_settings';
// @ts-ignore untyped local lib
import { templateFromReactComponent } from '../../../../public/lib/template_from_react_component';
import { ArgumentFactory } from '../../../../types/arguments';
import { ArgumentStrings } from '../../../../i18n';

const { NumberFormat: strings } = ArgumentStrings;

const formatMap = {
NUMBER: AdvancedSettings.get('format:number:defaultPattern'),
PERCENT: AdvancedSettings.get('format:percent:defaultPattern'),
CURRENCY: AdvancedSettings.get('format:currency:defaultPattern'),
const getFormatMap = () => ({
NUMBER: getAdvancedSettings().get('format:number:defaultPattern'),
PERCENT: getAdvancedSettings().get('format:percent:defaultPattern'),
CURRENCY: getAdvancedSettings().get('format:currency:defaultPattern'),
DURATION: '00:00:00',
BYTES: AdvancedSettings.get('format:bytes:defaultPattern'),
};
BYTES: getAdvancedSettings().get('format:bytes:defaultPattern'),
});

const numberFormats = [
{ value: formatMap.NUMBER, text: strings.getFormatNumber() },
{ value: formatMap.PERCENT, text: strings.getFormatPercent() },
{ value: formatMap.CURRENCY, text: strings.getFormatCurrency() },
{ value: formatMap.DURATION, text: strings.getFormatDuration() },
{ value: formatMap.BYTES, text: strings.getFormatBytes() },
];
const getNumberFormats = () => {
const formatMap = getFormatMap();
return [
{ value: formatMap.NUMBER, text: strings.getFormatNumber() },
{ value: formatMap.PERCENT, text: strings.getFormatPercent() },
{ value: formatMap.CURRENCY, text: strings.getFormatCurrency() },
{ value: formatMap.DURATION, text: strings.getFormatDuration() },
{ value: formatMap.BYTES, text: strings.getFormatBytes() },
];
};

export const NumberFormatArgInput = compose<ComponentProps, null>(withProps({ numberFormats }))(
Component
);
export const NumberFormatArgInput = compose<ComponentProps, null>(
withProps({ numberFormats: getNumberFormats() })
)(Component);

export const numberFormat: ArgumentFactory<ComponentProps> = () => ({
name: 'numberFormat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { openSans } from '../../../common/lib/fonts';
import { AdvancedSettings } from '../../../public/lib/kibana_advanced_settings';
import { getAdvancedSettings } from '../../../public/lib/kibana_advanced_settings';
import { ViewStrings } from '../../../i18n';

const { Metric: strings } = ViewStrings;
Expand All @@ -21,7 +21,7 @@ export const metric = () => ({
displayName: strings.getMetricFormatDisplayName(),
help: strings.getMetricFormatHelp(),
argType: 'numberFormat',
default: `"${AdvancedSettings.get('format:number:defaultPattern')}"`,
default: `"${getAdvancedSettings().get('format:number:defaultPattern')}"`,
},
{
name: '_',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('ui/new_platform');
import { getElementStrings } from './element_strings';
import { elementSpecs } from '../../canvas_plugin_src/elements';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import { ConfirmModal } from '../confirm_modal';
import { Link } from '../link';
import { Paginate } from '../paginate';
import { ComponentStrings } from '../../../i18n';
import { AdvancedSettings } from '../../lib/kibana_advanced_settings';
import { getAdvancedSettings } from '../../lib/kibana_advanced_settings';
import { WorkpadDropzone } from './workpad_dropzone';
import { WorkpadCreate } from './workpad_create';
import { WorkpadSearch } from './workpad_search';
import { uploadWorkpad } from './upload_workpad';

const { WorkpadLoader: strings } = ComponentStrings;

const formatDate = date => date && moment(date).format(AdvancedSettings.get('dateFormat'));
const formatDate = date => date && moment(date).format(getAdvancedSettings().get('dateFormat'));

const getDisplayName = (name, workpad, loadedWorkpad) => {
const workpadName = name.length ? name : <em>{workpad.id}</em>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import chrome from 'ui/chrome';
import { getCoreStart } from '../legacy';

export const AdvancedSettings = chrome.getUiSettingsClient();
export const getAdvancedSettings = () => getCoreStart().uiSettings;
Loading

0 comments on commit 6d0dd82

Please sign in to comment.