feat: delete incident, fix git push, title template, clarify AI settings
Release APK / build (push) Has been cancelled

- IncidentDetailScreen: add Delete button (confirm dialog) wired to deleteIncident()
- git.ts: fix Gitea POST vs PUT (use PUT when file exists/sha present); add
  pre-flight validation for missing URL/token/owner/repo; add 15s fetch timeout
  with AbortError handling; improve error messages with actionable hints
- [id].tsx: guard URL for Gitea/GitLab before calling pushIncidentToGit
- settings.tsx: move ToggleRow/SegmentRow/Field outside SettingsScreen to fix
  TextInput focus loss on each keystroke (component remount on rerender)
- settings.tsx: add Title Template setting with auto-increment info card
- settings.tsx: add AI base URL + model fields; expand AI section description
- new.tsx: pre-fill title from pref_title_template; increment counter after save

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 13:34:41 +02:00
parent fee283b5d6
commit c915d5f2ad
4 changed files with 349 additions and 167 deletions
+20
View File
@@ -10,6 +10,7 @@ import {
Alert,
} from "react-native";
import { router, useLocalSearchParams, useNavigation } from "expo-router";
import * as SecureStore from "expo-secure-store";
import {
createIncident,
updateIncident,
@@ -48,6 +49,14 @@ const LABEL_STYLE = {
type VoiceField = "title" | "service" | "symptom" | "rootCause" | "fix";
function incrementTemplate(template: string): string {
const match = template.match(/^([\s\S]*?)(\d+)$/);
if (!match) return template;
const [, prefix, numStr] = match;
const next = (parseInt(numStr, 10) + 1).toString().padStart(numStr.length, "0");
return prefix + next;
}
export default function NewIncidentScreen() {
const { editId } = useLocalSearchParams<{ editId?: string }>();
const navigation = useNavigation();
@@ -74,6 +83,13 @@ export default function NewIncidentScreen() {
getDistinctServices().then(setKnownServices);
}, []);
useEffect(() => {
if (editId) return;
SecureStore.getItemAsync("pref_title_template").then((tpl) => {
if (tpl) setForm((f) => ({ ...f, title: tpl }));
});
}, [editId]);
useEffect(() => {
if (!editId) return;
navigation.setOptions({ title: "Edit Incident" });
@@ -144,6 +160,10 @@ export default function NewIncidentScreen() {
await updateIncident(editId, form);
} else {
await createIncident(form);
const tpl = await SecureStore.getItemAsync("pref_title_template");
if (tpl) {
await SecureStore.setItemAsync("pref_title_template", incrementTemplate(tpl));
}
}
router.back();
} catch {