Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions Composer/packages/client/src/pages/botProject/AllowedCallers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ const ItemContainer = styled.div({
});

type ItemProps = {
index: number;
value: string;
onBlur: () => void;
onChange: (event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => void;
onRemove: () => void;
};

const Item = React.memo(({ value, onBlur, onChange, onRemove }: ItemProps) => {
const Item = React.memo(({ index, value, onBlur, onChange, onRemove }: ItemProps) => {
const itemRef = React.useRef<ITextField | null>(null);
const didMount = React.useRef<boolean>(false);

Expand All @@ -75,8 +76,9 @@ const Item = React.memo(({ value, onBlur, onChange, onRemove }: ItemProps) => {
}, []);

return (
<Stack horizontal verticalAlign={'center'}>
<Stack horizontal role="listitem" verticalAlign={'center'}>
<Input
ariaLabel={formatMessage('Item {index}: Allowed caller bot App ID', { index })}
componentRef={(ref) => (itemRef.current = ref)}
data-testid="addCallerInputField"
styles={textFieldStyles}
Expand All @@ -85,7 +87,7 @@ const Item = React.memo(({ value, onBlur, onChange, onRemove }: ItemProps) => {
onChange={onChange}
/>
<ActionButton
aria-label={formatMessage('Remove item')}
ariaLabel={formatMessage('Remove item {index}', { index })}
data-testid="addCallerRemoveBtn"
styles={actionButton}
onClick={onRemove}
Expand Down Expand Up @@ -178,9 +180,18 @@ export const AllowedCallers: React.FC<Props> = ({ projectId }) => {
}
)}
</div>
<ItemContainer>
<ItemContainer role="list">
{allowedCallers.map(({ value, id }, index) => {
return <Item key={id} value={value} onBlur={onBlur} onChange={onChange(index)} onRemove={onRemove(index)} />;
return (
<Item
key={id}
index={index + 1}
value={value}
onBlur={onBlur}
onChange={onChange(index)}
onRemove={onRemove(index)}
/>
);
})}
</ItemContainer>
{!allowedCallers.length && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const ABSChannels: React.FC<RuntimeSettingsProps> = (props) => {
const { setApplicationLevelError, requireUserLogin } = useRecoilValue(dispatcherState);
const currentUser = useRecoilValue(currentUserState);
const isAuthenticated = useRecoilValue(isAuthenticatedState);
const [selectedConnectionKey, setSelectedConnectionKey] = useState<string>('');

/* Copied from Azure Publishing extension */
const getSubscriptions = async (token: string): Promise<Array<Subscription>> => {
Expand All @@ -115,11 +116,15 @@ export const ABSChannels: React.FC<RuntimeSettingsProps> = (props) => {
}
};

const onSelectProfile = async (_, opt) => {
const isDropdownFocusEvent = (event: React.FormEvent<HTMLDivElement>) => event.type === 'focus';

const onSelectProfile = async (ev, opt) => {
if (opt.key === 'manageProfiles') {
if (isDropdownFocusEvent(ev)) return;
TelemetryClient.track('ConnectionsAddNewProfile');
navigateTo(`/bot/${projectId}/publish/all/#addNewPublishProfile`);
} else {
setSelectedConnectionKey(opt.key);
// identify the publishing profile in the list
const profile = publishTargets?.find((p) => p.name === opt.key);
if (profile) {
Expand Down Expand Up @@ -593,9 +598,11 @@ export const ABSChannels: React.FC<RuntimeSettingsProps> = (props) => {
)}
<div>
<Dropdown
ariaLabel={formatMessage('Select publishing profile')}
data-testid="publishTargetDropDown"
options={publishTargetOptions}
placeholder={formatMessage('Select publishing profile')}
selectedKey={selectedConnectionKey}
styles={{
root: { display: 'flex', alignItems: 'center', marginBottom: 10 },
label: { width: 200 },
Expand Down