diff --git a/public/locales/en/common.json b/public/locales/en/common.json index f90980dc..8e5d8e57 100755 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -499,7 +499,7 @@ "kopia": { "status": "Status", "size": "Size", - "executiontime": "Execution Time", - "failed": "Failed" + "lastrun": "Last Run", + "nextrun": "Next Run" } } \ No newline at end of file diff --git a/src/widgets/kopia/component.jsx b/src/widgets/kopia/component.jsx index 1e6560f3..04b9eda7 100755 --- a/src/widgets/kopia/component.jsx +++ b/src/widgets/kopia/component.jsx @@ -8,38 +8,50 @@ export default function Component({ service }) { const { t } = useTranslation(); const { widget } = service; - const { data: kopiaData, error: kopiaError } = useWidgetAPI(widget, "api"); + const { data: statusData, error: statusError } = useWidgetAPI(widget, "status"); + const { data: tasksData, error: tasksError } = useWidgetAPI(widget, "tasks"); - if (kopiaError) { - return ; + if (statusError || tasksError) { + return ; } - if (!kopiaData) { + if (!statusData || !tasksData) { return ( - - + + ); } - const startTime = new Date(kopiaData.sources[0].lastSnapshot.startTime); - const endTime = new Date(kopiaData.sources[0].lastSnapshot.endTime); - const duration = new Date(endTime - startTime); - const hours = duration.getUTCHours().toString().padStart(2, '0'); - const minutes = duration.getUTCMinutes().toString().padStart(2, '0'); - const seconds = duration.getSeconds().toString().padStart(2, '0'); - const split = ":"; - const time = (hours + split + minutes + split+ seconds); + function fromTasks(task) { + for (let i=0; i - - - - + + + + ); } \ No newline at end of file diff --git a/src/widgets/kopia/widget.js b/src/widgets/kopia/widget.js index 288ec0dd..ecee3b8a 100755 --- a/src/widgets/kopia/widget.js +++ b/src/widgets/kopia/widget.js @@ -5,9 +5,12 @@ const widget = { proxyHandler: genericProxyHandler, mappings: { - api: { + status: { endpoint: "api/v1/sources", }, + tasks: { + endpoint: "api/v1/tasks", + }, }, };