Loading frontend/src/exercisepanel/ExportImport/index.tsx +18 −8 Original line number Diff line number Diff line import { AnchorButton, Button, ButtonGroup, Section } from '@blueprintjs/core' import { Button, ButtonGroup, Section } from '@blueprintjs/core' import { useHost } from '@inject/graphql/connection/host' import { exportImportUrl } from '@inject/shared/config' import { notify } from '@inject/shared/notification/engine' import authenticatedFetch from '@inject/shared/utils/authenticatedFetch' import { useState } from 'react' import ImportDialog from './ImportDialog' Loading @@ -8,6 +10,19 @@ const ExportImport = () => { const host = useHost() const [isImportOpen, setIsImportOpen] = useState(false) const handleExport = () => { authenticatedFetch(exportImportUrl(host || '')) .then(response => response.blob()) .then(blob => { const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = `IXP-export-${new Date().toISOString().substring(0, 18)}.zip` a.click() }) .catch(error => notify(error.message, { intent: 'danger' })) } return ( <> <Section Loading @@ -19,14 +34,9 @@ const ExportImport = () => { } rightElement={ <ButtonGroup> <AnchorButton icon='export' href={exportImportUrl(host || '')} target='_blank' rel='noreferrer' > <Button icon='export' onClick={handleExport}> Export </AnchorButton> </Button> <Button active={isImportOpen} onClick={() => setIsImportOpen(true)} Loading frontend/src/pages/(navbar)/exercise-panel/index.tsx +6 −1 Original line number Diff line number Diff line Loading @@ -10,14 +10,19 @@ const limitedHeight = css` overflow-y: auto; ` const noMargin = css` margin: 0; ` const ExercisePanel = () => { const { isSuperuser } = useAuthIdentity() return ( <> {isSuperuser && <ExportImport />} <h1 className={noMargin}>Exercise panel</h1> <DefinitionManager className={limitedHeight} /> <ExerciseManager className={limitedHeight} /> {isSuperuser && <ExportImport />} <GitVersion /> </> ) Loading Loading
frontend/src/exercisepanel/ExportImport/index.tsx +18 −8 Original line number Diff line number Diff line import { AnchorButton, Button, ButtonGroup, Section } from '@blueprintjs/core' import { Button, ButtonGroup, Section } from '@blueprintjs/core' import { useHost } from '@inject/graphql/connection/host' import { exportImportUrl } from '@inject/shared/config' import { notify } from '@inject/shared/notification/engine' import authenticatedFetch from '@inject/shared/utils/authenticatedFetch' import { useState } from 'react' import ImportDialog from './ImportDialog' Loading @@ -8,6 +10,19 @@ const ExportImport = () => { const host = useHost() const [isImportOpen, setIsImportOpen] = useState(false) const handleExport = () => { authenticatedFetch(exportImportUrl(host || '')) .then(response => response.blob()) .then(blob => { const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = `IXP-export-${new Date().toISOString().substring(0, 18)}.zip` a.click() }) .catch(error => notify(error.message, { intent: 'danger' })) } return ( <> <Section Loading @@ -19,14 +34,9 @@ const ExportImport = () => { } rightElement={ <ButtonGroup> <AnchorButton icon='export' href={exportImportUrl(host || '')} target='_blank' rel='noreferrer' > <Button icon='export' onClick={handleExport}> Export </AnchorButton> </Button> <Button active={isImportOpen} onClick={() => setIsImportOpen(true)} Loading
frontend/src/pages/(navbar)/exercise-panel/index.tsx +6 −1 Original line number Diff line number Diff line Loading @@ -10,14 +10,19 @@ const limitedHeight = css` overflow-y: auto; ` const noMargin = css` margin: 0; ` const ExercisePanel = () => { const { isSuperuser } = useAuthIdentity() return ( <> {isSuperuser && <ExportImport />} <h1 className={noMargin}>Exercise panel</h1> <DefinitionManager className={limitedHeight} /> <ExerciseManager className={limitedHeight} /> {isSuperuser && <ExportImport />} <GitVersion /> </> ) Loading