Farmbot-Web-App/frontend/devices/components/diagnostic_dump_row.tsx

38 lines
1.0 KiB
TypeScript
Raw Normal View History

import * as React from "react";
import { Row, Col } from "../../ui";
2018-08-01 07:09:30 -06:00
import { TaggedDiagnosticDump } from "farmbot";
import { destroy } from "../../api/crud";
import { ago } from "../connectivity/status_checks";
2019-04-02 13:59:37 -06:00
import { t } from "../../i18next_wrapper";
export interface Props {
diag: TaggedDiagnosticDump;
dispatch: Function;
}
export class DiagnosticDumpRow extends React.Component<Props, {}> {
get ticket() { return this.props.diag.body.ticket_identifier; }
get age() { return ago(new Date(this.props.diag.body.created_at).getTime()); }
destroy = () => this.props.dispatch(destroy(this.props.diag.uuid));
render() {
return <Row>
2018-11-12 17:14:16 -07:00
<Col xsOffset={3} xs={8}>
2019-09-23 12:56:35 -06:00
{t("Report {{ticket}} (Saved {{age}})", {
ticket: this.ticket, age: this.age
})}
</Col>
2018-07-10 21:46:22 -06:00
<Col xs={1}>
<button
className="red fb-button del-button"
2019-08-26 12:20:46 -06:00
title={t("Delete")}
2018-07-10 21:46:22 -06:00
onClick={this.destroy}>
<i className="fa fa-times" />
</button>
</Col>
2019-09-23 12:56:35 -06:00
</Row>;
}
}