From 04effb70c70114a35f6963e732f593507cf47bd9 Mon Sep 17 00:00:00 2001 From: To-om Date: Mon, 12 Apr 2021 10:32:02 +0200 Subject: [PATCH] #1946 Filter labels return by platform status --- .../thehive/controllers/v1/AdminCtrl.scala | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/thehive/app/org/thp/thehive/controllers/v1/AdminCtrl.scala b/thehive/app/org/thp/thehive/controllers/v1/AdminCtrl.scala index 0e4641120f..045e1c4467 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/AdminCtrl.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/AdminCtrl.scala @@ -26,7 +26,6 @@ class AdminCtrl @Inject() ( @Named("integrity-check-actor") integrityCheckActor: ActorRef, integrityCheckOps: immutable.Set[GenIntegrityCheckOps], db: Database, - schemas: immutable.Set[UpdatableSchema], implicit val ec: ExecutionContext ) { @@ -88,11 +87,37 @@ class AdminCtrl @Inject() ( } } + val labels = Seq( + "Config", + "ReportTag", + "KeyValue", + "Pattern", + "Case", + "Procedure", + "Alert", + "Dashboard", + "Observable", + "User", + "AnalyzerTemplate", + "Taxonomy", + "CustomField", + "Data", + "Organisation", + "Profile", + "Task", + "Action", + "Log", + "CaseTemplate", + "Audit", + "Tag", + "Job", + "Attachment" + ) def indexStatus: Action[AnyContent] = entrypoint("Get index status") .authPermittedRoTransaction(db, Permissions.managePlatform) { _ => graph => - val indices = schemas.flatMap(_.modelList).collect { - case v: VertexModel => Json.obj("name" -> v.label, "count" -> graph.indexCountQuery(s"""v."_label":${v.label}""")) + val indices = labels.map { label => + Json.obj("name" -> label, "count" -> graph.indexCountQuery(s"""v."_label":$label""")) } val indexCount = Json.obj("name" -> "global", "indices" -> indices) Success(Results.Ok(Json.obj("index" -> Seq(indexCount))))