mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-05-14 09:17:29 +01:00
Addressing comments
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { configContext } from "ConfigContext";
|
||||
import { Keys, t } from "Localization";
|
||||
import { ApiType, userContext } from "UserContext";
|
||||
import * as NotificationConsoleUtils from "Utils/NotificationConsoleUtils";
|
||||
import {
|
||||
@@ -143,37 +144,50 @@ const pollDataTransferJobOperation = async (
|
||||
if (status === "Cancelled") {
|
||||
removeFromPolling(jobName);
|
||||
clearMessage && clearMessage();
|
||||
const cancelMessage = `Data transfer job ${jobName} cancelled`;
|
||||
const cancelMessage = t(Keys.containerCopy.dataTransfers.polling.cancelConsoleMessage);
|
||||
NotificationConsoleUtils.logConsoleError(cancelMessage);
|
||||
throw new AbortError(cancelMessage);
|
||||
}
|
||||
if (status === "Paused") {
|
||||
removeFromPolling(jobName);
|
||||
clearMessage && clearMessage();
|
||||
const pauseMessage = `Data transfer job ${jobName} paused`;
|
||||
NotificationConsoleUtils.logConsoleInfo(pauseMessage);
|
||||
NotificationConsoleUtils.logConsoleInfo(t(Keys.containerCopy.dataTransfers.polling.pauseConsoleMessage));
|
||||
return body;
|
||||
}
|
||||
if (status === "Failed" || status === "Faulted") {
|
||||
removeFromPolling(jobName);
|
||||
const errorMessage = body?.properties?.error
|
||||
? JSON.stringify(body?.properties?.error)
|
||||
: "Operation could not be completed";
|
||||
: t(Keys.containerCopy.dataTransfers.polling.defaultErrorMessage);
|
||||
const error = new Error(errorMessage);
|
||||
clearMessage && clearMessage();
|
||||
NotificationConsoleUtils.logConsoleError(`Data transfer job ${jobName} failed: ${errorMessage}`);
|
||||
NotificationConsoleUtils.logConsoleError(
|
||||
t(Keys.containerCopy.dataTransfers.polling.errorConsoleMessage, {
|
||||
errorMessage: errorMessage,
|
||||
jobName: jobName,
|
||||
}),
|
||||
);
|
||||
throw new AbortError(error);
|
||||
}
|
||||
if (status === "Completed") {
|
||||
removeFromPolling(jobName);
|
||||
clearMessage && clearMessage();
|
||||
NotificationConsoleUtils.logConsoleInfo(`Data transfer job ${jobName} completed`);
|
||||
NotificationConsoleUtils.logConsoleInfo(
|
||||
t(Keys.containerCopy.dataTransfers.polling.completedConsoleMessage, {
|
||||
jobName: jobName,
|
||||
}),
|
||||
);
|
||||
return body;
|
||||
}
|
||||
const processedCount = body.properties.processedCount;
|
||||
const totalCount = body.properties.totalCount;
|
||||
const retryMessage = `Data transfer job ${jobName} in progress, total count: ${totalCount}, processed count: ${processedCount}`;
|
||||
throw new Error(retryMessage);
|
||||
throw new Error(
|
||||
t(Keys.containerCopy.dataTransfers.polling.retryConsoleMessage, {
|
||||
jobName: jobName,
|
||||
processedCount: processedCount,
|
||||
totalCount: totalCount,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
export const cancelDataTransferJob = async (
|
||||
|
||||
@@ -173,20 +173,20 @@ export const PartitionKeyComponent: React.FC<PartitionKeyComponentProps> = ({
|
||||
action === CopyJobActions.cancel ? (
|
||||
<Stack tokens={{ childrenGap: 10 }}>
|
||||
<Stack.Item>
|
||||
{/*t(Keys.controls.settings.partitionKeyEditor.confirmCancel1)*/}
|
||||
{t(Keys.controls.settings.partitionKeyEditor.confirmCancel1)}
|
||||
<br />
|
||||
<b>{jobName}</b>
|
||||
</Stack.Item>
|
||||
<Stack.Item>{/*t(Keys.controls.settings.partitionKeyEditor.confirmCancel2)*/}</Stack.Item>
|
||||
<Stack.Item>{t(Keys.controls.settings.partitionKeyEditor.confirmCancel2)}</Stack.Item>
|
||||
</Stack>
|
||||
) : action === CopyJobActions.complete ? (
|
||||
<Stack tokens={{ childrenGap: 10 }}>
|
||||
<Stack.Item>
|
||||
{/*t(Keys.controls.settings.partitionKeyEditor.confirmComplete1)*/}
|
||||
{t(Keys.controls.settings.partitionKeyEditor.confirmComplete1)}
|
||||
<br />
|
||||
<b>{jobName}</b>
|
||||
</Stack.Item>
|
||||
<Stack.Item>{/*t(Keys.controls.settings.partitionKeyEditor.confrimComplete2)*/}</Stack.Item>
|
||||
<Stack.Item>{t(Keys.controls.settings.partitionKeyEditor.confrimComplete2)}</Stack.Item>
|
||||
</Stack>
|
||||
) : null;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import { createCollection } from "Common/dataAccess/createCollection";
|
||||
import { DataTransferParams, initiateDataTransfer } from "Common/dataAccess/dataTransfers";
|
||||
import * as DataModels from "Contracts/DataModels";
|
||||
import * as ViewModels from "Contracts/ViewModels";
|
||||
import { buildResourceLink } from "Explorer/ContainerCopy/CopyJobUtils";
|
||||
import { BackupPolicyType } from "Explorer/ContainerCopy/Enums/CopyJobEnums";
|
||||
import {
|
||||
getPartitionKeyName,
|
||||
@@ -141,7 +142,8 @@ export const ChangePartitionKeyPane: React.FC<ChangePartitionKeyPaneProps> = ({
|
||||
};
|
||||
|
||||
const handleEnablePitr = () => {
|
||||
const featureUrl = `https://portal.azure.com/#@/resource/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/backupRestore`;
|
||||
const sourceAccountLink = buildResourceLink(localAccount);
|
||||
const featureUrl = `${sourceAccountLink}/backupRestore`;
|
||||
setIsEnablingPrerequisite(true);
|
||||
setPrerequisiteLoaderMessage(t(Keys.containerCopy.popoverOverlaySpinnerLabel));
|
||||
window.open(featureUrl, "_blank");
|
||||
|
||||
@@ -1155,6 +1155,16 @@
|
||||
"confirmButtonText": "Confirm",
|
||||
"cancelButtonText": "Cancel"
|
||||
}
|
||||
},
|
||||
"dataTransfers": {
|
||||
"polling": {
|
||||
"cancelConsoleMessage": "Data transfer job \"{{jobName}}\" cancelled",
|
||||
"completedConsoleMessage": "Data transfer job \"{{jobName}}\" completed",
|
||||
"defaultErrorMessage": "Operation could not be completed",
|
||||
"errorConsoleMessage": "Data transfer job \"{{jobName}}\" failed: {{errorMessage}}",
|
||||
"pauseConsoleMessage": "Data transfer job \"{{jobName}}\" paused",
|
||||
"retryConsoleMessage": "Data transfer job \"{{jobName}}\" in progress, total count: {{totalCount}}, processed count: {{processedCount}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user