generated from kevisual/vite-react-template
feat: 更新停止工作区逻辑以接受工作区参数
This commit is contained in:
@@ -106,8 +106,7 @@ export function RepoCard({ repo, onStartWorkspace, onEdit, onIssue, onSettings,
|
|||||||
size="sm"
|
size="sm"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// TODO: 实现停止工作区逻辑
|
stopWorkspace(workspace)
|
||||||
stopWorkspace()
|
|
||||||
}}
|
}}
|
||||||
className="h-8 w-8 p-0 border-neutral-200 hover:border-red-600 hover:bg-red-600 hover:text-white transition-all cursor-pointer"
|
className="h-8 w-8 p-0 border-neutral-200 hover:border-red-600 hover:bg-red-600 hover:text-white transition-all cursor-pointer"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ type State = {
|
|||||||
getWorkspaceList: () => Promise<any>;
|
getWorkspaceList: () => Promise<any>;
|
||||||
refresh: (opts?: { message?: string, showTips?: boolean }) => Promise<any>;
|
refresh: (opts?: { message?: string, showTips?: boolean }) => Promise<any>;
|
||||||
startWorkspace: (data: Partial<Data>, params?: { open?: boolean, branch?: string }) => Promise<any>;
|
startWorkspace: (data: Partial<Data>, params?: { open?: boolean, branch?: string }) => Promise<any>;
|
||||||
stopWorkspace: () => Promise<any>;
|
stopWorkspace: (workspace?: WorkspaceInfo) => Promise<any>;
|
||||||
getWorkspaceDetail: (data: WorkspaceInfo) => Promise<any>;
|
getWorkspaceDetail: (data: WorkspaceInfo) => Promise<any>;
|
||||||
workspaceLink: Partial<WorkspaceOpen>;
|
workspaceLink: Partial<WorkspaceOpen>;
|
||||||
selectWorkspace?: WorkspaceInfo,
|
selectWorkspace?: WorkspaceInfo,
|
||||||
@@ -299,8 +299,8 @@ export const useRepoStore = create<State>((set, get) => {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
stopWorkspace: async () => {
|
stopWorkspace: async (workspace?: WorkspaceInfo) => {
|
||||||
const sn = get().selectWorkspace?.sn;
|
const sn = workspace?.sn || get().selectWorkspace?.sn;
|
||||||
if (!sn) {
|
if (!sn) {
|
||||||
toast.error('未选择工作区');
|
toast.error('未选择工作区');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user