show copyjob screen from portal navigation

This commit is contained in:
Bikram Choudhury
2025-10-29 18:36:13 +05:30
parent 58e187aeb2
commit 844b6e6b65
3 changed files with 21 additions and 8 deletions

View File

@@ -444,6 +444,7 @@ export interface DataExplorerInputsFrame {
};
feedbackPolicies?: any;
aadToken?: string;
containerCopyEnabled?: boolean;
}
export interface SelfServeFrameInputs {

View File

@@ -1,10 +1,21 @@
import { DatabaseAccount } from "Contracts/DataModels";
import { CopyJobErrorType } from "./Types";
const azurePortalMpacEndpoint = "https://ms.portal.azure.com/";
export const buildResourceLink = (resource: DatabaseAccount): string => {
const resourceId = resource.id;
// TODO: update "ms.portal.azure.com" based on environment (e.g. for PROD or Fairfax)
return `https://ms.portal.azure.com/#resource${resourceId}`;
let parentOrigin = window.location.ancestorOrigins?.[0] ?? window.location.origin;
if (/\/\/localhost:/.test(parentOrigin)) {
parentOrigin = azurePortalMpacEndpoint;
} else if (/\/\/cosmos\.azure/.test(parentOrigin)) {
parentOrigin = parentOrigin.replace("cosmos.azure", "portal.azure");
}
parentOrigin = parentOrigin.replace(/\/$/, "");
return `${parentOrigin}/#resource${resourceId}`;
};
export const COSMOS_SQL_COMPONENT = "CosmosDBSql";

View File

@@ -959,12 +959,13 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
if (inputs.features) {
Object.assign(userContext.features, extractFeatures(new URLSearchParams(inputs.features)));
}
// somehow we need to make enableContainerCopy true for platform: portal & apiType: SQL
// Ideally we need to pass this as a feature flag from portal or in a query param
// Then we will fetch the value from query param and set this to true
// For now setting it to true unconditionally
if (userContext.apiType === "SQL") {
Object.assign(userContext.features, { enableContainerCopy: true });
if (
configContext.platform === Platform.Portal &&
inputs.containerCopyEnabled &&
userContext.apiType === "SQL"
) {
Object.assign(userContext.features, { enableContainerCopy: inputs.containerCopyEnabled });
}
if (inputs.flights) {