mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
feedback
This commit is contained in:
parent
3b9a504890
commit
3db2f2563a
9 changed files with 42 additions and 43 deletions
|
|
@ -22,8 +22,6 @@
|
|||
"vitest": "^2.1.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bull-board/api": "^6.13.0",
|
||||
"@bull-board/express": "^6.13.0",
|
||||
"@coderabbitai/bitbucket": "^1.1.3",
|
||||
"@gitbeaker/rest": "^40.5.1",
|
||||
"@octokit/rest": "^21.0.2",
|
||||
|
|
|
|||
|
|
@ -104,9 +104,8 @@ export const fetchRepository = async (
|
|||
signal?: AbortSignal
|
||||
}
|
||||
) => {
|
||||
const git = createGitClientForPath(path, onProgress, signal);
|
||||
try {
|
||||
const git = createGitClientForPath(path, onProgress, signal);
|
||||
|
||||
if (authHeader) {
|
||||
await git.addConfig("http.extraHeader", authHeader);
|
||||
}
|
||||
|
|
@ -129,12 +128,6 @@ export const fetchRepository = async (
|
|||
}
|
||||
} finally {
|
||||
if (authHeader) {
|
||||
const git = simpleGit({
|
||||
progress: onProgress,
|
||||
}).cwd({
|
||||
path: path,
|
||||
})
|
||||
|
||||
await git.raw(["config", "--unset", "http.extraHeader", authHeader]);
|
||||
}
|
||||
}
|
||||
|
|
@ -221,6 +214,10 @@ export const isPathAValidGitRepoRoot = async ({
|
|||
onProgress?: onProgressFn,
|
||||
signal?: AbortSignal
|
||||
}) => {
|
||||
if (!existsSync(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const git = createGitClientForPath(path, onProgress, signal);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export class PromClient {
|
|||
private registry: Registry;
|
||||
private app: express.Application;
|
||||
private server: Server;
|
||||
|
||||
|
||||
public activeRepoIndexingJobs: Gauge<string>;
|
||||
public pendingRepoIndexingJobs: Gauge<string>;
|
||||
public repoIndexingReattemptsTotal: Counter<string>;
|
||||
|
|
@ -80,7 +80,7 @@ export class PromClient {
|
|||
help: 'The number of repo garbage collection fails',
|
||||
labelNames: ['repo'],
|
||||
});
|
||||
this.registry.registerMetric(this.repoGarbageCollectionFailTotal);
|
||||
this.registry.registerMetric(this.repoGarbageCollectionFailTotal);
|
||||
|
||||
this.repoGarbageCollectionSuccessTotal = new Counter({
|
||||
name: 'repo_garbage_collection_successes',
|
||||
|
|
@ -106,7 +106,12 @@ export class PromClient {
|
|||
});
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.server.close();
|
||||
async dispose() {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.server.close((err) => {
|
||||
if (err) reject(err);
|
||||
else resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ export class RepoIndexManager {
|
|||
|
||||
for (const job of jobs) {
|
||||
await this.queue.add({
|
||||
groupId: `repo:${job.repoId}_${job.repo.name}`,
|
||||
groupId: `repo:${job.repoId}`,
|
||||
data: {
|
||||
jobId: job.id,
|
||||
type,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ import { search } from "@codemirror/search";
|
|||
import CodeMirror, { EditorSelection, EditorView, ReactCodeMirrorRef, SelectionRange, ViewUpdate } from "@uiw/react-codemirror";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { EditorContextMenu } from "../../../components/editorContextMenu";
|
||||
import { BrowseHighlightRange, HIGHLIGHT_RANGE_QUERY_PARAM, useBrowseNavigation } from "../../hooks/useBrowseNavigation";
|
||||
import { BrowseHighlightRange, useBrowseNavigation } from "../../hooks/useBrowseNavigation";
|
||||
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "../../hooks/utils";
|
||||
import { useBrowseState } from "../../hooks/useBrowseState";
|
||||
import { rangeHighlightingExtension } from "./rangeHighlightingExtension";
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
||||
|
|
|
|||
|
|
@ -3,28 +3,7 @@
|
|||
import { useRouter } from "next/navigation";
|
||||
import { useDomain } from "@/hooks/useDomain";
|
||||
import { useCallback } from "react";
|
||||
import { BrowseState } from "../browseStateProvider";
|
||||
import { getBrowsePath } from "./utils";
|
||||
|
||||
export type BrowseHighlightRange = {
|
||||
start: { lineNumber: number; column: number; };
|
||||
end: { lineNumber: number; column: number; };
|
||||
} | {
|
||||
start: { lineNumber: number; };
|
||||
end: { lineNumber: number; };
|
||||
}
|
||||
|
||||
export const HIGHLIGHT_RANGE_QUERY_PARAM = 'highlightRange';
|
||||
|
||||
export interface GetBrowsePathProps {
|
||||
repoName: string;
|
||||
revisionName?: string;
|
||||
path: string;
|
||||
pathType: 'blob' | 'tree';
|
||||
highlightRange?: BrowseHighlightRange;
|
||||
setBrowseState?: Partial<BrowseState>;
|
||||
domain: string;
|
||||
}
|
||||
import { getBrowsePath, GetBrowsePathProps } from "./utils";
|
||||
|
||||
export const useBrowseNavigation = () => {
|
||||
const router = useRouter();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { GetBrowsePathProps } from "./useBrowseNavigation";
|
||||
import { getBrowsePath } from "./utils";
|
||||
import { getBrowsePath, GetBrowsePathProps } from "./utils";
|
||||
import { useDomain } from "@/hooks/useDomain";
|
||||
|
||||
export const useBrowsePath = ({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,24 @@
|
|||
import { SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
|
||||
import { GetBrowsePathProps, HIGHLIGHT_RANGE_QUERY_PARAM } from "./useBrowseNavigation";
|
||||
import { BrowseState, SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
|
||||
|
||||
export const HIGHLIGHT_RANGE_QUERY_PARAM = 'highlightRange';
|
||||
|
||||
export type BrowseHighlightRange = {
|
||||
start: { lineNumber: number; column: number; };
|
||||
end: { lineNumber: number; column: number; };
|
||||
} | {
|
||||
start: { lineNumber: number; };
|
||||
end: { lineNumber: number; };
|
||||
}
|
||||
|
||||
export interface GetBrowsePathProps {
|
||||
repoName: string;
|
||||
revisionName?: string;
|
||||
path: string;
|
||||
pathType: 'blob' | 'tree';
|
||||
highlightRange?: BrowseHighlightRange;
|
||||
setBrowseState?: Partial<BrowseState>;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export const getBrowseParamsFromPathParam = (pathParam: string) => {
|
||||
const sentinelIndex = pathParam.search(/\/-\/(tree|blob)/);
|
||||
|
|
@ -67,3 +86,4 @@ export const getBrowsePath = ({
|
|||
const browsePath = `/${domain}/browse/${repoName}@${revisionName}/-/${pathType}/${encodedPath}${params.size > 0 ? `?${params.toString()}` : ''}`;
|
||||
return browsePath;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { Link2Icon } from "@radix-ui/react-icons";
|
|||
import { EditorView, SelectionRange } from "@uiw/react-codemirror";
|
||||
import { useCallback, useEffect, useRef } from "react";
|
||||
import { useDomain } from "@/hooks/useDomain";
|
||||
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "@/app/[domain]/browse/hooks/useBrowseNavigation";
|
||||
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "../browse/hooks/utils";
|
||||
|
||||
interface ContextMenuProps {
|
||||
view: EditorView;
|
||||
|
|
|
|||
Loading…
Reference in a new issue