Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

3 additional task statuses implemented #589

Merged
merged 1 commit into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/frame/All.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import SingleFrame from './Single';
import { timeStampToHR } from './../../utils/time';

const statusDict = Object.freeze({
WAITINGFORPEER: 'waiting for peer',
NOTREADY: 'not started',
READY: 'ready',
WAITING: 'waiting',
Expand Down
12 changes: 1 addition & 11 deletions src/components/tasks/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { connect } from "react-redux";

import * as Actions from "../../actions";
import blender_logo from "./../../assets/img/blender_logo.png";
import { taskStatus as status } from './../../constants/statusDicts'
import { convertSecsToHMS, timeStampToHR } from "./../../utils/time";

import InsufficientAmountModal from "./modal/InsufficientAmountModal";
Expand All @@ -26,17 +27,6 @@ const mapDispatchToProps = dispatch => ({
actions: bindActionCreators(Actions, dispatch)
});

const status = Object.freeze({
WAITINGFORPEER: "Waiting for peer",
NOTREADY: "Not started",
READY: "Ready",
WAITING: "Waiting",
COMPUTING: "Computing",
FINISHED: "Finished",
TIMEOUT: "Timeout",
RESTART: "Restart"
});

function shouldPSEnabled(_item) {
return (
_item.status == status.COMPUTING ||
Expand Down
52 changes: 51 additions & 1 deletion src/components/tasks/TaskItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,54 @@ export class TaskItem extends React.Component {
const { options } = item;
const { nodeNumbers } = this.props;
switch (item.status) {
case taskStatus.CREATING:
return (
<div>
<span>
Duration:{' '}
{convertSecsToHMS(
new Date() / 1000 - item.time_started
)}
</span>
<span className="bumper" />
<span className="duration--preparing">
Creating the task...{' '}
</span>
</div>
);

case taskStatus.ERRORCREATING:
return (
<div>
<span>
Duration:{' '}
{convertSecsToHMS(
new Date() / 1000 - item.time_started
)}
</span>
<span className="bumper" />
<span className="duration--failure">
{item?.status_message || "Error creating task"}
</span>
</div>
);

case taskStatus.ABORTED:
return (
<div>
<span>
Task time:{' '}
{timeStampToHR(
item.last_updated - item.time_started,
true
)}
</span>
<span className="bumper" />
<span className="duration--aborted">Aborted: </span>
<span>{timeStampToHR(item.last_updated)}</span>
</div>
);

case taskStatus.TIMEOUT:
return (
<div>
Expand Down Expand Up @@ -521,7 +569,9 @@ export class TaskItem extends React.Component {
!(
item.status === taskStatus.RESTART ||
item.status === taskStatus.TIMEOUT ||
item.status === taskStatus.FINISHED
item.status === taskStatus.FINISHED ||
item.status === taskStatus.ABORTED ||
item.status === taskStatus.ERRORCREATING
)
}
restartSubtasksModalHandler={
Expand Down
7 changes: 5 additions & 2 deletions src/constants/statusDicts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ const testStatusDict = Object.freeze({
})

const taskStatus = Object.freeze({
WAITINGFORPEER: 'Waiting for peer',
DEPOSIT: 'Creating the deposit',
NOTREADY: 'Not started',
SENDING: "Sending",
READY: 'Ready',
WAITING: 'Waiting',
COMPUTING: 'Computing',
FINISHED: 'Finished',
TIMEOUT: 'Timeout',
RESTART: 'Restart',
FAILURE: 'Failure'
FAILURE: 'Failure',
ABORTED: "Aborted",
CREATING: 'Creating',
ERRORCREATING: 'Error Creating'
})

module.exports = {
Expand Down
4 changes: 4 additions & 0 deletions src/scss/tasks/task-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
.duration {
font-size: 8.5pt;
margin-top: 1px;
&--aborted {
color: $color-error;
font-weight: 400;
}
&--active {
color: $button-static-color;
font-weight: 400;
Expand Down