feat: Convert workflow definition entity type to a free-text field and update tenant ID API parameter.

This commit is contained in:
Yashwin 2026-03-16 18:10:07 +05:30
parent 5a0da32699
commit 8b9ac59c3f
3 changed files with 14 additions and 7 deletions

View File

@ -99,7 +99,7 @@ const workflowSchema = z
name: z.string().min(1, "Name is required"), name: z.string().min(1, "Name is required"),
code: z.string().min(1, "Code is required"), code: z.string().min(1, "Code is required"),
description: z.string().optional(), description: z.string().optional(),
entity_type: z.enum(["document", "capa", "supplier", "training"]), entity_type: z.string().min(1, "entity_type is required").max(100, "entity_type must be at most 100 characters"),
status: z.enum(["draft", "active", "deprecated", "archived"]), status: z.enum(["draft", "active", "deprecated", "archived"]),
source_module: z.array(z.string()).optional(), source_module: z.array(z.string()).optional(),
source_module_id: z source_module_id: z
@ -235,7 +235,7 @@ export const WorkflowDefinitionModal = ({
name: "", name: "",
code: "", code: "",
description: "", description: "",
entity_type: "document", entity_type: "",
status: "draft", status: "draft",
source_module: [], source_module: [],
source_module_id: [], source_module_id: [],
@ -350,7 +350,7 @@ export const WorkflowDefinitionModal = ({
name: "", name: "",
code: "", code: "",
description: "", description: "",
entity_type: "document", entity_type: "",
status: "draft", status: "draft",
source_module: [], source_module: [],
source_module_id: [], source_module_id: [],
@ -591,7 +591,14 @@ export const WorkflowDefinitionModal = ({
error={errors.description?.message as any} error={errors.description?.message as any}
/> />
</div> </div>
<Controller <FormField
label="Entity Type"
placeholder="e.g. Document, CAPA, Supplier, Training"
required
{...register("entity_type")}
error={errors.entity_type?.message as any}
/>
{/* <Controller
name="entity_type" name="entity_type"
control={control} control={control}
render={({ field }) => ( render={({ field }) => (
@ -610,7 +617,7 @@ export const WorkflowDefinitionModal = ({
disabled={isEdit} disabled={isEdit}
/> />
)} )}
/> /> */}
<Controller <Controller
name="status" name="status"
control={control} control={control}

View File

@ -200,7 +200,7 @@ const WorkflowDefinitionsTable = ({
key: "entity_type", key: "entity_type",
label: "Entity Type", label: "Entity Type",
render: (wf) => ( render: (wf) => (
<span className="text-sm text-[#6b7280] capitalize"> <span className="text-sm text-[#6b7280]">
{wf.entity_type} {wf.entity_type}
</span> </span>
), ),

View File

@ -30,7 +30,7 @@ class WorkflowService {
} }
async getDefinition(id: string, tenantId?: string): Promise<WorkflowDefinitionResponse> { async getDefinition(id: string, tenantId?: string): Promise<WorkflowDefinitionResponse> {
const params = tenantId ? { tenant_id: tenantId } : {}; const params = tenantId ? { tenantId: tenantId } : {};
const response = await apiClient.get<WorkflowDefinitionResponse>(`${this.baseUrl}/definitions/${id}`, { params }); const response = await apiClient.get<WorkflowDefinitionResponse>(`${this.baseUrl}/definitions/${id}`, { params });
return response.data; return response.data;
} }