sort orgs alphabetically
This commit is contained in:
parent
e7df805b51
commit
2664fd0f0e
@ -4,6 +4,7 @@ import { render, type TemplateResult } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
import { when } from "lit/directives/when.js";
|
||||
import { sortBy } from "lodash/fp";
|
||||
|
||||
import "broadcastchannel-polyfill";
|
||||
import "./utils/polyfills";
|
||||
@ -361,6 +362,8 @@ export class App extends LiteElement {
|
||||
const orgs = this.appState.userInfo?.orgs;
|
||||
if (!orgs || orgs.length < 2 || !this.appState.userInfo) return;
|
||||
|
||||
const sortedOrgs = sortBy<UserOrg>("name")(orgs);
|
||||
|
||||
const selectedOption = this.appState.orgSlug
|
||||
? orgs.find(({ slug }) => slug === this.appState.orgSlug)
|
||||
: { slug: "", name: msg("All Organizations") };
|
||||
@ -405,7 +408,7 @@ export class App extends LiteElement {
|
||||
<sl-divider></sl-divider>
|
||||
`,
|
||||
)}
|
||||
${this.appState.userInfo.orgs.map(
|
||||
${sortedOrgs.map(
|
||||
(org) => html`
|
||||
<sl-menu-item
|
||||
type="checkbox"
|
||||
|
@ -2,6 +2,7 @@ import { localized, msg, str } from "@lit/localize";
|
||||
import { serialize } from "@shoelace-style/shoelace/dist/utilities/form.js";
|
||||
import { type PropertyValues, type TemplateResult } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { sortBy } from "lodash/fp";
|
||||
|
||||
import type { InviteSuccessDetail } from "@/features/accounts/invite-form";
|
||||
import type { APIPaginatedList } from "@/types/api";
|
||||
@ -276,7 +277,7 @@ export class Home extends LiteElement {
|
||||
}
|
||||
|
||||
private async fetchOrgs() {
|
||||
this.orgList = await this.getOrgs();
|
||||
this.orgList = sortBy<OrgData>("name")(await this.getOrgs());
|
||||
}
|
||||
|
||||
private async getOrgs() {
|
||||
|
Loading…
Reference in New Issue
Block a user