Skip to content

Commit

Permalink
Updating UI for create acceleration flyout (opensearch-project#1532)
Browse files Browse the repository at this point in the history
* add create accelerations folder

Signed-off-by: Shenoy Pratik <[email protected]>

* add index.tsx for create acceleration

Signed-off-by: Shenoy Pratik <[email protected]>

* update acc datasource options

Signed-off-by: Shenoy Pratik <[email protected]>

* add support for load columns

Signed-off-by: Shenoy Pratik <[email protected]>

* add window.start in mv and support for bool filter

Signed-off-by: Shenoy Pratik <[email protected]>

* update jest tests

Signed-off-by: Shenoy Pratik <[email protected]>

* remove console.logs

Signed-off-by: Shenoy Pratik <[email protected]>

* fix refresh type and load table fields

Signed-off-by: Shenoy Pratik <[email protected]>

* fix conflicts

Signed-off-by: Shenoy Pratik <[email protected]>

* update comments and add create acceleration button

Signed-off-by: Shenoy Pratik <[email protected]>

* update snapshot for source_selector

Signed-off-by: Shenoy Pratik <[email protected]>

* add jest tests for new files

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 authored Mar 15, 2024
1 parent 01bec05 commit 220e347
Show file tree
Hide file tree
Showing 76 changed files with 5,569 additions and 3,943 deletions.
5 changes: 5 additions & 0 deletions common/constants/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const ACCELERATION_TIME_INTERVAL = [
export const ACCELERATION_ADD_FIELDS_TEXT = '(add fields here)';
export const ACCELERATION_INDEX_NAME_REGEX = /^[a-z][a-z_]*$/;
export const ACCELERATION_S3_URL_REGEX = /^(s3|s3a):\/\/[a-zA-Z0-9.\-]+/;
export const TIMESTAMP_DATATYPE = 'timestamp';

export const ACCELERATION_INDEX_TYPES = [
{ label: 'Skipping Index', value: 'skipping' },
Expand Down Expand Up @@ -65,12 +66,16 @@ export const SKIPPING_INDEX_ACCELERATION_METHODS = [
{ value: 'PARTITION', text: 'Partition' },
{ value: 'VALUE_SET', text: 'Value Set' },
{ value: 'MIN_MAX', text: 'Min Max' },
{ value: 'BLOOM_FILTER', text: 'Bloom Filter' },
];

export const ACCELERATION_AGGREGRATION_FUNCTIONS = [
{ label: 'window.start' },
{ label: 'count' },
{ label: 'sum' },
{ label: 'avg' },
{ label: 'max' },
{ label: 'min' },
];

export const SPARK_PARTITION_INFO = `# Partition Information`;
31 changes: 6 additions & 25 deletions common/types/data_connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export type PollingCallback = (statusObj: AsyncApiResponse) => void;

export type AccelerationIndexType = 'skipping' | 'covering' | 'materialized';

export type LoadCacheType = 'databases' | 'tables' | 'accelerations';
export type LoadCacheType = 'databases' | 'tables' | 'accelerations' | 'tableColumns';

export enum CachedDataSourceStatus {
Updated = 'Updated',
Expand All @@ -77,7 +77,7 @@ export enum CachedDataSourceStatus {
}

export interface CachedColumn {
name: string;
fieldName: string;
dataType: string;
}

Expand Down Expand Up @@ -134,35 +134,16 @@ export interface PollingSuccessResult {

export type AsyncPollingResult = PollingSuccessResult | null;

export interface CreateAccelerationForm {
dataSource: string;
database: string;
dataTable: string;
dataTableFields: DataTableFieldsType[];
accelerationIndexType: AccelerationIndexType;
skippingIndexQueryData: SkippingIndexRowType[];
coveringIndexQueryData: string[];
materializedViewQueryData: MaterializedViewQueryType;
accelerationIndexName: string;
primaryShardsCount: number;
replicaShardsCount: number;
refreshType: AccelerationRefreshType;
checkpointLocation: string | undefined;
watermarkDelay: WatermarkDelayType;
refreshIntervalOptions: RefreshIntervalType;
formErrors: FormErrorsType;
}

export type AggregationFunctionType = 'count' | 'sum' | 'avg' | 'max' | 'min';
export type AggregationFunctionType = 'count' | 'sum' | 'avg' | 'max' | 'min' | 'window.start';

export interface MaterializedViewColumn {
id: string;
functionName: AggregationFunctionType;
functionParam: string;
functionParam?: string;
fieldAlias?: string;
}

export type SkippingIndexAccMethodType = 'PARTITION' | 'VALUE_SET' | 'MIN_MAX';
export type SkippingIndexAccMethodType = 'PARTITION' | 'VALUE_SET' | 'MIN_MAX' | 'BLOOM_FILTER';

export interface SkippingIndexRowType {
id: string;
Expand Down Expand Up @@ -213,7 +194,7 @@ export interface FormErrorsType {
watermarkDelayError: string[];
}

export type AccelerationRefreshType = 'auto' | 'interval' | 'manual';
export type AccelerationRefreshType = 'auto' | 'autoInterval' | 'manual' | 'manualIncrement';

export interface CreateAccelerationForm {
dataSource: string;
Expand Down
37 changes: 19 additions & 18 deletions common/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { QueryManager } from 'common/query_manager';
import { History } from 'history';
import Plotly from 'plotly.js-dist';
import { QueryManager } from 'common/query_manager';
import {
CoreSetup,
CoreStart,
HttpSetup,
HttpStart,
NotificationsStart,
} from '../../../../src/core/public';
import { ChromeBreadcrumb } from '../../../../src/core/public/chrome';
import {
SavedObjectAttributes,
SavedObjectsStart,
} from '../../../../src/core/public/saved_objects';
import { DataSourceType } from '../../../../src/plugins/data/public';
import { OTEL_METRIC_SUBTYPE, VIS_CHART_TYPES } from '../../common/constants/shared';
import DSLService from '../../public/services/requests/dsl';
import PPLService from '../../public/services/requests/ppl';
import SavedObjects from '../../public/services/saved_objects/event_analytics/saved_objects';
import TimestampUtils from '../../public/services/timestamp/timestamp';
import {
AGGREGATIONS,
AVAILABLE_FIELDS,
Expand All @@ -22,23 +39,6 @@ import {
SELECTED_TIMESTAMP,
UNSELECTED_FIELDS,
} from '../constants/explorer';
import {
CoreSetup,
CoreStart,
HttpSetup,
HttpStart,
NotificationsStart,
} from '../../../../src/core/public';
import SavedObjects from '../../public/services/saved_objects/event_analytics/saved_objects';
import TimestampUtils from '../../public/services/timestamp/timestamp';
import PPLService from '../../public/services/requests/ppl';
import DSLService from '../../public/services/requests/dsl';
import {
SavedObjectAttributes,
SavedObjectsStart,
} from '../../../../src/core/public/saved_objects';
import { ChromeBreadcrumb } from '../../../../src/core/public/chrome';
import { DataSourceType } from '../../../../src/plugins/data/public';
import { PROMQL_METRIC_SUBTYPE } from '../constants/shared';

export interface IQueryTab {
Expand Down Expand Up @@ -429,6 +429,7 @@ export enum DirectQueryLoadingStatus {
RUNNING = 'running',
SCHEDULED = 'scheduled',
CANCELED = 'canceled',
WAITING = 'waiting',
}

export interface DirectQueryRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@
*/

import {
EuiBasicTableColumn,
EuiButton,
EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
EuiPanel,
EuiText,
EuiHorizontalRule,
EuiButton,
EuiSpacer,
EuiLink,
EuiInMemoryTable,
EuiBasicTableColumn,
EuiLink,
EuiLoadingSpinner,
EuiEmptyPrompt,
EuiPanel,
EuiSpacer,
EuiText,
} from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import {
getRefreshButtonIcon,
onRefreshButtonClick,
onDiscoverButtonClick,
onDeleteButtonClick,
AccelerationStatus,
ACC_LOADING_MSG,
ACC_PANEL_TITLE,
ACC_PANEL_DESC,
} from './utils/acceleration_utils';
import { getRenderAccelerationDetailsFlyout } from '../../../../../plugin';
import { CatalogCacheManager } from '../../../../../framework/catalog_cache/cache_manager';
import {
CachedAccelerations,
CachedDataSourceStatus,
} from '../../../../../../common/types/data_connections';
import { useLoadAccelerationsToCache } from '../../../../../framework/catalog_cache/cache_loader';
import { DirectQueryLoadingStatus } from '../../../../../../common/types/explorer';
import { useLoadAccelerationsToCache } from '../../../../../framework/catalog_cache/cache_loader';
import { CatalogCacheManager } from '../../../../../framework/catalog_cache/cache_manager';
import { getRenderAccelerationDetailsFlyout } from '../../../../../plugin';
import {
ACC_LOADING_MSG,
ACC_PANEL_DESC,
ACC_PANEL_TITLE,
AccelerationStatus,
getRefreshButtonIcon,
onDeleteButtonClick,
onDiscoverButtonClick,
onRefreshButtonClick,
} from './utils/acceleration_utils';

interface AccelerationTableProps {
dataSourceName: string;
Expand Down

This file was deleted.

Loading

0 comments on commit 220e347

Please sign in to comment.