diff --git a/console/client/src/components/AttributeBadge.tsx b/console/client/src/components/AttributeBadge.tsx new file mode 100644 index 0000000000..2765d6cb5d --- /dev/null +++ b/console/client/src/components/AttributeBadge.tsx @@ -0,0 +1,14 @@ +interface Props { + name: string + value: string +} + +export const AttributeBadge = ({ name, value }: Props) => { + return ( + + {name} + : + {value} + + ) +} diff --git a/console/client/src/components/Card.tsx b/console/client/src/components/Card.tsx new file mode 100644 index 0000000000..e153026120 --- /dev/null +++ b/console/client/src/components/Card.tsx @@ -0,0 +1,6 @@ +interface Props { + children: React.ReactNode +} +export const Card = ({ children }: Props) => { + return
{children}
+} diff --git a/console/client/src/components/CloseButton.tsx b/console/client/src/components/CloseButton.tsx new file mode 100644 index 0000000000..6d83c9d796 --- /dev/null +++ b/console/client/src/components/CloseButton.tsx @@ -0,0 +1,13 @@ +import { XMarkIcon } from '@heroicons/react/24/outline' + +interface Props { + onClick: () => void +} + +export const CloseButton = ({ onClick }: Props) => { + return ( + + ) +} diff --git a/console/client/src/features/timeline/details/TimelineCallDetails.tsx b/console/client/src/features/timeline/details/TimelineCallDetails.tsx index c0db91b8ba..b91e9fc55f 100644 --- a/console/client/src/features/timeline/details/TimelineCallDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineCallDetails.tsx @@ -1,12 +1,14 @@ import { Timestamp } from '@bufbuild/protobuf' -import { useEffect, useState } from 'react' +import React, { useEffect, useState } from 'react' +import { AttributeBadge } from '../../../components/AttributeBadge' +import { CloseButton } from '../../../components/CloseButton' import { CodeBlock } from '../../../components/CodeBlock' import { useClient } from '../../../hooks/use-client' import { ConsoleService } from '../../../protos/xyz/block/ftl/v1/console/console_connect' import { Call } from '../../../protos/xyz/block/ftl/v1/console/console_pb' +import { SidePanelContext } from '../../../providers/side-panel-provider' import { getRequestCalls } from '../../../services/console.service' import { formatDuration } from '../../../utils/date.utils' -import { textColor } from '../../../utils/style.utils' import { RequestGraph } from '../../requests/RequestGraph' import { verbRefString } from '../../verbs/verb.utils' import { TimelineTimestamp } from './TimelineTimestamp' @@ -18,6 +20,7 @@ interface Props { export const TimelineCallDetails = ({ timestamp, call }: Props) => { const client = useClient(ConsoleService) + const { closePanel } = React.useContext(SidePanelContext) const [requestCalls, setRequestCalls] = useState([]) const [selectedCall, setSelectedCall] = useState(call) @@ -38,21 +41,25 @@ export const TimelineCallDetails = ({ timestamp, call }: Props) => { }, [client, selectedCall]) return ( - <> - - -
- +
+
+
+
+ {call.destinationVerbRef && ( +
+ {verbRefString(call.destinationVerbRef)} +
+ )} +
+ +
+
- {call.destinationVerbRef && ( -
- {verbRefString(call.destinationVerbRef)} -
- )} +
Request
@@ -68,40 +75,29 @@ export const TimelineCallDetails = ({ timestamp, call }: Props) => { )} -
-
-
Deployment
-
{selectedCall.deploymentName}
-
-
-
Request
-
{selectedCall.requestName}
-
-
-
Duration
-
{formatDuration(selectedCall.duration)}
-
-
-
Module
-
{selectedCall.destinationVerbRef?.module}
-
-
-
Verb
-
{selectedCall.destinationVerbRef?.name}
-
- {selectedCall.sourceVerbRef?.module && ( - <> -
-
Source module
-
{selectedCall.sourceVerbRef?.module}
-
-
-
Source verb
-
{selectedCall.sourceVerbRef?.name}
-
- +
    +
  • + +
  • + {selectedCall.requestName && ( +
  • + +
  • )} -
- +
  • + +
  • + {selectedCall.destinationVerbRef && ( +
  • + +
  • + )} + {selectedCall.sourceVerbRef && ( +
  • + +
  • + )} + +
    ) } diff --git a/console/client/src/features/timeline/details/TimelineDeploymentDetails.tsx b/console/client/src/features/timeline/details/TimelineDeploymentDetails.tsx index 19fb65de32..7aa2fd8f3b 100644 --- a/console/client/src/features/timeline/details/TimelineDeploymentDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineDeploymentDetails.tsx @@ -1,7 +1,10 @@ import { Timestamp } from '@bufbuild/protobuf' +import React from 'react' +import { AttributeBadge } from '../../../components/AttributeBadge' +import { CloseButton } from '../../../components/CloseButton' import { Deployment, DeploymentEventType, Event } from '../../../protos/xyz/block/ftl/v1/console/console_pb' +import { SidePanelContext } from '../../../providers/side-panel-provider' import { classNames } from '../../../utils/react.utils' -import { textColor } from '../../../utils/style.utils' import { TimelineTimestamp } from './TimelineTimestamp' interface Props { @@ -16,55 +19,61 @@ export const deploymentTypeText: { [key in DeploymentEventType]: string } = { [DeploymentEventType.DEPLOYMENT_REPLACED]: 'Replaced', } +export const deploymentTypeBarColor: { [key in DeploymentEventType]: string } = { + [DeploymentEventType.DEPLOYMENT_UNKNOWN]: '', + [DeploymentEventType.DEPLOYMENT_CREATED]: 'bg-green-500 dark:bg-green-300', + [DeploymentEventType.DEPLOYMENT_UPDATED]: 'bg-blue-500 dark:bg-blue-300', + [DeploymentEventType.DEPLOYMENT_REPLACED]: 'bg-indigo-600 dark:bg-indigo-300', +} + export const deploymentTypeBadge: { [key in DeploymentEventType]: string } = { [DeploymentEventType.DEPLOYMENT_UNKNOWN]: '', - [DeploymentEventType.DEPLOYMENT_CREATED]: 'text-green-600 bg-green-400/30 dark:text-green-300 dark:bg-green-700/10', - [DeploymentEventType.DEPLOYMENT_UPDATED]: 'text-blue-350 bg-blue-300/30 dark:text-blue-300 dark:bg-blue-700/30', + [DeploymentEventType.DEPLOYMENT_CREATED]: 'text-green-500 bg-green-400/30 dark:text-green-300 dark:bg-green-700/10', + [DeploymentEventType.DEPLOYMENT_UPDATED]: 'text-blue-500 bg-blue-300/30 dark:text-blue-300 dark:bg-blue-700/30', [DeploymentEventType.DEPLOYMENT_REPLACED]: - 'text-indigo-600 bg-indigo-400/30 dark:text-indigo-300 dark:bg-indigo-700/10', + 'text-indigo-600 bg-indigo-400/30 dark:text-indigo-300 dark:bg-indigo-700/50', } export const TimelineDeploymentDetails = ({ event, deployment }: Props) => { + const { closePanel } = React.useContext(SidePanelContext) return ( <> -
    - -
    +
    +
    +
    +
    + + {deploymentTypeText[deployment.eventType]} + + +
    + +
    -
    - +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + {deployment.replaced && ( +
  • + +
  • )} - > - {deploymentTypeText[deployment.eventType]} -
    -
    - -
    -
    -
    Name
    -
    {deployment.name}
    -
    -
    -
    Module
    -
    {deployment.moduleName}
    -
    -
    -
    Language
    -
    {deployment.language}
    -
    -
    -
    Min replicas
    -
    {deployment.minReplicas}
    -
    - {deployment.replaced && ( -
    -
    Replaced
    -
    {deployment.replaced}
    -
    - )} +
    ) diff --git a/console/client/src/features/timeline/details/TimelineLogDetails.tsx b/console/client/src/features/timeline/details/TimelineLogDetails.tsx index 08779c9623..595b85476b 100644 --- a/console/client/src/features/timeline/details/TimelineLogDetails.tsx +++ b/console/client/src/features/timeline/details/TimelineLogDetails.tsx @@ -1,8 +1,13 @@ import { Timestamp } from '@bufbuild/protobuf' +import React from 'react' +import { AttributeBadge } from '../../../components/AttributeBadge' +import { CloseButton } from '../../../components/CloseButton' import { CodeBlock } from '../../../components/CodeBlock' import { Event, LogEntry } from '../../../protos/xyz/block/ftl/v1/console/console_pb' +import { SidePanelContext } from '../../../providers/side-panel-provider' import { textColor } from '../../../utils/style.utils' import { LogLevelBadge } from '../../logs/LogLevelBadge' +import { logLevelBgColor } from '../../logs/log.utils' import { TimelineTimestamp } from './TimelineTimestamp' interface Props { @@ -11,41 +16,40 @@ interface Props { } export const TimelineLogDetails = ({ event, log }: Props) => { + const { closePanel } = React.useContext(SidePanelContext) return ( <> -
    - -
    -
    -

    {log.message}

    -
    - -

    Attributes

    - - -
    -
    -
    Level
    -
    +
    +
    +
    +
    -
    + +
    +
    -
    -
    Deployment
    -
    {log.deploymentName}
    +
    +

    {log.message}

    - {log.requestName && ( -
    -
    Request
    -
    {log.requestName}
    -
    - )} - {log.error && ( -
    -
    Error
    -
    {log.error}
    -
    - )} + +

    Attributes

    + + +
      +
    • + +
    • + {log.requestName && ( +
    • + +
    • + )} + {log.error && ( +
    • + +
    • + )} +
    ) diff --git a/console/client/src/features/timeline/details/TimelineTimestamp.tsx b/console/client/src/features/timeline/details/TimelineTimestamp.tsx index e3e9d86cec..e237e76d5b 100644 --- a/console/client/src/features/timeline/details/TimelineTimestamp.tsx +++ b/console/client/src/features/timeline/details/TimelineTimestamp.tsx @@ -1,6 +1,6 @@ import { Timestamp } from '@bufbuild/protobuf' import { formatTimestampShort } from '../../../utils/date.utils' -import { lightTextColor } from '../../../utils/style.utils' +import { textColor } from '../../../utils/style.utils' interface Props { timestamp: Timestamp @@ -8,7 +8,7 @@ interface Props { export const TimelineTimestamp = ({ timestamp }: Props) => { return ( -