Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drtii 1557 min staff #1920

Merged
merged 103 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
9941f99
initial add min staff component
Aug 27, 2024
4779d05
Merge branch 'master' of github.com:UKHomeOffice/drt-v2 into DRTII-15…
Aug 27, 2024
4cbaeef
Changes to add min staff
Aug 30, 2024
eaee1b7
edit min staff
Aug 30, 2024
e4088f6
state change only min staff
Sep 2, 2024
b67c748
Adding updated version for drt react
Sep 2, 2024
530f6e6
update drt react and add port in montly staffing
Sep 3, 2024
1a26f95
updating updateAt with change in min staff roster
Sep 3, 2024
95ed4b5
merge master
Sep 4, 2024
b3e6a2a
Separating update alert box
Sep 5, 2024
1574037
reposition staff update page
Sep 6, 2024
e2545b6
adding cancel and refresh button
Sep 9, 2024
bc49aa4
DRTII-1557 Min staff end point return updated shifts. Detect update &…
richbirch Sep 10, 2024
9e4e3c0
getting update to work with confirm on monthly staff
Sep 11, 2024
d0a1837
tidy up changes
Sep 11, 2024
7142cd3
fixing unit test
Sep 11, 2024
2381097
merge master
Sep 11, 2024
2403d57
remove commented
Sep 11, 2024
ec8510f
add handler for alert update min staff banner
Sep 12, 2024
e3f3e86
moving ShouldShowMinStaffSuccessBanner to monthly banner
Sep 12, 2024
1c58f70
changing text for min staff
Sep 13, 2024
f2b7948
Drtii 1557 min staff monthly staffing data (#1921)
richbirch Sep 16, 2024
cdff1dc
add Staff Shift form
Sep 20, 2024
69d3aeb
merge master
Sep 23, 2024
bce835d
merge master
Sep 24, 2024
8fc9712
adding json serialisation for api for staff shift api
Sep 24, 2024
581a637
Merge branch 'master' of github.com:UKHomeOffice/drt-v2 into DRTII-15…
Sep 27, 2024
ae44217
Adding staff shift component
Oct 1, 2024
3619743
adding update edit shift
Oct 2, 2024
14256b4
editing staff with drawer
Oct 2, 2024
f277c74
update the edit shift staff
Oct 4, 2024
03534ad
DRTII-1603 Return all shifts on update (#1936)
richbirch Oct 7, 2024
625c78a
Adding dayofWeek
Oct 8, 2024
a683c1e
showing days of week in staff
Oct 8, 2024
9de84aa
adding weekly and daily staff view of planning
ngu04 Oct 10, 2024
5aa8f66
adding weekly controls for staffing
ngu04 Oct 11, 2024
6c6092c
adding previous and next for daily and monthly staff view
ngu04 Oct 11, 2024
e738b73
adding sticky header
ngu04 Oct 11, 2024
afdca41
fixing test
ngu04 Oct 11, 2024
b4ed6d4
fixing timezone
ngu04 Oct 14, 2024
1ea4524
fixing test
ngu04 Oct 14, 2024
c765878
removing min staff number
ngu04 Oct 14, 2024
01fbab3
fixing the column header
ngu04 Oct 14, 2024
5c1d29f
adding feature flag for staffing changes with edit form
ngu04 Oct 15, 2024
87d1a6f
fix FeatureFlagsControllerSpec the test
ngu04 Oct 15, 2024
12641b9
refactor duplicate changes
ngu04 Oct 15, 2024
5d00825
merging master
ngu04 Oct 16, 2024
dd509bf
feature flag for port to enable staffing changes
ngu04 Oct 16, 2024
a9380fb
Update drt-react with date format
ngu04 Oct 17, 2024
d436504
breaking shift 15 mins
ngu04 Oct 21, 2024
d3f24ac
using key for updating
ngu04 Oct 21, 2024
88b08d1
adding shiftUtil for moving override logic
ngu04 Oct 21, 2024
e4d9bf3
Adding test for Split Util
ngu04 Oct 21, 2024
0a92f3b
adding 14 mins interval with 1 min break
ngu04 Oct 21, 2024
a21cac6
fixing test for shiftActor
ngu04 Oct 21, 2024
d8f636c
remove println
ngu04 Oct 22, 2024
89df090
remove sorted
ngu04 Oct 22, 2024
7275d9b
fix test without sort
ngu04 Oct 22, 2024
665776a
update shiftsSequentialWritesActor timeout 90 seconds
ngu04 Oct 22, 2024
cbb6e29
update timeout at drt module
ngu04 Oct 22, 2024
5e10345
adding multiple
ngu04 Oct 22, 2024
052861f
chaning retrievla interval
ngu04 Oct 22, 2024
a9e08e0
removing multiple shifts-actor-writes
ngu04 Oct 22, 2024
23a9ebe
se parallel collections to process
ngu04 Oct 22, 2024
e645007
trying terminal hash
ngu04 Oct 22, 2024
2f36c96
one stop backoff from 30 to 60
ngu04 Oct 23, 2024
0f0c0e0
updating logic for filter terminal check
ngu04 Oct 23, 2024
a8294ba
updating shift sorucecall for understand delay
ngu04 Oct 23, 2024
2fbc607
batch process process recovery for shift actor
ngu04 Oct 23, 2024
3674018
reducing snapshot to 500 for shiftactor
ngu04 Oct 23, 2024
96b2a6f
reducing snapshot to 10 which is temp
ngu04 Oct 24, 2024
6df5b55
Update drt remove async persist call
ngu04 Oct 25, 2024
47fd8a1
updating submode default to an hour for staffing
ngu04 Oct 25, 2024
8c6a49f
few of review comment changes
ngu04 Oct 28, 2024
1fc5333
update logic to update shift
ngu04 Oct 28, 2024
906be86
fixing key for StaffAssignment
ngu04 Oct 28, 2024
e768e0a
few of review comment changes
ngu04 Oct 29, 2024
1c6774b
Adding test for almost 18k shiftsassignment
ngu04 Oct 29, 2024
9138e60
moving consecutive days to util
ngu04 Oct 29, 2024
6105211
fixing weekly and daily staff
ngu04 Oct 29, 2024
e53f585
adding interval base edit form and form style change
ngu04 Oct 30, 2024
1d0e5a1
Drtii 1557 min staff update shifts optimal solution (#1943)
ngu04 Oct 30, 2024
14f7791
adding weekly and daily rolling option in calender
ngu04 Oct 31, 2024
12b4e1e
fixing styling for staffing
ngu04 Nov 1, 2024
d614728
update react component
ngu04 Nov 4, 2024
922dd9f
removing StaffShiftFormService
ngu04 Nov 4, 2024
2931c54
remove PortTerminal Shift reference
ngu04 Nov 4, 2024
e05dbe4
remove temp border added
ngu04 Nov 4, 2024
9bd4e49
making marging left 20 px
ngu04 Nov 4, 2024
2f1840c
update changes
ngu04 Nov 5, 2024
15ae954
review comment changes
ngu04 Nov 5, 2024
29b1099
remove isweekly and isdaily boolean param
ngu04 Nov 5, 2024
b0c7463
rename EditShiftStaffForm to UpdateStaffForTimeRangeForm
ngu04 Nov 5, 2024
735b532
DRTII-1557 Correct test name
richbirch Nov 5, 2024
0ac7712
update setting
ngu04 Nov 5, 2024
36ba7a7
Merge branch 'DRTII-1557-min-staff' of github.com:UKHomeOffice/drt-v2…
ngu04 Nov 5, 2024
88251e6
fixing e2e
ngu04 Nov 5, 2024
13c598e
update prevent to failing test
ngu04 Nov 6, 2024
5ec793d
waiting for saveshift to complete
ngu04 Nov 6, 2024
829a364
temp adding wait
ngu04 Nov 6, 2024
8b2eca4
update react component
ngu04 Nov 6, 2024
5dd62ae
update react version 1.5.4
ngu04 Nov 6, 2024
7214e05
merge master
ngu04 Nov 6, 2024
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
17,064 changes: 2,908 additions & 14,156 deletions client/package-lock.json

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions client/src/main/scala/drt/client/SPAMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ object SPAMain {
}
}

object UrlDayRangeType {
val paramName = "dayRange"

def apply(viewType: Option[String]): UrlParameter = new UrlParameter {
override val name: String = paramName
override val value: Option[String] = viewType
}
}


case class PortConfigPageLoc()


object TerminalPageTabLoc {
val hashValue: String = "#terminal"

Expand Down Expand Up @@ -131,6 +144,7 @@ object SPAMain {
override def title(maybeTerminal: Option[Terminal]): String = title(pageName, maybeTerminal)

val terminal: Terminal = Terminal(terminalName)
def dayRangeType = queryParams.get(UrlDayRangeType.paramName)
val maybeViewDate: Option[LocalDate] = queryParams.get(UrlDateParameter.paramName)
.filter(_.matches(".+"))
.flatMap(dateStr => Try {
Expand All @@ -145,7 +159,6 @@ object SPAMain {
val deskType: DeskType = queryParams.get(UrlViewType.paramName).map(vt => if (Ideal.queryParamsValue == vt) Ideal else Deployments).getOrElse(Deployments)
val displayAs: DisplayType = queryParams.get(UrlDisplayType.paramName).map(vt => if (TableView.queryParamsValue == vt) TableView else ChartsView).getOrElse(TableView)
val mode: TerminalPageMode = TerminalPageModes.fromString(modeStr)

def viewMode: ViewMode = {
(mode, maybeViewDate) match {
case (Current, Some(viewDate)) =>
Expand Down Expand Up @@ -180,7 +193,7 @@ object SPAMain {

def loadAction: Action = mode match {
case Staffing =>
GetShiftsForMonth(dateFromUrlOrNow)
GetAllShifts
case _ =>
SetViewMode(viewMode)
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/scala/drt/client/actions/Actions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ object Actions {

case class GetShifts(viewMode: ViewMode) extends Action

case class SetShiftsForMonth(shiftsForMonth: MonthOfShifts) extends Action
case class SetAllShifts(allShifts: ShiftAssignments) extends Action

case class GetShiftsForMonth(month: SDateLike) extends Action
case object GetAllShifts extends Action

case class UpdateShifts(shiftsToUpdate: Seq[StaffAssignment]) extends Action

Expand Down
2 changes: 1 addition & 1 deletion client/src/main/scala/drt/client/components/Debug.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object Debug {
.render_P { _ =>
val staffingRCP = SPACircuit.connect(
m => (
m.shifts,
m.dayOfShifts,
m.fixedPoints,
m.staffMovements,
m.portStatePot,
Expand Down
106 changes: 62 additions & 44 deletions client/src/main/scala/drt/client/components/HotTable.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package drt.client.components

import drt.client.logger.{Logger, LoggerFactory}
import japgolly.scalajs.react.component.Js.Component
import japgolly.scalajs.react.{Children, CtorType, JsComponent}
import drt.shared.CrunchApi.MillisSinceEpoch
import japgolly.scalajs.react.callback.Callback
import japgolly.scalajs.react.component.Js.{Component, RawMounted, UnmountedWithRawType}
import japgolly.scalajs.react.component.Scala.Unmounted
import japgolly.scalajs.react.{Children, CtorType, JsComponent, Reusability, ScalaComponent}

import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
Expand All @@ -14,58 +17,73 @@ object HotTable {

@JSImport("@handsontable/react", JSImport.Default)
@js.native
object HotTableComponent extends js.Object
private object HotTableComponent extends js.Object

@js.native
trait Props extends js.Object {
trait RawProps extends js.Object {
var settings: js.Dictionary[js.Any] = js.native
}

def props(data: Seq[Seq[Any]],
colHeadings: Seq[String],
rowHeadings: Seq[String],
changeCallback: (Int, Int, Int) => Unit,
colWidths: String = "2em"
): Props = {
case class Props(data: Seq[Seq[Any]],
colHeadings: Seq[String],
rowHeadings: Seq[String],
changeCallback: (Int, Int, Int) => Unit,
colWidths: String = "2em",
lastDataRefresh: MillisSinceEpoch,
) {
val raw: RawProps = {
import js.JSConverters._

import js.JSConverters._

val props = (new js.Object).asInstanceOf[Props]
val afterChange = (changes: js.Array[js.Array[Any]], _: String) => {
val maybeArray = Option(changes)
maybeArray.foreach(
c => {
c.toList.foreach(change =>
(change(0), change(1), change(3)) match {
case (row: Int, col: Int, value: String) =>
Try(Integer.parseInt(value)) match {
case Success(v) =>
changeCallback(row, col, v)
case Failure(f) =>
log.warn(s"Couldn't parse $value to an Integer $f")
}
case (row: Int, col: Int, value: Int) =>
changeCallback(row, col, value)
case other =>
log.error(s"couldn't match $other")
}
)
})
if (maybeArray.isEmpty) {
log.info(s"Called change function with no values")
val props = (new js.Object).asInstanceOf[RawProps]
val afterChange = (changes: js.Array[js.Array[Any]], _: String) => {
val maybeArray = Option(changes)
maybeArray.foreach(
c => {
c.toList.foreach(change =>
(change(0), change(1), change(3)) match {
case (row: Int, col: Int, value: String) =>
Try(Integer.parseInt(value)) match {
case Success(v) =>
changeCallback(row, col, v)
case Failure(f) =>
log.warn(s"Couldn't parse $value to an Integer $f")
}
case (row: Int, col: Int, value: Int) =>
changeCallback(row, col, value)
case other =>
log.error(s"couldn't match $other")
}
)
})
if (maybeArray.isEmpty) {
log.info(s"Called change function with no values")
}
}

props.settings = js.Dictionary(
"data" -> data.map(_.toJSArray).toJSArray,
"rowHeaders" -> rowHeadings.toJSArray,
"colHeaders" -> colHeadings.toJSArray,
"afterChange" -> afterChange,
"colWidth" -> colWidths
)

props
}
}

props.settings = js.Dictionary(
"data" -> data.map(_.toJSArray).toJSArray,
"rowHeaders" -> rowHeadings.toJSArray,
"colHeaders" -> colHeadings.toJSArray,
"afterChange" -> afterChange,
"colWidth" -> colWidths
)
implicit val propsReuse: Reusability[Props] = Reusability((a, b) => a.lastDataRefresh == b.lastDataRefresh)

props
class Backend {
def render(props: Props): UnmountedWithRawType[RawProps, Null, RawMounted[RawProps, Null]] = rawComponent(props.raw)
}

val component: Component[Props, Null, CtorType.Props] = JsComponent[Props, Children.None, Null](HotTableComponent)
val rawComponent: Component[RawProps, Null, CtorType.Props] = JsComponent[RawProps, Children.None, Null](HotTableComponent)

val component = ScalaComponent.builder[Props]("HotTable")
.renderBackend[Backend]
.configure(Reusability.shouldComponentUpdate)
.build

def apply(props: Props): Unmounted[Props, Unit, Backend] = component(props)
}
Loading