fix(workflow) : couleurs par defaut par categorie + migration de correction du workflow Standard

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-05-21 09:51:27 +02:00
parent 0a5fe300eb
commit caf19c8fd7
2 changed files with 49 additions and 1 deletions

View File

@@ -95,6 +95,7 @@
<script setup lang="ts">
import type { Workflow, StatusCategory } from '~/services/dto/workflow'
import { STATUS_CATEGORY_COLOR } from '~/services/dto/workflow'
import type { TaskStatusWrite } from '~/services/dto/task-status'
import { useWorkflowService } from '~/services/workflows'
import { useTaskStatusService } from '~/services/task-statuses'
@@ -169,10 +170,20 @@ watch(() => props.modelValue, (open) => {
touched.name = false
})
watch(() => form.statuses.map(s => s.category), (cats, prev) => {
if (!prev) return
cats.forEach((cat, i) => {
const s = form.statuses[i]
if (s && cat !== prev[i] && s.color === STATUS_CATEGORY_COLOR[prev[i] as StatusCategory]) {
s.color = STATUS_CATEGORY_COLOR[cat as StatusCategory]
}
})
})
function addStatus() {
form.statuses.push({
label: '',
color: '#222783',
color: STATUS_CATEGORY_COLOR.todo,
position: form.statuses.length,
isFinal: false,
category: 'todo',

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260521094948 extends AbstractMigration
{
public function getDescription(): string
{
return 'Remet les couleurs classiques sur les statuts du workflow Standard (derive data prod).';
}
public function up(Schema $schema): void
{
$map = [
'todo' => '#222783',
'in_progress' => '#4A90D9',
'blocked' => '#C62828',
'review' => '#FF8F00',
'done' => '#26A69A',
];
foreach ($map as $category => $hex) {
$this->addSql(
"UPDATE task_status SET color = '".$hex."' WHERE category = '".$category."' AND workflow_id = (SELECT id FROM workflow WHERE name = 'Standard' ORDER BY id ASC LIMIT 1)"
);
}
}
public function down(Schema $schema): void
{
$this->throwIrreversibleMigration('Correction de couleurs non reversible.');
}
}