Skip to content

Commit

Permalink
remove diagnostic download btn
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Nov 13, 2018
1 parent b33fc29 commit 1435aaf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
jest.mock("../../../account/request_account_export", () => {
return { jsonDownload: jest.fn() };
});

jest.mock("../../../api/crud", () => {
return { destroy: jest.fn() };
});
Expand All @@ -12,7 +8,6 @@ import { DiagnosticDumpRow } from "../diagnostic_dump_row";
import {
fakeDiagnosticDump
} from "../../../__test_support__/fake_state/resources";
import { jsonDownload } from "../../../account/request_account_export";
import { destroy } from "../../../api/crud";

describe("<DiagnosticDumpRow/>", () => {
Expand All @@ -22,9 +17,6 @@ describe("<DiagnosticDumpRow/>", () => {
diag.body.ticket_identifier = "0000";
const el = mount(<DiagnosticDumpRow dispatch={dispatch} diag={diag} />);
expect(el.text()).toContain("0000");
el.find("button.green").first().simulate("click");
expect(jsonDownload).toHaveBeenCalledWith(diag.body,
"farmbot_diagnostics_0000.json");
el.find("button.red").first().simulate("click");
expect(destroy).toHaveBeenCalledWith(diag.uuid);
});
Expand Down
19 changes: 1 addition & 18 deletions webpack/devices/components/diagnostic_dump_row.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from "react";
import { Row, Col } from "../../ui";
import { TaggedDiagnosticDump } from "farmbot";
import { jsonDownload } from "../../account/request_account_export";
import { destroy } from "../../api/crud";
import { ago } from "../connectivity/status_checks";
import { t } from "i18next";
Expand All @@ -18,25 +17,9 @@ export class DiagnosticDumpRow extends React.Component<Props, {}> {

destroy = () => this.props.dispatch(destroy(this.props.diag.uuid));

download = (e: React.MouseEvent<{}>) => {
e.preventDefault();
const { body } = this.props.diag;
const { ticket_identifier } = body;
const fileName = `farmbot_diagnostics_${ticket_identifier}.json`;
jsonDownload(body, fileName);
}

render() {
return <Row>
<Col xs={3}>
<button
className="fb-button green"
hidden={true}
onClick={this.download}>
{t("Download")}
</button>
</Col>
<Col xs={8}>
<Col xsOffset={3} xs={8}>
{t("Report {{ticket}} (Saved {{age}})",
{ ticket: this.ticket, age: this.age })}
</Col>
Expand Down

0 comments on commit 1435aaf

Please sign in to comment.