From ca30b8233b0f6d798ebad9e8245229d9a9f30c5d Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 20 Jul 2022 20:33:43 +0200 Subject: [PATCH] fixes --- interface/src/framework/system/GeneralFileUpload.tsx | 9 +++------ interface/src/project/HelpInformation.tsx | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/interface/src/framework/system/GeneralFileUpload.tsx b/interface/src/framework/system/GeneralFileUpload.tsx index f24f11ffb..d6f694b1e 100644 --- a/interface/src/framework/system/GeneralFileUpload.tsx +++ b/interface/src/framework/system/GeneralFileUpload.tsx @@ -1,4 +1,4 @@ -import { FC, useContext } from 'react'; +import { FC } from 'react'; import { AxiosPromise } from 'axios'; import { Typography, Button, Box } from '@mui/material'; @@ -6,8 +6,6 @@ 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'; @@ -23,12 +21,11 @@ interface UploadFileProps { const GeneralFileUpload: FC = ({ 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' @@ -84,7 +81,7 @@ const GeneralFileUpload: FC = ({ uploadGeneralFile }) => { Download - {me.admin && ( + {!uploading && ( <> diff --git a/interface/src/project/HelpInformation.tsx b/interface/src/project/HelpInformation.tsx index c47577f92..ae6de59de 100644 --- a/interface/src/project/HelpInformation.tsx +++ b/interface/src/project/HelpInformation.tsx @@ -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' @@ -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) => {