Skip to content

Commit

Permalink
feat(Ui): Remove export to flamegraph.com (#3729)
Browse files Browse the repository at this point in the history
  • Loading branch information
grafakus authored Dec 5, 2024
1 parent 1ceaa7e commit 9ac9e47
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 66 deletions.
21 changes: 0 additions & 21 deletions public/app/components/ExportData.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,6 @@ describe('ExportData', () => {
render(<ExportData exportHTML flamebearer={TestData} />);
screen.getByRole('button', { name: /html/i });
});

describe('the "flamegraph.com" export button', () => {
it('is enabled by default"', () => {
render(<ExportData flamebearer={TestData} />);
screen.getByRole('button', { name: /flamegraph\.com/i });
});

it('can be enabled"', () => {
render(<ExportData exportFlamegraphDotCom flamebearer={TestData} />);
screen.getByRole('button', { name: /flamegraph\.com/i });
});

it('can be disabled"', () => {
render(
<ExportData exportFlamegraphDotCom={false} flamebearer={TestData} />
);
expect(
screen.queryByRole('button', { name: /flamegraph\.com/i })
).not.toBeInTheDocument();
});
});
});

describe('filename', () => {
Expand Down
45 changes: 0 additions & 45 deletions public/app/components/ExportData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { createBiggestInterval } from '@pyroscope/util/timerange';
import { downloadWithOrgID } from '@pyroscope/services/base';
import { faShareSquare } from '@fortawesome/free-solid-svg-icons/faShareSquare';
import { Field, Message } from 'protobufjs/light';
import { flameGraphUpload } from '@pyroscope/services/flamegraphcom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { format } from 'date-fns';
import { isRouteActive, ROUTES } from '@pyroscope/pages/routes';
Expand Down Expand Up @@ -173,40 +172,6 @@ function ExportData(props: ExportDataProps) {
}
};

const downloadFlamegraphDotCom = async () => {
if (!exportFlamegraphDotCom) {
return;
}

const { flamebearer } = props;

const defaultExportName = getFilename(
flamebearer.metadata.appName,
flamebearer.metadata.startTime,
flamebearer.metadata.endTime
);
// get user input from modal
const customExportName = await getCustomExportName(defaultExportName);
// return if user cancels the modal
if (!customExportName) {
return;
}

const url = await flameGraphUpload(customExportName, flamebearer);
if (url.isErr) {
handleError(dispatch, 'Failed to export to flamegraph.com', url.error);
return;
}

const dlLink = document.createElement('a');
dlLink.target = '_blank';
dlLink.href = url.value;

document.body.appendChild(dlLink);
dlLink.click();
document.body.removeChild(dlLink);
};

const downloadPNG = async () => {
if (exportPNG) {
const { flamebearer } = props;
Expand Down Expand Up @@ -346,16 +311,6 @@ function ExportData(props: ExportDataProps) {
html
</button>
)}
{exportFlamegraphDotCom && (
<button
className={styles.dropdownMenuItem}
type="button"
onClick={downloadFlamegraphDotCom}
>
{' '}
flamegraph.com
</button>
)}
</div>
</OutsideClickHandler>
</div>
Expand Down

0 comments on commit 9ac9e47

Please sign in to comment.