forked from microsoft/BotFramework-Composer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added network and activity logs to Web Chat log panel (microsof…
…t#6638) * Added fadedWhenReadOnly option to JsonEditor * Added activity tracking and inspection panel * Plumbed data through to Web Chat inspection panel. * More style polish * Made inspector resizable and did some renames * Plumbed network response data into log * Fixed logging network responses to client * Condensed network and activity traffic into one socket * Consolidated network errors into traffic channel * Cleaned up types and recoil code * Factored out client code into smaller components * Only show error indicator when unread errors are present * Fixed client tests * Fixed server tests. * Removing old name directory * Adding back properly named dir * PR comments * Fixed timestamps * More PR comments addressed * Fixed tests * Addressed more PR comments * Fixed types * Added test for logNetworkTraffic * Fixed test. * Updated recoil dispatcher names to be consistent. * Added web chat state tests * Adjusted fonts in both log and inspector panes to match * Merge conflicts resolved Signed-off-by: Srinaath Ravichandran <[email protected]> * Smoothing out merge conflict * Moved network logging middleware to specific routes * Fixed attachment route tests. Co-authored-by: Ben Yackley <[email protected]> Co-authored-by: Srinaath Ravichandran <[email protected]> Co-authored-by: Dong Lei <[email protected]> Co-authored-by: Srinaath Ravichandran <[email protected]>
- Loading branch information
1 parent
6a4b903
commit 0dd130a
Showing
44 changed files
with
1,070 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...r/packages/client/src/pages/design/DebugPanel/TabExtensions/WebChatLog/LogItemHelpers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
/** @jsx jsx */ | ||
import { css, jsx } from '@emotion/core'; | ||
import { NeutralColors, SharedColors } from '@uifabric/fluent-theme'; | ||
|
||
const timestampStyle = css` | ||
color: ${SharedColors.green20}; | ||
padding-right: 6px; | ||
`; | ||
|
||
const timestampBracket = css` | ||
color: ${NeutralColors.gray130}; | ||
`; | ||
|
||
export const renderActivityArrow = (activity) => { | ||
if (activity?.recipient && activity.recipient.role === 'bot') { | ||
return <span>{'->'}</span>; | ||
} | ||
return <span>{'<-'}</span>; | ||
}; | ||
|
||
export const renderTimeStamp = (timestamp: number, appLocale: string) => { | ||
return ( | ||
<span css={timestampStyle}> | ||
<span css={timestampBracket}>[</span> | ||
{new Intl.DateTimeFormat(appLocale, { hour: '2-digit', minute: '2-digit', second: '2-digit' }).format(timestamp)} | ||
<span css={timestampBracket}>]</span> | ||
</span> | ||
); | ||
}; |
50 changes: 50 additions & 0 deletions
50
...es/client/src/pages/design/DebugPanel/TabExtensions/WebChatLog/WebChatActivityLogItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
/** @jsx jsx */ | ||
import { css, jsx } from '@emotion/core'; | ||
import { ConversationActivityTrafficItem } from '@botframework-composer/types'; | ||
import { useCallback } from 'react'; | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
import { WebChatInspectionData } from '../../../../../recoilModel/types'; | ||
import { userSettingsState } from '../../../../../recoilModel'; | ||
|
||
import { renderTimeStamp } from './LogItemHelpers'; | ||
import { clickableSegment, emphasizedText, hoverItem, logItem } from './logItemStyles'; | ||
|
||
const clickable = css` | ||
cursor: pointer; | ||
`; | ||
|
||
const renderActivityArrow = (activity) => { | ||
if (activity?.recipient?.role === 'bot') { | ||
return <span>{'->'}</span>; | ||
} | ||
return <span>{'<-'}</span>; | ||
}; | ||
|
||
type WebChatActivityLogItemProps = { | ||
index: number; | ||
item: ConversationActivityTrafficItem; | ||
isSelected?: boolean; | ||
onClickTraffic: (data: WebChatInspectionData) => void; | ||
}; | ||
|
||
export const WebChatActivityLogItem: React.FC<WebChatActivityLogItemProps> = (props) => { | ||
const { index, item, isSelected = false, onClickTraffic } = props; | ||
const { appLocale } = useRecoilValue(userSettingsState); | ||
|
||
const onClick = useCallback(() => { | ||
onClickTraffic({ item }); | ||
}, [item, onClickTraffic]); | ||
|
||
return ( | ||
<span key={`webchat-activity-item-${index}`} css={[clickable, hoverItem(isSelected), logItem]} onClick={onClick}> | ||
{renderTimeStamp(item.timestamp, appLocale)} | ||
{renderActivityArrow(item.activity)} | ||
<span css={clickableSegment}>{item.activity.type || 'unknown'}</span> | ||
{item.activity.type === 'message' ? <span css={emphasizedText}>{item.activity.text}</span> : null} | ||
</span> | ||
); | ||
}; |
Oops, something went wrong.