ui for ok with force pushing

This commit is contained in:
Nikita Galaiko 2023-12-11 11:17:20 +01:00 committed by GitButler
parent 0840e69db8
commit a1e4e651cc
3 changed files with 44 additions and 0 deletions

View File

@ -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<Project>('update_project', { project: params });
this.reload();

View File

@ -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 @@
<Spacer />
<KeysForm project={$project$} on:updated={onKeysUpdated} />
<Spacer />
<PreferencesForm project={$project$} on:updated={onPreferencesUpdated} />
<Spacer />
<div class="flex gap-x-4">
<a

View File

@ -0,0 +1,37 @@
<script lang="ts">
import type { Project } from '$lib/backend/projects';
import Checkbox from '$lib/components/Checkbox.svelte';
import { createEventDispatcher } from 'svelte';
export let project: Project;
let allowForcePushing = project?.ok_with_force_push;
const dispatch = createEventDispatcher<{
updated: {
ok_with_force_push: boolean;
};
}>();
</script>
<div
class="flex flex-row items-center justify-between rounded-lg border border-light-400 p-2 dark:border-dark-500"
>
<div class="flex flex-row space-x-3">
<div class="flex flex-row">
<form class="flex items-center gap-1">
<Checkbox
name="allow-force-pushing"
checked={allowForcePushing}
on:change={() => {
allowForcePushing = !allowForcePushing;
dispatch('updated', { ok_with_force_push: allowForcePushing });
}}
/>
<label class="ml-2" for="allow-force-pushing">
Rebase my branches instead of creating merge commmits
</label>
</form>
</div>
</div>
</div>