Loading backend @ c8449e30 Compare aebac181 to c8449e30 Original line number Diff line number Diff line Subproject commit aebac181798e5fa1b501784a8d8aaf38a8eba71b Subproject commit c8449e302163102f761b54f65255200bb9642dac codegen/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/codegen", "version": "3.20.0", "version": "3.21.0", "description": "GraphQL API Codegen Setup for the Inject Backend", "main": "index.js", "license": "MIT", Loading frontend/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/frontend", "version": "3.20.0", "version": "3.21.0", "description": "Main wrapper for rendering INJECT Frontend", "main": "index.js", "license": "MIT", Loading frontend/src/components/DefinitionList/DefinitionButtons.tsx +37 −2 Original line number Diff line number Diff line import { Button, ButtonGroup, Classes } from '@blueprintjs/core' import { css } from '@emotion/css' import type { Definition } from '@inject/graphql' import { DeleteDefinition, useTypedMutation } from '@inject/graphql' import { LinkButton } from '@inject/shared' import { DeleteDefinition, useHost, useTypedMutation } from '@inject/graphql' import { authenticatedFetch, downloadDefinitionUrl, LinkButton, notify, } from '@inject/shared' import type { FC } from 'react' import { useState } from 'react' import ConfirmAlert from '../../exercisepanel/ConfirmAlert' Loading @@ -27,12 +32,35 @@ interface DefinitionButtonsProps { const DefinitionButtons: FC<DefinitionButtonsProps> = ({ definition }) => { const [alertOpen, setAlertOpen] = useState(false) const [donwloadLoading, setDonwloadLoading] = useState(false) const host = useHost() const { id: definitionId } = definition const [{ fetching: loading }, deleteDefinition] = useTypedMutation(DeleteDefinition) const onDownload = () => { setDonwloadLoading(true) authenticatedFetch(downloadDefinitionUrl(host, definition.id)) .then(response => response.blob()) .then(blob => { console.log(blob) const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = `${definition.name}.zip` a.click() }) .catch(error => notify(error.message, JSON.stringify(error), { intent: 'danger' }) ) .finally(() => { setDonwloadLoading(false) }) } return ( <> <ButtonGroup className={buttonGroup}> Loading @@ -43,6 +71,13 @@ const DefinitionButtons: FC<DefinitionButtonsProps> = ({ definition }) => { }} button={{ icon: 'people', fill: true, title: 'Access' }} /> <Button icon='download' fill title='Download' loading={donwloadLoading} onClick={onDownload} /> <Button type='button' active={alertOpen} Loading frontend/src/components/DefinitionList/index.tsx +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ const DefinitionList: FC<DefinitionListProps> = ({ className }) => { { id: 'actions', name: 'Actions', style: { textAlign: 'right', width: '12ch' }, style: { textAlign: 'right', width: '16ch' }, renderValue: definition => ( <span> <DefinitionButtons definition={definition} /> Loading Loading
backend @ c8449e30 Compare aebac181 to c8449e30 Original line number Diff line number Diff line Subproject commit aebac181798e5fa1b501784a8d8aaf38a8eba71b Subproject commit c8449e302163102f761b54f65255200bb9642dac
codegen/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/codegen", "version": "3.20.0", "version": "3.21.0", "description": "GraphQL API Codegen Setup for the Inject Backend", "main": "index.js", "license": "MIT", Loading
frontend/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/frontend", "version": "3.20.0", "version": "3.21.0", "description": "Main wrapper for rendering INJECT Frontend", "main": "index.js", "license": "MIT", Loading
frontend/src/components/DefinitionList/DefinitionButtons.tsx +37 −2 Original line number Diff line number Diff line import { Button, ButtonGroup, Classes } from '@blueprintjs/core' import { css } from '@emotion/css' import type { Definition } from '@inject/graphql' import { DeleteDefinition, useTypedMutation } from '@inject/graphql' import { LinkButton } from '@inject/shared' import { DeleteDefinition, useHost, useTypedMutation } from '@inject/graphql' import { authenticatedFetch, downloadDefinitionUrl, LinkButton, notify, } from '@inject/shared' import type { FC } from 'react' import { useState } from 'react' import ConfirmAlert from '../../exercisepanel/ConfirmAlert' Loading @@ -27,12 +32,35 @@ interface DefinitionButtonsProps { const DefinitionButtons: FC<DefinitionButtonsProps> = ({ definition }) => { const [alertOpen, setAlertOpen] = useState(false) const [donwloadLoading, setDonwloadLoading] = useState(false) const host = useHost() const { id: definitionId } = definition const [{ fetching: loading }, deleteDefinition] = useTypedMutation(DeleteDefinition) const onDownload = () => { setDonwloadLoading(true) authenticatedFetch(downloadDefinitionUrl(host, definition.id)) .then(response => response.blob()) .then(blob => { console.log(blob) const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = `${definition.name}.zip` a.click() }) .catch(error => notify(error.message, JSON.stringify(error), { intent: 'danger' }) ) .finally(() => { setDonwloadLoading(false) }) } return ( <> <ButtonGroup className={buttonGroup}> Loading @@ -43,6 +71,13 @@ const DefinitionButtons: FC<DefinitionButtonsProps> = ({ definition }) => { }} button={{ icon: 'people', fill: true, title: 'Access' }} /> <Button icon='download' fill title='Download' loading={donwloadLoading} onClick={onDownload} /> <Button type='button' active={alertOpen} Loading
frontend/src/components/DefinitionList/index.tsx +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ const DefinitionList: FC<DefinitionListProps> = ({ className }) => { { id: 'actions', name: 'Actions', style: { textAlign: 'right', width: '12ch' }, style: { textAlign: 'right', width: '16ch' }, renderValue: definition => ( <span> <DefinitionButtons definition={definition} /> Loading