/** * Страница для просмотра задач из Jira * Данные импортируются из CSV файлов в папке "новая папка" */ 'use client'; import { useState, useEffect } from 'react'; import Sidebar from '@/components/Sidebar'; interface JiraEpic { issueId: string; summary: string; description: string; priority: string; components: string[]; labels: string[]; stories?: JiraStory[]; createdAt: string; updatedAt: string; } interface JiraStory { issueId: string; summary: string; description: string; priority: string; storyPoints?: number; components: string[]; labels: string[]; acceptanceCriteria?: string; subtasks?: JiraSubtask[]; createdAt: string; } interface JiraSubtask { issueId: string; summary: string; description: string; priority: string; components: string[]; labels: string[]; createdAt: string; } interface Dependency { fromIssueId: string; toIssueId: string; linkType: string; } export default function JiraTasksPage() { const [epics, setEpics] = useState([]); const [dependencies, setDependencies] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [selectedEpic, setSelectedEpic] = useState(null); useEffect(() => { loadTasks(); }, []); const loadTasks = async () => { try { setLoading(true); setError(null); const response = await fetch('/api/jira-tasks?type=epic'); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); setEpics(data.data || []); setDependencies(data.dependencies || []); } catch (err) { setError(err instanceof Error ? err.message : 'Ошибка загрузки задач'); console.error('Ошибка загрузки задач:', err); } finally { setLoading(false); } }; const getPriorityColor = (priority: string) => { switch (priority?.toLowerCase()) { case 'high': return '#f44336'; case 'medium': return '#ff9800'; case 'low': return '#4caf50'; default: return '#757575'; } }; const getPriorityLabel = (priority: string) => { switch (priority?.toLowerCase()) { case 'high': return 'Высокий'; case 'medium': return 'Средний'; case 'low': return 'Низкий'; default: return priority || 'Не указан'; } }; if (loading) { return (
Загрузка задач...
); } if (error) { return (
❌ Ошибка: {error}
); } return (

Задачи Jira (REFLY)

Эпики, истории и подзадачи из импортированных CSV файлов

{epics.length === 0 ? (

Нет данных. Запустите импорт:

npm run import:jira
) : (
{epics.map((epic) => (
📋 {epic.summary} {getPriorityLabel(epic.priority)} ID: {epic.issueId}
{epic.description && (

{epic.description}

)}
{epic.components && epic.components.length > 0 && (
Компоненты: {epic.components.join(', ')}
)} {epic.labels && epic.labels.length > 0 && (
Метки:{' '} {epic.labels.map((label) => ( {label} ))}
)}
{selectedEpic === epic.issueId && epic.stories && epic.stories.length > 0 && (

Истории ({epic.stories.length})

{epic.stories.map((story) => (
📝 {story.summary} {getPriorityLabel(story.priority)} {story.storyPoints && ( {story.storyPoints} SP )} ID: {story.issueId}
{story.description && (

{story.description}

)} {story.acceptanceCriteria && (
Критерии приемки:
                                    {story.acceptanceCriteria}
                                  
)}
{story.subtasks && story.subtasks.length > 0 && (
Подзадачи ({story.subtasks.length}):
    {story.subtasks.map((subtask) => (
  • {subtask.summary} ({subtask.issueId})
  • ))}
)}
))}
)}
))}
)} {dependencies.length > 0 && (

Зависимости между задачами ({dependencies.length})

{dependencies.map((dep, index) => (
{dep.fromIssueId}{dep.toIssueId} ({dep.linkType})
))}
)}
); }