Skip to content

Commit

Permalink
indexPatternsService marked as mandatory dep
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandar Djindjic <djindjic@gmail.com>
  • Loading branch information
djindjic committed Jan 22, 2023
1 parent 1cd30fb commit ab586e6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion public/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface BrowserServices {
alertService: AlertsService;
ruleService: RuleService;
notificationsService: NotificationsService;
indexPatternsService?: IndexPatternsService;
indexPatternsService: IndexPatternsService;
}

export interface RuleOptions {
Expand Down
5 changes: 1 addition & 4 deletions public/pages/Findings/components/CreateIndexPatternForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface CreateIndexPatternFormProps {
};
created: (values: string) => void;
close: () => void;
indexPatternsService?: IndexPatternsService;
indexPatternsService: IndexPatternsService;
}

export const CreateIndexPatternForm: React.FC<CreateIndexPatternFormProps> = ({
Expand Down Expand Up @@ -113,9 +113,6 @@ export const CreateIndexPatternForm: React.FC<CreateIndexPatternFormProps> = ({
return errors;
}}
onSubmit={async (values, { setSubmitting }) => {
if (!indexPatternsService) {
return;
}
try {
const newIndex = await indexPatternsService.createAndSave({
title: values.name,
Expand Down
2 changes: 1 addition & 1 deletion public/pages/Findings/components/FindingDetailsFlyout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface FindingDetailsFlyoutProps {
backButton?: React.ReactNode;
allRules: { [id: string]: RuleSource };
opensearchService: OpenSearchService;
indexPatternsService?: IndexPatternsService;
indexPatternsService: IndexPatternsService;
closeFlyout: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface FindingsTableProps extends RouteComponentProps {
onRefresh: () => void;
onFindingsFiltered: (findings: FindingItemType[]) => void;
hasNotificationsPlugin: boolean;
indexPatternsService?: IndexPatternsService;
indexPatternsService: IndexPatternsService;
}

interface FindingsTableState {
Expand Down
2 changes: 1 addition & 1 deletion public/pages/Findings/containers/Findings/Findings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface FindingsProps extends RouteComponentProps {
detectorService: DetectorsService;
findingsService: FindingsService;
notificationsService: NotificationsService;
indexPatternsService?: IndexPatternsService;
indexPatternsService: IndexPatternsService;
opensearchService: OpenSearchService;
ruleService: RuleService;
notifications: NotificationsStart;
Expand Down
6 changes: 2 additions & 4 deletions public/security_analytics_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function renderApp(
coreStart: CoreStart,
params: AppMountParameters,
landingPage: string,
plugins?: SecurityAnalyticsPluginStartDeps
depsStart: SecurityAnalyticsPluginStartDeps
) {
const { http, savedObjects } = coreStart;

Expand All @@ -42,9 +42,7 @@ export function renderApp(
const alertsService = new AlertsService(http);
const ruleService = new RuleService(http);
const notificationsService = new NotificationsService(http);
const indexPatternsService = plugins
? new IndexPatternsService((plugins.data as any).indexPatterns)
: undefined;
const indexPatternsService = new IndexPatternsService((depsStart.data as any).indexPatterns);

const services: BrowserServices = {
detectorsService,
Expand Down

0 comments on commit ab586e6

Please sign in to comment.