Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ThisBuild / organization := "io.latis-data"
ThisBuild / scalaVersion := "3.3.6"
ThisBuild / scalaVersion := "3.3.8"

val catsVersion = "2.13.0"
val catsEffectVersion = "3.7.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LogvizRoutes(eventsource: EventSource, instancesource: InstanceSource) ext
StaticFile.fromResource("styles.css", req.some).getOrElseF(NotFound())

// event with query params
case req @ GET -> Root / "events" :?
case GET -> Root / "events" :?
StartDateQueryParamMatcher(startTime) +&
EndDateQueryParamMatcher(endTime) +&
InstanceQueryParamMatcher(instance) =>
Expand All @@ -69,7 +69,7 @@ class LogvizRoutes(eventsource: EventSource, instancesource: InstanceSource) ext
}.merge

//default (past 24 hours)
case req @ GET -> Root / "events" =>
case GET -> Root / "events" =>
// hard coding times for now
val end: LocalDateTime = LocalDateTime.now(ZoneOffset.UTC)
val start: LocalDateTime = end.minusHours(24)
Expand All @@ -78,7 +78,7 @@ class LogvizRoutes(eventsource: EventSource, instancesource: InstanceSource) ext

Ok(sse)

case req @ GET -> Root / "instances" =>
case GET -> Root / "instances" =>
val list = instancesource.instances.map { tup =>
tup.asJson
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class EventComponent(
scrollRef <- Resource.eval(Ref[IO].of(0.0))
isTop <- Resource.eval(Ref[IO].of(true))
rectRef <- Resource.eval(Ref[IO].of(List[Rectangle]()))
end <- Resource.eval(endTime.get)
// end <- Resource.eval(endTime.get)
//prevEndRef <- Resource.eval(Ref[IO].of(end))
prevZoomRef <- Resource.eval(Ref[IO].of(1.0))
_ <- animate(canvas,
Expand Down Expand Up @@ -248,7 +248,7 @@ class EventComponent(
): Resource[IO, Dispatcher[IO]] =
Dispatcher.sequential[IO] evalTap{ dispatcher =>

def go(timestamp: Double): IO[Unit] =
def go: IO[Unit] =
for {
scroll <- IO(canvas.parentElement.scrollTop)
top <- isTop.get
Expand Down Expand Up @@ -361,12 +361,12 @@ class EventComponent(
} else {
IO.unit
}
_ <- IO.delay(dom.window.requestAnimationFrame(ts =>
dispatcher.unsafeRunAndForget(go(ts))))
_ <- IO.delay(dom.window.requestAnimationFrame(_ =>
dispatcher.unsafeRunAndForget(go)))
} yield()

IO.delay(dom.window.requestAnimationFrame(ts =>
dispatcher.unsafeRunAndForget(go(ts))))
IO.delay(dom.window.requestAnimationFrame(_ =>
dispatcher.unsafeRunAndForget(go)))
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object EventParser {
currDepth) +: lst)
>> IO(currDepth)

case Some((RequestEvent.Partial(start, status), currDepth)) =>
case Some((RequestEvent.Partial(_, status), currDepth)) =>
val successTime = LocalDateTime.parse(time)
// if we should have had a partial request event and we don't, discard, otherwise update the partial event
val eventStart = successTime.minus(duration, ChronoUnit.MILLIS)
Expand Down Expand Up @@ -157,7 +157,7 @@ object EventParser {
case None => IO.raiseError(new Exception(
"No unused column available. Increase number of columns!!!"))
}
c <- colCounter.updateAndGet(c => c + 1)
_ <- colCounter.updateAndGet(c => c + 1)
_ <- maxCounter.update(prev => math.max(prev, currDepth.number + 1)) // maxCounter is 1-indexed
_ <- compEventsRef.update(lst =>
(RequestEvent.Partial(time, s"partial success event- start time unknown. duration: $duration"),
Expand All @@ -179,7 +179,7 @@ object EventParser {
(RequestEvent.Failure(start, url, time, msg),
currDepth) +: lst)
>> IO(currDepth)
case Some((RequestEvent.Partial(start, status), currDepth)) =>
case Some((RequestEvent.Partial(_, status), currDepth)) =>
compEventsRef.update(lst =>
(RequestEvent.Partial(time, s"failed event with response status of: $status, error msg: $msg"),
currDepth) +: lst)
Expand Down
69 changes: 34 additions & 35 deletions modules/frontend/src/main/scala/latis/logviz/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,42 @@ object Main extends IOWebApp {
events <- Resource.eval(SignallingRef[IO].of[Stream[IO, Event]](Stream.empty))
instanceRef <- Resource.eval(SignallingRef[IO].of[String](""))

liveButton <- button(
`type` := "button",
"LIVE",
styleAttr <-- liveRef.map{
case true => "background-color: #db2a30"
case false => "background-color: #FFFFFF"
},
onClick(_ => {
for {
//TODO "disabling/greying out" endtime button when live so visually looks like its not being used?
live <- liveRef.updateAndGet(bool => !bool)

_ <- if (!live) {
//going from live to not live: visually it'll look like the canvas stopped moving
//so endtime should just be where we left off
endRef.update(t => LocalDateTime.now(ZoneOffset.UTC))
// liveButton <- button(
// `type` := "button",
// "LIVE",
// styleAttr <-- liveRef.map{
// case true => "background-color: #db2a30"
// case false => "background-color: #FFFFFF"
// },
// onClick(_ => {
// for {
// //TODO "disabling/greying out" endtime button when live so visually looks like its not being used?
// live <- liveRef.updateAndGet(bool => !bool)

// _ <- if (!live) {
// //going from live to not live: visually it'll look like the canvas stopped moving
// //so endtime should just be where we left off
// endRef.update(_ => LocalDateTime.now(ZoneOffset.UTC))

} else {
IO.unit
}

// start <- startRef.get

//if I just have params take liveref, then changes to liveref should trigger a change right?
// _ <- if (live) {
// startRef.set(start)
// // events.set(ec.getEvents(start.toString()))
// } else {
// //updating endRef already calls getevents correctly, so I dont think I need it again
// //events.set(ec.getEvents(start.toString(), end.toString()))
// IO.unit
// }
// } else {
// IO.unit
// }

// // start <- startRef.get

// //if I just have params take liveref, then changes to liveref should trigger a change right?
// // _ <- if (live) {
// // startRef.set(start)
// // // events.set(ec.getEvents(start.toString()))
// // } else {
// // //updating endRef already calls getevents correctly, so I dont think I need it again
// // //events.set(ec.getEvents(start.toString(), end.toString()))
// // IO.unit
// // }

} yield ()
})
)
// } yield ()
// })
// )

updateSource<- button(
`type` := "button",
Expand All @@ -88,7 +88,6 @@ object Main extends IOWebApp {
for {
start <- startRef.get
end <- endRef.get
inst <- instanceRef.get
_ <- liveRef.set(false)
_ <- pickedStart.set(start)
_ <- pickedEnd.set(end)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class TimeRangeComponent(
def render: Resource[IO, HtmlElement[IO]] =
for {
start <- Resource.eval(startRef.get)
end <- Resource.eval(endRef.get)


startInput <- div(
idAttr := "start-time",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package latis.logviz
import cats.effect.IO
import cats.effect.Resource
import cats.effect.kernel.Ref
import cats.syntax.all._
import calico.html.io.{*, given}
import fs2.dom.HtmlElement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ object SplunkClient {
m.get("latest").flatMap(_.toLongOption)
).tupled
}.mapFilter(identity).pure
case Left(err) =>
case Left(_) =>
IO.raiseError(new Exception("Source enumeration was unable to be parsed from JSON"))
}
}
Expand Down
Loading