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 375
feature: new design for Connections setting pane #6724
Merged
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
84f3510
remodel Adapters section into new design
beyackle e542c41
better formatting
beyackle aa6a76a
Merge branch 'main' into beyackle/adapterRedesign
beyackle 0b3a0b7
fix table formatting
beyackle 6222fad
update l10n strings
beyackle d9e64d0
Update AdapterSection.tsx
beyackle c18a0b6
Merge branch 'main' into beyackle/adapterRedesign
beyackle 4707f1b
Update AdapterSection.tsx
beyackle 153ae2f
Merge branch 'main' into beyackle/adapterRedesign
beyackle b6c67a7
Merge branch 'main' into beyackle/adapterRedesign
beyackle 5a58937
Update AdapterSettings.test.tsx
beyackle 3307f6c
Merge branch 'main' into beyackle/adapterRedesign
beyackle 7aa4a9d
Merge branch 'main' into beyackle/adapterRedesign
beyackle baa3707
Merge branch 'beyackle/adapterRedesign' of https://github.com/microso…
beyackle f0e228b
Update en-US.json
beyackle 89e06b4
Merge branch 'main' into beyackle/adapterRedesign
beyackle f292369
Update en-US.json
beyackle a3e588f
Merge branch 'main' into beyackle/adapterRedesign
beyackle 1f74bda
Merge branch 'main' into beyackle/adapterRedesign
beyackle 95a760b
Update AdapterSettings.test.tsx
beyackle d49f77a
Merge branch 'beyackle/adapterRedesign' of https://github.com/microso…
beyackle 9184b19
Merge branch 'main' into beyackle/adapterRedesign
beyackle 1d65484
Merge branch 'main' into beyackle/adapterRedesign
beyackle 9ca87be
Merge branch 'main' into beyackle/adapterRedesign
beyackle 342e8e3
Merge branch 'main' into beyackle/adapterRedesign
beyackle 462de01
Merge branch 'main' into beyackle/adapterRedesign
beyackle 55afb03
address PR comments
beyackle 576ff54
Merge branch 'main' into beyackle/adapterRedesign
beyackle fa33de4
Merge branch 'main' into beyackle/adapterRedesign
tonyanziano 8fdef4b
Merge branch 'main' into beyackle/adapterRedesign
beyackle 80dd9dd
Merge branch 'main' into beyackle/adapterRedesign
cwhitten 232e76a
Merge branch 'main' into beyackle/adapterRedesign
beyackle 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,16 +8,12 @@ import formatMessage from 'format-message'; | |
| import { useRecoilValue } from 'recoil'; | ||
| import { BotSchemas, DialogSetting } from '@bfc/shared'; | ||
| import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
| import { Icon } from 'office-ui-fabric-react/lib/Icon'; | ||
| import { Toggle } from 'office-ui-fabric-react/lib/Toggle'; | ||
| import { IconButton } from 'office-ui-fabric-react/lib/Button'; | ||
| import { TooltipHost, DirectionalHint } from 'office-ui-fabric-react/lib/Tooltip'; | ||
| import { SharedColors } from '@uifabric/fluent-theme'; | ||
| import { JSONSchema7 } from '@botframework-composer/types'; | ||
|
|
||
| import { useRouterCache } from '../../../utils/hooks'; | ||
| import { schemasState, settingsState, dispatcherState } from '../../../recoilModel'; | ||
| import { subtitle, tableRow, tableRowItem, tableColumnHeader, columnSizes } from '../styles'; | ||
| import { subtitle, tableHeaderRow, tableRow, tableRowItem, tableColumnHeader, columnSizes } from '../styles'; | ||
|
|
||
| import AdapterModal, { AdapterRecord, hasRequired } from './ExternalAdapterModal'; | ||
|
|
||
|
|
@@ -40,40 +36,29 @@ const ExternalAdapterSettings = (props: Props) => { | |
| const { definitions: schemaDefinitions } = schemas?.sdk?.content ?? {}; | ||
| const uiSchemas = schemas?.ui?.content ?? {}; | ||
|
|
||
| const [currentModalProps, setModalProps] = useState< | ||
| { key: string; packageName: string; firstTime: boolean } | undefined | ||
| >(); | ||
| const [currentModalProps, setModalProps] = useState<{ key: string; packageName: string } | undefined>(); | ||
|
|
||
| const openModal = (key?: string, firstTime?: boolean, packageName?: string) => { | ||
| if (key == null || packageName == null || firstTime == null) { | ||
| const openModal = (key?: string, packageName?: string) => { | ||
| if (key == null || packageName == null) { | ||
| setModalProps(undefined); | ||
| } else { | ||
| setModalProps({ key, packageName, firstTime }); | ||
| setModalProps({ key, packageName }); | ||
| } | ||
| }; | ||
|
|
||
| if (schemaDefinitions == null) return null; | ||
|
|
||
| const externalServices = (schemas: (JSONSchema7 & { key: string; packageName?: string; firstTime?: boolean })[]) => ( | ||
| const externalServices = (schemas: (JSONSchema7 & { key: string; packageName?: string })[]) => ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are few places this type is being used { key: string; packageName?: string }. Maybe create a type to be used across files. In addition it looks like key always exist as a string and packageName could be undefined. There are places where it is indicated key and packageName could be optional. Could we make sure this type is consistent? |
||
| <div role="table"> | ||
| <div css={subtitle}> | ||
| {formatMessage.rich('Install more adapters in <a>the package manager</a>.', { | ||
| a: ({ children }) => ( | ||
| <Link key="subtitle-link" href={packageManagerLink}> | ||
| {children} | ||
| </Link> | ||
| ), | ||
| })} | ||
| </div> | ||
| <div css={tableRow} role="row"> | ||
| <div css={tableHeaderRow} role="row"> | ||
| <div css={tableColumnHeader(columnSizes[0])} role="columnheader"> | ||
| {formatMessage('Name')} | ||
| </div> | ||
| <div css={tableColumnHeader(columnSizes[1])} role="columnheader"> | ||
| {formatMessage('Configured')} | ||
| {formatMessage('Enabled')} | ||
| </div> | ||
| <div css={tableColumnHeader(columnSizes[2])} role="columnheader"> | ||
| {formatMessage('Enabled')} | ||
| {formatMessage('Configuration')} | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
@@ -92,23 +77,6 @@ const ExternalAdapterSettings = (props: Props) => { | |
| {title} | ||
| </div> | ||
| <div css={tableRowItem(columnSizes[1])} role="cell"> | ||
| {keyConfigured ? ( | ||
| <Icon | ||
| aria-label={formatMessage('Configured')} | ||
| iconName="CheckMark" | ||
| styles={{ root: { color: SharedColors.green10, fontSize: '18px' } }} | ||
| /> | ||
| ) : ( | ||
| <Link | ||
| key={key} | ||
| ariaLabel={formatMessage('Configure {title}', { title })} | ||
| onClick={() => openModal(key, true, packageName)} | ||
| > | ||
| {formatMessage('Configure')} | ||
| </Link> | ||
| )} | ||
| </div> | ||
| <div css={tableRowItem(columnSizes[2])} role="cell"> | ||
| <Toggle | ||
| ariaLabel={formatMessage('{title} connection', { title })} | ||
| checked={keyEnabled} | ||
|
|
@@ -133,31 +101,11 @@ const ExternalAdapterSettings = (props: Props) => { | |
| }} | ||
| /> | ||
| </div> | ||
| <TooltipHost content={formatMessage('Actions')} directionalHint={DirectionalHint.rightCenter}> | ||
| <IconButton | ||
| ariaLabel={formatMessage('Actions')} | ||
| className="dialog-more-btn" | ||
| data-testid="dialogMoreButton" | ||
| menuIconProps={{ iconName: 'MoreVertical' }} | ||
| menuProps={{ | ||
| items: [ | ||
| { | ||
| key: 'edit', | ||
| text: formatMessage('Edit'), | ||
| iconProps: { iconName: 'Edit' }, | ||
| onClick: () => openModal(key, false, packageName), | ||
| }, | ||
| ], | ||
| }} | ||
| role="cell" | ||
| styles={{ root: { paddingTop: '10px', paddingBottom: '10px' } }} | ||
| onKeyDown={(e) => { | ||
| if (e.key === 'Enter') { | ||
| e.stopPropagation(); | ||
| } | ||
| }} | ||
| /> | ||
| </TooltipHost> | ||
| <div css={tableRowItem(columnSizes[2])} role="cell"> | ||
| <Link key={key} onClick={() => openModal(key, packageName)}> | ||
|
beyackle marked this conversation as resolved.
Outdated
|
||
| {formatMessage('Configure')} | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| ); | ||
| })} | ||
|
|
@@ -175,11 +123,19 @@ const ExternalAdapterSettings = (props: Props) => { | |
| return ( | ||
| <Fragment> | ||
| <div data-testid="adapterSettings">{externalServices(adapterSchemas)}</div> | ||
| <div key={'subtitle'} css={subtitle}> | ||
| {formatMessage.rich('<a>Add from package manager</a>.', { | ||
| a: ({ children }) => ( | ||
| <Link key="link" href={packageManagerLink}> | ||
| {children} | ||
| </Link> | ||
| ), | ||
| })} | ||
| </div> | ||
| {currentKey != null && currentPackageName != null && schemaDefinitions[currentKey] != null && ( | ||
| <AdapterModal | ||
| isOpen | ||
| adapterKey={currentKey} | ||
| isFirstTime={currentModalProps?.firstTime ?? false} | ||
| packageName={currentPackageName} | ||
| projectId={projectId} | ||
| schema={schemaDefinitions[currentKey]} | ||
|
|
||
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.