Skip to content

Commit dab0135

Browse files
committed
Added index.ts file to common in searchprofiler route
Marked types and values as internal Removed unnecessary "async" from function Update import to not use "src" alias
1 parent c14047c commit dab0135

File tree

9 files changed

+19
-9
lines changed

9 files changed

+19
-9
lines changed

x-pack/plugins/searchprofiler/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { LicenseType } from '../../licensing/common/types';
77

88
const basicLicense: LicenseType = 'basic';
99

10+
/** @internal */
1011
export const PLUGIN = Object.freeze({
1112
id: 'searchprofiler',
1213
minimumLicenseType: basicLicense,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
export { PLUGIN } from './constants';
8+
9+
export { LicenseStatus } from './types';

x-pack/plugins/searchprofiler/common/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7+
/** @internal */
78
export interface LicenseStatus {
89
valid: boolean;
910
message?: string;

x-pack/plugins/searchprofiler/public/application/boot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { render, unmountComponentAtNode } from 'react-dom';
77
import { HttpStart as Http, ToastsSetup } from 'kibana/public';
88
import React from 'react';
99

10-
import { LicenseStatus } from '../../common/types';
10+
import { LicenseStatus } from '../../common';
1111
import { App } from '.';
1212

1313
export interface Dependencies {

x-pack/plugins/searchprofiler/public/application/contexts/app_context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React, { useContext, createContext, useCallback } from 'react';
88

99
import { HttpSetup, ToastsSetup } from 'kibana/public';
10-
import { LicenseStatus } from '../../../common/types';
10+
import { LicenseStatus } from '../../../common';
1111

1212
export interface ContextArgs {
1313
http: HttpSetup;

x-pack/plugins/searchprofiler/public/application/hooks/use_request_profile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface ReturnValue {
1919
error?: string;
2020
}
2121

22-
const extractProfilerErrorMessage = async (e: any): Promise<string | undefined> => {
22+
const extractProfilerErrorMessage = (e: any): string | undefined => {
2323
if (e.body?.attributes?.error?.reason) {
2424
const { reason, line, col } = e.body.attributes.error;
2525
return `${reason} at line: ${line - 1} col: ${col}`;
@@ -73,7 +73,7 @@ export const useRequestProfile = () => {
7373

7474
return { data: resp.resp.profile.shards };
7575
} catch (e) {
76-
const profilerErrorMessage = await extractProfilerErrorMessage(e);
76+
const profilerErrorMessage = extractProfilerErrorMessage(e);
7777
if (profilerErrorMessage) {
7878
notifications.addError(e, {
7979
title: e.message,

x-pack/plugins/searchprofiler/public/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { first } from 'rxjs/operators';
1111
import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public';
1212
import { LICENSE_CHECK_STATE } from '../../licensing/public';
1313

14-
import { PLUGIN } from '../common/constants';
14+
import { PLUGIN } from '../common';
1515
import { AppPublicPluginDependencies } from './types';
1616

1717
export class SearchProfilerUIPlugin implements Plugin<void, void, AppPublicPluginDependencies> {

x-pack/plugins/searchprofiler/server/plugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'kibana/serv
99

1010
import { LICENSE_CHECK_STATE } from '../../licensing/common/types';
1111

12-
import { LicenseStatus } from '../common/types';
12+
import { LicenseStatus, PLUGIN } from '../common';
1313
import { AppServerPluginDependencies } from './types';
1414
import * as profileRoute from './routes/profile';
15-
import { PLUGIN } from '../common/constants';
1615

1716
export class SearchProfilerServerPlugin implements Plugin {
1817
licenseStatus: LicenseStatus;

x-pack/plugins/searchprofiler/server/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66

77
import { IRouter, Logger } from 'kibana/server';
8-
import { ElasticsearchPlugin } from 'src/legacy/core_plugins/elasticsearch';
8+
import { ElasticsearchPlugin } from '../../../../src/legacy/core_plugins/elasticsearch';
99
import { LicensingPluginSetup } from '../../licensing/server';
10-
import { LicenseStatus } from '../common/types';
10+
import { LicenseStatus } from '../common';
1111

1212
export interface AppServerPluginDependencies {
1313
licensing: LicensingPluginSetup;

0 commit comments

Comments
 (0)