From a1e4e651ccb3577ccf19594cb858d0755dc2039c Mon Sep 17 00:00:00 2001 From: Nikita Galaiko Date: Mon, 11 Dec 2023 11:17:20 +0100 Subject: [PATCH] ui for ok with force pushing --- packages/ui/src/lib/backend/projects.ts | 2 + .../routes/[projectId]/settings/+page.svelte | 5 +++ .../settings/PreferencesForm.svelte | 37 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 packages/ui/src/routes/[projectId]/settings/PreferencesForm.svelte diff --git a/packages/ui/src/lib/backend/projects.ts b/packages/ui/src/lib/backend/projects.ts index ac919d9df..4f072c995 100644 --- a/packages/ui/src/lib/backend/projects.ts +++ b/packages/ui/src/lib/backend/projects.ts @@ -24,6 +24,7 @@ export type Project = { path: string; api?: CloudProject & { sync: boolean }; preferred_key: Key; + ok_with_force_push: boolean; }; export class ProjectService { @@ -59,6 +60,7 @@ export class ProjectService { title?: string; api?: CloudProject & { sync: boolean }; preferred_key?: Key; + okWithForcePush?: boolean; }) { await invoke('update_project', { project: params }); this.reload(); diff --git a/packages/ui/src/routes/[projectId]/settings/+page.svelte b/packages/ui/src/routes/[projectId]/settings/+page.svelte index 72780e3d8..dde99d05c 100644 --- a/packages/ui/src/routes/[projectId]/settings/+page.svelte +++ b/packages/ui/src/routes/[projectId]/settings/+page.svelte @@ -4,6 +4,7 @@ import CloudForm from './CloudForm.svelte'; import DetailsForm from './DetailsForm.svelte'; import KeysForm from './KeysForm.svelte'; + import PreferencesForm from './PreferencesForm.svelte'; import type { PageData } from './$types'; import Modal from '$lib/components/Modal.svelte'; import Button from '$lib/components/Button.svelte'; @@ -39,6 +40,8 @@ projectService.updateProject({ ...$project$, ...e.detail }); const onCloudUpdated = (e: { detail: Project }) => projectService.updateProject({ ...$project$, ...e.detail }); + const onPreferencesUpdated = (e: { detail: { ok_with_force_push: boolean } }) => + projectService.updateProject({ ...$project$, ...e.detail }); const onDetailsUpdated = async (e: { detail: Project }) => { const api = $user$ && e.detail.api @@ -71,6 +74,8 @@ + +