show loading in account selection
This commit is contained in:
parent
afb36cdbfd
commit
99d32fe12d
1 changed files with 23 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { ArrowPathIcon } from "@heroicons/react/24/outline";
|
||||
import { UserCircleIcon } from "@heroicons/react/24/solid";
|
||||
import { isOnPremSession } from "core/control-plane/AuthTypes";
|
||||
import {
|
||||
|
|
@ -10,11 +11,13 @@ import { Button } from "../../components/ui/Button";
|
|||
import { useAuth } from "../../context/Auth";
|
||||
import { selectCurrentOrg } from "../../redux";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { cn } from "../../util/cn";
|
||||
import { ScopeSelect } from "./ScopeSelect";
|
||||
|
||||
export function AccountButton() {
|
||||
const { session, logout, login, organizations } = useAuth();
|
||||
const { session, logout, login, organizations, refreshProfiles } = useAuth();
|
||||
const selectedOrg = useAppSelector(selectCurrentOrg);
|
||||
const configLoading = useAppSelector((store) => store.config.loading);
|
||||
|
||||
if (!session) {
|
||||
return (
|
||||
|
|
@ -58,9 +61,25 @@ export function AccountButton() {
|
|||
|
||||
{organizations.length > 0 && (
|
||||
<div className="flex flex-col gap-1">
|
||||
<label className="text-vsc-foreground text-xs">
|
||||
Organization
|
||||
</label>
|
||||
<div className="flex items-center justify-between">
|
||||
<label className="text-vsc-foreground text-xs">
|
||||
Organization
|
||||
</label>
|
||||
<div
|
||||
className="mt-0.5 cursor-pointer hover:brightness-125"
|
||||
onClick={async (e) => {
|
||||
e.stopPropagation();
|
||||
await refreshProfiles();
|
||||
}}
|
||||
>
|
||||
<ArrowPathIcon
|
||||
className={cn(
|
||||
"text-description h-2.5 w-2.5",
|
||||
configLoading && "animate-spin-slow",
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<ScopeSelect onSelect={close} />
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue