mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 00:41:31 +00:00
set intra-account copy as the default one (#2267)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { Subscription } from "Contracts/DataModels";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { userContext } from "UserContext";
|
import { userContext } from "UserContext";
|
||||||
import { CopyJobMigrationType } from "../Enums/CopyJobEnums";
|
import { CopyJobMigrationType } from "../Enums/CopyJobEnums";
|
||||||
@@ -21,8 +22,10 @@ const getInitialCopyJobState = (): CopyJobContextState => {
|
|||||||
jobName: "",
|
jobName: "",
|
||||||
migrationType: CopyJobMigrationType.Offline,
|
migrationType: CopyJobMigrationType.Offline,
|
||||||
source: {
|
source: {
|
||||||
subscription: null,
|
subscription: {
|
||||||
account: null,
|
subscriptionId: userContext.subscriptionId || "",
|
||||||
|
} as Subscription,
|
||||||
|
account: userContext.databaseAccount || null,
|
||||||
databaseId: "",
|
databaseId: "",
|
||||||
containerId: "",
|
containerId: "",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -84,9 +84,10 @@ const PointInTimeRestore: React.FC = () => {
|
|||||||
setShowRefreshButton(true);
|
setShowRefreshButton(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRefresh = () => {
|
const handleRefresh = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
handleFetchAccount();
|
await handleFetchAccount();
|
||||||
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openWindowAndMonitor = () => {
|
const openWindowAndMonitor = () => {
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ export const AccountDropdown: React.FC<AccountDropdownProps> = React.memo(
|
|||||||
/>
|
/>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
),
|
),
|
||||||
|
(prev, next) => prev.options.length === next.options.length && prev.selectedKey === next.selectedKey,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ export const SubscriptionDropdown: React.FC<SubscriptionDropdownProps> = React.m
|
|||||||
/>
|
/>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
),
|
),
|
||||||
|
(prev, next) => prev.options.length === next.options.length && prev.selectedKey === next.selectedKey,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { useDropdownOptions, useEventHandlers } from "./Utils/selectAccountUtils
|
|||||||
const SelectAccount = React.memo(() => {
|
const SelectAccount = React.memo(() => {
|
||||||
const { copyJobState, setCopyJobState } = useCopyJobContext();
|
const { copyJobState, setCopyJobState } = useCopyJobContext();
|
||||||
const selectedSubscriptionId = copyJobState?.source?.subscription?.subscriptionId;
|
const selectedSubscriptionId = copyJobState?.source?.subscription?.subscriptionId;
|
||||||
|
const selectedSourceAccountId = copyJobState?.source?.account?.id;
|
||||||
|
|
||||||
const subscriptions: Subscription[] = useSubscriptions();
|
const subscriptions: Subscription[] = useSubscriptions();
|
||||||
const allAccounts: DatabaseAccount[] = useDatabaseAccounts(selectedSubscriptionId);
|
const allAccounts: DatabaseAccount[] = useDatabaseAccounts(selectedSubscriptionId);
|
||||||
@@ -38,7 +39,7 @@ const SelectAccount = React.memo(() => {
|
|||||||
|
|
||||||
<AccountDropdown
|
<AccountDropdown
|
||||||
options={accountOptions}
|
options={accountOptions}
|
||||||
selectedKey={copyJobState?.source?.account?.id}
|
selectedKey={selectedSourceAccountId}
|
||||||
disabled={!selectedSubscriptionId}
|
disabled={!selectedSubscriptionId}
|
||||||
onChange={(_ev, option) => handleSelectSourceAccount("account", option?.data)}
|
onChange={(_ev, option) => handleSelectSourceAccount("account", option?.data)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user