-
Notifications
You must be signed in to change notification settings - Fork 171
Add deep links to Quantum OS portal for V2 workspaces and jobs #3123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
98660d6
f3decbc
8b0bd6c
db1b957
e759be3
be89f9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,45 @@ import { getRandomGuid } from "../utils"; | |
| import { EventType, sendTelemetryEvent, UserFlowStatus } from "../telemetry"; | ||
| import { getTenantIdAndToken, getTokenForWorkspace } from "./auth"; | ||
|
|
||
| export function getAzurePortalWorkspaceLink(workspace: WorkspaceConnection) { | ||
| // Portal link format: | ||
| // - https://portal.azure.com/#resource/subscriptions/<sub guid>/resourceGroups/<group>/providers/Microsoft.Quantum/Workspaces/<name>/overview | ||
| export function getQuantumOsJobLink( | ||
| workspace: WorkspaceConnection, | ||
| jobId: string, | ||
| ) { | ||
| // Quantum OS job page format: | ||
| // https://manage.quantum.microsoft.com/jobs/<job-id> | ||
| return `https://manage.quantum-test.microsoft.com/jobs/${jobId}`; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, having it be a VS Code setting might make it easier to dealt with the lock-step issue between the Quantum OS development and the VS Code extension development. |
||
| } | ||
|
|
||
| export function getWorkspacePortalLink(workspace: WorkspaceConnection) { | ||
| const endpointMatch = workspace.endpointUri.match(QuantumUris.endpointRegExp); | ||
| const isV2Workspace = endpointMatch?.groups?.versionSuffix === "-v2"; | ||
|
|
||
| if (isV2Workspace) { | ||
| // Quantum OS link format: | ||
| // https://manage.quantum.microsoft.com/workspaces/<workspace-name> | ||
| // #tenantId=<tenant-id>&subscriptionId=<sub-id>&role=Researcher&offeringId=<provider-id>&workspaceId=<workspace-id> | ||
| // | ||
| // workspace.id starts with '/' (e.g. "/subscriptions/.../Workspaces/<name>"), | ||
| // so it is appended directly to produce a clean path with literal slashes. | ||
| const idRegex = | ||
| /\/subscriptions\/(?<subscriptionId>[^/]+)\/resourceGroups\//; | ||
| const subscriptionId = | ||
| workspace.id.match(idRegex)?.groups?.subscriptionId ?? ""; | ||
|
|
||
| const offeringId = workspace.providers[0]?.providerId ?? ""; | ||
|
|
||
| const fragment = | ||
| `tenantId=${workspace.tenantId}` + | ||
| `&subscriptionId=${subscriptionId}` + | ||
| `&role=Researcher` + | ||
| (offeringId ? `&offeringId=${offeringId}` : "") + | ||
| `&workspaceId=${workspace.id}`; | ||
|
|
||
| return `https://manage.quantum-test.microsoft.com/workspaces/${workspace.name}#${fragment}`; | ||
| } | ||
|
|
||
| // Azure Portal link format: | ||
| // https://portal.azure.com/#resource/subscriptions/<sub guid>/resourceGroups/<group>/providers/Microsoft.Quantum/Workspaces/<name>/overview | ||
| return `https://portal.azure.com/#resource${workspace.id}/overview`; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.