feat: update dynamic status model badge activation

This commit is contained in:
Mahen 2026-02-19 11:26:20 +07:00
parent 1317694bcc
commit 072273b260
8 changed files with 17 additions and 6 deletions

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Model" ADD COLUMN "isActive" BOOLEAN NOT NULL DEFAULT false;

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Model" ALTER COLUMN "isActive" SET DEFAULT true;

View File

@ -180,11 +180,11 @@ model Model {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
modelName String modelName String
description String? description String?
accuracy Float accuracy Float
macroF1 Float macroF1 Float
f1Negative Float f1Negative Float
f1Neutral Float f1Neutral Float
isActive Boolean @default(true)
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt

View File

@ -12,6 +12,7 @@ async function main() {
macroF1: 0.56, macroF1: 0.56,
f1Negative: 0.61, f1Negative: 0.61,
f1Neutral: 0.16, f1Neutral: 0.16,
isActive: false,
}, },
{ {
modelName: "Model XGBoost (Tuned)", modelName: "Model XGBoost (Tuned)",
@ -21,6 +22,7 @@ async function main() {
macroF1: 0.58, macroF1: 0.58,
f1Negative: 0.65, f1Negative: 0.65,
f1Neutral: 0.17, f1Neutral: 0.17,
isActive: false,
}, },
{ {
modelName: "Model XGBoost (Optimized)", modelName: "Model XGBoost (Optimized)",
@ -30,6 +32,7 @@ async function main() {
macroF1: 0.61, macroF1: 0.61,
f1Negative: 0.65, f1Negative: 0.65,
f1Neutral: 0.27, f1Neutral: 0.27,
isActive: true,
}, },
]; ];

View File

@ -14,6 +14,7 @@ export const getClassificationReport = async () => {
macroF1: true, macroF1: true,
f1Negative: true, f1Negative: true,
f1Neutral: true, f1Neutral: true,
isActive: true,
}, },
orderBy: { orderBy: {
createdAt: "asc", createdAt: "asc",

View File

@ -21,7 +21,6 @@ export default function AnalysisClient() {
register, register,
handleSubmit, handleSubmit,
onSubmit, onSubmit,
setValue,
errors, errors,
isValid, isValid,
loading, loading,
@ -43,7 +42,6 @@ export default function AnalysisClient() {
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
<div className="flex w-full gap-4"> <div className="flex w-full gap-4">
{/* Field Profesi */}
<div className="w-1/2"> <div className="w-1/2">
<label className="block mb-1 text-sm font-medium text-gray-700"> <label className="block mb-1 text-sm font-medium text-gray-700">
Pilih Profesi Pilih Profesi
@ -60,7 +58,11 @@ export default function AnalysisClient() {
</SelectTrigger> </SelectTrigger>
<SelectContent className="bg-card" position="popper"> <SelectContent className="bg-card" position="popper">
{professionItems.map((item) => ( {professionItems.map((item) => (
<SelectItem key={item.value} value={item.value} className="focus:bg-primary focus:text-card"> <SelectItem
key={item.value}
value={item.value}
className="focus:bg-primary focus:text-card"
>
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
<item.icon className="h-4 w-4" /> <item.icon className="h-4 w-4" />
<span>{item.label}</span> <span>{item.label}</span>

View File

@ -54,9 +54,9 @@ export function ModelInfo({ data }: { data: ModelDB[] }) {
<Badge <Badge
variant="secondary" variant="secondary"
className="bg-sentiment-positive-light text-sentiment-positive" className={`bg-sentiment-positive-light text-sentiment-positive ${currentModel.isActive ? "bg-sentiment-positive-light text-sentiment-positive" : "bg-primary/10 text-primary"}`}
> >
Active {currentModel.isActive === true ? "Active" : "Inactive"}
</Badge> </Badge>
</div> </div>

View File

@ -10,6 +10,7 @@ export interface ModelDB {
macroF1: number; macroF1: number;
f1Negative: number; f1Negative: number;
f1Neutral: number; f1Neutral: number;
isActive: boolean;
} }
export interface ProfileClientProps { export interface ProfileClientProps {