This commit is contained in:
Andras Bacsai 2022-11-07 09:36:51 +01:00
parent 1c2d76e651
commit 2a9bd00a50
4 changed files with 26 additions and 9 deletions

View File

@ -189,7 +189,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
const variable = foundTemplate.variables.find(v => v.id === proxyValue.domain) const variable = foundTemplate.variables.find(v => v.id === proxyValue.domain)
if (variable) { if (variable) {
const { id, name, label, description, defaultValue, required = false } = variable const { id, name, label, description, defaultValue, required = false } = variable
const found = await prisma.serviceSetting.findFirst({ where: { variableName: proxyValue.domain } }) const found = await prisma.serviceSetting.findFirst({ where: { serviceId: service.id , variableName: proxyValue.domain } })
parsedTemplate[realKey].fqdns.push( parsedTemplate[realKey].fqdns.push(
{ id, name, value: found?.value || '', label, description, defaultValue, required } { id, name, value: found?.value || '', label, description, defaultValue, required }
) )

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
export let type: string; export let type: string;
export let isAbsolute = true; export let isAbsolute = false;
let extension = 'png'; let extension = 'png';
let svgs = [ let svgs = [
@ -35,7 +35,7 @@
case 'weblate': case 'weblate':
return 'w-12 h-12 -mt-3'; return 'w-12 h-12 -mt-3';
default: default:
return isAbsolute ? 'w-10 h-10' : 'w-8 h-8 mx-auto'; return isAbsolute ? 'w-10 h-10 absolute -m-4 -mt-9 left-0' : 'w-10 h-10';
} }
} }
</script> </script>

View File

@ -41,6 +41,7 @@
import ServiceIcons from '$lib/components/svg/services/ServiceIcons.svelte'; import ServiceIcons from '$lib/components/svg/services/ServiceIcons.svelte';
import { dev } from '$app/env'; import { dev } from '$app/env';
import NewResource from './_NewResource.svelte'; import NewResource from './_NewResource.svelte';
import { onMount } from 'svelte';
let numberOfGetStatus = 0; let numberOfGetStatus = 0;
let status: any = {}; let status: any = {};
@ -54,8 +55,13 @@
services: false, services: false,
databases: false databases: false
}; };
let searchInput: HTMLInputElement;
doSearch(); doSearch();
onMount(() => {
setTimeout(() => {
searchInput.focus();
}, 100);
});
async function refreshStatusApplications() { async function refreshStatusApplications() {
noInitialStatus.applications = false; noInitialStatus.applications = false;
numberOfGetStatus = 0; numberOfGetStatus = 0;
@ -563,6 +569,7 @@
</div> </div>
<input <input
bind:this={searchInput}
id="search" id="search"
type="text" type="text"
placeholder="Search: You can search for names, domains, types, database types, version, servers etc..." placeholder="Search: You can search for names, domains, types, database types, version, servers etc..."

View File

@ -30,15 +30,22 @@
let search = ''; let search = '';
let filteredServices = services; let filteredServices = services;
import { page } from '$app/stores';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { get, post } from '$lib/api'; import { get, post } from '$lib/api';
import { errorNotification } from '$lib/common'; import { errorNotification } from '$lib/common';
import ServiceIcons from '$lib/components/svg/services/ServiceIcons.svelte'; import ServiceIcons from '$lib/components/svg/services/ServiceIcons.svelte';
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 searchInput: HTMLInputElement;
onMount(() => {
setTimeout(() => {
searchInput.focus();
}, 100);
});
async function handleSubmit(service: any) { async function handleSubmit(service: any) {
try { try {
await post(`/services/${id}/configuration/type`, { type: service.type }); await post(`/services/${id}/configuration/type`, { type: service.type });
@ -51,8 +58,10 @@
filteredServices = services.filter( filteredServices = services.filter(
(service: any) => (service: any) =>
service.name.toLowerCase().includes(search.toLowerCase()) || service.name.toLowerCase().includes(search.toLowerCase()) ||
service.labels?.some((label: string) => label.toLowerCase().includes(search.toLowerCase())) || service.labels?.some((label: string) =>
service.description.toLowerCase().includes(search.toLowerCase()) label.toLowerCase().includes(search.toLowerCase())
) ||
service.description.toLowerCase().includes(search.toLowerCase())
); );
} }
function cleanupSearch() { function cleanupSearch() {
@ -95,8 +104,9 @@
</svg> </svg>
</div> </div>
<input <input
bind:this={searchInput}
id="search" id="search"
class="input w-full" class="input w-full input-primary"
type="text" type="text"
placeholder="Search for services" placeholder="Search for services"
bind:value={search} bind:value={search}
@ -110,7 +120,7 @@
{#key service.name} {#key service.name}
<button <button
on:click={() => handleSubmit(service)} on:click={() => handleSubmit(service)}
class="box-selection relative text-xl font-bold hover:bg-primary " class="box-selection relative text-xl font-bold hover:bg-primary"
> >
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex justify-center items-center gap-2 pb-4"> <div class="flex justify-center items-center gap-2 pb-4">