mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-18 01:45:17 +00:00
refactor(dokploy): improve repository selection UI for version control providers
- Updated repository selection logic across Bitbucket, Gitea, GitHub, and GitLab components to display a placeholder when no repository is selected. - Enhanced loading state messages for better user experience, ensuring users are prompted to select an account before loading repositories. - Cleaned up conditional rendering for loading states and account selection prompts in the UI.
This commit is contained in:
+12
-8
@@ -245,13 +245,13 @@ export const SaveBitbucketProvider = ({ applicationId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -263,11 +263,15 @@ export const SaveBitbucketProvider = ({ applicationId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!bitbucketId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a Bitbucket account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -258,14 +258,14 @@ export const SaveGiteaProvider = ({ applicationId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo: GiteaRepository) =>
|
(repo: GiteaRepository) =>
|
||||||
repo.name === field.value.repo,
|
repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -277,11 +277,15 @@ export const SaveGiteaProvider = ({ applicationId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!giteaId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a Gitea account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -233,13 +233,13 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -251,11 +251,15 @@ export const SaveGithubProvider = ({ applicationId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!githubId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a GitHub account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -254,13 +254,13 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -272,11 +272,15 @@ export const SaveGitlabProvider = ({ applicationId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!gitlabId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a GitLab account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -247,13 +247,13 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -265,11 +265,15 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!bitbucketId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a Bitbucket account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -244,13 +244,13 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@@ -261,11 +261,15 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!giteaId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a Gitea account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -234,13 +234,13 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -252,11 +252,15 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!githubId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a GitHub account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
+12
-8
@@ -256,13 +256,13 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
|
|||||||
!field.value && "text-muted-foreground",
|
!field.value && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingRepositories
|
{!field.value.owner
|
||||||
? "Loading...."
|
? "Select repository"
|
||||||
: field.value.owner
|
: isLoadingRepositories
|
||||||
? repositories?.find(
|
? "Loading...."
|
||||||
|
: repositories?.find(
|
||||||
(repo) => repo.name === field.value.repo,
|
(repo) => repo.name === field.value.repo,
|
||||||
)?.name
|
)?.name ?? "Select repository"}
|
||||||
: "Select repository"}
|
|
||||||
|
|
||||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -274,11 +274,15 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
|
|||||||
placeholder="Search repository..."
|
placeholder="Search repository..."
|
||||||
className="h-9"
|
className="h-9"
|
||||||
/>
|
/>
|
||||||
{isLoadingRepositories && (
|
{!gitlabId ? (
|
||||||
|
<span className="py-6 text-center text-sm text-muted-foreground">
|
||||||
|
Select a GitLab account first
|
||||||
|
</span>
|
||||||
|
) : isLoadingRepositories ? (
|
||||||
<span className="py-6 text-center text-sm">
|
<span className="py-6 text-center text-sm">
|
||||||
Loading Repositories....
|
Loading Repositories....
|
||||||
</span>
|
</span>
|
||||||
)}
|
) : null}
|
||||||
<CommandEmpty>No repositories found.</CommandEmpty>
|
<CommandEmpty>No repositories found.</CommandEmpty>
|
||||||
<ScrollArea className="h-96">
|
<ScrollArea className="h-96">
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user