This commit is contained in:
Ruben Fiszel
2022-10-31 12:23:36 +01:00
parent b0b00863c0
commit d0e31431be
3 changed files with 5 additions and 10 deletions
+1 -3
View File
@@ -14,7 +14,7 @@
import { initFlow } from '$lib/components/flows/flowStore'
import { FlowService, type Flow } from '$lib/gen'
import { workspaceStore } from '$lib/stores'
import { decodeState, emptySchema, sendUserToast } from '$lib/utils'
import { decodeState, emptySchema } from '$lib/utils'
const initialState = $page.url.searchParams.get('state')
const hubId = $page.url.searchParams.get('hub')
@@ -44,13 +44,11 @@
Object.assign(flow, template)
flow = flow
$page.url.searchParams.delete('template')
sendUserToast('Code & arguments have been loaded from template.')
} else if (hubId) {
const hub = (await FlowService.getHubFlowById({ id: Number(hubId) })).flow
Object.assign(flow, hub)
flow = flow
$page.url.searchParams.delete('hub')
sendUserToast(`Flow has been loaded from hub flow id ${hubId}.`)
}
initFlow(flow)
}
+4 -6
View File
@@ -13,7 +13,7 @@
import { workspaceStore } from '$lib/stores'
import ScriptBuilder from '$lib/components/ScriptBuilder.svelte'
import type { Schema } from '$lib/common'
import { decodeState, emptySchema, getScriptByPath, sendUserToast } from '$lib/utils'
import { decodeState, emptySchema } from '$lib/utils'
import { dirtyStore } from '$lib/components/common/confirmationModal/dirtyStore'
// Default
@@ -54,17 +54,15 @@
script.content = template.content
script.schema = template.schema
script.language = template.language
sendUserToast('Code & arguments have been loaded from template.')
}
}
async function loadHub(): Promise<void> {
if (hubPath) {
const template = await getScriptByPath(hubPath)
const { content, language } = await ScriptService.getHubScriptByPath({ path: hubPath })
script.description = `Fork of ${hubPath}`
script.content = template.content
script.language = template.language as Script.language
sendUserToast(`Code has been loaded from hub script ${hubPath}.`)
script.content = content
script.language = language as Script.language
}
}
@@ -20,7 +20,6 @@
workspace_id
}
})
sendUserToast(`Invitation to ${workspace_id} accepted as ${username}`)
usersWorkspaceStore.set(await WorkspaceService.listUserWorkspaces())
workspaceStore.set(workspace_id)
goto($page.url.searchParams.get('rd') ?? '/scripts')