All scripts owned by you (and visible only to you if you do not explicitely share them)
- will be displayed below
{:else if sectionTab == 'groups'}
Groups that I am member of
- All scripts being owned by groups that you are member of will be displayed below
+ All scripts being owned by groups that you are member of
{:else if sectionTab == 'shared'}
Shared with me
- All scripts visible to you because they have been shared to you will be displayed below
+ All scripts visible to you because they have been shared to you
- {:else if sectionTab == 'community'}
-
Community templates & examples
+ {:else if sectionTab == 'examples'}
+
Shared across all workspaces of this instance
- All scripts by the community that went through a review process and merged to the
- official github repo will be displayed
- below. Contributions welcome as Github PR.
+ Template and examples shared across all workspaces of this instance. They are managed
+ from a special workspace called 'starter' that only superadmin can change.
+ {:else if sectionTab == 'hub'}
+
Approved scripts from the WindmillHub
+
+ All approved Deno scripts from the WindmillHub.
+ Approved scripts have been reviewed by the Windmill team and are safe to use in
+ production. The hub only offers Deno scripts because Hub scripts are meant to be solely
+ used as building blocks of flows and are much more efficient to execute than their
+ Python counterparts.
+
owner: {section}
{#if section == 'g/all'}
- 'g/all' is the namespace for the group all. Every user is a member of all.
Everything in this namespace is visible by all users. At the opposite, 'u/myuser'
are private user namespaces.
- import { ScriptService, type Script } from '$lib/gen'
+ import { Script, ScriptService } from '$lib/gen'
import { page } from '$app/stores'
import { workspaceStore } from '$lib/stores'
import ScriptBuilder from '$lib/components/ScriptBuilder.svelte'
import type { Schema } from '$lib/common'
- import { emptySchema, sendUserToast } from '$lib/utils'
+ import { emptySchema, getScriptByPath, sendUserToast } from '$lib/utils'
// Default
let schema: Schema = emptySchema()
$: templatePath = $page.url.searchParams.get('template')
+ $: hubPath = $page.url.searchParams.get('hub')
const initialState = $page.url.searchParams.get('state')
@@ -47,9 +48,20 @@
}
}
+ async function loadHub(): Promise {
+ if (hubPath) {
+ const template = await getScriptByPath(hubPath)
+ script.summary = `Fork of ${hubPath}`
+ script.content = template.content
+ script.language = Script.language.DENO
+ sendUserToast(`Code has been loaded from hub script ${hubPath}.`)
+ }
+ }
+
$: {
if ($workspaceStore) {
loadTemplate()
+ loadHub()
}
}