fix: Team switching moved to IAM menu
This commit is contained in:
parent
48fa4ff245
commit
106aee31bd
@ -25,7 +25,6 @@
|
|||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
selectedTeamId: session.teamId,
|
|
||||||
...(await res.json())
|
...(await res.json())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -35,9 +34,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export let teams;
|
|
||||||
export let selectedTeamId;
|
|
||||||
|
|
||||||
import '../tailwind.css';
|
import '../tailwind.css';
|
||||||
import { SvelteToast, toast } from '@zerodevx/svelte-toast';
|
import { SvelteToast, toast } from '@zerodevx/svelte-toast';
|
||||||
import { page, session } from '$app/stores';
|
import { page, session } from '$app/stores';
|
||||||
@ -89,17 +85,6 @@
|
|||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function switchTeam() {
|
|
||||||
try {
|
|
||||||
await post(`/dashboard.json?from=${$page.url.pathname}`, {
|
|
||||||
cookie: 'teamId',
|
|
||||||
value: selectedTeamId
|
|
||||||
});
|
|
||||||
return window.location.reload();
|
|
||||||
} catch (error) {
|
|
||||||
return window.location.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function update() {
|
async function update() {
|
||||||
updateStatus.loading = true;
|
updateStatus.loading = true;
|
||||||
@ -525,21 +510,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{#if $session.whiteLabeled}
|
{#if $session.whiteLabeled}
|
||||||
<span class="fixed bottom-0 left-[50px] z-50 m-2 px-4 text-xs text-stone-700"
|
<span class="fixed bottom-0 left-[50px] z-50 m-2 px-4 text-xs text-stone-700"
|
||||||
>Powered by <a href="https://coolify.io" target="_blank">Coolify</a></span
|
>Powered by <a href="https://coolify.io" target="_blank">Coolify</a></span
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<select
|
|
||||||
class="fixed right-0 bottom-0 z-50 m-2 w-64 bg-opacity-30 p-2 px-4 hover:bg-opacity-100"
|
|
||||||
bind:value={selectedTeamId}
|
|
||||||
on:change={switchTeam}
|
|
||||||
>
|
|
||||||
<option value="" disabled selected>Switch to a different team...</option>
|
|
||||||
{#each teams as team}
|
|
||||||
<option value={team.teamId}>{team.team.name} - {team.permission}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
{/if}
|
{/if}
|
||||||
<main>
|
<main>
|
||||||
<slot />
|
<slot />
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { session } from '$app/stores';
|
import { page, session } from '$app/stores';
|
||||||
import { get, post } from '$lib/api';
|
import { get, post } from '$lib/api';
|
||||||
import { errorNotification } from '$lib/form';
|
import { errorNotification } from '$lib/form';
|
||||||
import { toast } from '@zerodevx/svelte-toast';
|
import { toast } from '@zerodevx/svelte-toast';
|
||||||
@ -81,6 +81,18 @@
|
|||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function switchTeam(selectedTeamId) {
|
||||||
|
try {
|
||||||
|
await post(`/dashboard.json?from=${$page.url.pathname}`, {
|
||||||
|
cookie: 'teamId',
|
||||||
|
value: selectedTeamId
|
||||||
|
});
|
||||||
|
return window.location.reload();
|
||||||
|
} catch (error) {
|
||||||
|
return window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex space-x-1 p-6 font-bold">
|
<div class="flex space-x-1 p-6 font-bold">
|
||||||
@ -175,20 +187,39 @@
|
|||||||
<div class="flex flex-row flex-wrap justify-center px-2 pb-10 md:flex-row">
|
<div class="flex flex-row flex-wrap justify-center px-2 pb-10 md:flex-row">
|
||||||
{#each ownTeams as team}
|
{#each ownTeams as team}
|
||||||
<a href="/iam/team/{team.id}" class="w-96 p-2 no-underline">
|
<a href="/iam/team/{team.id}" class="w-96 p-2 no-underline">
|
||||||
<div
|
<div class="box-selection relative">
|
||||||
class="box-selection relative"
|
<div>
|
||||||
class:hover:bg-fuchsia-600={team.id !== '0'}
|
<div class="truncate text-center text-xl font-bold">
|
||||||
class:hover:bg-red-500={team.id === '0'}
|
{team.name}
|
||||||
>
|
</div>
|
||||||
<div class="truncate text-center text-xl font-bold">
|
<div class="mt-1 text-center text-xs">
|
||||||
{team.name}
|
{team.permissions?.length} member(s)
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="truncate text-center font-bold">
|
<div class="flex items-center justify-center pt-3">
|
||||||
{team.id === '0' ? 'root team' : ''}
|
<button
|
||||||
</div>
|
on:click|preventDefault={() => switchTeam(team.id)}
|
||||||
|
class:bg-fuchsia-600={$session.teamId !== team.id}
|
||||||
<div class:mt-6={team.id !== '0'} class="mt-1 text-center">
|
class:hover:bg-fuchsia-500={$session.teamId !== team.id}
|
||||||
{team.permissions?.length} member(s)
|
class:bg-transparent={$session.teamId === team.id}
|
||||||
|
disabled={$session.teamId === team.id}
|
||||||
|
><svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="h-6 w-6"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
|
<path d="M3 17h5l1.67 -2.386m3.66 -5.227l1.67 -2.387h6" />
|
||||||
|
<path d="M18 4l3 3l-3 3" />
|
||||||
|
<path d="M3 7h5l7 10h6" />
|
||||||
|
<path d="M18 20l3 -3l-3 -3" />
|
||||||
|
</svg></button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@ -207,9 +238,6 @@
|
|||||||
<div class="truncate text-center text-xl font-bold">
|
<div class="truncate text-center text-xl font-bold">
|
||||||
{team.name}
|
{team.name}
|
||||||
</div>
|
</div>
|
||||||
<div class="truncate text-center font-bold">
|
|
||||||
{team.id === '0' ? 'root team' : ''}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-1 text-center">{team.permissions?.length} member(s)</div>
|
<div class="mt-1 text-center">{team.permissions?.length} member(s)</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user