Skip to content

Commit

Permalink
Allow to be specified in request
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyford committed Jul 24, 2024
1 parent b4d7fd0 commit eb257d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions apps/rule-manager/app/controllers/RulesController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,14 @@ class RulesController(
case Some(tag) => tag.head
case None => ""
}
category = formData.dataParts.get("category") match {
case Some(category) => category.head
case None => ""
}
} yield RuleManager.csvImport(
file.ref.path.toFile,
tag,
category,
bucketRuleResource
)

Expand Down
4 changes: 2 additions & 2 deletions apps/rule-manager/app/service/RuleManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ case class AllRuleData(
)

object RuleManager extends Loggable {
def csvImport(toFile: File, tagName: String, bucketRuleResource: BucketRuleResource) = {
def csvImport(toFile: File, tagName: String, category: String, bucketRuleResource: BucketRuleResource) = {
val reader = CSVReader.open(toFile)
val rules = reader.all()

Expand All @@ -49,7 +49,7 @@ object RuleManager extends Loggable {
id = None,
ruleType = RuleType.regex,
pattern = Some(pattern),
category = Some("Imported from CSV"),
category = Some(category),
description = Some(description),
ignore = false,
replacement = Some(replacement),
Expand Down

0 comments on commit eb257d5

Please sign in to comment.