disabled change partition key section for emulator

This commit is contained in:
Nishtha Ahuja 2024-12-09 13:17:57 +05:30
parent 73d2686025
commit 0d574221ce

View File

@ -14,6 +14,7 @@ import * as ViewModels from "../../../../Contracts/ViewModels";
import { handleError } from "Common/ErrorHandlingUtils"; import { handleError } from "Common/ErrorHandlingUtils";
import { cancelDataTransferJob, pollDataTransferJob } from "Common/dataAccess/dataTransfers"; import { cancelDataTransferJob, pollDataTransferJob } from "Common/dataAccess/dataTransfers";
import { Platform, configContext } from "ConfigContext";
import Explorer from "Explorer/Explorer"; import Explorer from "Explorer/Explorer";
import { ChangePartitionKeyPane } from "Explorer/Panes/ChangePartitionKeyPane/ChangePartitionKeyPane"; import { ChangePartitionKeyPane } from "Explorer/Panes/ChangePartitionKeyPane/ChangePartitionKeyPane";
import { import {
@ -148,69 +149,71 @@ export const PartitionKeyComponent: React.FC<PartitionKeyComponentProps> = ({ da
}; };
return ( return (
<Stack tokens={{ childrenGap: 20 }} styles={{ root: { maxWidth: 600 } }}> configContext.platform !== Platform.Emulator && (
<Stack tokens={{ childrenGap: 10 }}> <Stack tokens={{ childrenGap: 20 }} styles={{ root: { maxWidth: 600 } }}>
<Text styles={textHeadingStyle}>Change {partitionKeyName.toLowerCase()}</Text> <Stack tokens={{ childrenGap: 10 }}>
<Stack horizontal tokens={{ childrenGap: 20 }}> <Text styles={textHeadingStyle}>Change {partitionKeyName.toLowerCase()}</Text>
<Stack tokens={{ childrenGap: 5 }}> <Stack horizontal tokens={{ childrenGap: 20 }}>
<Text styles={textSubHeadingStyle}>Current {partitionKeyName.toLowerCase()}</Text> <Stack tokens={{ childrenGap: 5 }}>
<Text styles={textSubHeadingStyle}>Partitioning</Text> <Text styles={textSubHeadingStyle}>Current {partitionKeyName.toLowerCase()}</Text>
</Stack> <Text styles={textSubHeadingStyle}>Partitioning</Text>
<Stack tokens={{ childrenGap: 5 }}> </Stack>
<Text>{partitionKeyValue}</Text> <Stack tokens={{ childrenGap: 5 }}>
<Text>{isHierarchicalPartitionedContainer() ? "Hierarchical" : "Non-hierarchical"}</Text> <Text>{partitionKeyValue}</Text>
<Text>{isHierarchicalPartitionedContainer() ? "Hierarchical" : "Non-hierarchical"}</Text>
</Stack>
</Stack> </Stack>
</Stack> </Stack>
</Stack> <MessageBar messageBarType={MessageBarType.warning}>
<MessageBar messageBarType={MessageBarType.warning}> To safeguard the integrity of the data being copied to the new container, ensure that no updates are made to
To safeguard the integrity of the data being copied to the new container, ensure that no updates are made to the the source container for the entire duration of the partition key change process.
source container for the entire duration of the partition key change process. <Link
<Link href="https://learn.microsoft.com/azure/cosmos-db/container-copy#how-does-container-copy-work"
href="https://learn.microsoft.com/azure/cosmos-db/container-copy#how-does-container-copy-work" target="_blank"
target="_blank" underline
underline
>
Learn more
</Link>
</MessageBar>
<Text>
To change the partition key, a new destination container must be created or an existing destination container
selected. Data will then be copied to the destination container.
</Text>
<PrimaryButton
styles={{ root: { width: "fit-content" } }}
text="Change"
onClick={startPartitionkeyChangeWorkflow}
disabled={isCurrentJobInProgress(portalDataTransferJob)}
/>
{portalDataTransferJob && (
<Stack>
<Text styles={textHeadingStyle}>{partitionKeyName} change job</Text>
<Stack
horizontal
tokens={{ childrenGap: 20 }}
styles={{
root: {
alignItems: "center",
},
}}
> >
<ProgressIndicator Learn more
label={portalDataTransferJob?.properties?.jobName} </Link>
description={getProgressDescription()} </MessageBar>
percentComplete={getPercentageComplete()} <Text>
To change the partition key, a new destination container must be created or an existing destination container
selected. Data will then be copied to the destination container.
</Text>
<PrimaryButton
styles={{ root: { width: "fit-content" } }}
text="Change"
onClick={startPartitionkeyChangeWorkflow}
disabled={isCurrentJobInProgress(portalDataTransferJob)}
/>
{portalDataTransferJob && (
<Stack>
<Text styles={textHeadingStyle}>{partitionKeyName} change job</Text>
<Stack
horizontal
tokens={{ childrenGap: 20 }}
styles={{ styles={{
root: { root: {
width: "85%", alignItems: "center",
}, },
}} }}
></ProgressIndicator> >
{isCurrentJobInProgress(portalDataTransferJob) && ( <ProgressIndicator
<DefaultButton text="Cancel" onClick={() => cancelRunningDataTransferJob(portalDataTransferJob)} /> label={portalDataTransferJob?.properties?.jobName}
)} description={getProgressDescription()}
percentComplete={getPercentageComplete()}
styles={{
root: {
width: "85%",
},
}}
></ProgressIndicator>
{isCurrentJobInProgress(portalDataTransferJob) && (
<DefaultButton text="Cancel" onClick={() => cancelRunningDataTransferJob(portalDataTransferJob)} />
)}
</Stack>
</Stack> </Stack>
</Stack> )}
)} </Stack>
</Stack> )
); );
}; };