windmill-components 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/common.d.ts +29 -0
- package/components/ArgInfo.svelte +48 -0
- package/components/ArgInput.svelte +277 -0
- package/components/AutosizedTextarea.svelte +34 -0
- package/components/Badge.svelte +12 -0
- package/components/Button.svelte +82 -0
- package/components/ButtonAndDropdown.svelte +25 -0
- package/components/CenteredPage.svelte +5 -0
- package/components/ChevronButton.svelte +21 -0
- package/components/DisplayResult.svelte +101 -0
- package/components/Dropdown.svelte +108 -0
- package/components/Editor.svelte +370 -0
- package/components/FieldHeader.svelte +21 -0
- package/components/FlowBuilder.svelte +202 -0
- package/components/FlowEditor.svelte +95 -0
- package/components/FlowPreview.svelte +141 -0
- package/components/FlowStatusViewer.svelte +137 -0
- package/components/GroupModal.svelte +90 -0
- package/components/IconedResourceType.svelte +32 -0
- package/components/InviteGlobalUser.svelte +56 -0
- package/components/InviteUser.svelte +48 -0
- package/components/ItemPicker.svelte +58 -0
- package/components/JobStatus.svelte +38 -0
- package/components/Modal.svelte +94 -0
- package/components/ModuleStep.svelte +64 -0
- package/components/Multiselect.svelte +327 -0
- package/components/ObjectResourceInput.svelte +62 -0
- package/components/ObjectTypeNarrowing.svelte +25 -0
- package/components/PageHeader.svelte +29 -0
- package/components/Password.svelte +45 -0
- package/components/Path.svelte +129 -0
- package/components/RadioButton.svelte +117 -0
- package/components/Required.svelte +11 -0
- package/components/ResourceEditor.svelte +260 -0
- package/components/ResourcePicker.svelte +21 -0
- package/components/ResourceTypePicker.svelte +71 -0
- package/components/RunForm.svelte +127 -0
- package/components/SchemaEditor.svelte +221 -0
- package/components/SchemaForm.svelte +166 -0
- package/components/SchemaModal.svelte +160 -0
- package/components/SchemaViewer.svelte +76 -0
- package/components/ScriptBuilder.svelte +293 -0
- package/components/ScriptEditor.svelte +669 -0
- package/components/ScriptPicker.svelte +110 -0
- package/components/ScriptSchema.svelte +71 -0
- package/components/ShareModal.svelte +135 -0
- package/components/SharedBadge.svelte +54 -0
- package/components/StringTypeNarrowing.svelte +101 -0
- package/components/Switch.svelte +61 -0
- package/components/TableCustom.svelte +39 -0
- package/components/TableSimple.svelte +66 -0
- package/components/Tabs.svelte +21 -0
- package/components/Tooltip.svelte +93 -0
- package/components/VariableEditor.svelte +159 -0
- package/components/icons/DbIcon.svelte +12 -0
- package/components/icons/Mail.svelte +62 -0
- package/components/icons/Mysql.svelte +77 -0
- package/components/icons/PostgresIcon.svelte +57 -0
- package/components/icons/Slack.svelte +26 -0
- package/gen/core/ApiError.d.ts +8 -0
- package/gen/core/ApiRequestOptions.d.ts +13 -0
- package/gen/core/ApiResult.d.ts +7 -0
- package/gen/core/CancelablePromise.d.ts +26 -0
- package/gen/core/OpenAPI.d.ts +16 -0
- package/gen/core/request.d.ts +13 -0
- package/gen/index.d.ts +59 -0
- package/gen/models/AuditLog.d.ts +32 -0
- package/gen/models/CompletedJob.d.ts +48 -0
- package/gen/models/ContextualVariable.d.ts +5 -0
- package/gen/models/CreateResource.d.ts +6 -0
- package/gen/models/CreateVariable.d.ts +6 -0
- package/gen/models/CreateWorkspace.d.ts +6 -0
- package/gen/models/EditResource.d.ts +5 -0
- package/gen/models/EditResourceType.d.ts +4 -0
- package/gen/models/EditSchedule.d.ts +7 -0
- package/gen/models/EditVariable.d.ts +6 -0
- package/gen/models/EditWorkspaceUser.d.ts +3 -0
- package/gen/models/Flow.d.ts +13 -0
- package/gen/models/FlowModule.d.ts +6 -0
- package/gen/models/FlowModuleValue.d.ts +10 -0
- package/gen/models/FlowPreview.d.ts +7 -0
- package/gen/models/FlowStatus.d.ts +6 -0
- package/gen/models/FlowStatusModule.d.ts +15 -0
- package/gen/models/FlowValue.d.ts +5 -0
- package/gen/models/GlobalUserInfo.d.ts +14 -0
- package/gen/models/Group.d.ts +6 -0
- package/gen/models/InputTransform.d.ts +12 -0
- package/gen/models/Job.d.ts +11 -0
- package/gen/models/ListableVariable.d.ts +8 -0
- package/gen/models/Login.d.ts +4 -0
- package/gen/models/MainArgSignature.d.ts +14 -0
- package/gen/models/NewSchedule.d.ts +9 -0
- package/gen/models/NewToken.d.ts +4 -0
- package/gen/models/NewUser.d.ts +5 -0
- package/gen/models/Preview.d.ts +13 -0
- package/gen/models/QueuedJob.d.ts +47 -0
- package/gen/models/Resource.d.ts +8 -0
- package/gen/models/ResourceType.d.ts +6 -0
- package/gen/models/Schedule.d.ts +13 -0
- package/gen/models/Script.d.ts +29 -0
- package/gen/models/ScriptArgs.d.ts +1 -0
- package/gen/models/TruncatedToken.d.ts +7 -0
- package/gen/models/User.d.ts +10 -0
- package/gen/models/UserWorkspaceList.d.ts +8 -0
- package/gen/models/WorkerPing.d.ts +8 -0
- package/gen/models/Workspace.d.ts +6 -0
- package/gen/models/WorkspaceInvite.d.ts +5 -0
- package/gen/services/AdminService.d.ts +35 -0
- package/gen/services/AuditService.d.ts +37 -0
- package/gen/services/FlowService.d.ts +82 -0
- package/gen/services/GranularAclService.d.ts +42 -0
- package/gen/services/GroupService.d.ts +94 -0
- package/gen/services/JobService.d.ts +217 -0
- package/gen/services/ResourceService.d.ts +116 -0
- package/gen/services/ScheduleService.d.ts +73 -0
- package/gen/services/ScriptService.d.ts +165 -0
- package/gen/services/SettingsService.d.ts +15 -0
- package/gen/services/UserService.d.ts +211 -0
- package/gen/services/VariableService.d.ts +66 -0
- package/gen/services/WorkerService.d.ts +15 -0
- package/gen/services/WorkspaceService.d.ts +137 -0
- package/infer.d.ts +2 -0
- package/lib/components/ArgInfo.svelte.d.ts +16 -0
- package/lib/components/ArgInput.svelte.d.ts +37 -0
- package/lib/components/AutosizedTextarea.svelte.d.ts +19 -0
- package/lib/components/Badge.svelte.d.ts +20 -0
- package/lib/components/Button.svelte.d.ts +23 -0
- package/lib/components/ButtonAndDropdown.svelte.d.ts +23 -0
- package/lib/components/CenteredPage.svelte.d.ts +23 -0
- package/lib/components/ChevronButton.svelte.d.ts +19 -0
- package/lib/components/DisplayResult.svelte.d.ts +16 -0
- package/lib/components/Dropdown.svelte.d.ts +22 -0
- package/lib/components/Editor.svelte.d.ts +38 -0
- package/lib/components/FieldHeader.svelte.d.ts +23 -0
- package/lib/components/FlowBuilder.svelte.d.ts +18 -0
- package/lib/components/FlowEditor.svelte.d.ts +19 -0
- package/lib/components/FlowPreview.svelte.d.ts +21 -0
- package/lib/components/FlowStatusViewer.svelte.d.ts +18 -0
- package/lib/components/GroupModal.svelte.d.ts +17 -0
- package/lib/components/IconedResourceType.svelte.d.ts +19 -0
- package/lib/components/InviteGlobalUser.svelte.d.ts +19 -0
- package/lib/components/InviteUser.svelte.d.ts +19 -0
- package/lib/components/ItemPicker.svelte.d.ts +24 -0
- package/lib/components/JobStatus.svelte.d.ts +17 -0
- package/lib/components/Modal.svelte.d.ts +28 -0
- package/lib/components/ModuleStep.svelte.d.ts +26 -0
- package/lib/components/Multiselect.svelte.d.ts +33 -0
- package/lib/components/ObjectResourceInput.svelte.d.ts +17 -0
- package/lib/components/ObjectTypeNarrowing.svelte.d.ts +16 -0
- package/lib/components/PageHeader.svelte.d.ts +20 -0
- package/lib/components/Password.svelte.d.ts +18 -0
- package/lib/components/Path.svelte.d.ts +26 -0
- package/lib/components/RadioButton.svelte.d.ts +21 -0
- package/lib/components/Required.svelte.d.ts +17 -0
- package/lib/components/ResourceEditor.svelte.d.ts +22 -0
- package/lib/components/ResourcePicker.svelte.d.ts +17 -0
- package/lib/components/ResourceTypePicker.svelte.d.ts +19 -0
- package/lib/components/RunForm.svelte.d.ts +22 -0
- package/lib/components/SchemaEditor.svelte.d.ts +22 -0
- package/lib/components/SchemaForm.svelte.d.ts +23 -0
- package/lib/components/SchemaModal.svelte.d.ts +44 -0
- package/lib/components/SchemaViewer.svelte.d.ts +17 -0
- package/lib/components/ScriptBuilder.svelte.d.ts +20 -0
- package/lib/components/ScriptEditor.svelte.d.ts +28 -0
- package/lib/components/ScriptPicker.svelte.d.ts +21 -0
- package/lib/components/ScriptSchema.svelte.d.ts +22 -0
- package/lib/components/ShareModal.svelte.d.ts +21 -0
- package/lib/components/SharedBadge.svelte.d.ts +17 -0
- package/lib/components/StringTypeNarrowing.svelte.d.ts +18 -0
- package/lib/components/Switch.svelte.d.ts +31 -0
- package/lib/components/TableCustom.svelte.d.ts +25 -0
- package/lib/components/TableSimple.svelte.d.ts +24 -0
- package/lib/components/Tabs.svelte.d.ts +20 -0
- package/lib/components/Tooltip.svelte.d.ts +20 -0
- package/lib/components/VariableEditor.svelte.d.ts +21 -0
- package/lib/components/icons/DbIcon.svelte.d.ts +17 -0
- package/lib/components/icons/Mail.svelte.d.ts +17 -0
- package/lib/components/icons/Mysql.svelte.d.ts +17 -0
- package/lib/components/icons/PostgresIcon.svelte.d.ts +17 -0
- package/lib/components/icons/Slack.svelte.d.ts +17 -0
- package/package.json +110 -0
- package/stores.d.ts +19 -0
- package/utils.d.ts +60 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script>import { emptySchema } from '../../utils';
|
|
2
|
+
import Highlight from 'svelte-highlight';
|
|
3
|
+
import json from 'svelte-highlight/languages/json';
|
|
4
|
+
import github from 'svelte-highlight/styles/github';
|
|
5
|
+
import TableCustom from './TableCustom.svelte';
|
|
6
|
+
export let schema = emptySchema();
|
|
7
|
+
let viewJsonSchema = false;
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<svelte:head>
|
|
11
|
+
{@html github}
|
|
12
|
+
</svelte:head>
|
|
13
|
+
|
|
14
|
+
<div class="w-full">
|
|
15
|
+
<div class="flex flex-col sm:flex-row text-base">
|
|
16
|
+
<button
|
|
17
|
+
class="text-xs sm:text-base py-1 px-6 block hover:text-blue-500 focus:outline-noneborder-gray-200 {viewJsonSchema
|
|
18
|
+
? 'text-gray-500 '
|
|
19
|
+
: 'text-gray-700 font-semibold '}"
|
|
20
|
+
on:click={() => (viewJsonSchema = false)}
|
|
21
|
+
>
|
|
22
|
+
arguments
|
|
23
|
+
</button><button
|
|
24
|
+
class="py-1 px-6 block hover:text-blue-500 focus:outline-none border-gray-200 {viewJsonSchema
|
|
25
|
+
? 'text-gray-700 font-semibold '
|
|
26
|
+
: 'text-gray-500'}"
|
|
27
|
+
on:click={() => (viewJsonSchema = true)}
|
|
28
|
+
>
|
|
29
|
+
advanced
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<!--json schema or table view-->
|
|
34
|
+
<div class="border-t py-1">
|
|
35
|
+
<div class={viewJsonSchema ? 'hidden' : ''}>
|
|
36
|
+
{#if schema && schema.properties && Object.keys(schema.properties).length > 0 && schema.required}
|
|
37
|
+
<div class="flex flex-row">
|
|
38
|
+
<TableCustom>
|
|
39
|
+
<tr slot="header-row" class="underline">
|
|
40
|
+
<th>name</th>
|
|
41
|
+
<th>type</th>
|
|
42
|
+
<th>description</th>
|
|
43
|
+
<th>default</th>
|
|
44
|
+
<th>format</th>
|
|
45
|
+
<th>required</th>
|
|
46
|
+
</tr>
|
|
47
|
+
<tbody slot="body">
|
|
48
|
+
{#each Object.entries(schema.properties) as [name, property] (name)}
|
|
49
|
+
<tr>
|
|
50
|
+
<td>{name}</td>
|
|
51
|
+
<td
|
|
52
|
+
>{#if !property.type} any {:else} {property.type} {/if}</td
|
|
53
|
+
>
|
|
54
|
+
<td>{property.description}</td>
|
|
55
|
+
<td
|
|
56
|
+
>{property.default == '<function call>'
|
|
57
|
+
? '<function call>'
|
|
58
|
+
: property.default
|
|
59
|
+
? JSON.stringify(property.default)
|
|
60
|
+
: ''}</td
|
|
61
|
+
>
|
|
62
|
+
<td>{property.format ?? ''}</td>
|
|
63
|
+
<td>{schema.required.includes(name) ? 'required' : 'optional'}</td>
|
|
64
|
+
</tr>
|
|
65
|
+
{/each}
|
|
66
|
+
</tbody>
|
|
67
|
+
</TableCustom>
|
|
68
|
+
</div>
|
|
69
|
+
{:else}
|
|
70
|
+
<div class="text-gray-700 text-xs italic">This script has no argument</div>
|
|
71
|
+
{/if}
|
|
72
|
+
</div>
|
|
73
|
+
<div class={viewJsonSchema ? '' : 'hidden'}>
|
|
74
|
+
<Highlight language={json} code={JSON.stringify(schema, null, 4)} />
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
<script context="module">
|
|
2
|
+
const PYTHON_INIT_CODE = `import os
|
|
3
|
+
import wmill
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
# Our webeditor includes a syntax, type checker through a language server running pyright
|
|
6
|
+
# and the autoformatter Black in our servers. Use Cmd/Ctrl + S to autoformat the code.
|
|
7
|
+
# Beware that the code is only saved when you click Save and not across reload.
|
|
8
|
+
# You can however navigate to any steps safely.
|
|
9
|
+
"""
|
|
10
|
+
The client is used to interact with windmill itself through its standard API.
|
|
11
|
+
One can explore the methods available through autocompletion of \`client.XXX\`.
|
|
12
|
+
Only the most common methods are included for ease of use. Request more as
|
|
13
|
+
feedback if you feel you are missing important ones.
|
|
14
|
+
"""
|
|
15
|
+
def main(name: str = "Nicolas Bourbaki",
|
|
16
|
+
age: int = 42,
|
|
17
|
+
obj: dict = {"even": "dicts"},
|
|
18
|
+
l: list = ["or", "lists!"],
|
|
19
|
+
file_: bytes = bytes(0),
|
|
20
|
+
dtime: datetime = datetime.now()):
|
|
21
|
+
"""A main function is required for the script to be able to accept arguments.
|
|
22
|
+
Types are recommended."""
|
|
23
|
+
print(f"Hello World and a warm welcome especially to {name}")
|
|
24
|
+
print("and its acolytes..", age, obj, l, len(file_), dtime)
|
|
25
|
+
# retrieve variables, including secrets by querying the windmill platform.
|
|
26
|
+
# secret fetching is audited by windmill.
|
|
27
|
+
secret = wmill.get_variable("g/all/pretty_secret")
|
|
28
|
+
print(f"The env variable at \`g_all/pretty_secret\`: {secret}")
|
|
29
|
+
# interact with the windmill platform to get the version
|
|
30
|
+
version = wmill.get_version()
|
|
31
|
+
# fetch reserved variables as environment variables
|
|
32
|
+
user = os.environ.get("WM_USERNAME")
|
|
33
|
+
# the return value is then parsed and can be retrieved by other scripts conveniently
|
|
34
|
+
return {"version": version, "splitted": name.split(), "user": user}
|
|
35
|
+
`
|
|
36
|
+
const DENO_INIT_CODE = `
|
|
37
|
+
// only do the following import if you require your script to interact with the windmill
|
|
38
|
+
// for instance to get a variable or resource
|
|
39
|
+
// import * as wmill from 'https://deno.land/x/windmill@v${__pkg__.version}/index.ts'
|
|
40
|
+
|
|
41
|
+
export async function main(x: string, y: string = 'default arg') {
|
|
42
|
+
// let x = await wmill.getVariable('u/user/foo');
|
|
43
|
+
// let y = await wmill.getResource('u/user/foo')
|
|
44
|
+
return { foo: x }
|
|
45
|
+
}
|
|
46
|
+
`
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<script>import { ScriptService } from '../../gen';
|
|
50
|
+
import { emptySchema, sendUserToast } from '../../utils';
|
|
51
|
+
import { onDestroy } from 'svelte';
|
|
52
|
+
import ScriptEditor from './ScriptEditor.svelte';
|
|
53
|
+
import { page } from '$app/stores';
|
|
54
|
+
import { goto } from '$app/navigation';
|
|
55
|
+
import Path from './Path.svelte';
|
|
56
|
+
import SvelteMarkdown from 'svelte-markdown';
|
|
57
|
+
import { workspaceStore } from '../../stores';
|
|
58
|
+
import ScriptSchema from './ScriptSchema.svelte';
|
|
59
|
+
import { inferArgs } from '../../infer';
|
|
60
|
+
import Required from './Required.svelte';
|
|
61
|
+
import RadioButton from './RadioButton.svelte';
|
|
62
|
+
let editor;
|
|
63
|
+
let scriptSchema;
|
|
64
|
+
$: step = Number($page.url.searchParams.get('step')) || 1;
|
|
65
|
+
export let script;
|
|
66
|
+
export let initialPath = '';
|
|
67
|
+
$: {
|
|
68
|
+
$page.url.searchParams.set('state', btoa(JSON.stringify(script)));
|
|
69
|
+
history.replaceState({}, '', $page.url);
|
|
70
|
+
}
|
|
71
|
+
if (script.content == '') {
|
|
72
|
+
initContent(script.language);
|
|
73
|
+
}
|
|
74
|
+
function initContent(lang) {
|
|
75
|
+
script.content = lang == 'deno' ? DENO_INIT_CODE : PYTHON_INIT_CODE;
|
|
76
|
+
}
|
|
77
|
+
async function editScript() {
|
|
78
|
+
try {
|
|
79
|
+
const newHash = await ScriptService.createScript({
|
|
80
|
+
workspace: $workspaceStore,
|
|
81
|
+
requestBody: {
|
|
82
|
+
path: script.path,
|
|
83
|
+
summary: script.summary,
|
|
84
|
+
description: script.description ?? '',
|
|
85
|
+
content: script.content,
|
|
86
|
+
parent_hash: script.hash != '' ? script.hash : undefined,
|
|
87
|
+
schema: script.schema,
|
|
88
|
+
is_template: script.is_template,
|
|
89
|
+
language: script.language
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
sendUserToast(`Success! New script version created with hash ${newHash}`);
|
|
93
|
+
goto(`/scripts/get/${newHash}`);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
sendUserToast(`Impossible to save the script: ${error.body}`, true);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function setCode(script) {
|
|
100
|
+
editor?.getEditor().setCode(script.content);
|
|
101
|
+
if (scriptSchema) {
|
|
102
|
+
if (script.schema) {
|
|
103
|
+
scriptSchema.setSchema(script.schema);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
scriptSchema.setSchema(emptySchema());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function inferSchema() {
|
|
111
|
+
await inferArgs(script.language, script.content, script.schema);
|
|
112
|
+
}
|
|
113
|
+
async function changeStep(step) {
|
|
114
|
+
if (step == 3) {
|
|
115
|
+
script.content = editor?.getEditor().getCode() ?? script.content;
|
|
116
|
+
await inferSchema();
|
|
117
|
+
script.schema = script.schema;
|
|
118
|
+
}
|
|
119
|
+
goto(`?step=${step}`);
|
|
120
|
+
}
|
|
121
|
+
onDestroy(() => {
|
|
122
|
+
editor?.$destroy();
|
|
123
|
+
});
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<div class="flex flex-col h-screen max-w-screen-lg xl:-ml-20 xl:pl-4 w-full -mt-4 pt-4 md:mx-10 ">
|
|
127
|
+
<!-- Nav between steps-->
|
|
128
|
+
<div class="flex flex-col w-full">
|
|
129
|
+
<div class="justify-between flex flex-row drop-shadow-sm w-full">
|
|
130
|
+
<div class="wizard-nav flex flex-row w-full">
|
|
131
|
+
<button
|
|
132
|
+
class="{step === 1
|
|
133
|
+
? 'default-button-disabled text-gray-700'
|
|
134
|
+
: 'default-button-secondary'} min-w-max ml-2"
|
|
135
|
+
on:click={() => {
|
|
136
|
+
changeStep(1)
|
|
137
|
+
}}>Step 1: Metadata</button
|
|
138
|
+
>
|
|
139
|
+
<button
|
|
140
|
+
class="{step === 2
|
|
141
|
+
? 'default-button-disabled text-gray-700'
|
|
142
|
+
: 'default-button-secondary'} min-w-max ml-2"
|
|
143
|
+
on:click={() => {
|
|
144
|
+
changeStep(2)
|
|
145
|
+
}}>Step 2: Code</button
|
|
146
|
+
>
|
|
147
|
+
<button
|
|
148
|
+
class="{step === 3
|
|
149
|
+
? 'default-button-disabled text-gray-700'
|
|
150
|
+
: 'default-button-secondary'} min-w-max ml-2"
|
|
151
|
+
on:click={() => {
|
|
152
|
+
changeStep(3)
|
|
153
|
+
}}>Step 3: UI customisation</button
|
|
154
|
+
>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="flex flex-row-reverse ml-2">
|
|
157
|
+
{#if step != 3}
|
|
158
|
+
<button
|
|
159
|
+
disabled={step == 1 &&
|
|
160
|
+
(script.path == undefined || script.path == '' || script.path.split('/')[2] == '')}
|
|
161
|
+
class="default-button px-6 max-h-8"
|
|
162
|
+
on:click={() => {
|
|
163
|
+
changeStep(step + 1)
|
|
164
|
+
}}>Next</button
|
|
165
|
+
>
|
|
166
|
+
{#if step == 2}
|
|
167
|
+
<button
|
|
168
|
+
class="default-button-secondary px-6 max-h-8 mr-2"
|
|
169
|
+
on:click={async () => {
|
|
170
|
+
await inferSchema()
|
|
171
|
+
editScript()
|
|
172
|
+
}}>Save (commit)</button
|
|
173
|
+
>
|
|
174
|
+
{/if}
|
|
175
|
+
{:else}
|
|
176
|
+
<button class="default-button px-6 self-end" on:click={editScript}>Save (commit)</button>
|
|
177
|
+
{/if}
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
<div class="flex flex-row-reverse">
|
|
181
|
+
<span class="my-1 text-sm text-gray-500 italic">
|
|
182
|
+
{#if script.hash != ''} Editing from {script.hash} with path{/if}
|
|
183
|
+
{#if initialPath && initialPath != script.path} {initialPath} → {/if}
|
|
184
|
+
{script.path}
|
|
185
|
+
</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<!-- metadata -->
|
|
190
|
+
{#if step === 1}
|
|
191
|
+
<div class="grid grid-cols-1 gap-6 max-w-7xl">
|
|
192
|
+
<Path bind:path={script.path} {initialPath} namePlaceholder="example/my/script">
|
|
193
|
+
<div slot="ownerToolkit" class="text-gray-700 text-2xs">
|
|
194
|
+
Script permissions depend on their path. Select the group <span class="font-mono"
|
|
195
|
+
>all</span
|
|
196
|
+
>
|
|
197
|
+
to share your script, and <span class="font-mono">user</span> to keep it private.
|
|
198
|
+
<a href="https://docs.windmill.dev/docs/reference/namespaces">docs</a>
|
|
199
|
+
</div>
|
|
200
|
+
</Path>
|
|
201
|
+
<h3 class="text-gray-700 pb-1 border-b">Language</h3>
|
|
202
|
+
<div class="max-w-md">
|
|
203
|
+
<RadioButton
|
|
204
|
+
label="Language"
|
|
205
|
+
small={true}
|
|
206
|
+
options={[
|
|
207
|
+
['Python 3.10', 'python3'],
|
|
208
|
+
['Typescript (Deno) WIP', 'deno']
|
|
209
|
+
]}
|
|
210
|
+
on:change={(e) => initContent(e.detail)}
|
|
211
|
+
bind:value={script.language}
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
<h3 class="text-gray-700 pb-1 border-b">Metadata</h3>
|
|
215
|
+
|
|
216
|
+
<label class="block ">
|
|
217
|
+
<span class="text-gray-700">Summary <Required required={false} /></span>
|
|
218
|
+
<textarea
|
|
219
|
+
bind:value={script.summary}
|
|
220
|
+
class="
|
|
221
|
+
mt-1
|
|
222
|
+
block
|
|
223
|
+
w-full
|
|
224
|
+
rounded-md
|
|
225
|
+
border-gray-300
|
|
226
|
+
shadow-sm
|
|
227
|
+
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
228
|
+
"
|
|
229
|
+
placeholder="A very short summary of the script displayed when the script is listed"
|
|
230
|
+
rows="1"
|
|
231
|
+
/>
|
|
232
|
+
</label>
|
|
233
|
+
<label class="block ">
|
|
234
|
+
<span class="text-gray-700"
|
|
235
|
+
>Description<Required required={false} detail="accept markdown formatting" />
|
|
236
|
+
<textarea
|
|
237
|
+
bind:value={script.description}
|
|
238
|
+
class="
|
|
239
|
+
mt-1
|
|
240
|
+
block
|
|
241
|
+
w-full
|
|
242
|
+
rounded-md
|
|
243
|
+
border-gray-300
|
|
244
|
+
shadow-sm
|
|
245
|
+
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
246
|
+
"
|
|
247
|
+
placeholder="A description to help users understand what this script does and how to use it."
|
|
248
|
+
rows="3"
|
|
249
|
+
/>
|
|
250
|
+
</span></label
|
|
251
|
+
>
|
|
252
|
+
<label class="block">
|
|
253
|
+
<span class="text-gray-700 mr-2">Save as template</span>
|
|
254
|
+
<input type="checkbox" bind:checked={script.is_template} />
|
|
255
|
+
</label>
|
|
256
|
+
|
|
257
|
+
<div>
|
|
258
|
+
<h3 class="text-gray-700 ">Description rendered</h3>
|
|
259
|
+
<div
|
|
260
|
+
class="prose mt-5 text-xs shadow-inner shadow-blue p-4 overflow-auto"
|
|
261
|
+
style="max-height: 200px;"
|
|
262
|
+
>
|
|
263
|
+
<SvelteMarkdown source={script.description ?? ''} />
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
{:else if step === 2}
|
|
268
|
+
<div class="flex-1 overflow-auto">
|
|
269
|
+
<ScriptEditor
|
|
270
|
+
bind:this={editor}
|
|
271
|
+
bind:schema={script.schema}
|
|
272
|
+
path={script.path}
|
|
273
|
+
bind:code={script.content}
|
|
274
|
+
lang={script.language}
|
|
275
|
+
/>
|
|
276
|
+
</div>
|
|
277
|
+
{:else if step === 3}
|
|
278
|
+
<ScriptSchema
|
|
279
|
+
bind:summary={script.summary}
|
|
280
|
+
bind:description={script.description}
|
|
281
|
+
bind:schema={script.schema}
|
|
282
|
+
/>
|
|
283
|
+
{/if}
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<style>
|
|
287
|
+
/* .wizard-nav {
|
|
288
|
+
@apply w-1/2 sm:w-1/4;
|
|
289
|
+
} */
|
|
290
|
+
|
|
291
|
+
.wizard-nav button {
|
|
292
|
+
max-height: 30px;
|
|
293
|
+
}</style>
|