Skip to content

Commit

Permalink
Add new errors. Working integration with dashboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMauderer committed Dec 22, 2023
1 parent 7443683 commit 4b31b03
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
44 changes: 37 additions & 7 deletions app/gui2/src/components/GraphEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ import { colorFromString } from '@/util/colors'
import { Rect } from '@/util/data/rect'
import { Vec2 } from '@/util/data/vec2'
import * as set from 'lib0/set'
import { toast } from 'react-toastify'
import type { ExprId, NodeMetadata } from 'shared/yjsModel'
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import { toast } from 'vue3-toastify'
import { ProjectManagerEvents } from '../../../ide-desktop/lib/dashboard/src/authentication/src/dashboard/projectManager'
import { type Usage } from './ComponentBrowser/input'
const EXECUTION_MODES = ['design', 'live']
Expand All @@ -51,24 +52,53 @@ const componentBrowserUsage = ref<Usage>({ type: 'newNode' })
const suggestionDb = useSuggestionDbStore()
const interaction = provideInteractionHandler()
/// === UI Messages and Errors ===
function initStartupToast() {
const startupToast = toast.info('Initializing the project. This can take up to one minute.', {
autoClose: false,
})
projectStore.firstExecution.then(() => {
if (startupToast != null) {
toast.remove(startupToast)
}
toast.dismiss(startupToast)
})
onUnmounted(() => {
if (startupToast != null) {
toast.remove(startupToast)
}
toast.dismiss(startupToast)
})
}
function initiConnectionLostToast() {
let connectionLostToast = 'connectionLostToast'
document.addEventListener(
ProjectManagerEvents.loadingFailed,
() => {
toast.error('Lost connection to Language Server.', {
autoClose: false,
toastId: connectionLostToast,
})
},
{ once: true },
)
onUnmounted(() => {
toast.dismiss(connectionLostToast)
})
}
projectStore.lsRpcConnection.catch((err) => {
toast.error(`Connection to language server failed: ${err}`)
})
projectStore.lsRpcConnection.then((ls) => {
ls.client.onError((err) => {
toast.error(`Language server error: ${err}`)
})
})
projectStore.executionContext.on('executionFailed', (err) => {
toast.error(`Execution Failed: ${err}`, {})
})
onMounted(() => {
initStartupToast()
initiConnectionLostToast()
})
const nodeSelection = provideGraphSelection(graphNavigator, graphStore.nodeRects, {
Expand Down
2 changes: 1 addition & 1 deletion app/gui2/stories/GraphEditor.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ main =
autoPropsDisabled
>
<MockProjectStoreWrapper v-model="text">
<Suspense><GraphEditor /></Suspense>
<Suspense> <GraphEditor /></Suspense>
</MockProjectStoreWrapper>

<template #controls><HstCode v-model="text" title="code" /></template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default function App(props: AppProps) {
draggable={false}
toastClassName="text-sm leading-170 bg-frame-selected rounded-2xl backdrop-blur-3xl"
transition={toastify.Zoom}
limit={3}
/>
<Router basename={getMainPageUrl().pathname}>
<AppRouter {...props} />
Expand Down

0 comments on commit 4b31b03

Please sign in to comment.