mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 08:11:24 +02:00
Show push errors in commit dialog
This commit is contained in:
@@ -12,7 +12,7 @@ import classNames from 'classnames';
|
|||||||
|
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||||
import { showToast } from '../lib/toast';
|
import {showErrorToast, showToast} from '../lib/toast';
|
||||||
import { Banner } from './core/Banner';
|
import { Banner } from './core/Banner';
|
||||||
import { Button } from './core/Button';
|
import { Button } from './core/Button';
|
||||||
import type { CheckboxProps } from './core/Checkbox';
|
import type { CheckboxProps } from './core/Checkbox';
|
||||||
@@ -49,7 +49,11 @@ export function GitCommitDialog({ syncDir, onDone, workspace }: Props) {
|
|||||||
|
|
||||||
const handleCreateCommitAndPush = async () => {
|
const handleCreateCommitAndPush = async () => {
|
||||||
await commit.mutateAsync({ message });
|
await commit.mutateAsync({ message });
|
||||||
await push.mutateAsync();
|
await push.mutateAsync(undefined, {
|
||||||
|
onError(err) {
|
||||||
|
showErrorToast('git-push-error', String(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
showToast({ id: 'git-push-success', message: 'Pushed changes', color: 'success' });
|
showToast({ id: 'git-push-success', message: 'Pushed changes', color: 'success' });
|
||||||
onDone();
|
onDone();
|
||||||
};
|
};
|
||||||
@@ -278,6 +282,10 @@ function ExternalTreeNode({
|
|||||||
entry: GitStatusEntry;
|
entry: GitStatusEntry;
|
||||||
onCheck: (entry: GitStatusEntry) => void;
|
onCheck: (entry: GitStatusEntry) => void;
|
||||||
}) {
|
}) {
|
||||||
|
if (entry.status === 'current') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
fullWidth
|
fullWidth
|
||||||
@@ -288,18 +296,16 @@ function ExternalTreeNode({
|
|||||||
<div className="grid grid-cols-[auto_minmax(0,1fr)_auto] gap-1 w-full items-center">
|
<div className="grid grid-cols-[auto_minmax(0,1fr)_auto] gap-1 w-full items-center">
|
||||||
<Icon color="secondary" icon="file_code" />
|
<Icon color="secondary" icon="file_code" />
|
||||||
<div className="truncate">{entry.relaPath}</div>
|
<div className="truncate">{entry.relaPath}</div>
|
||||||
{entry.status !== 'current' && (
|
<InlineCode
|
||||||
<InlineCode
|
className={classNames(
|
||||||
className={classNames(
|
'py-0 ml-auto bg-transparent w-[6rem] text-center',
|
||||||
'py-0 ml-auto bg-transparent w-[6rem] text-center',
|
entry.status === 'modified' && 'text-info',
|
||||||
entry.status === 'modified' && 'text-info',
|
entry.status === 'untracked' && 'text-success',
|
||||||
entry.status === 'untracked' && 'text-success',
|
entry.status === 'removed' && 'text-danger',
|
||||||
entry.status === 'removed' && 'text-danger',
|
)}
|
||||||
)}
|
>
|
||||||
>
|
{entry.status}
|
||||||
{entry.status}
|
</InlineCode>
|
||||||
</InlineCode>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export function HistoryDialog({ log }: Props) {
|
|||||||
<TableBody>
|
<TableBody>
|
||||||
{log.map((l, i) => (
|
{log.map((l, i) => (
|
||||||
<TableRow key={i}>
|
<TableRow key={i}>
|
||||||
<TruncatedWideTableCell>{l.message}</TruncatedWideTableCell>
|
<TruncatedWideTableCell>{l.message || <em className="text-text-subtle">No message</em>}</TruncatedWideTableCell>
|
||||||
<TableCell className="font-bold">{l.author.name ?? 'Unknown'}</TableCell>
|
<TableCell>{l.author.name ?? 'Unknown'}</TableCell>
|
||||||
<TableCell className="text-text-subtle">
|
<TableCell className="text-text-subtle">
|
||||||
<span title={l.when}>{formatDistanceToNowStrict(l.when)} ago</span>
|
<span title={l.when}>{formatDistanceToNowStrict(l.when)} ago</span>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
Reference in New Issue
Block a user