windmill-components 1.22.0 → 1.28.2

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.
Files changed (252) hide show
  1. package/components/AppConnect.svelte +93 -47
  2. package/components/AppConnect.svelte.d.ts +2 -2
  3. package/components/ArgInfo.svelte +0 -5
  4. package/components/ArgInput.svelte +91 -64
  5. package/components/ArgInput.svelte.d.ts +8 -3
  6. package/components/Button.svelte +4 -4
  7. package/components/CenteredPage.svelte +1 -1
  8. package/components/CollapseLink.svelte +12 -0
  9. package/components/CollapseLink.svelte.d.ts +19 -0
  10. package/components/CronInput.svelte +84 -0
  11. package/components/CronInput.svelte.d.ts +18 -0
  12. package/components/DisplayResult.svelte +28 -15
  13. package/components/Editor.svelte +144 -61
  14. package/components/Editor.svelte.d.ts +2 -0
  15. package/components/EditorBar.svelte +215 -0
  16. package/components/EditorBar.svelte.d.ts +23 -0
  17. package/components/FlowBuilder.svelte +155 -79
  18. package/components/FlowEditor.svelte +75 -200
  19. package/components/FlowEditor.svelte.d.ts +3 -2
  20. package/components/FlowJobResult.svelte +1 -1
  21. package/components/FlowPreview.svelte +18 -24
  22. package/components/FlowPreviewContent.svelte +68 -0
  23. package/components/FlowPreviewContent.svelte.d.ts +21 -0
  24. package/components/FlowStatusViewer.svelte +85 -37
  25. package/components/FlowStatusViewer.svelte.d.ts +3 -2
  26. package/components/FlowViewer.svelte +98 -26
  27. package/components/FlowViewer.svelte.d.ts +2 -2
  28. package/components/IconedResourceType.svelte +30 -5
  29. package/components/InputTransformForm.svelte +209 -0
  30. package/components/InputTransformForm.svelte.d.ts +26 -0
  31. package/components/InputTransformsViewer.svelte +19 -0
  32. package/components/InputTransformsViewer.svelte.d.ts +17 -0
  33. package/components/InviteGlobalUser.svelte +2 -2
  34. package/components/InviteUser.svelte +2 -2
  35. package/components/JobStatus.svelte +32 -25
  36. package/components/Modal.svelte +44 -42
  37. package/components/ModuleStep.svelte +99 -76
  38. package/components/ObjectResourceInput.svelte +58 -38
  39. package/components/ObjectTypeNarrowing.svelte +4 -19
  40. package/components/Path.svelte +1 -1
  41. package/components/Path.svelte.d.ts +1 -1
  42. package/components/RadioButton.svelte +11 -96
  43. package/components/RadioButton.svelte.d.ts +4 -2
  44. package/components/ResourceEditor.svelte +4 -5
  45. package/components/ResourceEditor.svelte.d.ts +2 -2
  46. package/components/ResourcePicker.svelte +25 -2
  47. package/components/ResourcePicker.svelte.d.ts +3 -0
  48. package/components/ResourceTypePicker.svelte +17 -29
  49. package/components/ResourceTypePicker.svelte.d.ts +1 -0
  50. package/components/RunForm.svelte +14 -15
  51. package/components/RunForm.svelte.d.ts +1 -1
  52. package/components/SchemaEditor.svelte +87 -71
  53. package/components/SchemaEditor.svelte.d.ts +2 -0
  54. package/components/SchemaEditorProperty.svelte +11 -0
  55. package/components/SchemaEditorProperty.svelte.d.ts +17 -0
  56. package/components/SchemaForm.svelte +21 -127
  57. package/components/SchemaForm.svelte.d.ts +3 -4
  58. package/components/SchemaModal.svelte +20 -33
  59. package/components/SchemaModal.svelte.d.ts +1 -1
  60. package/components/SchemaViewer.svelte +5 -7
  61. package/components/ScriptBuilder.svelte +40 -43
  62. package/components/ScriptEditor.svelte +76 -248
  63. package/components/ScriptPicker.svelte +13 -26
  64. package/components/ScriptPicker.svelte.d.ts +1 -1
  65. package/components/ScriptSchema.svelte +0 -5
  66. package/components/ShareModal.svelte +1 -1
  67. package/components/SharedBadge.svelte +12 -10
  68. package/components/StringTypeNarrowing.svelte +8 -4
  69. package/components/StringTypeNarrowing.svelte.d.ts +1 -0
  70. package/components/TableCustom.svelte +7 -9
  71. package/components/TableSimple.svelte +1 -1
  72. package/components/Toggle.svelte +8 -10
  73. package/components/Toggle.svelte.d.ts +5 -11
  74. package/components/Tooltip.svelte +3 -2
  75. package/components/VariableEditor.svelte +21 -6
  76. package/components/flows/CopyFirstStepSchema.svelte +7 -5
  77. package/components/flows/DynamicInputHelpBox.svelte +1 -1
  78. package/components/flows/FlowBox.svelte +3 -0
  79. package/components/flows/FlowBox.svelte.d.ts +23 -0
  80. package/components/flows/FlowBoxHeader.svelte +9 -0
  81. package/components/flows/FlowBoxHeader.svelte.d.ts +18 -0
  82. package/components/flows/FlowInput.svelte +20 -0
  83. package/components/flows/FlowInput.svelte.d.ts +14 -0
  84. package/components/flows/FlowInputs.svelte +7 -3
  85. package/components/flows/FlowModuleHeader.svelte +44 -41
  86. package/components/flows/FlowModuleHeader.svelte.d.ts +1 -1
  87. package/components/flows/FlowSettings.svelte +174 -0
  88. package/components/flows/FlowSettings.svelte.d.ts +21 -0
  89. package/components/flows/flowStore.d.ts +5 -2
  90. package/components/flows/flowStore.js +65 -9
  91. package/components/flows/pickers/FlowScriptPicker.svelte +6 -1
  92. package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -0
  93. package/components/flows/utils.d.ts +11 -11
  94. package/components/flows/utils.js +111 -64
  95. package/components/icons/AirtableIcon.svelte +17 -0
  96. package/components/icons/AirtableIcon.svelte.d.ts +17 -0
  97. package/components/icons/GCloudIcon.svelte +16 -0
  98. package/components/icons/GCloudIcon.svelte.d.ts +17 -0
  99. package/components/icons/GItlabIcon.svelte +16 -0
  100. package/components/icons/GItlabIcon.svelte.d.ts +17 -0
  101. package/components/icons/GSheetsIcon.svelte +16 -0
  102. package/components/icons/GSheetsIcon.svelte.d.ts +17 -0
  103. package/components/icons/GcalIcon.svelte +16 -0
  104. package/components/icons/GcalIcon.svelte.d.ts +17 -0
  105. package/components/icons/GdriveIcon.svelte +16 -0
  106. package/components/icons/GdriveIcon.svelte.d.ts +17 -0
  107. package/components/icons/GmailIcon.svelte +16 -0
  108. package/components/icons/GmailIcon.svelte.d.ts +17 -0
  109. package/components/icons/PostgresIcon.svelte +8 -49
  110. package/components/icons/Slack.svelte +9 -18
  111. package/components/icons/TogglIcon.svelte +59 -0
  112. package/components/icons/TogglIcon.svelte.d.ts +17 -0
  113. package/components/propertyPicker/ObjectViewer.svelte +35 -37
  114. package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
  115. package/components/propertyPicker/OverlayPropertyPicker.svelte +53 -53
  116. package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +5 -2
  117. package/components/propertyPicker/PropPicker.svelte +13 -15
  118. package/components/propertyPicker/PropPicker.svelte.d.ts +1 -1
  119. package/components/propertyPicker/WarningMessage.svelte +14 -41
  120. package/components/propertyPicker/WarningMessage.svelte.d.ts +11 -8
  121. package/components/propertyPicker/utils.d.ts +1 -0
  122. package/components/propertyPicker/utils.js +25 -0
  123. package/gen/core/OpenAPI.js +1 -1
  124. package/gen/index.d.ts +12 -2
  125. package/gen/index.js +1 -2
  126. package/gen/models/CompletedJob.d.ts +1 -1
  127. package/gen/models/Flow.d.ts +3 -13
  128. package/gen/models/FlowMetadata.d.ts +9 -0
  129. package/gen/models/FlowMetadata.js +4 -0
  130. package/gen/models/FlowModuleValue.d.ts +5 -22
  131. package/gen/models/FlowModuleValue.js +1 -15
  132. package/gen/models/ForloopFlow.d.ts +8 -0
  133. package/gen/models/ForloopFlow.js +4 -0
  134. package/gen/models/InputTransform.d.ts +3 -12
  135. package/gen/models/InputTransform.js +1 -8
  136. package/gen/models/JavascriptTransform.d.ts +4 -0
  137. package/gen/models/JavascriptTransform.js +4 -0
  138. package/gen/models/MainArgSignature.d.ts +1 -1
  139. package/gen/models/NewSchedule.d.ts +1 -0
  140. package/gen/models/OpenFlow.d.ts +7 -0
  141. package/gen/models/OpenFlow.js +4 -0
  142. package/gen/models/OpenFlowWPath.d.ts +4 -0
  143. package/gen/models/OpenFlowWPath.js +4 -0
  144. package/gen/models/PathFlow.d.ts +4 -0
  145. package/gen/models/PathFlow.js +4 -0
  146. package/gen/models/PathScript.d.ts +4 -0
  147. package/gen/models/PathScript.js +4 -0
  148. package/gen/models/RawScript.d.ts +12 -0
  149. package/gen/models/RawScript.js +11 -0
  150. package/gen/models/Schedule.d.ts +1 -1
  151. package/gen/models/StaticTransform.d.ts +4 -0
  152. package/gen/models/StaticTransform.js +4 -0
  153. package/gen/models/TokenResponse.d.ts +3 -3
  154. package/gen/models/Usage.d.ts +5 -0
  155. package/gen/models/Usage.js +4 -0
  156. package/gen/models/User.d.ts +2 -0
  157. package/gen/schemas/$AuditLog.d.ts +32 -0
  158. package/gen/schemas/$AuditLog.js +35 -0
  159. package/gen/schemas/$CompletedJob.d.ts +98 -0
  160. package/gen/schemas/$CompletedJob.js +103 -0
  161. package/gen/schemas/$ContextualVariable.d.ts +16 -0
  162. package/gen/schemas/$ContextualVariable.js +19 -0
  163. package/gen/schemas/$CreateResource.d.ts +22 -0
  164. package/gen/schemas/$CreateResource.js +25 -0
  165. package/gen/schemas/$CreateVariable.d.ts +26 -0
  166. package/gen/schemas/$CreateVariable.js +29 -0
  167. package/gen/schemas/$CreateWorkspace.d.ts +20 -0
  168. package/gen/schemas/$CreateWorkspace.js +23 -0
  169. package/gen/schemas/$EditResource.d.ts +13 -0
  170. package/gen/schemas/$EditResource.js +16 -0
  171. package/gen/schemas/$EditResourceType.d.ts +10 -0
  172. package/gen/schemas/$EditResourceType.js +13 -0
  173. package/gen/schemas/$EditSchedule.d.ts +20 -0
  174. package/gen/schemas/$EditSchedule.js +23 -0
  175. package/gen/schemas/$EditVariable.d.ts +16 -0
  176. package/gen/schemas/$EditVariable.js +19 -0
  177. package/gen/schemas/$EditWorkspaceUser.d.ts +7 -0
  178. package/gen/schemas/$EditWorkspaceUser.js +10 -0
  179. package/gen/schemas/$Flow.d.ts +23 -0
  180. package/gen/schemas/$Flow.js +26 -0
  181. package/gen/schemas/$FlowMetadata.d.ts +31 -0
  182. package/gen/schemas/$FlowMetadata.js +34 -0
  183. package/gen/schemas/$FlowPreview.d.ts +80 -0
  184. package/gen/schemas/$FlowPreview.js +83 -0
  185. package/gen/schemas/$GlobalUserInfo.d.ts +26 -0
  186. package/gen/schemas/$GlobalUserInfo.js +29 -0
  187. package/gen/schemas/$Group.d.ts +23 -0
  188. package/gen/schemas/$Group.js +26 -0
  189. package/gen/schemas/$Job.d.ts +17 -0
  190. package/gen/schemas/$Job.js +20 -0
  191. package/gen/schemas/$ListableVariable.d.ts +35 -0
  192. package/gen/schemas/$ListableVariable.js +38 -0
  193. package/gen/schemas/$Login.d.ts +12 -0
  194. package/gen/schemas/$Login.js +15 -0
  195. package/gen/schemas/$MainArgSignature.d.ts +50 -0
  196. package/gen/schemas/$MainArgSignature.js +53 -0
  197. package/gen/schemas/$NewSchedule.d.ts +30 -0
  198. package/gen/schemas/$NewSchedule.js +33 -0
  199. package/gen/schemas/$NewToken.d.ts +11 -0
  200. package/gen/schemas/$NewToken.js +14 -0
  201. package/gen/schemas/$NewUser.d.ts +16 -0
  202. package/gen/schemas/$NewUser.js +19 -0
  203. package/gen/schemas/$Preview.d.ts +19 -0
  204. package/gen/schemas/$Preview.js +22 -0
  205. package/gen/schemas/$QueuedJob.d.ts +139 -0
  206. package/gen/schemas/$QueuedJob.js +144 -0
  207. package/gen/schemas/$Resource.d.ts +31 -0
  208. package/gen/schemas/$Resource.js +34 -0
  209. package/gen/schemas/$ResourceType.d.ts +17 -0
  210. package/gen/schemas/$ResourceType.js +20 -0
  211. package/gen/schemas/$Schedule.d.ts +47 -0
  212. package/gen/schemas/$Schedule.js +50 -0
  213. package/gen/schemas/$Script.d.ts +77 -0
  214. package/gen/schemas/$Script.js +80 -0
  215. package/gen/schemas/$ScriptArgs.d.ts +6 -0
  216. package/gen/schemas/$ScriptArgs.js +9 -0
  217. package/gen/schemas/$SlackToken.d.ts +24 -0
  218. package/gen/schemas/$SlackToken.js +27 -0
  219. package/gen/schemas/$TokenResponse.d.ts +23 -0
  220. package/gen/schemas/$TokenResponse.js +26 -0
  221. package/gen/schemas/$TruncatedToken.d.ts +25 -0
  222. package/gen/schemas/$TruncatedToken.js +28 -0
  223. package/gen/schemas/$Usage.d.ts +13 -0
  224. package/gen/schemas/$Usage.js +16 -0
  225. package/gen/schemas/$User.d.ts +42 -0
  226. package/gen/schemas/$User.js +45 -0
  227. package/gen/schemas/$UserWorkspaceList.d.ts +28 -0
  228. package/gen/schemas/$UserWorkspaceList.js +31 -0
  229. package/gen/schemas/$WorkerPing.d.ts +31 -0
  230. package/gen/schemas/$WorkerPing.js +34 -0
  231. package/gen/schemas/$Workspace.d.ts +19 -0
  232. package/gen/schemas/$Workspace.js +22 -0
  233. package/gen/schemas/$WorkspaceInvite.d.ts +16 -0
  234. package/gen/schemas/$WorkspaceInvite.js +19 -0
  235. package/gen/services/FlowService.d.ts +30 -16
  236. package/gen/services/FlowService.js +25 -0
  237. package/gen/services/JobService.d.ts +1 -1
  238. package/gen/services/ScriptService.d.ts +13 -8
  239. package/gen/services/WorkspaceService.d.ts +1 -1
  240. package/gen/services/WorkspaceService.js +1 -1
  241. package/infer.js +8 -1
  242. package/package.json +88 -16
  243. package/script_helpers.d.ts +1 -1
  244. package/script_helpers.js +11 -13
  245. package/sql.d.ts +89 -0
  246. package/sql.js +817 -0
  247. package/stores.d.ts +1 -1
  248. package/stores.js +0 -6
  249. package/utils.d.ts +26 -6
  250. package/utils.js +94 -7
  251. package/components/RadioButtonV2.svelte +0 -33
  252. package/components/RadioButtonV2.svelte.d.ts +0 -20
