Skip to content

Commit

Permalink
Remove legacy notifications/delivery related code (opensearch-project#94
Browse files Browse the repository at this point in the history
)

* remove legacy notifications/delivery related code
Signed-off-by: David Cui <davidcui@amazon.com>

* remove commented out reference
Signed-off-by: David Cui <davidcui@amazon.com>
  • Loading branch information
davidcui1225 authored Jun 23, 2021
1 parent eebbec6 commit 6f2d7ed
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 225 deletions.
4 changes: 0 additions & 4 deletions common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export const PLUGIN_NAME = 'reports-dashboards';

export const API_PREFIX = '/api/reporting';

export const NOTIFICATION_API = {
SEND: '/_plugins/_notifications/send',
};

const BASE_REPORTS_URI = '/_plugins/_reports';

export const OPENSEARCH_REPORTS_API = {
Expand Down
42 changes: 0 additions & 42 deletions server/backend/opendistro-notification-plugin.ts

This file was deleted.

13 changes: 0 additions & 13 deletions server/executor/createScheduledReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ import { createSavedSearchReport } from '../routes/utils/savedSearchReportHelper
import { ReportSchemaType } from '../model';
import { CreateReportResultType } from '../routes/utils/types';
import { createVisualReport } from '../routes/utils/visual_report/visualReportHelper';
import { deliverReport } from '../routes/lib/deliverReport';
import { updateReportState } from '../routes/lib/updateReportState';

export const createScheduledReport = async (
reportId: string,
report: ReportSchemaType,
opensearchClient: ILegacyClusterClient,
opensearchReportsClient: ILegacyClusterClient,
notificationClient: ILegacyClusterClient,
logger: Logger
) => {
let createReportResult: CreateReportResultType;
Expand Down Expand Up @@ -76,17 +74,6 @@ export const createScheduledReport = async (
// }

await updateReportState(reportId, opensearchReportsClient, REPORT_STATE.created);

// deliver report
if (deliveryType == DELIVERY_TYPE.channel) {
await deliverReport(
report,
notificationClient,
opensearchReportsClient,
reportId,
logger
);
}
} catch (error) {
// update report instance with "error" state
//TODO: save error detail and display on UI
Expand Down
2 changes: 0 additions & 2 deletions server/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { BackendReportInstanceType } from 'server/model/backendModel';

async function pollAndExecuteJob(
opensearchReportsClient: ILegacyClusterClient,
notificationClient: ILegacyClusterClient,
opensearchClient: ILegacyClusterClient,
logger: Logger
) {
Expand All @@ -60,7 +59,6 @@ async function pollAndExecuteJob(
reportMetadata,
opensearchClient,
opensearchReportsClient,
notificationClient,
logger
);
} else {
Expand Down
14 changes: 0 additions & 14 deletions server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
import { setIntervalAsync } from 'set-interval-async/dynamic';
import { Semaphore, SemaphoreInterface, withTimeout } from 'async-mutex';
import opensearchReportsPlugin from './backend/opensearch-reports-plugin';
import notificationPlugin from './backend/opendistro-notification-plugin';
import {
ReportsDashboardsPluginSetup,
ReportsDashboardsPluginStart,
Expand Down Expand Up @@ -89,12 +88,6 @@ export class ReportsDashboardsPlugin
}
);

const notificationClient: ILegacyClusterClient = core.opensearch.legacy.createClient(
'notification',
{
plugins: [notificationPlugin],
}
);
// Register server side APIs
registerRoutes(router, accessInfo);

Expand All @@ -106,7 +99,6 @@ export class ReportsDashboardsPlugin
return {
logger: this.logger,
semaphore: this.semaphore,
notificationClient,
opensearchReportsClient,
};
}
Expand All @@ -124,12 +116,6 @@ export class ReportsDashboardsPlugin
}
);

const notificationClient: ILegacyClusterClient = core.opensearch.legacy.createClient(
'notification',
{
plugins: [notificationPlugin],
}
);
const opensearchClient: ILegacyClusterClient =
core.opensearch.legacy.client;
/*
Expand Down
17 changes: 0 additions & 17 deletions server/routes/lib/createReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import { ReportSchemaType } from '../../model';
import { CreateReportResultType } from '../utils/types';
import { createVisualReport } from '../utils/visual_report/visualReportHelper';
import { SetCookie, Headers } from 'puppeteer-core';
import { deliverReport } from './deliverReport';
import { updateReportState } from './updateReportState';
import { saveReport } from './saveReport';
import { SemaphoreInterface } from 'async-mutex';
Expand All @@ -61,10 +60,6 @@ export const createReport = async (
//@ts-ignore
const semaphore: SemaphoreInterface = context.reporting_plugin.semaphore;
// @ts-ignore
const notificationClient: ILegacyScopedClusterClient = context.reporting_plugin.notificationClient.asScoped(
request
);
// @ts-ignore
const opensearchReportsClient: ILegacyScopedClusterClient = context.reporting_plugin.opensearchReportsClient.asScoped(
request
);
Expand All @@ -82,7 +77,6 @@ export const createReport = async (
const {
report_definition: {
report_params: reportParams,
delivery: { delivery_type: deliveryType },
},
} = report;
const { report_source: reportSource } = reportParams;
Expand Down Expand Up @@ -154,17 +148,6 @@ export const createReport = async (
// if (!savedReportId) {
// await updateReportState(reportId, opensearchReportsClient, REPORT_STATE.created);
// }

// deliver report
if (!savedReportId && deliveryType == DELIVERY_TYPE.channel) {
await deliverReport(
report,
notificationClient,
opensearchReportsClient,
reportId,
logger
);
}
} catch (error) {
// update report instance with "error" state
// TODO: save error detail and display on UI
Expand Down
133 changes: 0 additions & 133 deletions server/routes/lib/deliverReport.ts

This file was deleted.

0 comments on commit 6f2d7ed

Please sign in to comment.