Skip to content

Commit c6bd9a6

Browse files
committed
Revert the code format
Signed-off-by: gaobinlong <gbinlong@amazon.com>
1 parent b3b0ded commit c6bd9a6

File tree

4 files changed

+70
-70
lines changed

4 files changed

+70
-70
lines changed

public/redux/reducers/__tests__/opensearch.test.ts

+25-25
Original file line numberDiff line numberDiff line change
@@ -290,28 +290,28 @@ describe('opensearch reducer actions', () => {
290290
{ alias: 'alias1', index: 'index1' },
291291
{ alias: 'alias2', index: 'index2' },
292292
];
293-
293+
294294
httpMockedClient.get = jest
295295
.fn()
296296
.mockResolvedValue({ ok: true, response: { indices, aliases } });
297-
297+
298298
await store.dispatch(getIndicesAndAliases());
299299
const actions = store.getActions();
300-
300+
301301
expect(actions[0].type).toBe('opensearch/GET_INDICES_AND_ALIASES_REQUEST');
302302
expect(reducer(initialState, actions[0])).toEqual({
303303
...initialState,
304304
requesting: true,
305305
});
306-
306+
307307
expect(actions[1].type).toBe('opensearch/GET_INDICES_AND_ALIASES_SUCCESS');
308308
expect(reducer(initialState, actions[1])).toEqual({
309309
...initialState,
310310
requesting: false,
311311
indices,
312312
aliases,
313313
});
314-
314+
315315
expect(httpMockedClient.get).toHaveBeenCalledWith(
316316
`..${BASE_NODE_API_PATH}/_indices_and_aliases`,
317317
{
@@ -328,28 +328,28 @@ describe('opensearch reducer actions', () => {
328328
{ alias: 'alias1', index: 'index1' },
329329
{ alias: 'alias2', index: 'index2' },
330330
];
331-
331+
332332
httpMockedClient.get = jest
333333
.fn()
334334
.mockResolvedValue({ ok: true, response: { indices, aliases } });
335-
335+
336336
await store.dispatch(getIndicesAndAliases('', '', 'cluster-2,cluster-3'));
337337
const actions = store.getActions();
338-
338+
339339
expect(actions[0].type).toBe('opensearch/GET_INDICES_AND_ALIASES_REQUEST');
340340
expect(reducer(initialState, actions[0])).toEqual({
341341
...initialState,
342342
requesting: true,
343343
});
344-
344+
345345
expect(actions[1].type).toBe('opensearch/GET_INDICES_AND_ALIASES_SUCCESS');
346346
expect(reducer(initialState, actions[1])).toEqual({
347347
...initialState,
348348
requesting: false,
349349
indices,
350350
aliases,
351351
});
352-
352+
353353
expect(httpMockedClient.get).toHaveBeenCalledWith(
354354
`..${BASE_NODE_API_PATH}/_indices_and_aliases`,
355355
{
@@ -366,26 +366,26 @@ describe('opensearch reducer actions', () => {
366366
ok: false,
367367
error: 'Something went wrong',
368368
});
369-
369+
370370
try {
371371
await store.dispatch(getIndicesAndAliases());
372372
} catch (e) {
373373
const actions = store.getActions();
374-
374+
375375
expect(actions[0].type).toBe('opensearch/GET_INDICES_AND_ALIASES_REQUEST');
376376
expect(reducer(initialState, actions[0])).toEqual({
377377
...initialState,
378378
requesting: true,
379379
errorMessage: '',
380380
});
381-
381+
382382
expect(actions[1].type).toBe('opensearch/GET_INDICES_AND_ALIASES_FAILURE');
383383
expect(reducer(initialState, actions[1])).toEqual({
384384
...initialState,
385385
requesting: false,
386386
errorMessage: 'Something went wrong',
387387
});
388-
388+
389389
expect(httpMockedClient.get).toHaveBeenCalledWith(
390390
`..${BASE_NODE_API_PATH}/_indices_and_aliases`,
391391
{
@@ -405,65 +405,65 @@ describe('opensearch reducer actions', () => {
405405
{ cluster: 'cluster1', status: 'green' },
406406
{ cluster: 'cluster2', status: 'yellow' },
407407
];
408-
408+
409409
httpMockedClient.get = jest
410410
.fn()
411411
.mockResolvedValue({ ok: true, response: { clusters } });
412-
412+
413413
await store.dispatch(getClustersInfo());
414414
const actions = store.getActions();
415-
415+
416416
expect(actions[0].type).toBe('opensearch/GET_CLUSTERS_INFO_REQUEST');
417417
expect(reducer(initialState, actions[0])).toEqual({
418418
...initialState,
419419
requesting: true,
420420
errorMessage: '',
421421
});
422-
422+
423423
expect(actions[1].type).toBe('opensearch/GET_CLUSTERS_INFO_SUCCESS');
424424
expect(reducer(initialState, actions[1])).toEqual({
425425
...initialState,
426426
requesting: false,
427427
clusters,
428428
});
429-
429+
430430
expect(httpMockedClient.get).toHaveBeenCalledWith(
431431
`..${BASE_NODE_API_PATH}/_remote/info`
432432
);
433433
});
434434
test('should invoke [REQUEST, FAILURE]', async () => {
435435
const errorMessage = 'Something went wrong';
436-
436+
437437
httpMockedClient.get = jest.fn().mockRejectedValue({
438438
ok: false,
439439
error: errorMessage,
440440
});
441-
441+
442442
try {
443443
await store.dispatch(getClustersInfo());
444444
} catch (e) {
445445
const actions = store.getActions();
446-
446+
447447
expect(actions[0].type).toBe('opensearch/GET_CLUSTERS_INFO_REQUEST');
448448
expect(reducer(initialState, actions[0])).toEqual({
449449
...initialState,
450450
requesting: true,
451451
errorMessage: '',
452452
});
453-
453+
454454
expect(actions[1].type).toBe('opensearch/GET_CLUSTERS_INFO_FAILURE');
455455
expect(reducer(initialState, actions[1])).toEqual({
456456
...initialState,
457457
requesting: false,
458458
errorMessage,
459459
});
460-
460+
461461
expect(httpMockedClient.get).toHaveBeenCalledWith(
462462
`..${BASE_NODE_API_PATH}/_remote/info`
463463
);
464464
}
465465
});
466466
});
467467

468-
describe('getPrioritizedIndices', () => { });
468+
describe('getPrioritizedIndices', () => {});
469469
});

public/redux/reducers/opensearch.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -424,33 +424,33 @@ export const getPrioritizedIndices =
424424
dataSourceId: string = '',
425425
clusters: string = '*'
426426
): ThunkAction =>
427-
async (dispatch, getState) => {
428-
//Fetch Indices and Aliases with text provided
429-
await dispatch(getIndicesAndAliases(searchKey, dataSourceId, clusters));
427+
async (dispatch, getState) => {
428+
//Fetch Indices and Aliases with text provided
429+
await dispatch(getIndicesAndAliases(searchKey, dataSourceId, clusters));
430+
const osState = getState().opensearch;
431+
const exactMatchedIndices = osState.indices;
432+
const exactMatchedAliases = osState.aliases;
433+
if (exactMatchedAliases.length || exactMatchedIndices.length) {
434+
//If we have exact match just return that
435+
return {
436+
indices: exactMatchedIndices,
437+
aliases: exactMatchedAliases,
438+
};
439+
} else {
440+
//No results found for exact match, append wildCard and get partial matches if exists
441+
await dispatch(
442+
getIndicesAndAliases(`${searchKey}*`, dataSourceId, clusters)
443+
);
430444
const osState = getState().opensearch;
431-
const exactMatchedIndices = osState.indices;
432-
const exactMatchedAliases = osState.aliases;
433-
if (exactMatchedAliases.length || exactMatchedIndices.length) {
434-
//If we have exact match just return that
445+
const partialMatchedIndices = osState.indices;
446+
const partialMatchedAliases = osState.aliases;
447+
if (partialMatchedAliases.length || partialMatchedIndices.length) {
435448
return {
436-
indices: exactMatchedIndices,
437-
aliases: exactMatchedAliases,
449+
indices: partialMatchedIndices,
450+
aliases: partialMatchedAliases,
438451
};
439-
} else {
440-
//No results found for exact match, append wildCard and get partial matches if exists
441-
await dispatch(
442-
getIndicesAndAliases(`${searchKey}*`, dataSourceId, clusters)
443-
);
444-
const osState = getState().opensearch;
445-
const partialMatchedIndices = osState.indices;
446-
const partialMatchedAliases = osState.aliases;
447-
if (partialMatchedAliases.length || partialMatchedIndices.length) {
448-
return {
449-
indices: partialMatchedIndices,
450-
aliases: partialMatchedAliases,
451-
};
452-
}
453452
}
454-
};
453+
}
454+
};
455455

456456
export default reducer;

public/utils/contextMenu/getActions.tsx

+17-17
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ const grouping: Action['grouping'] = [
3434
export const getActions = () => {
3535
const getOnClick =
3636
(startingFlyout) =>
37-
async ({ embeddable }) => {
38-
const overlayService = getOverlays();
39-
const openFlyout = overlayService.openFlyout;
40-
const store = configureStore(getClient());
41-
const overlay = openFlyout(
42-
toMountPoint(
43-
<Provider store={store}>
44-
<AnywhereParentFlyout
45-
startingFlyout={startingFlyout}
46-
embeddable={embeddable}
47-
closeFlyout={() => overlay.close()}
48-
/>
49-
</Provider>
50-
),
51-
{ size: 'm', className: 'context-menu__flyout' }
52-
);
53-
};
37+
async ({ embeddable }) => {
38+
const overlayService = getOverlays();
39+
const openFlyout = overlayService.openFlyout;
40+
const store = configureStore(getClient());
41+
const overlay = openFlyout(
42+
toMountPoint(
43+
<Provider store={store}>
44+
<AnywhereParentFlyout
45+
startingFlyout={startingFlyout}
46+
embeddable={embeddable}
47+
closeFlyout={() => overlay.close()}
48+
/>
49+
</Provider>
50+
),
51+
{ size: 'm', className: 'context-menu__flyout' }
52+
);
53+
};
5454

5555
return [
5656
{

server/plugin.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export interface ADPluginSetupDependencies {
4545

4646
export class AnomalyDetectionOpenSearchDashboardsPlugin
4747
implements
48-
Plugin<
49-
AnomalyDetectionOpenSearchDashboardsPluginSetup,
50-
AnomalyDetectionOpenSearchDashboardsPluginStart
51-
>
48+
Plugin<
49+
AnomalyDetectionOpenSearchDashboardsPluginSetup,
50+
AnomalyDetectionOpenSearchDashboardsPluginStart
51+
>
5252
{
5353
private readonly logger: Logger;
5454
private readonly globalConfig$: any;

0 commit comments

Comments
 (0)