Commit 3e529e77 authored by Marek Veselý's avatar Marek Veselý
Browse files

Merge branch '1004-new-view' into 'main'

Analyst Activity Log page improvements

See merge request inject/frontend!890
parents d5ede11d 700421f9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
    "@tanstack/react-router": "^1.109.2",
    "d3-array": "^3.2.4",
    "d3-axis": "^3.0.0",
    "d3-brush": "^3.0.0",
    "d3-format": "^3.1.0",
    "d3-hierarchy": "^3.1.2",
    "d3-polygon": "^3.0.1",
@@ -64,7 +63,6 @@
    "@types/d3": "^7.4.3",
    "@types/d3-array": "^3.2.1",
    "@types/d3-axis": "^3.0.6",
    "@types/d3-brush": "^3.0.6",
    "@types/d3-format": "^3.0.4",
    "@types/d3-hierarchy": "^3",
    "@types/d3-polygon": "^3",
+19 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ import { ActionLogIcon } from '../ActionLogTitle/ActionLogIcon'
import useActionLogs from '../dataHooks/useActionLogs'
import { useTools } from '../dataHooks/useTools'
import type { SelectedAction, SelectedState } from '../Overview/selectedReducer'
import type { TimeRange } from '../Plots/TimeScatterPlot/types'

const centerChildren = css`
  display: flex;
@@ -30,6 +31,8 @@ interface ActionLogProps {
  teamLimit?: number
  displayAction: DisplayActionType
  teamIds: string[]
  selectedTimeRange: TimeRange
  earliestStartTime: number
}

export const ActionLog: FC<ActionLogProps> = ({
@@ -38,16 +41,26 @@ export const ActionLog: FC<ActionLogProps> = ({
  teamLimit,
  displayAction,
  teamIds,
  selectedTimeRange,
  earliestStartTime,
}) => {
  const tools = useTools()

  const actionLogs = useActionLogs({ teamLimit, teamIds }).filter(actionLog =>
  const actionLogs = useActionLogs({ teamLimit, teamIds })
    .filter(actionLog =>
      displayActionFilter({
        actionLog,
        displayAction,
        tools,
      })
    )
    .filter(actionLog => {
      const actionLogTime = new Date(actionLog.timestamp).getTime()
      return (
        actionLogTime >= earliestStartTime + selectedTimeRange.rangeStart &&
        actionLogTime <= earliestStartTime + selectedTimeRange.rangeEnd
      )
    })

  const getHandleClick = useCallback(
    (actionLog: IAnalystActionLogSimple) => () =>
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@ export const displayActionFilter = ({
}): boolean => {
  const { team, details, logType } = actionLog

  if (!displayAction.all) {
  // if displayAction.all === null, displayAction.all is not used
  if (displayAction.all === false) {
    return false
  }
  if (!displayAction.types[ACTION_TYPES.indexOf(logType)]) {
+2 −2
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ export const ActionLogOptions: FC<ActionLogOptionsProps> = ({
  )

  const filters = (() => {
    if (displayAuto && setDisplayAuto) {
    if (displayAuto && setDisplayAuto && displayAction.all !== null) {
      return (
        <>
          <Checkbox
@@ -207,7 +207,7 @@ export const ActionLogOptions: FC<ActionLogOptionsProps> = ({

  const setAllDisplayStates = (state: boolean) => {
    setDisplayAction(prev => ({
      all: state,
      all: prev.all === null ? null : state,
      types: prev.types.map(() => state),
      email: {
        sent: state,
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ export type DisplayAutoType = {
}

export type DisplayActionType = {
  all: boolean
  all: boolean | null // use null when only using DisplayAction (without DisplayAuto)
  types: boolean[]
  email: {
    sent: boolean
Loading