mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-13 07:57:26 +01:00
show copyjob screen from portal navigation
This commit is contained in:
@@ -444,6 +444,7 @@ export interface DataExplorerInputsFrame {
|
|||||||
};
|
};
|
||||||
feedbackPolicies?: any;
|
feedbackPolicies?: any;
|
||||||
aadToken?: string;
|
aadToken?: string;
|
||||||
|
containerCopyEnabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelfServeFrameInputs {
|
export interface SelfServeFrameInputs {
|
||||||
|
|||||||
@@ -1,10 +1,21 @@
|
|||||||
import { DatabaseAccount } from "Contracts/DataModels";
|
import { DatabaseAccount } from "Contracts/DataModels";
|
||||||
import { CopyJobErrorType } from "./Types";
|
import { CopyJobErrorType } from "./Types";
|
||||||
|
|
||||||
|
const azurePortalMpacEndpoint = "https://ms.portal.azure.com/";
|
||||||
|
|
||||||
export const buildResourceLink = (resource: DatabaseAccount): string => {
|
export const buildResourceLink = (resource: DatabaseAccount): string => {
|
||||||
const resourceId = resource.id;
|
const resourceId = resource.id;
|
||||||
// TODO: update "ms.portal.azure.com" based on environment (e.g. for PROD or Fairfax)
|
let parentOrigin = window.location.ancestorOrigins?.[0] ?? window.location.origin;
|
||||||
return `https://ms.portal.azure.com/#resource${resourceId}`;
|
|
||||||
|
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";
|
export const COSMOS_SQL_COMPONENT = "CosmosDBSql";
|
||||||
|
|||||||
@@ -959,12 +959,13 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||||||
if (inputs.features) {
|
if (inputs.features) {
|
||||||
Object.assign(userContext.features, extractFeatures(new URLSearchParams(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
|
if (
|
||||||
// Then we will fetch the value from query param and set this to true
|
configContext.platform === Platform.Portal &&
|
||||||
// For now setting it to true unconditionally
|
inputs.containerCopyEnabled &&
|
||||||
if (userContext.apiType === "SQL") {
|
userContext.apiType === "SQL"
|
||||||
Object.assign(userContext.features, { enableContainerCopy: true });
|
) {
|
||||||
|
Object.assign(userContext.features, { enableContainerCopy: inputs.containerCopyEnabled });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.flights) {
|
if (inputs.flights) {
|
||||||
|
|||||||
Reference in New Issue
Block a user