@airporting/tech-app 0.0.117 → 0.0.119

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.
Files changed (119) hide show
  1. package/dist/mf/1.js +1 -1
  2. package/dist/mf/1659.js +1 -1
  3. package/dist/mf/2880.js +1 -1
  4. package/dist/mf/3080.js +1 -1
  5. package/dist/mf/3364.js +2 -2
  6. package/dist/mf/3429.js +3 -3
  7. package/dist/mf/3724.js +1 -1
  8. package/dist/mf/4153.js +1 -1
  9. package/dist/mf/5178.js +1 -1
  10. package/dist/mf/5182.js +1 -1
  11. package/dist/mf/6548.js +1 -1
  12. package/dist/mf/7364.js +1 -1
  13. package/dist/mf/7380.js +1 -1
  14. package/dist/mf/7541.js +1 -1
  15. package/dist/mf/7906.js +1 -1
  16. package/dist/mf/8119.js +1 -1
  17. package/dist/mf/9439.js +1 -1
  18. package/dist/mf/9622.js +1 -1
  19. package/dist/mf/9669.js +1 -1
  20. package/dist/mf/@mf-types/compiled-types/App.d.ts +1 -1
  21. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/BulkActionBar.d.ts +1 -1
  22. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/FiltersBar.d.ts +1 -1
  23. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/JobLogsDrawer.d.ts +1 -1
  24. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/KpiStrip.d.ts +1 -1
  25. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/MobileTasksList.d.ts +1 -1
  26. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/QueueDashboard.d.ts +1 -1
  27. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/TasksTable.d.ts +1 -1
  28. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/TopErrorsCard.d.ts +1 -1
  29. package/dist/mf/@mf-types/compiled-types/apps/_shared/queueDashboard/jobLogsContext.d.ts +1 -1
  30. package/dist/mf/@mf-types/compiled-types/apps/amex.app.d.ts +1 -1
  31. package/dist/mf/@mf-types/compiled-types/apps/bnpp.app.d.ts +1 -1
  32. package/dist/mf/@mf-types/compiled-types/apps/credmut.app.d.ts +1 -1
  33. package/dist/mf/@mf-types/compiled-types/apps/etat-saisie/BankLogo.d.ts +1 -1
  34. package/dist/mf/@mf-types/compiled-types/apps/etat-saisie/DetailTable.d.ts +1 -1
  35. package/dist/mf/@mf-types/compiled-types/apps/etat-saisie/DossiersTab.d.ts +1 -1
  36. package/dist/mf/@mf-types/compiled-types/apps/etat-saisie/ManagedBadge.d.ts +1 -1
  37. package/dist/mf/@mf-types/compiled-types/apps/etat-saisie/ProviderIcon.d.ts +1 -1
  38. package/dist/mf/@mf-types/compiled-types/apps/etat-saisie.app.d.ts +1 -1
  39. package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/RowActions.d.ts +1 -1
  40. package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/RunRecipeButton.d.ts +1 -1
  41. package/dist/mf/@mf-types/compiled-types/apps/finance-jobs/RunnerBadge.d.ts +1 -1
  42. package/dist/mf/@mf-types/compiled-types/apps/finance-jobs.app.d.ts +1 -1
  43. package/dist/mf/@mf-types/compiled-types/apps/github.app.d.ts +1 -1
  44. package/dist/mf/@mf-types/compiled-types/apps/mcpAccess.app.d.ts +1 -1
  45. package/dist/mf/@mf-types/compiled-types/apps/payfit.app.d.ts +1 -1
  46. package/dist/mf/@mf-types/compiled-types/apps/sales/LeadDetailDrawer.d.ts +1 -1
  47. package/dist/mf/@mf-types/compiled-types/apps/sales/LeadTimeline.d.ts +1 -1
  48. package/dist/mf/@mf-types/compiled-types/apps/sales/LeadsTable.d.ts +1 -1
  49. package/dist/mf/@mf-types/compiled-types/apps/sales/NewLeadModal.d.ts +1 -1
  50. package/dist/mf/@mf-types/compiled-types/apps/sales/SourceLogo.d.ts +1 -1
  51. package/dist/mf/@mf-types/compiled-types/apps/sales/sourceIcons.d.ts +2 -2
  52. package/dist/mf/@mf-types/compiled-types/apps/sales.app.d.ts +1 -1
  53. package/dist/mf/@mf-types/compiled-types/apps/sante/SystemHealthStrip.d.ts +1 -1
  54. package/dist/mf/@mf-types/compiled-types/apps/scrapers/ScraperCard.d.ts +4 -4
  55. package/dist/mf/@mf-types/compiled-types/apps/scrapers/ScraperDetailDrawer.d.ts +1 -1
  56. package/dist/mf/@mf-types/compiled-types/apps/scrapers/SobankDrawer.d.ts +1 -1
  57. package/dist/mf/@mf-types/compiled-types/apps/scrapers.app.d.ts +1 -1
  58. package/dist/mf/@mf-types/compiled-types/apps/spendesk.app.d.ts +1 -1
  59. package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/RowActions.d.ts +1 -1
  60. package/dist/mf/@mf-types/compiled-types/apps/spreadsheet/ServiceLogo.d.ts +1 -1
  61. package/dist/mf/@mf-types/compiled-types/apps/spreadsheet.app.d.ts +1 -1
  62. package/dist/mf/@mf-types/compiled-types/apps/synchro.app.d.ts +1 -1
  63. package/dist/mf/@mf-types/compiled-types/apps/usage/AbandonedChart.d.ts +1 -1
  64. package/dist/mf/@mf-types/compiled-types/apps/usage/ChargeStack.d.ts +1 -1
  65. package/dist/mf/@mf-types/compiled-types/apps/usage/ConcurrencyChart.d.ts +1 -1
  66. package/dist/mf/@mf-types/compiled-types/apps/usage/ServiceLevelChart.d.ts +1 -1
  67. package/dist/mf/@mf-types/compiled-types/apps/usage/TopTables.d.ts +2 -2
  68. package/dist/mf/@mf-types/compiled-types/apps/usage/TractionChart.d.ts +1 -1
  69. package/dist/mf/@mf-types/compiled-types/apps/usage/TriggerFilter.d.ts +1 -1
  70. package/dist/mf/@mf-types/compiled-types/apps/usage/UsageKpiRow.d.ts +1 -1
  71. package/dist/mf/@mf-types/compiled-types/apps/usage.app.d.ts +1 -1
  72. package/dist/mf/@mf-types/compiled-types/apps/wise.app.d.ts +1 -1
  73. package/dist/mf/@mf-types/compiled-types/components/BrandLogo.d.ts +1 -1
  74. package/dist/mf/@mf-types/compiled-types/components/CompanyLogo.d.ts +1 -1
  75. package/dist/mf/@mf-types/compiled-types/components/PageHeader.d.ts +1 -1
  76. package/dist/mf/@mf-types/compiled-types/components/QuickBooksIcon.d.ts +1 -1
  77. package/dist/mf/@mf-types/compiled-types/components/icons/IconBraintree.d.ts +1 -1
  78. package/dist/mf/@mf-types/compiled-types/components/icons/IconGithub.d.ts +1 -1
  79. package/dist/mf/@mf-types/compiled-types/components/icons/IconHealthCross.d.ts +1 -1
  80. package/dist/mf/@mf-types/compiled-types/dashboard.d.ts +1 -1
  81. package/dist/mf/@mf-types/compiled-types/providers.d.ts +1 -1
  82. package/dist/mf/@mf-types/compiled-types/tabs/amex.d.ts +1 -1
  83. package/dist/mf/@mf-types/compiled-types/tabs/bnpp.d.ts +1 -1
  84. package/dist/mf/@mf-types/compiled-types/tabs/credmut.d.ts +1 -1
  85. package/dist/mf/@mf-types/compiled-types/tabs/etat-saisie.d.ts +1 -1
  86. package/dist/mf/@mf-types/compiled-types/tabs/finance-jobs.d.ts +1 -1
  87. package/dist/mf/@mf-types/compiled-types/tabs/github.d.ts +1 -1
  88. package/dist/mf/@mf-types/compiled-types/tabs/mcpAccess.d.ts +1 -1
  89. package/dist/mf/@mf-types/compiled-types/tabs/payfit.d.ts +1 -1
  90. package/dist/mf/@mf-types/compiled-types/tabs/sales.d.ts +1 -1
  91. package/dist/mf/@mf-types/compiled-types/tabs/scrapers.d.ts +1 -1
  92. package/dist/mf/@mf-types/compiled-types/tabs/spendesk.d.ts +1 -1
  93. package/dist/mf/@mf-types/compiled-types/tabs/spreadsheet.d.ts +1 -1
  94. package/dist/mf/@mf-types/compiled-types/tabs/synchro.d.ts +1 -1
  95. package/dist/mf/@mf-types/compiled-types/tabs/usage.d.ts +1 -1
  96. package/dist/mf/@mf-types/compiled-types/tabs/wise.d.ts +1 -1
  97. package/dist/mf/@mf-types.zip +0 -0
  98. package/dist/mf/__federation_expose_amex.js +1 -1
  99. package/dist/mf/__federation_expose_bnpp.js +1 -1
  100. package/dist/mf/__federation_expose_credmut.js +1 -1
  101. package/dist/mf/__federation_expose_dashboard.js +1 -1
  102. package/dist/mf/__federation_expose_etat_saisie.js +1 -1
  103. package/dist/mf/__federation_expose_finance_jobs.js +1 -1
  104. package/dist/mf/__federation_expose_github.js +1 -1
  105. package/dist/mf/__federation_expose_mcp_access.js +1 -1
  106. package/dist/mf/__federation_expose_payfit.js +1 -1
  107. package/dist/mf/__federation_expose_sales.js +1 -1
  108. package/dist/mf/__federation_expose_scrapers.js +1 -1
  109. package/dist/mf/__federation_expose_spendesk.js +1 -1
  110. package/dist/mf/__federation_expose_spreadsheet.js +1 -1
  111. package/dist/mf/__federation_expose_synchro.js +1 -1
  112. package/dist/mf/__federation_expose_usage.js +1 -1
  113. package/dist/mf/__federation_expose_wise.js +1 -1
  114. package/dist/mf/index.css +73 -73
  115. package/dist/mf/index.js +4 -4
  116. package/dist/mf/mf-manifest.json +10 -10
  117. package/dist/mf/mf-stats.json +16 -16
  118. package/dist/mf/tech_app.js +3 -3
  119. package/package.json +12 -12
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["509"],{466:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>useGsheetStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGsheetStock(filters={}){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();const query={...filters.period&&{period:filters.period}};return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","gsheet","stock",filters],queryFn:async()=>(await api.gsheet.getStockV1({query})).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},5080:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Spreadsheet});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var QueueDashboard=__webpack_require__(5351);var index_mjs_=__webpack_require__(207);var tabler_icons_react_mjs_=__webpack_require__(9632);var gsheetStockQuery=__webpack_require__(466);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useGsheetTasks(filters){const api=(0,useApi.h)();const service=filters.service?.toLowerCase()==="all"?void 0:filters.service;const owner=filters.owner?.toLowerCase()==="all"?void 0:filters.owner;const query={...service&&{service},...owner&&{owner},...filters.state&&{state:filters.state},...filters.period&&{period:filters.period},...void 0!==filters.take&&{take:String(filters.take)},...void 0!==filters.skip&&{skip:String(filters.skip)}};return(0,modern_index_js_.useQuery)({queryKey:["tech","gsheet","tasks",filters],queryFn:async()=>(await api.gsheet.listTasksV1(query)).data,refetchOnWindowFocus:false})}function useInvalidate(){const queryClient=(0,modern_index_js_.useQueryClient)();return()=>queryClient.invalidateQueries({queryKey:["tech","gsheet"]})}function useUnstickTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.unstickV1({id:String(id)})).data,onSuccess:invalidate})}function useDiscardTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.discardV1({id:String(id)})).data,onSuccess:invalidate})}function useSetTaskOwner(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async({id,owner})=>(await api.gsheet.setOwnerV1({id:String(id)},{owner})).data,onSuccess:invalidate})}function useDeleteRedisLock(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.deleteRedisLockV1({id:String(id)})).data,onSuccess:invalidate})}var jobLogsContext=__webpack_require__(4302);var esm_index_mjs_=__webpack_require__(1455);function grafanaUrl(traceId){return`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${encodeURIComponent(traceId)}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`}function notify(title,message,color){esm_index_mjs_.notifications.show({title,message,color})}function RowActions({taskId,currentOwner,service,spreadsheet,worksheet,githubJob,traceId,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=useUnstickTask();const discard=useDiscardTask();const setOwner=useSetTaskOwner();const deleteLock=useDeleteRedisLock();const runUnstick=()=>unstick.mutate(taskId,{onSuccess:()=>notify("Unstuck",`Task #${taskId} reset`,"green"),onError:e=>notify("Failed",e?.message??"Unstick 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")})};const getWorksheetUrl=()=>{if(!spreadsheet)return null;return"excel"===service?`https://airporting.sharepoint.com/:x:/g/personal/airporting_com/ER${spreadsheet}`:`https://docs.google.com/spreadsheets/d/${spreadsheet}/edit`};const worksheetUrl=getWorksheetUrl();return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[worksheetUrl&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Ouvrir le tableur",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{component:"a",href:worksheetUrl,target:"_blank",rel:"noopener noreferrer",variant:"subtle","aria-label":"Ouvrir le tableur",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileSpreadsheet,{size:16})})}),githubJob&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"GitHub Actions logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",onClick:()=>onShowLogs(githubJob),"aria-label":"GitHub Actions logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTerminal,{size:16})})}),traceId&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Grafana Loki logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{component:"a",href:grafanaUrl(traceId),target:"_blank",rel:"noopener noreferrer",variant:"subtle","aria-label":"Grafana Loki logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{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:()=>{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:"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," (",spreadsheet,worksheet?`:${worksheet}`:"",") as ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"done"})," with step=",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"discarded"}),". The task will not be processed by the runner."]}),/*#__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 the Redis running-lock for ",spreadsheet,worksheet?`:${worksheet}`:"",". The runner will be able to pick up the worksheet 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"})]})]})})]})}var BrandLogo=__webpack_require__(3897);const SERVICE_DOMAIN={gsheet:"google.com",excel:"microsoft.com"};const SERVICE_LABEL={gsheet:"Google Sheets",excel:"Excel"};function ServiceLogo({service,size=18}){const domain=SERVICE_DOMAIN[service];const label=SERVICE_LABEL[service]??service;if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"light",color:"gray",title:service,children:service.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:domain,alt:label,size:size}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:label})]})}const STATE_COLORS={pending:"gray",running:"blue",stuck:"orange",errored:"red",done:"green"};const STATE_LABELS={pending:"En attente",running:"En cours",stuck:"Bloqu\xe9e",errored:"En erreur",done:"Termin\xe9e"};function fmt(d){return d?new Date(d).toLocaleString("fr-FR"):"—"}function GsheetRowActions({item}){const openLogs=(0,jobLogsContext.j)();return/*#__PURE__*/(0,jsx_runtime.jsx)(RowActions,{taskId:item.id,currentOwner:item.owner,service:item.service,spreadsheet:item.spreadsheet,worksheet:item.worksheet,githubJob:item.github_job,traceId:item.trace_id,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 useGsheetConfig(){const unstick=useUnstickTask();const discard=useDiscardTask();const setOwner=useSetTaskOwner();const deleteLock=useDeleteRedisLock();return(0,index_js_.useMemo)(()=>({title:"Worksheets : \xe9tat des lieux des copies sur tableurs",source:{useStock:({period})=>(0,gsheetStockQuery.U)({period:period??void 0}),useTasks:({service,owner,state,period},pagination)=>useGsheetTasks({service:service??void 0,owner:owner??void 0,state,period:period??void 0,skip:pagination.skip,take:pagination.take})},initialFilters:{service:null,owner:null,state:"pending",period:"today",search:""},kpis:[{key:"pending",label:"En attente",value:s=>s?.pending??0,filter:{state:"pending"}},{key:"running",label:"En cours",value:s=>s?.running??0,filter:{state:"running"}},{key:"stuck",label:"Bloqu\xe9es",value:s=>s?.stuck??0,tone:s=>(s?.stuck??0)>0?"warn":"neutral",filter:{state:"stuck"}},{key:"errored",label:"En erreur",value:s=>s?.errored??0,tone:s=>(s?.errored??0)>0?"bad":"neutral",filter:{state:"errored"}},{key:"done_today",label:"Termin\xe9es",value:s=>s?.done_today??0,filter:{state:"done"}},{key:"oldest",label:"Plus ancienne en attente",value:s=>s?.oldest?`${s.oldest.ageHours}h`:"—"}],filters:[{kind:"select",key:"service",label:"Service",options:()=>["all","gsheet","excel"],width:240},{kind:"select",key:"owner",label:"Propri\xe9taire",options:s=>["all",...(s?.byOwner??[]).map(e=>e.key)],width:240},{kind:"select",key:"state",label:"\xc9tat",options:()=>["pending","running","stuck","errored","done","all"],clearable:false,width:140},{kind:"select",key:"period",label:"P\xe9riode",options:()=>[{value:"today",label:"Aujourd'hui"},{value:"7d",label:"7 jours"},{value:"30d",label:"30 jours"},{value:"all",label:"Tout"}],clearable:false,width:130},{kind:"search",key:"search",label:"Recherche",placeholder:"id, owner, spreadsheet…",width:240}],columns:[{key:"service",label:"Service",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(ServiceLogo,{service:t.service})},{key:"spreadsheet",label:"ID tableur",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:t.spreadsheet})},{key:"worksheet",label:"Onglet",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:t.worksheet??"—"})},{key:"company_display_name",label:"Entreprise",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.company_display_name??"—"})},{key:"trigger_source",label:"Type",render:t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ThemeIcon,{variant:"transparent",color:"gray",size:"sm",children:"manual"===t.trigger_source?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconUser,{size:16,stroke:1.5}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRobot,{size:16,stroke:1.5})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"manual"===t.trigger_source?t.owner??"Manuel":"Planifi\xe9"})]})},{key:"state",label:"\xc9tat",render:t=>{const badge=/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:STATE_COLORS[t.state],children:STATE_LABELS[t.state]});return t.error?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:t.error,multiline:true,maw:420,withArrow:true,children:badge}):badge}},{key:"created",label:"Cr\xe9\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.created)})},{key:"started",label:"D\xe9marr\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.started)})},{key:"finished_at",label:"Termin\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.finished_at)})}],rowActions:[{key:"actions",render:item=>/*#__PURE__*/(0,jsx_runtime.jsx)(GsheetRowActions,{item:item})}],bulkActions:[{key:"unstick",label:"D\xe9bloquer",run:ids=>runBulk(ids,id=>unstick.mutateAsync(id))},{key:"set-owner",label:"Changer le propri\xe9taire…",prompt:{label:"E-mail du propri\xe9taire",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:"Supprimer le verrou Redis",color:"orange",confirm:{title:"Supprimer le verrou Redis pour {count} t\xe2che(s)",body:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"fm-task-node-<id>",disabled:true,children:/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:["Suppression du verrou Redis pour ","{count}"," t\xe2che(s)."]})})},run:ids=>runBulk(ids,id=>deleteLock.mutateAsync(id))},{key:"discard",label:"Abandonner",color:"red",confirm:{title:"Abandonner {count} t\xe2che(s)",body:"Les t\xe2ches seront marqu\xe9es comme termin\xe9es/abandonn\xe9es."},run:ids=>runBulk(ids,id=>discard.mutateAsync(id))}],getRowId:t=>t.id,searchMatches:(t,q)=>String(t.id).includes(q)||(t.owner??"").toLowerCase().includes(q)||(t.spreadsheet??"").toLowerCase().includes(q)||(t.worksheet??"").toLowerCase().includes(q)||(t.service??"").toLowerCase().includes(q)||(t.company_display_name??"").toLowerCase().includes(q)}),[unstick,discard,setOwner,deleteLock])}function SpreadsheetApp(){const config=useGsheetConfig();return/*#__PURE__*/(0,jsx_runtime.jsx)(QueueDashboard.r,{config:config})}function Spreadsheet(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)(SpreadsheetApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["509"],{466:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>useGsheetStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGsheetStock(filters={}){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();const query={...filters.period&&{period:filters.period}};return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","gsheet","stock",filters],queryFn:async()=>(await api.gsheet.getStockV1({query})).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},5080:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Spreadsheet});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var QueueDashboard=__webpack_require__(5351);var index_mjs_=__webpack_require__(207);var tabler_icons_react_mjs_=__webpack_require__(9632);var gsheetStockQuery=__webpack_require__(466);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useGsheetTasks(filters){const api=(0,useApi.h)();const service=filters.service?.toLowerCase()==="all"?void 0:filters.service;const owner=filters.owner?.toLowerCase()==="all"?void 0:filters.owner;const query={...service&&{service},...owner&&{owner},...filters.state&&{state:filters.state},...filters.period&&{period:filters.period},...void 0!==filters.take&&{take:String(filters.take)},...void 0!==filters.skip&&{skip:String(filters.skip)}};return(0,modern_index_js_.useQuery)({queryKey:["tech","gsheet","tasks",filters],queryFn:async()=>(await api.gsheet.listTasksV1(query)).data,refetchOnWindowFocus:false})}function useInvalidate(){const queryClient=(0,modern_index_js_.useQueryClient)();return()=>queryClient.invalidateQueries({queryKey:["tech","gsheet"]})}function useUnstickTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.unstickV1({id:String(id)})).data,onSuccess:invalidate})}function useDiscardTask(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.discardV1({id:String(id)})).data,onSuccess:invalidate})}function useSetTaskOwner(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async({id,owner})=>(await api.gsheet.setOwnerV1({id:String(id)},{owner})).data,onSuccess:invalidate})}function useDeleteRedisLock(){const api=(0,useApi.h)();const invalidate=useInvalidate();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.gsheet.deleteRedisLockV1({id:String(id)})).data,onSuccess:invalidate})}var jobLogsContext=__webpack_require__(4302);var esm_index_mjs_=__webpack_require__(1455);function grafanaUrl(traceId){return`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${encodeURIComponent(traceId)}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`}function notify(title,message,color){esm_index_mjs_.notifications.show({title,message,color})}function RowActions({taskId,currentOwner,service,spreadsheet,worksheet,githubJob,traceId,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=useUnstickTask();const discard=useDiscardTask();const setOwner=useSetTaskOwner();const deleteLock=useDeleteRedisLock();const runUnstick=()=>unstick.mutate(taskId,{onSuccess:()=>notify("Unstuck",`Task #${taskId} reset`,"green"),onError:e=>notify("Failed",e?.message??"Unstick 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")})};const getWorksheetUrl=()=>{if(!spreadsheet)return null;return"excel"===service?`https://airporting.sharepoint.com/:x:/g/personal/airporting_com/ER${spreadsheet}`:`https://docs.google.com/spreadsheets/d/${spreadsheet}/edit`};const worksheetUrl=getWorksheetUrl();return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[worksheetUrl&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Ouvrir le tableur",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{component:"a",href:worksheetUrl,target:"_blank",rel:"noopener noreferrer",variant:"subtle","aria-label":"Ouvrir le tableur",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileSpreadsheet,{size:16})})}),githubJob&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"GitHub Actions logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"subtle",onClick:()=>onShowLogs(githubJob),"aria-label":"GitHub Actions logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconTerminal,{size:16})})}),traceId&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"Grafana Loki logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{component:"a",href:grafanaUrl(traceId),target:"_blank",rel:"noopener noreferrer",variant:"subtle","aria-label":"Grafana Loki logs",children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{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:()=>{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:"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," (",spreadsheet,worksheet?`:${worksheet}`:"",") as ",/*#__PURE__*/(0,jsx_runtime.jsx)("b",{children:"done"})," with step=",/*#__PURE__*/(0,jsx_runtime.jsx)("code",{children:"discarded"}),". The task will not be processed by the runner."]}),/*#__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 the Redis running-lock for ",spreadsheet,worksheet?`:${worksheet}`:"",". The runner will be able to pick up the worksheet 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"})]})]})})]})}var BrandLogo=__webpack_require__(3897);const SERVICE_DOMAIN={gsheet:"google.com",excel:"microsoft.com"};const SERVICE_LABEL={gsheet:"Google Sheets",excel:"Excel"};function ServiceLogo({service,size=18}){const domain=SERVICE_DOMAIN[service];const label=SERVICE_LABEL[service]??service;if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"light",color:"gray",title:service,children:service.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:domain,alt:label,size:size}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:label})]})}const STATE_COLORS={pending:"gray",running:"blue",stuck:"orange",errored:"red",done:"green"};const STATE_LABELS={pending:"En attente",running:"En cours",stuck:"Bloqu\xe9e",errored:"En erreur",done:"Termin\xe9e"};function fmt(d){return d?new Date(d).toLocaleString("fr-FR"):"—"}function GsheetRowActions({item}){const openLogs=(0,jobLogsContext.j)();return/*#__PURE__*/(0,jsx_runtime.jsx)(RowActions,{taskId:item.id,currentOwner:item.owner,service:item.service,spreadsheet:item.spreadsheet,worksheet:item.worksheet,githubJob:item.github_job,traceId:item.trace_id,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 useGsheetConfig(){const unstick=useUnstickTask();const discard=useDiscardTask();const setOwner=useSetTaskOwner();const deleteLock=useDeleteRedisLock();return(0,index_js_.useMemo)(()=>({title:"Worksheets : \xe9tat des lieux des copies sur tableurs",source:{useStock:({period})=>(0,gsheetStockQuery.U)({period:period??void 0}),useTasks:({service,owner,state,period},pagination)=>useGsheetTasks({service:service??void 0,owner:owner??void 0,state,period:period??void 0,skip:pagination.skip,take:pagination.take})},initialFilters:{service:null,owner:null,state:"pending",period:"today",search:""},kpis:[{key:"pending",label:"En attente",value:s=>s?.pending??0,filter:{state:"pending"}},{key:"running",label:"En cours",value:s=>s?.running??0,filter:{state:"running"}},{key:"stuck",label:"Bloqu\xe9es",value:s=>s?.stuck??0,tone:s=>(s?.stuck??0)>0?"warn":"neutral",filter:{state:"stuck"}},{key:"errored",label:"En erreur",value:s=>s?.errored??0,tone:s=>(s?.errored??0)>0?"bad":"neutral",filter:{state:"errored"}},{key:"done_today",label:"Termin\xe9es",value:s=>s?.done_today??0,filter:{state:"done"}},{key:"oldest",label:"Plus ancienne en attente",value:s=>s?.oldest?`${s.oldest.ageHours}h`:"—"}],filters:[{kind:"select",key:"service",label:"Service",options:()=>["all","gsheet","excel"],width:240},{kind:"select",key:"owner",label:"Propri\xe9taire",options:s=>["all",...(s?.byOwner??[]).map(e=>e.key)],width:240},{kind:"select",key:"state",label:"\xc9tat",options:()=>["pending","running","stuck","errored","done","all"],clearable:false,width:140},{kind:"select",key:"period",label:"P\xe9riode",options:()=>[{value:"today",label:"Aujourd'hui"},{value:"7d",label:"7 jours"},{value:"30d",label:"30 jours"},{value:"all",label:"Tout"}],clearable:false,width:130},{kind:"search",key:"search",label:"Recherche",placeholder:"id, owner, spreadsheet…",width:240}],columns:[{key:"service",label:"Service",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(ServiceLogo,{service:t.service})},{key:"spreadsheet",label:"ID tableur",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:t.spreadsheet})},{key:"worksheet",label:"Onglet",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{wordBreak:"break-all"},children:t.worksheet??"—"})},{key:"company_display_name",label:"Entreprise",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:t.company_display_name??"—"})},{key:"trigger_source",label:"Type",render:t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ThemeIcon,{variant:"transparent",color:"gray",size:"sm",children:"manual"===t.trigger_source?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconUser,{size:16,stroke:1.5}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRobot,{size:16,stroke:1.5})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"manual"===t.trigger_source?t.owner??"Manuel":"Planifi\xe9"})]})},{key:"state",label:"\xc9tat",render:t=>{const badge=/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:STATE_COLORS[t.state],children:STATE_LABELS[t.state]});return t.error?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:t.error,multiline:true,maw:420,withArrow:true,children:badge}):badge}},{key:"created",label:"Cr\xe9\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.created)})},{key:"started",label:"D\xe9marr\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.started)})},{key:"finished_at",label:"Termin\xe9e",render:t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:fmt(t.finished_at)})}],rowActions:[{key:"actions",render:item=>/*#__PURE__*/(0,jsx_runtime.jsx)(GsheetRowActions,{item:item})}],bulkActions:[{key:"unstick",label:"D\xe9bloquer",run:ids=>runBulk(ids,id=>unstick.mutateAsync(id))},{key:"set-owner",label:"Changer le propri\xe9taire…",prompt:{label:"E-mail du propri\xe9taire",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:"Supprimer le verrou Redis",color:"orange",confirm:{title:"Supprimer le verrou Redis pour {count} t\xe2che(s)",body:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:"fm-task-node-<id>",disabled:true,children:/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:["Suppression du verrou Redis pour ","{count}"," t\xe2che(s)."]})})},run:ids=>runBulk(ids,id=>deleteLock.mutateAsync(id))},{key:"discard",label:"Abandonner",color:"red",confirm:{title:"Abandonner {count} t\xe2che(s)",body:"Les t\xe2ches seront marqu\xe9es comme termin\xe9es/abandonn\xe9es."},run:ids=>runBulk(ids,id=>discard.mutateAsync(id))}],getRowId:t=>t.id,searchMatches:(t,q)=>String(t.id).includes(q)||(t.owner??"").toLowerCase().includes(q)||(t.spreadsheet??"").toLowerCase().includes(q)||(t.worksheet??"").toLowerCase().includes(q)||(t.service??"").toLowerCase().includes(q)||(t.company_display_name??"").toLowerCase().includes(q)}),[unstick,discard,setOwner,deleteLock])}function SpreadsheetApp(){const config=useGsheetConfig();return/*#__PURE__*/(0,jsx_runtime.jsx)(QueueDashboard.r,{config:config})}function Spreadsheet(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)(SpreadsheetApp,{})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["2124"],{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"})})}},9098:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Synchro});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(9038);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSynchroStatsQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","stats"],queryFn:async()=>await api.synchro.getRunStatsV1().then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var tabler_icons_react_mjs_=__webpack_require__(9632);var notifications_esm_index_mjs_=__webpack_require__(1455);function useResetStatsMutation(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useMutation)({mutationFn:async values=>await api.synchro.resetOwnerStatsV1(values).then(x=>x.data),onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Cible remise \xe0 niveau",message:"C'est reparti comme en 40"})},onError:(error,variables,context)=>{console.error(error,variables,context);notifications_esm_index_mjs_.notifications.show({color:"red",title:"Erreur !",message:"Nous rencontrons un soucis technique. Veuillez r\xe9essayer plus tard."})}});return query}function useSynchroTasks({gas,dateRange,companies,jobs}){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","tasks","list",{gas,dateRange,companies,jobs}],queryFn:async()=>await api.synchro.getTasksV1({...gas&&{gas},...dateRange&&{dateStart:dateRange[0]??void 0,dateEnd:dateRange[1]??void 0,companyIds:companies?.map(x=>+x),jobNames:jobs}}).then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true})}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var date_fns_index_js_=__webpack_require__(4365);function useCompaniesQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","companies"],queryFn:async()=>await api.getCompanies().then(x=>x.data)});return query}function useJobsDefaultQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","jobs","defaults"],queryFn:async()=>await api.synchro.getJobsDefaultsV1().then(x=>x.data)});return query}function SynchroApp(){const[gasOnly,setGasOnly]=(0,index_js_.useState)("nodejs");const[dateRange,setDateRange]=(0,index_js_.useState)([(0,date_fns_index_js_.formatISO)((0,date_fns_index_js_.startOfDay)(new Date)),(0,date_fns_index_js_.formatISO)((0,date_fns_index_js_.endOfDay)(new Date))]);const[companies,setCompanies]=(0,index_js_.useState)([]);const[jobs,setJobs]=(0,index_js_.useState)([]);const companiesResult=useCompaniesQuery();const companiesList=(companiesResult.data?.list??[]).map(company=>({value:company.id.toString(),label:company.display_name??company.id.toString()}));const jobsDefaultResult=useJobsDefaultQuery();const jobsDefaultList=(jobsDefaultResult.data?.list??[]).map(jobDefault=>jobDefault.task);const statsResult=useSynchroStatsQuery();const stats=statsResult.data;const tasksListResult=useSynchroTasks({gas:gasOnly,dateRange,companies,jobs});const tasksList=tasksListResult.data;const resetFn=useResetStatsMutation();function resolveStatus(element){if(!element.ready)return"en attente";if(element.need_gas)return element.gas_started?"GAS en cours":"GAS en attente";return element.finished?"fini":"en cours"}const rows=(tasksList?.tasks??[]).map(element=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.id}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[element.need_gas?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconOld,{title:"papi GAS"}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconBolt,{title:"fougueux nodejs"})," ",element.job_name,/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),/*#__PURE__*/(0,jsx_runtime.jsx)("small",{children:element.job_name_fr})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(element.created,"dd/MM/yyyy HH:mm:ss")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.startedAt?(0,date_fns_index_js_.format)(element.startedAt,"dd/MM/yyyy HH:mm:ss"):""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:resolveStatus(element)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.owner}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.main_company?.display_name}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:element.github_job,title:"Github runner",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${element.recipe_uuid}-${element.id}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{title:"Logs",size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:"gray",size:"compact-sm",onClick:()=>console.log(`coucou ${element.id}`),children:"log"}),element.finished?/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",onClick:async()=>{console.log("stop",element.id)},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconHandStop,{title:"Stop",size:20})})]})]},element.id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:stats&&Object.entries(stats.currentJobsCounters).map(([key,value])=>/*#__PURE__*/(0,jsx_runtime.jsxs)("li",{children:[key,": ",value.db," db, ",value.redis," redis",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:value.db!=value.redis?"red":"green",onClick:async()=>{await resetFn.mutateAsync({owner:key,value:(value.db??0).toString()});await statsResult.refetch()},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRefreshDot,{size:20})})]},key))}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{align:"flex-end",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"GAS et/ou nodejs",data:[{value:"all",label:"Toutes"},{value:"nodejs",label:"nodejs seulement"},{value:"gas",label:"GAS seulement"}],value:gasOnly,onChange:v=>setGasOnly(v??"nodejs"),w:140}),/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.DatePickerInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconCalendar,{size:18}),type:"range",label:"Date de cr\xe9ation",placeholder:"S\xe9lectionner une plage",value:dateRange,onChange:setDateRange,clearable:true,allowSingleDateInRange:true,w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MultiSelect,{label:"Client",placeholder:"S\xe9lectionner un ou plusieurs clients",data:companiesList,onChange:setCompanies,searchable:true,clearable:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MultiSelect,{label:"Fonction",placeholder:"S\xe9lectionner une ou plusieurs fonctions",data:jobsDefaultList,onChange:setJobs,searchable:true,clearable:true})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{stickyHeader:true,striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders: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,{children:"ID"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Fonction"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Demand\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"D\xe9mar\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Owner"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Client"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Liens"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows})]})]})}function Synchro(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)(SynchroApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["2124"],{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"})})}},9098:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Synchro});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(9038);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSynchroStatsQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","stats"],queryFn:async()=>await api.synchro.getRunStatsV1().then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var tabler_icons_react_mjs_=__webpack_require__(9632);var notifications_esm_index_mjs_=__webpack_require__(1455);function useResetStatsMutation(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useMutation)({mutationFn:async values=>await api.synchro.resetOwnerStatsV1(values).then(x=>x.data),onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Cible remise \xe0 niveau",message:"C'est reparti comme en 40"})},onError:(error,variables,context)=>{console.error(error,variables,context);notifications_esm_index_mjs_.notifications.show({color:"red",title:"Erreur !",message:"Nous rencontrons un soucis technique. Veuillez r\xe9essayer plus tard."})}});return query}function useSynchroTasks({gas,dateRange,companies,jobs}){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","tasks","list",{gas,dateRange,companies,jobs}],queryFn:async()=>await api.synchro.getTasksV1({...gas&&{gas},...dateRange&&{dateStart:dateRange[0]??void 0,dateEnd:dateRange[1]??void 0,companyIds:companies?.map(x=>+x),jobNames:jobs}}).then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true})}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var date_fns_index_js_=__webpack_require__(4365);function useCompaniesQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","companies"],queryFn:async()=>await api.getCompanies().then(x=>x.data)});return query}function useJobsDefaultQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","jobs","defaults"],queryFn:async()=>await api.synchro.getJobsDefaultsV1().then(x=>x.data)});return query}function SynchroApp(){const[gasOnly,setGasOnly]=(0,index_js_.useState)("nodejs");const[dateRange,setDateRange]=(0,index_js_.useState)([(0,date_fns_index_js_.formatISO)((0,date_fns_index_js_.startOfDay)(new Date)),(0,date_fns_index_js_.formatISO)((0,date_fns_index_js_.endOfDay)(new Date))]);const[companies,setCompanies]=(0,index_js_.useState)([]);const[jobs,setJobs]=(0,index_js_.useState)([]);const companiesResult=useCompaniesQuery();const companiesList=(companiesResult.data?.list??[]).map(company=>({value:company.id.toString(),label:company.display_name??company.id.toString()}));const jobsDefaultResult=useJobsDefaultQuery();const jobsDefaultList=(jobsDefaultResult.data?.list??[]).map(jobDefault=>jobDefault.task);const statsResult=useSynchroStatsQuery();const stats=statsResult.data;const tasksListResult=useSynchroTasks({gas:gasOnly,dateRange,companies,jobs});const tasksList=tasksListResult.data;const resetFn=useResetStatsMutation();function resolveStatus(element){if(!element.ready)return"en attente";if(element.need_gas)return element.gas_started?"GAS en cours":"GAS en attente";return element.finished?"fini":"en cours"}const rows=(tasksList?.tasks??[]).map(element=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.id}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[element.need_gas?/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconOld,{title:"papi GAS"}):/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconBolt,{title:"fougueux nodejs"})," ",element.job_name,/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),/*#__PURE__*/(0,jsx_runtime.jsx)("small",{children:element.job_name_fr})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(element.created,"dd/MM/yyyy HH:mm:ss")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.startedAt?(0,date_fns_index_js_.format)(element.startedAt,"dd/MM/yyyy HH:mm:ss"):""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:resolveStatus(element)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.owner}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.main_company?.display_name}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:element.github_job,title:"Github runner",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${element.recipe_uuid}-${element.id}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{title:"Logs",size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:"gray",size:"compact-sm",onClick:()=>console.log(`coucou ${element.id}`),children:"log"}),element.finished?/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",onClick:async()=>{console.log("stop",element.id)},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconHandStop,{title:"Stop",size:20})})]})]},element.id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:stats&&Object.entries(stats.currentJobsCounters).map(([key,value])=>/*#__PURE__*/(0,jsx_runtime.jsxs)("li",{children:[key,": ",value.db," db, ",value.redis," redis",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:value.db!=value.redis?"red":"green",onClick:async()=>{await resetFn.mutateAsync({owner:key,value:(value.db??0).toString()});await statsResult.refetch()},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRefreshDot,{size:20})})]},key))}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{align:"flex-end",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"GAS et/ou nodejs",data:[{value:"all",label:"Toutes"},{value:"nodejs",label:"nodejs seulement"},{value:"gas",label:"GAS seulement"}],value:gasOnly,onChange:v=>setGasOnly(v??"nodejs"),w:140}),/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.DatePickerInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconCalendar,{size:18}),type:"range",label:"Date de cr\xe9ation",placeholder:"S\xe9lectionner une plage",value:dateRange,onChange:setDateRange,clearable:true,allowSingleDateInRange:true,w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MultiSelect,{label:"Client",placeholder:"S\xe9lectionner un ou plusieurs clients",data:companiesList,onChange:setCompanies,searchable:true,clearable:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.MultiSelect,{label:"Fonction",placeholder:"S\xe9lectionner une ou plusieurs fonctions",data:jobsDefaultList,onChange:setJobs,searchable:true,clearable:true})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{stickyHeader:true,striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders: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,{children:"ID"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Fonction"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Demand\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"D\xe9mar\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Owner"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Client"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Liens"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows})]})]})}function Synchro(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)(SynchroApp,{})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["4927"],{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 _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__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,leading,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.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:[leading,/*#__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__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},6592:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Usage});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var tabler_icons_react_mjs_=__webpack_require__(9632);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);const STALE_MS=6e4;const DAY_REFETCH_MS=3e5;function chargeKey(view,trigger,at){return["tech","usage","charge",view,trigger,at??null]}function chargeParams(view,trigger,at){return{view,..."all"===trigger?{}:{trigger},...at?{at}:{}}}function useUsageCharge(view,trigger,at){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:chargeKey(view,trigger,at),queryFn:async()=>{const response=await api.http.request({path:"/v1/usage/charge",method:"GET",query:chargeParams(view,trigger,at),format:"json"});return response.data},placeholderData:modern_index_js_.keepPreviousData,staleTime:STALE_MS,refetchInterval:"day"===view?DAY_REFETCH_MS:false,refetchOnWindowFocus:false})}function useUsageChargePrefetch(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(view,trigger,at)=>{queryClient.prefetchQuery({queryKey:chargeKey(view,trigger,at),queryFn:async()=>{const response=await api.http.request({path:"/v1/usage/charge",method:"GET",query:chargeParams(view,trigger,at),format:"json"});return response.data},staleTime:STALE_MS})}}var PageHeader=__webpack_require__(1354);const OPTIONS=[{value:"all",label:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Tout"})},{value:"auto",label:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRobot,{size:16,stroke:1.5}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Robots"})]})},{value:"human",label:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconUser,{size:16,stroke:1.5}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Humains"})]})}];const HINT="Robots = planificateur et crons d\xe9di\xe9s. Humains = run lanc\xe9 depuis l’app ; c’est un plancher, les runs pass\xe9s par l’ancienne API sont compt\xe9s comme planifi\xe9s.";function TriggerFilter(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:HINT,multiline:true,w:320,withArrow:true,position:"bottom",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:props.value,onChange:next=>props.onChange(next),data:OPTIONS,size:"xs"})})}const SERVICE_LEVEL_MINUTES=15;const USAGE_COLORS={productive:"#3987e5",errored:"#d03b3b",noop:"#fab219"};const AXIS_INK="#898781";function formatHours(hours){if(hours>=100)return`${Math.round(hours)} h`;return`${hours.toFixed(1).replace(".",",")} h`}function formatCount(value){return new Intl.NumberFormat("fr-FR").format(value)}function formatCompactCount(value){return new Intl.NumberFormat("fr-FR",{notation:"compact",maximumFractionDigits:1}).format(value)}function servicePercent(under,measured){if(measured<=0)return 0;return Math.round(under/measured*100)}function wastePercent(kpis){if(kpis.computeHours<=0)return 0;return Math.round((kpis.erroredHours+kpis.noopHours)/kpis.computeHours*100)}function UsageKpiRow(props){const{kpis}=props;const tiles=[{key:"compute",label:"Compute",value:formatHours(kpis.computeHours),hint:`${formatCount(kpis.tasks)} t\xe2ches, dont ${formatCount(kpis.worksheetTasks)} worksheets`},{key:"companies",label:"Entreprises actives",value:formatCount(kpis.companies),hint:`${formatCount(kpis.distinctJobs)} connecteurs distincts`},{key:"waste",label:"Compute non productif",value:`${formatHours(kpis.erroredHours+kpis.noopHours)} \xb7 ${wastePercent(kpis)} %`,hint:`${formatHours(kpis.erroredHours)} en erreur (${formatCount(kpis.erroredTasks)} t\xe2ches), ${formatHours(kpis.noopHours)} sans r\xe9sultat`,accent:USAGE_COLORS.errored},{key:"concurrency",label:"Concurrence max",value:null===kpis.maxConcurrent?"—":`${formatCount(kpis.maxConcurrent)} t\xe2ches`,hint:null===kpis.maxConcurrent?"Non calcul\xe9 sur 12 mois : trop co\xfbteux \xe0 recouvrir":"Pic de t\xe2ches simultan\xe9es, dur\xe9e born\xe9e \xe0 110 min"},{key:"service",label:`D\xe9marrage < ${SERVICE_LEVEL_MINUTES} min`,value:kpis.waitMeasured>0?`${servicePercent(kpis.waitLe15,kpis.waitMeasured)} %`:"—",hint:kpis.waitMeasured>0?`${servicePercent(kpis.waitLe30,kpis.waitMeasured)} % sous 30 min, ${servicePercent(kpis.waitLe60,kpis.waitMeasured)} % sous 1 h, ${servicePercent(kpis.waitLe240,kpis.waitMeasured)} % sous 4 h \u{2014} sur ${formatCount(kpis.waitMeasured)} t\xe2ches r\xe9ellement ex\xe9cut\xe9es`:"Aucune t\xe2che ex\xe9cut\xe9e sur la p\xe9riode"},{key:"abandoned",label:"Synchros perdues",value:formatCount(kpis.abandonedTasks),hint:0===kpis.abandonedTasks?"Aucune synchro abandonn\xe9e sur la p\xe9riode":`Abandonn\xe9es apr\xe8s 3 d\xe9blocages, sans jamais avoir tourn\xe9. ${formatHours(kpis.abandonedFabricatedHours)} de dur\xe9e fictive exclues du compute.`,accent:kpis.abandonedTasks>0?USAGE_COLORS.errored:void 0},{key:"rows",label:"Lignes synchronis\xe9es",value:formatCompactCount(kpis.rowsSynced),hint:"Somme des compteurs renvoy\xe9s par les jobs — proxy de tendance"}];return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3,lg:4,xl:7},spacing:"md",children:tiles.map(tile=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,align:"center",mb:6,children:[tile.accent?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{"aria-hidden":true,style:{width:8,height:8,borderRadius:2,background:tile.accent,display:"inline-block"}}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:700,children:tile.label})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:tile.hint,withArrow:true,multiline:true,w:260,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:26,fw:600,lh:1.1,children:tile.value})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",mt:6,lineClamp:2,children:tile.hint})]},tile.key))})}var esm_index_mjs_=__webpack_require__(7183);const PARIS_TZ="Europe/Paris";const minuteFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,hour:"2-digit",minute:"2-digit"});const weekDayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,weekday:"short",day:"numeric"});const monthFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,month:"short",year:"2-digit"});const fullDayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,weekday:"long",day:"numeric",month:"long"});function bucketDate(t){if(7===t.length)return new Date(`${t}-15T12:00:00Z`);return new Date(`${t}T12:00:00Z`)}function formatMinuteTick(iso){return minuteFormatter.format(new Date(iso))}function formatBucketTick(t,view){if("year"===view)return monthFormatter.format(bucketDate(t));if("month"===view)return String(bucketDate(t).getUTCDate());return weekDayFormatter.format(bucketDate(t))}function formatBucketLong(t,view){if("year"===view)return monthFormatter.format(bucketDate(t));return fullDayFormatter.format(bucketDate(t))}function formatWindow(from,to,view){if("day"===view)return fullDayFormatter.format(new Date(from));if("year"===view){const start=monthFormatter.format(new Date(from));const end=monthFormatter.format(new Date(new Date(to).getTime()-1));return`${start} \u{2192} ${end}`}const start=fullDayFormatter.format(new Date(from));const end=fullDayFormatter.format(new Date(new Date(to).getTime()-1));return`${start} \u{2192} ${end}`}function ConcurrencyTooltip({payload}){const point=payload?.[0]?.payload;if(!point)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatMinuteTick(point.t)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[point.concurrent," t\xe2che",point.concurrent>1?"s":""," en cours"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[point.started," d\xe9marrage",point.started>1?"s":""]}),point.errored>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:[point.errored," en erreur"]}):null]})}function ConcurrencyChart(props){const{data}=props;if(0===data.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Aucune t\xe2che sur la journ\xe9e."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.AreaChart,{h:260,data:data,dataKey:"t",withDots:false,strokeWidth:2,curveType:"linear",gridAxis:"y",tickLine:"none",series:[{name:"concurrent",label:"T\xe2ches en cours",color:USAGE_COLORS.productive}],xAxisProps:{tickFormatter:formatMinuteTick,minTickGap:48,stroke:AXIS_INK},yAxisProps:{allowDecimals:false,stroke:AXIS_INK,width:32},tooltipProps:{content:ConcurrencyTooltip},tooltipAnimationDuration:0})}const SURFACE="var(--mantine-color-body)";const SERIES=[{name:"productiveHours",label:"Productif",color:USAGE_COLORS.productive},{name:"noopHours",label:"Sans r\xe9sultat",color:USAGE_COLORS.noop},{name:"erroredHours",label:"En erreur",color:USAGE_COLORS.errored}];const TOP_SERIES=SERIES[SERIES.length-1].name;function makeTooltip(view){return function({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[formatHours(bucket.computeHours)," de compute"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:["dont ",formatHours(bucket.erroredHours)," en erreur (",formatCount(bucket.erroredTasks)," t\xe2ches)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["dont ",formatHours(bucket.noopHours)," sans r\xe9sultat"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:[formatCount(bucket.tasks)," t\xe2ches \xb7"," ",formatCount(bucket.worksheetTasks)," worksheets"]}),bucket.waitMaxMinutes?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["attente max ",Math.round(bucket.waitMaxMinutes)," min"]}):null]})}}function ChargeStack(props){const{buckets,view}=props;if(0===buckets.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Aucune t\xe2che sur la p\xe9riode."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:300,data:buckets,dataKey:"t",type:"stacked",withLegend:true,legendProps:{verticalAlign:"top",height:32},gridAxis:"y",tickLine:"none",unit:" h",series:SERIES,barProps:item=>({stroke:SURFACE,strokeWidth:1.5,strokeOpacity:1,radius:item.name===TOP_SERIES?[4,4,0,0]:0}),xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:44},tooltipProps:{content:makeTooltip(view)},tooltipAnimationDuration:0})}function AbandonedChart_makeTooltip(view){return function({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:[formatCount(bucket.abandonedTasks)," synchro",bucket.abandonedTasks>1?"s":""," perdue",bucket.abandonedTasks>1?"s":""]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["sur ",formatCount(bucket.tasks)," t\xe2ches cr\xe9\xe9es"]})]})}}function AbandonedChart(props){const{buckets,view}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:180,data:buckets,dataKey:"t",gridAxis:"y",tickLine:"none",series:[{name:"abandonedTasks",label:"Synchros perdues",color:USAGE_COLORS.errored}],barProps:{radius:[4,4,0,0]},xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:44,allowDecimals:false},tooltipProps:{content:AbandonedChart_makeTooltip(view)},tooltipAnimationDuration:0})}function toPoints(buckets){return buckets.map(b=>({t:b.t,service:servicePercent(b.waitLe15,b.waitMeasured),under30:servicePercent(b.waitLe30,b.waitMeasured),under60:servicePercent(b.waitLe60,b.waitMeasured),measured:b.waitMeasured}))}function ServiceLevelChart_makeTooltip(view){return function({payload}){const point=payload?.[0]?.payload;if(!point)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(point.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.productive,children:[point.service," % d\xe9marr\xe9es sous ",SERVICE_LEVEL_MINUTES," min"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[point.under30," % sous 30 min \xb7 ",point.under60," % sous 1 h"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:["sur ",formatCount(point.measured)," t\xe2ches ex\xe9cut\xe9es"]})]})}}function ServiceLevelChart(props){const{buckets,view}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.LineChart,{h:180,data:toPoints(buckets),dataKey:"t",gridAxis:"y",tickLine:"none",unit:" %",withDots:buckets.length<=40,series:[{name:"service",label:`D\xe9marr\xe9es sous ${SERVICE_LEVEL_MINUTES} min`,color:USAGE_COLORS.productive}],xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:48,domain:[0,100],allowDecimals:false},tooltipProps:{content:ServiceLevelChart_makeTooltip(view)},tooltipAnimationDuration:0})}const TRACTION_SERIES=[{name:"companies",label:"Entreprises actives",color:"#3987e5"},{name:"distinctJobs",label:"Connecteurs distincts",color:"#d95926"}];function TractionTooltip({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,"year")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[bucket.companies??0," entreprises actives"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[bucket.distinctJobs??0," connecteurs distincts"]})]})}function TractionChart(props){const{buckets}=props;if(0===buckets.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Pas d'historique sur la p\xe9riode."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.LineChart,{h:240,data:buckets,dataKey:"t",withLegend:true,legendProps:{verticalAlign:"top",height:32},strokeWidth:2,dotProps:{r:4},activeDotProps:{r:6},gridAxis:"y",tickLine:"none",series:TRACTION_SERIES,xAxisProps:{tickFormatter:t=>formatBucketTick(t,"year"),stroke:AXIS_INK},yAxisProps:{allowDecimals:false,stroke:AXIS_INK,width:40},tooltipProps:{content:TractionTooltip},tooltipAnimationDuration:0})}function ShareBar(props){const{hours,erroredHours,max}=props;if(max<=0)return null;const total=hours/max*100;const errored=Math.min(erroredHours,hours)/max*100;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Progress.Root,{size:"md",w:140,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Progress.Section,{value:Math.max(total-errored,0),color:USAGE_COLORS.productive}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Progress.Section,{value:errored,color:USAGE_COLORS.errored})]})}function LostCell(props){if(0===props.count)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",children:"—"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums",color:USAGE_COLORS.errored,fontWeight:600},children:formatCount(props.count)})}function TopCompaniesTable(props){const{rows,totalHours}=props;const max=rows.length>0?rows[0].computeHours:0;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,striped:false,verticalSpacing:"xs",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:32,children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:150,children:"Part"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:90,ta:"right",children:"Compute"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:70,ta:"right",children:"% total"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:100,ta:"right",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:80,ta:"right",children:"Perdues"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map((row,index)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:"dimmed",children:index+1}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:row.displayName??row.slug??`#${row.companyId}`}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:row.slug??`company ${row.companyId}`})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{withArrow:true,label:`${formatHours(row.erroredHours)} en erreur sur ${formatHours(row.computeHours)}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ShareBar,{hours:row.computeHours,erroredHours:row.erroredHours,max:max})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums"},children:formatHours(row.computeHours)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:totalHours>0?`${Math.round(row.computeHours/totalHours*100)} %`:"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:formatCount(row.tasks)}),/*#__PURE__*/(0,jsx_runtime.jsx)(LostCell,{count:row.abandonedTasks})]},row.companyId))})]})}function TopJobsTable(props){const{rows,totalHours}=props;const max=rows.length>0?rows[0].computeHours:0;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,verticalSpacing:"xs",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:32,children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:150,children:"Part"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:90,ta:"right",children:"Compute"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:70,ta:"right",children:"% total"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:110,ta:"right",children:"h / entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:80,ta:"right",children:"Perdues"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map((row,index)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:"dimmed",children:index+1}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:row.jobName}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",children:[formatCount(row.companies)," entreprise",row.companies>1?"s":""," \xb7 ",formatCount(row.tasks)," t\xe2ches"]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{withArrow:true,label:`${formatHours(row.erroredHours)} en erreur sur ${formatHours(row.computeHours)}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ShareBar,{hours:row.computeHours,erroredHours:row.erroredHours,max:max})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums"},children:formatHours(row.computeHours)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:totalHours>0?`${Math.round(row.computeHours/totalHours*100)} %`:"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:row.companies>0?formatHours(row.computeHours/row.companies):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LostCell,{count:row.abandonedTasks})]},row.jobName))})]})}var date_fns_index_js_=__webpack_require__(4365);function shiftPeriod(view,at,direction){if("week"===view)return(0,date_fns_index_js_.addWeeks)(at,direction);if("month"===view)return(0,date_fns_index_js_.addMonths)(at,direction);if("year"===view)return(0,date_fns_index_js_.addMonths)(at,12*direction);return(0,date_fns_index_js_.addDays)(at,direction)}function canGoForward(view,at,now){return shiftPeriod(view,at,1).getTime()<=now.getTime()}const RESET_LABEL={day:"Aujourd'hui",week:"Cette semaine",month:"Ce mois",year:"12 derniers mois"};const VIEW_OPTIONS=[{value:"day",label:"Jour"},{value:"week",label:"Semaine"},{value:"month",label:"Mois"},{value:"year",label:"12 mois"}];const CHART_TITLES={day:"T\xe2ches simultan\xe9es, minute par minute",week:"Compute par jour (lundi → dimanche)",month:"Compute par jour du mois",year:"Compute par mois"};function SectionTitle(props){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"baseline",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:600,children:props.children}),props.hint?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:props.hint}):null]})}function UsageApp(){const[view,setView]=(0,index_js_.useState)("day");const[at,setAt]=(0,index_js_.useState)(null);const[trigger,setTrigger]=(0,index_js_.useState)("all");const charge=useUsageCharge(view,trigger,at?at.toISOString():void 0);const prefetch=useUsageChargePrefetch();const data=charge.data;const reference=at??new Date;const forwardDisabled=null===at||!canGoForward(view,reference,new Date);(0,index_js_.useEffect)(()=>{if(charge.isFetching)return;const previous=shiftPeriod(view,at??new Date,-1);prefetch(view,trigger,previous.toISOString())},[view,at,trigger,charge.isFetching]);const goto=direction=>{const next=shiftPeriod(view,reference,direction);setAt(next)};const changeView=next=>{setView(next);setAt(null)};return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Usage & charge",updatedAt:charge.dataUpdatedAt,isFetching:charge.isFetching,isError:charge.isError,onRefresh:()=>charge.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"center",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"md",align:"center",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:view,onChange:value=>changeView(value),data:VIEW_OPTIONS}),/*#__PURE__*/(0,jsx_runtime.jsx)(TriggerFilter,{value:trigger,onChange:setTrigger})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",align:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",size:"lg","aria-label":"P\xe9riode pr\xe9c\xe9dente",onClick:()=>goto(-1),children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronLeft,{size:18})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",ta:"center",miw:280,children:data?`${formatWindow(data.from,data.to,data.view)} \xb7 heure de Paris`:"…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",size:"lg","aria-label":"P\xe9riode suivante",disabled:forwardDisabled,onClick:()=>goto(1),children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronRight,{size:18})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:"gray",size:"xs",disabled:null===at,onClick:()=>setAt(null),children:RESET_LABEL[view]})]})]}),charge.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Impossible de charger la charge",children:String(charge.error)}):null,data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",style:{opacity:charge.isPlaceholderData?.45:1,transition:"opacity 150ms ease",pointerEvents:charge.isPlaceholderData?"none":void 0},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(UsageKpiRow,{kpis:data.kpis}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"day"===view?"dur\xe9e born\xe9e \xe0 110 min — au-del\xe0, une t\xe2che est perdue, pas en cours":"heures de compute, d\xe9compos\xe9es par issue",children:CHART_TITLES[view]}),"day"===view?/*#__PURE__*/(0,jsx_runtime.jsx)(ConcurrencyChart,{data:data.concurrency}):/*#__PURE__*/(0,jsx_runtime.jsx)(ChargeStack,{buckets:data.buckets,view:data.view})]}),"year"===view?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"deux d\xe9nombrements, un seul axe",children:"Traction — entreprises actives et connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TractionChart,{buckets:data.buckets})]}):null,"day"===view&&data.buckets.length>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"d\xe9composition du compute de la journ\xe9e",children:"Compute de la journ\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(ChargeStack,{buckets:data.buckets,view:data.view})]}):null,data.buckets.length>1?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"cr\xe9ation → ex\xe9cution, sur les t\xe2ches r\xe9ellement ex\xe9cut\xe9es",children:"D\xe9lai de mise en route"}),/*#__PURE__*/(0,jsx_runtime.jsx)(ServiceLevelChart,{buckets:data.buckets,view:data.view})]}):null,data.kpis.abandonedTasks>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"abandonn\xe9es apr\xe8s 3 d\xe9blocages, sans jamais avoir tourn\xe9",children:"Synchros perdues"}),/*#__PURE__*/(0,jsx_runtime.jsx)(AbandonedChart,{buckets:data.buckets,view:data.view})]}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",h:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"classement, pas de moyenne",children:"Top consommateurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TopCompaniesTable,{rows:data.topCompanies,totalHours:data.kpis.computeHours})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",h:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"brique de tarification du free",children:"Co\xfbt par connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TopJobsTable,{rows:data.topJobs,totalHours:data.kpis.computeHours})]})})]})]}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:96}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300})]})]})})}function Usage(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)(UsageApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["4927"],{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 _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(9735);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,leading,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.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:[leading,/*#__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__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},6592:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Usage});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var tabler_icons_react_mjs_=__webpack_require__(9632);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);const STALE_MS=6e4;const DAY_REFETCH_MS=3e5;function chargeKey(view,trigger,at){return["tech","usage","charge",view,trigger,at??null]}function chargeParams(view,trigger,at){return{view,..."all"===trigger?{}:{trigger},...at?{at}:{}}}function useUsageCharge(view,trigger,at){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:chargeKey(view,trigger,at),queryFn:async()=>{const response=await api.http.request({path:"/v1/usage/charge",method:"GET",query:chargeParams(view,trigger,at),format:"json"});return response.data},placeholderData:modern_index_js_.keepPreviousData,staleTime:STALE_MS,refetchInterval:"day"===view?DAY_REFETCH_MS:false,refetchOnWindowFocus:false})}function useUsageChargePrefetch(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(view,trigger,at)=>{queryClient.prefetchQuery({queryKey:chargeKey(view,trigger,at),queryFn:async()=>{const response=await api.http.request({path:"/v1/usage/charge",method:"GET",query:chargeParams(view,trigger,at),format:"json"});return response.data},staleTime:STALE_MS})}}var PageHeader=__webpack_require__(1354);const OPTIONS=[{value:"all",label:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Tout"})},{value:"auto",label:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRobot,{size:16,stroke:1.5}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Robots"})]})},{value:"human",label:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconUser,{size:16,stroke:1.5}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:"Humains"})]})}];const HINT="Robots = planificateur et crons d\xe9di\xe9s. Humains = run lanc\xe9 depuis l’app ; c’est un plancher, les runs pass\xe9s par l’ancienne API sont compt\xe9s comme planifi\xe9s.";function TriggerFilter(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:HINT,multiline:true,w:320,withArrow:true,position:"bottom",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:props.value,onChange:next=>props.onChange(next),data:OPTIONS,size:"xs"})})}const SERVICE_LEVEL_MINUTES=15;const USAGE_COLORS={productive:"#3987e5",errored:"#d03b3b",noop:"#fab219"};const AXIS_INK="#898781";function formatHours(hours){if(hours>=100)return`${Math.round(hours)} h`;return`${hours.toFixed(1).replace(".",",")} h`}function formatCount(value){return new Intl.NumberFormat("fr-FR").format(value)}function formatCompactCount(value){return new Intl.NumberFormat("fr-FR",{notation:"compact",maximumFractionDigits:1}).format(value)}function servicePercent(under,measured){if(measured<=0)return 0;return Math.round(under/measured*100)}function wastePercent(kpis){if(kpis.computeHours<=0)return 0;return Math.round((kpis.erroredHours+kpis.noopHours)/kpis.computeHours*100)}function UsageKpiRow(props){const{kpis}=props;const tiles=[{key:"compute",label:"Compute",value:formatHours(kpis.computeHours),hint:`${formatCount(kpis.tasks)} t\xe2ches, dont ${formatCount(kpis.worksheetTasks)} worksheets`},{key:"companies",label:"Entreprises actives",value:formatCount(kpis.companies),hint:`${formatCount(kpis.distinctJobs)} connecteurs distincts`},{key:"waste",label:"Compute non productif",value:`${formatHours(kpis.erroredHours+kpis.noopHours)} \xb7 ${wastePercent(kpis)} %`,hint:`${formatHours(kpis.erroredHours)} en erreur (${formatCount(kpis.erroredTasks)} t\xe2ches), ${formatHours(kpis.noopHours)} sans r\xe9sultat`,accent:USAGE_COLORS.errored},{key:"concurrency",label:"Concurrence max",value:null===kpis.maxConcurrent?"—":`${formatCount(kpis.maxConcurrent)} t\xe2ches`,hint:null===kpis.maxConcurrent?"Non calcul\xe9 sur 12 mois : trop co\xfbteux \xe0 recouvrir":"Pic de t\xe2ches simultan\xe9es, dur\xe9e born\xe9e \xe0 110 min"},{key:"service",label:`D\xe9marrage < ${SERVICE_LEVEL_MINUTES} min`,value:kpis.waitMeasured>0?`${servicePercent(kpis.waitLe15,kpis.waitMeasured)} %`:"—",hint:kpis.waitMeasured>0?`${servicePercent(kpis.waitLe30,kpis.waitMeasured)} % sous 30 min, ${servicePercent(kpis.waitLe60,kpis.waitMeasured)} % sous 1 h, ${servicePercent(kpis.waitLe240,kpis.waitMeasured)} % sous 4 h \u{2014} sur ${formatCount(kpis.waitMeasured)} t\xe2ches r\xe9ellement ex\xe9cut\xe9es`:"Aucune t\xe2che ex\xe9cut\xe9e sur la p\xe9riode"},{key:"abandoned",label:"Synchros perdues",value:formatCount(kpis.abandonedTasks),hint:0===kpis.abandonedTasks?"Aucune synchro abandonn\xe9e sur la p\xe9riode":`Abandonn\xe9es apr\xe8s 3 d\xe9blocages, sans jamais avoir tourn\xe9. ${formatHours(kpis.abandonedFabricatedHours)} de dur\xe9e fictive exclues du compute.`,accent:kpis.abandonedTasks>0?USAGE_COLORS.errored:void 0},{key:"rows",label:"Lignes synchronis\xe9es",value:formatCompactCount(kpis.rowsSynced),hint:"Somme des compteurs renvoy\xe9s par les jobs — proxy de tendance"}];return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3,lg:4,xl:7},spacing:"md",children:tiles.map(tile=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:6,align:"center",mb:6,children:[tile.accent?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{"aria-hidden":true,style:{width:8,height:8,borderRadius:2,background:tile.accent,display:"inline-block"}}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:700,children:tile.label})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{label:tile.hint,withArrow:true,multiline:true,w:260,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:26,fw:600,lh:1.1,children:tile.value})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",mt:6,lineClamp:2,children:tile.hint})]},tile.key))})}var esm_index_mjs_=__webpack_require__(7183);const PARIS_TZ="Europe/Paris";const minuteFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,hour:"2-digit",minute:"2-digit"});const weekDayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,weekday:"short",day:"numeric"});const monthFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,month:"short",year:"2-digit"});const fullDayFormatter=new Intl.DateTimeFormat("fr-FR",{timeZone:PARIS_TZ,weekday:"long",day:"numeric",month:"long"});function bucketDate(t){if(7===t.length)return new Date(`${t}-15T12:00:00Z`);return new Date(`${t}T12:00:00Z`)}function formatMinuteTick(iso){return minuteFormatter.format(new Date(iso))}function formatBucketTick(t,view){if("year"===view)return monthFormatter.format(bucketDate(t));if("month"===view)return String(bucketDate(t).getUTCDate());return weekDayFormatter.format(bucketDate(t))}function formatBucketLong(t,view){if("year"===view)return monthFormatter.format(bucketDate(t));return fullDayFormatter.format(bucketDate(t))}function formatWindow(from,to,view){if("day"===view)return fullDayFormatter.format(new Date(from));if("year"===view){const start=monthFormatter.format(new Date(from));const end=monthFormatter.format(new Date(new Date(to).getTime()-1));return`${start} \u{2192} ${end}`}const start=fullDayFormatter.format(new Date(from));const end=fullDayFormatter.format(new Date(new Date(to).getTime()-1));return`${start} \u{2192} ${end}`}function ConcurrencyTooltip({payload}){const point=payload?.[0]?.payload;if(!point)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatMinuteTick(point.t)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[point.concurrent," t\xe2che",point.concurrent>1?"s":""," en cours"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[point.started," d\xe9marrage",point.started>1?"s":""]}),point.errored>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:[point.errored," en erreur"]}):null]})}function ConcurrencyChart(props){const{data}=props;if(0===data.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Aucune t\xe2che sur la journ\xe9e."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.AreaChart,{h:260,data:data,dataKey:"t",withDots:false,strokeWidth:2,curveType:"linear",gridAxis:"y",tickLine:"none",series:[{name:"concurrent",label:"T\xe2ches en cours",color:USAGE_COLORS.productive}],xAxisProps:{tickFormatter:formatMinuteTick,minTickGap:48,stroke:AXIS_INK},yAxisProps:{allowDecimals:false,stroke:AXIS_INK,width:32},tooltipProps:{content:ConcurrencyTooltip},tooltipAnimationDuration:0})}const SURFACE="var(--mantine-color-body)";const SERIES=[{name:"productiveHours",label:"Productif",color:USAGE_COLORS.productive},{name:"noopHours",label:"Sans r\xe9sultat",color:USAGE_COLORS.noop},{name:"erroredHours",label:"En erreur",color:USAGE_COLORS.errored}];const TOP_SERIES=SERIES[SERIES.length-1].name;function makeTooltip(view){return function({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[formatHours(bucket.computeHours)," de compute"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:["dont ",formatHours(bucket.erroredHours)," en erreur (",formatCount(bucket.erroredTasks)," t\xe2ches)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["dont ",formatHours(bucket.noopHours)," sans r\xe9sultat"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:[formatCount(bucket.tasks)," t\xe2ches \xb7"," ",formatCount(bucket.worksheetTasks)," worksheets"]}),bucket.waitMaxMinutes?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["attente max ",Math.round(bucket.waitMaxMinutes)," min"]}):null]})}}function ChargeStack(props){const{buckets,view}=props;if(0===buckets.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Aucune t\xe2che sur la p\xe9riode."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:300,data:buckets,dataKey:"t",type:"stacked",withLegend:true,legendProps:{verticalAlign:"top",height:32},gridAxis:"y",tickLine:"none",unit:" h",series:SERIES,barProps:item=>({stroke:SURFACE,strokeWidth:1.5,strokeOpacity:1,radius:item.name===TOP_SERIES?[4,4,0,0]:0}),xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:44},tooltipProps:{content:makeTooltip(view)},tooltipAnimationDuration:0})}function AbandonedChart_makeTooltip(view){return function({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.errored,children:[formatCount(bucket.abandonedTasks)," synchro",bucket.abandonedTasks>1?"s":""," perdue",bucket.abandonedTasks>1?"s":""]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:["sur ",formatCount(bucket.tasks)," t\xe2ches cr\xe9\xe9es"]})]})}}function AbandonedChart(props){const{buckets,view}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.BarChart,{h:180,data:buckets,dataKey:"t",gridAxis:"y",tickLine:"none",series:[{name:"abandonedTasks",label:"Synchros perdues",color:USAGE_COLORS.errored}],barProps:{radius:[4,4,0,0]},xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:44,allowDecimals:false},tooltipProps:{content:AbandonedChart_makeTooltip(view)},tooltipAnimationDuration:0})}function toPoints(buckets){return buckets.map(b=>({t:b.t,service:servicePercent(b.waitLe15,b.waitMeasured),under30:servicePercent(b.waitLe30,b.waitMeasured),under60:servicePercent(b.waitLe60,b.waitMeasured),measured:b.waitMeasured}))}function ServiceLevelChart_makeTooltip(view){return function({payload}){const point=payload?.[0]?.payload;if(!point)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(point.t,view)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:USAGE_COLORS.productive,children:[point.service," % d\xe9marr\xe9es sous ",SERVICE_LEVEL_MINUTES," min"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",children:[point.under30," % sous 30 min \xb7 ",point.under60," % sous 1 h"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:["sur ",formatCount(point.measured)," t\xe2ches ex\xe9cut\xe9es"]})]})}}function ServiceLevelChart(props){const{buckets,view}=props;return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.LineChart,{h:180,data:toPoints(buckets),dataKey:"t",gridAxis:"y",tickLine:"none",unit:" %",withDots:buckets.length<=40,series:[{name:"service",label:`D\xe9marr\xe9es sous ${SERVICE_LEVEL_MINUTES} min`,color:USAGE_COLORS.productive}],xAxisProps:{tickFormatter:t=>formatBucketTick(t,view),stroke:AXIS_INK,minTickGap:4},yAxisProps:{stroke:AXIS_INK,width:48,domain:[0,100],allowDecimals:false},tooltipProps:{content:ServiceLevelChart_makeTooltip(view)},tooltipAnimationDuration:0})}const TRACTION_SERIES=[{name:"companies",label:"Entreprises actives",color:"#3987e5"},{name:"distinctJobs",label:"Connecteurs distincts",color:"#d95926"}];function TractionTooltip({payload}){const bucket=payload?.[0]?.payload;if(!bucket)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{px:"md",py:"sm",withBorder:true,shadow:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,mb:4,children:formatBucketLong(bucket.t,"year")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[bucket.companies??0," entreprises actives"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",children:[bucket.distinctJobs??0," connecteurs distincts"]})]})}function TractionChart(props){const{buckets}=props;if(0===buckets.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",size:"sm",children:"Pas d'historique sur la p\xe9riode."});return/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.LineChart,{h:240,data:buckets,dataKey:"t",withLegend:true,legendProps:{verticalAlign:"top",height:32},strokeWidth:2,dotProps:{r:4},activeDotProps:{r:6},gridAxis:"y",tickLine:"none",series:TRACTION_SERIES,xAxisProps:{tickFormatter:t=>formatBucketTick(t,"year"),stroke:AXIS_INK},yAxisProps:{allowDecimals:false,stroke:AXIS_INK,width:40},tooltipProps:{content:TractionTooltip},tooltipAnimationDuration:0})}function ShareBar(props){const{hours,erroredHours,max}=props;if(max<=0)return null;const total=hours/max*100;const errored=Math.min(erroredHours,hours)/max*100;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Progress.Root,{size:"md",w:140,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Progress.Section,{value:Math.max(total-errored,0),color:USAGE_COLORS.productive}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Progress.Section,{value:errored,color:USAGE_COLORS.errored})]})}function LostCell(props){if(0===props.count)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",children:"—"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums",color:USAGE_COLORS.errored,fontWeight:600},children:formatCount(props.count)})}function TopCompaniesTable(props){const{rows,totalHours}=props;const max=rows.length>0?rows[0].computeHours:0;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,striped:false,verticalSpacing:"xs",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:32,children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:150,children:"Part"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:90,ta:"right",children:"Compute"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:70,ta:"right",children:"% total"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:100,ta:"right",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:80,ta:"right",children:"Perdues"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map((row,index)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:"dimmed",children:index+1}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:row.displayName??row.slug??`#${row.companyId}`}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:row.slug??`company ${row.companyId}`})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{withArrow:true,label:`${formatHours(row.erroredHours)} en erreur sur ${formatHours(row.computeHours)}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ShareBar,{hours:row.computeHours,erroredHours:row.erroredHours,max:max})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums"},children:formatHours(row.computeHours)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:totalHours>0?`${Math.round(row.computeHours/totalHours*100)} %`:"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:formatCount(row.tasks)}),/*#__PURE__*/(0,jsx_runtime.jsx)(LostCell,{count:row.abandonedTasks})]},row.companyId))})]})}function TopJobsTable(props){const{rows,totalHours}=props;const max=rows.length>0?rows[0].computeHours:0;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{highlightOnHover:true,verticalSpacing:"xs",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:32,children:"#"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:150,children:"Part"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:90,ta:"right",children:"Compute"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:70,ta:"right",children:"% total"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:110,ta:"right",children:"h / entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{w:80,ta:"right",children:"Perdues"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map((row,index)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:"dimmed",children:index+1}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Td,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:row.jobName}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",children:[formatCount(row.companies)," entreprise",row.companies>1?"s":""," \xb7 ",formatCount(row.tasks)," t\xe2ches"]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tooltip,{withArrow:true,label:`${formatHours(row.erroredHours)} en erreur sur ${formatHours(row.computeHours)}`,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ShareBar,{hours:row.computeHours,erroredHours:row.erroredHours,max:max})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",style:{fontVariantNumeric:"tabular-nums"},children:formatHours(row.computeHours)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:totalHours>0?`${Math.round(row.computeHours/totalHours*100)} %`:"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{ta:"right",c:"dimmed",style:{fontVariantNumeric:"tabular-nums"},children:row.companies>0?formatHours(row.computeHours/row.companies):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LostCell,{count:row.abandonedTasks})]},row.jobName))})]})}var date_fns_index_js_=__webpack_require__(4365);function shiftPeriod(view,at,direction){if("week"===view)return(0,date_fns_index_js_.addWeeks)(at,direction);if("month"===view)return(0,date_fns_index_js_.addMonths)(at,direction);if("year"===view)return(0,date_fns_index_js_.addMonths)(at,12*direction);return(0,date_fns_index_js_.addDays)(at,direction)}function canGoForward(view,at,now){return shiftPeriod(view,at,1).getTime()<=now.getTime()}const RESET_LABEL={day:"Aujourd'hui",week:"Cette semaine",month:"Ce mois",year:"12 derniers mois"};const VIEW_OPTIONS=[{value:"day",label:"Jour"},{value:"week",label:"Semaine"},{value:"month",label:"Mois"},{value:"year",label:"12 mois"}];const CHART_TITLES={day:"T\xe2ches simultan\xe9es, minute par minute",week:"Compute par jour (lundi → dimanche)",month:"Compute par jour du mois",year:"Compute par mois"};function SectionTitle(props){return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"baseline",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:600,children:props.children}),props.hint?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:props.hint}):null]})}function UsageApp(){const[view,setView]=(0,index_js_.useState)("day");const[at,setAt]=(0,index_js_.useState)(null);const[trigger,setTrigger]=(0,index_js_.useState)("all");const charge=useUsageCharge(view,trigger,at?at.toISOString():void 0);const prefetch=useUsageChargePrefetch();const data=charge.data;const reference=at??new Date;const forwardDisabled=null===at||!canGoForward(view,reference,new Date);(0,index_js_.useEffect)(()=>{if(charge.isFetching)return;const previous=shiftPeriod(view,at??new Date,-1);prefetch(view,trigger,previous.toISOString())},[view,at,trigger,charge.isFetching]);const goto=direction=>{const next=shiftPeriod(view,reference,direction);setAt(next)};const changeView=next=>{setView(next);setAt(null)};return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Usage & charge",updatedAt:charge.dataUpdatedAt,isFetching:charge.isFetching,isError:charge.isError,onRefresh:()=>charge.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"center",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"md",align:"center",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{value:view,onChange:value=>changeView(value),data:VIEW_OPTIONS}),/*#__PURE__*/(0,jsx_runtime.jsx)(TriggerFilter,{value:trigger,onChange:setTrigger})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",align:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",size:"lg","aria-label":"P\xe9riode pr\xe9c\xe9dente",onClick:()=>goto(-1),children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronLeft,{size:18})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",ta:"center",miw:280,children:data?`${formatWindow(data.from,data.to,data.view)} \xb7 heure de Paris`:"…"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ActionIcon,{variant:"default",size:"lg","aria-label":"P\xe9riode suivante",disabled:forwardDisabled,onClick:()=>goto(1),children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconChevronRight,{size:18})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:"gray",size:"xs",disabled:null===at,onClick:()=>setAt(null),children:RESET_LABEL[view]})]})]}),charge.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Impossible de charger la charge",children:String(charge.error)}):null,data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",style:{opacity:charge.isPlaceholderData?.45:1,transition:"opacity 150ms ease",pointerEvents:charge.isPlaceholderData?"none":void 0},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(UsageKpiRow,{kpis:data.kpis}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"day"===view?"dur\xe9e born\xe9e \xe0 110 min — au-del\xe0, une t\xe2che est perdue, pas en cours":"heures de compute, d\xe9compos\xe9es par issue",children:CHART_TITLES[view]}),"day"===view?/*#__PURE__*/(0,jsx_runtime.jsx)(ConcurrencyChart,{data:data.concurrency}):/*#__PURE__*/(0,jsx_runtime.jsx)(ChargeStack,{buckets:data.buckets,view:data.view})]}),"year"===view?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"deux d\xe9nombrements, un seul axe",children:"Traction — entreprises actives et connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TractionChart,{buckets:data.buckets})]}):null,"day"===view&&data.buckets.length>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"d\xe9composition du compute de la journ\xe9e",children:"Compute de la journ\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(ChargeStack,{buckets:data.buckets,view:data.view})]}):null,data.buckets.length>1?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"cr\xe9ation → ex\xe9cution, sur les t\xe2ches r\xe9ellement ex\xe9cut\xe9es",children:"D\xe9lai de mise en route"}),/*#__PURE__*/(0,jsx_runtime.jsx)(ServiceLevelChart,{buckets:data.buckets,view:data.view})]}):null,data.kpis.abandonedTasks>0?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"abandonn\xe9es apr\xe8s 3 d\xe9blocages, sans jamais avoir tourn\xe9",children:"Synchros perdues"}),/*#__PURE__*/(0,jsx_runtime.jsx)(AbandonedChart,{buckets:data.buckets,view:data.view})]}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",h:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"classement, pas de moyenne",children:"Top consommateurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TopCompaniesTable,{rows:data.topCompanies,totalHours:data.kpis.computeHours})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12,lg:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,radius:"md",p:"md",h:"100%",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SectionTitle,{hint:"brique de tarification du free",children:"Co\xfbt par connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(TopJobsTable,{rows:data.topJobs,totalHours:data.kpis.computeHours})]})})]})]}):/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:96}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300})]})]})})}function Usage(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)(UsageApp,{})})})}}}]);
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},7936:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:()=>AppConfigProvider,M:()=>useAppConfig});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3106);const AppConfigCtx=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}},7034:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{C:()=>Providers});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _airporting_app_front__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1380);var _mantine_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(207);var _mantine_modals__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4142);var _mantine_notifications__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(1455);var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(6197);var radash__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9877);var _hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7936);const theme=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_2__.createTheme)((0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.theme,{components:{}}));const cssVarResolver=x=>(0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__.$,{value:config,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClientProvider,{client:tanstack?.queryClient??new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClient,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_2__.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_modals__WEBPACK_IMPORTED_MODULE_3__.ModalsProvider,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_notifications__WEBPACK_IMPORTED_MODULE_4__.Notifications,{}),children]})})})})}},8898:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Wise});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);function WiseApp(){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:"Wise - soon"})})}function Wise(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)(WiseApp,{})})})}}}]);
10
+ */var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},7936:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:()=>AppConfigProvider,M:()=>useAppConfig});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(9735);const AppConfigCtx=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}},7034:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{C:()=>Providers});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _airporting_app_front__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1380);var _mantine_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(207);var _mantine_modals__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4142);var _mantine_notifications__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(1455);var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(6197);var radash__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(9877);var _hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7936);const theme=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_2__.createTheme)((0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.theme,{components:{}}));const cssVarResolver=x=>(0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__.$,{value:config,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClientProvider,{client:tanstack?.queryClient??new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClient,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_2__.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_modals__WEBPACK_IMPORTED_MODULE_3__.ModalsProvider,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_notifications__WEBPACK_IMPORTED_MODULE_4__.Notifications,{}),children]})})})})}},8898:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Wise});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(9735);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);function WiseApp(){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:"Wise - soon"})})}function Wise(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)(WiseApp,{})})})}}}]);