mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-19 07:32:22 +03:00
Merged origin/master into Commit box two fields
This commit is contained in:
commit
546e60c433
@ -145,6 +145,15 @@ impl App {
|
||||
.map_err(|e| Error::Other(anyhow::anyhow!(e.to_string())))
|
||||
}
|
||||
|
||||
pub fn git_index_size(&self, project_id: &ProjectId) -> Result<usize, Error> {
|
||||
let project = self.projects.get(project_id)?;
|
||||
let project_repository = project_repository::Repository::open(&project)?;
|
||||
let size = project_repository
|
||||
.git_index_size()
|
||||
.context("failed to get index size")?;
|
||||
Ok(size)
|
||||
}
|
||||
|
||||
pub fn git_head(&self, project_id: &ProjectId) -> Result<String, Error> {
|
||||
let project = self.projects.get(project_id)?;
|
||||
let project_repository = project_repository::Repository::open(&project)?;
|
||||
|
@ -103,6 +103,17 @@ pub async fn git_test_fetch(
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn git_index_size(handle: tauri::AppHandle, project_id: &str) -> Result<usize, Error> {
|
||||
let app = handle.state::<app::App>();
|
||||
let project_id = project_id.parse().map_err(|_| Error::UserError {
|
||||
code: Code::Validation,
|
||||
message: "Malformed project id".to_string(),
|
||||
})?;
|
||||
Ok(app.git_index_size(&project_id).expect("git index size"))
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn git_head(handle: tauri::AppHandle, project_id: &str) -> Result<String, Error> {
|
||||
|
@ -224,6 +224,10 @@ impl Repository {
|
||||
self.0.index().map(Into::into).map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn index_size(&self) -> Result<usize> {
|
||||
Ok(self.0.index()?.len())
|
||||
}
|
||||
|
||||
pub fn blob_path<P: AsRef<Path>>(&self, path: P) -> Result<Oid> {
|
||||
self.0
|
||||
.blob_path(path.as_ref())
|
||||
|
@ -240,6 +240,7 @@ fn main() {
|
||||
commands::project_flush_and_push,
|
||||
commands::git_test_push,
|
||||
commands::git_test_fetch,
|
||||
commands::git_index_size,
|
||||
zip::commands::get_logs_archive_path,
|
||||
zip::commands::get_project_archive_path,
|
||||
zip::commands::get_project_data_archive_path,
|
||||
|
@ -125,6 +125,11 @@ impl Repository {
|
||||
self.project = project.clone();
|
||||
}
|
||||
|
||||
pub fn git_index_size(&self) -> Result<usize, git::Error> {
|
||||
let head = self.git_repository.index_size()?;
|
||||
Ok(head)
|
||||
}
|
||||
|
||||
pub fn get_head(&self) -> Result<git::Reference, git::Error> {
|
||||
let head = self.git_repository.head()?;
|
||||
Ok(head)
|
||||
|
@ -155,6 +155,7 @@ export function getCloudApiClient(
|
||||
const formData = new FormData();
|
||||
formData.append('message', params.message);
|
||||
if (params.email) formData.append('email', params.email);
|
||||
if (params.context) formData.append('context', params.context);
|
||||
if (params.logs) formData.append('logs', params.logs);
|
||||
if (params.repo) formData.append('repo', params.repo);
|
||||
if (params.data) formData.append('data', params.data);
|
||||
|
@ -1,10 +1,12 @@
|
||||
<script lang="ts">
|
||||
import TextArea from './TextArea.svelte';
|
||||
import { invoke } from '$lib/backend/ipc';
|
||||
import * as zip from '$lib/backend/zip';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import Checkbox from '$lib/components/Checkbox.svelte';
|
||||
import Modal from '$lib/components/Modal.svelte';
|
||||
import * as toasts from '$lib/utils/toasts';
|
||||
import { getVersion } from '@tauri-apps/api/app';
|
||||
import type { User, getCloudApiClient } from '$lib/backend/cloud';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
@ -15,6 +17,12 @@
|
||||
modal.show();
|
||||
}
|
||||
|
||||
function gitIndexLength() {
|
||||
return invoke<void>('git_index_size', {
|
||||
projectId: projectId
|
||||
});
|
||||
}
|
||||
|
||||
let modal: Modal;
|
||||
|
||||
let messageInputValue = '';
|
||||
@ -41,9 +49,19 @@
|
||||
: new Blob([file], { type: 'application/zip' });
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
async function onSubmit() {
|
||||
const message = messageInputValue;
|
||||
const email = user?.email ?? emailInputValue;
|
||||
|
||||
// put together context information to send with the feedback
|
||||
let context = '';
|
||||
const appVersion = await getVersion();
|
||||
const indexLength = await gitIndexLength();
|
||||
context += 'GitButler Version: ' + appVersion + '\n';
|
||||
context += 'Browser: ' + navigator.userAgent + '\n';
|
||||
context += 'URL: ' + window.location.href + '\n';
|
||||
context += 'Length of index: ' + indexLength + '\n';
|
||||
|
||||
toasts.promise(
|
||||
Promise.all([
|
||||
sendLogs ? zip.logs().then((path) => readZipFile(path, 'logs.zip')) : undefined,
|
||||
@ -57,6 +75,7 @@
|
||||
cloud.feedback.create(user?.access_token, {
|
||||
email,
|
||||
message,
|
||||
context,
|
||||
logs,
|
||||
data,
|
||||
repo
|
||||
@ -83,7 +102,7 @@
|
||||
<Modal bind:this={modal} on:close={onClose} title="Share debug data with GitButler team for review">
|
||||
<div class="flex flex-col gap-4">
|
||||
<p class="text-color-3">
|
||||
If you are having trouble, please share your project and logs with the Gitbutler team. We will
|
||||
If you are having trouble, please share your project and logs with the GitButler team. We will
|
||||
review it for you and help identify how we can help resolve the issue.
|
||||
</p>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user