windmill-components 1.309.2 → 1.309.4

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.
@@ -1,5 +1,4 @@
1
1
  <script>import { DraftService, ScriptService, ScheduleService } from '../gen';
2
- import { goto } from '$app/navigation';
3
2
  import { page } from '$app/stores';
4
3
  import { inferArgs } from '../infer';
5
4
  import { initialCode } from '../script_helpers';
@@ -32,6 +31,7 @@ import ScriptSchedules from './ScriptSchedules.svelte';
32
31
  import { writable } from 'svelte/store';
33
32
  import { loadScriptSchedule, defaultScriptLanguages } from '../scripts';
34
33
  import DefaultScripts from './DefaultScripts.svelte';
34
+ import { createEventDispatcher } from 'svelte';
35
35
  export let script;
36
36
  export let initialPath = '';
37
37
  export let template = 'script';
@@ -59,6 +59,7 @@ async function loadSchedule() {
59
59
  scheduleStore.set(scheduleRes);
60
60
  }
61
61
  }
62
+ const dispatch = createEventDispatcher();
62
63
  $: {
63
64
  if (initialPath != '') {
64
65
  loadSchedule();
@@ -228,7 +229,7 @@ async function editScript(stay) {
228
229
  script.parent_hash = newHash;
229
230
  }
230
231
  else {
231
- goto(`/scripts/get/${newHash}?workspace=${$workspaceStore}`);
232
+ dispatch('deploy', newHash);
232
233
  }
233
234
  }
234
235
  catch (error) {
@@ -323,7 +324,7 @@ async function saveDraft(forceSave = false) {
323
324
  };
324
325
  if (initialPath == '' || (savedScript?.draft_only && script.path !== initialPath)) {
325
326
  initialPath = script.path;
326
- goto(`/scripts/edit/${script.path}`);
327
+ dispatch('saveInitial', script.path);
327
328
  }
328
329
  sendUserToast('Saved as draft');
329
330
  }
@@ -352,7 +353,7 @@ function computeDropdownItems(initialPath) {
352
353
  {
353
354
  label: 'Exit & See details',
354
355
  onClick: () => {
355
- goto(`/scripts/get/${initialPath}?workspace=${$workspaceStore}`);
356
+ dispatch('seeDetails', initialPath);
356
357
  }
357
358
  }
358
359
  ]
@@ -15,6 +15,9 @@ declare const __propDef: {
15
15
  };
16
16
  events: {
17
17
  focus: FocusEvent;
18
+ deploy: CustomEvent<any>;
19
+ saveInitial: CustomEvent<any>;
20
+ seeDetails: CustomEvent<any>;
18
21
  } & {
19
22
  [evt: string]: CustomEvent<any>;
20
23
  };
@@ -9,6 +9,8 @@ import { editor as meditor, KeyCode, KeyMod, Uri as mUri, languages } from 'mona
9
9
  import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution';
10
10
  import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution';
11
11
  import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution';
12
+ import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
13
+ import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
12
14
  import 'monaco-editor/esm/vs/language/json/monaco.contribution';
13
15
  import 'monaco-editor/esm/vs/basic-languages/css/css.contribution';
14
16
  import 'monaco-editor/esm/vs/language/css/monaco.contribution';
@@ -3,6 +3,8 @@ import { editor as meditor } from 'monaco-editor';
3
3
  import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution';
4
4
  import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution';
5
5
  import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution';
6
+ import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
7
+ import 'monaco-editor/esm/vs/language/typescript/monaco.contribution';
6
8
  import 'monaco-editor/esm/vs/language/json/monaco.contribution';
7
9
  import 'monaco-editor/esm/vs/basic-languages/css/css.contribution';
8
10
  import 'monaco-editor/esm/vs/language/css/monaco.contribution';
@@ -56,7 +56,7 @@ onMount(async () => {
56
56
  try {
57
57
  let renderer = globalThis.windmill[customComponent?.name ?? 'no_name'];
58
58
  if (!renderer) {
59
- sendUserToast('Custom Component seem to be ill-defined (renderer missing)', true);
59
+ sendUserToast('Custom Component seem to be ill-defined (renderer missing). is COMPONENT_NAME in vite.config.ts matching the name of the custom component?', true);
60
60
  return;
61
61
  }
62
62
  renderer?.(ccProps);
@@ -42,7 +42,8 @@ async function addCustomComponent(nameField) {
42
42
  dispatch('reload');
43
43
  }
44
44
  catch (e) {
45
- sendUserToast('Component creation failed. You need write privilege on folder app_custom: ' + e.body ?? e, true);
45
+ sendUserToast('Component creation failed. Is the file uploaded, did you give it a name ? Do you have write privilege on folder app_custom: ' +
46
+ e.body ?? e, true);
46
47
  }
47
48
  getCustomComponents();
48
49
  nameField = '';
@@ -29,7 +29,7 @@ export declare const DENO_INIT_CODE_APPROVAL = "import * as wmill from \"npm:win
29
29
  export declare const BUN_INIT_CODE_APPROVAL = "import * as wmill from \"windmill-client@^1.158.2\"\n\nexport async function main(approver?: string) {\n const urls = await wmill.getResumeUrls(approver)\n // send the urls to their intended recipients\n\n\n // if the resumeUrls are part of the response, they will be available to any persons having access\n // to the run page and allowed to be approved from there, even from non owners of the flow\n // self-approval is disablable in the suspend options\n return {\n \t...urls,\n\t\tdefault_args: {},\n\t\tenums: {},\n\t\tdescription: undefined\n\t\t// supports all formats from rich display rendering such as simple strings,\n\t\t// but also markdown, html, images, tables, maps, render_all, etc...\n\t\t// https://www.windmill.dev/docs/core_concepts/rich_display_rendering\n }\n}";
30
30
  export declare const PYTHON_INIT_CODE_APPROVAL = "import wmill\n\ndef main():\n urls = wmill.get_resume_urls()\n # send the urls to their intended recipients\n\n # if the get_resume_urls are part of the response, they will be available to any persons having access\n # to the run page and allowed to be approved from there, even from non owners of the flow\n # self-approval is disablable in the suspend options\n return { \n **urls, \n \"default_args\": {}, \n \"enums\": {}, \n \"description\": None,\n # supports all formats from rich display rendering such as simple strings,\n # but also markdown, html, images, tables, maps, render_all, etc...\n # https://www.windmill.dev/docs/core_concepts/rich_display_rendering\n }\n";
31
31
  export declare const DOCKER_INIT_CODE = "# shellcheck shell=bash\n# Bash script that calls docker as a client to the host daemon\n# See documentation: https://www.windmill.dev/docs/advanced/docker\nmsg=\"${1:-world}\"\n\nIMAGE=\"alpine:latest\"\nCOMMAND=\"/bin/echo Hello $msg\"\n\n# ensure that the image is up-to-date\ndocker pull $IMAGE\ndocker run --rm $IMAGE $COMMAND\n";
32
- export declare const POWERSHELL_INIT_CODE = "param($Msg, $Dflt = \"default value\", [int]$Nb = 3)\n\n# Import-Module MyModule\n\n# the last line of the stdout is the return value\nWrite-Output \"Hello $Msg\"";
32
+ export declare const POWERSHELL_INIT_CODE = "param($Msg, $Dflt = \"default value\", [int]$Nb = 3)\n\n# Import-Module MyModule\n\n# Import-Module WindmillClient\n# Connect-Windmill\n# Get-WindmillVariable -Path 'u/user/foo'\n\n# the last line of the stdout is the return value\nWrite-Output \"Hello $Msg\"";
33
33
  export declare function isInitialCode(content: string): boolean;
34
34
  export declare function initialCode(language: SupportedLanguage | undefined, kind: Script['kind'] | undefined, subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | 'powershell' | undefined): string;
35
35
  export declare function getResetCode(language: SupportedLanguage | undefined, kind: Script['kind'] | undefined, subkind: 'pgsql' | 'mysql' | 'flow' | 'script' | 'fetch' | 'docker' | 'powershell' | undefined): string;
@@ -317,6 +317,10 @@ export const POWERSHELL_INIT_CODE = `param($Msg, $Dflt = "default value", [int]$
317
317
 
318
318
  # Import-Module MyModule
319
319
 
320
+ # Import-Module WindmillClient
321
+ # Connect-Windmill
322
+ # Get-WindmillVariable -Path 'u/user/foo'
323
+
320
324
  # the last line of the stdout is the return value
321
325
  Write-Output "Hello $Msg"`;
322
326
  const ALL_INITIAL_CODE = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.309.2",
3
+ "version": "1.309.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",
@@ -225,6 +225,11 @@
225
225
  "svelte": "./package/components/FlowBuilder.svelte",
226
226
  "default": "./package/components/FlowBuilder.svelte"
227
227
  },
228
+ "./components/ScriptBuilder.svelte": {
229
+ "types": "./package/components/ScriptBuilder.svelte.d.ts",
230
+ "svelte": "./package/components/ScriptBuilder.svelte",
231
+ "default": "./package/components/ScriptBuilder.svelte"
232
+ },
228
233
  "./components/FlowEditor.svelte": {
229
234
  "types": "./package/components/flows/FlowEditor.svelte.d.ts",
230
235
  "svelte": "./package/components/flows/FlowEditor.svelte",
@@ -360,6 +365,9 @@
360
365
  "components/FlowBuilder.svelte": [
361
366
  "./package/components/FlowBuilder.svelte.d.ts"
362
367
  ],
368
+ "components/ScriptBuilder.svelte": [
369
+ "./package/components/ScriptBuilder.svelte.d.ts"
370
+ ],
363
371
  "components/FlowEditor.svelte": [
364
372
  "./package/components/flows/FlowEditor.svelte.d.ts"
365
373
  ],