@airporting/tech-app 0.0.44 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mf/9660.js +1 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/BulkActionBar.d.ts +8 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/FiltersBar.d.ts +9 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/KpiStrip.d.ts +9 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/QueueDashboard.d.ts +6 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/TasksTable.d.ts +14 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/TopErrorsCard.d.ts +8 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/jobLogsContext.d.ts +5 -0
- package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/types.d.ts +77 -0
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/config.d.ts +54 -0
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs.app.d.ts +1 -1
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/config.d.ts +41 -0
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet.app.d.ts +1 -1
- package/dist/mf/@mf-types/compiled-types/components/PageHeader.d.ts +12 -0
- package/dist/mf/@mf-types.zip +0 -0
- package/dist/mf/__federation_expose_dashboard.js +1 -1
- package/dist/mf/__federation_expose_etat_saisie.js +1 -1
- package/dist/mf/__federation_expose_finance_jobs.js +1 -1
- package/dist/mf/__federation_expose_github.js +1 -1
- package/dist/mf/__federation_expose_sobank.js +1 -1
- package/dist/mf/__federation_expose_spreadsheet.js +1 -1
- package/dist/mf/index.js +3 -3
- package/dist/mf/mf-manifest.json +14 -11
- package/dist/mf/mf-stats.json +20 -22
- package/dist/mf/tech_app.js +3 -3
- package/package.json +1 -1
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/Breakdowns.d.ts +0 -11
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/BulkActionBar.d.ts +0 -6
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/FinanceJobsApp.d.ts +0 -1
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/KpiCards.d.ts +0 -17
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/TasksFilters.d.ts +0 -19
- package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/TasksTable.d.ts +0 -31
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/Breakdowns.d.ts +0 -10
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/BulkActionBar.d.ts +0 -6
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/KpiCards.d.ts +0 -16
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/SpreadsheetApp.d.ts +0 -1
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/TasksFilters.d.ts +0 -14
- package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/TasksTable.d.ts +0 -24
- /package/dist/mf/@mf-types/compiled-types/apps/{spreadsheet → _shared/queueDashboard}/JobLogsDrawer.d.ts +0 -0
package/dist/mf/9660.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9660"],{2663:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{r:()=>QueueDashboard});var jsx_runtime=__webpack_require__(5893);var index_mjs_=__webpack_require__(207);var index_js_=__webpack_require__(3106);var PageHeader=__webpack_require__(1354);var esm_index_mjs_=__webpack_require__(1455);function BulkActionBar({selectedIds,onClear,actions}){const count=selectedIds.length;const[confirm,setConfirm]=(0,index_js_.useState)(null);const[prompt,setPrompt]=(0,index_js_.useState)(null);const[promptValue,setPromptValue]=(0,index_js_.useState)("");const[pending,setPending]=(0,index_js_.useState)(false);if(0===count)return null;const run=async(action,value)=>{setConfirm(null);setPrompt(null);setPending(true);const res=await action.run(selectedIds,value);setPending(false);onClear();esm_index_mjs_.notifications.show({title:action.label,message:`${res.ok} succeeded${res.failed?`, ${res.failed} failed`:""}`,color:res.failed?"red":"green"})};const trigger=action=>{if(action.prompt){setPromptValue("");setPrompt(action.key)}else if(action.confirm)setConfirm(action.key);else run(action)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{p:"sm",radius:"md",withBorder:true,style:{position:"sticky",bottom:16,zIndex:5,backgroundColor:"var(--mantine-color-dark-7)"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",fw:600,children:[count," selected"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"subtle",onClick:onClear,children:"Clear"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{gap:"xs",children:actions.map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:a.variant??"default",color:a.color,loading:pending,onClick:()=>trigger(a),children:a.label},a.key))})]})}),actions.filter(a=>a.confirm).map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:confirm===a.key,onClose:()=>setConfirm(null),title:a.confirm.title.replace("{count}",String(count)),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:a.confirm.body}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:a.color,onClick:()=>run(a),children:[a.label," ",count]})]})]})},a.key)),actions.filter(a=>a.prompt).map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:prompt===a.key,onClose:()=>setPrompt(null),title:`${a.label} \u{2014} ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:a.prompt.label,placeholder:a.prompt.placeholder,value:promptValue,onChange:e=>setPromptValue(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setPrompt(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:a.color,disabled:!promptValue.trim(),onClick:()=>run(a,promptValue.trim()),children:["Apply to ",count]})]})]})},a.key))]})}function FiltersBar({fields,values,onChange,stock}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{align:"flex-end",children:fields.map(field=>{if("search"===field.kind)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:field.label,placeholder:field.placeholder??"Rechercher…",value:values[field.key]??"",onChange:e=>onChange({...values,[field.key]:e.currentTarget.value}),w:field.width??220},field.key);const raw=field.options(stock);const options=raw.map(o=>"string"==typeof o?{value:o,label:o}:o);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:field.label,placeholder:field.placeholder??"All",data:options,value:values[field.key]??null,onChange:v=>onChange({...values,[field.key]:v}),searchable:true,clearable:field.clearable??true,w:field.width??220},field.key)})})}var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useJobLogs(githubJob){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","github","job-logs",githubJob],queryFn:async()=>(await api.github.getJobLogsV1({githubJob:githubJob})).data,enabled:!!githubJob,refetchOnWindowFocus:false,retry:false})}function fallbackUrl(githubJob){const parts=githubJob.split("/");if(parts.length<3)return null;const runId=parts[parts.length-1];const repo=parts[parts.length-2];const owner=parts.slice(0,-2).join("/");return`https://github.com/${owner}/${repo}/actions/runs/${runId}`}function JobLogsDrawer({githubJob,opened,onClose}){const query=useJobLogs(opened?githubJob:null);const ghLink=githubJob?fallbackUrl(githubJob):null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:opened,onClose:onClose,position:"right",size:"60%",title:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Workflow logs"}),query.data?.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===query.data.conclusion?"green":"red",children:query.data.conclusion})]}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[ghLink&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{component:"a",href:ghLink,target:"_blank",variant:"default",size:"xs",children:"Open in GitHub"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",onClick:()=>query.refetch(),children:"Refresh logs"})]}),query.isLoading&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:400}),query.isError&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Failed to load logs",children:query.error?.message??"Unknown error"}),query.data?.jobs.map((j,i)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:j.name}),j.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===j.conclusion?"green":"red",children:j.conclusion})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Code,{block:true,style:{maxHeight:400,overflow:"auto",whiteSpace:"pre"},children:j.logs||"(empty)"})]},i)),query.data&&0===query.data.jobs.length&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No jobs found."})]})})}var jobLogsContext=__webpack_require__(6845);function toneToBg(tone){switch(tone){case"bad":return"rgba(255, 99, 99, 0.12)";case"warn":return"rgba(255, 170, 80, 0.12)";case"good":return"rgba(80, 200, 120, 0.10)";default:return}}function KpiStrip({stock,isLoading,isError,tiles}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,6),children:tiles.map(t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:60},t.key))});if(isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",children:"Failed to load stock"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,6),children:tiles.map(t=>{const tone=t.tone?.(stock);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"sm",radius:"md",withBorder:true,style:{backgroundColor:toneToBg(tone),minHeight:60},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:t.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"lg",children:t.value(stock)})]},t.key)})})}function TasksTable({items,total,isLoading,columns,rowActions,selectedIds,getRowId,onToggleId,onToggleAll}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300});if(!items||0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No tasks for current filters."});const visibleIds=items.map(getRowId);const allSelected=visibleIds.every(id=>selectedIds.has(id));const someSelected=!allSelected&&visibleIds.some(id=>selectedIds.has(id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.ScrollArea,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",mb:"xs",children:[total," task(s)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:1100,verticalSpacing:"xs",highlightOnHover:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:40,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:allSelected,indeterminate:someSelected,onChange:e=>onToggleAll(visibleIds,e.currentTarget.checked),"aria-label":"Select all"})}),columns.map(col=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{style:{minWidth:col.minWidth},children:col.label},col.key)),rowActions.length>0&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Actions"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:items.map(item=>{const id=getRowId(item);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{bg:selectedIds.has(id)?"var(--mantine-color-dark-6)":void 0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:selectedIds.has(id),onChange:()=>onToggleId(id),"aria-label":`Select task ${id}`})}),columns.map(col=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:col.render(item)},col.key)),rowActions.length>0&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:rowActions.map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:a.render(item)},a.key))})]},id)})})]})]})}function normalizeSignature(message){return message.replace(/[\d]+/g,"#").replace(/['"]/g,"").replace(/\s+/g," ").trim().slice(0,140)}function TopErrorsCard({items,extract,onPick,limit=5}){const groups=(0,index_js_.useMemo)(()=>{const map=new Map;for(const item of items??[]){const raw=extract(item);if(!raw)continue;const sig=normalizeSignature(raw);map.set(sig,(map.get(sig)??0)+1)}return[...map.entries()].sort((a,b)=>b[1]-a[1]).slice(0,limit).map(([sig,count])=>({sig,count}))},[items,extract,limit]);if(0===groups.length)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"md",radius:"md",withBorder:true,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:"Top erreurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"regroup\xe9es par signature"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:6,children:groups.map(({sig,count})=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",wrap:"nowrap",style:{cursor:onPick?"pointer":"default"},onClick:()=>onPick?.(sig),children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:"red",variant:"light",children:["\xd7",count]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{flex:1},truncate:true,children:sig})]},sig))})]})}function QueueDashboard({config}){const stock=config.source.useStock();const[filters,setFilters]=(0,index_js_.useState)(config.initialFilters);const tasksQuery=config.source.useTasks(filters);const items=tasksQuery.data?.items;const[selectedIds,setSelectedIds]=(0,index_js_.useState)(new Set);const toggleId=(0,index_js_.useCallback)(id=>{setSelectedIds(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next})},[]);const toggleAll=(0,index_js_.useCallback)((ids,select)=>{setSelectedIds(prev=>{const next=new Set(prev);for(const id of ids)if(select)next.add(id);else next.delete(id);return next})},[]);const clearSelection=(0,index_js_.useCallback)(()=>setSelectedIds(new Set),[]);const searchKey=config.filters.find(f=>"search"===f.kind)?.key;const searchValue=searchKey?(filters[searchKey]??"").trim().toLowerCase():"";const filtered=(0,index_js_.useMemo)(()=>{if(!items)return;if(!searchValue||!config.searchMatches)return items;return items.filter(it=>config.searchMatches(it,searchValue))},[items,searchValue,config]);const onErrorPick=signature=>{if(!searchKey)return;setFilters({...filters,[searchKey]:signature})};return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(jobLogsContext.z,{children:(currentJob,closeJob)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:config.title,badge:config.headerBadge,updatedAt:stock.dataUpdatedAt,isFetching:stock.isFetching||tasksQuery.isFetching,isError:stock.isError,onRefresh:()=>{stock.refetch();tasksQuery.refetch()},actions:config.headerActions}),/*#__PURE__*/(0,jsx_runtime.jsx)(KpiStrip,{stock:stock.data,isLoading:stock.isLoading,isError:stock.isError,tiles:config.kpis}),config.topErrors&&/*#__PURE__*/(0,jsx_runtime.jsx)(TopErrorsCard,{items:items,extract:config.topErrors.extract,onPick:onErrorPick}),/*#__PURE__*/(0,jsx_runtime.jsx)(FiltersBar,{fields:config.filters,values:filters,onChange:setFilters,stock:stock.data}),/*#__PURE__*/(0,jsx_runtime.jsx)(TasksTable,{items:filtered,total:tasksQuery.data?.total??filtered?.length??0,isLoading:tasksQuery.isLoading,columns:config.columns,rowActions:config.rowActions,selectedIds:selectedIds,getRowId:config.getRowId,onToggleId:toggleId,onToggleAll:toggleAll}),/*#__PURE__*/(0,jsx_runtime.jsx)(BulkActionBar,{selectedIds:[...selectedIds],onClear:clearSelection,actions:config.bulkActions}),/*#__PURE__*/(0,jsx_runtime.jsx)(JobLogsDrawer,{githubJob:currentJob,opened:!!currentJob,onClose:closeJob})]})})})}},6845:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>useOpenJobLogs,z:()=>JobLogsProvider});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3106);const JobLogsContext=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(null);function useOpenJobLogs(){const ctx=(0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(JobLogsContext);if(!ctx)throw new Error("useOpenJobLogs must be used within JobLogsProvider");return ctx.open}function JobLogsProvider({children}){const[current,setCurrent]=(0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(null);return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(JobLogsContext.Provider,{value:{open:setCurrent},children:children(current,()=>setCurrent(null))})}},1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative})}),actions]})]})}}}]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BulkActionDef } from './types';
|
|
2
|
+
type Props = {
|
|
3
|
+
selectedIds: number[];
|
|
4
|
+
onClear: () => void;
|
|
5
|
+
actions: BulkActionDef[];
|
|
6
|
+
};
|
|
7
|
+
export declare function BulkActionBar({ selectedIds, onClear, actions }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterField } from './types';
|
|
2
|
+
type Props<Filters extends Record<string, unknown>> = {
|
|
3
|
+
fields: FilterField<Filters>[];
|
|
4
|
+
values: Filters;
|
|
5
|
+
onChange: (next: Filters) => void;
|
|
6
|
+
stock: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare function FiltersBar<F extends Record<string, unknown>>({ fields, values, onChange, stock, }: Props<F>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KpiTile } from './types';
|
|
2
|
+
type Props<Stock> = {
|
|
3
|
+
stock: Stock | undefined;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
tiles: KpiTile<Stock>[];
|
|
7
|
+
};
|
|
8
|
+
export declare function KpiStrip<S>({ stock, isLoading, isError, tiles }: Props<S>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QueueDashboardConfig } from './types';
|
|
2
|
+
type Props<Item, Stock, Filters extends Record<string, unknown>> = {
|
|
3
|
+
config: QueueDashboardConfig<Item, Stock, Filters>;
|
|
4
|
+
};
|
|
5
|
+
export declare function QueueDashboard<I, S, F extends Record<string, unknown>>({ config, }: Props<I, S, F>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnDef, RowActionDef } from './types';
|
|
2
|
+
type Props<Item> = {
|
|
3
|
+
items: Item[] | undefined;
|
|
4
|
+
total: number;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
columns: ColumnDef<Item>[];
|
|
7
|
+
rowActions: RowActionDef<Item>[];
|
|
8
|
+
selectedIds: Set<number>;
|
|
9
|
+
getRowId: (item: Item) => number;
|
|
10
|
+
onToggleId: (id: number) => void;
|
|
11
|
+
onToggleAll: (ids: number[], select: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function TasksTable<I>({ items, total, isLoading, columns, rowActions, selectedIds, getRowId, onToggleId, onToggleAll, }: Props<I>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props<Item> = {
|
|
2
|
+
items: Item[] | undefined;
|
|
3
|
+
extract: (item: Item) => string | null;
|
|
4
|
+
onPick?: (signature: string) => void;
|
|
5
|
+
limit?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function TopErrorsCard<I>({ items, extract, onPick, limit, }: Props<I>): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare function useOpenJobLogs(): (githubJob: string) => void;
|
|
3
|
+
export declare function JobLogsProvider({ children, }: {
|
|
4
|
+
children: (current: string | null, close: () => void) => ReactNode;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type KpiTile<Stock> = {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: (s: Stock | undefined) => string | number;
|
|
7
|
+
tone?: (s: Stock | undefined) => 'neutral' | 'good' | 'warn' | 'bad';
|
|
8
|
+
};
|
|
9
|
+
export type FilterField<Filters = Record<string, unknown>> = {
|
|
10
|
+
kind: 'select';
|
|
11
|
+
key: keyof Filters & string;
|
|
12
|
+
label: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
options: (stock: unknown) => Array<string | {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}>;
|
|
18
|
+
width?: number;
|
|
19
|
+
clearable?: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'search';
|
|
22
|
+
key: keyof Filters & string;
|
|
23
|
+
label: string;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
width?: number;
|
|
26
|
+
};
|
|
27
|
+
export type ColumnDef<Item> = {
|
|
28
|
+
key: string;
|
|
29
|
+
label: string;
|
|
30
|
+
render: (item: Item) => ReactNode;
|
|
31
|
+
minWidth?: number;
|
|
32
|
+
};
|
|
33
|
+
export type RowActionDef<Item> = {
|
|
34
|
+
key: string;
|
|
35
|
+
render: (item: Item) => ReactNode;
|
|
36
|
+
};
|
|
37
|
+
export type BulkActionDef = {
|
|
38
|
+
key: string;
|
|
39
|
+
label: string;
|
|
40
|
+
color?: string;
|
|
41
|
+
variant?: 'default' | 'filled' | 'subtle';
|
|
42
|
+
confirm?: {
|
|
43
|
+
title: string;
|
|
44
|
+
body: ReactNode;
|
|
45
|
+
};
|
|
46
|
+
prompt?: {
|
|
47
|
+
label: string;
|
|
48
|
+
placeholder: string;
|
|
49
|
+
};
|
|
50
|
+
run: (ids: number[], promptValue?: string) => Promise<{
|
|
51
|
+
ok: number;
|
|
52
|
+
failed: number;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
export type QueueDashboardConfig<Item, Stock, Filters extends Record<string, unknown>> = {
|
|
56
|
+
title: string;
|
|
57
|
+
source: {
|
|
58
|
+
useStock: () => UseQueryResult<Stock>;
|
|
59
|
+
useTasks: (filters: Filters) => UseQueryResult<{
|
|
60
|
+
items: Item[];
|
|
61
|
+
total: number;
|
|
62
|
+
}>;
|
|
63
|
+
};
|
|
64
|
+
initialFilters: Filters;
|
|
65
|
+
kpis: KpiTile<Stock>[];
|
|
66
|
+
filters: FilterField<Filters>[];
|
|
67
|
+
columns: ColumnDef<Item>[];
|
|
68
|
+
rowActions: RowActionDef<Item>[];
|
|
69
|
+
bulkActions: BulkActionDef[];
|
|
70
|
+
topErrors?: {
|
|
71
|
+
extract: (item: Item) => string | null;
|
|
72
|
+
};
|
|
73
|
+
headerBadge?: ReactNode;
|
|
74
|
+
headerActions?: ReactNode;
|
|
75
|
+
getRowId: (item: Item) => number;
|
|
76
|
+
searchMatches?: (item: Item, query: string) => boolean;
|
|
77
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { QueueDashboardConfig } from '@/src/apps/_shared/queueDashboard/types';
|
|
2
|
+
import { TaskState } from './types';
|
|
3
|
+
type FinanceItem = {
|
|
4
|
+
id: number;
|
|
5
|
+
job_name: string;
|
|
6
|
+
job_name_fr: string | null;
|
|
7
|
+
company_id: number;
|
|
8
|
+
company_slug: string | null;
|
|
9
|
+
company_display_name: string | null;
|
|
10
|
+
owner: string;
|
|
11
|
+
beta: boolean;
|
|
12
|
+
state: TaskState;
|
|
13
|
+
error: string | null;
|
|
14
|
+
trace_count: number | null;
|
|
15
|
+
trace_label: string | null;
|
|
16
|
+
runDuration: number | null;
|
|
17
|
+
created: string;
|
|
18
|
+
startedAt: string | null;
|
|
19
|
+
finishedAt: string | null;
|
|
20
|
+
github_job: string | null;
|
|
21
|
+
};
|
|
22
|
+
type FinanceStock = {
|
|
23
|
+
pending: number;
|
|
24
|
+
running: number;
|
|
25
|
+
stuck: number;
|
|
26
|
+
errored: number;
|
|
27
|
+
done_today: number;
|
|
28
|
+
oldest: {
|
|
29
|
+
created: string;
|
|
30
|
+
ageHours: number;
|
|
31
|
+
} | null;
|
|
32
|
+
byJobName: Array<{
|
|
33
|
+
key: string;
|
|
34
|
+
count: number;
|
|
35
|
+
}>;
|
|
36
|
+
byOwner: Array<{
|
|
37
|
+
key: string;
|
|
38
|
+
count: number;
|
|
39
|
+
}>;
|
|
40
|
+
byCompany: Array<{
|
|
41
|
+
key: string;
|
|
42
|
+
count: number;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
type FinanceFilters = {
|
|
46
|
+
job_name: string | null;
|
|
47
|
+
owner: string | null;
|
|
48
|
+
company_slug: string | null;
|
|
49
|
+
state: TaskState | 'all';
|
|
50
|
+
beta: 'true' | 'false' | 'all';
|
|
51
|
+
search: string;
|
|
52
|
+
};
|
|
53
|
+
export declare function useFinanceJobsConfig(): QueueDashboardConfig<FinanceItem, FinanceStock, FinanceFilters>;
|
|
54
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function FinanceJobsApp(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { QueueDashboardConfig } from '@/src/apps/_shared/queueDashboard/types';
|
|
2
|
+
import { TaskState } from './types';
|
|
3
|
+
type GsheetItem = {
|
|
4
|
+
id: number;
|
|
5
|
+
service: string;
|
|
6
|
+
spreadsheet: string;
|
|
7
|
+
worksheet: string | null;
|
|
8
|
+
owner: string | null;
|
|
9
|
+
state: TaskState;
|
|
10
|
+
created: string;
|
|
11
|
+
started: string | null;
|
|
12
|
+
github_job: string | null;
|
|
13
|
+
trace_id: string | null;
|
|
14
|
+
};
|
|
15
|
+
type GsheetStock = {
|
|
16
|
+
pending: number;
|
|
17
|
+
running: number;
|
|
18
|
+
stuck: number;
|
|
19
|
+
errored: number;
|
|
20
|
+
done_today: number;
|
|
21
|
+
oldest: {
|
|
22
|
+
created: string;
|
|
23
|
+
ageHours: number;
|
|
24
|
+
} | null;
|
|
25
|
+
byService: Array<{
|
|
26
|
+
key: string;
|
|
27
|
+
count: number;
|
|
28
|
+
}>;
|
|
29
|
+
byOwner: Array<{
|
|
30
|
+
key: string;
|
|
31
|
+
count: number;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
type GsheetFilters = {
|
|
35
|
+
service: string | null;
|
|
36
|
+
owner: string | null;
|
|
37
|
+
state: TaskState | 'all';
|
|
38
|
+
search: string;
|
|
39
|
+
};
|
|
40
|
+
export declare function useGsheetConfig(): QueueDashboardConfig<GsheetItem, GsheetStock, GsheetFilters>;
|
|
41
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function SpreadsheetApp(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
title: string;
|
|
4
|
+
badge?: ReactNode;
|
|
5
|
+
updatedAt?: number;
|
|
6
|
+
isFetching?: boolean;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
onRefresh?: () => void;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function PageHeader({ title, badge, updatedAt, isFetching, isError, onRefresh, actions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
package/dist/mf/@mf-types.zip
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9777"],{5068:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>IconGithub});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);function IconGithub({color="currentColor",size=20,marker,...props}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 0.297C5.373 0.297 0 5.67 0 12.297c0 5.292 3.438 9.787 8.205 11.387.6.111.82-.261.82-.58 0-.287-.011-1.244-.016-2.255-3.338.726-4.042-1.609-4.042-1.609-.546-1.389-1.333-1.759-1.333-1.759-1.089-.745.083-.73.083-.73 1.205.085 1.84 1.236 1.84 1.236 1.07 1.834 2.807 1.304 3.492.997.107-.775.419-1.305.762-1.605-2.665-.304-5.466-1.332-5.466-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.536-1.524.116-3.176 0 0 1.008-.322 3.301 1.23a11.51 11.51 0 0 1 3.004-.404 c1.019.005 2.047.138 3.004.404 2.291-1.552 3.297-1.23 3.297-1.23.655 1.652.243 2.873.119 3.176.77.84 1.235 1.91 1.235 3.221 0 4.61-2.805 5.624-5.476 5.921.43.372.823 1.104.823 2.223 0 1.606-.015 2.896-.015 3.293 0 .321.216.697.825.578C20.565 22.08 24 17.585 24 12.297 24 5.67 18.627.297 12 .297z"})})}},2086:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{p:()=>formatDate});const formatDate=ts=>new Date(ts).toLocaleString("fr-FR",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false})},884:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Dashboard});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useDashboardQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","dashboard"],queryFn:async()=>await api.getDashboard().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var formatDate=__webpack_require__(2086);function App(){const dashboardResult=useDashboardQuery();const dashboard=dashboardResult.data;if(!dashboard)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Chargement..."})});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:"lighter",fz:"sm",my:"md",span:true,c:"dimmed",children:["Derni\xe8re mise \xe0 jour :"," ",(0,formatDate.p)(dashboardResult?.dataUpdatedAt??Date.now())]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:2,my:"md",ml:dashboard.amex.globalProblem?-30:0,children:[dashboard.amex.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Amex"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Purchase"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.purchaseProblem?"red":"green",children:[dashboard.amex.purchaseTodayBalances," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"cash balances"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.purchasePendingTransactions,"/",dashboard.amex.purchaseTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"})]})]})})},"amex_purchase")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Merchant"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.merchantProblem?"red":"green",children:[dashboard.amex.merchantPendingTransactions,"/",dashboard.amex.merchantTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingChargebacks,"/",dashboard.amex.merchantTodayChargesbacks," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"remboursements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingAdjustments,"/",dashboard.amex.merchantTodayAdjustments," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"ajustements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{})]})]})})},"payfit_waiting_load")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:2,my:"md",ml:dashboard.gsheet.globalProblem?-30:0,children:[dashboard.gsheet.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Gsheet"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches non termin\xe9es"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.gsheet.pending>50?"red":dashboard.gsheet.pending>30?"orange":"green",children:[dashboard.gsheet.pending," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{span:true,c:"dimmed",children:["Le plus ancien date du :"," "]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:"bold",c:dashboard.gsheet.isPendingTooOld?"red":"green",children:dashboard.gsheet.oldest})]})]},"payfit_wainting_load")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches en cours"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.gsheet.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/gsheet_runner/actions",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"payfit_wainting_load")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:2,my:"md",children:["Notion",/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://www.notion.so/airporting/Bug-report-5686f21b8154456f8b82629fb36e0859",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ScrollArea,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:800,verticalSpacing:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Membre"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Not started"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"In progress"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"To be reviewed"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.notion.bugs?.map((bug,i)=>{const[assignee,avatar,notStarted,inProgress,toBeReviewed]=bug;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{size:26,src:avatar,radius:26}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:assignee})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+notStarted?"red":void 0,children:notStarted}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+inProgress?"orange":void 0,children:inProgress}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+toBeReviewed?"green":void 0,children:toBeReviewed})]},i)})})]})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Payfit"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports du jour"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.today.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.today.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]},"payfit_wainting_load")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports en attente"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.pending.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.pending.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/payfit-scraper/actions/workflows/scrap.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"payfit_wainting_load")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Cookie"})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",mt:"md",children:["Dernier refresh \xe0"," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,span:true,c:dashboard.pennylane.isTooOld?"red":"green",children:dashboard.pennylane.lastTime})]})]},"payfit_wainting_load")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:"green",children:[dashboard.synchro.askedToday," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"aujourd'hui"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,c:"red",children:dashboard.synchro.errorsToday})," ","en erreur (~",((dashboard.synchro.errorsToday??0)*100/(dashboard.synchro.askedToday??1)).toFixed(2),"%)"]})]},"payfit_wainting_load")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Actuellement"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.synchro.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"en cours"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,children:dashboard.synchro.waiting})," ","en attente"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/jobs_recipes_runner/actions/workflows/run-recipe.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})]},"payfit_wainting_load")})]})]})}var providers=__webpack_require__(7034);function Dashboard(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})})})}}}]);
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9777"],{5068:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>IconGithub});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);function IconGithub({color="currentColor",size=20,marker,...props}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 0.297C5.373 0.297 0 5.67 0 12.297c0 5.292 3.438 9.787 8.205 11.387.6.111.82-.261.82-.58 0-.287-.011-1.244-.016-2.255-3.338.726-4.042-1.609-4.042-1.609-.546-1.389-1.333-1.759-1.333-1.759-1.089-.745.083-.73.083-.73 1.205.085 1.84 1.236 1.84 1.236 1.07 1.834 2.807 1.304 3.492.997.107-.775.419-1.305.762-1.605-2.665-.304-5.466-1.332-5.466-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.536-1.524.116-3.176 0 0 1.008-.322 3.301 1.23a11.51 11.51 0 0 1 3.004-.404 c1.019.005 2.047.138 3.004.404 2.291-1.552 3.297-1.23 3.297-1.23.655 1.652.243 2.873.119 3.176.77.84 1.235 1.91 1.235 3.221 0 4.61-2.805 5.624-5.476 5.921.43.372.823 1.104.823 2.223 0 1.606-.015 2.896-.015 3.293 0 .321.216.697.825.578C20.565 22.08 24 17.585 24 12.297 24 5.67 18.627.297 12 .297z"})})}},1999:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Dashboard});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useDashboardQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","dashboard"],queryFn:async()=>await api.getDashboard().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);const formatDate=ts=>new Date(ts).toLocaleString("fr-FR",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:false});function App(){const dashboardResult=useDashboardQuery();const dashboard=dashboardResult.data;if(!dashboard)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Chargement..."})});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:"lighter",fz:"sm",my:"md",span:true,c:"dimmed",children:["Derni\xe8re mise \xe0 jour :"," ",formatDate(dashboardResult?.dataUpdatedAt??Date.now())]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:2,my:"md",ml:dashboard.amex.globalProblem?-30:0,children:[dashboard.amex.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Amex"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Purchase"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.purchaseProblem?"red":"green",children:[dashboard.amex.purchaseTodayBalances," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"cash balances"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.purchasePendingTransactions,"/",dashboard.amex.purchaseTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"})]})]})})},"amex_purchase")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Merchant"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.merchantProblem?"red":"green",children:[dashboard.amex.merchantPendingTransactions,"/",dashboard.amex.merchantTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingChargebacks,"/",dashboard.amex.merchantTodayChargesbacks," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"remboursements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingAdjustments,"/",dashboard.amex.merchantTodayAdjustments," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"ajustements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{})]})]})})},"payfit_waiting_load")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:2,my:"md",ml:dashboard.gsheet.globalProblem?-30:0,children:[dashboard.gsheet.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Gsheet"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches non termin\xe9es"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.gsheet.pending>50?"red":dashboard.gsheet.pending>30?"orange":"green",children:[dashboard.gsheet.pending," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{span:true,c:"dimmed",children:["Le plus ancien date du :"," "]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:"bold",c:dashboard.gsheet.isPendingTooOld?"red":"green",children:dashboard.gsheet.oldest})]})]},"payfit_wainting_load")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches en cours"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.gsheet.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/gsheet_runner/actions",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"payfit_wainting_load")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:2,my:"md",children:["Notion",/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://www.notion.so/airporting/Bug-report-5686f21b8154456f8b82629fb36e0859",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ScrollArea,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:800,verticalSpacing:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Membre"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Not started"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"In progress"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"To be reviewed"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.notion.bugs?.map((bug,i)=>{const[assignee,avatar,notStarted,inProgress,toBeReviewed]=bug;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{size:26,src:avatar,radius:26}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:assignee})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+notStarted?"red":void 0,children:notStarted}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+inProgress?"orange":void 0,children:inProgress}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+toBeReviewed?"green":void 0,children:toBeReviewed})]},i)})})]})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Payfit"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports du jour"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.today.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.today.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]},"payfit_wainting_load")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports en attente"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.pending.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.pending.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/payfit-scraper/actions/workflows/scrap.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"payfit_wainting_load")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Cookie"})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",mt:"md",children:["Dernier refresh \xe0"," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,span:true,c:dashboard.pennylane.isTooOld?"red":"green",children:dashboard.pennylane.lastTime})]})]},"payfit_wainting_load")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:"green",children:[dashboard.synchro.askedToday," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"aujourd'hui"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,c:"red",children:dashboard.synchro.errorsToday})," ","en erreur (~",((dashboard.synchro.errorsToday??0)*100/(dashboard.synchro.askedToday??1)).toFixed(2),"%)"]})]},"payfit_wainting_load")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Actuellement"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.synchro.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"en cours"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,children:dashboard.synchro.waiting})," ","en attente"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/jobs_recipes_runner/actions/workflows/run-recipe.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})]},"payfit_wainting_load")})]})]})}var providers=__webpack_require__(7034);function Dashboard(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})})})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7915"],{7497:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>EtatSaisie});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useEtatSaisieLatest(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","latest"],queryFn:async()=>(await api.etatSaisie.getLatestV1()).data,refetchOnWindowFocus:true})}function useEtatSaisieRecompute(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.etatSaisie.recomputeV1()).data,onSuccess:()=>qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})})}function DetailTable(props){const{columns,rows}=props;const[sortKey,setSortKey]=(0,index_js_.useState)(null);const[asc,setAsc]=(0,index_js_.useState)(false);const sorted=[...rows].sort((a,b)=>{if(!sortKey)return 0;const av=a[sortKey];const bv=b[sortKey];if("number"==typeof av&&"number"==typeof bv)return asc?av-bv:bv-av;return asc?String(av).localeCompare(String(bv)):String(bv).localeCompare(String(av))});const toggle=k=>{if(sortKey===k)setAsc(v=>!v);else{setSortKey(k);setAsc(false)}};const fmt=(v,numeric)=>{if(numeric&&"number"==typeof v)return v.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2});if("boolean"==typeof v)return v?"✓":"";return null==v?"—":String(v)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{onClick:()=>toggle(c.key),style:{cursor:"pointer"},children:[c.label,sortKey===c.key?asc?" ▲":" ▼":""]},c.key))})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===sorted.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:columns.length,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucune ligne"})})}):sorted.map((row,i)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:fmt(row[c.key],c.numeric)},c.key))},i))})]})}function parisDate(iso){if(!iso)return"—";return new Date(iso).toLocaleString("fr-FR",{timeZone:"Europe/Paris"})}function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const d=latest.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,children:"Etat saisie"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["Derni\xe8re mise \xe0 jour : ",parisDate(d?.computed_at??null)]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:recompute.isPending,onClick:()=>recompute.mutate(),variant:"light",children:"Recalculer"})]})]}),d&&!d.available?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun snapshot disponible — lancez \xab Recalculer \xbb ou attendez le run nocturne."}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs,{value:tab,onChange:setTab,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.List,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"resume",children:"R\xe9sum\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s471",children:"D\xe9tail 471"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s401",children:"Fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s411",children:"Clients cr\xe9diteurs (411)"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Scann\xe9s"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",children:d?.summary?.companies_scanned??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Propres"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"green",children:d?.summary?.companies_clean??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En anomalie"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"orange",children:d?.summary?.companies_with_anomalies??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En erreur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"red",children:d?.summary?.companies_in_error??0})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 comptes d'attente (471)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUSPENSE_COLS,rows:d?.summary?.top_5_suspense??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUPPLIER_COLS,rows:d?.summary?.top_5_supplier_debtors??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_CUSTOMER_COLS,rows:d?.summary?.top_5_customer_creditors??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers \xe0 relancer (no_data)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:d?.no_data??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers non manag\xe9s (hors agr\xe9gats)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:d?.not_managed??[]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:d?.suspense_rows??[]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:d?.supplier_rows??[]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:d?.customer_rows??[]})})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"solde_eur",label:"Solde 471 (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"top_libelle",label:"Top \xe9criture"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_SUPPLIER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total d\xe9biteur (€)",numeric:true},{key:"nb_fournisseurs",label:"Nb fourn.",numeric:true},{key:"top_nom",label:"Top fournisseur"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_CUSTOMER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total cr\xe9diteur (€)",numeric:true},{key:"nb_clients",label:"Nb clients",numeric:true},{key:"top_nom",label:"Top client"},{key:"top_montant",label:"Montant",numeric:true}];const DOSSIER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"status",label:"Statut"},{key:"solde_attente_eur",label:"Solde attente (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Total fourn. (€)",numeric:true},{key:"total_clients_eur",label:"Total clients (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture"}];const SUSPENSE_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_compte",label:"Libell\xe9 compte"},{key:"libelle_ecriture",label:"Libell\xe9 \xe9criture"},{key:"journal",label:"Journal"},{key:"numero_piece",label:"N\xb0 Pi\xe8ce"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"},{key:"devise",label:"Devise"}];const SUPPLIER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const CUSTOMER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];function EtatSaisie(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(EtatSaisieApp,{})})})}}}]);
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7915"],{1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative})}),actions]})]})}},7497:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>EtatSaisie});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useEtatSaisieLatest(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","latest"],queryFn:async()=>(await api.etatSaisie.getLatestV1()).data,refetchOnWindowFocus:true})}function useEtatSaisieRecompute(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.etatSaisie.recomputeV1()).data,onSuccess:()=>qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})})}function DetailTable(props){const{columns,rows}=props;const[sortKey,setSortKey]=(0,index_js_.useState)(null);const[asc,setAsc]=(0,index_js_.useState)(false);const sorted=[...rows].sort((a,b)=>{if(!sortKey)return 0;const av=a[sortKey];const bv=b[sortKey];if("number"==typeof av&&"number"==typeof bv)return asc?av-bv:bv-av;return asc?String(av).localeCompare(String(bv)):String(bv).localeCompare(String(av))});const toggle=k=>{if(sortKey===k)setAsc(v=>!v);else{setSortKey(k);setAsc(false)}};const fmt=(v,numeric)=>{if(numeric&&"number"==typeof v)return v.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2});if("boolean"==typeof v)return v?"✓":"";return null==v?"—":String(v)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{onClick:()=>toggle(c.key),style:{cursor:"pointer"},children:[c.label,sortKey===c.key?asc?" ▲":" ▼":""]},c.key))})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===sorted.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:columns.length,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucune ligne"})})}):sorted.map((row,i)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:fmt(row[c.key],c.numeric)},c.key))},i))})]})}var PageHeader=__webpack_require__(1354);function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const d=latest.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"\xc9tat saisie",updatedAt:d?.computed_at?new Date(d.computed_at).getTime():latest.dataUpdatedAt,isFetching:latest.isFetching,isError:latest.isError,onRefresh:()=>latest.refetch(),actions:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:recompute.isPending,onClick:()=>recompute.mutate(),variant:"light",children:"Recalculer"})}),d&&!d.available?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun snapshot disponible — lancez \xab Recalculer \xbb ou attendez le run nocturne."}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs,{value:tab,onChange:setTab,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.List,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"resume",children:"R\xe9sum\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s471",children:"D\xe9tail 471"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s401",children:"Fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s411",children:"Clients cr\xe9diteurs (411)"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Scann\xe9s"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",children:d?.summary?.companies_scanned??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Propres"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"green",children:d?.summary?.companies_clean??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En anomalie"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"orange",children:d?.summary?.companies_with_anomalies??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En erreur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"red",children:d?.summary?.companies_in_error??0})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 comptes d'attente (471)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUSPENSE_COLS,rows:d?.summary?.top_5_suspense??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUPPLIER_COLS,rows:d?.summary?.top_5_supplier_debtors??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_CUSTOMER_COLS,rows:d?.summary?.top_5_customer_creditors??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers \xe0 relancer (no_data)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:d?.no_data??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers non manag\xe9s (hors agr\xe9gats)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:d?.not_managed??[]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:d?.suspense_rows??[]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:d?.supplier_rows??[]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:d?.customer_rows??[]})})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"solde_eur",label:"Solde 471 (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"top_libelle",label:"Top \xe9criture"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_SUPPLIER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total d\xe9biteur (€)",numeric:true},{key:"nb_fournisseurs",label:"Nb fourn.",numeric:true},{key:"top_nom",label:"Top fournisseur"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_CUSTOMER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total cr\xe9diteur (€)",numeric:true},{key:"nb_clients",label:"Nb clients",numeric:true},{key:"top_nom",label:"Top client"},{key:"top_montant",label:"Montant",numeric:true}];const DOSSIER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"status",label:"Statut"},{key:"solde_attente_eur",label:"Solde attente (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Total fourn. (€)",numeric:true},{key:"total_clients_eur",label:"Total clients (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture"}];const SUSPENSE_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_compte",label:"Libell\xe9 compte"},{key:"libelle_ecriture",label:"Libell\xe9 \xe9criture"},{key:"journal",label:"Journal"},{key:"numero_piece",label:"N\xb0 Pi\xe8ce"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"},{key:"devise",label:"Devise"}];const SUPPLIER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const CUSTOMER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];function EtatSaisie(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(EtatSaisieApp,{})})})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7825"],{620:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{o:()=>JobLogsDrawer});var jsx_runtime=__webpack_require__(5893);var index_mjs_=__webpack_require__(207);var index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useJobLogs(githubJob){const api=(0,useApi.h)();return(0,index_js_.useQuery)({queryKey:["tech","github","job-logs",githubJob],queryFn:async()=>(await api.github.getJobLogsV1({githubJob:githubJob})).data,enabled:!!githubJob,refetchOnWindowFocus:false,retry:false})}function fallbackUrl(githubJob){const parts=githubJob.split("/");if(parts.length<3)return null;const runId=parts[parts.length-1];const repo=parts[parts.length-2];const owner=parts.slice(0,-2).join("/");return`https://github.com/${owner}/${repo}/actions/runs/${runId}`}function JobLogsDrawer({githubJob,opened,onClose}){const query=useJobLogs(opened?githubJob:null);const ghLink=githubJob?fallbackUrl(githubJob):null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:opened,onClose:onClose,position:"right",size:"60%",title:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Workflow logs"}),query.data?.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===query.data.conclusion?"green":"red",children:query.data.conclusion})]}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[ghLink&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{component:"a",href:ghLink,target:"_blank",variant:"default",size:"xs",children:"Open in GitHub"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",onClick:()=>query.refetch(),children:"Refresh logs"})]}),query.isLoading&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:400}),query.isError&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Failed to load logs",children:query.error?.message??"Unknown error"}),query.data?.jobs.map((j,i)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:j.name}),j.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===j.conclusion?"green":"red",children:j.conclusion})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Code,{block:true,style:{maxHeight:400,overflow:"auto",whiteSpace:"pre"},children:j.logs||"(empty)"})]},i)),query.data&&0===query.data.jobs.length&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No jobs found."})]})})}},7208:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>FinanceJobs});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useFinanceJobsStock(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","finance-jobs","stock"],queryFn:async()=>(await api.financeJobs.getStockV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}function useFinanceJobsTasks(filters){const api=(0,useApi.h)();const query={...filters.job_name&&{job_name:filters.job_name},...filters.owner&&{owner:filters.owner},...filters.company_slug&&{company_slug:filters.company_slug},...filters.state&&{state:filters.state},...filters.beta&&{beta:filters.beta},...void 0!==filters.take&&{take:String(filters.take)},...void 0!==filters.skip&&{skip:String(filters.skip)}};return(0,modern_index_js_.useQuery)({queryKey:["tech","finance-jobs","tasks",filters],queryFn:async()=>(await api.financeJobs.listTasksV1(query)).data,refetchOnWindowFocus:false})}var JobLogsDrawer=__webpack_require__(620);function Tile({label,value,color}){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"md",radius:"md",withBorder:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,c:color,children:value})]})}function KpiCards({stock,isLoading,isError}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:6,children:[0,1,2,3,4,5].map(i=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:88},i))});if(isError||!stock)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",children:"Failed to load stock"})});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:6,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{label:"Pending",value:stock.pending}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{label:"Running",value:stock.running,color:"blue"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{label:"Stuck",value:stock.stuck,color:"orange"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{label:"Errored",value:stock.errored,color:"red"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{label:"Done today",value:stock.done_today,color:"green"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tile,{label:"Oldest pending",value:stock.oldest?`${stock.oldest.ageHours}h`:"—"})]})}var esm_index_mjs_=__webpack_require__(7183);function Panel({title,data,limit=12}){const sliced=data.slice(0,limit);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"md",radius:"md",withBorder:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mb:"sm",children:title}),0===sliced.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No data"}):/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:220,data:sliced.map(d=>({name:d.key,count:d.count})),dataKey:"name",series:[{name:"count",color:"teal.6"}],withTooltip:true})]})}function Breakdowns({byJobName,byOwner,byCompany}){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Panel,{title:"By job",data:byJobName??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Panel,{title:"By owner",data:byOwner??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Panel,{title:"By company",data:byCompany??[]})]})}const STATES=["pending","running","stuck","errored","done","all"];const BETA_OPTIONS=[{value:"false",label:"Prod"},{value:"true",label:"Beta"},{value:"all",label:"All"}];function TasksFilters({jobName,owner,company,state,beta,jobNames,owners,companies,onJobName,onOwner,onCompany,onState,onBeta,onRefresh}){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Job",placeholder:"All",data:jobNames,value:jobName,onChange:onJobName,searchable:true,clearable:true,w:240}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Owner",placeholder:"All",data:owners,value:owner,onChange:onOwner,searchable:true,clearable:true,w:240}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Company",placeholder:"All",data:companies,value:company,onChange:onCompany,searchable:true,clearable:true,w:220}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"State",data:STATES.map(s=>({value:s,label:s})),value:state,onChange:v=>onState(v??"pending"),w:140}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Beta",data:BETA_OPTIONS,value:beta,onChange:v=>onBeta(v??"false"),w:120}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",onClick:onRefresh,"aria-label":"Refresh",mt:22,children:"↻"})]})}const STATE_COLORS={pending:"gray",running:"blue",stuck:"orange",errored:"red",done:"green"};const STATE_LABELS={pending:"Pending",running:"Running",stuck:"Stuck",errored:"Errored",done:"Done"};var tabler_icons_react_mjs_=__webpack_require__(9632);var notifications_esm_index_mjs_=__webpack_require__(1455);function useInvalidate(){const queryClient=(0,modern_index_js_.useQueryClient)();return()=>queryClient.invalidateQueries({queryKey:["tech","finance-jobs"]})}function useUnstickFinanceTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.unstickV1({id:String(id)})).data,onSuccess:invalidate})}function useRetryFinanceTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.retryV1({id:String(id)})).data,onSuccess:invalidate})}function useDiscardFinanceTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.discardV1({id:String(id)})).data,onSuccess:invalidate})}function useSetFinanceTaskOwner(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async({id,owner})=>(await api.financeJobs.setOwnerV1({id:String(id)},{owner})).data,onSuccess:invalidate})}function useDeleteFinanceRedisLock(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.deleteRedisLockV1({id:String(id)})).data,onSuccess:invalidate})}function notify(title,message,color){notifications_esm_index_mjs_.notifications.show({title,message,color})}function RowActions({taskId,jobName,companyLabel,currentOwner,githubJob,onShowLogs}){const[confirm,setConfirm]=(0,index_js_.useState)(null);const[ownerModalOpen,setOwnerModalOpen]=(0,index_js_.useState)(false);const[ownerInput,setOwnerInput]=(0,index_js_.useState)(currentOwner??"");const unstick=useUnstickFinanceTask();const retry=useRetryFinanceTask();const discard=useDiscardFinanceTask();const setOwner=useSetFinanceTaskOwner();const deleteLock=useDeleteFinanceRedisLock();const runUnstick=()=>unstick.mutate(taskId,{onSuccess:()=>notify("Unstuck",`Task #${taskId} reset`,"green"),onError:e=>notify("Failed",e?.message??"Unstick failed","red")});const runRetry=()=>{setConfirm(null);retry.mutate(taskId,{onSuccess:()=>notify("Retry queued",`Task #${taskId} will rerun`,"green"),onError:e=>notify("Failed",e?.message??"Retry failed","red")})};const runDiscard=()=>{setConfirm(null);discard.mutate(taskId,{onSuccess:()=>notify("Discarded",`Task #${taskId} marked done`,"green"),onError:e=>notify("Failed",e?.message??"Discard failed","red")})};const runSetOwner=()=>{setOwnerModalOpen(false);setOwner.mutate({id:taskId,owner:ownerInput},{onSuccess:()=>notify("Owner updated",`Task #${taskId} \u{2192} ${ownerInput}`,"green"),onError:e=>notify("Failed",e?.message??"Set owner failed","red")})};const runDeleteLock=()=>{setConfirm(null);deleteLock.mutate(taskId,{onSuccess:data=>notify("Redis lock",data.existed?`Deleted ${data.key}`:`No lock found (${data.key})`,"green"),onError:e=>notify("Failed",e?.message??"Redis delete failed","red")})};return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[githubJob&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Voir les logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",onClick:()=>onShowLogs(githubJob),"aria-label":"Voir les logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTerminal,{size:16})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu,{position:"bottom-end",withArrow:true,shadow:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Target,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default","aria-label":"Actions",children:"⋮"})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu.Dropdown,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:runUnstick,children:"Unstick"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>setConfirm("retry"),children:"Retry"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>{setOwnerInput(currentOwner??"");setOwnerModalOpen(true)},children:"Set owner…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>setConfirm("redis"),children:"Delete Redis lock"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{color:"red",onClick:()=>setConfirm("discard"),children:"Discard"})]})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"retry"===confirm,onClose:()=>setConfirm(null),title:"Retry task",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Reset task #",taskId," (",jobName," — ",companyLabel,") so the runner picks it up again. This clears ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"finished"}),","," ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"startedAt"}),", ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"error"})," and the Redis lock."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:runRetry,loading:retry.isPending,children:"Retry"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"discard"===confirm,onClose:()=>setConfirm(null),title:"Discard task",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Mark task #",taskId," (",jobName," — ",companyLabel,") as ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"finished"})," ","with error=",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"discarded"}),". The runner will skip it."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",onClick:runDiscard,loading:discard.isPending,children:"Discard"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"redis"===confirm,onClose:()=>setConfirm(null),title:"Delete Redis lock",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Delete ",/*#__PURE__*/(0,jsx_runtime.jsxs)("code",{children:["fm-task-node-",taskId]}),". The runner will be able to pick this task up again on the next iteration."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"orange",onClick:runDeleteLock,loading:deleteLock.isPending,children:"Delete lock"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:ownerModalOpen,onClose:()=>setOwnerModalOpen(false),title:`Set owner for task #${taskId}`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Owner email",value:ownerInput,onChange:e=>setOwnerInput(e.currentTarget.value),placeholder:"bob@airporting.com"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setOwnerModalOpen(false),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:runSetOwner,loading:setOwner.isPending,disabled:!ownerInput.trim(),children:"Save"})]})]})})]})}function fmt(d){return d?new Date(d).toLocaleString("fr-FR"):"—"}function fmtDuration(ms){if(null==ms)return"—";if(ms<1e3)return`${ms}ms`;const s=Math.floor(ms/1e3);if(s<60)return`${s}s`;const m=Math.floor(s/60);const rem=s%60;return`${m}m${rem}s`}function TasksTable({items,total,isLoading,onShowLogs,selectedIds,onToggleId,onToggleAll}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300});if(!items||0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No tasks for current filters."});const visibleIds=items.map(i=>i.id);const allSelected=visibleIds.every(id=>selectedIds.has(id));const someSelected=!allSelected&&visibleIds.some(id=>selectedIds.has(id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.ScrollArea,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",mb:"xs",children:[total," task(s)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:1300,verticalSpacing:"xs",highlightOnHover:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:40,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:allSelected,indeterminate:someSelected,onChange:e=>onToggleAll(visibleIds,e.currentTarget.checked),"aria-label":"Select all"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Job"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Company"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Owner"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"State"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Created"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Started"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Duration"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Result / Error"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Actions"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:items.map(t=>{const companyLabel=t.company_display_name??t.company_slug??`#${t.company_id}`;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{bg:selectedIds.has(t.id)?"var(--mantine-color-dark-6)":void 0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:selectedIds.has(t.id),onChange:()=>onToggleId(t.id),"aria-label":`Select task ${t.id}`})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:t.id}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.job_name}),t.beta&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"violet",variant:"light",children:"beta"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:companyLabel})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.owner})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:STATE_COLORS[t.state],children:STATE_LABELS[t.state]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:fmt(t.created)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:fmt(t.startedAt)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:fmtDuration(t.runDuration)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:{maxWidth:320},children:t.error?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:t.error,multiline:true,w:420,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Code,{c:"red",style:{display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.error})}):null!=t.trace_count?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[t.trace_count," ",t.trace_label??""]}):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(RowActions,{taskId:t.id,jobName:t.job_name,companyLabel:companyLabel,currentOwner:t.owner,githubJob:t.github_job,onShowLogs:onShowLogs})})]},t.id)})})]})]})}function BulkActionBar_notify(title,message,color){notifications_esm_index_mjs_.notifications.show({title,message,color})}async function runBulk(ids,fn){const results=await Promise.allSettled(ids.map(fn));const ok=results.filter(r=>"fulfilled"===r.status).length;return{ok,failed:results.length-ok}}function BulkActionBar({selectedIds,onClear}){const count=selectedIds.length;const[confirm,setConfirm]=(0,index_js_.useState)(null);const[ownerOpen,setOwnerOpen]=(0,index_js_.useState)(false);const[ownerInput,setOwnerInput]=(0,index_js_.useState)("");const[pending,setPending]=(0,index_js_.useState)(false);const unstick=useUnstickFinanceTask();const retry=useRetryFinanceTask();const discard=useDiscardFinanceTask();const setOwner=useSetFinanceTaskOwner();const deleteLock=useDeleteFinanceRedisLock();const finalize=(label,res)=>{setPending(false);onClear();BulkActionBar_notify(label,`${res.ok} succeeded${res.failed?`, ${res.failed} failed`:""}`,res.failed?"red":"green")};const runUnstick=async()=>{setPending(true);const res=await runBulk(selectedIds,id=>unstick.mutateAsync(id));finalize("Bulk unstick",res)};const runRetry=async()=>{setConfirm(null);setPending(true);const res=await runBulk(selectedIds,id=>retry.mutateAsync(id));finalize("Bulk retry",res)};const runDiscard=async()=>{setConfirm(null);setPending(true);const res=await runBulk(selectedIds,id=>discard.mutateAsync(id));finalize("Bulk discard",res)};const runDeleteLock=async()=>{setConfirm(null);setPending(true);const res=await runBulk(selectedIds,id=>deleteLock.mutateAsync(id));finalize("Bulk Redis lock delete",res)};const runSetOwner=async()=>{setOwnerOpen(false);const owner=ownerInput.trim();if(!owner)return;setPending(true);const res=await runBulk(selectedIds,id=>setOwner.mutateAsync({id,owner}));finalize(`Bulk set owner \u{2192} ${owner}`,res)};if(0===count)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{p:"sm",radius:"md",withBorder:true,style:{position:"sticky",bottom:16,zIndex:5,backgroundColor:"var(--mantine-color-dark-7)"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",fw:600,children:[count," selected"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"subtle",onClick:onClear,children:"Clear"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",loading:pending,onClick:runUnstick,children:"Unstick"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",loading:pending,onClick:()=>setConfirm("retry"),children:"Retry"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",loading:pending,onClick:()=>{setOwnerInput("");setOwnerOpen(true)},children:"Set owner…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",color:"orange",loading:pending,onClick:()=>setConfirm("redis"),children:"Delete Redis lock"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",color:"red",loading:pending,onClick:()=>setConfirm("discard"),children:"Discard"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"retry"===confirm,onClose:()=>setConfirm(null),title:`Retry ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Reset ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:count})," task(s) so the runner picks them up again."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{onClick:runRetry,children:["Retry ",count]})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"discard"===confirm,onClose:()=>setConfirm(null),title:`Discard ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Mark ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:count})," task(s) as ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"finished"})," with error=",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"discarded"}),". They will not be processed."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:"red",onClick:runDiscard,children:["Discard ",count]})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"redis"===confirm,onClose:()=>setConfirm(null),title:`Delete Redis lock for ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:["Delete ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"fm-task-node-<id>"})," for ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:count})," ","task(s)."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:"orange",onClick:runDeleteLock,children:["Delete ",count," lock(s)"]})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:ownerOpen,onClose:()=>setOwnerOpen(false),title:`Set owner for ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Owner email",value:ownerInput,onChange:e=>setOwnerInput(e.currentTarget.value),placeholder:"bob@airporting.com"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setOwnerOpen(false),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{onClick:runSetOwner,disabled:!ownerInput.trim(),children:["Apply to ",count]})]})]})})]})}function useFinanceRunners(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","finance-jobs","runners"],queryFn:async()=>(await api.financeJobs.getRunnersV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}function RunnerBadge(){const runners=useFinanceRunners();if(runners.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"gray",variant:"light",children:"runners —"});if(!runners.data)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"gray",variant:"light",children:"runners …"});const inProgress=runners.data.inProgress??0;const queued=runners.data.queued??0;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:`${inProgress} run(s) en cours \xb7 ${queued} en file`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:inProgress>0?"green":"gray",variant:inProgress>0?"filled":"light",children:["▶ ",inProgress," en cours",queued>0?` \xb7 ${queued} en file`:""]})})}function useRunRecipe(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async count=>(await api.financeJobs.runRecipeV1({count})).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Run recipe",message:data?.message??`${data?.dispatched??0} run(s) lanc\xe9(s)`,color:"green"});queryClient.invalidateQueries({queryKey:["tech","finance-jobs","runners"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Run recipe",message:err?.error?.error??err?.message??"\xc9chec du dispatch",color:"red"})}})}function RunRecipeButton(){const[count,setCount]=(0,index_js_.useState)(1);const run=useRunRecipe();return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.NumberInput,{size:"sm",w:70,min:1,max:3,value:count,onChange:v=>setCount("number"==typeof v?v:1),clampBehavior:"strict"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"sm",color:"green",loading:run.isPending,onClick:()=>run.mutate(count),children:"▶ Run recipe"})]})}function FinanceJobsApp(){const stock=useFinanceJobsStock();const[jobName,setJobName]=(0,index_js_.useState)(null);const[owner,setOwner]=(0,index_js_.useState)(null);const[company,setCompany]=(0,index_js_.useState)(null);const[state,setState]=(0,index_js_.useState)("pending");const[beta,setBeta]=(0,index_js_.useState)("false");const tasks=useFinanceJobsTasks({job_name:jobName??void 0,owner:owner??void 0,company_slug:company??void 0,state,beta,take:50});const[openJob,setOpenJob]=(0,index_js_.useState)(null);const[selectedIds,setSelectedIds]=(0,index_js_.useState)(new Set);const toggleId=(0,index_js_.useCallback)(id=>{setSelectedIds(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next})},[]);const toggleAll=(0,index_js_.useCallback)((ids,select)=>{setSelectedIds(prev=>{const next=new Set(prev);for(const id of ids)if(select)next.add(id);else next.delete(id);return next})},[]);const clearSelection=(0,index_js_.useCallback)(()=>setSelectedIds(new Set),[]);const jobNames=(0,index_js_.useMemo)(()=>(stock.data?.byJobName??[]).map(e=>e.key),[stock.data]);const owners=(0,index_js_.useMemo)(()=>(stock.data?.byOwner??[]).map(e=>e.key),[stock.data]);const companies=(0,index_js_.useMemo)(()=>(stock.data?.byCompany??[]).map(e=>e.key),[stock.data]);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,children:"Finance Jobs Tasks"}),/*#__PURE__*/(0,jsx_runtime.jsx)(RunnerBadge,{}),stock.dataUpdatedAt&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",size:"xs",children:["Updated"," ",new Date(stock.dataUpdatedAt).toLocaleTimeString("fr-FR")]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(RunRecipeButton,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",size:"sm",loading:stock.isFetching||tasks.isFetching,onClick:()=>{stock.refetch();tasks.refetch()},children:"↻ Refresh"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(KpiCards,{stock:stock.data,isLoading:stock.isLoading,isError:stock.isError}),/*#__PURE__*/(0,jsx_runtime.jsx)(Breakdowns,{byJobName:stock.data?.byJobName,byOwner:stock.data?.byOwner,byCompany:stock.data?.byCompany}),/*#__PURE__*/(0,jsx_runtime.jsx)(TasksFilters,{jobName:jobName,owner:owner,company:company,state:state,beta:beta,jobNames:jobNames,owners:owners,companies:companies,onJobName:setJobName,onOwner:setOwner,onCompany:setCompany,onState:setState,onBeta:setBeta,onRefresh:()=>tasks.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsx)(TasksTable,{items:tasks.data?.items,total:tasks.data?.total??0,isLoading:tasks.isLoading,onShowLogs:setOpenJob,selectedIds:selectedIds,onToggleId:toggleId,onToggleAll:toggleAll}),/*#__PURE__*/(0,jsx_runtime.jsx)(BulkActionBar,{selectedIds:[...selectedIds],onClear:clearSelection}),/*#__PURE__*/(0,jsx_runtime.jsx)(JobLogsDrawer.o,{githubJob:openJob,opened:!!openJob,onClose:()=>setOpenJob(null)})]})})}function FinanceJobs(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(FinanceJobsApp,{})})})}}}]);
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7825"],{5781:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>FinanceJobs});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var QueueDashboard=__webpack_require__(2663);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useFinanceJobsStock(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","finance-jobs","stock"],queryFn:async()=>(await api.financeJobs.getStockV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}function useFinanceJobsTasks(filters){const api=(0,useApi.h)();const query={...filters.job_name&&{job_name:filters.job_name},...filters.owner&&{owner:filters.owner},...filters.company_slug&&{company_slug:filters.company_slug},...filters.state&&{state:filters.state},...filters.beta&&{beta:filters.beta},...void 0!==filters.take&&{take:String(filters.take)},...void 0!==filters.skip&&{skip:String(filters.skip)}};return(0,modern_index_js_.useQuery)({queryKey:["tech","finance-jobs","tasks",filters],queryFn:async()=>(await api.financeJobs.listTasksV1(query)).data,refetchOnWindowFocus:false})}function useInvalidate(){const queryClient=(0,modern_index_js_.useQueryClient)();return()=>queryClient.invalidateQueries({queryKey:["tech","finance-jobs"]})}function useUnstickFinanceTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.unstickV1({id:String(id)})).data,onSuccess:invalidate})}function useRetryFinanceTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.retryV1({id:String(id)})).data,onSuccess:invalidate})}function useDiscardFinanceTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.discardV1({id:String(id)})).data,onSuccess:invalidate})}function useSetFinanceTaskOwner(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async({id,owner})=>(await api.financeJobs.setOwnerV1({id:String(id)},{owner})).data,onSuccess:invalidate})}function useDeleteFinanceRedisLock(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.financeJobs.deleteRedisLockV1({id:String(id)})).data,onSuccess:invalidate})}var jobLogsContext=__webpack_require__(6845);var tabler_icons_react_mjs_=__webpack_require__(9632);var esm_index_mjs_=__webpack_require__(1455);function notify(title,message,color){esm_index_mjs_.notifications.show({title,message,color})}function RowActions({taskId,jobName,companyLabel,currentOwner,githubJob,onShowLogs}){const[confirm,setConfirm]=(0,index_js_.useState)(null);const[ownerModalOpen,setOwnerModalOpen]=(0,index_js_.useState)(false);const[ownerInput,setOwnerInput]=(0,index_js_.useState)(currentOwner??"");const unstick=useUnstickFinanceTask();const retry=useRetryFinanceTask();const discard=useDiscardFinanceTask();const setOwner=useSetFinanceTaskOwner();const deleteLock=useDeleteFinanceRedisLock();const runUnstick=()=>unstick.mutate(taskId,{onSuccess:()=>notify("Unstuck",`Task #${taskId} reset`,"green"),onError:e=>notify("Failed",e?.message??"Unstick failed","red")});const runRetry=()=>{setConfirm(null);retry.mutate(taskId,{onSuccess:()=>notify("Retry queued",`Task #${taskId} will rerun`,"green"),onError:e=>notify("Failed",e?.message??"Retry failed","red")})};const runDiscard=()=>{setConfirm(null);discard.mutate(taskId,{onSuccess:()=>notify("Discarded",`Task #${taskId} marked done`,"green"),onError:e=>notify("Failed",e?.message??"Discard failed","red")})};const runSetOwner=()=>{setOwnerModalOpen(false);setOwner.mutate({id:taskId,owner:ownerInput},{onSuccess:()=>notify("Owner updated",`Task #${taskId} \u{2192} ${ownerInput}`,"green"),onError:e=>notify("Failed",e?.message??"Set owner failed","red")})};const runDeleteLock=()=>{setConfirm(null);deleteLock.mutate(taskId,{onSuccess:data=>notify("Redis lock",data.existed?`Deleted ${data.key}`:`No lock found (${data.key})`,"green"),onError:e=>notify("Failed",e?.message??"Redis delete failed","red")})};return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[githubJob&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Voir les logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",onClick:()=>onShowLogs(githubJob),"aria-label":"Voir les logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTerminal,{size:16})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu,{position:"bottom-end",withArrow:true,shadow:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Target,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default","aria-label":"Actions",children:"⋮"})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Menu.Dropdown,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:runUnstick,children:"Unstick"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>setConfirm("retry"),children:"Retry"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>{setOwnerInput(currentOwner??"");setOwnerModalOpen(true)},children:"Set owner…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{onClick:()=>setConfirm("redis"),children:"Delete Redis lock"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Menu.Item,{color:"red",onClick:()=>setConfirm("discard"),children:"Discard"})]})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"retry"===confirm,onClose:()=>setConfirm(null),title:"Retry task",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Reset task #",taskId," (",jobName," — ",companyLabel,") so the runner picks it up again. This clears ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"finished"}),","," ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"startedAt"}),", ",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"error"})," and the Redis lock."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:runRetry,loading:retry.isPending,children:"Retry"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"discard"===confirm,onClose:()=>setConfirm(null),title:"Discard task",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Mark task #",taskId," (",jobName," — ",companyLabel,") as ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"finished"})," ","with error=",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"discarded"}),". The runner will skip it."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",onClick:runDiscard,loading:discard.isPending,children:"Discard"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:"redis"===confirm,onClose:()=>setConfirm(null),title:"Delete Redis lock",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:["Delete ",/*#__PURE__*/(0,jsx_runtime.jsxs)("code",{children:["fm-task-node-",taskId]}),". The runner will be able to pick this task up again on the next iteration."]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"orange",onClick:runDeleteLock,loading:deleteLock.isPending,children:"Delete lock"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:ownerModalOpen,onClose:()=>setOwnerModalOpen(false),title:`Set owner for task #${taskId}`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Owner email",value:ownerInput,onChange:e=>setOwnerInput(e.currentTarget.value),placeholder:"bob@airporting.com"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setOwnerModalOpen(false),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:runSetOwner,loading:setOwner.isPending,disabled:!ownerInput.trim(),children:"Save"})]})]})})]})}function useFinanceRunners(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","finance-jobs","runners"],queryFn:async()=>(await api.financeJobs.getRunnersV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}function RunnerBadge(){const runners=useFinanceRunners();if(runners.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"gray",variant:"light",children:"runners —"});if(!runners.data)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"gray",variant:"light",children:"runners …"});const inProgress=runners.data.inProgress??0;const queued=runners.data.queued??0;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:`${inProgress} run(s) en cours \xb7 ${queued} en file`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:inProgress>0?"green":"gray",variant:inProgress>0?"filled":"light",children:["▶ ",inProgress," en cours",queued>0?` \xb7 ${queued} en file`:""]})})}function useRunRecipe(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async count=>(await api.financeJobs.runRecipeV1({count})).data,onSuccess:data=>{esm_index_mjs_.notifications.show({title:"Run recipe",message:data?.message??`${data?.dispatched??0} run(s) lanc\xe9(s)`,color:"green"});queryClient.invalidateQueries({queryKey:["tech","finance-jobs","runners"]})},onError:err=>{esm_index_mjs_.notifications.show({title:"Run recipe",message:err?.error?.error??err?.message??"\xc9chec du dispatch",color:"red"})}})}function RunRecipeButton(){const[count,setCount]=(0,index_js_.useState)(1);const run=useRunRecipe();return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.NumberInput,{size:"sm",w:70,min:1,max:3,value:count,onChange:v=>setCount("number"==typeof v?v:1),clampBehavior:"strict"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"sm",color:"green",loading:run.isPending,onClick:()=>run.mutate(count),children:"▶ Run recipe"})]})}const STATE_COLORS={pending:"gray",running:"blue",stuck:"orange",errored:"red",done:"green"};const STATE_LABELS={pending:"Pending",running:"Running",stuck:"Stuck",errored:"Errored",done:"Done"};function fmt(d){return d?new Date(d).toLocaleString("fr-FR"):"—"}function fmtDuration(ms){if(null==ms)return"—";if(ms<1e3)return`${ms}ms`;const s=Math.floor(ms/1e3);if(s<60)return`${s}s`;const m=Math.floor(s/60);return`${m}m${s%60}s`}function ageBadge(created){const h=(Date.now()-new Date(created).getTime())/36e5;if(h<1)return null;const label=h>=24?`${Math.floor(h/24)}j`:`${Math.floor(h)}h`;const color=h>=24?"red":h>=4?"orange":"gray";return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{ml:6,size:"xs",color:color,variant:"light",children:label})}function FinanceRowActions({item}){const openLogs=(0,jobLogsContext.j)();const companyLabel=item.company_display_name??item.company_slug??`#${item.company_id}`;return/*#__PURE__*/(0,jsx_runtime.jsx)(RowActions,{taskId:item.id,jobName:item.job_name,companyLabel:companyLabel,currentOwner:item.owner,githubJob:item.github_job,onShowLogs:openLogs})}async function runBulk(ids,fn){const results=await Promise.allSettled(ids.map(fn));const ok=results.filter(r=>"fulfilled"===r.status).length;return{ok,failed:results.length-ok}}function useFinanceJobsConfig(){const unstick=useUnstickFinanceTask();const retry=useRetryFinanceTask();const discard=useDiscardFinanceTask();const setOwner=useSetFinanceTaskOwner();const deleteLock=useDeleteFinanceRedisLock();return(0,index_js_.useMemo)(()=>({title:"Finance jobs",source:{useStock:useFinanceJobsStock,useTasks:({job_name,owner,company_slug,state,beta})=>useFinanceJobsTasks({job_name:job_name??void 0,owner:owner??void 0,company_slug:company_slug??void 0,state,beta,take:50})},initialFilters:{job_name:null,owner:null,company_slug:null,state:"pending",beta:"false",search:""},kpis:[{key:"pending",label:"Pending",value:s=>s?.pending??0},{key:"running",label:"Running",value:s=>s?.running??0},{key:"stuck",label:"Stuck",value:s=>s?.stuck??0,tone:s=>(s?.stuck??0)>0?"warn":"neutral"},{key:"errored",label:"Errored",value:s=>s?.errored??0,tone:s=>(s?.errored??0)>0?"bad":"neutral"},{key:"done_today",label:"Done today",value:s=>s?.done_today??0},{key:"oldest",label:"Oldest pending",value:s=>s?.oldest?`${s.oldest.ageHours}h`:"—"}],filters:[{kind:"select",key:"job_name",label:"Job",options:s=>(s?.byJobName??[]).map(e=>e.key),width:240},{kind:"select",key:"owner",label:"Owner",options:s=>(s?.byOwner??[]).map(e=>e.key),width:240},{kind:"select",key:"company_slug",label:"Company",options:s=>(s?.byCompany??[]).map(e=>e.key),width:220},{kind:"select",key:"state",label:"State",options:()=>["pending","running","stuck","errored","done","all"],clearable:false,width:140},{kind:"select",key:"beta",label:"Beta",options:()=>[{value:"false",label:"Prod"},{value:"true",label:"Beta"},{value:"all",label:"All"}],clearable:false,width:120},{kind:"search",key:"search",label:"Recherche",placeholder:"id, owner, company, erreur…",width:240}],columns:[{key:"job",label:"Job",render:t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.job_name}),t.beta&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"violet",variant:"light",children:"beta"})]})},{key:"company",label:"Company",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.company_display_name??t.company_slug??`#${t.company_id}`})},{key:"owner",label:"Owner",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.owner})},{key:"state",label:"State",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:STATE_COLORS[t.state],children:STATE_LABELS[t.state]})},{key:"created",label:"Created",render:t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:4,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.created)}),ageBadge(t.created)]})},{key:"duration",label:"Duration",render:t=>fmtDuration(t.runDuration)},{key:"error",label:"Result / Error",render:t=>t.error?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:t.error,multiline:true,w:420,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Code,{c:"red",style:{display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:320},children:t.error})}):null!=t.trace_count?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[t.trace_count," ",t.trace_label??""]}):"—"}],rowActions:[{key:"actions",render:item=>/*#__PURE__*/(0,jsx_runtime.jsx)(FinanceRowActions,{item:item})}],bulkActions:[{key:"unstick",label:"Unstick",run:ids=>runBulk(ids,id=>unstick.mutateAsync(id))},{key:"retry",label:"Retry",confirm:{title:"Retry {count} task(s)",body:"Reset les t\xe2ches pour que le runner les reprenne."},run:ids=>runBulk(ids,id=>retry.mutateAsync(id))},{key:"set-owner",label:"Set owner…",prompt:{label:"Owner email",placeholder:"bob@airporting.com"},run:(ids,owner)=>{if(!owner)return Promise.resolve({ok:0,failed:ids.length});return runBulk(ids,id=>setOwner.mutateAsync({id,owner}))}},{key:"delete-lock",label:"Delete Redis lock",color:"orange",confirm:{title:"Delete Redis lock for {count} task(s)",body:"Suppression du verrou Redis fm-task-node-<id>."},run:ids=>runBulk(ids,id=>deleteLock.mutateAsync(id))},{key:"discard",label:"Discard",color:"red",confirm:{title:"Discard {count} task(s)",body:"Les t\xe2ches seront marqu\xe9es comme finished avec error=discarded."},run:ids=>runBulk(ids,id=>discard.mutateAsync(id))}],topErrors:{extract:t=>t.error},headerBadge:/*#__PURE__*/(0,jsx_runtime.jsx)(RunnerBadge,{}),headerActions:/*#__PURE__*/(0,jsx_runtime.jsx)(RunRecipeButton,{}),getRowId:t=>t.id,searchMatches:(t,q)=>String(t.id).includes(q)||(t.owner??"").toLowerCase().includes(q)||(t.company_slug??"").toLowerCase().includes(q)||(t.company_display_name??"").toLowerCase().includes(q)||(t.job_name??"").toLowerCase().includes(q)||(t.error??"").toLowerCase().includes(q)}),[unstick,retry,discard,setOwner,deleteLock])}function FinanceJobsApp(){const config=useFinanceJobsConfig();return/*#__PURE__*/(0,jsx_runtime.jsx)(QueueDashboard.r,{config:config})}function FinanceJobs(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(FinanceJobsApp,{})})})}}}]);
|