mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-25 12:44:06 +00:00
show copyjob screen from portal navigation
This commit is contained in:
@@ -444,6 +444,7 @@ export interface DataExplorerInputsFrame {
|
||||
};
|
||||
feedbackPolicies?: any;
|
||||
aadToken?: string;
|
||||
containerCopyEnabled?: boolean;
|
||||
}
|
||||
|
||||
export interface SelfServeFrameInputs {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user