Migrate frontend to Svelte 5 runes semantics
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
// [SECTION: IMPORTS]
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { t } from '$lib/i18n';
|
||||
// [/SECTION]
|
||||
|
||||
@@ -20,23 +19,22 @@
|
||||
targetDatabases = [],
|
||||
mappings = [],
|
||||
suggestions = [],
|
||||
onupdate = () => {},
|
||||
} = $props();
|
||||
|
||||
// [/SECTION]
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
// [DEF:updateMapping:Function]
|
||||
/**
|
||||
* @purpose Updates a mapping for a specific source database.
|
||||
* @pre sourceUuid and targetUuid are provided.
|
||||
* @post 'update' event is dispatched.
|
||||
* @post Parent callback receives normalized mapping payload.
|
||||
*/
|
||||
function updateMapping(sourceUuid: string, targetUuid: string) {
|
||||
const sDb = sourceDatabases.find(d => d.uuid === sourceUuid);
|
||||
const tDb = targetDatabases.find(d => d.uuid === targetUuid);
|
||||
|
||||
dispatch('update', {
|
||||
onupdate({
|
||||
sourceUuid,
|
||||
targetUuid,
|
||||
sourceName: sDb?.database_name || "",
|
||||
@@ -80,7 +78,7 @@
|
||||
<select
|
||||
class="block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md"
|
||||
value={mapping?.target_db_uuid || suggestion?.target_db_uuid || ""}
|
||||
on:change={(e) => updateMapping(sDb.uuid, (e.target as HTMLSelectElement).value)}
|
||||
onchange={(e) => updateMapping(sDb.uuid, (e.target as HTMLSelectElement).value)}
|
||||
>
|
||||
<option value="">{$t.migration?.target_env }</option>
|
||||
{#each targetDatabases as tDb}
|
||||
|
||||
Reference in New Issue
Block a user