show toaster first

pull/5563/head
aniket-engg 2 months ago committed by Aniket
parent 7ff03180ec
commit 743bef2bfb
  1. 8
      libs/remix-ui/run-tab/src/lib/components/environment.tsx

@ -48,16 +48,16 @@ export function EnvironmentUI(props: EnvironmentProps) {
)
}
const saveVmState = () => {
const saveVmState = async () => {
const context = currentProvider.name
vmStateName.current = `${context}_${Date.now()}`
const contextExists = await props.runTabPlugin.call('fileManager', 'exists', `.states/${context}/state.json`)
if (contextExists) {
props.modal(
intl.formatMessage({ id: 'udapp.saveVmStateTitle' }),
saveVmStatePrompt(vmStateName.current),
intl.formatMessage({ id: 'udapp.save' }),
async () => {
const contextExists = await props.runTabPlugin.call('fileManager', 'exists', `.states/${context}/state.json`)
if (contextExists) {
let currentStateDb = await props.runTabPlugin.call('fileManager', 'readFile', `.states/${context}/state.json`)
currentStateDb = JSON.parse(currentStateDb)
currentStateDb.stateName = vmStateName.current
@ -66,11 +66,11 @@ export function EnvironmentUI(props: EnvironmentProps) {
await props.runTabPlugin.call('fileManager', 'writeFile', `.states/saved_states/${vmStateName.current}.json`, JSON.stringify(currentStateDb, null, 2))
props.runTabPlugin.emit('vmStateSaved', vmStateName.current)
props.runTabPlugin.call('notification', 'toast', `VM state ${vmStateName.current} saved.`)
} else props.runTabPlugin.call('notification', 'toast', `VM state doesn't exist for selected environment.`)
},
intl.formatMessage({ id: 'udapp.cancel' }),
null
)
} else props.runTabPlugin.call('notification', 'toast', `VM state doesn't exist for selected environment.`)
}
const resetVmState = () => {

Loading…
Cancel
Save