@@ -0,0 +1,26 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { Schema } from '../common';
3
+ import type { InputTransform } from '../gen';
4
+ declare const __propDef: {
5
+ props: {
6
+ schema: Schema;
7
+ arg: InputTransform | any;
8
+ argName: string;
9
+ extraLib?: string | undefined;
10
+ inputCheck: {
11
+ [id: string]: boolean;
12
+ };
13
+ i?: number | undefined;
14
+ pickableProperties?: Object | undefined;
15
+ };
16
+ events: {
17
+ [evt: string]: CustomEvent<any>;
18
+ };
19
+ slots: {};
20
+ };
21
+ export declare type InputTransformFormProps = typeof __propDef.props;
22
+ export declare type InputTransformFormEvents = typeof __propDef.events;
23
+ export declare type InputTransformFormSlots = typeof __propDef.slots;
24
+ export default class InputTransformForm extends SvelteComponentTyped<InputTransformFormProps, InputTransformFormEvents, InputTransformFormSlots> {
25
+ }
26
+ export {};
@@ -0,0 +1,19 @@
1
+ <script>import { Highlight } from 'svelte-highlight';
2
+ import ObjectViewer from './propertyPicker/ObjectViewer.svelte';
3
+ import typescript from 'svelte-highlight/languages/typescript';
4
+ export let inputTransforms;
5
+ </script>
6
+
7
+ <ul class="mb-1">
8
+ {#each Object.entries(inputTransforms) as [key, val]}
9
+ <li>
10
+ <span class="font-black text-gray-700">{key}</span>: {#if val.type == 'static'}<ObjectViewer
11
+ json={val.value}
12
+ />{:else}
13
+ <span class="inline-block inline-highlight">
14
+ <Highlight offsetTop={0} language={typescript} code={val.expr} />
15
+ </span>
16
+ {/if}
17
+ </li>
18
+ {/each}
19
+ </ul>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { InputTransform } from '../gen';
3
+ declare const __propDef: {
4
+ props: {
5
+ inputTransforms: Record<string, InputTransform>;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export declare type InputTransformsViewerProps = typeof __propDef.props;
13
+ export declare type InputTransformsViewerEvents = typeof __propDef.events;
14
+ export declare type InputTransformsViewerSlots = typeof __propDef.slots;
15
+ export default class InputTransformsViewer extends SvelteComponentTyped<InputTransformsViewerProps, InputTransformsViewerEvents, InputTransformsViewerSlots> {
16
+ }
17
+ export {};
@@ -14,8 +14,8 @@ let password;
14
14
  let name;
15
15
  let company;
16
16
  function handleKeyUp(event) {
17
- const key = event.key || event.keyCode;
18
- if (key === 13 || key === 'Enter') {
17
+ const key = event.key;
18
+ if (key === 'Enter') {
19
19
  event.preventDefault();
20
20
  addUser();
21
21
  }
@@ -12,8 +12,8 @@ export function openModal() {
12
12
  let email;
13
13
  let is_admin = false;
14
14
  function handleKeyUp(event) {
15
- const key = event.key || event.keyCode;
16
- if (key === 13 || key === 'Enter') {
15
+ const key = event.key;
16
+ if (key === 'Enter') {
17
17
  event.preventDefault();
18
18
  inviteUser();
19
19
  }
@@ -1,38 +1,45 @@
1
- <script>import { faCalendar, faCircle, faClock, faHourglassHalf, faTimes } from '@fortawesome/free-solid-svg-icons';
2
- import { displayDate, forLater } from '../utils';
1
+ <script>import { displayDate, forLater, msToSec } from '../utils';
2
+ import { faCalendar, faCheck, faCircle, faClock, faHourglassHalf, faTimes } from '@fortawesome/free-solid-svg-icons';
3
3
  import Icon from 'svelte-awesome';
4
- import { check } from 'svelte-awesome/icons';
4
+ import { Badge } from 'flowbite-svelte';
5
5
  const SMALL_ICON_SCALE = 0.7;
6
6
  export let job;
7
7
  </script>
8
8
 
9
9
  {#if job && 'success' in job && job.success}
10
- <Icon class="text-green-600" data={check} scale={SMALL_ICON_SCALE} />
11
- <span class="mx-2">Succeeded {job.is_skipped ? '(Skipped)' : ''}</span>
12
- <div>
13
- <Icon class="text-gray-700" data={faHourglassHalf} scale={SMALL_ICON_SCALE} /><span class="mx-2"
14
- >Job ran in {job.duration}
15
- s</span
16
- >
17
- </div>
10
+ <Badge large color="green">
11
+ <Icon data={faCheck} scale={SMALL_ICON_SCALE} class="mr-2" />
12
+ Succeeded {job.is_skipped ? '(Skipped)' : ''}
13
+ </Badge>
14
+
15
+ <Badge large>
16
+ <Icon data={faHourglassHalf} scale={SMALL_ICON_SCALE} class="mr-2" />
17
+ Job ran in {msToSec(job.duration_ms)} s
18
+ </Badge>
18
19
  {:else if job && 'success' in job}
19
- <Icon class="text-red-700" data={faTimes} scale={SMALL_ICON_SCALE} />
20
- <span class="mx-2">Failed</span>
21
- <div>
22
- <Icon class="text-gray-700" data={faHourglassHalf} scale={SMALL_ICON_SCALE} /><span class="mx-2"
23
- >Job ran in {job.duration}
24
- s</span
25
- >
26
- </div>
20
+ <Badge large color="red">
21
+ <Icon data={faTimes} scale={SMALL_ICON_SCALE} class="mr-2" />
22
+ Failed
23
+ </Badge>
24
+ <Badge large>
25
+ <Icon data={faHourglassHalf} scale={SMALL_ICON_SCALE} class="mr-2" />
26
+ Job ran in {msToSec(job.duration_ms)}s
27
+ </Badge>
27
28
  {:else if job && 'running' in job && job.running}
28
- <Icon class="text-yellow-500" data={faCircle} scale={SMALL_ICON_SCALE} />
29
- <span class="mx-2">Running</span>
29
+ <Badge large color="yellow">
30
+ <Icon data={faCircle} scale={SMALL_ICON_SCALE} class="mr-2" />
31
+ Running
32
+ </Badge>
30
33
  {:else if job && 'running' in job && 'scheduled_for' in job && job.scheduled_for && forLater(job.scheduled_for)}
31
- <Icon class="text-gray-700" data={faCalendar} scale={SMALL_ICON_SCALE} />
32
- <span class="mx-2">Scheduled for {displayDate(job.scheduled_for)}</span>
34
+ <Badge>
35
+ <Icon data={faCalendar} scale={SMALL_ICON_SCALE} class="mr-2" />
36
+ Scheduled for {displayDate(job.scheduled_for)}
37
+ </Badge>
33
38
  {:else if job && 'running' in job}
34
- <Icon class="text-gray-700" data={faClock} scale={SMALL_ICON_SCALE} />
35
- <span class="mx-2">Queued</span>
39
+ <Badge>
40
+ <Icon data={faClock} scale={SMALL_ICON_SCALE} class="mr-2" />
41
+ Queued
42
+ </Badge>
36
43
  {:else}
37
44
  <Icon class="text-gray-200" data={faCircle} scale={SMALL_ICON_SCALE} />
38
45
  {/if}
@@ -13,8 +13,8 @@ export function openModal() {
13
13
  dispatch('open');
14
14
  }
15
15
  function handleKeyUp(event) {
16
- const key = event.key || event.keyCode;
17
- if (key === 27 || key === 'Escape' || key === 'Esc') {
16
+ const key = event.key;
17
+ if (key === 'Escape' || key === 'Esc') {
18
18
  if (open) {
19
19
  event.preventDefault();
20
20
  closeModal();
@@ -25,45 +25,18 @@ function handleKeyUp(event) {
25
25
 
26
26
  <svelte:window on:keyup={handleKeyUp} />
27
27
 
28
- <div class="blurred-background {open ? '' : 'hidden'}" />
28
+ {#if open}
29
+ <div class="blurred-background" />
29
30
 
30
- <div class="fixed top-0 w-screen h-screen {open ? '' : 'hidden'} {z}">
31
- <div
32
- class="fixed right-0 flex flex-col w-3/4 sm:w-2/3 lg:w-1/2 h-screen border border-gray-300 shadow-xl"
33
- >
34
- {#if open}
35
- <div class="flex flex-row justify-between p-2 bg-white border-b border-gray-200">
36
- <button
37
- on:click={() => {
38
- open = false
39
- closeModal()
40
- }}
41
- >
42
- <svg
43
- class="w-6 h-6"
44
- fill="none"
45
- stroke="currentColor"
46
- viewBox="0 0 24 24"
47
- xmlns="http://www.w3.org/2000/svg"
48
- >
49
- <path
50
- stroke-linecap="round"
51
- stroke-linejoin="round"
52
- stroke-width="2"
53
- d="M6 18L18 6M6 6l12 12"
54
- />
55
- </svg>
56
- </button>
57
- <p class="font-semibold text-gray-800"><slot name="title" /></p>
58
- <div />
59
- </div>
60
- <div class="flex flex-col bg-gray-50 pt-3 px-6 grow overflow-y-auto">
61
- <slot name="content" />
62
- </div>
63
- <div class="flex flex-col bg-white border-gray-200 p-2">
64
- <div class="flex flex-row justify-between p-2 ">
31
+ <div class="fixed top-0 w-screen h-screen {z}">
32
+ <div
33
+ class="fixed right-0 top-0 flex flex-col w-3/4 sm:w-2/3 lg:w-1/2 h-screen border border-gray-300 shadow-xl"
34
+ >
35
+ {#if open}
36
+ <div class="flex flex-row justify-between p-2 bg-white border-b border-gray-200">
65
37
  <button
66
38
  on:click={() => {
39
+ open = false
67
40
  closeModal()
68
41
  }}
69
42
  >
@@ -82,12 +55,41 @@ function handleKeyUp(event) {
82
55
  />
83
56
  </svg>
84
57
  </button>
85
- <span class="mr-4"><slot name="submission">&nbsp;</slot></span>
58
+ <p class="font-semibold text-gray-800"><slot name="title" /></p>
59
+ <div />
60
+ </div>
61
+ <div class="flex flex-col bg-gray-50 pt-3 px-6 grow overflow-y-auto">
62
+ <slot name="content" />
63
+ </div>
64
+ <div class="flex flex-col bg-white border-gray-200 p-2">
65
+ <div class="flex flex-row justify-between p-2 ">
66
+ <button
67
+ on:click={() => {
68
+ closeModal()
69
+ }}
70
+ >
71
+ <svg
72
+ class="w-6 h-6"
73
+ fill="none"
74
+ stroke="currentColor"
75
+ viewBox="0 0 24 24"
76
+ xmlns="http://www.w3.org/2000/svg"
77
+ >
78
+ <path
79
+ stroke-linecap="round"
80
+ stroke-linejoin="round"
81
+ stroke-width="2"
82
+ d="M6 18L18 6M6 6l12 12"
83
+ />
84
+ </svg>
85
+ </button>
86
+ <span class="mr-4"><slot name="submission">&nbsp;</slot></span>
87
+ </div>
86
88
  </div>
87
- </div>
88
- {/if}
89
+ {/if}
90
+ </div>
89
91
  </div>
90
- </div>
92
+ {/if}
91
93
 
92
94
  <style>
93
95
  .blurred-background {
@@ -1,13 +1,16 @@
1
- <script>import { FlowModuleValue } from '../gen';
2
- import { addPreviewResult, previewResults } from '../stores';
3
- import { buildExtraLib, objectToTsType, schemaToObject, schemaToTsType } from '../utils';
4
- import { faRobot } from '@fortawesome/free-solid-svg-icons';
1
+ <script>import { RawScript } from '../gen';
2
+ import { previewResults } from '../stores';
3
+ import { buildExtraLib, objectToTsType, schemaToTsType } from '../utils';
4
+ import { faChevronDown, faChevronUp, faPlus } from '@fortawesome/free-solid-svg-icons';
5
5
  import Icon from 'svelte-awesome';
6
6
  import Editor from './Editor.svelte';
7
+ import EditorBar from './EditorBar.svelte';
7
8
  import FlowPreview from './FlowPreview.svelte';
9
+ import FlowBox from './flows/FlowBox.svelte';
8
10
  import FlowInputs from './flows/FlowInputs.svelte';
9
11
  import FlowModuleHeader from './flows/FlowModuleHeader.svelte';
10
- import { createInlineScriptModule, flowStore, loadSchema, pickScript, schemasStore } from './flows/flowStore';
12
+ import { addModule, createInlineScriptModule, flowStore, loadSchema, pickScript, schemasStore } from './flows/flowStore';
13
+ import { getPickableProperties, jobsToResults } from './flows/utils';
11
14
  import SchemaForm from './SchemaForm.svelte';
12
15
  import Tooltip from './Tooltip.svelte';
13
16
  export let open;
@@ -15,68 +18,93 @@ export let mode;
15
18
  export let i;
16
19
  export let mod;
17
20
  export let args = {};
21
+ let editor;
22
+ let websocketAlive = { pyright: false, black: false, deno: false };
23
+ let pickableProperties = undefined;
24
+ let bigEditor = false;
18
25
  $: schema = $schemasStore[i];
19
- $: shouldPick = mod.value.path === '' && mod.value.language === undefined;
20
- $: previousSchema = i === 0 ? schemaToObject($flowStore?.schema) : $previewResults[i];
21
- $: extraLib = buildExtraLib(i === 0 ? schemaToTsType($flowStore?.schema) : objectToTsType($previewResults[i]));
26
+ $: shouldPick = 'path' in mod.value && mod.value.path === '' && !('language' in mod.value);
27
+ $: pickableProperties = getPickableProperties($flowStore?.schema, args, $previewResults, mode, i);
28
+ $: extraLib = buildExtraLib(schemaToTsType($flowStore?.schema), i === 0 ? schemaToTsType($flowStore?.schema) : objectToTsType($previewResults[i]));
29
+ const isTrigger = mode === 'pull' && i === 0;
22
30
  </script>
23
31
 
24
- <li class="flex flex-row flex-shrink max-w-full mx-auto mt-16">
25
- <div
26
- class="bg-white border border-gray xl-rounded shadow-lg w-full max-w-4xl mx-4 md:mx-auto"
27
- id="module-{i}"
28
- >
29
- <div class="flex items-center justify-between flex-wra p-4 sm:px-6 z-10">
30
- <FlowModuleHeader bind:open {mod} {i} {shouldPick}>
31
- <div>
32
- <h3 class="text-lg font-bold text-gray-900">Step {i + 1}</h3>
33
- {#if i == 0 && mode == 'pull'}
34
- <h3 class="font-bold">
35
- Trigger Script <Tooltip
36
- >When a flow is 'Pull', the first step is a trigger script. Trigger scripts are
37
- scripts that must return a list which are the new items to be treated one by one by
38
- the rest of the flow, usually the list of new items since last time the flow was
39
- run. One can retrieve the item in the next step using `previous_result._value`. To
40
- easily compute the diff, windmill provides some helpers under the form of
41
- `getInternalState` and `setInternalState`.</Tooltip
42
- >
43
- </h3>{/if}
44
- <p>
45
- {#if mod.value.path}
46
- {mod.value.path}
47
- {/if}
48
- {#if mod.value.language}
49
- Inline {mod.value.language}
50
- {/if}
51
- {#if !mod.value.path && !mod.value.language}
52
- Select a script
53
- {/if}
54
- </p>
55
- </div>
56
- </FlowModuleHeader>
57
- </div>
58
- <div class="border-b border-gray-200" />
32
+ <button
33
+ class="rounded-full h-10 w-10 bg-white border-2 border-gray-400"
34
+ on:click={() => {
35
+ addModule(i)
36
+ open = i
37
+ }}
38
+ >
39
+ <Icon class="text-gray-400 mb-1" data={faPlus} />
40
+ </button>
41
+ <FlowBox>
42
+ <div id="module-{i}">
43
+ <FlowModuleHeader bind:open {mod} {i} {shouldPick}>
44
+ <div>
45
+ <h3 class="text-lg font-bold text-gray-900">Step {i + 1}</h3>
46
+ {#if isTrigger}
47
+ <h3 class="font-bold">
48
+ Trigger Script
49
+ <Tooltip>
50
+ When a flow is 'Pull', the first step is a trigger script. Trigger scripts are scripts
51
+ that must return a list which are the new items to be treated one by one by the rest
52
+ of the flow, usually the list of new items since last time the flow was run. One can
53
+ retrieve the item in the next step using `previous_result._value`. To easily compute
54
+ the diff, windmill provides some helpers under the form of `getInternalState` and
55
+ `setInternalState`.
56
+ </Tooltip>
57
+ </h3>
58
+ {/if}
59
+ <p>
60
+ {#if 'path' in mod.value && mod.value.path}
61
+ {mod.value.path}
62
+ {/if}
63
+ {#if 'language' in mod.value && mod.value.language}
64
+ Inline {mod.value.language}
65
+ {/if}
66
+ {#if !('path' in mod.value) && !('language' in mod.value)}
67
+ Select a script
68
+ {/if}
69
+ </p>
70
+ </div>
71
+ </FlowModuleHeader>
59
72
  {#if open == i}
60
73
  <div class="p-6">
61
74
  {#if shouldPick}
62
75
  <FlowInputs
63
- isTrigger={mode == 'pull' && i == 0}
76
+ {isTrigger}
64
77
  on:pick={(e) => pickScript(e.detail.path, i)}
65
78
  on:new={(e) => createInlineScriptModule(e.detail.language, i, mode)}
66
79
  />
67
80
  {/if}
68
- {#if mod.value.type === FlowModuleValue.type.RAWSCRIPT}
69
- <Editor
70
- class="h-80 border p-2 rounded"
71
- bind:code={mod.value.content}
72
- deno={mod.value.language === FlowModuleValue.language.DENO}
73
- />
81
+ {#if mod.value.type === 'rawscript'}
82
+ <div class="mb-2 overflow-hidden">
83
+ <EditorBar {editor} {websocketAlive} lang={mod.value.language ?? 'deno'} />
84
+ </div>
85
+ <div>
86
+ <Editor
87
+ bind:websocketAlive
88
+ bind:this={editor}
89
+ class="{bigEditor ? 'h-2/3' : 'h-80'} border p-2 rounded"
90
+ bind:code={mod.value.content}
91
+ deno={mod.value.language === RawScript.language.DENO}
92
+ automaticLayout={true}
93
+ on:blur={() => loadSchema(i)}
94
+ formatAction={() => loadSchema(i)}
95
+ />
96
+ <button
97
+ class="w-full text-center"
98
+ on:click={() => {
99
+ bigEditor = !bigEditor
100
+ }}><Icon data={bigEditor ? faChevronUp : faChevronDown} scale={1.0} /></button
101
+ >
102
+ </div>
74
103
  <div class="mt-2 mb-8">
75
- <button class="default-primary-button-v2" on:click={() => loadSchema(i)}>
76
- <Icon data={faRobot} class="w-4 h-4 mr-2 -ml-2" />
77
-
78
- Infer step inputs from code
79
- </button>
104
+ <p class="text-gray-500 italic">
105
+ Move the focus outside of the text editor to recompute the input schema or press
106
+ Ctrl/Cmd+S
107
+ </p>
80
108
  </div>
81
109
  {/if}
82
110
  {#if !shouldPick}
@@ -86,7 +114,7 @@ $: extraLib = buildExtraLib(i === 0 ? schemaToTsType($flowStore?.schema) : objec
86
114
  {schema}
87
115
  {extraLib}
88
116
  {i}
89
- {previousSchema}
117
+ bind:pickableProperties
90
118
  bind:args={mod.input_transform}
91
119
  />
92
120
  {/if}
@@ -102,29 +130,24 @@ $: extraLib = buildExtraLib(i === 0 ? schemaToTsType($flowStore?.schema) : objec
102
130
  {mode}
103
131
  schemas={$schemasStore}
104
132
  on:change={(e) => {
105
- addPreviewResult(e.detail.result, i + 1)
133
+ previewResults.set(jobsToResults(e.detail))
106
134
  }}
107
135
  />
108
136
  </div>
109
- <div>
110
- <button class="w-full h-full" on:click={() => (open = -1)}>(-)</button>
111
- </div>
112
- {:else}
113
- <div>
114
- <button class="w-full h-full" on:click={() => (open = i)}>(+)</button>
115
- </div>
116
137
  {/if}
117
138
  {/if}
139
+ {#if open == i}
140
+ <div>
141
+ <button class="w-full h-full" on:click={() => (open = -1)}>
142
+ <Icon data={faChevronUp} scale={1.0} />
143
+ </button>
144
+ </div>
145
+ {:else}
146
+ <div>
147
+ <button class="w-full h-full" on:click={() => (open = i)}>
148
+ <Icon data={faChevronDown} scale={1.0} />
149
+ </button>
150
+ </div>
151
+ {/if}
118
152
  </div>
119
- </li>
120
- {#if i == 0 && mode == 'pull'}
121
- <li class="relative m-20 ">
122
- <div class="relative flex justify-center bg-white shadow p-2">
123
- Starting from here, the flow for loop over items from step 1's result above &nbsp;<Tooltip
124
- >This flow being in 'Pull' mode, the rest of the flow will for loop over the list of items
125
- returned by the trigger script right above. Retrieve the item value using
126
- `previous_result._value`</Tooltip
127
- >
128
- </div>
129
- </li>
130
- {/if}
153
+ </FlowBox>
@@ -1,61 +1,81 @@
1
1
  <script>import { ResourceService } from '../gen';
2
- import ResourcePicker from './ResourcePicker.svelte';
3
2
  import { workspaceStore } from '../stores';
4
- import SchemaForm from './SchemaForm.svelte';
5
3
  import RadioButton from './RadioButton.svelte';
4
+ import ResourcePicker from './ResourcePicker.svelte';
5
+ import SchemaForm from './SchemaForm.svelte';
6
6
  export let format;
7
7
  export let value;
8
8
  function isString(value) {
9
9
  return typeof value === 'string' || value instanceof String;
10
10
  }
11
- let path = isString(value) && value.length >= '$res:'.length ? value.substr('$res:'.length) : undefined;
11
+ let path = '';
12
12
  let args = {};
13
- if (!isString(value) && value) {
14
- args = value;
15
- }
16
13
  let schema = undefined;
17
14
  let isValid = true;
18
15
  let resourceTypeName = '';
16
+ let option = isString(value) || value == undefined ? 'resource' : 'raw';
17
+ $: format.startsWith('resource-') && loadSchema(format);
19
18
  async function loadSchema(format) {
20
19
  resourceTypeName = format.substring('resource-'.length);
21
20
  schema = (await ResourceService.getResourceType({ workspace: $workspaceStore, path: resourceTypeName })).schema;
22
21
  }
23
- let option = isString(value) || value == undefined ? 'resource' : 'raw';
24
- $: {
25
- if (option == 'resource') {
26
- value = `$res:${path}`;
22
+ function argToValue() {
23
+ value = args;
24
+ }
25
+ function resourceToValue() {
26
+ value = `$res:${path}`;
27
+ }
28
+ function isResource() {
29
+ return isString(value) && value.length >= '$res:'.length;
30
+ }
31
+ function valueToPath() {
32
+ if (!isString(value) && value) {
33
+ args = value;
34
+ }
35
+ if (isResource()) {
36
+ path = value.substr('$res:'.length);
27
37
  }
28
- else {
29
- value = args;
38
+ else if (value !== undefined && value !== '') {
39
+ option = 'raw';
30
40
  }
31
41
  }
32
- $: format.startsWith('resource-') && loadSchema(format);
42
+ $: value && valueToPath();
33
43
  </script>
34
44
 
35
- <div class="max-w-lg">
36
- <RadioButton
37
- options={[
38
- [`Resource (${resourceTypeName})`, 'resource'],
39
- [`Raw object value`, 'raw']
40
- ]}
41
- small={true}
42
- bind:value={option}
43
- />
44
- </div>
45
- <div class="mt-1" />
46
- {#if option == 'resource'}
47
- <ResourcePicker
48
- bind:value={path}
49
- resourceType={format.split('-').length > 1 ? format.substring('resource-'.length) : undefined}
50
- />
51
- {:else}
52
- <div class="border rounded p-5">
53
- <h2 class="mb-5">
54
- Object of <a target="_blank" href="/resources">resource type</a>
55
- {resourceTypeName}
56
- </h2>
57
- {#if !isString(args)}
58
- <SchemaForm {schema} bind:isValid bind:args />
45
+ <div class="flex flex-row w-full gap-2">
46
+ <div class="shrink w-40">
47
+ <RadioButton
48
+ options={[
49
+ [`Resource (${resourceTypeName})`, 'resource'],
50
+ [`Raw object value`, 'raw']
51
+ ]}
52
+ on:change={argToValue}
53
+ bind:value={option}
54
+ />
55
+ </div>
56
+ <div class="grow">
57
+ {#if option == 'resource'}
58
+ <ResourcePicker
59
+ on:refresh={() => loadSchema(format)}
60
+ on:change={(e) => {
61
+ path = e.detail
62
+ resourceToValue()
63
+ }}
64
+ bind:value={path}
65
+ resourceType={format.split('-').length > 1
66
+ ? format.substring('resource-'.length)
67
+ : undefined}
68
+ />
69
+ {:else}
70
+ <div class="border rounded p-5 w-full">
71
+ <h2 class="mb-5">
72
+ Object of <a target="_blank" href="/resources">resource type</a>
73
+ {resourceTypeName}
74
+ </h2>
75
+ {#if !isString(args)}
76
+ <SchemaForm {schema} bind:isValid bind:args />
77
+ {/if}
78
+ </div>
59
79
  {/if}
60
80
  </div>
61
- {/if}
81
+ </div>
@@ -1,25 +1,10 @@
1
- <script>import RadioButton from './RadioButton.svelte';
2
- import ResourceTypePicker from './ResourceTypePicker.svelte';
1
+ <script>import ResourceTypePicker from './ResourceTypePicker.svelte';
3
2
  export let format;
4
- let kind = format?.startsWith('resource') ? 'resource' : 'none';
5
3
  let resource = format?.startsWith('resource-')
6
4
  ? format.substring('resource-'.length)
7
5
  : undefined;
8
- $: format =
9
- kind == 'resource' ? (resource != undefined ? `resource-${resource}` : 'resource') : undefined;
6
+ $: format = resource != undefined ? `resource-${resource}` : undefined;
10
7
  </script>
11
8
 
12
- <RadioButton
13
- label="Kind"
14
- small={true}
15
- options={[
16
- ['None', 'none'],
17
- ['Resource Type', 'resource']
18
- ]}
19
- bind:value={kind}
20
- />
21
-
22
- {#if kind == 'resource'}
23
- <div class="mt-1" />
24
- <ResourceTypePicker bind:value={resource} />
25
- {/if}
9
+ <div class="mt-2" />
10
+ <ResourceTypePicker bind:value={resource} nonePickable={true} />
@@ -4,7 +4,6 @@ import { GroupService } from '../gen';
4
4
  import Tooltip from './Tooltip.svelte';
5
5
  import { userStore, workspaceStore } from '../stores';
6
6
  import { sleep } from '../utils';
7
- import { workspace } from 'vscode';
8
7
  export let meta = {
9
8
  ownerKind: 'user',
10
9
  owner: '',
@@ -156,6 +155,7 @@ $: {
156
155
  <label class="block col-span-2">
157
156
  <span class="text-gray-700 text-sm">Name<span class="text-red-600 text-sm">*</span></span>
158
157
  <input
158
+ autofocus
159
159
  bind:value={meta.name}
160
160
  placeholder={namePlaceholder}
161
161
  class={error === ''