Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nturinski committed Dec 11, 2024
1 parent 47dd35a commit d1936d6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
1 change: 1 addition & 0 deletions api/src/AzExtResourceType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export enum AzExtResourceType {
SpringApps = 'SpringApps',
SqlDatabases = 'SqlDatabases',
SqlServers = 'SqlServers',
Subscription = 'Subscription',
VirtualMachineScaleSets = 'VirtualMachineScaleSets',
VirtualNetworks = 'VirtualNetworks',
WebHostingEnvironments = 'WebHostingEnvironments',
Expand Down
16 changes: 16 additions & 0 deletions resources/azureIcons/Subscription.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions src/managedIdentity/ManagedIdentityBranchDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ export class ManagedIdentityBranchDataProvider extends vscode.Disposable impleme

async getChildren(element: ResourceGroupsItem): Promise<ResourceGroupsItem[] | null | undefined> {
return (await element.getChildren?.())?.map((child) => {
if (child.id) {
return ext.azureTreeState.wrapItemInStateHandling(child, () => this.refresh(child))
}

return child;
return ext.azureTreeState.wrapItemInStateHandling(child, () => this.refresh(child))
});
}

Expand Down
17 changes: 13 additions & 4 deletions src/managedIdentity/RoleDefinitionsItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ export class RoleDefinitionsItem implements ResourceGroupsItem {
iconPath = getIconPath(getAzExtResourceType({ type: parsedAzureResourceId.provider }));
}
catch (error) {
// if this fails, then it was a resource group ID
parsedAzureResourceGroupId = parseAzureResourceGroupId(scope);
label = parsedAzureResourceGroupId.resourceGroup;
iconPath = getIconPath(AzExtResourceType.ResourceGroup);
try {
// if it's not a resource, then it's possibly a resource group or subscription
parsedAzureResourceGroupId = parseAzureResourceGroupId(scope);
label = parsedAzureResourceGroupId.resourceGroup;
iconPath = getIconPath(AzExtResourceType.ResourceGroup);
} catch (error) {
// if it's not a resource group, then it's a subscription
const subscriptions = await (await ext.subscriptionProviderFactory()).getSubscriptions(false);
const subscriptionId = scope.split('/').pop();
label = subscriptions.find(s => s.subscriptionId === subscriptionId)?.name ?? scope;
iconPath = getIconPath(AzExtResourceType.Subscription);
}

}

if (fromOtherSub) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/azureUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const azExtDisplayInfo: Partial<Record<AzExtResourceType, AzExtResourceTypeDispl
Images: { displayName: localize('images', 'Images') },
LoadBalancers: { displayName: localize('loadBalancers', 'Load balancers') },
LogicApp: { displayName: localize('logicApp', 'Logic App') },
ManagedIdentityUserAssignedIdentities: { displayName: localize('managedIdentity', 'Managed Identity (Read-Only)') },
ManagedIdentityUserAssignedIdentities: { displayName: localize('managedIdentity', 'User Assigned Managed Identities (Read-Only)') },
MongoClusters: { displayName: localize('mongoclusters', 'Azure Cosmos DB for MongoDB (vCore)') },
MysqlServers: { displayName: localize('mysqlServers', 'MySql servers') },
NetworkInterfaces: { displayName: localize('networkInterfaces', 'Network interfaces') },
Expand Down

0 comments on commit d1936d6

Please sign in to comment.