import React, { Component, Fragment } from "react";
import {
Row,
Col,
Modal,
Button,
ListGroup,
ListGroupItem,
ProgressBar,
Glyphicon
} from "react-bootstrap";
import IonAssetLabel from "./IonAssetLabel";
import "./TaskDialog.scss";
const TaskStatusItem = ({
asset,
progress,
task,
helpText = "",
active = true,
bsStyle = "primary"
}) => (
Status: {task}
{helpText && {helpText}}
);
export default class TaskDialog extends Component {
static defaultProps = {
tasks: [],
taskComponent: TaskStatusItem
};
render() {
const {
tasks,
taskComponent: TaskComponent,
onClearFailed,
onHide,
...options
} = this.props;
let hasErrors = false;
const taskItems = tasks.map(
({ type: asset, upload, process, error }) => {
let task,
style,
active = true,
progress = 0;
if (upload.active) {
progress = upload.progress;
task = "Uploading";
style = "info";
} else if (process.active) {
progress = process.progress;
task = "Processing";
style = "success";
}
if (error.length > 0) {
task = "Error";
style = "danger";
active = false;
console.error(error);
hasErrors = true;
}
return (
);
}
);
return (
Cesium Ion Tasks
{taskItems}
{hasErrors && (
)}
);
}
}