Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongnansu committed Feb 5, 2021
1 parent c6c8f2d commit 3d518fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
18 changes: 0 additions & 18 deletions kibana-reports/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,11 @@
*/

import { OpendistroKibanaReportsPlugin } from './plugin';
import { schema, TypeOf } from '@kbn/config-schema';
import {
PluginInitializerContext,
PluginConfigDescriptor,
HttpServerInfo,
} from '../../../src/core/server';

export const configSchema = schema.object({
access: schema.object({
port: schema.number({ defaultValue: 5601 }),
basePath: schema.string({ defaultValue: '' }),
}),
});

export type KibanaReportsPluginConfigType = TypeOf<typeof configSchema>;

export const config: PluginConfigDescriptor<KibanaReportsPluginConfigType> = {
exposeToBrowser: {
access: true,
},
schema: configSchema,
};

export type AccessInfoType = {
basePath: string;
serverInfo: HttpServerInfo;
Expand Down
2 changes: 1 addition & 1 deletion kibana-reports/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import registerRoutes from './routes';
import { pollAndExecuteJob } from './executor/executor';
import { POLL_INTERVAL } from './utils/constants';
import { AccessInfoType, KibanaReportsPluginConfigType } from 'server';
import { AccessInfoType } from 'server';

export interface ReportsPluginRequestContext {
logger: Logger;
Expand Down
4 changes: 2 additions & 2 deletions kibana-reports/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import registerReportRoute from './report';
import registerReportDefinitionRoute from './reportDefinition';
import registerReportSourceRoute from './reportSource';
import registerMetricRoute from './metric';
import { HttpServerInfo, IRouter } from '../../../../src/core/server';
import { AccessInfoType, KibanaReportsPluginConfigType } from 'server';
import { IRouter } from '../../../../src/core/server';
import { AccessInfoType } from 'server';

export default function (router: IRouter, accessInfo: AccessInfoType) {
registerReportRoute(router, accessInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* permissions and limitations under the License.
*/

import { KibanaReportsPluginConfigType } from 'server';
import { AccessInfoType } from 'server';
import {
BackendReportInstanceType,
BACKEND_DELIVERY_FORMAT,
Expand Down Expand Up @@ -74,10 +74,13 @@ const input: BackendReportInstanceType = {
status: BACKEND_REPORT_STATE.success,
};

const testConfig: KibanaReportsPluginConfigType = {
access: {
const testAccessInfo: AccessInfoType = {
basePath: '',
serverInfo: {
name: '',
hostname: 'localhost',
port: 5601,
basePath: '',
protocol: 'http',
},
};

Expand Down Expand Up @@ -133,7 +136,7 @@ const output = {

describe('test backend to ui model conversion', () => {
test('convert backend to ui report', async () => {
const res = backendToUiReport(input, testConfig.access.basePath);
const res = backendToUiReport(input, testAccessInfo.basePath);
expect(res).toEqual(output);
}, 20000);
});

0 comments on commit 3d518fb

Please sign in to comment.