Replace ${base} with resolve()
This removes some deprecated code. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
b8ff6d9e14
commit
69a2c509a7
99 changed files with 181 additions and 185 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import type { Instance } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import DataTable from './DataTable.svelte';
|
||||
import { EntityCell, StatusCell, GenericCell, ActionsCell } from './cells';
|
||||
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<div class="px-4 py-5 sm:p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-white">Instances ({instances.length})</h2>
|
||||
<a href={`${base}/instances`} class="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300">View all instances</a>
|
||||
<a href={resolve('/instances')} class="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300">View all instances</a>
|
||||
</div>
|
||||
<DataTable
|
||||
{columns}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import ActionButton from './ActionButton.svelte';
|
||||
import Badge from './Badge.svelte';
|
||||
import { getForgeIcon } from '$lib/utils/common.js';
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
href = href.replace('{id}', item.id || '');
|
||||
href = href.replace('{name}', encodeURIComponent(item.name || ''));
|
||||
|
||||
return `${base}${href}`;
|
||||
return resolve(href);
|
||||
}
|
||||
|
||||
function handleAction(actionType: string) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import { auth, authStore } from '$lib/stores/auth.js';
|
||||
import { websocketStore } from '$lib/stores/websocket.js';
|
||||
import { onMount } from 'svelte';
|
||||
|
|
@ -70,37 +70,37 @@
|
|||
// Navigation items with pools and scale sets grouped together, instances after scale sets
|
||||
const mainNavItems = [
|
||||
{
|
||||
href: `${base}/`,
|
||||
href: resolve('/'),
|
||||
label: 'Dashboard',
|
||||
icon: ['M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z', 'M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z']
|
||||
},
|
||||
{
|
||||
href: `${base}/repositories`,
|
||||
href: resolve('/repositories'),
|
||||
label: 'Repositories',
|
||||
icon: ['M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z', 'M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z']
|
||||
},
|
||||
{
|
||||
href: `${base}/organizations`,
|
||||
href: resolve('/organizations'),
|
||||
label: 'Organizations',
|
||||
icon: 'M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4'
|
||||
},
|
||||
{
|
||||
href: `${base}/enterprises`,
|
||||
href: resolve('/enterprises'),
|
||||
label: 'Enterprises',
|
||||
icon: 'M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4'
|
||||
},
|
||||
{
|
||||
href: `${base}/pools`,
|
||||
href: resolve('/pools'),
|
||||
label: 'Pools',
|
||||
icon: 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'
|
||||
},
|
||||
{
|
||||
href: `${base}/scalesets`,
|
||||
href: resolve('/scalesets'),
|
||||
label: 'Scale Sets',
|
||||
icon: 'M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4'
|
||||
},
|
||||
{
|
||||
href: `${base}/instances`,
|
||||
href: resolve('/instances'),
|
||||
label: 'Runners',
|
||||
icon: 'M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z'
|
||||
}
|
||||
|
|
@ -108,12 +108,12 @@
|
|||
|
||||
const configNavItems = [
|
||||
{
|
||||
href: `${base}/credentials`,
|
||||
href: resolve('/credentials'),
|
||||
label: 'Credentials',
|
||||
icon: 'M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z'
|
||||
},
|
||||
{
|
||||
href: `${base}/endpoints`,
|
||||
href: resolve('/endpoints'),
|
||||
label: 'Endpoints',
|
||||
icon: 'M13 10V3L4 14h7v7l9-11h-7z'
|
||||
}
|
||||
|
|
@ -129,14 +129,14 @@
|
|||
<div class="flex-shrink-0 border-b border-gray-200 dark:border-gray-700">
|
||||
<!-- Logo Area - Generous padding and larger size -->
|
||||
<div class="px-6 py-3 bg-gradient-to-r from-gray-50 to-white dark:from-gray-800 dark:to-gray-700">
|
||||
<a href={`${base}/`} class="flex justify-center">
|
||||
<a href={resolve('/')} class="flex justify-center">
|
||||
<img
|
||||
src="{base}/assets/garm-light.svg"
|
||||
src={resolve('/assets/garm-light.svg')}
|
||||
alt="GARM"
|
||||
class="h-24 w-auto dark:hidden transition-transform hover:scale-105"
|
||||
/>
|
||||
<img
|
||||
src="{base}/assets/garm-dark.svg"
|
||||
src={resolve('/assets/garm-dark.svg')}
|
||||
alt="GARM"
|
||||
class="h-24 w-auto hidden dark:block transition-transform hover:scale-105"
|
||||
/>
|
||||
|
|
@ -268,12 +268,12 @@
|
|||
<!-- Mobile logo and status -->
|
||||
<div class="flex items-center space-x-3">
|
||||
<img
|
||||
src="{base}/assets/garm-light.svg"
|
||||
src={resolve('/assets/garm-light.svg')}
|
||||
alt="GARM"
|
||||
class="{darkMode ? 'hidden' : 'block'} h-8 w-8"
|
||||
/>
|
||||
<img
|
||||
src="{base}/assets/garm-dark.svg"
|
||||
src={resolve('/assets/garm-dark.svg')}
|
||||
alt="GARM"
|
||||
class="{darkMode ? 'block' : 'hidden'} h-8 w-8"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import type { Pool } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import { getEnabledStatusBadge, getEntityName } from '$lib/utils/common.js';
|
||||
import { eagerCache } from '$lib/stores/eager-cache.js';
|
||||
import DataTable from './DataTable.svelte';
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
<div class="px-4 py-5 sm:p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-white">Pools ({pools.length})</h2>
|
||||
<a href={`${base}/pools`} class="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300">View all pools</a>
|
||||
<a href={resolve('/pools')} class="text-sm text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300">View all pools</a>
|
||||
</div>
|
||||
{#if pools.length === 0}
|
||||
<!-- Custom empty state with Add Pool button -->
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
|
||||
export let item: any;
|
||||
export let entityType: 'repository' | 'organization' | 'enterprise' | 'pool' | 'scaleset' | 'instance' = 'repository';
|
||||
|
|
@ -51,17 +51,17 @@
|
|||
|
||||
switch (entityType) {
|
||||
case 'repository':
|
||||
return `${base}/repositories/${entityId}`;
|
||||
return resolve(`/repositories/${entityId}`);
|
||||
case 'organization':
|
||||
return `${base}/organizations/${entityId}`;
|
||||
return resolve(`/organizations/${entityId}`);
|
||||
case 'enterprise':
|
||||
return `${base}/enterprises/${entityId}`;
|
||||
return resolve(`/enterprises/${entityId}`);
|
||||
case 'pool':
|
||||
return `${base}/pools/${entityId}`;
|
||||
return resolve(`/pools/${entityId}`);
|
||||
case 'scaleset':
|
||||
return `${base}/scalesets/${entityId}`;
|
||||
return resolve(`/scalesets/${entityId}`);
|
||||
case 'instance':
|
||||
return `${base}/instances/${encodeURIComponent(entityId)}`;
|
||||
return resolve(`/instances/${encodeURIComponent(entityId)}`);
|
||||
default:
|
||||
return '#';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
|
||||
export let item: any;
|
||||
</script>
|
||||
|
||||
<div class="w-full min-w-0 text-sm font-medium">
|
||||
{#if item?.pool_id}
|
||||
<a href="{base}/pools/{item.pool_id}" class="text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate block text-sm" title="Pool: {item.pool_id}">
|
||||
<a href={resolve(`/pools/${item.pool_id}`)} class="text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate block text-sm" title="Pool: {item.pool_id}">
|
||||
Pool: {item.pool_id}
|
||||
</a>
|
||||
{:else if item?.scale_set_id}
|
||||
<a href="{base}/scalesets/{item.scale_set_id}" class="text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate block text-sm" title="Scale Set: {item.scale_set_id}">
|
||||
<a href={resolve(`/scalesets/${item.scale_set_id}`)} class="text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate block text-sm" title="Scale Set: {item.scale_set_id}">
|
||||
Scale Set: {item.scale_set_id}
|
||||
</a>
|
||||
{:else}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { getEntityName, getEntityType, getEntityUrl } from '$lib/utils/common.js';
|
||||
|
||||
export let item: any;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import { auth, authStore } from '$lib/stores/auth.js';
|
||||
import Navigation from '$lib/components/Navigation.svelte';
|
||||
import Toast from '$lib/components/Toast.svelte';
|
||||
|
|
@ -13,14 +13,14 @@
|
|||
|
||||
// Check for redirect after auth state settles
|
||||
setTimeout(() => {
|
||||
const isLoginPage = $page.url.pathname === `${base}/login`;
|
||||
const isInitPage = $page.url.pathname === `${base}/init`;
|
||||
const isLoginPage = $page.url.pathname === resolve('/login');
|
||||
const isInitPage = $page.url.pathname === resolve('/init');
|
||||
|
||||
if (!isLoginPage && !isInitPage && !$authStore.isAuthenticated && !$authStore.loading) {
|
||||
if ($authStore.needsInitialization) {
|
||||
goto(`${base}/init`);
|
||||
goto(resolve('/init'));
|
||||
} else {
|
||||
goto(`${base}/login`);
|
||||
goto(resolve('/login'));
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
|
|
@ -29,21 +29,21 @@
|
|||
// Reactive redirect logic
|
||||
$: {
|
||||
if (!$authStore.loading) {
|
||||
const isLoginPage = $page.url.pathname === `${base}/login`;
|
||||
const isInitPage = $page.url.pathname === `${base}/init`;
|
||||
const isLoginPage = $page.url.pathname === resolve('/login');
|
||||
const isInitPage = $page.url.pathname === resolve('/init');
|
||||
|
||||
if (!isLoginPage && !isInitPage && !$authStore.isAuthenticated) {
|
||||
if ($authStore.needsInitialization) {
|
||||
goto(`${base}/init`);
|
||||
goto(resolve('/init'));
|
||||
} else {
|
||||
goto(`${base}/login`);
|
||||
goto(resolve('/login'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: isLoginPage = $page.url.pathname === `${base}/login`;
|
||||
$: isInitPage = $page.url.pathname === `${base}/init`;
|
||||
$: isLoginPage = $page.url.pathname === resolve('/login');
|
||||
$: isInitPage = $page.url.pathname === resolve('/init');
|
||||
$: requiresAuth = !isLoginPage && !isInitPage;
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import { websocketStore, type WebSocketEvent } from '$lib/stores/websocket.js';
|
||||
import { eagerCacheManager, eagerCache } from '$lib/stores/eager-cache.js';
|
||||
|
|
@ -156,28 +156,28 @@
|
|||
value: stats.repositories,
|
||||
icon: 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z',
|
||||
color: 'blue',
|
||||
href: `${base}/repositories`
|
||||
href: resolve('/repositories')
|
||||
},
|
||||
{
|
||||
title: 'Organizations',
|
||||
value: stats.organizations,
|
||||
icon: 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z',
|
||||
color: 'green',
|
||||
href: `${base}/organizations`
|
||||
href: resolve('/organizations')
|
||||
},
|
||||
{
|
||||
title: 'Pools',
|
||||
value: stats.pools,
|
||||
icon: 'M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z',
|
||||
color: 'purple',
|
||||
href: `${base}/pools`
|
||||
href: resolve('/pools')
|
||||
},
|
||||
{
|
||||
title: 'Instances',
|
||||
value: stats.instances,
|
||||
icon: 'M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z',
|
||||
color: 'yellow',
|
||||
href: `${base}/instances`
|
||||
href: resolve('/instances')
|
||||
}
|
||||
];
|
||||
|
||||
|
|
@ -272,7 +272,7 @@
|
|||
|
||||
<div class="mt-6 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<a
|
||||
href="{base}/repositories"
|
||||
href={resolve('/repositories')}
|
||||
class="relative block w-full bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg p-6 hover:border-gray-400 dark:hover:border-gray-500 hover:shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
|
|
@ -287,7 +287,7 @@
|
|||
</a>
|
||||
|
||||
<a
|
||||
href="{base}/pools"
|
||||
href={resolve('/pools')}
|
||||
class="relative block w-full bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg p-6 hover:border-gray-400 dark:hover:border-gray-500 hover:shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
|
|
@ -302,7 +302,7 @@
|
|||
</a>
|
||||
|
||||
<a
|
||||
href="{base}/instances"
|
||||
href={resolve('/instances')}
|
||||
class="relative block w-full bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg p-6 hover:border-gray-400 dark:hover:border-gray-500 hover:shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Enterprise, CreateEnterpriseParams, UpdateEntityParams } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import PageHeader from '$lib/components/PageHeader.svelte';
|
||||
import CreateEnterpriseModal from '$lib/components/CreateEnterpriseModal.svelte';
|
||||
import UpdateEntityModal from '$lib/components/UpdateEntityModal.svelte';
|
||||
|
|
@ -269,7 +269,7 @@ import { EntityCell, EndpointCell, StatusCell, ActionsCell, GenericCell } from '
|
|||
{@const status = getEntityStatusBadge(enterprise)}
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex-1 min-w-0">
|
||||
<a href={`${base}/enterprises/${enterprise.id}`} class="block">
|
||||
<a href={resolve(`/enterprises/${enterprise.id}`)} class="block">
|
||||
<p class="text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate">
|
||||
{enterprise.name}
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Enterprise, Pool, Instance } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import UpdateEntityModal from '$lib/components/UpdateEntityModal.svelte';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
import EntityInformation from '$lib/components/EntityInformation.svelte';
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
if (!enterprise) return;
|
||||
try {
|
||||
await garmApi.deleteEnterprise(enterprise.id!);
|
||||
goto(`${base}/enterprises`);
|
||||
goto(resolve('/enterprises'));
|
||||
} catch (err) {
|
||||
const errorMessage = extractAPIError(err);
|
||||
toastStore.error(
|
||||
|
|
@ -182,7 +182,7 @@
|
|||
const deletedEnterpriseId = event.payload.id || event.payload;
|
||||
// If this enterprise was deleted, redirect to enterprises list
|
||||
if (enterprise && enterprise.id === deletedEnterpriseId) {
|
||||
goto(`${base}/enterprises`);
|
||||
goto(resolve('/enterprises'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -287,7 +287,7 @@
|
|||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a href={`${base}/enterprises`} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<a href={resolve('/enterprises')} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/>
|
||||
</svg>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import { auth, authStore } from '$lib/stores/auth.js';
|
||||
import { toastStore } from '$lib/stores/toast.js';
|
||||
import { extractAPIError } from '$lib/utils/apiError';
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
);
|
||||
|
||||
// Redirect to dashboard
|
||||
goto(`${base}/`);
|
||||
goto(resolve('/'));
|
||||
} catch (err) {
|
||||
error = extractAPIError(err);
|
||||
} finally {
|
||||
|
|
@ -79,22 +79,22 @@
|
|||
onMount(() => {
|
||||
// If already authenticated, redirect to dashboard
|
||||
if ($authStore.isAuthenticated) {
|
||||
goto(`${base}/`);
|
||||
goto(resolve('/'));
|
||||
return;
|
||||
}
|
||||
|
||||
// If doesn't need initialization, redirect to login
|
||||
if (!$authStore.needsInitialization && !$authStore.loading) {
|
||||
goto(`${base}/login`);
|
||||
goto(resolve('/login'));
|
||||
}
|
||||
});
|
||||
|
||||
// Redirect if auth state changes
|
||||
$: {
|
||||
if ($authStore.isAuthenticated) {
|
||||
goto(`${base}/`);
|
||||
goto(resolve('/'));
|
||||
} else if (!$authStore.needsInitialization && !$authStore.loading) {
|
||||
goto(`${base}/login`);
|
||||
goto(resolve('/login'));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -107,12 +107,12 @@
|
|||
<div class="sm:mx-auto sm:w-full sm:max-w-md">
|
||||
<div class="flex justify-center">
|
||||
<img
|
||||
src="{base}/assets/garm-light.svg"
|
||||
src={resolve('/assets/garm-light.svg')}
|
||||
alt="GARM"
|
||||
class="h-16 w-auto dark:hidden"
|
||||
/>
|
||||
<img
|
||||
src="{base}/assets/garm-dark.svg"
|
||||
src={resolve('/assets/garm-dark.svg')}
|
||||
alt="GARM"
|
||||
class="h-16 w-auto hidden dark:block"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Instance } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
import { websocketStore, type WebSocketEvent } from '$lib/stores/websocket.js';
|
||||
import { formatStatusText, getStatusBadgeClass } from '$lib/utils/status.js';
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
if (!instance) return;
|
||||
try {
|
||||
await garmApi.deleteInstance(instance.name!);
|
||||
goto(`${base}/instances`);
|
||||
goto(resolve('/instances'));
|
||||
} catch (err) {
|
||||
error = extractAPIError(err);
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
// Instance was deleted - redirect to list page
|
||||
const instanceId = event.payload.id || event.payload;
|
||||
if (instanceId === instance.id) {
|
||||
goto(`${base}/instances`);
|
||||
goto(resolve('/instances'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a href={`${base}/instances`} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<a href={resolve('/instances')} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/>
|
||||
</svg>
|
||||
|
|
@ -187,11 +187,11 @@
|
|||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">Pool/Scale Set:</dt>
|
||||
<dd class="text-sm font-mono text-gray-900 dark:text-white break-all">
|
||||
{#if instance.pool_id}
|
||||
<a href="{base}/pools/{instance.pool_id}" class="text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-300 hover:underline">
|
||||
<a href={resolve(`/pools/${instance.pool_id}`)} class="text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 hover:underline">
|
||||
{instance.pool_id}
|
||||
</a>
|
||||
{:else if instance.scale_set_id}
|
||||
<a href="{base}/scalesets/{instance.scale_set_id}" class="text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-300 hover:underline">
|
||||
<a href={resolve(`/scalesets/${instance.scale_set_id}`)} class="text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 hover:underline">
|
||||
{instance.scale_set_id}
|
||||
</a>
|
||||
{:else}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import { auth, authStore } from '$lib/stores/auth.js';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import { extractAPIError } from '$lib/utils/apiError';
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
// Redirect if already authenticated
|
||||
$: if ($authStore.isAuthenticated) {
|
||||
goto(`${base}/`);
|
||||
goto(resolve('/'));
|
||||
}
|
||||
|
||||
async function handleLogin() {
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
try {
|
||||
await auth.login(username, password);
|
||||
goto(`${base}/`);
|
||||
goto(resolve('/'));
|
||||
} catch (err) {
|
||||
error = extractAPIError(err);
|
||||
} finally {
|
||||
|
|
@ -76,12 +76,12 @@
|
|||
<div>
|
||||
<div class="mx-auto h-48 w-auto flex justify-center">
|
||||
<img
|
||||
src="{base}/assets/garm-light.svg"
|
||||
src={resolve('/assets/garm-light.svg')}
|
||||
alt="GARM"
|
||||
class="h-48 w-auto dark:hidden"
|
||||
/>
|
||||
<img
|
||||
src="{base}/assets/garm-dark.svg"
|
||||
src={resolve('/assets/garm-dark.svg')}
|
||||
alt="GARM"
|
||||
class="h-48 w-auto hidden dark:block"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Organization, CreateOrgParams, UpdateEntityParams } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import CreateOrganizationModal from '$lib/components/CreateOrganizationModal.svelte';
|
||||
import UpdateEntityModal from '$lib/components/UpdateEntityModal.svelte';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
|
|
@ -307,7 +307,7 @@ import { EntityCell, EndpointCell, StatusCell, ActionsCell, GenericCell } from '
|
|||
{@const status = getEntityStatusBadge(organization)}
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex-1 min-w-0">
|
||||
<a href={`${base}/organizations/${organization.id}`} class="block">
|
||||
<a href={resolve(`/organizations/${organization.id}`)} class="block">
|
||||
<p class="text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-500 dark:hover:text-blue-300 truncate">
|
||||
{organization.name}
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Organization, Pool, Instance } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import UpdateEntityModal from '$lib/components/UpdateEntityModal.svelte';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
import EntityInformation from '$lib/components/EntityInformation.svelte';
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
if (!organization) return;
|
||||
try {
|
||||
await garmApi.deleteOrganization(organization.id!);
|
||||
goto(`${base}/organizations`);
|
||||
goto(resolve('/organizations'));
|
||||
} catch (err) {
|
||||
const errorMessage = extractAPIError(err);
|
||||
toastStore.error(
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
const deletedOrganizationId = event.payload.id || event.payload;
|
||||
// If this organization was deleted, redirect to organizations list
|
||||
if (organization && organization.id === deletedOrganizationId) {
|
||||
goto(`${base}/organizations`);
|
||||
goto(resolve('/organizations'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@
|
|||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a href={`${base}/organizations`} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<a href={resolve('/organizations')} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/>
|
||||
</svg>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Pool, UpdatePoolParams } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import UpdatePoolModal from '$lib/components/UpdatePoolModal.svelte';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
import InstancesSection from '$lib/components/InstancesSection.svelte';
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
if (!pool) return;
|
||||
try {
|
||||
await garmApi.deletePool(pool.id!);
|
||||
goto(`${base}/pools`);
|
||||
goto(resolve('/pools'));
|
||||
} catch (err) {
|
||||
const errorMessage = extractAPIError(err);
|
||||
toastStore.error(
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
const deletedPoolId = event.payload.id || event.payload;
|
||||
// If this pool was deleted, redirect to pools list
|
||||
if (pool && pool.id === deletedPoolId) {
|
||||
goto(`${base}/pools`);
|
||||
goto(resolve('/pools'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a href={`${base}/pools`} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<a href={resolve('/pools')} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/>
|
||||
</svg>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { Repository, Pool, Instance } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import UpdateEntityModal from '$lib/components/UpdateEntityModal.svelte';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
import EntityInformation from '$lib/components/EntityInformation.svelte';
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
if (!repository) return;
|
||||
try {
|
||||
await garmApi.deleteRepository(repository.id!);
|
||||
goto(`${base}/repositories`);
|
||||
goto(resolve('/repositories'));
|
||||
} catch (err) {
|
||||
const errorMessage = extractAPIError(err);
|
||||
toastStore.error(
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
const deletedRepositoryId = event.payload.id || event.payload;
|
||||
// If this repository was deleted, redirect to repositories list
|
||||
if (repository && repository.id === deletedRepositoryId) {
|
||||
goto(`${base}/repositories`);
|
||||
goto(resolve('/repositories'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@
|
|||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a href={`${base}/repositories`} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<a href={resolve('/repositories')} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/>
|
||||
</svg>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { ScaleSet, CreateScaleSetParams } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import PageHeader from '$lib/components/PageHeader.svelte';
|
||||
import CreateScaleSetModal from '$lib/components/CreateScaleSetModal.svelte';
|
||||
import UpdateScaleSetModal from '$lib/components/UpdateScaleSetModal.svelte';
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { garmApi } from '$lib/api/client.js';
|
||||
import type { ScaleSet, CreateScaleSetParams } from '$lib/api/generated/api.js';
|
||||
import { base } from '$app/paths';
|
||||
import { resolve } from '$app/paths';
|
||||
import UpdateScaleSetModal from '$lib/components/UpdateScaleSetModal.svelte';
|
||||
import DeleteModal from '$lib/components/DeleteModal.svelte';
|
||||
import InstancesSection from '$lib/components/InstancesSection.svelte';
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
if (!scaleSet) return;
|
||||
try {
|
||||
await garmApi.deleteScaleSet(scaleSet.id!);
|
||||
goto(`${base}/scalesets`);
|
||||
goto(resolve('/scalesets'));
|
||||
} catch (err) {
|
||||
const errorMessage = extractAPIError(err);
|
||||
toastStore.error(
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
const deletedScaleSetId = event.payload.id || event.payload;
|
||||
// If this scale set was deleted, redirect to scale sets list
|
||||
if (scaleSet && scaleSet.id === deletedScaleSetId) {
|
||||
goto(`${base}/scalesets`);
|
||||
goto(resolve('/scalesets'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a href={`${base}/scalesets`} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<a href={resolve('/scalesets')} class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg class="w-3 h-3 mr-2.5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/>
|
||||
</svg>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue