show quota status

This commit is contained in:
sua yoo 2024-05-21 15:09:40 -07:00
parent ad2902ee2f
commit e7028ce64a
No known key found for this signature in database
GPG Key ID: 5AD1B4C02D4F0567
2 changed files with 37 additions and 11 deletions

View File

@ -12,12 +12,15 @@ import type { CurrentUser } from "@/types/user";
import { formatNumber } from "@/utils/localization"; import { formatNumber } from "@/utils/localization";
import type { OrgData } from "@/utils/orgs"; import type { OrgData } from "@/utils/orgs";
/**
* @fires update-quotas
*/
@localized() @localized()
@customElement("btrix-orgs-list") @customElement("btrix-orgs-list")
export class OrgsList extends TailwindElement { export class OrgsList extends TailwindElement {
static styles = css` static styles = css`
btrix-table { btrix-table {
grid-template-columns: [clickable-start] auto auto auto [clickable-end] min-content; grid-template-columns: min-content [clickable-start] auto auto auto [clickable-end] min-content;
} }
`; `;
@property({ type: Object }) @property({ type: Object })
@ -52,12 +55,15 @@ export class OrgsList extends TailwindElement {
return html` return html`
<btrix-table> <btrix-table>
<btrix-table-head class="mb-2"> <btrix-table-head class="mb-2">
<btrix-table-header-cell class="px-2" <btrix-table-header-cell>
>${msg("Name")}</btrix-table-header-cell <span class="sr-only">${msg("Status")}</span>
> </btrix-table-header-cell>
<btrix-table-header-cell class="px-2" <btrix-table-header-cell class="px-2">
>${msg("Members")}</btrix-table-header-cell ${msg("Name")}
> </btrix-table-header-cell>
<btrix-table-header-cell class="px-2">
${msg("Members")}
</btrix-table-header-cell>
<btrix-table-header-cell class="px-2"> <btrix-table-header-cell class="px-2">
${msg("Bytes Stored")} ${msg("Bytes Stored")}
</btrix-table-header-cell> </btrix-table-header-cell>
@ -246,6 +252,8 @@ export class OrgsList extends TailwindElement {
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("update-quotas", { detail: this.currOrg }), new CustomEvent("update-quotas", { detail: this.currOrg }),
); );
void this.orgQuotaDialog?.hide();
} }
} }
@ -272,6 +280,24 @@ export class OrgsList extends TailwindElement {
? "" ? ""
: "opacity-50"} cursor-pointer select-none border-b bg-neutral-0 transition-colors first-of-type:rounded-t last-of-type:rounded-b last-of-type:border-none focus-within:bg-neutral-50 hover:bg-neutral-50" : "opacity-50"} cursor-pointer select-none border-b bg-neutral-0 transition-colors first-of-type:rounded-t last-of-type:rounded-b last-of-type:border-none focus-within:bg-neutral-50 hover:bg-neutral-50"
> >
<btrix-table-cell class="min-w-6 pl-2">
${org.storageQuotaReached || org.execMinutesQuotaReached
? html`
<sl-tooltip content=${msg("Quota reached")}>
<sl-icon
class="text-base text-danger"
name="exclamation-triangle-fill"
>
</sl-icon>
</sl-tooltip>
`
: html`
<sl-tooltip content=${msg("Under quota")}>
<sl-icon class="text-base text-success" name="check-circle">
</sl-icon>
</sl-tooltip>
`}
</btrix-table-cell>
<btrix-table-cell class="p-2" rowClickTarget="a"> <btrix-table-cell class="p-2" rowClickTarget="a">
<a <a
href="/orgs/${org.slug}" href="/orgs/${org.slug}"

View File

@ -141,10 +141,10 @@ export class Home extends LiteElement {
<div class="grid grid-cols-5 gap-8"> <div class="grid grid-cols-5 gap-8">
<div class="col-span-5 md:col-span-3"> <div class="col-span-5 md:col-span-3">
<section> <section>
<header class="flex items-center justify-between"> <header
<h2 class="mb-3 mt-2 text-lg font-medium"> class="mb-3 flex items-center justify-between border-b pb-3"
${msg("All Organizations")} >
</h2> <h2 class="text-lg font-medium">${msg("All Organizations")}</h2>
<sl-button <sl-button
variant="primary" variant="primary"
size="small" size="small"