From 5ad02f9cb3a68010c25c5a5d835f61382b109491 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Sat, 30 Sep 2017 09:34:19 +0200 Subject: Show progress bar instead of text info in tasks --- .../app/sidebars/simulation/TaskComponent.js | 55 ++++++++++++++-------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src/components/app/sidebars/simulation') diff --git a/src/components/app/sidebars/simulation/TaskComponent.js b/src/components/app/sidebars/simulation/TaskComponent.js index 038e1f71..baf6f9ce 100644 --- a/src/components/app/sidebars/simulation/TaskComponent.js +++ b/src/components/app/sidebars/simulation/TaskComponent.js @@ -1,31 +1,29 @@ import approx from "approximate-number"; +import classNames from "classnames"; import React from "react"; import {convertSecondsToFormattedTime} from "../../../../util/date-time"; const TaskComponent = ({task, flopsLeft}) => { - let stateInfo; + let icon; + let progressBarContent; + let percent; + let infoTitle; if (flopsLeft === task.totalFlopCount) { - stateInfo = ( -
- - Waiting -
- ); + icon = "hourglass-half"; + progressBarContent = ""; + percent = 0; + infoTitle = "Not submitted yet"; } else if (flopsLeft > 0) { - stateInfo = ( -
- - Running ({approx(task.totalFlopCount - flopsLeft)} / {approx(task.totalFlopCount)} FLOP) -
- ); + icon = "refresh"; + progressBarContent = approx(task.totalFlopCount - flopsLeft) + " FLOP"; + percent = 100 * (task.totalFlopCount - flopsLeft) / task.totalFlopCount; + infoTitle = progressBarContent + " (" + Math.round(percent * 10) / 10 + "%)"; } else { - stateInfo = ( -
- - Completed -
- ); + icon = "check"; + progressBarContent = "Completed"; + percent = 100; + infoTitle = "Completed"; } return ( @@ -34,7 +32,24 @@ const TaskComponent = ({task, flopsLeft}) => {
{approx(task.totalFlopCount)} FLOP
Starts at {convertSecondsToFormattedTime(task.startTick)} - {stateInfo} +
+ +
+
+ {progressBarContent} +
+
+
); }; -- cgit v1.2.3