Alpha sort subscriptions and accounts in dropdown (#663)

This commit is contained in:
Steve Faulkner 2021-04-13 18:53:59 -05:00 committed by GitHub
parent d96cecdfe8
commit e8033f0bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ export async function fetchDatabaseAccounts(subscriptionId: string, accessToken:
nextLink = result.nextLink;
accounts = [...accounts, ...result.value];
}
return accounts;
return accounts.sort((a, b) => a.name.localeCompare(b.name));
}
export function useDatabaseAccounts(subscriptionId: string, armToken: string): DatabaseAccount[] | undefined {

View File

@ -1,5 +1,5 @@
import { Subscription } from "../Contracts/DataModels";
import useSWR from "swr";
import { Subscription } from "../Contracts/DataModels";
interface SubscriptionListResult {
nextLink: string;
@ -28,7 +28,7 @@ export async function fetchSubscriptions(accessToken: string): Promise<Subscript
);
subscriptions = [...subscriptions, ...validSubscriptions];
}
return subscriptions;
return subscriptions.sort((a, b) => a.displayName.localeCompare(b.displayName));
}
export function useSubscriptions(armToken: string): Subscription[] | undefined {