diff --git a/apps/gitness/src/components-v2/app-shell.tsx b/apps/gitness/src/components-v2/app-shell.tsx
index fcfad4b7d..6a734a5e6 100644
--- a/apps/gitness/src/components-v2/app-shell.tsx
+++ b/apps/gitness/src/components-v2/app-shell.tsx
@@ -175,58 +175,68 @@ export const AppShell = () => {
useRepoImportEvents()
return (
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+ >
)
}
export const AppShellMFE = () => {
- return
+ useRepoImportEvents()
+
+ return (
+ <>
+
+
+ >
+ )
}
function BreadcrumbsAndOutlet({ className }: { className?: string }) {
- useRepoImportEvents()
-
return (
)
}
diff --git a/apps/gitness/src/pages-v2/repo/repo-create-page.tsx b/apps/gitness/src/pages-v2/repo/repo-create-page.tsx
index 45863d68e..2a883c88e 100644
--- a/apps/gitness/src/pages-v2/repo/repo-create-page.tsx
+++ b/apps/gitness/src/pages-v2/repo/repo-create-page.tsx
@@ -1,16 +1,14 @@
import { useNavigate, useParams } from 'react-router-dom'
import {
- CreateRepositoryErrorResponse,
OpenapiCreateRepositoryRequest,
useCreateRepositoryMutation,
useListGitignoreQuery,
useListLicensesQuery
} from '@harnessio/code-service-client'
-import { toast } from '@harnessio/ui/components'
import { FormFields, RepoCreatePage as RepoCreatePageView } from '@harnessio/ui/views'
-import { Toaster } from '../../components-v2/toaster'
+// import { Toaster } from '../../components-v2/toaster'
import { useRoutes } from '../../framework/context/NavigationContext'
import { useGetSpaceURLParam } from '../../framework/hooks/useGetSpaceParam'
import { useTranslationStore } from '../../i18n/stores/i18n-store'
@@ -18,7 +16,7 @@ import { PathParams } from '../../RouteDefinitions'
export const CreateRepo = () => {
const routes = useRoutes()
- const createRepositoryMutation = useCreateRepositoryMutation({})
+ const { mutate: createRepository, error, isLoading, isSuccess } = useCreateRepositoryMutation({})
const { spaceId } = useParams()
const spaceURL = useGetSpaceURLParam()
const navigate = useNavigate()
@@ -35,7 +33,7 @@ export const CreateRepo = () => {
identifier: data.name
}
- createRepositoryMutation.mutate(
+ createRepository(
{
queryParams: {
space_path: spaceURL
@@ -45,13 +43,6 @@ export const CreateRepo = () => {
{
onSuccess: ({ body: data }) => {
navigate(routes.toRepoSummary({ spaceId, repoId: data?.identifier }))
- },
- onError: (error: CreateRepositoryErrorResponse) => {
- const message = error.message || 'An unknown error occurred.'
- toast({
- title: message,
- variant: 'destructive'
- })
}
}
)
@@ -70,13 +61,13 @@ export const CreateRepo = () => {
-
>
)
}
diff --git a/packages/ui/locales/en/component.json b/packages/ui/locales/en/component.json
index 9d69b1143..5d533d71e 100644
--- a/packages/ui/locales/en/component.json
+++ b/packages/ui/locales/en/component.json
@@ -1,62 +1,16 @@
{
- "deleteDialog": {
- "title": "Are you sure?",
- "descriptionWithType": "This will permanently delete your {{type}} and remove all data. This action cannot be undone.",
- "description": "This will permanently remove all data. This action cannot be undone.",
- "inputLabel": "To confirm, type",
- "cancel": "Cancel"
- },
- "filter": {
- "delete": "Delete Filter",
- "add-filter": "Add filter",
- "reset": "Reset",
- "defaultLabel": "Filter",
- "inputPlaceholder": "Filter by...",
- "buttonLabel": "Reset filters",
- "is": "is",
- "isNot": "is not",
- "isEmpty": "is empty",
- "isNotEmpty": "is not empty",
- "isBefore": "is before",
- "isAfter": "is after",
- "isBetween": "is between",
- "contains": "contains",
- "doesNotContain": "does not contain",
- "startsWith": "starts with",
- "endsWith": "ends with",
- "type": "Type",
- "public": "Public",
- "private": "Private",
- "fork": "Fork",
- "createdTime": "Created Time",
- "name": "Name",
- "stars": "Stars",
- "ascending": "Ascending",
- "descending": "Descending",
- "author": "Author",
- "createdBefore": "Created Before",
- "createdAfter": "Created After"
- },
- "sort": {
- "defaultLabel": "Sort",
- "inputPlaceholder": "Sort by...",
- "buttonLabel": "Reset sort",
- "lastUpdated": "Last updated",
- "stars": "Stars",
- "forks": "Forks",
- "pullRequests": "Pull Requests",
- "title": "Title"
- },
"navbar": {
"settings": "Settings",
"pin": "Pin",
"remove": "Remove",
"reorder": "Reorder",
"unpin": "Unpin",
+ "appearence": "Appearance",
+ "language": "Language",
+ "logout": "Log out",
"profile": "Profile",
"theme": "Theme",
"customNav": "Customize navigation",
- "logout": "Log out",
"devops": "Devops",
"repositories": "Repositories",
"pipelines": "Pipelines",
@@ -108,6 +62,54 @@
"administration": "Administration",
"account": "Account"
},
+ "deleteDialog": {
+ "title": "Are you sure?",
+ "descriptionWithType": "This will permanently delete your {{type}} and remove all data. This action cannot be undone.",
+ "description": "This will permanently remove all data. This action cannot be undone.",
+ "inputLabel": "To confirm, type",
+ "cancel": "Cancel"
+ },
+ "filter": {
+ "delete": "Delete Filter",
+ "add-filter": "Add filter",
+ "reset": "Reset",
+ "defaultLabel": "Filter",
+ "inputPlaceholder": "Filter by...",
+ "buttonLabel": "Reset filters",
+ "is": "is",
+ "isNot": "is not",
+ "isEmpty": "is empty",
+ "isNotEmpty": "is not empty",
+ "isBefore": "is before",
+ "isAfter": "is after",
+ "isBetween": "is between",
+ "contains": "contains",
+ "doesNotContain": "does not contain",
+ "startsWith": "starts with",
+ "endsWith": "ends with",
+ "type": "Type",
+ "public": "Public",
+ "private": "Private",
+ "fork": "Fork",
+ "createdTime": "Created Time",
+ "name": "Name",
+ "stars": "Stars",
+ "ascending": "Ascending",
+ "descending": "Descending",
+ "author": "Author",
+ "createdBefore": "Created Before",
+ "createdAfter": "Created After"
+ },
+ "sort": {
+ "defaultLabel": "Sort",
+ "inputPlaceholder": "Sort by...",
+ "buttonLabel": "Reset sort",
+ "lastUpdated": "Last updated",
+ "stars": "Stars",
+ "forks": "Forks",
+ "pullRequests": "Pull Requests",
+ "title": "Title"
+ },
"pagination": {
"previous": "Previous",
"next": "Next"
diff --git a/packages/ui/locales/fr/component.json b/packages/ui/locales/fr/component.json
index 12921eedf..3fc39f20c 100644
--- a/packages/ui/locales/fr/component.json
+++ b/packages/ui/locales/fr/component.json
@@ -1,62 +1,16 @@
{
- "deleteDialog": {
- "title": "Êtes-vous sûr ?",
- "descriptionWithType": "This will permanently delete your {{type}} and remove all data. This action cannot be undone.",
- "description": "This will permanently remove all data. This action cannot be undone.",
- "inputLabel": "To confirm, type",
- "cancel": "Annuler"
- },
- "filter": {
- "delete": "Delete filter",
- "add-filter": "Ajouter un filtre",
- "reset": "Réinitialiser",
- "defaultLabel": "Filtrer",
- "inputPlaceholder": "Filtrer par...",
- "buttonLabel": "Réinitialiser les filtres",
- "is": "est",
- "isNot": "n'est pas",
- "isEmpty": "est vide",
- "isNotEmpty": "n'est pas vide",
- "isBefore": "est avant",
- "isAfter": "est après",
- "isBetween": "est entre",
- "contains": "contient",
- "doesNotContain": "ne contient pas",
- "startsWith": "commence par",
- "endsWith": "se termine par",
- "type": "Type",
- "public": "Public",
- "private": "Privé",
- "fork": "Bifurcation",
- "createdTime": "Date de création",
- "name": "Nom",
- "stars": "Étoiles",
- "ascending": "Croissant",
- "descending": "Décroissant",
- "author": "Author",
- "createdBefore": "Created Before",
- "createdAfter": "Created After"
- },
- "sort": {
- "defaultLabel": "Trier",
- "inputPlaceholder": "Trier par...",
- "buttonLabel": "Réinitialiser le tri",
- "lastUpdated": "Dernière mise à jour",
- "stars": "Étoiles",
- "forks": "Bifurcations",
- "pullRequests": "Demandes de fusion",
- "title": "Titre"
- },
"navbar": {
"settings": "Paramètres",
"pin": "Épingler",
"remove": "Supprimer",
"reorder": "Réorganiser",
"unpin": "Désépingler",
+ "appearence": "Appearance",
+ "language": "Language",
+ "logout": "Se déconnecter",
"profile": "Profile",
"theme": "Thème",
"customNav": "Personnaliser la navigation",
- "logout": "Se déconnecter",
"devops": "Devops",
"repositories": "Dépôts",
"pipelines": "Pipelines",
@@ -108,6 +62,54 @@
"administration": "Administration",
"account": "Compte"
},
+ "deleteDialog": {
+ "title": "Êtes-vous sûr ?",
+ "descriptionWithType": "This will permanently delete your {{type}} and remove all data. This action cannot be undone.",
+ "description": "This will permanently remove all data. This action cannot be undone.",
+ "inputLabel": "To confirm, type",
+ "cancel": "Annuler"
+ },
+ "filter": {
+ "delete": "Delete filter",
+ "add-filter": "Ajouter un filtre",
+ "reset": "Réinitialiser",
+ "defaultLabel": "Filtrer",
+ "inputPlaceholder": "Filtrer par...",
+ "buttonLabel": "Réinitialiser les filtres",
+ "is": "est",
+ "isNot": "n'est pas",
+ "isEmpty": "est vide",
+ "isNotEmpty": "n'est pas vide",
+ "isBefore": "est avant",
+ "isAfter": "est après",
+ "isBetween": "est entre",
+ "contains": "contient",
+ "doesNotContain": "ne contient pas",
+ "startsWith": "commence par",
+ "endsWith": "se termine par",
+ "type": "Type",
+ "public": "Public",
+ "private": "Privé",
+ "fork": "Bifurcation",
+ "createdTime": "Date de création",
+ "name": "Nom",
+ "stars": "Étoiles",
+ "ascending": "Croissant",
+ "descending": "Décroissant",
+ "author": "Author",
+ "createdBefore": "Created Before",
+ "createdAfter": "Created After"
+ },
+ "sort": {
+ "defaultLabel": "Trier",
+ "inputPlaceholder": "Trier par...",
+ "buttonLabel": "Réinitialiser le tri",
+ "lastUpdated": "Dernière mise à jour",
+ "stars": "Étoiles",
+ "forks": "Bifurcations",
+ "pullRequests": "Demandes de fusion",
+ "title": "Titre"
+ },
"pagination": {
"previous": "Précédent",
"next": "Suivant"
diff --git a/packages/ui/src/views/repo/repo-create/index.tsx b/packages/ui/src/views/repo/repo-create/index.tsx
index ebd6ebae4..594915117 100644
--- a/packages/ui/src/views/repo/repo-create/index.tsx
+++ b/packages/ui/src/views/repo/repo-create/index.tsx
@@ -2,6 +2,7 @@ import { useEffect } from 'react'
import { useForm, type SubmitHandler } from 'react-hook-form'
import {
+ Alert,
Button,
ButtonGroup,
Checkbox,
@@ -24,13 +25,9 @@ import { SandboxLayout, TranslationStore } from '@/views'
import { zodResolver } from '@hookform/resolvers/zod'
import { z } from 'zod'
-const NAMESCHEMA = /^[a-zA-Z_][0-9a-zA-Z-_.$]*$/
-
// Define the form schema with optional fields for gitignore and license
const formSchema = z.object({
- name: z.string().min(1, { message: 'Please provide a name' }).regex(NAMESCHEMA, {
- message: 'Name must start with a letter or _ and only contain [a-zA-Z0-9-_.]'
- }),
+ name: z.string().min(1, { message: 'Please provide a name' }),
description: z.string(),
gitignore: z.string().optional(),
license: z.string().optional(),
@@ -48,6 +45,7 @@ interface RepoCreatePageProps {
gitIgnoreOptions?: string[]
licenseOptions?: { value?: string; label?: string }[]
useTranslationStore: () => TranslationStore
+ apiError?: string
}
export function RepoCreatePage({
@@ -57,7 +55,8 @@ export function RepoCreatePage({
isSuccess,
gitIgnoreOptions,
licenseOptions,
- useTranslationStore
+ useTranslationStore,
+ apiError
}: RepoCreatePageProps) {
const { t } = useTranslationStore()
@@ -67,7 +66,7 @@ export function RepoCreatePage({
setValue,
watch,
reset,
- formState: { errors, isValid }
+ formState: { errors }
} = useForm({
resolver: zodResolver(formSchema),
mode: 'onChange',
@@ -256,12 +255,18 @@ export function RepoCreatePage({
+ {apiError && (
+
+ {apiError}
+
+ )}
+
{/* SUBMIT BUTTONS */}
-