From bb9f1d9cbf6da453e442e73cc1c2fb3d18aa5a14 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Fri, 28 Jul 2023 11:32:23 -0700 Subject: [PATCH] addressed PR comments Signed-off-by: Amardeepsingh Siglani --- public/store/LogTypeStore.ts | 7 ++++++- server/services/LogTypeService.ts | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/store/LogTypeStore.ts b/public/store/LogTypeStore.ts index 8d8eaa095..1eebdc8ae 100644 --- a/public/store/LogTypeStore.ts +++ b/public/store/LogTypeStore.ts @@ -7,6 +7,7 @@ import { NotificationsStart } from 'opensearch-dashboards/public'; import { LogType, LogTypeBase, LogTypeItem } from '../../types'; import LogTypeService from '../services/LogTypeService'; import { errorNotificationToast } from '../utils/helpers'; +import { DataStore } from './DataStore'; export class LogTypeStore { constructor(private service: LogTypeService, private notifications: NotificationsStart) {} @@ -21,7 +22,11 @@ export class LogTypeStore { }; }); - return { ...logTypes[0], detectionRules: 10 }; + const rulesRes = await DataStore.rules.getAllRules({ + 'rule.category': [id], + }); + + return { ...logTypes[0], detectionRules: rulesRes.length }; } return undefined; diff --git a/server/services/LogTypeService.ts b/server/services/LogTypeService.ts index 159624a6c..1e190d73f 100644 --- a/server/services/LogTypeService.ts +++ b/server/services/LogTypeService.ts @@ -114,7 +114,6 @@ export class LogTypeService { const { logTypeId } = request.params; const params: UpdateLogTypeParams = { body: logType, logTypeId }; const { callAsCurrentUser: callWithRequest } = this.osDriver.asScoped(request); - console.log(JSON.stringify(params)); const updateLogTypeResponse: UpdateLogTypeResponse = await callWithRequest( CLIENT_LOGTYPE_METHODS.UPDATE_LOGTYPE, params