diff --git a/dashboards-observability/common/constants/application_analytics.ts b/dashboards-observability/common/constants/application_analytics.ts index 12fdb6b36..ed56a64a9 100644 --- a/dashboards-observability/common/constants/application_analytics.ts +++ b/dashboards-observability/common/constants/application_analytics.ts @@ -15,22 +15,3 @@ export const TAB_LOG_TITLE = 'Log Events'; export const TAB_CONFIG_TITLE = 'Configuration'; export const APP_ANALYTICS_API_PREFIX = '/api/observability/application' - -export interface optionType { - label: string; -} - -export type ApplicationListType = { - name: string; - id: string; - dateCreated: string; - dateModified: string; -}; - -export type ApplicationType = { - name: string; - description: string; - query: string; - selectedServices: Array; - selectedTraces: Array; -} diff --git a/dashboards-observability/common/types/app_analytics.ts b/dashboards-observability/common/types/app_analytics.ts new file mode 100644 index 000000000..9e18aa766 --- /dev/null +++ b/dashboards-observability/common/types/app_analytics.ts @@ -0,0 +1,23 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export interface optionType { + label: string; +} + +export type ApplicationListType = { + name: string; + id: string; + dateCreated: string; + dateModified: string; +}; + +export type ApplicationType = { + name: string; + description: string; + query: string; + selectedServices: Array; + selectedTraces: Array; +} diff --git a/dashboards-observability/public/components/application_analytics/components/app_table.tsx b/dashboards-observability/public/components/application_analytics/components/app_table.tsx index 0308634bf..bc6452828 100644 --- a/dashboards-observability/public/components/application_analytics/components/app_table.tsx +++ b/dashboards-observability/public/components/application_analytics/components/app_table.tsx @@ -32,7 +32,7 @@ import { AppAnalyticsComponentDeps } from '../home'; import { getCustomModal } from '../../custom_panels/helpers/modal_containers'; import { getClearModal } from '../helpers/modal_containers'; import { pageStyles } from '../../../../common/constants/shared'; -import { ApplicationListType } from '../../../../common/constants/application_analytics'; +import { ApplicationListType } from '../../../../common/types/app_analytics'; interface AppTableProps extends AppAnalyticsComponentDeps { loading: boolean; diff --git a/dashboards-observability/public/components/application_analytics/components/config_components/service_config.tsx b/dashboards-observability/public/components/application_analytics/components/config_components/service_config.tsx index bdb6d380c..aa1e9a920 100644 --- a/dashboards-observability/public/components/application_analytics/components/config_components/service_config.tsx +++ b/dashboards-observability/public/components/application_analytics/components/config_components/service_config.tsx @@ -12,7 +12,7 @@ import DSLService from "public/services/requests/dsl"; import React, { useState } from "react"; import { useEffect } from "react"; import { AppAnalyticsComponentDeps } from "../../home"; -import { optionType } from "../../../../../common/constants/application_analytics"; +import { optionType } from "../../../../../common/types/app_analytics"; import { getClearModal } from "../../helpers/modal_containers"; interface ServiceConfigProps extends AppAnalyticsComponentDeps { diff --git a/dashboards-observability/public/components/application_analytics/components/config_components/trace_config.tsx b/dashboards-observability/public/components/application_analytics/components/config_components/trace_config.tsx index a31728000..7ef19c8ac 100644 --- a/dashboards-observability/public/components/application_analytics/components/config_components/trace_config.tsx +++ b/dashboards-observability/public/components/application_analytics/components/config_components/trace_config.tsx @@ -5,7 +5,7 @@ import dateMath from '@elastic/datemath'; import { EuiAccordion, EuiBadge, EuiButton, EuiComboBox, EuiFormRow, EuiOverlayMask, EuiSpacer, EuiText } from "@elastic/eui"; -import { optionType } from "../../../../../common/constants/application_analytics"; +import { optionType } from "../../../../../common/types/app_analytics"; import { filtersToDsl } from "../../../trace_analytics/components/common/helper_functions"; import { handleDashboardRequest } from "../../../trace_analytics/requests/dashboard_request_handler"; import DSLService from "public/services/requests/dsl"; diff --git a/dashboards-observability/public/components/application_analytics/components/create.tsx b/dashboards-observability/public/components/application_analytics/components/create.tsx index 5069b7538..17f21e7cd 100644 --- a/dashboards-observability/public/components/application_analytics/components/create.tsx +++ b/dashboards-observability/public/components/application_analytics/components/create.tsx @@ -30,7 +30,7 @@ import { TraceConfig } from './config_components/trace_config'; import { ServiceConfig } from "./config_components/service_config"; import { LogConfig } from "./config_components/log_config"; import { PPLReferenceFlyout } from "../../../components/common/helpers"; -import { optionType } from "../../../../common/constants/application_analytics"; +import { optionType } from "../../../../common/types/app_analytics"; interface CreateAppProps extends AppAnalyticsComponentDeps { dslService: DSLService; diff --git a/dashboards-observability/public/components/application_analytics/components/helpers/modal_containers.tsx b/dashboards-observability/public/components/application_analytics/components/helpers/modal_containers.tsx deleted file mode 100644 index c9d54f9c2..000000000 --- a/dashboards-observability/public/components/application_analytics/components/helpers/modal_containers.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import { - EuiOverlayMask, - EuiConfirmModal, -} from '@elastic/eui'; - -/* The file contains helper functions for modal layouts - * getDeleteModal - returns a confirm-modal with clear option - */ - -export const getClearModal = ( - onCancel: ( - event?: React.KeyboardEvent | React.MouseEvent - ) => void, - onConfirm: (event?: React.MouseEvent) => void, - title: string, - message: string, - confirmMessage?: string -) => { - return ( - - - {message} - - - ); -}; \ No newline at end of file diff --git a/dashboards-observability/public/components/application_analytics/home.tsx b/dashboards-observability/public/components/application_analytics/home.tsx index bd567c313..5f847406f 100644 --- a/dashboards-observability/public/components/application_analytics/home.tsx +++ b/dashboards-observability/public/components/application_analytics/home.tsx @@ -17,7 +17,8 @@ import TimestampUtils from 'public/services/timestamp/timestamp'; import { handleIndicesExistRequest } from '../trace_analytics/requests/request_handler'; import { ObservabilitySideBar } from '../common/side_nav'; import { NotificationsStart } from '../../../../../src/core/public'; -import { optionType, APP_ANALYTICS_API_PREFIX, ApplicationListType } from '../../../common/constants/application_analytics'; +import { APP_ANALYTICS_API_PREFIX } from '../../../common/constants/application_analytics'; +import { optionType, ApplicationListType } from '../../../common/types/app_analytics'; import { isNameValid } from './helpers/utils'; import { EuiGlobalToastList } from '@elastic/eui'; import { Toast } from '@elastic/eui/src/components/toast/global_toast_list'; diff --git a/dashboards-observability/server/adaptors/application_analytics/app_analytics_adaptor.ts b/dashboards-observability/server/adaptors/application_analytics/app_analytics_adaptor.ts index 5c37ed0ac..8adaa6370 100644 --- a/dashboards-observability/server/adaptors/application_analytics/app_analytics_adaptor.ts +++ b/dashboards-observability/server/adaptors/application_analytics/app_analytics_adaptor.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ApplicationType } from "common/constants/application_analytics"; +import { ApplicationType } from "../../../common/types/app_analytics"; import { ILegacyScopedClusterClient } from "../../../../../src/core/server"; export class AppAnalyticsAdaptor { diff --git a/dashboards-observability/server/adaptors/application_analytics/application_adaptor.ts b/dashboards-observability/server/adaptors/application_analytics/application_adaptor.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboards-observability/server/routes/application_analytics/app_analytics_router.ts b/dashboards-observability/server/routes/application_analytics/app_analytics_router.ts index abe23aa76..18a0523a3 100644 --- a/dashboards-observability/server/routes/application_analytics/app_analytics_router.ts +++ b/dashboards-observability/server/routes/application_analytics/app_analytics_router.ts @@ -10,7 +10,8 @@ import { ResponseError, ILegacyScopedClusterClient, } from '../../../../../src/core/server'; -import { APP_ANALYTICS_API_PREFIX as API_PREFIX, ApplicationListType } from '../../../common/constants/application_analytics'; +import { APP_ANALYTICS_API_PREFIX as API_PREFIX } from '../../../common/constants/application_analytics'; +import { ApplicationListType } from '../../../common/types/app_analytics'; import { AppAnalyticsAdaptor } from '../../../server/adaptors/application_analytics/app_analytics_adaptor'; export function registerAppAnalyticsRouter(router: IRouter) {