feat: release asset upload, transfer, Actions secrets/variables/artifacts, admin, teams/projects, file search, reactions, attachments, package version delete
- client: multipart postForm; expo-document-picker + react-native-webview deps - release assets: upload (DocumentPicker) and delete; run artifacts list - repository transfer; Actions secrets + variables management screen - admin (users/orgs/repos) screen gated on is_admin - org teams, repo projects (read-only); find-file via recursive git tree - issue reactions toggle and attachments list; package version delete - endpoint tests (126 total)
This commit is contained in:
1 parent
b2b44bca73
commit
587bf732b5
31 files changed
+1919
-46
No files matched your search
@@ -177,6 +177,82 @@ export class GiteaClient {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a multipart/form-data body (e.g. a release asset) and parses the
|
||||
* JSON response. The multipart boundary is set by the platform, so we never
|
||||
* set `Content-Type` ourselves. Errors are normalized like {@link raw}.
|
||||
*/
|
||||
async postForm<T>(
|
||||
path: string,
|
||||
form: FormData,
|
||||
options: Omit<RequestOptions, 'method' | 'body'> = {},
|
||||
): Promise<T> {
|
||||
const url = `${this.apiRoot}${path}${buildQuery(options.query ?? {})}`;
|
||||
const headers: Record<string, string> = { Accept: 'application/json' };
|
||||
if (this.token) headers.Authorization = `token ${this.token}`;
|
||||
|
||||
const controller = new AbortController();
|
||||
let timedOut = false;
|
||||
const timeoutMs = options.timeoutMs ?? this.timeoutMs ?? 120_000;
|
||||
const timer = setTimeout(() => {
|
||||
timedOut = true;
|
||||
controller.abort();
|
||||
}, timeoutMs);
|
||||
const onCallerAbort = () => controller.abort();
|
||||
if (options.signal) {
|
||||
if (options.signal.aborted) {
|
||||
clearTimeout(timer);
|
||||
throw new ApiError({ kind: 'aborted', status: 0, message: 'Request cancelled.' });
|
||||
}
|
||||
options.signal.addEventListener('abort', onCallerAbort);
|
||||
}
|
||||
|
||||
let response: Response;
|
||||
try {
|
||||
response = await this.fetchImpl(url, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: form as unknown as BodyInit,
|
||||
signal: controller.signal,
|
||||
});
|
||||
} catch (error) {
|
||||
if (timedOut) {
|
||||
throw new ApiError({ kind: 'timeout', status: 0, message: 'The upload took too long.' });
|
||||
}
|
||||
if (options.signal?.aborted) {
|
||||
throw new ApiError({ kind: 'aborted', status: 0, message: 'Request cancelled.' });
|
||||
}
|
||||
throw toApiError(error);
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
options.signal?.removeEventListener('abort', onCallerAbort);
|
||||
}
|
||||
|
||||
const text = await response.text();
|
||||
let parsed: unknown = undefined;
|
||||
if (text.length > 0) {
|
||||
try {
|
||||
parsed = JSON.parse(text);
|
||||
} catch {
|
||||
parsed = undefined;
|
||||
}
|
||||
}
|
||||
if (!response.ok) {
|
||||
const serverMessage =
|
||||
parsed && typeof parsed === 'object' && 'message' in parsed
|
||||
? String((parsed as { message: unknown }).message)
|
||||
: null;
|
||||
const kind = ApiError.kindForStatus(response.status);
|
||||
throw new ApiError({
|
||||
kind,
|
||||
status: response.status,
|
||||
serverMessage,
|
||||
message: messageForStatus(kind, response.status, serverMessage),
|
||||
});
|
||||
}
|
||||
return parsed as T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a request and returns data plus pagination metadata.
|
||||
* `hasMore` uses `X-Total-Count` when present, otherwise a length heuristic
|
||||
|
||||
@@ -8,13 +8,19 @@
|
||||
import { GiteaClient } from './client';
|
||||
import {
|
||||
addRepoKey,
|
||||
addIssueReaction,
|
||||
createOrg,
|
||||
createRelease,
|
||||
createRepoVariable,
|
||||
createPullReview,
|
||||
deletePackageVersion,
|
||||
fetchRepoTree,
|
||||
listActionRuns,
|
||||
listReviewComments,
|
||||
mergePull,
|
||||
putRepoSecret,
|
||||
replyToReviewComment,
|
||||
transferRepo,
|
||||
updateRepo,
|
||||
updateUserSettings,
|
||||
} from './endpoints';
|
||||
@@ -122,4 +128,53 @@ describe('endpoint request bodies', () => {
|
||||
);
|
||||
expect(postedBody(fetchImpl)).toMatchObject({ body: 'thanks' });
|
||||
});
|
||||
|
||||
it('transfers a repository', async () => {
|
||||
const { fetchImpl, client } = capture();
|
||||
await transferRepo(client, 'octo', 'repo', 'newowner');
|
||||
expect(fetchImpl.mock.calls[0][0]).toBe('https://codeberg.org/api/v1/repos/octo/repo/transfer');
|
||||
expect(postedBody(fetchImpl)).toMatchObject({ new_owner: 'newowner' });
|
||||
});
|
||||
|
||||
it('writes an Actions secret and a variable', async () => {
|
||||
const { fetchImpl, client } = capture();
|
||||
await putRepoSecret(client, 'octo', 'repo', 'TOKEN', 's3cr3t');
|
||||
expect(fetchImpl.mock.calls[0][0]).toBe(
|
||||
'https://codeberg.org/api/v1/repos/octo/repo/actions/secrets/TOKEN',
|
||||
);
|
||||
expect(postedBody(fetchImpl)).toMatchObject({ data: 's3cr3t' });
|
||||
|
||||
fetchImpl.mockClear();
|
||||
await createRepoVariable(client, 'octo', 'repo', 'ENV', 'prod');
|
||||
expect(fetchImpl.mock.calls[0][0]).toBe(
|
||||
'https://codeberg.org/api/v1/repos/octo/repo/actions/variables/ENV',
|
||||
);
|
||||
expect(postedBody(fetchImpl)).toMatchObject({ value: 'prod' });
|
||||
});
|
||||
|
||||
it('adds an issue reaction', async () => {
|
||||
const { fetchImpl, client } = capture();
|
||||
await addIssueReaction(client, 'octo', 'repo', 5, '+1');
|
||||
expect(fetchImpl.mock.calls[0][0]).toBe(
|
||||
'https://codeberg.org/api/v1/repos/octo/repo/issues/5/reactions',
|
||||
);
|
||||
expect(postedBody(fetchImpl)).toMatchObject({ content: '+1' });
|
||||
});
|
||||
|
||||
it('deletes a specific package version', async () => {
|
||||
const { fetchImpl, client } = capture();
|
||||
await deletePackageVersion(client, 'octo', 'npm', 'pkg', '1.0.0');
|
||||
expect(fetchImpl.mock.calls[0][0]).toBe(
|
||||
'https://codeberg.org/api/v1/packages/octo/npm/pkg/1.0.0',
|
||||
);
|
||||
expect(fetchImpl.mock.calls[0][1].method).toBe('DELETE');
|
||||
});
|
||||
|
||||
it('fetches the recursive git tree for file search', async () => {
|
||||
const { fetchImpl, client } = capture();
|
||||
await fetchRepoTree(client, 'octo', 'repo', 'main');
|
||||
const url = fetchImpl.mock.calls[0][0] as string;
|
||||
expect(url).toContain('/repos/octo/repo/git/trees/main');
|
||||
expect(url).toContain('recursive=true');
|
||||
});
|
||||
});
|
||||
+346
-1
@@ -13,8 +13,10 @@ import { ApiError } from './errors';
|
||||
import type { GiteaClient, RequestOptions } from './client';
|
||||
import type {
|
||||
AccessToken,
|
||||
ActionArtifact,
|
||||
ActionRun,
|
||||
ActionRunJob,
|
||||
ActionVariable,
|
||||
ActionWorkflow,
|
||||
Activity,
|
||||
Branch,
|
||||
@@ -25,6 +27,7 @@ import type {
|
||||
Commit,
|
||||
ContentsEntry,
|
||||
DeployKey,
|
||||
GitTree,
|
||||
GpgKey,
|
||||
Issue,
|
||||
Label,
|
||||
@@ -33,16 +36,21 @@ import type {
|
||||
NotificationThread,
|
||||
Organization,
|
||||
Package,
|
||||
Project,
|
||||
PublicKey,
|
||||
PullRequest,
|
||||
PullReview,
|
||||
PullReviewComment,
|
||||
Reaction,
|
||||
Release,
|
||||
ReleaseAsset,
|
||||
Repository,
|
||||
ReviewEvent,
|
||||
Secret,
|
||||
ServerVersion,
|
||||
Subscription,
|
||||
Tag,
|
||||
Team,
|
||||
User,
|
||||
UserSettings,
|
||||
Webhook,
|
||||
@@ -1180,10 +1188,18 @@ export function replyToReviewComment(
|
||||
);
|
||||
}
|
||||
|
||||
export interface CreateReviewCommentInput {
|
||||
body: string;
|
||||
path: string;
|
||||
new_position?: number;
|
||||
old_position?: number;
|
||||
}
|
||||
|
||||
export interface CreateReviewInput {
|
||||
event: ReviewEvent;
|
||||
body?: string;
|
||||
commitId?: string;
|
||||
comments?: CreateReviewCommentInput[];
|
||||
}
|
||||
|
||||
export function createPullReview(
|
||||
@@ -1196,7 +1212,12 @@ export function createPullReview(
|
||||
): Promise<PullReview> {
|
||||
return client.post<PullReview>(
|
||||
`${repoPath(owner, repo)}/pulls/${index}/reviews`,
|
||||
{ event: input.event, body: input.body ?? '', commit_id: input.commitId },
|
||||
{
|
||||
event: input.event,
|
||||
body: input.body ?? '',
|
||||
commit_id: input.commitId,
|
||||
comments: input.comments,
|
||||
},
|
||||
options,
|
||||
);
|
||||
}
|
||||
@@ -1395,3 +1416,327 @@ export function listUserActivity(
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 20 },
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Release assets (multipart)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface UploadFile {
|
||||
/** Local file URI (from expo-document-picker / expo-image-picker). */
|
||||
uri: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export function uploadReleaseAsset(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
releaseId: number,
|
||||
file: UploadFile,
|
||||
options?: Omit<RequestOptions, 'method' | 'body'>,
|
||||
): Promise<ReleaseAsset> {
|
||||
const form = new FormData();
|
||||
// React Native accepts the {uri, name, type} shape for file parts.
|
||||
form.append('attachment', { uri: file.uri, name: file.name, type: file.type } as unknown as Blob);
|
||||
return client.postForm<ReleaseAsset>(
|
||||
`${repoPath(owner, repo)}/releases/${releaseId}/assets`,
|
||||
form,
|
||||
{ ...options, query: { ...options?.query, name: file.name } },
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteReleaseAsset(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
releaseId: number,
|
||||
assetId: number,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.delete<void>(
|
||||
`${repoPath(owner, repo)}/releases/${releaseId}/assets/${assetId}`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Repository transfer
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function transferRepo(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
newOwner: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<Repository> {
|
||||
return client.post<Repository>(`${repoPath(owner, repo)}/transfer`, { new_owner: newOwner }, options);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Actions secrets / variables / artifacts / workflow dispatch
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function listRepoSecrets(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<Secret[]>(`${repoPath(owner, repo)}/actions/secrets`, {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 50 },
|
||||
});
|
||||
}
|
||||
|
||||
export function putRepoSecret(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
name: string,
|
||||
data: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.put<void>(
|
||||
`${repoPath(owner, repo)}/actions/secrets/${enc(name)}`,
|
||||
{ data },
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteRepoSecret(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
name: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.delete<void>(`${repoPath(owner, repo)}/actions/secrets/${enc(name)}`, options);
|
||||
}
|
||||
|
||||
export function listRepoVariables(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<ActionVariable[]>(`${repoPath(owner, repo)}/actions/variables`, {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 50 },
|
||||
});
|
||||
}
|
||||
|
||||
export function createRepoVariable(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
name: string,
|
||||
value: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<ActionVariable> {
|
||||
return client.post<ActionVariable>(
|
||||
`${repoPath(owner, repo)}/actions/variables/${enc(name)}`,
|
||||
{ value },
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteRepoVariable(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
name: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.delete<void>(`${repoPath(owner, repo)}/actions/variables/${enc(name)}`, options);
|
||||
}
|
||||
|
||||
export function listRunArtifacts(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
run: number,
|
||||
options?: RequestOptions,
|
||||
): Promise<{ artifacts?: ActionArtifact[] }> {
|
||||
return client.get<{ artifacts?: ActionArtifact[] }>(
|
||||
`${repoPath(owner, repo)}/actions/runs/${run}/artifacts`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
export interface DispatchWorkflowInput {
|
||||
ref: string;
|
||||
inputs?: Record<string, string>;
|
||||
}
|
||||
|
||||
export function dispatchWorkflow(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
workflowId: string,
|
||||
input: DispatchWorkflowInput,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.post<void>(
|
||||
`${repoPath(owner, repo)}/actions/workflows/${enc(workflowId)}/dispatches`,
|
||||
input,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Teams, projects, tree (file search)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function listOrgTeams(
|
||||
client: GiteaClient,
|
||||
org: string,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<Team[]>(`/orgs/${enc(org)}/teams`, {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 50 },
|
||||
});
|
||||
}
|
||||
|
||||
export function listRepoProjects(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<Project[]>(`${repoPath(owner, repo)}/projects`, {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 50, state: 'all' },
|
||||
});
|
||||
}
|
||||
|
||||
/** Recursive git tree for a ref — powers the "find file" search. */
|
||||
export function fetchRepoTree(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
ref: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<GitTree> {
|
||||
return client.get<GitTree>(
|
||||
`${repoPath(owner, repo)}/git/trees/${enc(ref)}`,
|
||||
{ ...options, query: { recursive: true, per_page: 1000 } },
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Issue reactions & attachments
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function listIssueReactions(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
index: number,
|
||||
options?: RequestOptions,
|
||||
): Promise<Reaction[]> {
|
||||
return client.get<Reaction[]>(`${repoPath(owner, repo)}/issues/${index}/reactions`, options);
|
||||
}
|
||||
|
||||
export function addIssueReaction(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
index: number,
|
||||
content: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<Reaction> {
|
||||
return client.post<Reaction>(
|
||||
`${repoPath(owner, repo)}/issues/${index}/reactions`,
|
||||
{ content },
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
export function removeIssueReaction(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
index: number,
|
||||
content: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.delete<void>(
|
||||
`${repoPath(owner, repo)}/issues/${index}/reactions`,
|
||||
{ ...options, body: { content } },
|
||||
);
|
||||
}
|
||||
|
||||
export function listIssueAttachments(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
repo: string,
|
||||
index: number,
|
||||
options?: RequestOptions,
|
||||
): Promise<{ id?: number; name?: string; size?: number; browser_download_url?: string }[]> {
|
||||
return client.get(
|
||||
`${repoPath(owner, repo)}/issues/${index}/assets`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Admin (read-only)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function listAdminUsers(
|
||||
client: GiteaClient,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<User[]>('/admin/users', {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 30 },
|
||||
});
|
||||
}
|
||||
|
||||
export function listAdminOrgs(
|
||||
client: GiteaClient,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<Organization[]>('/admin/orgs', {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 30 },
|
||||
});
|
||||
}
|
||||
|
||||
export function listAdminRepos(
|
||||
client: GiteaClient,
|
||||
params: PageParams = {},
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return client.raw<Repository[]>('/admin/repos', {
|
||||
...options,
|
||||
query: { page: params.page ?? 1, limit: params.limit ?? 30 },
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Package version deletion
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function deletePackageVersion(
|
||||
client: GiteaClient,
|
||||
owner: string,
|
||||
type: string,
|
||||
name: string,
|
||||
version: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<void> {
|
||||
return client.delete<void>(
|
||||
`/packages/${enc(owner)}/${enc(type)}/${enc(name)}/${enc(version)}`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
@@ -66,6 +66,27 @@ export const queryKeys = {
|
||||
repoKeys: (accountId: string, owner: string, name: string) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'keys'] as const,
|
||||
|
||||
repoProjects: (accountId: string, owner: string, name: string) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'projects'] as const,
|
||||
|
||||
repoTree: (accountId: string, owner: string, name: string, ref: string) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'tree', ref] as const,
|
||||
|
||||
repoSecrets: (accountId: string, owner: string, name: string) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'actions', 'secrets'] as const,
|
||||
|
||||
repoVariables: (accountId: string, owner: string, name: string) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'actions', 'variables'] as const,
|
||||
|
||||
runArtifacts: (accountId: string, owner: string, name: string, run: number) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'actions', 'run', run, 'artifacts'] as const,
|
||||
|
||||
issueReactions: (accountId: string, owner: string, name: string, index: number) =>
|
||||
[...queryKeys.issue(accountId, owner, name, index), 'reactions'] as const,
|
||||
|
||||
issueAttachments: (accountId: string, owner: string, name: string, index: number) =>
|
||||
[...queryKeys.issue(accountId, owner, name, index), 'attachments'] as const,
|
||||
|
||||
// --- actions -------------------------------------------------------------
|
||||
actionsRoot: (accountId: string, owner: string, name: string) =>
|
||||
[...queryKeys.repo(accountId, owner, name), 'actions'] as const,
|
||||
|
||||
@@ -568,6 +568,84 @@ export interface UserSettings {
|
||||
theme?: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Actions secrets / variables / artifacts, teams, projects, tree, reactions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export interface Secret {
|
||||
name?: string;
|
||||
description?: string;
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
export interface ActionVariable {
|
||||
name?: string;
|
||||
data?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface ActionArtifact {
|
||||
id?: number;
|
||||
name?: string;
|
||||
size_in_bytes?: number;
|
||||
expired?: boolean;
|
||||
expires_at?: string;
|
||||
created_at?: string;
|
||||
archive_download_url?: string;
|
||||
workflow_run?: ActionRun;
|
||||
}
|
||||
|
||||
export interface Reaction {
|
||||
content?: string;
|
||||
user?: User;
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
export interface Team {
|
||||
id?: number;
|
||||
name?: string;
|
||||
description?: string;
|
||||
permission?: string;
|
||||
organization?: Organization;
|
||||
visibility?: string;
|
||||
units?: string[];
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id?: number;
|
||||
title?: string;
|
||||
description?: string;
|
||||
state?: string;
|
||||
type?: string;
|
||||
card_type?: string;
|
||||
is_closed?: boolean;
|
||||
num_issues?: number;
|
||||
num_open_issues?: number;
|
||||
num_closed_issues?: number;
|
||||
html_url?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
creator?: User;
|
||||
}
|
||||
|
||||
export interface GitTreeEntry {
|
||||
path?: string;
|
||||
mode?: string;
|
||||
type?: string;
|
||||
size?: number;
|
||||
sha?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface GitTree {
|
||||
sha?: string;
|
||||
url?: string;
|
||||
truncated?: boolean;
|
||||
page?: number;
|
||||
total_count?: number;
|
||||
entries?: GitTreeEntry[];
|
||||
}
|
||||
|
||||
export interface Activity {
|
||||
id?: number;
|
||||
user_id?: number;
|
||||
|
||||
@@ -16,12 +16,13 @@ import {
|
||||
fetchActionRun,
|
||||
listActionRunJobs,
|
||||
listActionRuns,
|
||||
listRunArtifacts,
|
||||
listWorkflows,
|
||||
rerunActionRun,
|
||||
type ListActionRunsParams,
|
||||
} from '@/core/api/endpoints';
|
||||
import { queryKeys } from '@/core/api/query-keys';
|
||||
import type { ActionRun, ActionRunJob, ActionWorkflow } from '@/core/api/types';
|
||||
import type { ActionArtifact, ActionRun, ActionRunJob, ActionWorkflow } from '@/core/api/types';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
|
||||
export function useWorkflows(owner: string, name: string) {
|
||||
@@ -114,6 +115,20 @@ export function useActionRunControl(owner: string, name: string, run: number) {
|
||||
return { rerun, cancel };
|
||||
}
|
||||
|
||||
/** Artifacts produced by a workflow run. */
|
||||
export function useRunArtifacts(owner: string, name: string, run: number) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<ActionArtifact[]>({
|
||||
queryKey: queryKeys.runArtifacts(accountId, owner, name, run),
|
||||
enabled: Boolean(client) && Boolean(accountId) && run > 0,
|
||||
queryFn: ({ signal }) =>
|
||||
listRunArtifacts(client!, owner, name, run, { signal }).then((r) => r.artifacts ?? []),
|
||||
staleTime: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useActionJobLogs(owner: string, name: string, jobId: number, enabled = true) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
|
||||
import type { RawResponse } from '@/core/api/client';
|
||||
import {
|
||||
addIssueReaction,
|
||||
createIssue,
|
||||
createIssueComment,
|
||||
createPull,
|
||||
@@ -28,7 +29,9 @@ import {
|
||||
fetchPull,
|
||||
fetchPullDiff,
|
||||
listCollaborators,
|
||||
listIssueAttachments,
|
||||
listIssueComments,
|
||||
listIssueReactions,
|
||||
listMilestones,
|
||||
listPullFiles,
|
||||
listPullReviews,
|
||||
@@ -37,6 +40,7 @@ import {
|
||||
listPulls,
|
||||
listReviewComments,
|
||||
mergePull,
|
||||
removeIssueReaction,
|
||||
replyToReviewComment,
|
||||
searchIssues,
|
||||
updateIssue,
|
||||
@@ -59,6 +63,7 @@ import type {
|
||||
PullRequest,
|
||||
PullReview,
|
||||
PullReviewComment,
|
||||
Reaction,
|
||||
User,
|
||||
} from '@/core/api/types';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
@@ -491,3 +496,53 @@ export function useCreatePull(owner: string, name: string) {
|
||||
|
||||
export type { Issue, Label, PullRequest };
|
||||
export type { ChangedFile, CombinedStatus, Comment, Milestone, PullReview, User };
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Issue reactions & attachments
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function useIssueReactions(owner: string, name: string, index: number) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<Reaction[]>({
|
||||
queryKey: queryKeys.issueReactions(accountId, owner, name, index),
|
||||
enabled: Boolean(client) && Boolean(accountId) && index > 0,
|
||||
queryFn: ({ signal }) => listIssueReactions(client!, owner, name, index, { signal }),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
/** Adds the reaction when absent, removes it when already present. */
|
||||
export function useToggleIssueReaction(owner: string, name: string, index: number) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({ content, mine }: { content: string; mine: boolean }): Promise<void> => {
|
||||
if (mine) {
|
||||
await removeIssueReaction(client!, owner, name, index, content);
|
||||
} else {
|
||||
await addIssueReaction(client!, owner, name, index, content);
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.issueReactions(accountId, owner, name, index),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useIssueAttachments(owner: string, name: string, index: number) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<{ id?: number; name?: string; size?: number; browser_download_url?: string }[]>({
|
||||
queryKey: queryKeys.issueAttachments(accountId, owner, name, index),
|
||||
enabled: Boolean(client) && Boolean(accountId) && index > 0,
|
||||
queryFn: ({ signal }) => listIssueAttachments(client!, owner, name, index, { signal }),
|
||||
staleTime: 60_000,
|
||||
});
|
||||
}
|
||||
@@ -6,7 +6,12 @@ import type { RawResponse } from '@/core/api/client';
|
||||
import {
|
||||
createOrg,
|
||||
deletePackage,
|
||||
deletePackageVersion,
|
||||
fetchAuthenticatedUser,
|
||||
fetchUserSettings,
|
||||
listAdminOrgs,
|
||||
listAdminRepos,
|
||||
listAdminUsers,
|
||||
listOrgRepos,
|
||||
listPackages,
|
||||
listUserGpgKeys,
|
||||
@@ -24,6 +29,7 @@ import type {
|
||||
Package,
|
||||
PublicKey,
|
||||
Repository,
|
||||
User,
|
||||
UserSettings,
|
||||
} from '@/core/api/types';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
@@ -49,6 +55,18 @@ function useAccountList<T>(
|
||||
});
|
||||
}
|
||||
|
||||
/** The signed-in user (used to gate admin-only UI on `is_admin`). */
|
||||
export function useCurrentUser() {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
return useQuery<User>({
|
||||
queryKey: queryKeys.me(accountId),
|
||||
enabled: Boolean(client) && Boolean(accountId),
|
||||
queryFn: ({ signal }) => fetchAuthenticatedUser(client!, { signal }),
|
||||
staleTime: 5 * 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useUserOrgs(limit = 30) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
@@ -152,3 +170,47 @@ export function useDeletePackage() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeletePackageVersion() {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
return useMutation({
|
||||
mutationFn: ({ owner, type, name, version }: { owner: string; type: string; name: string; version: string }) =>
|
||||
deletePackageVersion(client!, owner, type, name, version),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.account(accountId) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Admin (read-only)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function useAdminUsers(limit = 30) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
return useAccountList<User>(
|
||||
[...queryKeys.account(accountId), 'admin', 'users', { limit }],
|
||||
(page, signal) => listAdminUsers(client!, { page, limit }, { signal }),
|
||||
);
|
||||
}
|
||||
|
||||
export function useAdminOrgs(limit = 30) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
return useAccountList<Organization>(
|
||||
[...queryKeys.account(accountId), 'admin', 'orgs', { limit }],
|
||||
(page, signal) => listAdminOrgs(client!, { page, limit }, { signal }),
|
||||
);
|
||||
}
|
||||
|
||||
export function useAdminRepos(limit = 30) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
return useAccountList<Repository>(
|
||||
[...queryKeys.account(accountId), 'admin', 'repos', { limit }],
|
||||
(page, signal) => listAdminRepos(client!, { page, limit }, { signal }),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
import { useState } from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { QueryList } from '@/components/layout/query-list';
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { SegmentedControl } from '@/components/ui/segmented';
|
||||
import { EmptyState } from '@/components/ui/state-views';
|
||||
import type { Organization, Repository, User } from '@/core/api/types';
|
||||
import { flattenPages } from '@/core/utils/infinite';
|
||||
import { useAdminOrgs, useAdminRepos, useAdminUsers } from '@/features/profile/queries';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
|
||||
type Tab = 'users' | 'orgs' | 'repos';
|
||||
|
||||
/** Instance administration (read-only) for instance admins. */
|
||||
export function AdminScreen() {
|
||||
const { t } = useTranslation();
|
||||
const [tab, setTab] = useState<Tab>('users');
|
||||
|
||||
const users = useAdminUsers();
|
||||
const orgs = useAdminOrgs();
|
||||
const repos = useAdminRepos();
|
||||
|
||||
return (
|
||||
<Screen padded={false}>
|
||||
<View style={styles.tabs}>
|
||||
<SegmentedControl<Tab>
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
accessibilityLabel={t('admin.title')}
|
||||
options={[
|
||||
{ value: 'users', label: t('admin.users') },
|
||||
{ value: 'orgs', label: t('admin.orgs') },
|
||||
{ value: 'repos', label: t('admin.repos') },
|
||||
]}
|
||||
/>
|
||||
</View>
|
||||
|
||||
{tab === 'users' ? (
|
||||
<QueryList<User>
|
||||
query={users}
|
||||
items={flattenPages(users.data)}
|
||||
keyExtractor={(user) => String(user.id ?? user.login)}
|
||||
renderItem={(user) => (
|
||||
<View style={styles.row}>
|
||||
<View style={styles.body}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{user.login}
|
||||
</AppText>
|
||||
{user.full_name ? (
|
||||
<AppText variant="caption" tone="tertiary" numberOfLines={1}>
|
||||
{user.full_name}
|
||||
</AppText>
|
||||
) : null}
|
||||
</View>
|
||||
{user.is_admin ? <Badge tone="warning">{t('admin.adminBadge')}</Badge> : null}
|
||||
</View>
|
||||
)}
|
||||
empty={<EmptyState icon="people" title={t('admin.emptyUsers')} />}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{tab === 'orgs' ? (
|
||||
<QueryList<Organization>
|
||||
query={orgs}
|
||||
items={flattenPages(orgs.data)}
|
||||
keyExtractor={(org) => String(org.id ?? org.username)}
|
||||
renderItem={(org) => (
|
||||
<View style={styles.row}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{org.username ?? org.name}
|
||||
</AppText>
|
||||
</View>
|
||||
)}
|
||||
empty={<EmptyState icon="people" title={t('admin.emptyOrgs')} />}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{tab === 'repos' ? (
|
||||
<QueryList<Repository>
|
||||
query={repos}
|
||||
items={flattenPages(repos.data)}
|
||||
keyExtractor={(repo) => String(repo.id)}
|
||||
renderItem={(repo) => (
|
||||
<View style={styles.row}>
|
||||
<View style={styles.body}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{repo.full_name}
|
||||
</AppText>
|
||||
{repo.private ? <Badge tone="neutral">{t('repositories.private')}</Badge> : null}
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
empty={<EmptyState icon="repo" title={t('admin.emptyRepos')} />}
|
||||
/>
|
||||
) : null}
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
tabs: { paddingHorizontal: spacing.lg, paddingVertical: spacing.sm },
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.md,
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.md,
|
||||
},
|
||||
body: { flex: 1, gap: 2 },
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { useRoute, type RouteProp } from '@react-navigation/native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { EmptyState, ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { useOrgTeams } from '@/features/repositories/settings-queries';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
import type { SettingsStackParamList } from '@/navigation/types';
|
||||
|
||||
/** Teams within an organization (read-only). */
|
||||
export function OrgTeamsScreen() {
|
||||
const { t } = useTranslation();
|
||||
const route = useRoute<RouteProp<SettingsStackParamList, 'OrgTeams'>>();
|
||||
const { org } = route.params;
|
||||
const query = useOrgTeams(org);
|
||||
|
||||
if (query.isPending) return <LoadingView />;
|
||||
if (query.isError) {
|
||||
return (
|
||||
<ErrorState
|
||||
title={t('errors.title')}
|
||||
body={apiErrorMessage(query.error, t)}
|
||||
retryLabel={t('common.retry')}
|
||||
onRetry={() => void query.refetch()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const teams = query.data ?? [];
|
||||
if (teams.length === 0) return <EmptyState icon="people" title={t('organizations.noTeams')} />;
|
||||
|
||||
return (
|
||||
<Screen scroll padded>
|
||||
{teams.map((team) => (
|
||||
<Card key={team.id ?? team.name}>
|
||||
<View style={styles.row}>
|
||||
<View style={styles.body}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{team.name}
|
||||
</AppText>
|
||||
{team.description ? (
|
||||
<AppText variant="caption" tone="tertiary" numberOfLines={2}>
|
||||
{team.description}
|
||||
</AppText>
|
||||
) : null}
|
||||
</View>
|
||||
{team.permission ? <Badge tone="neutral">{team.permission}</Badge> : null}
|
||||
</View>
|
||||
</Card>
|
||||
))}
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
row: { flexDirection: 'row', alignItems: 'center', gap: spacing.md },
|
||||
body: { flex: 1, gap: 2 },
|
||||
});
|
||||
@@ -7,6 +7,7 @@ import { QueryList } from '@/components/layout/query-list';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Avatar } from '@/components/ui/avatar';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { IconButton } from '@/components/ui/icon-button';
|
||||
import { EmptyState } from '@/components/ui/state-views';
|
||||
import type { Organization } from '@/core/api/types';
|
||||
import { flattenPages } from '@/core/utils/infinite';
|
||||
@@ -57,6 +58,11 @@ export function OrganizationsScreen() {
|
||||
</AppText>
|
||||
) : null}
|
||||
</View>
|
||||
<IconButton
|
||||
name="people"
|
||||
onPress={() => navigation.navigate('OrgTeams', { org: login })}
|
||||
accessibilityLabel={t('organizations.teams')}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import type { Package } from '@/core/api/types';
|
||||
import { flattenPages } from '@/core/utils/infinite';
|
||||
import { formatRelativeTime } from '@/core/utils/format';
|
||||
import { useDeletePackage, usePackages } from '@/features/profile/queries';
|
||||
import { useDeletePackage, useDeletePackageVersion, usePackages } from '@/features/profile/queries';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
|
||||
@@ -21,21 +21,35 @@ export function PackagesScreen() {
|
||||
const login = account?.login ?? '';
|
||||
const query = usePackages(login);
|
||||
const deletePackage = useDeletePackage();
|
||||
const deleteVersion = useDeletePackageVersion();
|
||||
const packages: Package[] = flattenPages(query.data);
|
||||
|
||||
const confirmDelete = (pkg: Package) => {
|
||||
Alert.alert(t('packages.deleteTitle'), t('packages.deleteBody', { name: pkg.name ?? '' }), [
|
||||
{ text: t('common.cancel'), style: 'cancel' },
|
||||
const buttons = [
|
||||
{ text: t('common.cancel'), style: 'cancel' as const },
|
||||
...(pkg.version
|
||||
? [
|
||||
{
|
||||
text: t('packages.deleteVersion'),
|
||||
onPress: () =>
|
||||
deleteVersion.mutate(
|
||||
{ owner: login, type: pkg.type ?? '', name: pkg.name ?? '', version: pkg.version as string },
|
||||
{ onError: (error: unknown) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)) },
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
text: t('common.delete'),
|
||||
style: 'destructive',
|
||||
text: t('packages.deleteAll'),
|
||||
style: 'destructive' as const,
|
||||
onPress: () =>
|
||||
deletePackage.mutate(
|
||||
{ owner: login, type: pkg.type ?? '', name: pkg.name ?? '' },
|
||||
{ onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)) },
|
||||
{ onError: (error: unknown) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)) },
|
||||
),
|
||||
},
|
||||
]);
|
||||
];
|
||||
Alert.alert(t('packages.deleteTitle'), t('packages.deleteBody', { name: pkg.name ?? '' }), buttons);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -32,10 +32,14 @@ import {
|
||||
createRelease,
|
||||
updateRelease,
|
||||
deleteRelease,
|
||||
uploadReleaseAsset,
|
||||
deleteReleaseAsset,
|
||||
fetchRepoTree,
|
||||
type ForkRepoInput,
|
||||
type ListMyReposParams,
|
||||
type ReleaseInput,
|
||||
type SearchReposParams,
|
||||
type UploadFile,
|
||||
} from '@/core/api/endpoints';
|
||||
import type { RawResponse } from '@/core/api/client';
|
||||
import { queryKeys } from '@/core/api/query-keys';
|
||||
@@ -282,3 +286,43 @@ export function useDeleteRelease(owner: string, name: string, id: number) {
|
||||
onSuccess: () => invalidateReleases(queryClient, accountId, owner, name),
|
||||
});
|
||||
}
|
||||
|
||||
export function useUploadReleaseAsset(owner: string, name: string, releaseId: number) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (file: UploadFile) => uploadReleaseAsset(client!, owner, name, releaseId, file),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.release(accountId, owner, name, releaseId) });
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.repo(accountId, owner, name) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteReleaseAsset(owner: string, name: string, releaseId: number) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (assetId: number) => deleteReleaseAsset(client!, owner, name, releaseId, assetId),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.release(accountId, owner, name, releaseId) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** Recursive file tree for the "find file" search (keyed by ref). */
|
||||
export function useRepoTree(owner: string, name: string, ref: string | undefined) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery({
|
||||
queryKey: queryKeys.repoTree(accountId, owner, name, ref ?? ''),
|
||||
enabled: Boolean(client) && Boolean(accountId) && Boolean(ref),
|
||||
queryFn: ({ signal }) => fetchRepoTree(client!, owner, name, ref!, { signal }),
|
||||
staleTime: 5 * 60_000,
|
||||
});
|
||||
}
|
||||
@@ -7,16 +7,25 @@ import {
|
||||
addRepoKey,
|
||||
createBranchProtection,
|
||||
createRepo,
|
||||
createRepoVariable,
|
||||
createWebhook,
|
||||
deleteBranchProtection,
|
||||
deleteRepo,
|
||||
deleteRepoKey,
|
||||
deleteRepoSecret,
|
||||
deleteRepoVariable,
|
||||
deleteWebhook,
|
||||
listBranchProtections,
|
||||
listCollaborators,
|
||||
listOrgTeams,
|
||||
listRepoKeys,
|
||||
listRepoProjects,
|
||||
listRepoSecrets,
|
||||
listRepoVariables,
|
||||
listWebhooks,
|
||||
putRepoSecret,
|
||||
removeCollaborator,
|
||||
transferRepo,
|
||||
updateRepo,
|
||||
type AddRepoKeyInput,
|
||||
type CollaboratorPermission,
|
||||
@@ -26,7 +35,16 @@ import {
|
||||
type UpdateRepoInput,
|
||||
} from '@/core/api/endpoints';
|
||||
import { queryKeys } from '@/core/api/query-keys';
|
||||
import type { BranchProtection, DeployKey, User, Webhook } from '@/core/api/types';
|
||||
import type {
|
||||
ActionVariable,
|
||||
BranchProtection,
|
||||
DeployKey,
|
||||
Project,
|
||||
Secret,
|
||||
Team,
|
||||
User,
|
||||
Webhook,
|
||||
} from '@/core/api/types';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
|
||||
export function useCollaboratorsList(owner: string, name: string) {
|
||||
@@ -226,3 +244,131 @@ export function useDeleteRepoKey(owner: string, name: string) {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.repoKeys(accountId, owner, name) }),
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Transfer
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function useTransferRepo(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (newOwner: string) => transferRepo(client!, owner, name, newOwner),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.account(accountId) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Actions secrets & variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function useRepoSecrets(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<Secret[]>({
|
||||
queryKey: queryKeys.repoSecrets(accountId, owner, name),
|
||||
enabled: Boolean(client) && Boolean(accountId),
|
||||
queryFn: ({ signal }) =>
|
||||
listRepoSecrets(client!, owner, name, { limit: 50 }, { signal }).then((r) => r.data),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function usePutRepoSecret(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ key, value }: { key: string; value: string }) =>
|
||||
putRepoSecret(client!, owner, name, key, value),
|
||||
onSuccess: () =>
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.repoSecrets(accountId, owner, name) }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteRepoSecret(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (key: string) => deleteRepoSecret(client!, owner, name, key),
|
||||
onSuccess: () =>
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.repoSecrets(accountId, owner, name) }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useRepoVariables(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<ActionVariable[]>({
|
||||
queryKey: queryKeys.repoVariables(accountId, owner, name),
|
||||
enabled: Boolean(client) && Boolean(accountId),
|
||||
queryFn: ({ signal }) =>
|
||||
listRepoVariables(client!, owner, name, { limit: 50 }, { signal }).then((r) => r.data),
|
||||
staleTime: 30_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useCreateRepoVariable(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ key, value }: { key: string; value: string }) =>
|
||||
createRepoVariable(client!, owner, name, key, value),
|
||||
onSuccess: () =>
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.repoVariables(accountId, owner, name),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteRepoVariable(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (key: string) => deleteRepoVariable(client!, owner, name, key),
|
||||
onSuccess: () =>
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.repoVariables(accountId, owner, name),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Read-only project list for the repository. */
|
||||
export function useRepoProjects(owner: string, name: string) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<Project[]>({
|
||||
queryKey: queryKeys.repoProjects(accountId, owner, name),
|
||||
enabled: Boolean(client) && Boolean(accountId),
|
||||
queryFn: ({ signal }) =>
|
||||
listRepoProjects(client!, owner, name, { limit: 50 }, { signal }).then((r) => r.data),
|
||||
staleTime: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useOrgTeams(org: string) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<Team[]>({
|
||||
queryKey: [...queryKeys.account(accountId), 'org', org, 'teams'],
|
||||
enabled: Boolean(client) && Boolean(accountId) && org.length > 0,
|
||||
queryFn: ({ signal }) =>
|
||||
listOrgTeams(client!, org, { limit: 50 }, { signal }).then((r) => r.data),
|
||||
staleTime: 60_000,
|
||||
});
|
||||
}
|
||||
@@ -11,12 +11,13 @@ import { ListItem } from '@/components/ui/list-item';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import type { ActionRunJob } from '@/core/api/types';
|
||||
import { formatDateTime } from '@/core/utils/format';
|
||||
import { formatBytes, formatDateTime } from '@/core/utils/format';
|
||||
import {
|
||||
useActionJobLogs,
|
||||
useActionRun,
|
||||
useActionRunControl,
|
||||
useActionRunJobs,
|
||||
useRunArtifacts,
|
||||
} from '@/features/actions/queries';
|
||||
import { useTheme } from '@/theme/theme-provider';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
@@ -42,6 +43,7 @@ export function ActionRunDetailScreen({ route }: Props) {
|
||||
const runQuery = useActionRun(owner, name, id);
|
||||
const jobsQuery = useActionRunJobs(owner, name, id);
|
||||
const control = useActionRunControl(owner, name, id);
|
||||
const artifactsQuery = useRunArtifacts(owner, name, id);
|
||||
|
||||
if (runQuery.isPending) return <LoadingView />;
|
||||
if (runQuery.isError) {
|
||||
@@ -57,6 +59,7 @@ export function ActionRunDetailScreen({ route }: Props) {
|
||||
|
||||
const run = runQuery.data;
|
||||
const jobs: ActionRunJob[] = jobsQuery.data ?? [];
|
||||
const artifacts = artifactsQuery.data ?? [];
|
||||
const state = run?.conclusion || run?.status || '';
|
||||
const running = run?.status === 'running' || run?.status === 'waiting';
|
||||
const canRerun = Boolean(run) && !running;
|
||||
@@ -123,6 +126,30 @@ export function ActionRunDetailScreen({ route }: Props) {
|
||||
) : (
|
||||
jobs.map((job) => <JobRow key={job.id} owner={owner} name={name} job={job} />)
|
||||
)}
|
||||
|
||||
{artifacts.length > 0 ? (
|
||||
<>
|
||||
<AppText variant="subheading">{t('actions.artifacts')}</AppText>
|
||||
<Card padded={false} variant="flat">
|
||||
{artifacts.map((artifact) => (
|
||||
<ListItem
|
||||
key={artifact.id}
|
||||
leadingIcon="package"
|
||||
title={artifact.name ?? ''}
|
||||
subtitle={t('actions.artifactSize', {
|
||||
size: formatBytes(artifact.size_in_bytes ?? 0),
|
||||
})}
|
||||
rightText={artifact.expired ? t('actions.expired') : undefined}
|
||||
onPress={() =>
|
||||
artifact.archive_download_url
|
||||
? void Linking.openURL(artifact.archive_download_url).catch(() => undefined)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Card>
|
||||
</>
|
||||
) : null}
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { QueryList } from '@/components/layout/query-list';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Badge, type BadgeTone } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { SegmentedControl } from '@/components/ui/segmented';
|
||||
import { EmptyState } from '@/components/ui/state-views';
|
||||
import type { ActionRun } from '@/core/api/types';
|
||||
@@ -55,6 +56,15 @@ export function ActionsScreen({ navigation, route }: Props) {
|
||||
{ value: 'running', label: t('actions.filterRunning') },
|
||||
]}
|
||||
/>
|
||||
<View style={styles.settings}>
|
||||
<Button
|
||||
label={t('repoSettings.actionsSettings')}
|
||||
variant="secondary"
|
||||
iconLeft="gear"
|
||||
fullWidth
|
||||
onPress={() => navigation.navigate('ActionsSettings', { owner, name })}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
renderItem={(run) => {
|
||||
@@ -91,6 +101,7 @@ export function ActionsScreen({ navigation, route }: Props) {
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
filters: { paddingHorizontal: spacing.lg, paddingVertical: spacing.sm },
|
||||
settings: { marginTop: spacing.sm },
|
||||
row: { paddingHorizontal: spacing.lg, paddingVertical: spacing.md, gap: spacing.xs },
|
||||
metaRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, flexWrap: 'wrap' },
|
||||
});
|
||||
@@ -0,0 +1,215 @@
|
||||
import { useState } from 'react';
|
||||
import { Alert, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Field } from '@/components/ui/field';
|
||||
import { IconButton } from '@/components/ui/icon-button';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import {
|
||||
useCreateRepoVariable,
|
||||
useDeleteRepoSecret,
|
||||
useDeleteRepoVariable,
|
||||
usePutRepoSecret,
|
||||
useRepoSecrets,
|
||||
useRepoVariables,
|
||||
} from '@/features/repositories/settings-queries';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
import type { RepositoryStackParamList } from '@/navigation/types';
|
||||
import type { ScreenProps } from '@/navigation/typing';
|
||||
|
||||
type Props = ScreenProps<RepositoryStackParamList, 'ActionsSettings'>;
|
||||
|
||||
/** Repository Actions secrets and variables (secrets are write-only). */
|
||||
export function ActionsSettingsScreen({ route }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const { owner, name } = route.params;
|
||||
|
||||
const secrets = useRepoSecrets(owner, name);
|
||||
const variables = useRepoVariables(owner, name);
|
||||
const putSecret = usePutRepoSecret(owner, name);
|
||||
const deleteSecret = useDeleteRepoSecret(owner, name);
|
||||
const createVariable = useCreateRepoVariable(owner, name);
|
||||
const deleteVariable = useDeleteRepoVariable(owner, name);
|
||||
|
||||
const [secretName, setSecretName] = useState('');
|
||||
const [secretValue, setSecretValue] = useState('');
|
||||
const [varName, setVarName] = useState('');
|
||||
const [varValue, setVarValue] = useState('');
|
||||
|
||||
if (secrets.isPending || variables.isPending) return <LoadingView />;
|
||||
if (secrets.isError || variables.isError) {
|
||||
const error = secrets.error ?? variables.error;
|
||||
return (
|
||||
<ErrorState
|
||||
title={t('errors.title')}
|
||||
body={apiErrorMessage(error, t)}
|
||||
retryLabel={t('common.retry')}
|
||||
onRetry={() => {
|
||||
void secrets.refetch();
|
||||
void variables.refetch();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const secretItems = secrets.data ?? [];
|
||||
const variableItems = variables.data ?? [];
|
||||
|
||||
const addSecret = () => {
|
||||
if (secretName.trim().length === 0 || secretValue.length === 0) return;
|
||||
putSecret.mutate(
|
||||
{ key: secretName.trim(), value: secretValue },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setSecretName('');
|
||||
setSecretValue('');
|
||||
},
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const addVariable = () => {
|
||||
if (varName.trim().length === 0) return;
|
||||
createVariable.mutate(
|
||||
{ key: varName.trim(), value: varValue },
|
||||
{
|
||||
onSuccess: () => {
|
||||
setVarName('');
|
||||
setVarValue('');
|
||||
},
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const confirmSecretDelete = (key: string) => {
|
||||
Alert.alert(t('repoSettings.deleteSecretTitle'), t('repoSettings.deleteSecretBody', { name: key }), [
|
||||
{ text: t('common.cancel'), style: 'cancel' },
|
||||
{
|
||||
text: t('common.delete'),
|
||||
style: 'destructive',
|
||||
onPress: () =>
|
||||
deleteSecret.mutate(key, {
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
}),
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
const confirmVariableDelete = (key: string) => {
|
||||
Alert.alert(t('repoSettings.deleteVariableTitle'), t('repoSettings.deleteVariableBody', { name: key }), [
|
||||
{ text: t('common.cancel'), style: 'cancel' },
|
||||
{
|
||||
text: t('common.delete'),
|
||||
style: 'destructive',
|
||||
onPress: () =>
|
||||
deleteVariable.mutate(key, {
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
}),
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
return (
|
||||
<Screen scroll padded>
|
||||
<AppText variant="subheading">{t('repoSettings.secrets')}</AppText>
|
||||
<Card>
|
||||
<Field
|
||||
label={t('repoSettings.secretName')}
|
||||
value={secretName}
|
||||
onChangeText={setSecretName}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<Field
|
||||
label={t('repoSettings.secretValue')}
|
||||
value={secretValue}
|
||||
onChangeText={setSecretValue}
|
||||
secureTextEntry
|
||||
autoCapitalize="none"
|
||||
/>
|
||||
<Button
|
||||
label={t('common.add')}
|
||||
onPress={addSecret}
|
||||
loading={putSecret.isPending}
|
||||
disabled={secretName.trim().length === 0 || secretValue.length === 0}
|
||||
fullWidth
|
||||
style={styles.spaced}
|
||||
/>
|
||||
</Card>
|
||||
{secretItems.map((secret) => (
|
||||
<Card key={secret.name}>
|
||||
<View style={styles.row}>
|
||||
<AppText variant="bodyMedium" style={styles.name} numberOfLines={1}>
|
||||
{secret.name}
|
||||
</AppText>
|
||||
<IconButton
|
||||
name="trash"
|
||||
onPress={() => confirmSecretDelete(secret.name ?? '')}
|
||||
accessibilityLabel={t('common.delete')}
|
||||
/>
|
||||
</View>
|
||||
</Card>
|
||||
))}
|
||||
|
||||
<AppText variant="subheading">{t('repoSettings.variables')}</AppText>
|
||||
<Card>
|
||||
<Field
|
||||
label={t('repoSettings.variableName')}
|
||||
value={varName}
|
||||
onChangeText={setVarName}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<Field
|
||||
label={t('repoSettings.variableValue')}
|
||||
value={varValue}
|
||||
onChangeText={setVarValue}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<Button
|
||||
label={t('common.add')}
|
||||
onPress={addVariable}
|
||||
loading={createVariable.isPending}
|
||||
disabled={varName.trim().length === 0}
|
||||
fullWidth
|
||||
style={styles.spaced}
|
||||
/>
|
||||
</Card>
|
||||
{variableItems.map((variable) => (
|
||||
<Card key={variable.name}>
|
||||
<View style={styles.row}>
|
||||
<View style={styles.name}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{variable.name}
|
||||
</AppText>
|
||||
{variable.data ? (
|
||||
<AppText variant="monoSmall" tone="tertiary" numberOfLines={1}>
|
||||
{variable.data}
|
||||
</AppText>
|
||||
) : null}
|
||||
</View>
|
||||
<IconButton
|
||||
name="trash"
|
||||
onPress={() => confirmVariableDelete(variable.name ?? '')}
|
||||
accessibilityLabel={t('common.delete')}
|
||||
/>
|
||||
</View>
|
||||
</Card>
|
||||
))}
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
spaced: { marginTop: spacing.md },
|
||||
row: { flexDirection: 'row', alignItems: 'center', gap: spacing.md },
|
||||
name: { flex: 1 },
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { Pressable, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { SearchBar } from '@/components/ui/search-bar';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { useRepository, useRepoTree } from '@/features/repositories/queries';
|
||||
import { fontFamily, spacing } from '@/theme/tokens';
|
||||
import type { RepositoryStackParamList } from '@/navigation/types';
|
||||
import type { ScreenProps } from '@/navigation/typing';
|
||||
|
||||
type Props = ScreenProps<RepositoryStackParamList, 'FindFile'>;
|
||||
|
||||
/** Find a file by path across the repository tree. */
|
||||
export function FindFileScreen({ navigation, route }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const { owner, name, ref } = route.params;
|
||||
const repo = useRepository(owner, name);
|
||||
const targetRef = ref ?? repo.data?.default_branch;
|
||||
const tree = useRepoTree(owner, name, targetRef);
|
||||
const [query, setQuery] = useState('');
|
||||
|
||||
const entries = useMemo(() => {
|
||||
const all = tree.data?.entries ?? [];
|
||||
const q = query.trim().toLowerCase();
|
||||
return all
|
||||
.filter((entry) => entry.type === 'blob' && (!q || (entry.path ?? '').toLowerCase().includes(q)))
|
||||
.slice(0, 300);
|
||||
}, [tree.data, query]);
|
||||
|
||||
return (
|
||||
<Screen padded={false}>
|
||||
<View style={styles.search}>
|
||||
<SearchBar
|
||||
value={query}
|
||||
onChangeText={setQuery}
|
||||
placeholder={t('files.findPlaceholder')}
|
||||
/>
|
||||
</View>
|
||||
|
||||
{tree.isPending ? (
|
||||
<LoadingView />
|
||||
) : tree.isError ? (
|
||||
<ErrorState
|
||||
title={t('errors.title')}
|
||||
body={apiErrorMessage(tree.error, t)}
|
||||
retryLabel={t('common.retry')}
|
||||
onRetry={() => void tree.refetch()}
|
||||
/>
|
||||
) : entries.length === 0 ? (
|
||||
<AppText variant="secondary" tone="tertiary" style={styles.empty}>
|
||||
{t('files.noMatches')}
|
||||
</AppText>
|
||||
) : (
|
||||
entries.map((entry) => (
|
||||
<Pressable
|
||||
key={entry.path}
|
||||
onPress={() =>
|
||||
entry.path &&
|
||||
navigation.navigate('FileViewer', { owner, name, path: entry.path, ref: targetRef })
|
||||
}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={entry.path}
|
||||
style={styles.row}
|
||||
>
|
||||
<AppText variant="monoSmall" numberOfLines={1} style={styles.path}>
|
||||
{entry.path}
|
||||
</AppText>
|
||||
</Pressable>
|
||||
))
|
||||
)}
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
search: { paddingHorizontal: spacing.lg, paddingVertical: spacing.sm },
|
||||
row: {
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.md,
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: 'rgba(128,128,128,0.2)',
|
||||
},
|
||||
path: { fontFamily: fontFamily.mono },
|
||||
empty: { padding: spacing.xl, textAlign: 'center' },
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { Linking, Pressable, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { CommentItem } from '@/components/git/comment';
|
||||
@@ -12,6 +12,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Icon } from '@/components/ui/icon';
|
||||
import { LabelChip } from '@/components/ui/label-chip';
|
||||
import { ListItem } from '@/components/ui/list-item';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { safeHost } from '@/core/api/instance-url';
|
||||
@@ -22,7 +23,10 @@ import {
|
||||
useCreateIssueComment,
|
||||
useDeleteIssueComment,
|
||||
useIssue,
|
||||
useIssueAttachments,
|
||||
useIssueComments,
|
||||
useIssueReactions,
|
||||
useToggleIssueReaction,
|
||||
useUpdateIssue,
|
||||
useUpdateIssueComment,
|
||||
} from '@/features/issues/queries';
|
||||
@@ -34,6 +38,17 @@ import type { ScreenProps } from '@/navigation/typing';
|
||||
|
||||
type Props = ScreenProps<RepositoryStackParamList, 'IssueDetail'>;
|
||||
|
||||
const REACTION_EMOJI: Record<string, string> = {
|
||||
'+1': '👍',
|
||||
'-1': '👎',
|
||||
laugh: '😄',
|
||||
hooray: '🎉',
|
||||
confused: '😕',
|
||||
heart: '❤️',
|
||||
rocket: '🚀',
|
||||
eyes: '👀',
|
||||
};
|
||||
|
||||
/** Full issue view: state, author, labels, milestone, body, comments and composer. */
|
||||
export function IssueDetailScreen({ navigation, route }: Props) {
|
||||
const { t } = useTranslation();
|
||||
@@ -48,6 +63,9 @@ export function IssueDetailScreen({ navigation, route }: Props) {
|
||||
const createComment = useCreateIssueComment(owner, name, index);
|
||||
const updateComment = useUpdateIssueComment(owner, name, index);
|
||||
const deleteComment = useDeleteIssueComment(owner, name, index);
|
||||
const reactionsQuery = useIssueReactions(owner, name, index);
|
||||
const toggleReaction = useToggleIssueReaction(owner, name, index);
|
||||
const attachmentsQuery = useIssueAttachments(owner, name, index);
|
||||
|
||||
if (query.isPending) return <LoadingView />;
|
||||
if (query.isError) {
|
||||
@@ -153,11 +171,59 @@ export function IssueDetailScreen({ navigation, route }: Props) {
|
||||
/>
|
||||
</View>
|
||||
|
||||
{/* Reactions */}
|
||||
<View style={styles.reactions}>
|
||||
{Object.entries(REACTION_EMOJI).map(([content, emoji]) => {
|
||||
const list = (reactionsQuery.data ?? []).filter((reaction) => reaction.content === content);
|
||||
const mine = list.some((reaction) => reaction.user?.login === account?.login);
|
||||
return (
|
||||
<Pressable
|
||||
key={content}
|
||||
onPress={() => toggleReaction.mutate({ content, mine })}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={content}
|
||||
style={[
|
||||
styles.reactionChip,
|
||||
{
|
||||
borderColor: mine ? colors.primary : colors.border,
|
||||
backgroundColor: mine ? colors.primaryMuted : colors.surface,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<AppText variant="caption">{emoji}</AppText>
|
||||
{list.length > 0 ? (
|
||||
<AppText variant="caption" tone={mine ? 'primary' : 'tertiary'}>
|
||||
{list.length}
|
||||
</AppText>
|
||||
) : null}
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
{/* Attachments */}
|
||||
{attachmentsQuery.data && attachmentsQuery.data.length > 0 ? (
|
||||
<Card padded={false} variant="flat">
|
||||
{attachmentsQuery.data.map((attachment, attachmentIndex) => (
|
||||
<ListItem
|
||||
key={attachment.id ?? attachment.name ?? attachmentIndex}
|
||||
leadingIcon="file"
|
||||
title={attachment.name ?? ''}
|
||||
onPress={() =>
|
||||
attachment.browser_download_url
|
||||
? void Linking.openURL(attachment.browser_download_url).catch(() => undefined)
|
||||
: undefined
|
||||
}
|
||||
divider={attachmentIndex < (attachmentsQuery.data?.length ?? 0) - 1}
|
||||
/>
|
||||
))}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{/* Comments */}
|
||||
<AppText variant="subheading" style={styles.sectionTitle}>
|
||||
{t('comments.title')}
|
||||
</AppText>
|
||||
|
||||
{commentsQuery.isPending ? (
|
||||
<LoadingView label={t('comments.loading')} />
|
||||
) : commentsQuery.isError ? (
|
||||
@@ -234,5 +300,16 @@ const styles = StyleSheet.create({
|
||||
bodyCard: { minHeight: 80 },
|
||||
metaGrid: { gap: spacing.sm },
|
||||
metaRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
|
||||
reactions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },
|
||||
reactionChip: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.xs,
|
||||
borderWidth: 1,
|
||||
borderRadius: 999,
|
||||
paddingHorizontal: spacing.sm,
|
||||
paddingVertical: 2,
|
||||
minHeight: 32,
|
||||
},
|
||||
sectionTitle: { marginTop: spacing.md },
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
import { Linking, Pressable, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { EmptyState, ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { useRepoProjects } from '@/features/repositories/settings-queries';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
import type { RepositoryStackParamList } from '@/navigation/types';
|
||||
import type { ScreenProps } from '@/navigation/typing';
|
||||
|
||||
type Props = ScreenProps<RepositoryStackParamList, 'Projects'>;
|
||||
|
||||
/** Repository projects (read-only list). */
|
||||
export function ProjectsScreen({ route }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const { owner, name } = route.params;
|
||||
const query = useRepoProjects(owner, name);
|
||||
|
||||
if (query.isPending) return <LoadingView />;
|
||||
if (query.isError) {
|
||||
return (
|
||||
<ErrorState
|
||||
title={t('errors.title')}
|
||||
body={apiErrorMessage(query.error, t)}
|
||||
retryLabel={t('common.retry')}
|
||||
onRetry={() => void query.refetch()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const projects = query.data ?? [];
|
||||
if (projects.length === 0) return <EmptyState icon="dashboard" title={t('projects.empty')} />;
|
||||
|
||||
return (
|
||||
<Screen scroll padded>
|
||||
{projects.map((project) => (
|
||||
<Card key={project.id}>
|
||||
<Pressable
|
||||
onPress={() =>
|
||||
project.html_url
|
||||
? void Linking.openURL(project.html_url).catch(() => undefined)
|
||||
: undefined
|
||||
}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={project.title}
|
||||
>
|
||||
<View style={styles.header}>
|
||||
<AppText variant="bodyMedium" style={styles.title} numberOfLines={1}>
|
||||
{project.title}
|
||||
</AppText>
|
||||
<Badge tone={project.is_closed ? 'neutral' : 'success'}>
|
||||
{project.is_closed ? t('projects.closed') : t('projects.open')}
|
||||
</Badge>
|
||||
</View>
|
||||
{project.description ? (
|
||||
<AppText variant="caption" tone="tertiary" numberOfLines={2}>
|
||||
{project.description}
|
||||
</AppText>
|
||||
) : null}
|
||||
<AppText variant="caption" tone="tertiary">
|
||||
{t('projects.issues', {
|
||||
open: project.num_open_issues ?? 0,
|
||||
closed: project.num_closed_issues ?? 0,
|
||||
})}
|
||||
</AppText>
|
||||
</Pressable>
|
||||
</Card>
|
||||
))}
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
header: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
|
||||
title: { flex: 1, fontWeight: '600' },
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Alert, Linking, Pressable, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import * as DocumentPicker from 'expo-document-picker';
|
||||
|
||||
import { Markdown } from '@/components/git/markdown';
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
@@ -9,10 +10,16 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Icon } from '@/components/ui/icon';
|
||||
import { IconButton } from '@/components/ui/icon-button';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
import { useDeleteRelease, useRelease } from '@/features/repositories/queries';
|
||||
import {
|
||||
useDeleteRelease,
|
||||
useDeleteReleaseAsset,
|
||||
useRelease,
|
||||
useUploadReleaseAsset,
|
||||
} from '@/features/repositories/queries';
|
||||
import { formatBytes, formatDateTime } from '@/core/utils/format';
|
||||
import { useTheme } from '@/theme/theme-provider';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
@@ -30,8 +37,24 @@ export function ReleaseDetailScreen({ navigation, route }: Props) {
|
||||
|
||||
const query = useRelease(owner, name, id);
|
||||
const deleteRelease = useDeleteRelease(owner, name, id);
|
||||
const uploadAsset = useUploadReleaseAsset(owner, name, id);
|
||||
const deleteAsset = useDeleteReleaseAsset(owner, name, id);
|
||||
const release = query.data;
|
||||
|
||||
const pickAndUpload = async () => {
|
||||
const result = await DocumentPicker.getDocumentAsync({ copyToCacheDirectory: true });
|
||||
if (result.canceled || !result.assets || result.assets.length === 0) return;
|
||||
const file = result.assets[0];
|
||||
uploadAsset.mutate(
|
||||
{
|
||||
uri: file.uri,
|
||||
name: file.name,
|
||||
type: file.mimeType ?? 'application/octet-stream',
|
||||
},
|
||||
{ onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)) },
|
||||
);
|
||||
};
|
||||
|
||||
if (query.isPending) return <LoadingView />;
|
||||
if (query.isError) {
|
||||
return (
|
||||
@@ -79,35 +102,71 @@ export function ReleaseDetailScreen({ navigation, route }: Props) {
|
||||
<AppText variant="subheading">{t('releases.assets')}</AppText>
|
||||
<Card padded={false} variant="flat">
|
||||
{assets.map((asset, index) => (
|
||||
<Pressable
|
||||
<View
|
||||
key={asset.id ?? asset.name ?? index}
|
||||
onPress={() =>
|
||||
asset.browser_download_url
|
||||
? void Linking.openURL(asset.browser_download_url).catch(() => undefined)
|
||||
: undefined
|
||||
}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={asset.name}
|
||||
style={[styles.assetRow, index < assets.length - 1 && styles.divider]}
|
||||
>
|
||||
<Icon name="download" size={18} color={colors.textTertiary} />
|
||||
<View style={styles.assetBody}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{asset.name}
|
||||
</AppText>
|
||||
<AppText variant="caption" tone="tertiary">
|
||||
{t('releases.downloads', {
|
||||
size: formatBytes(asset.size ?? 0),
|
||||
count: asset.download_count ?? 0,
|
||||
})}
|
||||
</AppText>
|
||||
</View>
|
||||
</Pressable>
|
||||
<Pressable
|
||||
onPress={() =>
|
||||
asset.browser_download_url
|
||||
? void Linking.openURL(asset.browser_download_url).catch(() => undefined)
|
||||
: undefined
|
||||
}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={asset.name}
|
||||
style={styles.assetMain}
|
||||
>
|
||||
<Icon name="download" size={18} color={colors.textTertiary} />
|
||||
<View style={styles.assetBody}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{asset.name}
|
||||
</AppText>
|
||||
<AppText variant="caption" tone="tertiary">
|
||||
{t('releases.downloads', {
|
||||
size: formatBytes(asset.size ?? 0),
|
||||
count: asset.download_count ?? 0,
|
||||
})}
|
||||
</AppText>
|
||||
</View>
|
||||
</Pressable>
|
||||
{asset.id ? (
|
||||
<IconButton
|
||||
name="trash"
|
||||
onPress={() =>
|
||||
Alert.alert(
|
||||
t('releases.deleteAssetTitle'),
|
||||
t('releases.deleteAssetBody', { name: asset.name ?? '' }),
|
||||
[
|
||||
{ text: t('common.cancel'), style: 'cancel' },
|
||||
{
|
||||
text: t('common.delete'),
|
||||
style: 'destructive',
|
||||
onPress: () =>
|
||||
deleteAsset.mutate(asset.id as number, {
|
||||
onError: (error) =>
|
||||
Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
}),
|
||||
},
|
||||
],
|
||||
)
|
||||
}
|
||||
accessibilityLabel={t('common.delete')}
|
||||
/>
|
||||
) : null}
|
||||
</View>
|
||||
))}
|
||||
</Card>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
<Button
|
||||
label={t('releases.uploadAsset')}
|
||||
variant="secondary"
|
||||
iconLeft="plus"
|
||||
loading={uploadAsset.isPending}
|
||||
onPress={() => void pickAndUpload()}
|
||||
/>
|
||||
|
||||
{release.html_url ? (
|
||||
<Button
|
||||
label={t('repo.viewOnInstance')}
|
||||
@@ -161,6 +220,7 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.md,
|
||||
},
|
||||
assetMain: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: spacing.md },
|
||||
divider: { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: 'rgba(128,128,128,0.25)' },
|
||||
assetBody: { flex: 1, gap: 2 },
|
||||
actions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },
|
||||
|
||||
@@ -205,6 +205,11 @@ export function RepoOverviewScreen({ navigation, route }: Props) {
|
||||
title={t('repo.files')}
|
||||
onPress={() => navigation.navigate('Files', { owner, name, ref: readmeRef })}
|
||||
/>
|
||||
<ListItem
|
||||
leadingIcon="search"
|
||||
title={t('files.findFile')}
|
||||
onPress={() => navigation.navigate('FindFile', { owner, name, ref: readmeRef })}
|
||||
/>
|
||||
<ListItem
|
||||
leadingIcon="commit"
|
||||
title={t('repo.commits')}
|
||||
@@ -241,6 +246,13 @@ export function RepoOverviewScreen({ navigation, route }: Props) {
|
||||
onPress={() => navigation.navigate('Actions', { owner, name })}
|
||||
/>
|
||||
) : null}
|
||||
{repo.has_projects !== false ? (
|
||||
<ListItem
|
||||
leadingIcon="dashboard"
|
||||
title={t('projects.title')}
|
||||
onPress={() => navigation.navigate('Projects', { owner, name })}
|
||||
/>
|
||||
) : null}
|
||||
{repo.has_issues !== false ? (
|
||||
<ListItem
|
||||
leadingIcon="issue"
|
||||
|
||||
@@ -13,6 +13,7 @@ import { apiErrorMessage } from '@/core/api/error-text';
|
||||
import { useRepository } from '@/features/repositories/queries';
|
||||
import {
|
||||
useDeleteRepo,
|
||||
useTransferRepo,
|
||||
useUpdateRepo,
|
||||
} from '@/features/repositories/settings-queries';
|
||||
import { useTheme } from '@/theme/theme-provider';
|
||||
@@ -41,6 +42,8 @@ export function RepoSettingsScreen({ navigation, route }: Props) {
|
||||
const repo = repoQuery.data;
|
||||
const updateRepo = useUpdateRepo(owner, name);
|
||||
const deleteRepo = useDeleteRepo(owner, name);
|
||||
const transferRepo = useTransferRepo(owner, name);
|
||||
const [newOwner, setNewOwner] = useState('');
|
||||
|
||||
const [description, setDescription] = useState<string | null>(null);
|
||||
const [website, setWebsite] = useState<string | null>(null);
|
||||
@@ -186,6 +189,45 @@ export function RepoSettingsScreen({ navigation, route }: Props) {
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<AppText variant="subheading">{t('repoSettings.transfer')}</AppText>
|
||||
<Card>
|
||||
<Field
|
||||
label={t('repoSettings.newOwner')}
|
||||
value={newOwner}
|
||||
onChangeText={setNewOwner}
|
||||
placeholder={t('repoSettings.newOwnerPlaceholder')}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<Button
|
||||
label={t('repoSettings.transferAction')}
|
||||
variant="secondary"
|
||||
iconLeft="arrowLeft"
|
||||
disabled={newOwner.trim().length === 0}
|
||||
loading={transferRepo.isPending}
|
||||
onPress={() =>
|
||||
Alert.alert(
|
||||
t('repoSettings.transferTitle'),
|
||||
t('repoSettings.transferBody', { name, owner: newOwner.trim() }),
|
||||
[
|
||||
{ text: t('common.cancel'), style: 'cancel' },
|
||||
{
|
||||
text: t('repoSettings.transferAction'),
|
||||
style: 'destructive',
|
||||
onPress: () =>
|
||||
transferRepo.mutate(newOwner.trim(), {
|
||||
onSuccess: () => navigation.getParent()?.goBack(),
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
}),
|
||||
},
|
||||
],
|
||||
)
|
||||
}
|
||||
fullWidth
|
||||
style={styles.spaced}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<AppText variant="subheading" tone="error">
|
||||
{t('repoSettings.dangerZone')}
|
||||
</AppText>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { queryClient } from '@/core/api/query-client';
|
||||
import type { BiometricSupport } from '@/core/security/biometrics';
|
||||
import { getBiometricSupport } from '@/core/security/biometrics';
|
||||
import { useSettingsStore, type ThemePreference } from '@/features/settings/settings-store';
|
||||
import { useCurrentUser } from '@/features/profile/queries';
|
||||
import { useRootNavigation } from '@/navigation/use-root-navigation';
|
||||
import type { LanguagePreference } from '@/i18n';
|
||||
import { useTheme } from '@/theme/theme-provider';
|
||||
@@ -45,6 +46,7 @@ export function SettingsScreen(_props: Props) {
|
||||
const setNotificationPollSeconds = useSettingsStore((s) => s.setNotificationPollSeconds);
|
||||
const editorUrlTemplate = useSettingsStore((s) => s.editorUrlTemplate);
|
||||
const setEditorUrlTemplate = useSettingsStore((s) => s.setEditorUrlTemplate);
|
||||
const currentUser = useCurrentUser();
|
||||
|
||||
const [support, setSupport] = useState<BiometricSupport | null>(null);
|
||||
|
||||
@@ -215,8 +217,16 @@ export function SettingsScreen(_props: Props) {
|
||||
leadingIcon="lock"
|
||||
title={t('credentials.title')}
|
||||
onPress={() => stackNavigation.navigate('Credentials')}
|
||||
divider={false}
|
||||
divider={currentUser.data?.is_admin ? true : false}
|
||||
/>
|
||||
{currentUser.data?.is_admin ? (
|
||||
<ListItem
|
||||
leadingIcon="shield"
|
||||
title={t('admin.title')}
|
||||
onPress={() => stackNavigation.navigate('Admin')}
|
||||
divider={false}
|
||||
/>
|
||||
) : null}
|
||||
</Card>
|
||||
</Section>
|
||||
|
||||
|
||||
@@ -183,7 +183,10 @@
|
||||
"submodule": "Submodule",
|
||||
"symlink": "Symlink to {{target}}",
|
||||
"currentRef": "Branch: {{ref}}",
|
||||
"pathNotFound": "This path does not exist in the repository."
|
||||
"pathNotFound": "This path does not exist in the repository.",
|
||||
"findFile": "Find file",
|
||||
"findPlaceholder": "Search files by path",
|
||||
"noMatches": "No matching files"
|
||||
},
|
||||
"commits": {
|
||||
"title": "Commits",
|
||||
@@ -341,7 +344,10 @@
|
||||
"edit": "Edit release",
|
||||
"tagRequired": "A tag is required.",
|
||||
"deleteTitle": "Delete release?",
|
||||
"deleteBody": "Release {{tag}} will be deleted."
|
||||
"deleteBody": "Release {{tag}} will be deleted.",
|
||||
"uploadAsset": "Upload asset",
|
||||
"deleteAssetTitle": "Delete asset?",
|
||||
"deleteAssetBody": "{{name}} will be deleted."
|
||||
},
|
||||
"actions": {
|
||||
"title": "Actions",
|
||||
@@ -367,6 +373,9 @@
|
||||
"loadingLogs": "Loading logs…",
|
||||
"logsUnavailable": "Logs are not available here — open the run in the browser.",
|
||||
"emptyLogs": "No log output.",
|
||||
"artifacts": "Artifacts",
|
||||
"artifactSize": "{{size}}",
|
||||
"expired": "Expired",
|
||||
"rerun": "Re-run",
|
||||
"cancel": "Cancel run"
|
||||
},
|
||||
@@ -420,7 +429,24 @@
|
||||
"noDeployKeys": "No deploy keys",
|
||||
"deleteKeyTitle": "Delete deploy key?",
|
||||
"deleteKeyBody": "The deploy key will be removed.",
|
||||
"writeAccess": "Write"
|
||||
"writeAccess": "Write",
|
||||
"actionsSettings": "Secrets & variables",
|
||||
"secrets": "Secrets",
|
||||
"secretName": "Secret name",
|
||||
"secretValue": "Value",
|
||||
"deleteSecretTitle": "Delete secret?",
|
||||
"deleteSecretBody": "Secret {{name}} will be removed.",
|
||||
"variables": "Variables",
|
||||
"variableName": "Variable name",
|
||||
"variableValue": "Value",
|
||||
"deleteVariableTitle": "Delete variable?",
|
||||
"deleteVariableBody": "Variable {{name}} will be removed.",
|
||||
"transfer": "Transfer ownership",
|
||||
"newOwner": "New owner",
|
||||
"newOwnerPlaceholder": "username or organization",
|
||||
"transferAction": "Transfer",
|
||||
"transferTitle": "Transfer repository?",
|
||||
"transferBody": "{{name}} will be transferred to {{owner}}."
|
||||
},
|
||||
"createRepo": {
|
||||
"title": "New repository",
|
||||
@@ -443,7 +469,26 @@
|
||||
"visLimited": "Limited",
|
||||
"visPrivate": "Private",
|
||||
"createdTitle": "Created",
|
||||
"createdBody": "The organization was created."
|
||||
"createdBody": "The organization was created.",
|
||||
"teams": "Teams",
|
||||
"noTeams": "No teams"
|
||||
},
|
||||
"projects": {
|
||||
"title": "Projects",
|
||||
"empty": "No projects",
|
||||
"open": "Open",
|
||||
"closed": "Closed",
|
||||
"issues": "{{open}} open · {{closed}} closed"
|
||||
},
|
||||
"admin": {
|
||||
"title": "Administration",
|
||||
"users": "Users",
|
||||
"orgs": "Organizations",
|
||||
"repos": "Repositories",
|
||||
"adminBadge": "Admin",
|
||||
"emptyUsers": "No users",
|
||||
"emptyOrgs": "No organizations",
|
||||
"emptyRepos": "No repositories"
|
||||
},
|
||||
"profile": {
|
||||
"title": "Profile",
|
||||
@@ -456,7 +501,9 @@
|
||||
"title": "Packages",
|
||||
"empty": "No packages",
|
||||
"deleteTitle": "Delete package?",
|
||||
"deleteBody": "All versions of {{name}} will be deleted."
|
||||
"deleteBody": "Choose what to delete for {{name}}.",
|
||||
"deleteVersion": "Delete this version",
|
||||
"deleteAll": "Delete all versions"
|
||||
},
|
||||
"credentials": {
|
||||
"title": "Credentials",
|
||||
|
||||
@@ -183,7 +183,10 @@
|
||||
"submodule": "Submodule",
|
||||
"symlink": "Symlink naar {{target}}",
|
||||
"currentRef": "Branch: {{ref}}",
|
||||
"pathNotFound": "Dit pad bestaat niet in de repository."
|
||||
"pathNotFound": "Dit pad bestaat niet in de repository.",
|
||||
"findFile": "Bestand zoeken",
|
||||
"findPlaceholder": "Zoek bestanden op pad",
|
||||
"noMatches": "Geen overeenkomende bestanden"
|
||||
},
|
||||
"commits": {
|
||||
"title": "Commits",
|
||||
@@ -341,7 +344,10 @@
|
||||
"edit": "Release bewerken",
|
||||
"tagRequired": "Een tag is verplicht.",
|
||||
"deleteTitle": "Release verwijderen?",
|
||||
"deleteBody": "Release {{tag}} wordt verwijderd."
|
||||
"deleteBody": "Release {{tag}} wordt verwijderd.",
|
||||
"uploadAsset": "Bestand uploaden",
|
||||
"deleteAssetTitle": "Bestand verwijderen?",
|
||||
"deleteAssetBody": "{{name}} wordt verwijderd."
|
||||
},
|
||||
"actions": {
|
||||
"title": "Actions",
|
||||
@@ -367,6 +373,9 @@
|
||||
"loadingLogs": "Logs laden…",
|
||||
"logsUnavailable": "Logs zijn hier niet beschikbaar — open de run in de browser.",
|
||||
"emptyLogs": "Geen logregels.",
|
||||
"artifacts": "Artefacten",
|
||||
"artifactSize": "{{size}}",
|
||||
"expired": "Verlopen",
|
||||
"rerun": "Opnieuw uitvoeren",
|
||||
"cancel": "Run annuleren"
|
||||
},
|
||||
@@ -420,7 +429,24 @@
|
||||
"noDeployKeys": "Geen deploy-sleutels",
|
||||
"deleteKeyTitle": "Deploy-sleutel verwijderen?",
|
||||
"deleteKeyBody": "De deploy-sleutel wordt verwijderd.",
|
||||
"writeAccess": "Schrijven"
|
||||
"writeAccess": "Schrijven",
|
||||
"actionsSettings": "Secrets en variabelen",
|
||||
"secrets": "Secrets",
|
||||
"secretName": "Naam van secret",
|
||||
"secretValue": "Waarde",
|
||||
"deleteSecretTitle": "Secret verwijderen?",
|
||||
"deleteSecretBody": "Secret {{name}} wordt verwijderd.",
|
||||
"variables": "Variabelen",
|
||||
"variableName": "Naam van variabele",
|
||||
"variableValue": "Waarde",
|
||||
"deleteVariableTitle": "Variabele verwijderen?",
|
||||
"deleteVariableBody": "Variabele {{name}} wordt verwijderd.",
|
||||
"transfer": "Eigenaar overdragen",
|
||||
"newOwner": "Nieuwe eigenaar",
|
||||
"newOwnerPlaceholder": "gebruikersnaam of organisatie",
|
||||
"transferAction": "Overdragen",
|
||||
"transferTitle": "Repository overdragen?",
|
||||
"transferBody": "{{name}} wordt overgedragen aan {{owner}}."
|
||||
},
|
||||
"createRepo": {
|
||||
"title": "Nieuwe repository",
|
||||
@@ -443,7 +469,26 @@
|
||||
"visLimited": "Beperkt",
|
||||
"visPrivate": "Privé",
|
||||
"createdTitle": "Aangemaakt",
|
||||
"createdBody": "De organisatie is aangemaakt."
|
||||
"createdBody": "De organisatie is aangemaakt.",
|
||||
"teams": "Teams",
|
||||
"noTeams": "Geen teams"
|
||||
},
|
||||
"projects": {
|
||||
"title": "Projecten",
|
||||
"empty": "Geen projecten",
|
||||
"open": "Open",
|
||||
"closed": "Gesloten",
|
||||
"issues": "{{open}} open · {{closed}} gesloten"
|
||||
},
|
||||
"admin": {
|
||||
"title": "Beheer",
|
||||
"users": "Gebruikers",
|
||||
"orgs": "Organisaties",
|
||||
"repos": "Repositories",
|
||||
"adminBadge": "Beheerder",
|
||||
"emptyUsers": "Geen gebruikers",
|
||||
"emptyOrgs": "Geen organisaties",
|
||||
"emptyRepos": "Geen repositories"
|
||||
},
|
||||
"profile": {
|
||||
"title": "Profiel",
|
||||
@@ -456,7 +501,9 @@
|
||||
"title": "Packages",
|
||||
"empty": "Geen packages",
|
||||
"deleteTitle": "Package verwijderen?",
|
||||
"deleteBody": "Alle versies van {{name}} worden verwijderd."
|
||||
"deleteBody": "Kies wat je wilt verwijderen voor {{name}}.",
|
||||
"deleteVersion": "Deze versie verwijderen",
|
||||
"deleteAll": "Alle versies verwijderen"
|
||||
},
|
||||
"credentials": {
|
||||
"title": "Inloggegevens",
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { HeaderAccountAndSettings } from '@/components/layout/header-buttons';
|
||||
import { ActionsScreen } from '@/features/repository/screens/actions-screen';
|
||||
import { ActionRunDetailScreen } from '@/features/repository/screens/action-run-detail-screen';
|
||||
import { ActionsSettingsScreen } from '@/features/repository/screens/actions-settings-screen';
|
||||
import { BranchesScreen } from '@/features/repository/screens/branches-screen';
|
||||
import { CollaboratorsScreen } from '@/features/repository/screens/collaborators-screen';
|
||||
import { CommitDetailScreen } from '@/features/repository/screens/commit-detail-screen';
|
||||
@@ -17,8 +18,10 @@ import { DeployKeysScreen } from '@/features/repository/screens/deploy-keys-scre
|
||||
import { FileEditScreen } from '@/features/repository/screens/file-edit-screen';
|
||||
import { FileViewerScreen } from '@/features/repository/screens/file-viewer-screen';
|
||||
import { FilesScreen } from '@/features/repository/screens/files-screen';
|
||||
import { FindFileScreen } from '@/features/repository/screens/find-file-screen';
|
||||
import { IssueComposeScreen } from '@/features/repository/screens/issue-compose-screen';
|
||||
import { IssueDetailScreen } from '@/features/repository/screens/issue-detail-screen';
|
||||
import { ProjectsScreen } from '@/features/repository/screens/projects-screen';
|
||||
import { ProtectionsScreen } from '@/features/repository/screens/protections-screen';
|
||||
import { PullDetailScreen } from '@/features/repository/screens/pull-detail-screen';
|
||||
import { PullDiffScreen } from '@/features/repository/screens/pull-diff-screen';
|
||||
@@ -203,6 +206,21 @@ export function RepositoryNavigator() {
|
||||
component={ActionRunDetailScreen}
|
||||
options={{ title: t('actions.runTitle') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="ActionsSettings"
|
||||
component={ActionsSettingsScreen}
|
||||
options={{ title: t('repoSettings.actionsSettings') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="FindFile"
|
||||
component={FindFileScreen}
|
||||
options={{ title: t('files.findFile') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Projects"
|
||||
component={ProjectsScreen}
|
||||
options={{ title: t('projects.title') }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,9 @@ import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { CredentialsScreen } from '@/features/profile/screens/credentials-screen';
|
||||
import { CreateOrgScreen } from '@/features/profile/screens/create-org-screen';
|
||||
import { AdminScreen } from '@/features/profile/screens/admin-screen';
|
||||
import { OrgReposScreen } from '@/features/profile/screens/org-repos-screen';
|
||||
import { OrgTeamsScreen } from '@/features/profile/screens/org-teams-screen';
|
||||
import { OrganizationsScreen } from '@/features/profile/screens/organizations-screen';
|
||||
import { PackagesScreen } from '@/features/profile/screens/packages-screen';
|
||||
import { ProfileScreen } from '@/features/profile/screens/profile-screen';
|
||||
@@ -54,6 +56,16 @@ export function SettingsNavigator() {
|
||||
component={CreateOrgScreen}
|
||||
options={{ title: t('organizations.create') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="OrgTeams"
|
||||
component={OrgTeamsScreen}
|
||||
options={{ title: t('organizations.teams') }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Admin"
|
||||
component={AdminScreen}
|
||||
options={{ title: t('admin.title') }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
}
|
||||
@@ -63,6 +63,9 @@ export type RepositoryStackParamList = {
|
||||
DeployKeys: { owner: string; name: string };
|
||||
Actions: { owner: string; name: string };
|
||||
ActionRunDetail: { owner: string; name: string; id: number };
|
||||
ActionsSettings: { owner: string; name: string };
|
||||
FindFile: { owner: string; name: string; ref?: string };
|
||||
Projects: { owner: string; name: string };
|
||||
};
|
||||
|
||||
export type RepositoriesStackParamList = {
|
||||
@@ -74,10 +77,12 @@ export type SettingsStackParamList = {
|
||||
Settings: undefined;
|
||||
Organizations: undefined;
|
||||
OrgRepos: { org: string };
|
||||
OrgTeams: { org: string };
|
||||
Packages: undefined;
|
||||
Credentials: undefined;
|
||||
Profile: undefined;
|
||||
CreateOrg: undefined;
|
||||
Admin: undefined;
|
||||
};
|
||||
|
||||
export type AccountsStackParamList = {
|
||||
|
||||
Reference in new issue
Block a user