Skip to content

Commit 93b471e

Browse files
Swiddisopensearch-changeset-bot[bot]kavilla
authoredJun 13, 2025··
Implement polling for index state in Vended Dashboard progress (#9862)
Signed-off-by: Simeon Widdis <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: Kawika Avilla <[email protected]>
1 parent 9c35511 commit 93b471e

File tree

10 files changed

+304
-41
lines changed

10 files changed

+304
-41
lines changed
 

‎changelogs/fragments/9862.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
feat:
2+
- Implement polling for index state in Vended Dashboard progress ([#9862](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9862))

‎src/plugins/data_source_management/framework/types.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ export enum DirectQueryLoadingStatus {
1616
INITIAL = 'initial',
1717
}
1818

19+
/**
20+
* States for data-source driven indices, adhering to the OS-Spark state machine. See:
21+
* https://github.com/opensearch-project/opensearch-spark/blob/main/docs/index.md#index-state-transition
22+
*
23+
* Non-exhaustive: There may be more index states in the future. This should usually be typed as
24+
* `ExternalIndexState | string`.
25+
*/
26+
export enum ExternalIndexState {
27+
CREATING = 'creating',
28+
ACTIVE = 'active',
29+
REFRESHING = 'refreshing',
30+
RECOVERING = 'recovering',
31+
CANCELLING = 'cancelling',
32+
}
33+
1934
export interface DirectQueryRequest {
2035
query: string;
2136
lang: string;

‎src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_sync/direct_query_sync_banner.test.tsx

Lines changed: 153 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import { DashboardDirectQuerySyncBanner } from './direct_query_sync_banner';
1111
import { fetchDirectQuerySyncInfo } from './direct_query_sync_utils';
1212
import { useDirectQuery } from '../../../../framework/hooks/direct_query_hook';
1313
import { intervalAsMinutes } from '../../../constants';
14-
import { DirectQueryLoadingStatus } from 'src/plugins/data_source_management/framework/types';
14+
import {
15+
DirectQueryLoadingStatus,
16+
ExternalIndexState,
17+
} from 'src/plugins/data_source_management/framework/types';
18+
import { asSyncProgress } from './sync_progress';
1519

1620
// Mock dependencies
1721
jest.mock('./direct_query_sync_utils', () => ({
@@ -23,6 +27,7 @@ jest.mock('../../../../framework/hooks/direct_query_hook', () => ({
2327
}));
2428

2529
jest.mock('../../../constants', () => ({
30+
...jest.requireActual('../../../constants'),
2631
EMR_STATES: new Map([
2732
['initial', { ord: 100, terminal: true }],
2833
['success', { ord: 100, terminal: true }],
@@ -103,6 +108,7 @@ describe('DashboardDirectQuerySyncBanner', () => {
103108
lastRefreshTime: 1625097600000, // Some past timestamp
104109
mappingName: 'test_datasource.test_database.test_index',
105110
mdsId: 'mds-1',
111+
indexState: 'active',
106112
});
107113

108114
// Mock intervalAsMinutes for interval and last sync time
@@ -187,7 +193,7 @@ describe('DashboardDirectQuerySyncBanner', () => {
187193

188194
await waitFor(() => {
189195
expect(screen.getByTestId('directQuerySyncBar')).toBeInTheDocument();
190-
expect(screen.getByText(/Data sync is in progress \(70% complete\)\./)).toBeInTheDocument();
196+
expect(screen.getByText(/Data sync is in progress \(75% complete\)\./)).toBeInTheDocument();
191197
expect(screen.getByText(/The dashboard will reload on completion\./)).toBeInTheDocument();
192198
expect(screen.getByTestId('directQuerySyncBar')).toHaveTextContent(
193199
'Data sync is in progress'
@@ -332,7 +338,23 @@ describe('DashboardDirectQuerySyncBanner', () => {
332338
expect(screen.getByText('Sync data')).toBeInTheDocument();
333339
});
334340

335-
// Update loadStatus to 'success'
341+
// In order to trigger the refresh, we need to have a job that was previously running. We don't
342+
// refresh if we skip straight to "success".
343+
(useDirectQuery as jest.Mock).mockReturnValue({
344+
loadStatus: DirectQueryLoadingStatus.RUNNING,
345+
startLoading: mockStartLoading,
346+
});
347+
348+
rerender(
349+
<DashboardDirectQuerySyncBanner
350+
http={http}
351+
notifications={notifications}
352+
savedObjectsClient={savedObjectsClient}
353+
dashboardId="dashboard-1"
354+
removeBanner={removeBanner}
355+
/>
356+
);
357+
336358
(useDirectQuery as jest.Mock).mockReturnValue({
337359
loadStatus: DirectQueryLoadingStatus.SUCCESS,
338360
startLoading: mockStartLoading,
@@ -353,3 +375,131 @@ describe('DashboardDirectQuerySyncBanner', () => {
353375
});
354376
});
355377
});
378+
379+
describe('asProgress converter', () => {
380+
it('Prioritizes query status over index state when present', () => {
381+
const cases = [
382+
{
383+
input: {
384+
state: ExternalIndexState.ACTIVE,
385+
status: DirectQueryLoadingStatus.SUBMITTED,
386+
hasLastRefresh: true,
387+
},
388+
expect: { in_progress: true, percentage: 0 },
389+
},
390+
{
391+
input: {
392+
state: ExternalIndexState.CREATING,
393+
status: DirectQueryLoadingStatus.SCHEDULED,
394+
hasLastRefresh: false,
395+
},
396+
expect: { in_progress: true, percentage: 25 },
397+
},
398+
{
399+
input: {
400+
state: ExternalIndexState.REFRESHING,
401+
status: DirectQueryLoadingStatus.WAITING,
402+
hasLastRefresh: true,
403+
},
404+
expect: { in_progress: true, percentage: 50 },
405+
},
406+
{
407+
input: {
408+
state: ExternalIndexState.RECOVERING,
409+
status: DirectQueryLoadingStatus.RUNNING,
410+
hasLastRefresh: false,
411+
},
412+
expect: { in_progress: true, percentage: 75 },
413+
},
414+
];
415+
416+
for (const c of cases) {
417+
const result = asSyncProgress(c.input.state, c.input.status, c.input.hasLastRefresh);
418+
expect(result).toEqual(c.expect);
419+
}
420+
});
421+
422+
it('Handles index states correctly when no query is running', () => {
423+
const cases = [
424+
{
425+
input: {
426+
state: ExternalIndexState.ACTIVE,
427+
status: DirectQueryLoadingStatus.INITIAL,
428+
hasLastRefresh: true,
429+
},
430+
expect: { in_progress: false },
431+
},
432+
{
433+
input: {
434+
state: ExternalIndexState.ACTIVE,
435+
status: DirectQueryLoadingStatus.INITIAL,
436+
hasLastRefresh: false,
437+
},
438+
expect: { in_progress: true, percentage: 30 },
439+
},
440+
{
441+
input: {
442+
state: ExternalIndexState.CREATING,
443+
status: DirectQueryLoadingStatus.INITIAL,
444+
hasLastRefresh: false,
445+
},
446+
expect: { in_progress: true, percentage: 30 },
447+
},
448+
{
449+
input: {
450+
state: ExternalIndexState.REFRESHING,
451+
status: DirectQueryLoadingStatus.INITIAL,
452+
hasLastRefresh: false,
453+
},
454+
expect: { in_progress: true, percentage: 60 },
455+
},
456+
{
457+
input: {
458+
state: ExternalIndexState.RECOVERING,
459+
status: DirectQueryLoadingStatus.INITIAL,
460+
hasLastRefresh: true,
461+
},
462+
expect: { in_progress: true, percentage: 60 },
463+
},
464+
{
465+
input: {
466+
state: ExternalIndexState.CANCELLING,
467+
status: DirectQueryLoadingStatus.INITIAL,
468+
hasLastRefresh: false,
469+
},
470+
expect: { in_progress: true, percentage: 90 },
471+
},
472+
];
473+
474+
for (const c of cases) {
475+
const result = asSyncProgress(c.input.state, c.input.status, c.input.hasLastRefresh);
476+
expect(result).toEqual(c.expect);
477+
}
478+
});
479+
480+
it('Handles edge cases and null states', () => {
481+
const cases = [
482+
{
483+
input: {
484+
state: null,
485+
status: null,
486+
hasLastRefresh: false,
487+
},
488+
expect: { in_progress: false },
489+
},
490+
{
491+
input: {
492+
state: 'invalid_state',
493+
status: null,
494+
hasLastRefresh: true,
495+
},
496+
expect: { in_progress: false },
497+
},
498+
];
499+
500+
for (const c of cases) {
501+
const result = asSyncProgress(c.input.state, c.input.status, c.input.hasLastRefresh);
502+
expect(result).toEqual(c.expect);
503+
}
504+
});
505+
});

‎src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_sync/direct_query_sync_banner.tsx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ import {
1313
} from 'opensearch-dashboards/public';
1414

1515
import { fetchDirectQuerySyncInfo, DirectQuerySyncInfo } from './direct_query_sync_utils';
16-
import { EMR_STATES, intervalAsMinutes } from '../../../constants';
16+
import { intervalAsMinutes } from '../../../constants';
1717
import { useDirectQuery } from '../../../../framework/hooks/direct_query_hook';
1818
import './direct_query_sync_banner.scss';
19+
import { asSyncProgress, SyncProgress } from './sync_progress';
1920

2021
interface DirectQuerySyncProps {
2122
http: HttpStart;
@@ -25,6 +26,8 @@ interface DirectQuerySyncProps {
2526
removeBanner: () => void;
2627
}
2728

29+
const SYNC_INFO_POLLING_INTERVAL_MS = 10000;
30+
2831
export const DashboardDirectQuerySyncBanner: React.FC<DirectQuerySyncProps> = ({
2932
http,
3033
notifications,
@@ -33,8 +36,14 @@ export const DashboardDirectQuerySyncBanner: React.FC<DirectQuerySyncProps> = ({
3336
removeBanner,
3437
}) => {
3538
const [syncInfo, setSyncInfo] = useState<DirectQuerySyncInfo | null>(null);
39+
const [isLoading, setIsLoading] = useState(false);
40+
const [progress, setProgress] = useState<SyncProgress>({ in_progress: false });
3641

37-
const { loadStatus, startLoading } = useDirectQuery(http, notifications, syncInfo?.mdsId);
42+
const { loadStatus: queryStatus, startLoading: startQuerying } = useDirectQuery(
43+
http,
44+
notifications,
45+
syncInfo?.mdsId
46+
);
3847

3948
useEffect(() => {
4049
const loadSyncInfo = async () => {
@@ -53,14 +62,28 @@ export const DashboardDirectQuerySyncBanner: React.FC<DirectQuerySyncProps> = ({
5362
};
5463

5564
loadSyncInfo();
65+
const interval = setInterval(loadSyncInfo, SYNC_INFO_POLLING_INTERVAL_MS);
66+
return () => clearInterval(interval);
5667
}, [dashboardId, http, savedObjectsClient, removeBanner]);
5768

58-
// Refresh the window when loadStatus becomes 'success'
5969
useEffect(() => {
60-
if (loadStatus === 'success') {
70+
if (!syncInfo) {
71+
// Status data isn't loaded, nothing to do yet
72+
return;
73+
}
74+
75+
const nextProgress = asSyncProgress(
76+
syncInfo.indexState,
77+
queryStatus,
78+
Boolean(syncInfo.lastRefreshTime)
79+
);
80+
if (nextProgress.in_progress) {
81+
setIsLoading(true);
82+
} else if (isLoading) {
6183
window.location.reload();
6284
}
63-
}, [loadStatus]);
85+
setProgress(nextProgress);
86+
}, [syncInfo, queryStatus, isLoading]);
6487

6588
// Handle the "Sync Now" action
6689
const handleSynchronize = () => {
@@ -83,18 +106,16 @@ export const DashboardDirectQuerySyncBanner: React.FC<DirectQuerySyncProps> = ({
83106
lang: 'sql' as const,
84107
};
85108

86-
startLoading(requestPayload);
109+
startQuerying(requestPayload);
87110
};
88111

89112
if (!syncInfo) {
90113
return null;
91114
}
92115

93-
const state = EMR_STATES.get(loadStatus)!;
94-
95116
return (
96117
<div className="directQuerySync__banner" data-test-subj="directQuerySyncBar">
97-
{state.terminal ? (
118+
{!progress.in_progress ? (
98119
<EuiText size="s">
99120
{i18n.translate('dataSourcesManagement.directQuerySync.dataScheduledToSync', {
100121
defaultMessage:
@@ -110,7 +131,6 @@ export const DashboardDirectQuerySyncBanner: React.FC<DirectQuerySyncProps> = ({
110131
: '--',
111132
},
112133
})}
113-
114134
<EuiLink className="directQuerySync__link" onClick={handleSynchronize}>
115135
{i18n.translate('dataSourcesManagement.directQuerySync.syncDataLink', {
116136
defaultMessage: 'Sync data',
@@ -120,12 +140,11 @@ export const DashboardDirectQuerySyncBanner: React.FC<DirectQuerySyncProps> = ({
120140
) : (
121141
<EuiCallOut size="s">
122142
<EuiLoadingSpinner size="s" />
123-
124143
{i18n.translate('dataSourcesManagement.directQuerySync.dataSyncInProgress', {
125144
defaultMessage:
126145
'Data sync is in progress ({progress}% complete). The dashboard will reload on completion.',
127146
values: {
128-
progress: state.ord,
147+
progress: progress.percentage,
129148
},
130149
})}
131150
</EuiCallOut>

‎src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_sync/direct_query_sync_utils.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ describe('DirectQuerySyncUtils', () => {
141141
properties: {
142142
refreshInterval: 300,
143143
lastRefreshTime: 1625097600000,
144+
indexState: 'refreshing',
144145
},
145146
},
146147
},
@@ -166,6 +167,7 @@ describe('DirectQuerySyncUtils', () => {
166167
lastRefreshTime: 1625097600000,
167168
mappingName: 'test_datasource.test_database.test_index',
168169
mdsId: 'mds-1',
170+
indexState: 'refreshing',
169171
});
170172
expect(http.get).toHaveBeenCalledTimes(3);
171173
expect(http.get).toHaveBeenCalledWith('/api/opensearch-dashboards/dashboards/export', {
@@ -324,6 +326,7 @@ describe('DirectQuerySyncUtils', () => {
324326
refreshInterval: null,
325327
lastRefreshTime: null,
326328
mappingName: null,
329+
indexState: null,
327330
});
328331
});
329332

@@ -336,6 +339,7 @@ describe('DirectQuerySyncUtils', () => {
336339
properties: {
337340
refreshInterval: 300,
338341
lastRefreshTime: 1625097600000,
342+
indexState: 'active',
339343
},
340344
},
341345
},
@@ -353,6 +357,7 @@ describe('DirectQuerySyncUtils', () => {
353357
refreshInterval: 300,
354358
lastRefreshTime: 1625097600000,
355359
mappingName: 'test_datasource.test_database.test_index',
360+
indexState: 'active',
356361
});
357362
});
358363

@@ -364,6 +369,7 @@ describe('DirectQuerySyncUtils', () => {
364369
properties: {
365370
refreshInterval: 300,
366371
lastRefreshTime: 1625097600000,
372+
indexState: 'active',
367373
},
368374
},
369375
},
@@ -381,6 +387,7 @@ describe('DirectQuerySyncUtils', () => {
381387
refreshInterval: 300,
382388
lastRefreshTime: 1625097600000,
383389
mappingName: null,
390+
indexState: 'active',
384391
});
385392
});
386393
});

‎src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_sync/direct_query_sync_utils.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { HttpStart, SavedObjectsClientContract, SavedObject } from 'opensearch-dashboards/public';
77
import { DSL_MAPPING, DSL_BASE } from '../../../../framework/utils/shared';
8+
import { ExternalIndexState } from '../../../../framework/types';
89

910
export interface ExportDashboardsResponse {
1011
version: string;
@@ -18,6 +19,7 @@ export interface IndexExtractionResult {
1819
}
1920

2021
export interface DirectQuerySyncInfo {
22+
indexState: string | null;
2123
refreshQuery: string;
2224
refreshInterval: number | null;
2325
lastRefreshTime: number | null;
@@ -115,7 +117,7 @@ export async function fetchDirectQuerySyncInfo({
115117
}
116118

117119
// Step 5: Extract index parts, refresh interval, last refresh time, and name
118-
const { parts, refreshInterval, lastRefreshTime, mappingName } = extractIndexInfo(
120+
const { parts, refreshInterval, lastRefreshTime, mappingName, indexState } = extractIndexInfo(
119121
localMapping,
120122
resolvedIndex
121123
);
@@ -127,7 +129,14 @@ export async function fetchDirectQuerySyncInfo({
127129
// Step 6: Generate the refresh query
128130
const refreshQuery = generateRefreshQuery(parts);
129131

130-
return { refreshQuery, refreshInterval, lastRefreshTime, mappingName, mdsId: localMdsId };
132+
return {
133+
indexState,
134+
refreshQuery,
135+
refreshInterval,
136+
lastRefreshTime,
137+
mappingName,
138+
mdsId: localMdsId,
139+
};
131140
} catch (err) {
132141
return null;
133142
}
@@ -179,18 +188,26 @@ export function extractIndexInfo(
179188
refreshInterval: number | null;
180189
lastRefreshTime: number | null;
181190
mappingName: string | null;
191+
indexState: string | ExternalIndexState | null;
182192
} {
183193
const mappingValues = Object.values(mapping)[0] as any;
184194
if (!mappingValues) {
185-
return { parts: null, refreshInterval: null, lastRefreshTime: null, mappingName: null };
195+
return {
196+
parts: null,
197+
refreshInterval: null,
198+
lastRefreshTime: null,
199+
mappingName: null,
200+
indexState: null,
201+
};
186202
}
187203

188204
const mappingName = mappingValues?.mappings?._meta?.name ?? null;
189205
const refreshInterval = mappingValues?.mappings?._meta?.properties?.refreshInterval ?? null;
190206
const lastRefreshTime = mappingValues?.mappings?._meta?.properties?.lastRefreshTime ?? null;
207+
const indexState = mappingValues?.mappings?._meta?.properties?.indexState ?? null;
191208

192209
const parts = extractIndexParts(mappingName, concreteTitle);
193-
return { parts, refreshInterval, lastRefreshTime, mappingName };
210+
return { parts, refreshInterval, lastRefreshTime, mappingName, indexState };
194211
}
195212

196213
export function extractIndexParts(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { DirectQueryLoadingStatus, ExternalIndexState } from '../../../../framework/types';
7+
8+
export type SyncProgress = { in_progress: true; percentage: number } | { in_progress: false };
9+
10+
/**
11+
* Given the current state of an external index, convert it to a `Progress` value. Since the
12+
* "active" state doesn't distinguish between a fresh-activated or older activated index, we also
13+
* need to know if the index has been refreshed before.
14+
*
15+
* @param state An index state, as defined by the Flint State Machine.
16+
* @param queryStatus the Direct Query status for any running queries.
17+
* @param hasLastRefresh Whether the index has been refreshed before.
18+
* @returns A `Progress` value
19+
*/
20+
export const asSyncProgress = (
21+
state: ExternalIndexState | string | null,
22+
queryStatus: DirectQueryLoadingStatus | null,
23+
hasLastRefresh: boolean
24+
): SyncProgress => {
25+
// Query loading status takes precedence if in a processing state, otherwise fallback to state
26+
switch (queryStatus) {
27+
case DirectQueryLoadingStatus.SUBMITTED:
28+
return { in_progress: true, percentage: 0 };
29+
case DirectQueryLoadingStatus.SCHEDULED:
30+
return { in_progress: true, percentage: 25 };
31+
case DirectQueryLoadingStatus.WAITING:
32+
return { in_progress: true, percentage: 50 };
33+
case DirectQueryLoadingStatus.RUNNING:
34+
return { in_progress: true, percentage: 75 };
35+
}
36+
37+
switch (state) {
38+
case ExternalIndexState.ACTIVE:
39+
if (hasLastRefresh) {
40+
return { in_progress: false };
41+
} else {
42+
// This is equivalent to the 'creating' state: the index was activated but the follow-up
43+
// population refresh job hasn't kicked in.
44+
return { in_progress: true, percentage: 30 };
45+
}
46+
case ExternalIndexState.CREATING:
47+
return { in_progress: true, percentage: 30 };
48+
case ExternalIndexState.REFRESHING:
49+
return { in_progress: true, percentage: 60 };
50+
case ExternalIndexState.RECOVERING:
51+
return { in_progress: true, percentage: 60 };
52+
case ExternalIndexState.CANCELLING:
53+
return { in_progress: true, percentage: 90 };
54+
default:
55+
// Null state, or other error states
56+
return { in_progress: false };
57+
}
58+
};

‎src/plugins/data_source_management/public/components/frame_work_test/hooks/drect_query_hook.test.tsx renamed to ‎src/plugins/data_source_management/public/components/frame_work_test/hooks/direct_query_hook.test.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,17 @@ describe('useDirectQuery', () => {
7777
const { result } = renderHook(() => useDirectQuery(httpMock, notificationsMock));
7878

7979
await act(async () => {
80-
await result.current.startLoading({ datasource: 'test_source' });
80+
await result.current.startLoading({
81+
datasource: 'test_source',
82+
query: 'SELECT 1',
83+
lang: 'sql',
84+
});
8185
});
8286

83-
expect(fetchMock).toHaveBeenCalledWith({ datasource: 'test_source' }, undefined);
87+
expect(fetchMock).toHaveBeenCalledWith(
88+
{ datasource: 'test_source', query: 'SELECT 1', lang: 'sql' },
89+
undefined
90+
);
8491
expect(startPollingMock).toHaveBeenCalledWith({ queryId: 'test_query_id' });
8592
});
8693

@@ -91,7 +98,11 @@ describe('useDirectQuery', () => {
9198
const { result } = renderHook(() => useDirectQuery(httpMock, notificationsMock));
9299

93100
await act(async () => {
94-
await result.current.startLoading({ datasource: 'test_source' });
101+
await result.current.startLoading({
102+
datasource: 'test_source',
103+
query: 'SELECT 1',
104+
lang: 'sql',
105+
});
95106
});
96107

97108
expect(result.current.loadStatus).toBe(DirectQueryLoadingStatus.FAILED);

‎src/plugins/data_source_management/public/constants.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import { i18n } from '@osd/i18n';
77
import { DirectQueryDatasourceType } from './types';
8-
import { DirectQueryLoadingStatus } from '../framework/types';
98

109
export const QUERY_RESTRICTED = 'query-restricted';
1110
export const QUERY_ALL = 'query-all';
@@ -32,21 +31,6 @@ export const DATACONNECTIONS_UPDATE_STATUS = '/status';
3231
export const INTEGRATIONS_BASE = '/api/integrations';
3332
export const observabilityMetricsID = 'observability-metrics';
3433

35-
// Module for handling EMR states for Dashboards Progress Bar. All of these except "initial" are
36-
// directly from the EMR job run states. "ord" is used to approximate progress (eyeballed relative
37-
// stage times), and "terminal" indicates whether a job is in progress at all.
38-
export const EMR_STATES = new Map<DirectQueryLoadingStatus, { ord: number; terminal: boolean }>([
39-
[DirectQueryLoadingStatus.SUBMITTED, { ord: 0, terminal: false }],
40-
[DirectQueryLoadingStatus.SCHEDULED, { ord: 30, terminal: false }],
41-
[DirectQueryLoadingStatus.RUNNING, { ord: 70, terminal: false }],
42-
[DirectQueryLoadingStatus.SUCCESS, { ord: 100, terminal: true }],
43-
[DirectQueryLoadingStatus.FAILED, { ord: 100, terminal: true }],
44-
[DirectQueryLoadingStatus.CANCELED, { ord: 100, terminal: true }],
45-
[DirectQueryLoadingStatus.INITIAL, { ord: 100, terminal: true }],
46-
]);
47-
48-
export const MAX_ORD = 100;
49-
5034
export function intervalAsMinutes(interval: number): string {
5135
const minutes = Math.floor(interval / 60000);
5236
return minutes === 1

‎ts_error_baseline.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5454,21 +5454,21 @@
54545454
"message": "Type '{ name: string; dataType: string; }' is not assignable to type 'CachedColumn'."
54555455
},
54565456
{
5457-
"file": "src/plugins/data_source_management/public/components/frame_work_test/hooks/drect_query_hook.test.tsx",
5457+
"file": "src/plugins/data_source_management/public/components/frame_work_test/hooks/direct_query_hook.test.tsx",
54585458
"line": 31,
54595459
"column": 7,
54605460
"code": "TS6133",
54615461
"message": "'usePollingMock' is declared but its value is never read."
54625462
},
54635463
{
5464-
"file": "src/plugins/data_source_management/public/components/frame_work_test/hooks/drect_query_hook.test.tsx",
5464+
"file": "src/plugins/data_source_management/public/components/frame_work_test/hooks/direct_query_hook.test.tsx",
54655465
"line": 80,
54665466
"column": 41,
54675467
"code": "TS2345",
54685468
"message": "Argument of type '{ datasource: string; }' is not assignable to parameter of type 'DirectQueryRequest'."
54695469
},
54705470
{
5471-
"file": "src/plugins/data_source_management/public/components/frame_work_test/hooks/drect_query_hook.test.tsx",
5471+
"file": "src/plugins/data_source_management/public/components/frame_work_test/hooks/direct_query_hook.test.tsx",
54725472
"line": 94,
54735473
"column": 41,
54745474
"code": "TS2345",

0 commit comments

Comments
 (0)
Please sign in to comment.