Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Jul 20, 2022
1 parent c3757f9 commit ca30b82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions interface/src/framework/system/GeneralFileUpload.tsx
@@ -1,13 +1,11 @@
import { FC, useContext } from 'react';
import { FC } from 'react';
import { AxiosPromise } from 'axios';

import { Typography, Button, Box } from '@mui/material';

import { FileUploadConfig } from '../../api/endpoints';
import { SingleUpload, useFileUpload } from '../../components';

import { AuthenticatedContext } from '../../contexts/authentication';

import DownloadIcon from '@mui/icons-material/GetApp';

import { useSnackbar } from 'notistack';
Expand All @@ -23,12 +21,11 @@ interface UploadFileProps {
const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
const [uploadFile, cancelUpload, uploading, uploadProgress] = useFileUpload({ upload: uploadGeneralFile });

const { me } = useContext(AuthenticatedContext);
const { enqueueSnackbar } = useSnackbar();

const saveFile = (json: any, endpoint: string) => {
const a = document.createElement('a');
const filename = 'emsesp_' + endpoint + '_json.txt';
const filename = 'emsesp_' + endpoint + '.json';
a.href = URL.createObjectURL(
new Blob([JSON.stringify(json, null, 2)], {
type: 'text/plain'
Expand Down Expand Up @@ -84,7 +81,7 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
<Typography sx={{ pt: 2, pb: 2 }} variant="h6" color="primary">
Download
</Typography>
{me.admin && (
{!uploading && (
<>
<Box color="warning.main">
<Typography mb={1} variant="body2">
Expand Down
4 changes: 2 additions & 2 deletions interface/src/project/HelpInformation.tsx
Expand Up @@ -21,7 +21,7 @@ const HelpInformation: FC = () => {

const saveFile = (json: any, endpoint: string) => {
const a = document.createElement('a');
const filename = 'emsesp_' + endpoint + '_json.txt';
const filename = 'emsesp_' + endpoint + '.txt';
a.href = URL.createObjectURL(
new Blob([JSON.stringify(json, null, 2)], {
type: 'text/plain'
Expand All @@ -31,7 +31,7 @@ const HelpInformation: FC = () => {
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
enqueueSnackbar('File downloaded', { variant: 'info' });
enqueueSnackbar('System information downloaded', { variant: 'info' });
};

const callAPI = async (endpoint: string) => {
Expand Down

0 comments on commit ca30b82

Please sign in to comment.