add organization management and refine source repository view
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -12,6 +12,34 @@ import type {
|
||||
} from '../../types/application';
|
||||
import type { ApiAppComponent } from '../../types/runtime';
|
||||
|
||||
export type GiteaCommit = {
|
||||
sha: string;
|
||||
commit?: {
|
||||
message?: string;
|
||||
author?: {
|
||||
name?: string;
|
||||
date?: string;
|
||||
};
|
||||
committer?: {
|
||||
name?: string;
|
||||
date?: string;
|
||||
};
|
||||
};
|
||||
author?: {
|
||||
login?: string;
|
||||
username?: string;
|
||||
full_name?: string;
|
||||
name?: string;
|
||||
} | null;
|
||||
committer?: {
|
||||
login?: string;
|
||||
username?: string;
|
||||
full_name?: string;
|
||||
name?: string;
|
||||
} | null;
|
||||
created?: string;
|
||||
};
|
||||
|
||||
export function listApps() {
|
||||
return apiRequest<AppWithComponents[]>('/apps').then(filterAppsByCurrentAdmin);
|
||||
}
|
||||
@@ -94,6 +122,29 @@ export function createGiteaOrgRepo(
|
||||
}).then((result) => result.repo);
|
||||
}
|
||||
|
||||
export function listGiteaCommitsPage(
|
||||
owner: string,
|
||||
repo: string,
|
||||
branch = 'develop',
|
||||
options?: { page?: number; limit?: number; since?: string }
|
||||
) {
|
||||
const params = new URLSearchParams({
|
||||
sha: branch,
|
||||
page: String(options?.page ?? 1),
|
||||
limit: String(options?.limit ?? 5)
|
||||
});
|
||||
if (options?.since) params.set('since', options.since);
|
||||
return apiRequest<{ commits: GiteaCommit[]; total: number | null; page: number; limit: number }>(
|
||||
`/gitea/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/commits?${params.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
export function getGiteaCommitDiff(owner: string, repo: string, sha: string) {
|
||||
return apiRequest<{ diff: string }>(
|
||||
`/gitea/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/commits/${encodeURIComponent(sha)}/diff`
|
||||
).then((result) => result.diff);
|
||||
}
|
||||
|
||||
export function listBuildJobs(appKey?: string) {
|
||||
const query = appKey ? `?appKey=${encodeURIComponent(appKey)}` : '';
|
||||
return apiRequest<BuildJob[]>(`/apps/builds${query}`);
|
||||
|
||||
Reference in New Issue
Block a user