Merge pull request #2420 from automatisch/AUT-1492
feat: disable moving flow to a folder
This commit is contained in:
@@ -13,6 +13,7 @@ import IconButton from '@mui/material/IconButton';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
import * as React from 'react';
|
||||
|
||||
import useFlow from 'hooks/useFlow';
|
||||
import useFolders from 'hooks/useFolders';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
import useFlowFolder from 'hooks/useFlowFolder';
|
||||
@@ -25,6 +26,8 @@ function FlowFolderChangeDialog(props) {
|
||||
const { data: folders, isLoading: isFoldersLoading } = useFolders();
|
||||
const { data: flowFolder, isLoading: isFlowFolderLoading } =
|
||||
useFlowFolder(flowId);
|
||||
const { data: flowData, isPending: isFlowPending } = useFlow(flowId);
|
||||
const flow = flowData?.data;
|
||||
|
||||
const [selectedFolder, setSelectedFolder] = React.useState(null);
|
||||
|
||||
@@ -88,7 +91,8 @@ function FlowFolderChangeDialog(props) {
|
||||
isOptionEqualToValue={(option, value) => option.id === value.id}
|
||||
getOptionLabel={(option) => option.name}
|
||||
loading={isFoldersLoading || isFlowFolderLoading}
|
||||
disabled={isFoldersLoading || isFlowFolderLoading}
|
||||
disabled={isFoldersLoading || isFlowFolderLoading || isFlowPending}
|
||||
readOnly={!flow?.isOwner}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
@@ -116,11 +120,18 @@ function FlowFolderChangeDialog(props) {
|
||||
onClick={handleConfirm}
|
||||
data-test="flow-folder-change-dialog-confirm-button"
|
||||
loading={isUpdateFlowFolderPending}
|
||||
disabled={!flow?.isOwner}
|
||||
>
|
||||
{formatMessage('flowFolderChangeDialog.confirm')}
|
||||
</LoadingButton>
|
||||
</DialogActions>
|
||||
|
||||
{!flow?.isOwner && (
|
||||
<Alert severity="info">
|
||||
{formatMessage('flowFolder.cannotMoveFlow')}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{createUpdateFlowFolderError && (
|
||||
<Alert
|
||||
data-test="flow-folder-change-dialog-error-alert"
|
||||
|
||||
@@ -372,6 +372,7 @@
|
||||
"flowFolderChangeDialog.uncategorizedFolder": "Uncategorized",
|
||||
"flowFolderChangeDialog.successfullyUpdatedFolder": "The flow has been successfully moved to the new folder!",
|
||||
"flowFolder.uncategorized": "Uncategorized",
|
||||
"flowFolder.cannotMoveFlow": "A flow can only be moved to a folder by the flow owner.",
|
||||
"footer.docsLinkText": "Documentation",
|
||||
"footer.tosLinkText": "Terms of Service",
|
||||
"footer.privacyPolicyLinkText": "Privacy",
|
||||
|
||||
Reference in New Issue
Block a user