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 5 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
30 changes: 29 additions & 1 deletion Composer/packages/client/src/pages/botProject/PublishTargets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
// Licensed under the MIT License.

/** @jsx jsx */
import React, { Fragment, useState, useEffect } from 'react';
import React, { Fragment, useState, useEffect, useCallback } from 'react';
import { jsx, css } from '@emotion/core';
import { useRecoilValue } from 'recoil';
import { PublishTarget } from '@bfc/shared';
import formatMessage from 'format-message';
import { ActionButton } from 'office-ui-fabric-react/lib/Button';
import { FontWeights } from 'office-ui-fabric-react/lib/Styling';
import { SharedColors } from '@uifabric/fluent-theme';
import { OpenConfirmModal } from '@bfc/ui-shared';

import { dispatcherState, settingsState, publishTypesState } from '../../recoilModel';
import { CollapsableWrapper } from '../../components/CollapsableWrapper';
Expand Down Expand Up @@ -83,6 +84,23 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
}
}, [scrollToSectionId]);

const onDeletePublishTarget = async (publishTarget: PublishTarget) => {
if (publishTargets) {
const targetName = publishTarget.name;
const confirmed = await OpenConfirmModal(
formatMessage('Delete?'),
formatMessage(
'Are you sure you want to remove {targetName}? This will remove only the profile and will not delete provisioned resources.',
{ targetName }
)
);
if (confirmed) {
const newPublishTargets = publishTargets.filter((t) => t.name !== targetName);
setPublishTargets(newPublishTargets, projectId);
}
}
};

return (
<Fragment>
<CollapsableWrapper title={formatMessage('Publish profiles')} titleStyle={title}>
Expand All @@ -103,6 +121,7 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
</div>
<div css={tableRowItem(columnSizes[2])}>
<ActionButton
data-testid={'editPublishProfile'}
styles={editPublishProfile}
onClick={() => {
setCurrent({ item: p, index: index });
Expand All @@ -116,6 +135,15 @@ export const PublishTargets: React.FC<PublishTargetsProps> = (props) => {
{formatMessage('Edit')}
</ActionButton>
</div>
<div css={tableRowItem(columnSizes[2])}>
<ActionButton
data-testid={'deletePublishProfile'}
styles={editPublishProfile}
onClick={() => onDeletePublishTarget(p)}
Comment thread
GeoffCoxMSFT marked this conversation as resolved.
>
{formatMessage('Delete')}
</ActionButton>
</div>
</div>
);
})}
Expand Down
6 changes: 6 additions & 0 deletions Composer/packages/server/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@
"are_you_sure_you_want_to_remove_propertyname_8a793e4f": {
"message": "Are you sure you want to remove \"{ propertyName }\"?"
},
"are_you_sure_you_want_to_remove_targetname_this_wi_b3ddce54": {
"message": "Are you sure you want to remove { targetName }? This will remove only the profile and will not delete provisioned resources."
},
"are_you_sure_you_want_to_remove_this_property_5bfb9cb5": {
"message": "Are you sure you want to remove this property?"
},
Expand Down Expand Up @@ -962,6 +965,9 @@
"delete_bot_73586104": {
"message": "Delete Bot"
},
"delete_fd07d6ad": {
"message": "Delete?"
},
"delete_form_dialog_schema_c8e28229": {
"message": "Delete form dialog schema?"
},
Expand Down