1
This commit is contained in:
parent
c705e0eef7
commit
52bc47cc2d
@ -144,8 +144,8 @@ const ApplicationModal: React.FC<ApplicationModalProps> = ({
|
|||||||
setRepositoryGroups(response || []);
|
setRepositoryGroups(response || []);
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchRepositoryProjects = async (groupId: number) => {
|
const fetchRepositoryProjects = async (repoGroupId: number) => {
|
||||||
const response = await getRepositoryProjects(groupId);
|
const response = await getRepositoryProjects(repoGroupId);
|
||||||
setRepositoryProjects(response || []);
|
setRepositoryProjects(response || []);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ const ApplicationModal: React.FC<ApplicationModalProps> = ({
|
|||||||
>
|
>
|
||||||
{field.value
|
{field.value
|
||||||
? repositoryGroups.find(
|
? repositoryGroups.find(
|
||||||
(group) => group.id === field.value
|
(group) => group.repoGroupId === field.value
|
||||||
)?.fullName || "请选择代码仓库组"
|
)?.fullName || "请选择代码仓库组"
|
||||||
: !form.watch('externalSystemId')
|
: !form.watch('externalSystemId')
|
||||||
? "请先选择外部系统"
|
? "请先选择外部系统"
|
||||||
@ -349,16 +349,16 @@ const ApplicationModal: React.FC<ApplicationModalProps> = ({
|
|||||||
) : (
|
) : (
|
||||||
filteredGroups.map((group) => (
|
filteredGroups.map((group) => (
|
||||||
<div
|
<div
|
||||||
key={group.id}
|
key={group.repoGroupId}
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
|
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",
|
||||||
group.id === field.value && "bg-accent text-accent-foreground"
|
group.repoGroupId === field.value && "bg-accent text-accent-foreground"
|
||||||
)}
|
)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
form.setValue("repoGroupId", group.id);
|
form.setValue("repoGroupId", group.repoGroupId);
|
||||||
form.setValue("repoProjectId", undefined);
|
form.setValue("repoProjectId", undefined);
|
||||||
setRepositoryProjects([]);
|
setRepositoryProjects([]);
|
||||||
fetchRepositoryProjects(group.id);
|
fetchRepositoryProjects(group.repoGroupId);
|
||||||
setSearchValue("");
|
setSearchValue("");
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
@ -375,7 +375,7 @@ const ApplicationModal: React.FC<ApplicationModalProps> = ({
|
|||||||
{group.fullPath}
|
{group.fullPath}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{group.id === field.value && (
|
{group.repoGroupId === field.value && (
|
||||||
<Check className="ml-auto h-4 w-4" />
|
<Check className="ml-auto h-4 w-4" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export const getRepositoryGroupList = (externalSystemId: number) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 获取项目列表
|
// 获取项目列表
|
||||||
export const getRepositoryProjects = (groupId: number) =>
|
export const getRepositoryProjects = (repoGroupId: number) =>
|
||||||
request.get<RepositoryProject[]>(`${REPOSITORY_PROJECT_URL}/list`, {
|
request.get<RepositoryProject[]>(`${REPOSITORY_PROJECT_URL}/list`, {
|
||||||
params: { groupId },
|
params: { repoGroupId: repoGroupId },
|
||||||
});
|
});
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export interface Application extends BaseResponse {
|
|||||||
export interface RepositoryGroup extends BaseResponse {
|
export interface RepositoryGroup extends BaseResponse {
|
||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
groupId: number;
|
repoGroupId: number;
|
||||||
parentId?: number;
|
parentId?: number;
|
||||||
path: string;
|
path: string;
|
||||||
fullName: string;
|
fullName: string;
|
||||||
@ -48,7 +48,6 @@ export interface RepositoryProject extends BaseResponse {
|
|||||||
path: string;
|
path: string;
|
||||||
description: string;
|
description: string;
|
||||||
visibility: string;
|
visibility: string;
|
||||||
groupId: number;
|
|
||||||
isDefaultBranch: string;
|
isDefaultBranch: string;
|
||||||
webUrl: string;
|
webUrl: string;
|
||||||
sshUrl: string;
|
sshUrl: string;
|
||||||
@ -56,6 +55,8 @@ export interface RepositoryProject extends BaseResponse {
|
|||||||
lastActivityAt: string;
|
lastActivityAt: string;
|
||||||
externalSystemId: number;
|
externalSystemId: number;
|
||||||
projectId: number;
|
projectId: number;
|
||||||
|
repoGroupId: number;
|
||||||
|
repoProjectId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CreateApplicationRequest = Omit<Application, 'id' | keyof BaseResponse>;
|
export type CreateApplicationRequest = Omit<Application, 'id' | keyof BaseResponse>;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user