260220:1504 20260220 TASK-BEFE-001 Refactor by ADR-014
All checks were successful
Build and Deploy / deploy (push) Successful in 2m34s

This commit is contained in:
admin
2026-02-20 15:04:02 +07:00
parent 7f27f9478b
commit 397c46bc4e
15 changed files with 709 additions and 492 deletions

View File

@@ -1,13 +1,13 @@
"use client";
'use client';
import { useState, useEffect } from "react";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Plus, Edit, Copy, Trash, Loader2 } from "lucide-react";
import Link from "next/link";
import { Workflow } from "@/types/workflow";
import { workflowApi } from "@/lib/api/workflows";
import { useState, useEffect } from 'react';
import { Button } from '@/components/ui/button';
import { Card } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Plus, Edit, Copy, Trash, Loader2 } from 'lucide-react';
import Link from 'next/link';
import { Workflow } from '@/types/workflow';
import { workflowApi } from '@/lib/api/workflows';
export default function WorkflowsPage() {
const [workflows, setWorkflows] = useState<Workflow[]>([]);
@@ -20,7 +20,7 @@ export default function WorkflowsPage() {
const data = await workflowApi.getWorkflows();
setWorkflows(data);
} catch (error) {
console.error("Failed to fetch workflows", error);
console.error('Failed to fetch workflows', error);
} finally {
setLoading(false);
}
@@ -34,9 +34,7 @@ export default function WorkflowsPage() {
<div className="flex justify-between items-center">
<div>
<h1 className="text-3xl font-bold">Workflow Configuration</h1>
<p className="text-muted-foreground mt-1">
Manage workflow definitions and routing rules
</p>
<p className="text-muted-foreground mt-1">Manage workflow definitions and routing rules</p>
</div>
<Link href="/admin/workflows/new">
<Button>
@@ -57,24 +55,20 @@ export default function WorkflowsPage() {
<div className="flex justify-between items-start">
<div className="flex-1">
<div className="flex items-center gap-3 mb-2">
<h3 className="text-lg font-semibold">
{workflow.workflowName}
</h3>
<Badge variant={workflow.isActive ? "default" : "secondary"} className={workflow.isActive ? "bg-green-600 hover:bg-green-700" : ""}>
{workflow.isActive ? "Active" : "Inactive"}
<h3 className="text-lg font-semibold">{workflow.workflowName}</h3>
<Badge
variant={workflow.isActive ? 'default' : 'secondary'}
className={workflow.isActive ? 'bg-green-600 hover:bg-green-700' : ''}
>
{workflow.isActive ? 'Active' : 'Inactive'}
</Badge>
<Badge variant="outline">v{workflow.version}</Badge>
</div>
<p className="text-sm text-muted-foreground mb-3">
{workflow.description}
</p>
<p className="text-sm text-muted-foreground mb-3">{workflow.description}</p>
<div className="flex gap-6 text-sm text-muted-foreground">
<span>Type: {workflow.workflowType}</span>
<span>Steps: {workflow.stepCount}</span>
<span>
Updated:{" "}
{new Date(workflow.updatedAt).toLocaleDateString()}
</span>
<span>Updated: {new Date(workflow.updatedAt).toLocaleDateString()}</span>
</div>
</div>
@@ -85,11 +79,16 @@ export default function WorkflowsPage() {
Edit
</Button>
</Link>
<Button variant="outline" size="sm" onClick={() => alert("Clone functionality mocked")}>
<Button variant="outline" size="sm" onClick={() => alert('Clone functionality mocked')}>
<Copy className="mr-2 h-4 w-4" />
Clone
</Button>
<Button variant="outline" size="sm" className="text-destructive hover:text-destructive" onClick={() => alert("Delete functionality mocked")}>
<Button
variant="outline"
size="sm"
className="text-destructive hover:text-destructive"
onClick={() => alert('Delete functionality mocked')}
>
<Trash className="mr-2 h-4 w-4" />
Delete
</Button>