This commit is contained in:
Andras Bacsai
2022-08-16 09:38:34 +00:00
parent fb2a86ba3f
commit 6150a008d5
8 changed files with 40 additions and 9 deletions

View File

@@ -260,8 +260,8 @@ export const supportedServiceTypesAndVersions = [
fancyName: 'Hasura', fancyName: 'Hasura',
baseImage: 'hasura/graphql-engine', baseImage: 'hasura/graphql-engine',
images: ['postgres:12-alpine'], images: ['postgres:12-alpine'],
versions: ['latest', 'v2.8.4', 'v2.5.1'], versions: ['latest', 'v2.10.0', 'v2.5.1'],
recommendedVersion: 'v2.8.4', recommendedVersion: 'v2.10.0',
ports: { ports: {
main: 8080 main: 8080
} }

View File

@@ -131,8 +131,8 @@ export const supportedServiceTypesAndVersions = [
fancyName: 'Hasura', fancyName: 'Hasura',
baseImage: 'hasura/graphql-engine', baseImage: 'hasura/graphql-engine',
images: ['postgres:12-alpine'], images: ['postgres:12-alpine'],
versions: ['latest', 'v2.5.1'], versions: ['latest', 'v2.10.0', 'v2.5.1'],
recommendedVersion: 'v2.5.1', recommendedVersion: 'v2.10.0',
ports: { ports: {
main: 8080 main: 8080
} }

View File

@@ -31,6 +31,7 @@
import { t } from '$lib/translations'; import { t } from '$lib/translations';
import { appSession } from '$lib/store'; import { appSession } from '$lib/store';
import { errorNotification } from '$lib/common'; import { errorNotification } from '$lib/common';
import { onMount } from 'svelte/types/runtime/internal/lifecycle';
const { id } = $page.params; const { id } = $page.params;
const from = $page.url.searchParams.get('from'); const from = $page.url.searchParams.get('from');
@@ -55,6 +56,11 @@
return errorNotification(error); return errorNotification(error);
} }
} }
onMount(async () => {
if (destinations.length === 1) {
await handleSubmit(destinations[0].id);
}
});
</script> </script>
<div class="flex space-x-1 p-6 font-bold"> <div class="flex space-x-1 p-6 font-bold">
@@ -65,7 +71,9 @@
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
{#if !destinations || ownDestinations.length === 0} {#if !destinations || ownDestinations.length === 0}
<div class="flex-col"> <div class="flex-col">
<div class="pb-2 text-center font-bold">{$t('application.configuration.no_configurable_destination')}</div> <div class="pb-2 text-center font-bold">
{$t('application.configuration.no_configurable_destination')}
</div>
<div class="flex justify-center"> <div class="flex justify-center">
<a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500"> <a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
<svg <svg

View File

@@ -30,6 +30,7 @@
import { get, post } from '$lib/api'; import { get, post } from '$lib/api';
import { t } from '$lib/translations'; import { t } from '$lib/translations';
import { errorNotification } from '$lib/common'; import { errorNotification } from '$lib/common';
import { onMount } from 'svelte';
const { id } = $page.params; const { id } = $page.params;
const from = $page.url.searchParams.get('from'); const from = $page.url.searchParams.get('from');
@@ -45,6 +46,11 @@
return errorNotification(error); return errorNotification(error);
} }
} }
onMount(async () => {
if (destinations.length === 1) {
await handleSubmit(destinations[0].id);
}
});
</script> </script>
<div class="flex space-x-1 p-6 font-bold"> <div class="flex space-x-1 p-6 font-bold">
@@ -55,7 +61,9 @@
<div class="flex justify-center"> <div class="flex justify-center">
{#if !destinations || destinations.length === 0} {#if !destinations || destinations.length === 0}
<div class="flex-col"> <div class="flex-col">
<div class="pb-2 text-center font-bold">{$t('application.configuration.no_configurable_destination')}</div> <div class="pb-2 text-center font-bold">
{$t('application.configuration.no_configurable_destination')}
</div>
<div class="flex justify-center"> <div class="flex justify-center">
<a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500"> <a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
<svg <svg

View File

@@ -39,7 +39,7 @@
export let services: any; export let services: any;
let numberOfGetStatus = 0; let numberOfGetStatus = 0;
function getRndInteger(min, max) { function getRndInteger(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1) ) + min; return Math.floor(Math.random() * (max - min + 1) ) + min;
} }

View File

@@ -110,7 +110,6 @@
loading = true; loading = true;
try { try {
await post(`/services/${service.id}/${service.type}/start`, {}); await post(`/services/${service.id}/${service.type}/start`, {});
return window.location.reload();
} catch (error) { } catch (error) {
return errorNotification(error); return errorNotification(error);
} finally { } finally {

View File

@@ -32,10 +32,16 @@
import { get, post } from '$lib/api'; import { get, post } from '$lib/api';
import { t } from '$lib/translations'; import { t } from '$lib/translations';
import { errorNotification } from '$lib/common'; import { errorNotification } from '$lib/common';
import { onMount } from 'svelte';
const { id } = $page.params; const { id } = $page.params;
const from = $page.url.searchParams.get('from'); const from = $page.url.searchParams.get('from');
onMount(async () => {
if (destinations.length === 1) {
await handleSubmit(destinations[0].id);
}
});
async function handleSubmit(destinationId: any) { async function handleSubmit(destinationId: any) {
try { try {
await post(`/services/${id}/configuration/destination`, { destinationId }); await post(`/services/${id}/configuration/destination`, { destinationId });
@@ -54,7 +60,9 @@
<div class="flex justify-center"> <div class="flex justify-center">
{#if !destinations || destinations.length === 0} {#if !destinations || destinations.length === 0}
<div class="flex-col"> <div class="flex-col">
<div class="pb-2 text-center font-bold">{$t('application.configuration.no_configurable_destination')}</div> <div class="pb-2 text-center font-bold">
{$t('application.configuration.no_configurable_destination')}
</div>
<div class="flex justify-center"> <div class="flex justify-center">
<a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500"> <a href="/new/destination" sveltekit:prefetch class="add-icon bg-sky-600 hover:bg-sky-500">
<svg <svg

View File

@@ -32,12 +32,20 @@
import { get, post } from '$lib/api'; import { get, post } from '$lib/api';
import { t } from '$lib/translations'; import { t } from '$lib/translations';
import { errorNotification, supportedServiceTypesAndVersions } from '$lib/common'; import { errorNotification, supportedServiceTypesAndVersions } from '$lib/common';
import { onMount } from 'svelte';
const { id } = $page.params; const { id } = $page.params;
const from = $page.url.searchParams.get('from'); const from = $page.url.searchParams.get('from');
let recommendedVersion = supportedServiceTypesAndVersions.find( let recommendedVersion = supportedServiceTypesAndVersions.find(
({ name }) => name === type ({ name }) => name === type
)?.recommendedVersion; )?.recommendedVersion;
onMount(async () => {
if (versions.length === 1) {
await handleSubmit(versions[0]);
}
});
async function handleSubmit(version: any) { async function handleSubmit(version: any) {
try { try {
await post(`/services/${id}/configuration/version`, { version }); await post(`/services/${id}/configuration/version`, { version });