Skip to content

Commit

Permalink
[Synthetics] rename variables and delete unused files (#188152)
Browse files Browse the repository at this point in the history
## Summary

Resolves #188663

Rename variables and files and delete unused files to remove references
to Uptime within Synthetics

Also adds the `x-elastic-internal-origin` header to synthetics e2e tests
  • Loading branch information
dominiqueclarke authored Jul 22, 2024
1 parent f387b48 commit f7e99a2
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 47 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
* 2.0.
*/

export * from './common';
export * from './status_check';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export * from './alerts';
export * from './certs';
export * from './common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const enableMonitorManagedViaApi = async (kibanaUrl: string) => {
try {
await axios.put(kibanaUrl + SYNTHETICS_API_URLS.SYNTHETICS_ENABLEMENT, undefined, {
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'synthetics-e2e' },
});
} catch (e) {
// eslint-disable-next-line no-console
Expand All @@ -38,7 +38,7 @@ export const addTestMonitor = async (
try {
await axios.post(kibanaUrl + SYNTHETICS_API_URLS.SYNTHETICS_MONITORS, testData, {
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'synthetics-e2e' },
});
} catch (e) {
// eslint-disable-next-line no-console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const addTestMonitorProject = async (
testData,
{
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'synthetics-e2e' },
}
);
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class SyntheticsServices {
try {
await axios.put(this.kibanaUrl + SYNTHETICS_API_URLS.SYNTHETICS_ENABLEMENT, undefined, {
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'synthetics-e2e' },
});
} catch (e) {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -75,7 +75,7 @@ export class SyntheticsServices {
testData,
{
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'synthetics-e2e' },
}
);
return response.data.id;
Expand Down Expand Up @@ -121,7 +121,7 @@ export class SyntheticsServices {
{ isDisabled: false },
{
auth: { username: 'elastic', password: 'changeme' },
headers: { 'kbn-xsrf': 'true' },
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'synthetics-e2e' },
}
);
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('ActionMenuContent', () => {
it('renders settings link', () => {
const { getByRole, getByText } = render(<ActionMenuContent />);

const settingsAnchor = getByRole('link', { name: 'Navigate to the Uptime settings page' });
const settingsAnchor = getByRole('link', { name: 'Navigate to the Synthetics settings page' });
expect(settingsAnchor.getAttribute('href')).toBe('/settings');
expect(getByText('Settings'));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function ActionMenuContent(): React.ReactElement {

<EuiHeaderLink
aria-label={i18n.translate('xpack.synthetics.page_header.settingsLink.label', {
defaultMessage: 'Navigate to the Uptime settings page',
defaultMessage: 'Navigate to the Synthetics settings page',
})}
color="text"
data-test-subj="settings-page-link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useState } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiDescribedFormGroup } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { UptimePluginServices } from '../../../../../plugin';
import { SyntheticsPluginServices } from '../../../../../plugin';
import { DefaultEmail as DefaultEmailType } from '../../../../../../common/runtime_types';
import { hasInvalidEmail } from './validation';

Expand All @@ -26,7 +26,7 @@ export function DefaultEmail({
loading: boolean;
selectedConnectors: string[];
}) {
const { actionTypeRegistry } = useKibana<UptimePluginServices>().services.triggersActionsUi;
const { actionTypeRegistry } = useKibana<SyntheticsPluginServices>().services.triggersActionsUi;

const emailActionType = actionTypeRegistry.get('.email');
const ActionParams = emailActionType.actionParamsFields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { PluginInitializerContext } from '@kbn/core/public';
import { UptimePlugin } from './plugin';
import { SyntheticsPlugin } from './plugin';

export const plugin = (initializerContext: PluginInitializerContext) =>
new UptimePlugin(initializerContext);
new SyntheticsPlugin(initializerContext);
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export interface ClientPluginsStart {
licenseManagement?: LicenseManagementUIPluginSetup;
}

export interface UptimePluginServices extends Partial<CoreStart> {
export interface SyntheticsPluginServices extends Partial<CoreStart> {
embeddable: EmbeddableStart;
data: DataPublicPluginStart;
triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
Expand All @@ -114,7 +114,7 @@ export interface UptimePluginServices extends Partial<CoreStart> {
export type ClientSetup = void;
export type ClientStart = void;

export class UptimePlugin
export class SyntheticsPlugin
implements Plugin<ClientSetup, ClientStart, ClientPluginsSetup, ClientPluginsStart>
{
private readonly _packageInfo: Readonly<PackageInfo>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const elasticManagedLocationsEnabledPrivilege: SubFeaturePrivilegeGroupConfig =
],
};

export const uptimeFeature = {
export const syntheticsFeature = {
id: PLUGIN.ID,
name: PLUGIN.NAME,
order: 1000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import {
import { TelemetryEventsSender } from './telemetry/sender';
import { SyntheticsMonitorClient } from './synthetics_service/synthetics_monitor/synthetics_monitor_client';
import { initSyntheticsServer } from './server';
import { uptimeFeature } from './feature';

import { registerUptimeSavedObjects } from './saved_objects/saved_objects';
import { syntheticsFeature } from './feature';
import { registerSyntheticsSavedObjects } from './saved_objects/saved_objects';
import { UptimeConfig } from '../common/config';
import { SyntheticsService } from './synthetics_service/synthetics_service';
import { syntheticsServiceApiKey } from './saved_objects/service_api_key';
Expand Down Expand Up @@ -83,11 +82,11 @@ export class Plugin implements PluginType {

this.telemetryEventsSender.setup(plugins.telemetry);

plugins.features.registerKibanaFeature(uptimeFeature);
plugins.features.registerKibanaFeature(syntheticsFeature);

initSyntheticsServer(this.server, this.syntheticsMonitorClient, plugins, ruleDataClient);

registerUptimeSavedObjects(core.savedObjects, plugins.encryptedSavedObjects);
registerSyntheticsSavedObjects(core.savedObjects, plugins.encryptedSavedObjects);

return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from './synthetics_monitor';
import { syntheticsServiceApiKey } from './service_api_key';

export const registerUptimeSavedObjects = (
export const registerSyntheticsSavedObjects = (
savedObjectsService: SavedObjectsServiceSetup,
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup
) => {
Expand Down

0 comments on commit f7e99a2

Please sign in to comment.