mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-21 17:37:15 +00:00
Merge pull request #1417 from Aravindh-Raju/aravindhr/fix-batch-status-display
Fix batch status display
This commit is contained in:
commit
a64fac99fd
@ -443,7 +443,6 @@ class BatchChangeService(
|
||||
changes,
|
||||
batchChangeInput.ownerGroupId,
|
||||
BatchChangeApprovalStatus.PendingReview,
|
||||
BatchChangeStatus.PendingReview,
|
||||
scheduledTime = batchChangeInput.scheduledTime
|
||||
).asRight
|
||||
}
|
||||
@ -459,7 +458,6 @@ class BatchChangeService(
|
||||
changes,
|
||||
batchChangeInput.ownerGroupId,
|
||||
BatchChangeApprovalStatus.AutoApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
scheduledTime = batchChangeInput.scheduledTime
|
||||
).asRight
|
||||
}
|
||||
|
@ -1041,7 +1041,6 @@ class BatchChangeServiceSpec
|
||||
List(),
|
||||
ownerGroupId = Some(okGroup.id),
|
||||
BatchChangeApprovalStatus.ManuallyApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
Some(superUser.id),
|
||||
None,
|
||||
Some(Instant.now.truncatedTo(ChronoUnit.MILLIS))
|
||||
@ -2549,7 +2548,6 @@ class BatchChangeServiceSpec
|
||||
Instant.now.truncatedTo(ChronoUnit.MILLIS),
|
||||
List(),
|
||||
approvalStatus = BatchChangeApprovalStatus.PendingReview,
|
||||
batchStatus = BatchChangeStatus.PendingReview
|
||||
)
|
||||
batchChangeRepo.save(batchChangeOne)
|
||||
|
||||
@ -2560,7 +2558,6 @@ class BatchChangeServiceSpec
|
||||
Instant.ofEpochMilli(Instant.now.truncatedTo(ChronoUnit.MILLIS).toEpochMilli + 1000),
|
||||
List(),
|
||||
approvalStatus = BatchChangeApprovalStatus.AutoApproved,
|
||||
batchStatus = BatchChangeStatus.PendingProcessing
|
||||
)
|
||||
batchChangeRepo.save(batchChangeTwo)
|
||||
|
||||
@ -2578,8 +2575,7 @@ class BatchChangeServiceSpec
|
||||
result.ignoreAccess shouldBe false
|
||||
result.batchStatus shouldBe Some(BatchChangeStatus.PendingReview)
|
||||
|
||||
result.batchChanges.length shouldBe 1
|
||||
result.batchChanges(0).status shouldBe batchChangeOne.batchStatus
|
||||
result.batchChanges.length shouldBe 2
|
||||
}
|
||||
}
|
||||
|
||||
@ -2719,7 +2715,6 @@ class BatchChangeServiceSpec
|
||||
List(singleChangeGood, singleChangeNR),
|
||||
Some(authGrp.id),
|
||||
BatchChangeApprovalStatus.ManuallyApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
Some("reviewer_id"),
|
||||
Some("approved"),
|
||||
Some(Instant.now.truncatedTo(ChronoUnit.MILLIS))
|
||||
|
@ -100,7 +100,6 @@ class EmailNotifierSpec
|
||||
changes,
|
||||
None,
|
||||
BatchChangeApprovalStatus.AutoApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
@ -27,7 +27,7 @@ import org.mockito.Matchers._
|
||||
import org.mockito.Mockito._
|
||||
import org.mockito.ArgumentCaptor
|
||||
import cats.effect.IO
|
||||
import _root_.vinyldns.core.domain.batch.{BatchChange, BatchChangeApprovalStatus, BatchChangeStatus, SingleAddChange, SingleChange, SingleChangeStatus, SingleDeleteRRSetChange}
|
||||
import _root_.vinyldns.core.domain.batch.{BatchChange, BatchChangeApprovalStatus, SingleAddChange, SingleChange, SingleChangeStatus, SingleDeleteRRSetChange}
|
||||
import java.time.Instant
|
||||
import vinyldns.core.domain.record.RecordType
|
||||
import vinyldns.core.domain.record.AData
|
||||
@ -65,7 +65,6 @@ class SnsNotifierSpec
|
||||
changes,
|
||||
None,
|
||||
BatchChangeApprovalStatus.AutoApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
@ -39,7 +39,6 @@ class InMemoryBatchChangeRepository extends BatchChangeRepository {
|
||||
ownerGroupId: Option[String],
|
||||
id: String,
|
||||
approvalStatus: BatchChangeApprovalStatus,
|
||||
batchStatus: BatchChangeStatus,
|
||||
reviewerId: Option[String],
|
||||
reviewComment: Option[String],
|
||||
reviewTimestamp: Option[Instant]
|
||||
@ -55,7 +54,6 @@ class InMemoryBatchChangeRepository extends BatchChangeRepository {
|
||||
batchChange.ownerGroupId,
|
||||
batchChange.id,
|
||||
batchChange.approvalStatus,
|
||||
batchChange.batchStatus,
|
||||
batchChange.reviewerId,
|
||||
batchChange.reviewComment,
|
||||
batchChange.reviewTimestamp
|
||||
@ -90,7 +88,6 @@ class InMemoryBatchChangeRepository extends BatchChangeRepository {
|
||||
singleChangesFromRepo,
|
||||
sc.ownerGroupId,
|
||||
sc.approvalStatus,
|
||||
sc.batchStatus,
|
||||
sc.reviewerId,
|
||||
sc.reviewComment,
|
||||
sc.reviewTimestamp,
|
||||
@ -135,7 +132,6 @@ class InMemoryBatchChangeRepository extends BatchChangeRepository {
|
||||
|
||||
val userBatchChanges = batches.values.toList
|
||||
.filter(b => userId.forall(_ == b.userId))
|
||||
.filter(bs => batchStatus.forall(_ == bs.batchStatus))
|
||||
.filter(bu => userName.forall(_ == bu.userName))
|
||||
.filter(bdtsi => startInstant.forall(_.isBefore(bdtsi.createdTimestamp)))
|
||||
.filter(bdtei => endInstant.forall(_.isAfter(bdtei.createdTimestamp)))
|
||||
@ -152,7 +148,6 @@ class InMemoryBatchChangeRepository extends BatchChangeRepository {
|
||||
changes,
|
||||
sc.ownerGroupId,
|
||||
sc.approvalStatus,
|
||||
sc.batchStatus,
|
||||
sc.reviewerId,
|
||||
sc.reviewComment,
|
||||
sc.reviewTimestamp,
|
||||
|
@ -482,7 +482,6 @@ class BatchChangeJsonProtocolSpec
|
||||
List(add, delete),
|
||||
None,
|
||||
BatchChangeApprovalStatus.PendingReview,
|
||||
BatchChangeStatus.PendingReview,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@ -617,7 +616,6 @@ class BatchChangeJsonProtocolSpec
|
||||
List(add, delete),
|
||||
None,
|
||||
BatchChangeApprovalStatus.PendingReview,
|
||||
BatchChangeStatus.PendingReview,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
@ -133,7 +133,6 @@ class BatchChangeRoutingSpec()
|
||||
),
|
||||
ownerGroupId,
|
||||
approvalStatus,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
@ -31,7 +31,6 @@ case class BatchChange(
|
||||
changes: List[SingleChange],
|
||||
ownerGroupId: Option[String] = None,
|
||||
approvalStatus: BatchChangeApprovalStatus,
|
||||
batchStatus: BatchChangeStatus = BatchChangeStatus.PendingProcessing,
|
||||
reviewerId: Option[String] = None,
|
||||
reviewComment: Option[String] = None,
|
||||
reviewTimestamp: Option[Instant] = None,
|
||||
|
@ -47,7 +47,6 @@ class BatchChangeSummarySpec extends AnyWordSpec with Matchers {
|
||||
List(pendingChange, failedChange, completeChange),
|
||||
Some("groupId"),
|
||||
BatchChangeApprovalStatus.AutoApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
@ -47,10 +47,10 @@ class MySqlBatchChangeRepositoryIntegrationSpec
|
||||
|
||||
object TestData {
|
||||
def generateSingleAddChange(
|
||||
recordType: RecordType,
|
||||
recordData: RecordData,
|
||||
status: SingleChangeStatus = Pending,
|
||||
errors: List[SingleChangeError] = List.empty
|
||||
recordType: RecordType,
|
||||
recordData: RecordData,
|
||||
status: SingleChangeStatus = Pending,
|
||||
errors: List[SingleChangeError] = List.empty
|
||||
): SingleAddChange =
|
||||
SingleAddChange(
|
||||
Some(okZone.id),
|
||||
@ -103,7 +103,6 @@ class MySqlBatchChangeRepositoryIntegrationSpec
|
||||
changes,
|
||||
Some(UUID.randomUUID().toString),
|
||||
BatchChangeApprovalStatus.AutoApproved,
|
||||
BatchChangeStatus.PendingProcessing,
|
||||
Some(UUID.randomUUID().toString),
|
||||
Some("review comment"),
|
||||
Some(Instant.now.truncatedTo(ChronoUnit.MILLIS).plusSeconds(2))
|
||||
@ -456,8 +455,7 @@ class MySqlBatchChangeRepositoryIntegrationSpec
|
||||
} yield (updated, saved)
|
||||
|
||||
val (retrieved, saved) = f.unsafeRunSync
|
||||
// Batch Change Status will be updated once saved
|
||||
retrieved.map(x => x.copy(batchStatus = BatchChangeStatus.Complete)) shouldBe saved
|
||||
retrieved shouldBe saved
|
||||
}
|
||||
|
||||
"return no batch when single changes list is empty" in {
|
||||
|
@ -297,7 +297,6 @@ class MySqlBatchChangeRepository
|
||||
val complete = res.int("complete_count")
|
||||
val cancelled = res.int("cancelled_count")
|
||||
val approvalStatus = toApprovalStatus(res.intOpt("approval_status"))
|
||||
val batchChangeStatus = toBatchChangeStatus(res.stringOpt("batch_status"))
|
||||
val schedTime =
|
||||
res.timestampOpt("scheduled_time").map(st => st.toInstant)
|
||||
val cancelledTimestamp =
|
||||
@ -308,7 +307,14 @@ class MySqlBatchChangeRepository
|
||||
Option(res.string("comments")),
|
||||
res.timestamp("created_time").toInstant,
|
||||
pending + failed + complete + cancelled,
|
||||
batchChangeStatus,
|
||||
BatchChangeStatus
|
||||
.calculateBatchStatus(
|
||||
approvalStatus,
|
||||
pending > 0,
|
||||
failed > 0,
|
||||
complete > 0,
|
||||
schedTime.isDefined
|
||||
),
|
||||
Option(res.string("owner_group_id")),
|
||||
res.string("id"),
|
||||
None,
|
||||
@ -363,7 +369,6 @@ class MySqlBatchChangeRepository
|
||||
Nil,
|
||||
result.stringOpt("owner_group_id"),
|
||||
toApprovalStatus(result.intOpt("approval_status")),
|
||||
toBatchChangeStatus(result.stringOpt("batch_status")),
|
||||
result.stringOpt("reviewer_id"),
|
||||
result.stringOpt("review_comment"),
|
||||
result.timestampOpt("review_timestamp").map(toDateTime),
|
||||
|
Loading…
x
Reference in New Issue
Block a user