Migrate frontend to Svelte 5 runes semantics
This commit is contained in:
@@ -3,36 +3,34 @@
|
||||
@SEMANTICS: modal, mapping, prompt, migration
|
||||
@PURPOSE: Prompts the user to provide a database mapping when one is missing during migration.
|
||||
@LAYER: Feature
|
||||
@RELATION: DISPATCHES -> resolve
|
||||
@RELATION: BINDS_TO -> onresolve
|
||||
@RELATION: BINDS_TO -> oncancel
|
||||
|
||||
@INVARIANT: Modal blocks migration progress until resolved or cancelled.
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
// [SECTION: IMPORTS]
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
// [/SECTION]
|
||||
|
||||
// [SECTION: PROPS]
|
||||
let {
|
||||
show = false,
|
||||
sourceDbName = "",
|
||||
sourceDbUuid = "",
|
||||
targetDatabases = [],
|
||||
onresolve = () => {},
|
||||
oncancel = () => {},
|
||||
} = $props();
|
||||
|
||||
// [/SECTION]
|
||||
|
||||
let selectedTargetUuid = $state("");
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
// [DEF:resolve:Function]
|
||||
// @PURPOSE: Dispatches the resolution event with the selected mapping.
|
||||
// @PURPOSE: Resolves the missing mapping via callback prop.
|
||||
// @PRE: selectedTargetUuid must be set.
|
||||
// @POST: 'resolve' event is dispatched and modal is hidden.
|
||||
// @POST: Parent callback receives mapping payload and modal closes.
|
||||
function resolve() {
|
||||
if (!selectedTargetUuid) return;
|
||||
dispatch('resolve', {
|
||||
onresolve({
|
||||
sourceDbUuid,
|
||||
targetDbUuid: selectedTargetUuid,
|
||||
targetDbName: targetDatabases.find(d => d.uuid === selectedTargetUuid)?.database_name
|
||||
@@ -44,9 +42,9 @@
|
||||
// [DEF:cancel:Function]
|
||||
// @PURPOSE: Cancels the mapping resolution modal.
|
||||
// @PRE: Modal is open.
|
||||
// @POST: 'cancel' event is dispatched and modal is hidden.
|
||||
// @POST: Parent cancel callback is invoked and modal is hidden.
|
||||
function cancel() {
|
||||
dispatch('cancel');
|
||||
oncancel();
|
||||
show = false;
|
||||
}
|
||||
// [/DEF:cancel:Function]
|
||||
|
||||
Reference in New Issue
Block a user