This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
feat: show tunneling information notification when starting bot with remote skills #7611
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
91b6cef
add util to get device OS
a-b-r-o-w-n 29da0ae
add port to local publish result
a-b-r-o-w-n f68b953
add port to botEndpointsState
a-b-r-o-w-n b7d0d49
show ngrok notification when starting a bot with remote skills
a-b-r-o-w-n 60a5ffe
only show the remote skills notification onces per session per bot
a-b-r-o-w-n f4cd71b
update l10n file
a-b-r-o-w-n 56e239a
address feedback
a-b-r-o-w-n 6960f34
Merge branch 'main' into abrown/remote-skill-ngrok
a-b-r-o-w-n 713b571
update locale file after merge
a-b-r-o-w-n 49fc015
Merge branch 'main' into abrown/remote-skill-ngrok
a-b-r-o-w-n 61f05eb
Merge branch 'main' into abrown/remote-skill-ngrok
a-b-r-o-w-n a499590
fix failing test
a-b-r-o-w-n a1b313c
Merge branch 'main' into abrown/remote-skill-ngrok
hatpick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
106 changes: 106 additions & 0 deletions
106
Composer/packages/client/src/components/Notifications/TunnelingSetupNotification.tsx
This file contains hidden or 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,106 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| /** @jsx jsx */ | ||
| import { jsx, css } from '@emotion/core'; | ||
| import React from 'react'; | ||
| import formatMessage from 'format-message'; | ||
| import { IconButton, IButtonStyles } from 'office-ui-fabric-react/lib/Button'; | ||
| import { NeutralColors, FontSizes, FluentTheme } from '@uifabric/fluent-theme'; | ||
| import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
| import { FontWeights } from '@uifabric/styling'; | ||
|
|
||
| import { platform, OS } from '../../utils/os'; | ||
|
|
||
| import { CardProps } from './NotificationCard'; | ||
|
|
||
| const container = css` | ||
| padding: 0 16px 16px 40px; | ||
| position: relative; | ||
| `; | ||
|
|
||
| const commandContainer = css` | ||
| display: flex; | ||
| flex-flow: row nowrap; | ||
| position: relative; | ||
| padding: 4px 28px 4px 8px; | ||
| background-color: ${NeutralColors.gray20}; | ||
| line-height: 22px; | ||
| margin: 1rem 0; | ||
| `; | ||
|
|
||
| const copyContainer = css` | ||
| margin: 0; | ||
| margin-bottom: 4px; | ||
| font-size: ${FontSizes.size16}; | ||
| font-weight: ${FontWeights.semibold}; | ||
| `; | ||
|
|
||
| const copyIconColor = FluentTheme.palette.themeDark; | ||
| const copyIconStyles: IButtonStyles = { | ||
| root: { position: 'absolute', right: 0, color: copyIconColor, height: '22px' }, | ||
| rootHovered: { backgroundColor: 'transparent', color: copyIconColor }, | ||
| rootPressed: { backgroundColor: 'transparent', color: copyIconColor }, | ||
| }; | ||
|
|
||
| const linkContainer = css` | ||
| margin: 0; | ||
| `; | ||
|
|
||
| const getNgrok = () => { | ||
| const os = platform(); | ||
| if (os === OS.Windows) { | ||
| return 'ngrok.exe'; | ||
| } | ||
|
|
||
| return 'ngrok'; | ||
| }; | ||
|
|
||
| export const TunnelingSetupNotification: React.FC<CardProps> = (props) => { | ||
| const { title, data } = props; | ||
| const port = data?.port; | ||
| const command = `${getNgrok()} http ${port} --host-header=localhost`; | ||
|
|
||
| const copyLocationToClipboard = async () => { | ||
| try { | ||
| await window.navigator.clipboard.writeText(command); | ||
| } catch (e) { | ||
| // eslint-disable-next-line no-console | ||
| console.error('Something went wrong when trying to copy the command to clipboard.', e); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div css={container}> | ||
| <h2 css={copyContainer}>{title}</h2> | ||
| <p css={linkContainer}> | ||
| {formatMessage.rich('<a>Install ngrok</a> and run the following command to continue', { | ||
| a: ({ children }) => ( | ||
| <Link key="ngrok-download" href="https://ngrok.com/download" rel="noopener noreferrer" target="_blank"> | ||
| {children} | ||
| </Link> | ||
| ), | ||
| })} | ||
| </p> | ||
| <div css={commandContainer}> | ||
| {command} | ||
| <IconButton | ||
| ariaLabel={formatMessage('Copy command to clipboard')} | ||
| iconProps={{ iconName: 'Copy' }} | ||
| styles={copyIconStyles} | ||
| title={formatMessage('Copy command to clipboard')} | ||
| onClick={copyLocationToClipboard} | ||
| /> | ||
| </div> | ||
| <p css={linkContainer}> | ||
| <Link | ||
| href="https://docs.microsoft.com/en-us/composer/how-to-connect-to-a-skill" | ||
| rel="noopener noreferrer" | ||
| target="_blank" | ||
| > | ||
| {formatMessage('Learn more')} | ||
| </Link> | ||
| </p> | ||
| </div> | ||
| ); | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
41 changes: 8 additions & 33 deletions
41
Composer/packages/client/src/recoilModel/utils/fontUtil.ts
This file contains hidden or 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 hidden or 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,27 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { platform, OS } from '../os'; | ||
|
|
||
| describe('platform', () => { | ||
| it.each([ | ||
| [ | ||
| OS.Windows, | ||
| '5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) @bfc/electron-server/1.4.0-nightly.237625.d1378c6 Chrome/80.0.3987.165 Electron/8.2.4 Safari/537.36', | ||
| ], | ||
| [ | ||
| OS.MacOS, | ||
| '5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46', | ||
| ], | ||
| [ | ||
| OS.Linux, | ||
| 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36', | ||
| ], | ||
| [ | ||
| OS.Unix, | ||
| 'Mozilla/5.0 (X11; CrOS x86_64 13020.67.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36', | ||
| ], | ||
| ])('%s', (expectedOS, userAgentString) => { | ||
| expect(platform(userAgentString)).toBe(expectedOS); | ||
| }); | ||
| }); |
This file contains hidden or 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,30 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
a-b-r-o-w-n marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Licensed under the MIT License. | ||
|
|
||
| export enum OS { | ||
| Windows = 'Windows', | ||
| MacOS = 'MacOS', | ||
| Linux = 'Linux', | ||
| Unix = 'Unix', | ||
| Unknown = 'Unknown', | ||
| } | ||
|
|
||
| export function platform(userAgent: string = window.navigator.userAgent): OS { | ||
| if (userAgent.includes('Win')) { | ||
| return OS.Windows; | ||
| } | ||
|
|
||
| if (userAgent.includes('Mac')) { | ||
| return OS.MacOS; | ||
| } | ||
|
|
||
| if (userAgent.includes('Linux')) { | ||
| return OS.Linux; | ||
| } | ||
|
|
||
| if (userAgent.includes('X11')) { | ||
| return OS.Unix; | ||
| } | ||
|
|
||
| return OS.Unknown; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.