feat(remote): Enhance remote branch management and stability
Improved handling for deleting remote branches across the application, enhancing both user experience and backend reliability. This includes adding structured logging to all Git remote operations in Rust, refining UI components to handle remote-specific deletion flows, and providing clear status/error feedback in sync settings. - Standardized styling for action toggles (Stash, Branch, Explorer) using consistent dimensions. - Implemented detailed console logging for all Git remote operations on the backend. - Refined dialogs and sync settings to provide explicit status and error messages during remote management.
This commit is contained in:
@@ -23,12 +23,37 @@
|
||||
let newUrl = "";
|
||||
let editingName = "";
|
||||
let editingUrl = "";
|
||||
let actionError = "";
|
||||
let actionStatus = "";
|
||||
$: de = language === "de";
|
||||
|
||||
function beginEdit(remote: GitRemote) { editingName = remote.name; editingUrl = remote.fetch_url; }
|
||||
function beginEdit(remote: GitRemote) { actionError = ""; editingName = remote.name; editingUrl = remote.fetch_url; }
|
||||
async function requestDelete(event: MouseEvent, name: string) {
|
||||
console.log(name)
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
editingName = "";
|
||||
actionError = "";
|
||||
actionStatus = de ? `Remote „${name}“ wird entfernt …` : `Removing remote “${name}” …`;
|
||||
console.info("[Gitty remote] remove button activated", { name });
|
||||
await remove(name);
|
||||
}
|
||||
function cancelEdit() { editingName = ""; editingUrl = ""; }
|
||||
async function add() { if (!newName.trim() || !newUrl.trim()) return; await onAddRemote(newName.trim(), newUrl.trim()); newName = "origin"; newUrl = ""; }
|
||||
async function update() { if (!editingName || !editingUrl.trim()) return; await onUpdateRemote(editingName, editingUrl.trim()); cancelEdit(); }
|
||||
async function remove(name: string) {
|
||||
actionError = "";
|
||||
console.log("remove")
|
||||
try {
|
||||
await onRemoveRemote(name);
|
||||
if (draftRemote === name) draftRemote = "";
|
||||
if (draftUpstream.startsWith(`${name}/`)) draftUpstream = "";
|
||||
} catch (error) {
|
||||
actionError = error instanceof Error ? error.message : String(error);
|
||||
} finally {
|
||||
actionStatus = "";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="dialog-backdrop" role="presentation">
|
||||
@@ -59,6 +84,8 @@
|
||||
<section class="sync-settings-card">
|
||||
<div class="sync-card-heading"><div><h3>Remotes</h3><p>{de ? "Server-Verbindungen dieses Repositorys verwalten." : "Manage this repository's server connections."}</p></div><span class="count-pill">{remotes.length}</span></div>
|
||||
<div class="remote-list">
|
||||
{#if actionError}<div class="sync-action-error" role="alert"><strong>{de ? "Remote konnte nicht entfernt werden" : "Remote could not be removed"}</strong><span>{actionError}</span></div>{/if}
|
||||
{#if actionStatus}<div class="sync-action-status" role="status">{actionStatus}</div>{/if}
|
||||
{#each remotes as remote (remote.name)}
|
||||
<div class="remote-row">
|
||||
<span class="remote-mark"><GitBranch size={15} /></span>
|
||||
@@ -68,7 +95,7 @@
|
||||
<button class="btn-sm" type="button" onclick={cancelEdit} disabled={isBusy}>{de ? "Abbrechen" : "Cancel"}</button>
|
||||
{:else}
|
||||
<button class="remote-main" type="button" onclick={() => beginEdit(remote)} disabled={isBusy}><strong>{remote.name}</strong><span>{remote.fetch_url}</span></button>
|
||||
<button class="remote-delete" type="button" onclick={() => onRemoveRemote(remote.name)} disabled={isBusy} aria-label={`${de ? "Remote löschen" : "Remove remote"} ${remote.name}`}><Trash2 size={14} /></button>
|
||||
<button class="remote-delete" type="button" onclick={(event) => requestDelete(event, remote.name)} data-remote-name={remote.name} title={de ? "Remote-Verbindung sofort entfernen; lokale Daten bleiben erhalten" : "Remove remote connection now; local data is kept"}><Trash2 size={13} /><span>{de ? "Entfernen" : "Remove"}</span></button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}<p class="remote-empty">{de ? "Noch kein Remote eingerichtet." : "No remote configured yet."}</p>{/each}
|
||||
|
||||
Reference in New Issue
Block a user