[kbn/optimizer] only build xpack examples when building xpack plugins (#78656)

Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
Spencer 2020-09-28 13:25:15 -07:00 committed by GitHub
parent e75b36a68d
commit f5ca7d82d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 166 additions and 381 deletions

View file

@ -1,34 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export const ALERTING_EXAMPLE_APP_ID = 'AlertingExample';
// always firing
export const DEFAULT_INSTANCES_TO_GENERATE = 5;
// Astros
export enum Craft {
OuterSpace = 'Outer Space',
ISS = 'ISS',
}
export enum Operator {
AreAbove = 'Are above',
AreBelow = 'Are below',
AreExactly = 'Are exactly',
}

View file

@ -1,33 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { registerNavigation as registerPeopleInSpaceNavigation } from './astros';
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
import { SanitizedAlert } from '../../../../x-pack/plugins/alerts/common';
import { PluginSetupContract as AlertingSetup } from '../../../../x-pack/plugins/alerts/public';
export function registerNavigation(alerts: AlertingSetup) {
// register default navigation
alerts.registerDefaultNavigation(
ALERTING_EXAMPLE_APP_ID,
(alert: SanitizedAlert) => `/alert/${alert.id}`
);
registerPeopleInSpaceNavigation(alerts);
}

View file

@ -1,22 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { AlertingExamplePlugin } from './plugin';
export const plugin = () => new AlertingExamplePlugin();

View file

@ -1,47 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import uuid from 'uuid';
import { range } from 'lodash';
import { AlertType } from '../../../../x-pack/plugins/alerts/server';
import { DEFAULT_INSTANCES_TO_GENERATE, ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
export const alertType: AlertType = {
id: 'example.always-firing',
name: 'Always firing',
actionGroups: [{ id: 'default', name: 'default' }],
defaultActionGroupId: 'default',
async executor({ services, params: { instances = DEFAULT_INSTANCES_TO_GENERATE }, state }) {
const count = (state.count ?? 0) + 1;
range(instances)
.map(() => ({ id: uuid.v4() }))
.forEach((instance: { id: string }) => {
services
.alertInstanceFactory(instance.id)
.replaceState({ triggerdOnCycle: count })
.scheduleActions('default');
});
return {
count,
};
},
producer: ALERTING_EXAMPLE_APP_ID,
};

View file

@ -1,23 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { PluginInitializer } from 'kibana/server';
import { AlertingExamplePlugin } from './plugin';
export const plugin: PluginInitializer<void, void> = () => new AlertingExamplePlugin();

View file

@ -161,7 +161,8 @@ export class OptimizerConfig {
Path.resolve(repoRoot, 'src/plugins'), Path.resolve(repoRoot, 'src/plugins'),
...(oss ? [] : [Path.resolve(repoRoot, 'x-pack/plugins')]), ...(oss ? [] : [Path.resolve(repoRoot, 'x-pack/plugins')]),
Path.resolve(repoRoot, 'plugins'), Path.resolve(repoRoot, 'plugins'),
...(examples ? [Path.resolve('examples'), Path.resolve('x-pack/examples')] : []), ...(examples ? [Path.resolve('examples')] : []),
...(examples && !oss ? [Path.resolve('x-pack/examples')] : []),
Path.resolve(repoRoot, '../kibana-extra'), Path.resolve(repoRoot, '../kibana-extra'),
]; ];
if (!pluginScanDirs.every((p) => Path.isAbsolute(p))) { if (!pluginScanDirs.every((p) => Path.isAbsolute(p))) {

View file

@ -5,7 +5,6 @@ source src/dev/ci_setup/setup_env.sh
echo " -> building kibana platform plugins" echo " -> building kibana platform plugins"
node scripts/build_kibana_platform_plugins \ node scripts/build_kibana_platform_plugins \
--oss \ --oss \
--filter '!alertingExample' \
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \ --scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
--scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \ --scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \
--workers 6 \ --workers 6 \

View file

@ -2,10 +2,7 @@
"prefix": "xpack", "prefix": "xpack",
"paths": { "paths": {
"xpack.actions": "plugins/actions", "xpack.actions": "plugins/actions",
"xpack.uiActionsEnhanced": [ "xpack.uiActionsEnhanced": "plugins/ui_actions_enhanced",
"plugins/ui_actions_enhanced",
"examples/ui_actions_enhanced_examples"
],
"xpack.alerts": "plugins/alerts", "xpack.alerts": "plugins/alerts",
"xpack.eventLog": "plugins/event_log", "xpack.eventLog": "plugins/event_log",
"xpack.alertingBuiltins": "plugins/alerting_builtins", "xpack.alertingBuiltins": "plugins/alerting_builtins",
@ -59,6 +56,9 @@
"xpack.watcher": "plugins/watcher", "xpack.watcher": "plugins/watcher",
"xpack.observability": "plugins/observability" "xpack.observability": "plugins/observability"
}, },
"exclude": [
"examples"
],
"translations": [ "translations": [
"plugins/translations/translations/zh-CN.json", "plugins/translations/translations/zh-CN.json",
"plugins/translations/translations/ja-JP.json" "plugins/translations/translations/ja-JP.json"

View file

@ -0,0 +1,21 @@
/*
* 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.
*/
export const ALERTING_EXAMPLE_APP_ID = 'AlertingExample';
// always firing
export const DEFAULT_INSTANCES_TO_GENERATE = 5;
// Astros
export enum Craft {
OuterSpace = 'Outer Space',
ISS = 'ISS',
}
export enum Operator {
AreAbove = 'Are above',
AreBelow = 'Are below',
AreExactly = 'Are exactly',
}

View file

@ -1,26 +1,13 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiFieldNumber, EuiFormRow } from '@elastic/eui'; import { EuiFlexGroup, EuiFlexItem, EuiFieldNumber, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n'; import { i18n } from '@kbn/i18n';
import { AlertTypeModel } from '../../../../x-pack/plugins/triggers_actions_ui/public'; import { AlertTypeModel } from '../../../../plugins/triggers_actions_ui/public';
import { DEFAULT_INSTANCES_TO_GENERATE } from '../../common/constants'; import { DEFAULT_INSTANCES_TO_GENERATE } from '../../common/constants';
interface AlwaysFiringParamsProps { interface AlwaysFiringParamsProps {

View file

@ -1,20 +1,7 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React, { useState, useEffect, Fragment } from 'react'; import React, { useState, useEffect, Fragment } from 'react';
@ -32,9 +19,9 @@ import {
import { i18n } from '@kbn/i18n'; import { i18n } from '@kbn/i18n';
import { flatten } from 'lodash'; import { flatten } from 'lodash';
import { ALERTING_EXAMPLE_APP_ID, Craft, Operator } from '../../common/constants'; import { ALERTING_EXAMPLE_APP_ID, Craft, Operator } from '../../common/constants';
import { SanitizedAlert } from '../../../../x-pack/plugins/alerts/common'; import { SanitizedAlert } from '../../../../plugins/alerts/common';
import { PluginSetupContract as AlertingSetup } from '../../../../x-pack/plugins/alerts/public'; import { PluginSetupContract as AlertingSetup } from '../../../../plugins/alerts/public';
import { AlertTypeModel } from '../../../../x-pack/plugins/triggers_actions_ui/public'; import { AlertTypeModel } from '../../../../plugins/triggers_actions_ui/public';
export function registerNavigation(alerts: AlertingSetup) { export function registerNavigation(alerts: AlertingSetup) {
alerts.registerNavigation( alerts.registerNavigation(

View file

@ -0,0 +1,20 @@
/*
* 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 { registerNavigation as registerPeopleInSpaceNavigation } from './astros';
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
import { SanitizedAlert } from '../../../../plugins/alerts/common';
import { PluginSetupContract as AlertingSetup } from '../../../../plugins/alerts/public';
export function registerNavigation(alerts: AlertingSetup) {
// register default navigation
alerts.registerDefaultNavigation(
ALERTING_EXAMPLE_APP_ID,
(alert: SanitizedAlert) => `/alert/${alert.id}`
);
registerPeopleInSpaceNavigation(alerts);
}

View file

@ -1,20 +1,7 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React from 'react'; import React from 'react';
@ -28,14 +15,14 @@ import {
DocLinksStart, DocLinksStart,
ToastsSetup, ToastsSetup,
ApplicationStart, ApplicationStart,
} from '../../../src/core/public'; } from '../../../../src/core/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
import { ChartsPluginStart } from '../../../src/plugins/charts/public'; import { ChartsPluginStart } from '../../../../src/plugins/charts/public';
import { Page } from './components/page'; import { Page } from './components/page';
import { DocumentationPage } from './components/documentation'; import { DocumentationPage } from './components/documentation';
import { ViewAlertPage } from './components/view_alert'; import { ViewAlertPage } from './components/view_alert';
import { TriggersAndActionsUIPublicPluginStart } from '../../../x-pack/plugins/triggers_actions_ui/public'; import { TriggersAndActionsUIPublicPluginStart } from '../../../plugins/triggers_actions_ui/public';
import { AlertingExamplePublicStartDeps } from './plugin'; import { AlertingExamplePublicStartDeps } from './plugin';
import { ViewPeopleInSpaceAlertPage } from './components/view_astros_alert'; import { ViewPeopleInSpaceAlertPage } from './components/view_astros_alert';

View file

@ -1,30 +1,14 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { EuiIcon, EuiFlexItem, EuiCard, EuiFlexGroup } from '@elastic/eui'; import { EuiIcon, EuiFlexItem, EuiCard, EuiFlexGroup } from '@elastic/eui';
import { import { AlertsContextProvider, AlertAdd } from '../../../../plugins/triggers_actions_ui/public';
AlertsContextProvider,
AlertAdd,
} from '../../../../x-pack/plugins/triggers_actions_ui/public';
import { AlertingExampleComponentParams } from '../application'; import { AlertingExampleComponentParams } from '../application';
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants'; import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';

View file

@ -1,21 +1,9 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React from 'react'; import React from 'react';
import { import {

View file

@ -1,20 +1,7 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React from 'react'; import React from 'react';

View file

@ -1,21 +1,9 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React, { useState, useEffect, Fragment } from 'react'; import React, { useState, useEffect, Fragment } from 'react';
import { import {
@ -32,11 +20,7 @@ import {
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
import { CoreStart } from 'kibana/public'; import { CoreStart } from 'kibana/public';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { import { Alert, AlertTaskState, BASE_ALERT_API_PATH } from '../../../../plugins/alerts/common';
Alert,
AlertTaskState,
BASE_ALERT_API_PATH,
} from '../../../../x-pack/plugins/alerts/common';
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants'; import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
type Props = RouteComponentProps & { type Props = RouteComponentProps & {

View file

@ -1,21 +1,9 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import React, { useState, useEffect, Fragment } from 'react'; import React, { useState, useEffect, Fragment } from 'react';
import { import {
@ -34,11 +22,7 @@ import {
import { withRouter, RouteComponentProps } from 'react-router-dom'; import { withRouter, RouteComponentProps } from 'react-router-dom';
import { CoreStart } from 'kibana/public'; import { CoreStart } from 'kibana/public';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { import { Alert, AlertTaskState, BASE_ALERT_API_PATH } from '../../../../plugins/alerts/common';
Alert,
AlertTaskState,
BASE_ALERT_API_PATH,
} from '../../../../x-pack/plugins/alerts/common';
import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants'; import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
type Props = RouteComponentProps & { type Props = RouteComponentProps & {

View file

@ -0,0 +1,9 @@
/*
* 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 { AlertingExamplePlugin } from './plugin';
export const plugin = () => new AlertingExamplePlugin();

View file

@ -1,31 +1,23 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import { Plugin, CoreSetup, AppMountParameters, AppNavLinkStatus } from '../../../src/core/public'; import {
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerts/public'; Plugin,
import { ChartsPluginStart } from '../../../src/plugins/charts/public'; CoreSetup,
import { TriggersAndActionsUIPublicPluginSetup } from '../../../x-pack/plugins/triggers_actions_ui/public'; AppMountParameters,
import { DataPublicPluginStart } from '../../../src/plugins/data/public'; AppNavLinkStatus,
} from '../../../../src/core/public';
import { PluginSetupContract as AlertingSetup } from '../../../plugins/alerts/public';
import { ChartsPluginStart } from '../../../../src/plugins/charts/public';
import { TriggersAndActionsUIPublicPluginSetup } from '../../../plugins/triggers_actions_ui/public';
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
import { getAlertType as getAlwaysFiringAlertType } from './alert_types/always_firing'; import { getAlertType as getAlwaysFiringAlertType } from './alert_types/always_firing';
import { getAlertType as getPeopleInSpaceAlertType } from './alert_types/astros'; import { getAlertType as getPeopleInSpaceAlertType } from './alert_types/astros';
import { registerNavigation } from './alert_types'; import { registerNavigation } from './alert_types';
import { DeveloperExamplesSetup } from '../../developer_examples/public'; import { DeveloperExamplesSetup } from '../../../../examples/developer_examples/public';
export type Setup = void; export type Setup = void;
export type Start = void; export type Start = void;

View file

@ -0,0 +1,34 @@
/*
* 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 uuid from 'uuid';
import { range } from 'lodash';
import { AlertType } from '../../../../plugins/alerts/server';
import { DEFAULT_INSTANCES_TO_GENERATE, ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
export const alertType: AlertType = {
id: 'example.always-firing',
name: 'Always firing',
actionGroups: [{ id: 'default', name: 'default' }],
defaultActionGroupId: 'default',
async executor({ services, params: { instances = DEFAULT_INSTANCES_TO_GENERATE }, state }) {
const count = (state.count ?? 0) + 1;
range(instances)
.map(() => ({ id: uuid.v4() }))
.forEach((instance: { id: string }) => {
services
.alertInstanceFactory(instance.id)
.replaceState({ triggerdOnCycle: count })
.scheduleActions('default');
});
return {
count,
};
},
producer: ALERTING_EXAMPLE_APP_ID,
};

View file

@ -1,24 +1,11 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import axios from 'axios'; import axios from 'axios';
import { AlertType } from '../../../../x-pack/plugins/alerts/server'; import { AlertType } from '../../../../plugins/alerts/server';
import { Operator, Craft, ALERTING_EXAMPLE_APP_ID } from '../../common/constants'; import { Operator, Craft, ALERTING_EXAMPLE_APP_ID } from '../../common/constants';
interface PeopleInSpace { interface PeopleInSpace {

View file

@ -0,0 +1,10 @@
/*
* 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 { PluginInitializer } from 'kibana/server';
import { AlertingExamplePlugin } from './plugin';
export const plugin: PluginInitializer<void, void> = () => new AlertingExamplePlugin();

View file

@ -1,31 +1,18 @@
/* /*
* Licensed to Elasticsearch B.V. under one or more contributor * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* license agreements. See the NOTICE file distributed with * or more contributor license agreements. Licensed under the Elastic License;
* this work for additional information regarding copyright * you may not use this file except in compliance with the Elastic License.
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ */
import { Plugin, CoreSetup } from 'kibana/server'; import { Plugin, CoreSetup } from 'kibana/server';
import { i18n } from '@kbn/i18n'; import { i18n } from '@kbn/i18n';
import { DEFAULT_APP_CATEGORIES } from '../../../src/core/server'; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerts/server'; import { PluginSetupContract as AlertingSetup } from '../../../plugins/alerts/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../../x-pack/plugins/features/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/features/server';
import { alertType as alwaysFiringAlert } from './alert_types/always_firing'; import { alertType as alwaysFiringAlert } from './alert_types/always_firing';
import { alertType as peopleInSpaceAlert } from './alert_types/astros'; import { alertType as peopleInSpaceAlert } from './alert_types/astros';
import { INDEX_THRESHOLD_ID } from '../../../x-pack/plugins/alerting_builtins/server'; import { INDEX_THRESHOLD_ID } from '../../../plugins/alerting_builtins/server';
import { ALERTING_EXAMPLE_APP_ID } from '../common/constants'; import { ALERTING_EXAMPLE_APP_ID } from '../common/constants';
// this plugin's dependendencies // this plugin's dependendencies

View file

@ -1,5 +1,5 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./target" "outDir": "./target"
}, },
@ -9,10 +9,10 @@
"public/**/*.tsx", "public/**/*.tsx",
"server/**/*.ts", "server/**/*.ts",
"common/**/*.ts", "common/**/*.ts",
"../../typings/**/*", "../../../typings/**/*",
], ],
"exclude": [], "exclude": [],
"references": [ "references": [
{ "path": "../../src/core/tsconfig.json" } { "path": "../../../src/core/tsconfig.json" }
] ]
} }

View file

@ -18198,7 +18198,6 @@
"xpack.triggersActionsUI.typeRegistry.register.duplicateObjectTypeErrorMessage": "オブジェクトタイプ「{id}」は既に登録されています。", "xpack.triggersActionsUI.typeRegistry.register.duplicateObjectTypeErrorMessage": "オブジェクトタイプ「{id}」は既に登録されています。",
"xpack.uiActionsEnhanced.components.actionWizard.changeButton": "変更", "xpack.uiActionsEnhanced.components.actionWizard.changeButton": "変更",
"xpack.uiActionsEnhanced.components.actionWizard.insufficientLicenseLevelTooltip": "不十分なライセンスレベル", "xpack.uiActionsEnhanced.components.actionWizard.insufficientLicenseLevelTooltip": "不十分なライセンスレベル",
"xpack.uiActionsEnhanced.components.DiscoverDrilldownConfig.chooseIndexPattern": "対象インデックスパターンを選択",
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.addToPanelButtonTitle": "パネルに追加", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.addToPanelButtonTitle": "パネルに追加",
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.cancelButtonTitle": "キャンセル", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.cancelButtonTitle": "キャンセル",
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.optionsMenuForm.panelTitleFormRowLabel": "時間範囲", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.optionsMenuForm.panelTitleFormRowLabel": "時間範囲",
@ -18206,7 +18205,6 @@
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.updatePanelTimeRangeButtonTitle": "更新", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.updatePanelTimeRangeButtonTitle": "更新",
"xpack.uiActionsEnhanced.customizeTimeRange.modal.headerTitle": "パネルの時間範囲のカスタマイズ", "xpack.uiActionsEnhanced.customizeTimeRange.modal.headerTitle": "パネルの時間範囲のカスタマイズ",
"xpack.uiActionsEnhanced.customizeTimeRangeMenuItem.displayName": "時間範囲のカスタマイズ", "xpack.uiActionsEnhanced.customizeTimeRangeMenuItem.displayName": "時間範囲のカスタマイズ",
"xpack.uiActionsEnhanced.drilldown.goToDiscover": "Discoverに移動",
"xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText": "ドリルダウンにより、パネルと連携する新しい動作を定義できます。複数のアクションを追加し、デフォルトフィルターを無効化できます。", "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText": "ドリルダウンにより、パネルと連携する新しい動作を定義できます。複数のアクションを追加し、デフォルトフィルターを無効化できます。",
"xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "非表示", "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "非表示",
"xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "ドキュメントを表示", "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "ドキュメントを表示",

View file

@ -18209,7 +18209,6 @@
"xpack.triggersActionsUI.typeRegistry.register.duplicateObjectTypeErrorMessage": "已注册对象类型“{id}”。", "xpack.triggersActionsUI.typeRegistry.register.duplicateObjectTypeErrorMessage": "已注册对象类型“{id}”。",
"xpack.uiActionsEnhanced.components.actionWizard.changeButton": "更改", "xpack.uiActionsEnhanced.components.actionWizard.changeButton": "更改",
"xpack.uiActionsEnhanced.components.actionWizard.insufficientLicenseLevelTooltip": "许可证级别不够", "xpack.uiActionsEnhanced.components.actionWizard.insufficientLicenseLevelTooltip": "许可证级别不够",
"xpack.uiActionsEnhanced.components.DiscoverDrilldownConfig.chooseIndexPattern": "选择目标索引模式",
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.addToPanelButtonTitle": "添加到面板", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.addToPanelButtonTitle": "添加到面板",
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.cancelButtonTitle": "取消", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.cancelButtonTitle": "取消",
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.optionsMenuForm.panelTitleFormRowLabel": "时间范围", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.optionsMenuForm.panelTitleFormRowLabel": "时间范围",
@ -18217,7 +18216,6 @@
"xpack.uiActionsEnhanced.customizePanelTimeRange.modal.updatePanelTimeRangeButtonTitle": "更新", "xpack.uiActionsEnhanced.customizePanelTimeRange.modal.updatePanelTimeRangeButtonTitle": "更新",
"xpack.uiActionsEnhanced.customizeTimeRange.modal.headerTitle": "定制面板时间范围", "xpack.uiActionsEnhanced.customizeTimeRange.modal.headerTitle": "定制面板时间范围",
"xpack.uiActionsEnhanced.customizeTimeRangeMenuItem.displayName": "定制时间范围", "xpack.uiActionsEnhanced.customizeTimeRangeMenuItem.displayName": "定制时间范围",
"xpack.uiActionsEnhanced.drilldown.goToDiscover": "前往 Discover示例",
"xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText": "向下钻取允许您定义与面板交互的新行为。您可以添加多个操作并覆盖默认筛选。", "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText": "向下钻取允许您定义与面板交互的新行为。您可以添加多个操作并覆盖默认筛选。",
"xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "隐藏", "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "隐藏",
"xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "查看文档", "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "查看文档",