diff --git a/docs/user/alerting/images/rule-details-alerts-inactive.png b/docs/user/alerting/images/rule-details-alerts-inactive.png index f84910ae0dcdc4..fc82cf465ebb2d 100644 Binary files a/docs/user/alerting/images/rule-details-alerts-inactive.png and b/docs/user/alerting/images/rule-details-alerts-inactive.png differ diff --git a/src/plugins/console/server/config.ts b/src/plugins/console/server/config.ts index 90839a18e1210d..4e42e3c21d2ad8 100644 --- a/src/plugins/console/server/config.ts +++ b/src/plugins/console/server/config.ts @@ -15,8 +15,6 @@ export const config = schema.object( enabled: schema.boolean({ defaultValue: true }), proxyFilter: schema.arrayOf(schema.string(), { defaultValue: ['.*'] }), ssl: schema.object({ verify: schema.boolean({ defaultValue: false }) }, {}), - - // This does not actually work, track this issue: https://github.com/elastic/kibana/issues/55576 proxyConfig: schema.arrayOf( schema.object({ match: schema.object({ diff --git a/test/plugin_functional/test_suites/doc_views/index.ts b/test/plugin_functional/test_suites/doc_views/index.ts index 2fed8e10ffc8e7..e02b9ac4646f67 100644 --- a/test/plugin_functional/test_suites/doc_views/index.ts +++ b/test/plugin_functional/test_suites/doc_views/index.ts @@ -11,7 +11,8 @@ import { PluginFunctionalProviderContext } from '../../services'; export default function ({ getService, loadTestFile }: PluginFunctionalProviderContext) { const esArchiver = getService('esArchiver'); - describe('doc views', function () { + // SKIPPED: https://github.com/elastic/kibana/issues/100060 + describe.skip('doc views', function () { before(async () => { await esArchiver.loadIfNeeded('../functional/fixtures/es_archiver/discover'); }); diff --git a/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts b/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts index 7bc965f0aa5c81..27e3aa1df61f5e 100644 --- a/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts +++ b/x-pack/plugins/alerting/server/alerts_client/alerts_client.ts @@ -981,6 +981,11 @@ export class AlertsClient { ...this.apiKeyAsAlertAttributes(createdAPIKey, username), updatedBy: username, updatedAt: new Date().toISOString(), + executionStatus: { + status: 'pending', + lastExecutionDate: new Date().toISOString(), + error: null, + }, }); try { await this.unsecuredSavedObjectsClient.update('alert', id, updateAttributes, { version }); diff --git a/x-pack/plugins/alerting/server/alerts_client/tests/enable.test.ts b/x-pack/plugins/alerting/server/alerts_client/tests/enable.test.ts index 7b0d6d7b1f10b6..8c0a09c74457e3 100644 --- a/x-pack/plugins/alerting/server/alerts_client/tests/enable.test.ts +++ b/x-pack/plugins/alerting/server/alerts_client/tests/enable.test.ts @@ -248,6 +248,11 @@ describe('enable()', () => { }, }, ], + executionStatus: { + status: 'pending', + lastExecutionDate: '2019-02-12T21:01:22.479Z', + error: null, + }, }, { version: '123', @@ -352,6 +357,11 @@ describe('enable()', () => { }, }, ], + executionStatus: { + status: 'pending', + lastExecutionDate: '2019-02-12T21:01:22.479Z', + error: null, + }, }, { version: '123', diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx index d9187bb65adf06..8fff01b268b125 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx @@ -35,7 +35,9 @@ export const SchemaTable: React.FC = () => { {FIELD_NAME} - {FIELD_TYPE} + + {FIELD_TYPE} + @@ -74,6 +76,7 @@ export const SchemaTable: React.FC = () => { fieldName={fieldName} fieldType={fieldType} updateExistingFieldType={updateSchemaFieldType} + aria-labelledby="schemaFieldType" /> diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx index df287198390118..6d51a062737129 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx @@ -39,4 +39,10 @@ describe('SchemaFieldTypeSelect', () => { expect(wrapper.find(EuiSelect).prop('disabled')).toEqual(true); }); + + it('passes arbitrary props', () => { + const wrapper = shallow(); + + expect(wrapper.find(EuiSelect).prop('aria-label')).toEqual('Test label'); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx index 8dfd87f4015d65..fb6c0f2047b120 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx @@ -23,10 +23,12 @@ export const SchemaFieldTypeSelect: React.FC = ({ fieldType, updateExistingFieldType, disabled, + ...rest }) => { const fieldTypeOptions = Object.values(SchemaType).map((type) => ({ value: type, text: type })); return ( { {SCHEMA_ERRORS_TABLE_FIELD_NAME_HEADER} - + {SCHEMA_ERRORS_TABLE_DATA_TYPE_HEADER} @@ -58,6 +58,7 @@ export const SchemaFieldsTable: React.FC = () => { fieldName={fieldName} fieldType={filteredSchemaFields[fieldName]} updateExistingFieldType={updateExistingFieldType} + aria-labelledby="schemaDataType" /> diff --git a/x-pack/plugins/fleet/common/types/index.ts b/x-pack/plugins/fleet/common/types/index.ts index 03584a48ff17cf..7117973baa1393 100644 --- a/x-pack/plugins/fleet/common/types/index.ts +++ b/x-pack/plugins/fleet/common/types/index.ts @@ -15,13 +15,6 @@ export interface FleetConfigType { registryProxyUrl?: string; agents: { enabled: boolean; - tlsCheckDisabled: boolean; - pollingRequestTimeout: number; - maxConcurrentConnections: number; - kibana: { - host?: string[] | string; - ca_sha256?: string; - }; elasticsearch: { host?: string; ca_sha256?: string; @@ -29,8 +22,6 @@ export interface FleetConfigType { fleet_server?: { hosts?: string[]; }; - agentPolicyRolloutRateLimitIntervalMs: number; - agentPolicyRolloutRateLimitRequestPerInterval: number; }; agentPolicies?: PreconfiguredAgentPolicy[]; packages?: PreconfiguredPackage[]; diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts b/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts index 5d53425607361d..7f0b71de779dc6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts @@ -14,19 +14,10 @@ export const createConfigurationMock = (): FleetConfigType => { registryProxyUrl: '', agents: { enabled: true, - tlsCheckDisabled: true, - pollingRequestTimeout: 1000, - maxConcurrentConnections: 100, - kibana: { - host: '', - ca_sha256: '', - }, elasticsearch: { host: '', ca_sha256: '', }, - agentPolicyRolloutRateLimitIntervalMs: 100, - agentPolicyRolloutRateLimitRequestPerInterval: 1000, }, }; }; diff --git a/x-pack/plugins/fleet/server/mocks/index.ts b/x-pack/plugins/fleet/server/mocks/index.ts index 4bc2bea1e58b69..a94f274b202adf 100644 --- a/x-pack/plugins/fleet/server/mocks/index.ts +++ b/x-pack/plugins/fleet/server/mocks/index.ts @@ -30,6 +30,10 @@ export const createAppContextStartContractMock = (): FleetAppContext => { security: securityMock.createStart(), logger: loggingSystemMock.create().get(), isProductionMode: true, + configInitialValue: { + agents: { enabled: true, elasticsearch: {} }, + enabled: true, + }, kibanaVersion: '8.0.0', kibanaBranch: 'master', }; diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 61c3a83242c574..0fdc6ef651ed1a 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -6,7 +6,6 @@ */ import type { Observable } from 'rxjs'; -import { first } from 'rxjs/operators'; import type { CoreSetup, CoreStart, @@ -110,6 +109,7 @@ export interface FleetAppContext { encryptedSavedObjectsSetup?: EncryptedSavedObjectsPluginSetup; security?: SecurityPluginStart; config$?: Observable; + configInitialValue: FleetConfigType; savedObjects: SavedObjectsServiceStart; isProductionMode: PluginInitializerContext['env']['mode']['prod']; kibanaVersion: PluginInitializerContext['env']['packageInfo']['version']; @@ -189,6 +189,7 @@ export class FleetPlugin implements AsyncPlugin { private licensing$!: Observable; private config$: Observable; + private configInitialValue: FleetConfigType; private cloud: CloudSetup | undefined; private logger: Logger | undefined; @@ -204,15 +205,15 @@ export class FleetPlugin this.kibanaVersion = this.initializerContext.env.packageInfo.version; this.kibanaBranch = this.initializerContext.env.packageInfo.branch; this.logger = this.initializerContext.logger.get(); + this.configInitialValue = this.initializerContext.config.get(); } - public async setup(core: CoreSetup, deps: FleetSetupDeps) { + public setup(core: CoreSetup, deps: FleetSetupDeps) { this.httpSetup = core.http; this.licensing$ = deps.licensing.license$; this.encryptedSavedObjectsSetup = deps.encryptedSavedObjects; this.cloud = deps.cloud; - - const config = await this.config$.pipe(first()).toPromise(); + const config = this.configInitialValue; registerSavedObjects(core.savedObjects, deps.encryptedSavedObjects); registerEncryptedSavedObjects(deps.encryptedSavedObjects); @@ -279,13 +280,14 @@ export class FleetPlugin } } - public async start(core: CoreStart, plugins: FleetStartDeps): Promise { - await appContextService.start({ + public start(core: CoreStart, plugins: FleetStartDeps): FleetStartContract { + appContextService.start({ elasticsearch: core.elasticsearch, data: plugins.data, encryptedSavedObjectsStart: plugins.encryptedSavedObjects, encryptedSavedObjectsSetup: this.encryptedSavedObjectsSetup, security: plugins.security, + configInitialValue: this.configInitialValue, config$: this.config$, savedObjects: core.savedObjects, isProductionMode: this.isProductionMode, diff --git a/x-pack/plugins/fleet/server/services/app_context.ts b/x-pack/plugins/fleet/server/services/app_context.ts index 954308a9808613..82ec0aad526515 100644 --- a/x-pack/plugins/fleet/server/services/app_context.ts +++ b/x-pack/plugins/fleet/server/services/app_context.ts @@ -7,7 +7,6 @@ import type { Observable } from 'rxjs'; import { BehaviorSubject } from 'rxjs'; -import { first } from 'rxjs/operators'; import { kibanaPackageJson } from '@kbn/utils'; import type { KibanaRequest } from 'src/core/server'; import type { @@ -44,7 +43,7 @@ class AppContextService { private httpSetup?: HttpServiceSetup; private externalCallbacks: ExternalCallbacksStorage = new Map(); - public async start(appContext: FleetAppContext) { + public start(appContext: FleetAppContext) { this.data = appContext.data; this.esClient = appContext.elasticsearch.client.asInternalUser; this.encryptedSavedObjects = appContext.encryptedSavedObjectsStart?.getClient(); @@ -60,7 +59,7 @@ class AppContextService { if (appContext.config$) { this.config$ = appContext.config$; - const initialValue = await this.config$.pipe(first()).toPromise(); + const initialValue = appContext.configInitialValue; this.configSubject$ = new BehaviorSubject(initialValue); this.config$.subscribe(this.configSubject$); } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx index a41708f052dc8e..1bbffc850ee185 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.test.tsx @@ -8,6 +8,8 @@ import * as React from 'react'; import uuid from 'uuid'; import { shallow } from 'enzyme'; +import { mountWithIntl, nextTick } from '@kbn/test/jest'; +import { act } from '@testing-library/react'; import { AlertDetails } from './alert_details'; import { Alert, ActionType, AlertTypeModel, AlertType } from '../../../../types'; import { EuiTitle, EuiBadge, EuiFlexItem, EuiSwitch, EuiButtonEmpty, EuiText } from '@elastic/eui'; @@ -463,6 +465,74 @@ describe('disable button', () => { handler!({} as React.FormEvent); expect(enableAlert).toHaveBeenCalledTimes(1); }); + + it('should reset error banner dismissal after re-enabling the alert', async () => { + const alert = mockAlert({ + enabled: true, + executionStatus: { + status: 'error', + lastExecutionDate: new Date('2020-08-20T19:23:38Z'), + error: { + reason: AlertExecutionStatusErrorReasons.Execute, + message: 'Fail', + }, + }, + }); + + const alertType: AlertType = { + id: '.noop', + name: 'No Op', + actionGroups: [{ id: 'default', name: 'Default' }], + recoveryActionGroup, + actionVariables: { context: [], state: [], params: [] }, + defaultActionGroupId: 'default', + producer: ALERTS_FEATURE_ID, + authorizedConsumers, + minimumLicenseRequired: 'basic', + enabledInLicense: true, + }; + + const disableAlert = jest.fn(); + const enableAlert = jest.fn(); + const wrapper = mountWithIntl( + + ); + + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + // Dismiss the error banner + await act(async () => { + wrapper.find('[data-test-subj="dismiss-execution-error"]').first().simulate('click'); + await nextTick(); + }); + + // Disable the alert + await act(async () => { + wrapper.find('[data-test-subj="disableSwitch"] .euiSwitch__button').first().simulate('click'); + await nextTick(); + }); + expect(disableAlert).toHaveBeenCalled(); + + // Enable the alert + await act(async () => { + wrapper.find('[data-test-subj="disableSwitch"] .euiSwitch__button').first().simulate('click'); + await nextTick(); + }); + expect(enableAlert).toHaveBeenCalled(); + + // Ensure error banner is back + expect(wrapper.find('[data-test-subj="dismiss-execution-error"]').length).toBeGreaterThan(0); + }); }); describe('mute button', () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx index 0796f09b134606..d85e792f4a9bbd 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_details.tsx @@ -236,6 +236,8 @@ export const AlertDetails: React.FunctionComponent = ({ if (isEnabled) { setIsEnabled(false); await disableAlert(alert); + // Reset dismiss if previously clicked + setDissmissAlertErrors(false); } else { setIsEnabled(true); await enableAlert(alert); @@ -277,7 +279,7 @@ export const AlertDetails: React.FunctionComponent = ({ - {!dissmissAlertErrors && alert.executionStatus.status === 'error' ? ( + {alert.enabled && !dissmissAlertErrors && alert.executionStatus.status === 'error' ? ( = ({ - setDissmissAlertErrors(true)}> + setDissmissAlertErrors(true)} + > { }; expect(alertInstanceToListItem(fakeNow.getTime(), alertType, 'id', instance)).toEqual({ instance: 'id', - status: { label: 'OK', healthColor: 'subdued' }, + status: { label: 'Recovered', healthColor: 'subdued' }, start: undefined, duration: 0, sortPriority: 1, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx index d2919194125f83..5ba4c466f6fadf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alert_details/components/alert_instances.tsx @@ -226,7 +226,7 @@ const ACTIVE_LABEL = i18n.translate( const INACTIVE_LABEL = i18n.translate( 'xpack.triggersActionsUI.sections.alertDetails.alertInstancesList.status.inactive', - { defaultMessage: 'OK' } + { defaultMessage: 'Recovered' } ); function getActionGroupName(alertType: AlertType, actionGroupId?: string): string | undefined { diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts index b38b605bc1b678..34e08ad257f849 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts @@ -655,7 +655,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ).to.eql([ { instance: 'eu/east', - status: 'OK', + status: 'Recovered', start: '', duration: '', },