Skip to content

Commit

Permalink
[APM] Convert shared filenames and folders (#122911)
Browse files Browse the repository at this point in the history
* [APM] Convert shared filenames and folders

* Fix broken imports

* Update snapshots

* Fix broken imports
  • Loading branch information
kpatticha authored Jan 14, 2022
1 parent 5a77714 commit 46196f2
Show file tree
Hide file tree
Showing 225 changed files with 204 additions and 201 deletions.
13 changes: 8 additions & 5 deletions x-pack/plugins/apm/dev_docs/routing_and_linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ To be able to use the parameters, you can use `useApmParams`, which will automat
```ts
const {
path: { serviceName }, // string
query: { transactionType } // string | undefined
query: { transactionType }, // string | undefined
} = useApmParams('/services/:serviceName');
```

Expand All @@ -64,13 +64,16 @@ For links that stay inside APM, the preferred way of linking is to call the `use

```ts
const apmRouter = useApmRouter();
const serviceOverviewLink = apmRouter.link('/services/:serviceName', { path: { serviceName: 'opbeans-java' }, query: { transactionType: 'request' }});
const serviceOverviewLink = apmRouter.link('/services/:serviceName', {
path: { serviceName: 'opbeans-java' },
query: { transactionType: 'request' },
});
```

If you're not in React context, you can also import `apmRouter` directly and call its `link` function - but you have to prepend the basePath manually in that case.
If you're not in React context, you can also import `apmRouter` directly and call its `link` function - but you have to prepend the basePath manually in that case.

We also have the [`getLegacyApmHref` function and `APMLink` component](../public/components/shared/Links/apm/APMLink.tsx), but we should consider them deprecated, in favor of `router.link`. Other components inside that directory contain other functions and components that provide the same functionality for linking to more specific sections inside the APM plugin.
We also have the [`getLegacyApmHref` function and `APMLink` component](../public/components/shared/links/apm/APMLink.tsx), but we should consider them deprecated, in favor of `router.link`. Other components inside that directory contain other functions and components that provide the same functionality for linking to more specific sections inside the APM plugin.

### Cross-app linking

Other helpers and components in [the Links directory](../public/components/shared/Links) allow linking to other Kibana apps.
Other helpers and components in [the Links directory](../public/components/shared/links) allow linking to other Kibana apps.
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/public/application/uxApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
useUiSetting$,
} from '../../../../../src/plugins/kibana_react/public';
import { APMRouteDefinition } from '../application/routes';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { ScrollToTopOnPathChange } from '../components/app/main/ScrollToTopOnPathChange';
import {
RumHome,
DASHBOARD_LABEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
EuiSelectOption,
EuiFormRow,
} from '@elastic/eui';
import { SelectWithPlaceholder } from '../../../../../shared/SelectWithPlaceholder';
import { SelectWithPlaceholder } from '../../../../../shared/select_with_placeholder';

interface Props {
title: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '../../../../../../../common/agent_configuration/all_option';
import { useFetcher, FETCH_STATUS } from '../../../../../../hooks/use_fetcher';
import { FormRowSelect } from './FormRowSelect';
import { APMLink } from '../../../../../shared/Links/apm/APMLink';
import { APMLink } from '../../../../../shared/links/apm/apm_link';

interface Props {
newConfig: AgentConfigurationIntake;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
amountAndUnitToString,
amountAndUnitToObject,
} from '../../../../../../../common/agent_configuration/amount_and_unit';
import { SelectWithPlaceholder } from '../../../../../shared/SelectWithPlaceholder';
import { SelectWithPlaceholder } from '../../../../../shared/select_with_placeholder';

function FormRow({
setting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
AgentConfigurationIntake,
} from '../../../../../../common/agent_configuration/configuration_types';
import { FetcherResult } from '../../../../../hooks/use_fetcher';
import { fromQuery, toQuery } from '../../../../shared/Links/url_helpers';
import { fromQuery, toQuery } from '../../../../shared/links/url_helpers';
import { ServicePage } from './ServicePage/ServicePage';
import { SettingsPage } from './SettingsPage/SettingsPage';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { getOptionLabel } from '../../../../../../common/agent_configuration/all
import { useApmPluginContext } from '../../../../../context/apm_plugin/use_apm_plugin_context';
import { FETCH_STATUS } from '../../../../../hooks/use_fetcher';
import { useTheme } from '../../../../../hooks/use_theme';
import { LoadingStatePrompt } from '../../../../shared/LoadingStatePrompt';
import { LoadingStatePrompt } from '../../../../shared/loading_state_prompt';
import { ITableColumn, ManagedTable } from '../../../../shared/managed_table';
import { TimestampTooltip } from '../../../../shared/TimestampTooltip';
import { TimestampTooltip } from '../../../../shared/timestamp_tooltip';
import { ConfirmDeleteModal } from './ConfirmDeleteModal';

type Config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
EuiBasicTableColumn,
EuiInMemoryTableProps,
} from '@elastic/eui';
import { TimestampTooltip } from '../../../shared/TimestampTooltip';
import { TimestampTooltip } from '../../../shared/timestamp_tooltip';
import { ApiKey } from '../../../../../../security/common/model';
import { ConfirmDeleteModal } from './confirm_delete_modal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plug
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
import { useMlManageJobsHref } from '../../../../hooks/use_ml_manage_jobs_href';
import { callApmApi } from '../../../../services/rest/createCallApmApi';
import { MLExplorerLink } from '../../../shared/Links/MachineLearningLinks/MLExplorerLink';
import { MLManageJobsLink } from '../../../shared/Links/MachineLearningLinks/MLManageJobsLink';
import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt';
import { MLExplorerLink } from '../../../shared/links/machine_learning_links/mlexplorer_link';
import { MLManageJobsLink } from '../../../shared/links/machine_learning_links/mlmanage_jobs_link';
import { LoadingStatePrompt } from '../../../shared/loading_state_prompt';
import { ITableColumn, ManagedTable } from '../../../shared/managed_table';
import { MLCallout, shouldDisplayMlCallout } from '../../../shared/ml_callout';
import { AnomalyDetectionApiResponse } from './index';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { DATAFEED_STATE, JOB_STATE } from '../../../../../../ml/common';
import { MLManageJobsLink } from '../../../shared/Links/MachineLearningLinks/MLManageJobsLink';
import { MLManageJobsLink } from '../../../shared/links/machine_learning_links/mlmanage_jobs_link';

export function JobsListStatus({
jobId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { isEmpty } from 'lodash';
import React, { useState } from 'react';
import { CustomLink } from '../../../../../common/custom_link/custom_link_types';
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt';
import { LoadingStatePrompt } from '../../../shared/loading_state_prompt';
import { ITableColumn, ManagedTable } from '../../../shared/managed_table';
import { TimestampTooltip } from '../../../shared/TimestampTooltip';
import { TimestampTooltip } from '../../../shared/timestamp_tooltip';

interface Props {
items: CustomLink[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useUiTracker } from '../../../../../../observability/public';
import { ElasticDocsLink } from '../../../shared/Links/ElasticDocsLink';
import { ElasticDocsLink } from '../../../shared/links/elastic_docs_link';

interface Props {
onConfirm: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { EuiButton, EuiSpacer, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import React from 'react';
import { APMLink } from '../../../../shared/Links/apm/APMLink';
import { useFleetCloudAgentPolicyHref } from '../../../../shared/Links/kibana';
import { APMLink } from '../../../../shared/links/apm/apm_link';
import { useFleetCloudAgentPolicyHref } from '../../../../shared/links/kibana';

export function CardFooterContent() {
const fleetCloudAgentPolicyHref = useFleetCloudAgentPolicyHref();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EuiCard, EuiIcon, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import React from 'react';
import { useUpgradeApmPackagePolicyHref } from '../../../../shared/Links/kibana';
import { useUpgradeApmPackagePolicyHref } from '../../../../shared/links/kibana';
import { CardFooterContent } from './card_footer_content';

export function UpgradeAvailableCard({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import React from 'react';
import semverLt from 'semver/functions/lt';
import { SUPPORTED_APM_PACKAGE_VERSION } from '../../../../../common/fleet';
import { PackagePolicy } from '../../../../../../fleet/common/types';
import { ElasticDocsLink } from '../../../shared/Links/ElasticDocsLink';
import { ElasticDocsLink } from '../../../shared/links/elastic_docs_link';
import rocketLaunchGraphic from './blog-rocket-720x420.png';
import { MigrationInProgressPanel } from './migration_in_progress_panel';
import { UpgradeAvailableCard } from './migrated/upgrade_available_card';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import { useLocalStorage } from '../../../hooks/useLocalStorage';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { useTheme } from '../../../hooks/use_theme';

import { ImpactBar } from '../../shared/ImpactBar';
import { push } from '../../shared/Links/url_helpers';
import { ImpactBar } from '../../shared/impact_bar';
import { push } from '../../shared/links/url_helpers';

import { CorrelationsTable } from './correlations_table';
import { FailedTransactionsCorrelationsHelpPopover } from './failed_transactions_correlations_help_popover';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
mockApmPluginContextValue,
MockApmPluginContextWrapper,
} from '../../../context/apm_plugin/mock_apm_plugin_context';
import { fromQuery } from '../../shared/Links/url_helpers';
import { fromQuery } from '../../shared/links/url_helpers';

import { LatencyCorrelations } from './latency_correlations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_
import { FETCH_STATUS } from '../../../hooks/use_fetcher';

import { TransactionDistributionChart } from '../../shared/charts/transaction_distribution_chart';
import { push } from '../../shared/Links/url_helpers';
import { push } from '../../shared/links/url_helpers';

import { CorrelationsTable } from './correlations_table';
import { LatencyCorrelationsHelpPopover } from './latency_correlations_help_popover';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '../../../context/apm_plugin/mock_apm_plugin_context';
import { delay } from '../../../utils/testHelpers';

import { fromQuery } from '../../shared/Links/url_helpers';
import { fromQuery } from '../../shared/links/url_helpers';

import { useFailedTransactionsCorrelations } from './use_failed_transactions_correlations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '../../../context/apm_plugin/mock_apm_plugin_context';
import { delay } from '../../../utils/testHelpers';

import { fromQuery } from '../../shared/Links/url_helpers';
import { fromQuery } from '../../shared/links/url_helpers';

import { useLatencyCorrelations } from './use_latency_correlations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { EuiTitle } from '@elastic/eui';
import React from 'react';
import { Exception } from '../../../../../typings/es_schemas/raw/error_raw';
import { Stacktrace } from '../../../shared/Stacktrace';
import { CauseStacktrace } from '../../../shared/Stacktrace/cause_stacktrace';
import { Stacktrace } from '../../../shared/stacktrace';
import { CauseStacktrace } from '../../../shared/stacktrace/cause_stacktrace';

interface ExceptionStacktraceProps {
codeLanguage?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import { euiStyled } from '../../../../../../../../src/plugins/kibana_react/comm
import type { APIReturnType } from '../../../../services/rest/createCallApmApi';
import type { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import type { ApmUrlParams } from '../../../../context/url_params_context/types';
import { TransactionDetailLink } from '../../../shared/Links/apm/transaction_detail_link';
import { DiscoverErrorLink } from '../../../shared/Links/DiscoverLinks/DiscoverErrorLink';
import { fromQuery, toQuery } from '../../../shared/Links/url_helpers';
import { ErrorMetadata } from '../../../shared/MetadataTable/ErrorMetadata';
import { Stacktrace } from '../../../shared/Stacktrace';
import { Summary } from '../../../shared/Summary';
import { HttpInfoSummaryItem } from '../../../shared/Summary/http_info_summary_item';
import { UserAgentSummaryItem } from '../../../shared/Summary/UserAgentSummaryItem';
import { TimestampTooltip } from '../../../shared/TimestampTooltip';
import { TransactionDetailLink } from '../../../shared/links/apm/transaction_detail_link';
import { DiscoverErrorLink } from '../../../shared/links/discover_links/discover_error_link';
import { fromQuery, toQuery } from '../../../shared/links/url_helpers';
import { ErrorMetadata } from '../../../shared/metadata_table/error_metadata';
import { Stacktrace } from '../../../shared/stacktrace';
import { Summary } from '../../../shared/summary';
import { HttpInfoSummaryItem } from '../../../shared/summary/http_info_summary_item';
import { UserAgentSummaryItem } from '../../../shared/summary/user_agent_summary_item';
import { TimestampTooltip } from '../../../shared/timestamp_tooltip';
import {
ErrorTab,
exceptionStacktraceTab,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n';
import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params';
import { APIReturnType } from '../../../../services/rest/createCallApmApi';
import { truncate, unit } from '../../../../utils/style';
import { ErrorDetailLink } from '../../../shared/Links/apm/ErrorDetailLink';
import { ErrorOverviewLink } from '../../../shared/Links/apm/ErrorOverviewLink';
import { APMQueryParams } from '../../../shared/Links/url_helpers';
import { ErrorDetailLink } from '../../../shared/links/apm/error_detail_link';
import { ErrorOverviewLink } from '../../../shared/links/apm/error_overview_link';
import { APMQueryParams } from '../../../shared/links/url_helpers';
import { ITableColumn, ManagedTable } from '../../../shared/managed_table';
import { TimestampTooltip } from '../../../shared/TimestampTooltip';
import { TimestampTooltip } from '../../../shared/timestamp_tooltip';
import { SparkPlot } from '../../../shared/charts/spark_plot';

const GroupIdLink = euiStyled(ErrorDetailLink)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import React from 'react';
import { useHistory } from 'react-router-dom';
import { useUiSetting$ } from '../../../../../../../../src/plugins/kibana_react/public';
import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params';
import { fromQuery, toQuery } from '../../../shared/Links/url_helpers';
import { fromQuery, toQuery } from '../../../shared/links/url_helpers';
import { ChartWrapper } from '../chart_wrapper';
import { I18LABELS } from '../translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import {
fromQuery,
toQuery,
} from '../../../../components/shared/Links/url_helpers';
} from '../../../../components/shared/links/url_helpers';
import { removeUndefinedProps } from '../../../../context/url_params_context/helpers';
import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params';
import { getExcludedName } from '../local_ui_filters';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useLegacyUrlParams } from '../../../../context/url_params_context/use_u
import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher';
import { I18LABELS } from '../translations';
import { CsmSharedContext } from '../csm_shared_context';
import { ErrorDetailLink } from '../../../shared/Links/apm/ErrorDetailLink';
import { ErrorDetailLink } from '../../../shared/links/apm/error_detail_link';

interface JSErrorItem {
errorMessage: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useCallback } from 'react';
import { useHistory } from 'react-router-dom';
import { FilterValueLabel } from '../../../../../../observability/public';
import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params';
import { fromQuery, toQuery } from '../../../shared/Links/url_helpers';
import { fromQuery, toQuery } from '../../../shared/links/url_helpers';
import { TRANSACTION_URL } from '../../../../../common/elasticsearch_fieldnames';
import { IndexPattern } from '../../../../../../../../src/plugins/data_views/common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import { useUxUrlParams } from '../../../../context/url_params_context/use_ux_url_params';
import { useDateRangeRedirect } from '../../../../hooks/use_date_range_redirect';
import { DatePicker } from '../../../shared/DatePicker';
import { DatePicker } from '../../../shared/date_picker';

export function RumDatePicker() {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RumOverview } from '../rum_dashboard';
import { CsmSharedContextProvider } from './csm_shared_context';
import { WebApplicationSelect } from './panels/web_application_select';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { UxEnvironmentFilter } from '../../shared/EnvironmentFilter';
import { UxEnvironmentFilter } from '../../shared/environment_filter';
import { UserPercentile } from './user_percentile';
import { useBreakpoints } from '../../../hooks/use_breakpoints';
import { KibanaPageTemplateProps } from '../../../../../../../src/plugins/kibana_react/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useCallback } from 'react';
import { useHistory } from 'react-router-dom';
import { omit } from 'lodash';
import { URLSearch } from './url_search';
import { fromQuery, toQuery } from '../../../shared/Links/url_helpers';
import { fromQuery, toQuery } from '../../../shared/links/url_helpers';
import { removeUndefinedProps } from '../../../../context/url_params_context/helpers';

export function URLFilter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import React, { useEffect, useCallback } from 'react';
import { useHistory } from 'react-router-dom';
import { useLegacyUrlParams } from '../../../../../context/url_params_context/use_url_params';
import { fromQuery, toQuery } from '../../../../shared/Links/url_helpers';
import { fromQuery, toQuery } from '../../../../shared/links/url_helpers';

interface Props {
serviceNames: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { useCallback, useEffect } from 'react';
import { EuiSelect } from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params';
import { fromQuery, toQuery } from '../../../shared/Links/url_helpers';
import { fromQuery, toQuery } from '../../../shared/links/url_helpers';
import { I18LABELS } from '../translations';

const DEFAULT_P = 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useLocalStorage } from '../../../hooks/useLocalStorage';
import { useAnyOfApmParams } from '../../../hooks/use_apm_params';
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
import { useTimeRange } from '../../../hooks/use_time_range';
import { useUpgradeAssistantHref } from '../../shared/Links/kibana';
import { useUpgradeAssistantHref } from '../../shared/links/kibana';
import { SearchBar } from '../../shared/search_bar';
import { getTimeRangeComparison } from '../../shared/time_comparison/get_time_range_comparison';
import { ServiceList } from './service_list';
Expand Down
Loading

0 comments on commit 46196f2

Please sign in to comment.