agregar sprint, has_impairment, tabla impairments + sync pendings KAPPA
This commit is contained in:
@@ -12,6 +12,8 @@ import type {
|
||||
KappaBusinessRule,
|
||||
KappaRequirement,
|
||||
KappaEmployee,
|
||||
KappaPending,
|
||||
KappaTypeImpediment,
|
||||
PaginatedResponse,
|
||||
} from '@/types/kappa'
|
||||
|
||||
@@ -197,6 +199,14 @@ class KappaAPI {
|
||||
async createRequirement(data: KappaRequirement): Promise<unknown> {
|
||||
return this.request<unknown>('POST', '/functionalrequirements/create/', data)
|
||||
}
|
||||
|
||||
async getPendings(huId: number, page = 1): Promise<PaginatedResponse<KappaPending>> {
|
||||
return this.request<PaginatedResponse<KappaPending>>('GET', `/pendings/?hu=${huId}&page=${page}`)
|
||||
}
|
||||
|
||||
async getTypeImpediments(): Promise<KappaTypeImpediment[]> {
|
||||
return this.request<KappaTypeImpediment[]>('GET', '/typeimpediments/')
|
||||
}
|
||||
}
|
||||
|
||||
export const kappa = new KappaAPI()
|
||||
|
||||
@@ -52,9 +52,27 @@ export interface UserStoryRecord {
|
||||
estimated_hours: number | null
|
||||
actual_hours: number | null
|
||||
assigned_to: number | null
|
||||
sprint: string | null
|
||||
has_impairment: boolean
|
||||
item_type: string | null
|
||||
hierarchy_path: string | null
|
||||
parent_code: string | null
|
||||
created_at: string | null
|
||||
}
|
||||
|
||||
export interface ImpairmentRecord {
|
||||
id: number
|
||||
hu_id: number
|
||||
responsible: string | null
|
||||
pending_activity: string | null
|
||||
pending_type: string | null
|
||||
type_impediment: boolean
|
||||
delivery_date: string | null
|
||||
status: boolean
|
||||
created_at: string | null
|
||||
updated_at: string | null
|
||||
}
|
||||
|
||||
export interface WorkItemRecord {
|
||||
id: number
|
||||
project_id: number
|
||||
@@ -236,4 +254,15 @@ export const tauriDb = {
|
||||
savePerformance(snap: PerformanceRecord): Promise<number> {
|
||||
return safeInvoke('save_performance', { snap })
|
||||
},
|
||||
|
||||
// Impairments
|
||||
getImpairments(huId: number): Promise<ImpairmentRecord[]> {
|
||||
return safeInvoke('get_impairments', { huId })
|
||||
},
|
||||
saveImpairment(imp: ImpairmentRecord): Promise<number> {
|
||||
return safeInvoke('save_impairment', { imp })
|
||||
},
|
||||
deleteImpairment(id: number): Promise<void> {
|
||||
return safeInvoke('delete_impairment', { id })
|
||||
},
|
||||
}
|
||||
|
||||
+38
-4
@@ -1,17 +1,18 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import { kappa } from '@/services/kappa-api'
|
||||
import { tauriDb, type UserStoryRecord, type EpicRecord } from '@/services/tauri-db'
|
||||
import { tauriDb, type UserStoryRecord, type EpicRecord, type ImpairmentRecord } from '@/services/tauri-db'
|
||||
import { stripHtml } from '@/services/clean-html'
|
||||
import { criteriaToJson, parseQuillList } from '@/services/clean-html'
|
||||
import { parseHierarchy, stripHierarchy, getItemType, type ItemType } from '@/services/hierarchy'
|
||||
import type { KappaUserStory, KappaLogbookEntry, KappaPlanningEntry, KappaEpicDevelopment } from '@/types/kappa'
|
||||
import type { KappaUserStory, KappaLogbookEntry, KappaPlanningEntry, KappaEpicDevelopment, KappaPending } from '@/types/kappa'
|
||||
|
||||
export interface EnrichedUserStory extends KappaUserStory {
|
||||
_itemType: ItemType
|
||||
_hierarchyPath: string | null
|
||||
_cleanTitle: string
|
||||
_criteriaList: string[]
|
||||
has_impairment: boolean
|
||||
}
|
||||
|
||||
export interface EnrichedEpic extends KappaEpicDevelopment {
|
||||
@@ -71,6 +72,7 @@ export const useWorkItemsStore = defineStore('workitems', () => {
|
||||
_hierarchyPath: h?.fullPath ?? null,
|
||||
_cleanTitle: h ? stripHierarchy(hu.title || '') : (hu.title || ''),
|
||||
_criteriaList: criteriaList,
|
||||
has_impairment: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +168,19 @@ export const useWorkItemsStore = defineStore('workitems', () => {
|
||||
console.log(`[Alpha] Syncing ${hus.length} HUs to Turso for project ${projectId}`)
|
||||
for (const hu of hus) {
|
||||
try {
|
||||
const huId = Number(hu.id) || 0
|
||||
|
||||
// Consultar impedimentos en KAPPA
|
||||
let hasImpairment = false
|
||||
let impairments: KappaPending[] = []
|
||||
try {
|
||||
const pendingResp = await kappa.getPendings(huId)
|
||||
impairments = pendingResp.results
|
||||
hasImpairment = impairments.some(p => !p.status)
|
||||
} catch {}
|
||||
|
||||
await tauriDb.saveUserStory({
|
||||
id: Number(hu.id) || 0,
|
||||
id: huId,
|
||||
initiative_id: projectId,
|
||||
epic_id: null,
|
||||
code: safeStr(hu.code),
|
||||
@@ -176,12 +189,33 @@ export const useWorkItemsStore = defineStore('workitems', () => {
|
||||
acceptance_criteria: (hu.acceptance_criteria || hu.criterios_aceptacion || null) as string | null,
|
||||
status: safeStr(hu.status),
|
||||
priority: safeStr(hu.priority),
|
||||
story_points: null,
|
||||
story_points: hu.story_points ?? null,
|
||||
estimated_hours: null,
|
||||
actual_hours: null,
|
||||
assigned_to: null,
|
||||
sprint: safeStr(hu.sprint),
|
||||
has_impairment: hasImpairment,
|
||||
item_type: null,
|
||||
hierarchy_path: null,
|
||||
parent_code: null,
|
||||
created_at: null,
|
||||
})
|
||||
|
||||
// Guardar impedimentos en Turso
|
||||
for (const p of impairments) {
|
||||
await tauriDb.saveImpairment({
|
||||
id: p.id,
|
||||
hu_id: huId,
|
||||
responsible: p.responsible || null,
|
||||
pending_activity: p.pending_activity || null,
|
||||
pending_type: p.type || null,
|
||||
type_impediment: p.type_impediment,
|
||||
delivery_date: p.delivery_date || null,
|
||||
status: p.status,
|
||||
created_at: p.created_at || null,
|
||||
updated_at: p.updated_at || null,
|
||||
}).catch(() => {})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`[Alpha] Failed to save HU ${hu.id}:`, e)
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ export interface KappaUserStory {
|
||||
status?: string
|
||||
priority?: string
|
||||
initiative: number | string
|
||||
story_points?: number
|
||||
sprint?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
@@ -151,6 +153,34 @@ export interface KappaEmployee {
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface KappaPending {
|
||||
id: number
|
||||
historia_title: string[]
|
||||
created_at: string
|
||||
updated_at: string
|
||||
responsible: string
|
||||
pending_activity: string
|
||||
delivery_date: string
|
||||
real_date: string | null
|
||||
type: string
|
||||
type_impediment: boolean
|
||||
status_pending: string | null
|
||||
status: boolean
|
||||
pending_client_type: string | null
|
||||
pending_general_client: boolean
|
||||
solution_date: string | null
|
||||
which: string
|
||||
client: string | null
|
||||
initiative: string | null
|
||||
hu: number[]
|
||||
initiatives_client: string[]
|
||||
}
|
||||
|
||||
export interface KappaTypeImpediment {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
count: number
|
||||
next: string | null
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import { useProjectsStore } from '@/stores/projects'
|
||||
import { useWorkItemsStore } from '@/stores/workitems'
|
||||
import { getTypeLabel, getTypeColor, getTypeIcon } from '@/services/hierarchy'
|
||||
import { Activity, FileText, Layers, Clock, Info } from 'lucide-vue-next'
|
||||
import { Activity, FileText, Layers, Clock, Info, AlertTriangle } from 'lucide-vue-next'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
@@ -209,6 +209,11 @@ const statusLabel = (status: unknown) => {
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell class="text-sm max-w-[280px] truncate flex items-center gap-1">
|
||||
<AlertTriangle
|
||||
v-if="hu.has_impairment"
|
||||
class="size-3.5 text-amber-500 flex-shrink-0"
|
||||
title="Tiene impedimentos pendientes"
|
||||
/>
|
||||
<span class="truncate">{{ hu._cleanTitle || hu.title }}</span>
|
||||
<span
|
||||
v-if="hu._criteriaList?.length"
|
||||
|
||||
Reference in New Issue
Block a user