useUpdateProject
Datalayer Core / useUpdateProject
Function: useUpdateProject()
useUpdateProject(): {
assignAgent: (project,agentPodName,agentSpecId?) =>Promise<any>;context:unknown;data:undefined;error:null;failureCount:number;failureReason:Error|null;isError:false;isIdle:true;isPaused:boolean;isPending:false;isSuccess:false;mutate:UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;mutateAsync:UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;renameProject: (project,newName) =>Promise<any>;reset: () =>void;status:"idle";submittedAt:number;unassignAgent: (project) =>Promise<any>;variables:undefined; } | {assignAgent: (project,agentPodName,agentSpecId?) =>Promise<any>;context:unknown;data:undefined;error:null;failureCount:number;failureReason:Error|null;isError:false;isIdle:false;isPaused:boolean;isPending:true;isSuccess:false;mutate:UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;mutateAsync:UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;renameProject: (project,newName) =>Promise<any>;reset: () =>void;status:"pending";submittedAt:number;unassignAgent: (project) =>Promise<any>;variables:Partial<IAnySpace> &Record<string,unknown>; } | {assignAgent: (project,agentPodName,agentSpecId?) =>Promise<any>;context:unknown;data:undefined;error:Error;failureCount:number;failureReason:Error|null;isError:true;isIdle:false;isPaused:boolean;isPending:false;isSuccess:false;mutate:UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;mutateAsync:UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;renameProject: (project,newName) =>Promise<any>;reset: () =>void;status:"error";submittedAt:number;unassignAgent: (project) =>Promise<any>;variables:Partial<IAnySpace> &Record<string,unknown>; } | {assignAgent: (project,agentPodName,agentSpecId?) =>Promise<any>;context:unknown;data:any;error:null;failureCount:number;failureReason:Error|null;isError:false;isIdle:false;isPaused:boolean;isPending:false;isSuccess:true;mutate:UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;mutateAsync:UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>;renameProject: (project,newName) =>Promise<any>;reset: () =>void;status:"success";submittedAt:number;unassignAgent: (project) =>Promise<any>;variables:Partial<IAnySpace> &Record<string,unknown>; }
Defined in: src/hooks/useProjects.ts:159
Hook to update a project (e.g. persist the attached agent pod name). Uses the spacer PUT endpoint via useUpdateSpace.
Returns
Type Literal
{ assignAgent: (project, agentPodName, agentSpecId?) => Promise<any>; context: unknown; data: undefined; error: null; failureCount: number; failureReason: Error | null; isError: false; isIdle: true; isPaused: boolean; isPending: false; isSuccess: false; mutate: UseMutateFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; renameProject: (project, newName) => Promise<any>; reset: () => void; status: "idle"; submittedAt: number; unassignAgent: (project) => Promise<any>; variables: undefined; }
assignAgent
assignAgent: (
project,agentPodName,agentSpecId?) =>Promise<any>
Assign an agent runtime to the project
Parameters
project
agentPodName
string
agentSpecId?
string
Returns
Promise<any>
context
context:
unknown
data
data:
undefined
The last successfully resolved data for the mutation.
error
error:
null
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
false
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
true
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
false
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
false
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
renameProject
renameProject: (
project,newName) =>Promise<any>
Rename a project
Parameters
project
newName
string
Returns
Promise<any>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"idle"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
unassignAgent
unassignAgent: (
project) =>Promise<any>
Remove the agent assignment from the project
Parameters
project
Returns
Promise<any>
variables
variables:
undefined
The variables object passed to the mutationFn.
Type Literal
{ assignAgent: (project, agentPodName, agentSpecId?) => Promise<any>; context: unknown; data: undefined; error: null; failureCount: number; failureReason: Error | null; isError: false; isIdle: false; isPaused: boolean; isPending: true; isSuccess: false; mutate: UseMutateFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; renameProject: (project, newName) => Promise<any>; reset: () => void; status: "pending"; submittedAt: number; unassignAgent: (project) => Promise<any>; variables: Partial<IAnySpace> & Record<string, unknown>; }
assignAgent
assignAgent: (
project,agentPodName,agentSpecId?) =>Promise<any>
Assign an agent runtime to the project
Parameters
project
agentPodName
string
agentSpecId?
string
Returns
Promise<any>
context
context:
unknown
data
data:
undefined
The last successfully resolved data for the mutation.
error
error:
null
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
false
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
false
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
true
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
false
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
renameProject
renameProject: (
project,newName) =>Promise<any>
Rename a project
Parameters
project
newName
string
Returns
Promise<any>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"pending"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
unassignAgent
unassignAgent: (
project) =>Promise<any>
Remove the agent assignment from the project
Parameters
project
Returns
Promise<any>
variables
variables:
Partial<IAnySpace> &Record<string,unknown>
The variables object passed to the mutationFn.
Type Literal
{ assignAgent: (project, agentPodName, agentSpecId?) => Promise<any>; context: unknown; data: undefined; error: Error; failureCount: number; failureReason: Error | null; isError: true; isIdle: false; isPaused: boolean; isPending: false; isSuccess: false; mutate: UseMutateFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; renameProject: (project, newName) => Promise<any>; reset: () => void; status: "error"; submittedAt: number; unassignAgent: (project) => Promise<any>; variables: Partial<IAnySpace> & Record<string, unknown>; }
assignAgent
assignAgent: (
project,agentPodName,agentSpecId?) =>Promise<any>
Assign an agent runtime to the project
Parameters
project
agentPodName
string
agentSpecId?
string
Returns
Promise<any>
context
context:
unknown
data
data:
undefined
The last successfully resolved data for the mutation.
error
error:
Error
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
true
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
false
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
false
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
false
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
renameProject
renameProject: (
project,newName) =>Promise<any>
Rename a project
Parameters
project
newName
string
Returns
Promise<any>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"error"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
unassignAgent
unassignAgent: (
project) =>Promise<any>
Remove the agent assignment from the project
Parameters
project
Returns
Promise<any>
variables
variables:
Partial<IAnySpace> &Record<string,unknown>
The variables object passed to the mutationFn.
Type Literal
{ assignAgent: (project, agentPodName, agentSpecId?) => Promise<any>; context: unknown; data: any; error: null; failureCount: number; failureReason: Error | null; isError: false; isIdle: false; isPaused: boolean; isPending: false; isSuccess: true; mutate: UseMutateFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; mutateAsync: UseMutateAsyncFunction<any, Error, Partial<IAnySpace> & Record<string, unknown>, unknown>; renameProject: (project, newName) => Promise<any>; reset: () => void; status: "success"; submittedAt: number; unassignAgent: (project) => Promise<any>; variables: Partial<IAnySpace> & Record<string, unknown>; }
assignAgent
assignAgent: (
project,agentPodName,agentSpecId?) =>Promise<any>
Assign an agent runtime to the project
Parameters
project
agentPodName
string
agentSpecId?
string
Returns
Promise<any>
context
context:
unknown
data
data:
any
The last successfully resolved data for the mutation.
error
error:
null
The error object for the mutation, if an error was encountered.
- Defaults to
null.
failureCount
failureCount:
number
failureReason
failureReason:
Error|null
isError
isError:
false
A boolean variable derived from status.
trueif the last mutation attempt resulted in an error.
isIdle
isIdle:
false
A boolean variable derived from status.
trueif the mutation is in its initial state prior to executing.
isPaused
isPaused:
boolean
isPending
isPending:
false
A boolean variable derived from status.
trueif the mutation is currently executing.
isSuccess
isSuccess:
true
A boolean variable derived from status.
trueif the last mutation attempt was successful.
mutate
mutate:
UseMutateFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
Param
The variables object to pass to the mutationFn.
Param
This function will fire when the mutation is successful and will be passed the mutation's result.
Param
This function will fire if the mutation encounters an error and will be passed the error.
Param
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
Remarks
- If you make multiple requests,
onSuccesswill fire only after the latest call you've made. - All the callback functions (
onSuccess,onError,onSettled) are void functions, and the returned value will be ignored.
mutateAsync
mutateAsync:
UseMutateAsyncFunction<any,Error,Partial<IAnySpace> &Record<string,unknown>,unknown>
renameProject
renameProject: (
project,newName) =>Promise<any>
Rename a project
Parameters
project
newName
string
Returns
Promise<any>
reset
reset: () =>
void
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
Returns
void
status
status:
"success"
The status of the mutation.
- Will be:
idleinitial status prior to the mutation function executing.pendingif the mutation is currently executing.errorif the last mutation attempt resulted in an error.successif the last mutation attempt was successful.
submittedAt
submittedAt:
number
unassignAgent
unassignAgent: (
project) =>Promise<any>
Remove the agent assignment from the project
Parameters
project
Returns
Promise<any>
variables
variables:
Partial<IAnySpace> &Record<string,unknown>
The variables object passed to the mutationFn.