Skip to content

Commit

Permalink
rebasing with main, updating types, and fixing refresh accelerations
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Li <[email protected]>
  • Loading branch information
sejli committed Mar 18, 2024
1 parent fa5d8db commit 1edf702
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,7 @@ export const AccelerationTable = ({
<EuiLink
onClick={() => {
console.log(displayName);
renderAccelerationDetailsFlyout({
index: displayName,
acceleration,
dataSourceName,
});
renderAccelerationDetailsFlyout(displayName, acceleration, dataSourceName);

Check warning on line 213 in public/components/datasources/components/manage/accelerations/acceleration_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/accelerations/acceleration_table.tsx#L213

Added line #L213 was not covered by tests
}}
>
{displayName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface AccelerationSchemaTabProps {
}

export const AccelerationSchemaTab = ({ mappings, indexInfo }: AccelerationSchemaTabProps) => {
console.log('mappings', mappings);
console.log('indexInfo', indexInfo);
const indexName = indexInfo.data[0]?.index;
const indexData = mappings.data[indexName]?.mappings._meta?.indexedColumns;
const indexType = mappings.data[indexName]?.mappings._meta?.kind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
const onRefreshButtonClick = () => {
if (!isCatalogCacheFetching(databasesLoadStatus, tablesLoadStatus, accelerationsLoadStatus)) {
startLoadingDatabases(datasource.name);
startLoadingAccelerations(datasource.name);

Check warning on line 95 in public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_tab.tsx#L95

Added line #L95 was not covered by tests
setIsRefreshing(true);
}
};
Expand Down Expand Up @@ -321,7 +322,7 @@ export const AssociatedObjectsTab: React.FC<AssociatedObjectsTabProps> = (props)
</EuiSelectable>
</EuiFlexItem>
<EuiFlexItem>
{isObjectsLoading && !isRefreshing ? (
{isObjectsLoading && isFirstTimeLoading ? (
<AssociatedObjectsTabLoading objectType="tables" warningMessage={true} />
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,15 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => {
<EuiLink
onClick={() => {
if (item.type === 'table') {
renderAssociatedObjectsDetailsFlyout({
tableDetail: item,
datasourceName,
});
renderAssociatedObjectsDetailsFlyout(item, datasourceName);

Check warning on line 73 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L73

Added line #L73 was not covered by tests
} else {
const acceleration = cachedAccelerations.find((acc) => acc.indexName === item.id);

Check warning on line 75 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L75

Added line #L75 was not covered by tests
console.log(acceleration);
if (acceleration) {
renderAccelerationDetailsFlyout({
index: getAccelerationName(acceleration, datasourceName),
renderAccelerationDetailsFlyout(

Check warning on line 77 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L77

Added line #L77 was not covered by tests
getAccelerationName(acceleration, datasourceName),
acceleration,
dataSourceName: datasourceName,
});
datasourceName
);
}
}
}}
Expand Down Expand Up @@ -124,11 +120,7 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => {
return (

Check warning on line 120 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L119-L120

Added lines #L119 - L120 were not covered by tests
<EuiLink
onClick={() => {
renderAccelerationDetailsFlyout({
index: name,
acceleration: accelerations[0],
dataSourceName: datasourceName,
});
renderAccelerationDetailsFlyout(name, accelerations[0], datasourceName);

Check warning on line 123 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L122-L123

Added lines #L122 - L123 were not covered by tests
}}
>
{name}
Expand All @@ -138,10 +130,7 @@ export const AssociatedObjectsTable = (props: AssociatedObjectsTableProps) => {
return (

Check warning on line 130 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L130

Added line #L130 was not covered by tests
<EuiButtonEmpty
onClick={() => {
renderAssociatedObjectsDetailsFlyout({
tableDetail: obj,
datasourceName,
});
renderAssociatedObjectsDetailsFlyout(obj, datasourceName);

Check warning on line 133 in public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/modules/associated_objects_table.tsx#L132-L133

Added lines #L132 - L133 were not covered by tests
}}
size="xs"
>
Expand Down
41 changes: 13 additions & 28 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
observabilityTracesTitle,
} from '../common/constants/shared';
import { QueryManager } from '../common/query_manager';
import { CachedAcceleration } from '../common/types/data_connections';
import { AssociatedObject, CachedAcceleration } from '../common/types/data_connections';
import { VISUALIZATION_SAVED_OBJECT } from '../common/types/observability_saved_object_attributes';
import {
setOSDHttp,
Expand All @@ -60,10 +60,7 @@ import { DirectSearch } from './components/common/search/direct_search';
import { Search } from './components/common/search/search';
import { AccelerationDetailsFlyout } from './components/datasources/components/manage/accelerations/acceleration_details_flyout';
import { CreateAcceleration } from './components/datasources/components/manage/accelerations/create_accelerations_flyout';
import {
AssociatedObjectsDetailsFlyout,
AssociatedObjectsFlyoutProps,
} from './components/datasources/components/manage/associated_objects/associated_objects_details_flyout';
import { AssociatedObjectsDetailsFlyout } from './components/datasources/components/manage/associated_objects/associated_objects_details_flyout';
import { convertLegacyNotebooksUrl } from './components/notebooks/components/helpers/legacy_route_helpers';
import { convertLegacyTraceAnalyticsUrl } from './components/trace_analytics/components/common/legacy_route_helpers';
import { registerAsssitantDependencies } from './dependencies/register_assistant';
Expand Down Expand Up @@ -104,21 +101,13 @@ export const [
getRenderAccelerationDetailsFlyout,
setRenderAccelerationDetailsFlyout,
] = createGetterSetter<
({
index,
acceleration,
dataSourceName,
}: {
index: string;
acceleration: CachedAcceleration;
dataSourceName: string;
}) => void
(index: string, acceleration: CachedAcceleration, dataSourceName: string) => void
>('renderAccelerationDetailsFlyout');

export const [
getRenderAssociatedObjectsDetailsFlyout,
setRenderAssociatedObjectsDetailsFlyout,
] = createGetterSetter<({ tableDetail, datasourceName }: AssociatedObjectsFlyoutProps) => void>(
] = createGetterSetter<(tableDetail: AssociatedObject, datasourceName: string) => void>(
'renderAssociatedObjectsDetailsFlyout'
);

Expand Down Expand Up @@ -404,15 +393,11 @@ export class ObservabilityPlugin
});

// Use overlay service to render flyouts
const renderAccelerationDetailsFlyout = ({
index,
acceleration,
dataSourceName,
}: {
index: string;
acceleration: CachedAcceleration;
dataSourceName: string;
}) => {
const renderAccelerationDetailsFlyout = (
index: string,
acceleration: CachedAcceleration,
dataSourceName: string
) => {
const accelerationDetailsFlyout = core.overlays.openFlyout(
toMountPoint(
<AccelerationDetailsFlyout
Expand All @@ -426,10 +411,10 @@ export class ObservabilityPlugin
};
setRenderAccelerationDetailsFlyout(renderAccelerationDetailsFlyout);

const renderAssociatedObjectsDetailsFlyout = ({
tableDetail,
datasourceName,
}: AssociatedObjectsFlyoutProps) => {
const renderAssociatedObjectsDetailsFlyout = (
tableDetail: AssociatedObject,
datasourceName: string
) => {
const associatedObjectsDetailsFlyout = core.overlays.openFlyout(
toMountPoint(
<AssociatedObjectsDetailsFlyout
Expand Down
17 changes: 10 additions & 7 deletions public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ManagementOverViewPluginSetup } from '../../../src/plugins/management_o
import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
import { UiActionsStart } from '../../../src/plugins/ui_actions/public';
import { VisualizationsSetup } from '../../../src/plugins/visualizations/public';
import { AssociatedObject } from '../common/types/data_connections';
import { AssociatedObject, CachedAcceleration } from '../common/types/data_connections';
import { AssistantSetup } from './types';

export interface AppPluginStartDependencies {
Expand All @@ -35,12 +35,15 @@ export interface SetupDependencies {
export interface ObservabilitySetup {}

export interface ObservabilityStart {
renderAccelerationDetailsFlyout: (acceleration: any) => void;
renderAssociatedObjectsDetailsFlyout: ({
tableDetail,
}: {
tableDetail: AssociatedObject;
}) => void;
renderAccelerationDetailsFlyout: (
index: string,
acceleration: CachedAcceleration,
datasourceName: string
) => void;
renderAssociatedObjectsDetailsFlyout: (
tableDetail: AssociatedObject,
datasourceName: string
) => void;
renderCreateAccelerationFlyout: (selectedDatasource: string) => void;
}

Expand Down

0 comments on commit 1edf702

Please sign in to comment.