mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Implement open in portal link for Azure resource viewer (#13139)
* Implement open in portal link for Azure resource viewer * localize
This commit is contained in:
@@ -47,11 +47,15 @@ export class AzureDataGridProvider implements azdata.DataGridProvider {
|
|||||||
id: item.id,
|
id: item.id,
|
||||||
fieldValues: {
|
fieldValues: {
|
||||||
nameLink: <azdata.DataGridHyperlinkInfo>{ displayText: item.name, linkOrCommand: 'https://microsoft.com' },
|
nameLink: <azdata.DataGridHyperlinkInfo>{ displayText: item.name, linkOrCommand: 'https://microsoft.com' },
|
||||||
|
name: item.name,
|
||||||
resourceGroup: item.resourceGroup,
|
resourceGroup: item.resourceGroup,
|
||||||
|
subscriptionId: item.subscriptionId,
|
||||||
subscriptionName: subscriptions.find(subscription => subscription.id === item.subscriptionId)?.name ?? item.subscriptionId,
|
subscriptionName: subscriptions.find(subscription => subscription.id === item.subscriptionId)?.name ?? item.subscriptionId,
|
||||||
locationDisplayName: utils.getRegionDisplayName(item.location),
|
locationDisplayName: utils.getRegionDisplayName(item.location),
|
||||||
|
type: item.type,
|
||||||
typeDisplayName: utils.getResourceTypeDisplayName(item.type),
|
typeDisplayName: utils.getResourceTypeDisplayName(item.type),
|
||||||
iconPath: utils.getResourceTypeIcon(this._appContext, item.type),
|
iconPath: utils.getResourceTypeIcon(this._appContext, item.type),
|
||||||
|
portalEndpoint: account.properties.providerSettings.settings.portalEndpoint
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -92,7 +92,17 @@ export async function activate(context: vscode.ExtensionContext): Promise<azurec
|
|||||||
registerAzureResourceCommands(appContext, [azureResourceTree, connectionDialogTree]);
|
registerAzureResourceCommands(appContext, [azureResourceTree, connectionDialogTree]);
|
||||||
azdata.dataprotocol.registerDataGridProvider(new AzureDataGridProvider(appContext));
|
azdata.dataprotocol.registerDataGridProvider(new AzureDataGridProvider(appContext));
|
||||||
vscode.commands.registerCommand('azure.dataGrid.openInAzurePortal', async (item: azdata.DataGridItem) => {
|
vscode.commands.registerCommand('azure.dataGrid.openInAzurePortal', async (item: azdata.DataGridItem) => {
|
||||||
await vscode.env.openExternal(vscode.Uri.parse('https://microsoft.com'));
|
const portalEndpoint = item.fieldValues.portalEndpoint;
|
||||||
|
const subscriptionId = item.fieldValues.subscriptionId;
|
||||||
|
const resourceGroup = item.fieldValues.resourceGroup;
|
||||||
|
const type = item.fieldValues.type;
|
||||||
|
const name = item.fieldValues.name;
|
||||||
|
if (portalEndpoint && subscriptionId && resourceGroup && type && name) {
|
||||||
|
await vscode.env.openExternal(vscode.Uri.parse(`${portalEndpoint}/#resource/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/${type}/${name}`));
|
||||||
|
} else {
|
||||||
|
console.log(`Missing required values - subscriptionId : ${subscriptionId} resourceGroup : ${resourceGroup} type: ${type} name: ${name}`);
|
||||||
|
vscode.window.showErrorMessage(loc.unableToOpenAzureLink);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -71,3 +71,5 @@ export const azureArcsqlManagedInstance = localize('azurecore.azureArcsqlManaged
|
|||||||
export const azureArcService = localize('azurecore.azureArcService', "Data Service - Azure Arc");
|
export const azureArcService = localize('azurecore.azureArcService', "Data Service - Azure Arc");
|
||||||
export const sqlServerArc = localize('azurecore.sqlServerArc', "SQL Server - Azure Arc");
|
export const sqlServerArc = localize('azurecore.sqlServerArc', "SQL Server - Azure Arc");
|
||||||
export const azureArcPostgresServer = localize('azurecore.azureArcPostgres', "Azure Arc enabled PostgreSQL Hyperscale");
|
export const azureArcPostgresServer = localize('azurecore.azureArcPostgres', "Azure Arc enabled PostgreSQL Hyperscale");
|
||||||
|
|
||||||
|
export const unableToOpenAzureLink = localize('azure.unableToOpenAzureLink', "Unable to open link, missing required values");
|
||||||
|
|||||||
Reference in New Issue
Block a user