Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: add restoresize to download button" #209

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 0 additions & 17 deletions src/components/Backups/StyledBackups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,6 @@ export const DataTable = styled.div`
padding-right: 15px;
}

.btn-download {
width: 173px;
padding-inline: 22px;
white-space: nowrap;

&-lg {
font-size: 80%;
}

@media (max-width: 1200px) {
width: unset;
&-lg {
font-size: initial;
}
}
}

& > div {
padding-left: 20px;
@media ${bp.wideDown} {
Expand Down
1 change: 0 additions & 1 deletion src/components/Backups/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const backupsData = [
restore: {
status: 'completed',
restoreLocation: 'https://example.com/backup',
restoreSize: 300
},
},
{
Expand Down
1 change: 0 additions & 1 deletion src/components/Backups/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export interface BackupsProps {
restore: {
status: 'completed' | 'pending' | 'failed';
restoreLocation?: string;
restoreSize?: number;
};
}[];
}
Expand Down
15 changes: 1 addition & 14 deletions src/components/RestoreButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ import React from 'react';
import Button from 'components/Button';
import Prepare from 'components/RestoreButton/Prepare';

function humanFileSize(size) {
var i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
const formatted = (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];

return [formatted.length > 5, formatted];
}

/**
* A button to restore a backup.
*/
Expand All @@ -20,13 +13,7 @@ const RestoreButton = ({ backup: { backupId, restore } }) => {

if (restore.status === 'failed') return <Button disabled>Retrieve failed</Button>;

const [isOverflowing, formattedSize] = humanFileSize(restore.restoreSize);

return (
<Button variant={`download ${isOverflowing ? 'btn-download-lg' : ''}`} href={restore.restoreLocation}>
Download ({formattedSize})
</Button>
);
return <Button href={restore.restoreLocation}>Download</Button>;
};

export default RestoreButton;
1 change: 0 additions & 1 deletion src/lib/query/EnvironmentWithBackups.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default gql`
id
status
restoreLocation
restoreSize
}
}
}
Expand Down
Loading