feat: labels/milestones CRUD, issue filters+sort, workflow enable/disable, package link/unlink
- labels screen (create/edit/delete) and milestones screen (create/close/delete) - repo issues: label + milestone server-side filters and client-side sorting - Actions settings: list workflows with enable/disable toggle - packages: link/unlink to a repository - endpoints/hooks/i18n (en/nl)
This commit is contained in:
1 parent
1226f154cc
commit
a104d65978
14 files changed
+996
-44
No files matched your search
@@ -18,6 +18,8 @@ import {
|
||||
listUserKeys,
|
||||
listUserOrgs,
|
||||
listUserTokens,
|
||||
linkPackageToRepo,
|
||||
unlinkPackageFromRepo,
|
||||
updateUserSettings,
|
||||
type CreateOrgInput,
|
||||
} from '@/core/api/endpoints';
|
||||
@@ -184,6 +186,32 @@ export function useDeletePackageVersion() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useLinkPackage() {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
return useMutation({
|
||||
mutationFn: ({ owner, type, name, repoName }: { owner: string; type: string; name: string; repoName: string }) =>
|
||||
linkPackageToRepo(client!, owner, type, name, repoName),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.account(accountId) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUnlinkPackage() {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
return useMutation({
|
||||
mutationFn: ({ owner, type, name }: { owner: string; type: string; name: string }) =>
|
||||
unlinkPackageFromRepo(client!, owner, type, name),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.account(accountId) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Admin (read-only)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
import { useState } from 'react';
|
||||
import { Alert, StyleSheet, View } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { QueryList } from '@/components/layout/query-list';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
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 { EmptyState } from '@/components/ui/state-views';
|
||||
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, useDeletePackageVersion, usePackages } from '@/features/profile/queries';
|
||||
import {
|
||||
useDeletePackage,
|
||||
useDeletePackageVersion,
|
||||
useLinkPackage,
|
||||
usePackages,
|
||||
useUnlinkPackage,
|
||||
} from '@/features/profile/queries';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
|
||||
@@ -22,8 +32,13 @@ export function PackagesScreen() {
|
||||
const query = usePackages(login);
|
||||
const deletePackage = useDeletePackage();
|
||||
const deleteVersion = useDeletePackageVersion();
|
||||
const linkPackage = useLinkPackage();
|
||||
const unlinkPackage = useUnlinkPackage();
|
||||
const packages: Package[] = flattenPages(query.data);
|
||||
|
||||
const [linkTarget, setLinkTarget] = useState<Package | null>(null);
|
||||
const [repoName, setRepoName] = useState('');
|
||||
|
||||
const confirmDelete = (pkg: Package) => {
|
||||
const buttons = [
|
||||
{ text: t('common.cancel'), style: 'cancel' as const },
|
||||
@@ -57,6 +72,72 @@ export function PackagesScreen() {
|
||||
query={query}
|
||||
items={packages}
|
||||
keyExtractor={(pkg) => `${pkg.type ?? ''}-${pkg.name ?? ''}-${pkg.version ?? ''}`}
|
||||
header={
|
||||
linkTarget ? (
|
||||
<Card style={styles.linkCard}>
|
||||
<AppText variant="bodyMedium" numberOfLines={1}>
|
||||
{linkTarget.name}
|
||||
</AppText>
|
||||
<Field
|
||||
label={t('packages.linkRepo')}
|
||||
value={repoName}
|
||||
onChangeText={setRepoName}
|
||||
placeholder={t('packages.linkRepoPlaceholder')}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<View style={styles.linkActions}>
|
||||
<Button
|
||||
label={t('common.cancel')}
|
||||
variant="ghost"
|
||||
size="md"
|
||||
onPress={() => {
|
||||
setLinkTarget(null);
|
||||
setRepoName('');
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
label={t('packages.link')}
|
||||
size="md"
|
||||
loading={linkPackage.isPending}
|
||||
disabled={repoName.trim().length === 0}
|
||||
onPress={() =>
|
||||
linkPackage.mutate(
|
||||
{
|
||||
owner: login,
|
||||
type: linkTarget.type ?? '',
|
||||
name: linkTarget.name ?? '',
|
||||
repoName: repoName.trim(),
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
setLinkTarget(null);
|
||||
setRepoName('');
|
||||
},
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
label={t('packages.unlink')}
|
||||
variant="danger"
|
||||
size="md"
|
||||
loading={unlinkPackage.isPending}
|
||||
onPress={() =>
|
||||
unlinkPackage.mutate(
|
||||
{ owner: login, type: linkTarget.type ?? '', name: linkTarget.name ?? '' },
|
||||
{
|
||||
onSuccess: () => setLinkTarget(null),
|
||||
onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)),
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</Card>
|
||||
) : undefined
|
||||
}
|
||||
renderItem={(pkg) => (
|
||||
<View style={styles.row}>
|
||||
<View style={styles.body}>
|
||||
@@ -77,6 +158,14 @@ export function PackagesScreen() {
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
<IconButton
|
||||
name="externalLink"
|
||||
onPress={() => {
|
||||
setLinkTarget(pkg);
|
||||
setRepoName('');
|
||||
}}
|
||||
accessibilityLabel={t('packages.link')}
|
||||
/>
|
||||
<IconButton
|
||||
name="trash"
|
||||
onPress={() => confirmDelete(pkg)}
|
||||
@@ -99,4 +188,6 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
body: { flex: 1, gap: spacing.xs },
|
||||
metaRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, flexWrap: 'wrap' },
|
||||
linkCard: { gap: spacing.sm },
|
||||
linkActions: { flexDirection: 'row', justifyContent: 'flex-end', gap: spacing.sm, flexWrap: 'wrap' },
|
||||
});
|
||||
Reference in new issue
Block a user