Skip to content

Commit

Permalink
Added index.ts file to common in searchprofiler route
Browse files Browse the repository at this point in the history
Marked types and values as internal
Removed unnecessary "async" from function
Update import to not use "src" alias
  • Loading branch information
jloleysens committed Jan 22, 2020
1 parent c14047c commit dab0135
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/searchprofiler/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LicenseType } from '../../licensing/common/types';

const basicLicense: LicenseType = 'basic';

/** @internal */
export const PLUGIN = Object.freeze({
id: 'searchprofiler',
minimumLicenseType: basicLicense,
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/searchprofiler/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { PLUGIN } from './constants';

export { LicenseStatus } from './types';
1 change: 1 addition & 0 deletions x-pack/plugins/searchprofiler/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

/** @internal */
export interface LicenseStatus {
valid: boolean;
message?: string;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/searchprofiler/public/application/boot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { render, unmountComponentAtNode } from 'react-dom';
import { HttpStart as Http, ToastsSetup } from 'kibana/public';
import React from 'react';

import { LicenseStatus } from '../../common/types';
import { LicenseStatus } from '../../common';
import { App } from '.';

export interface Dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React, { useContext, createContext, useCallback } from 'react';

import { HttpSetup, ToastsSetup } from 'kibana/public';
import { LicenseStatus } from '../../../common/types';
import { LicenseStatus } from '../../../common';

export interface ContextArgs {
http: HttpSetup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ReturnValue {
error?: string;
}

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

return { data: resp.resp.profile.shards };
} catch (e) {
const profilerErrorMessage = await extractProfilerErrorMessage(e);
const profilerErrorMessage = extractProfilerErrorMessage(e);
if (profilerErrorMessage) {
notifications.addError(e, {
title: e.message,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/searchprofiler/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { first } from 'rxjs/operators';
import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public';
import { LICENSE_CHECK_STATE } from '../../licensing/public';

import { PLUGIN } from '../common/constants';
import { PLUGIN } from '../common';
import { AppPublicPluginDependencies } from './types';

export class SearchProfilerUIPlugin implements Plugin<void, void, AppPublicPluginDependencies> {
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/searchprofiler/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { CoreSetup, Logger, Plugin, PluginInitializerContext } from 'kibana/serv

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

import { LicenseStatus } from '../common/types';
import { LicenseStatus, PLUGIN } from '../common';
import { AppServerPluginDependencies } from './types';
import * as profileRoute from './routes/profile';
import { PLUGIN } from '../common/constants';

export class SearchProfilerServerPlugin implements Plugin {
licenseStatus: LicenseStatus;
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/searchprofiler/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { IRouter, Logger } from 'kibana/server';
import { ElasticsearchPlugin } from 'src/legacy/core_plugins/elasticsearch';
import { ElasticsearchPlugin } from '../../../../src/legacy/core_plugins/elasticsearch';
import { LicensingPluginSetup } from '../../licensing/server';
import { LicenseStatus } from '../common/types';
import { LicenseStatus } from '../common';

export interface AppServerPluginDependencies {
licensing: LicensingPluginSetup;
Expand Down

0 comments on commit dab0135

Please sign in to comment.