windmill-components 1.22.42 → 1.28.3

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 (250) 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 +136 -66
  14. package/components/Editor.svelte.d.ts +2 -0
  15. package/components/EditorBar.svelte +56 -45
  16. package/components/FlowBuilder.svelte +155 -70
  17. package/components/FlowEditor.svelte +79 -200
  18. package/components/FlowEditor.svelte.d.ts +3 -2
  19. package/components/FlowJobResult.svelte +1 -1
  20. package/components/FlowPreview.svelte +18 -24
  21. package/components/FlowPreviewContent.svelte +68 -0
  22. package/components/FlowPreviewContent.svelte.d.ts +21 -0
  23. package/components/FlowStatusViewer.svelte +85 -37
  24. package/components/FlowStatusViewer.svelte.d.ts +3 -2
  25. package/components/FlowViewer.svelte +85 -45
  26. package/components/FlowViewer.svelte.d.ts +2 -1
  27. package/components/IconedResourceType.svelte +30 -5
  28. package/components/InputTransformForm.svelte +209 -0
  29. package/components/InputTransformForm.svelte.d.ts +26 -0
  30. package/components/InputTransformsViewer.svelte +19 -0
  31. package/components/InputTransformsViewer.svelte.d.ts +17 -0
  32. package/components/InviteGlobalUser.svelte +2 -2
  33. package/components/InviteUser.svelte +2 -2
  34. package/components/JobStatus.svelte +32 -25
  35. package/components/Modal.svelte +44 -42
  36. package/components/ModuleStep.svelte +94 -79
  37. package/components/ObjectResourceInput.svelte +58 -38
  38. package/components/ObjectTypeNarrowing.svelte +4 -19
  39. package/components/Path.svelte +1 -0
  40. package/components/Path.svelte.d.ts +1 -1
  41. package/components/RadioButton.svelte +11 -96
  42. package/components/RadioButton.svelte.d.ts +4 -2
  43. package/components/ResourceEditor.svelte +4 -5
  44. package/components/ResourceEditor.svelte.d.ts +2 -2
  45. package/components/ResourcePicker.svelte +25 -2
  46. package/components/ResourcePicker.svelte.d.ts +3 -0
  47. package/components/ResourceTypePicker.svelte +17 -29
  48. package/components/ResourceTypePicker.svelte.d.ts +1 -0
  49. package/components/RunForm.svelte +14 -15
  50. package/components/RunForm.svelte.d.ts +1 -1
  51. package/components/SchemaEditor.svelte +87 -71
  52. package/components/SchemaEditor.svelte.d.ts +2 -0
  53. package/components/SchemaEditorProperty.svelte +11 -0
  54. package/components/SchemaEditorProperty.svelte.d.ts +17 -0
  55. package/components/SchemaForm.svelte +21 -127
  56. package/components/SchemaForm.svelte.d.ts +3 -4
  57. package/components/SchemaModal.svelte +20 -33
  58. package/components/SchemaModal.svelte.d.ts +1 -1
  59. package/components/SchemaViewer.svelte +4 -6
  60. package/components/ScriptBuilder.svelte +40 -43
  61. package/components/ScriptEditor.svelte +71 -66
  62. package/components/ScriptPicker.svelte +10 -12
  63. package/components/ScriptPicker.svelte.d.ts +1 -1
  64. package/components/ScriptSchema.svelte +0 -5
  65. package/components/ShareModal.svelte +1 -1
  66. package/components/SharedBadge.svelte +12 -10
  67. package/components/StringTypeNarrowing.svelte +8 -4
  68. package/components/StringTypeNarrowing.svelte.d.ts +1 -0
  69. package/components/TableCustom.svelte +7 -9
  70. package/components/TableSimple.svelte +1 -1
  71. package/components/Toggle.svelte +8 -10
  72. package/components/Toggle.svelte.d.ts +5 -11
  73. package/components/Tooltip.svelte +3 -2
  74. package/components/VariableEditor.svelte +21 -6
  75. package/components/flows/CopyFirstStepSchema.svelte +7 -5
  76. package/components/flows/DynamicInputHelpBox.svelte +1 -1
  77. package/components/flows/FlowBox.svelte +3 -0
  78. package/components/flows/FlowBox.svelte.d.ts +23 -0
  79. package/components/flows/FlowBoxHeader.svelte +9 -0
  80. package/components/flows/FlowBoxHeader.svelte.d.ts +18 -0
  81. package/components/flows/FlowInput.svelte +20 -0
  82. package/components/flows/FlowInput.svelte.d.ts +14 -0
  83. package/components/flows/FlowInputs.svelte +7 -3
  84. package/components/flows/FlowModuleHeader.svelte +42 -40
  85. package/components/flows/FlowModuleHeader.svelte.d.ts +1 -1
  86. package/components/flows/FlowSettings.svelte +174 -0
  87. package/components/flows/FlowSettings.svelte.d.ts +21 -0
  88. package/components/flows/flowStore.d.ts +5 -2
  89. package/components/flows/flowStore.js +65 -9
  90. package/components/flows/pickers/FlowScriptPicker.svelte +6 -1
  91. package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -0
  92. package/components/flows/utils.d.ts +11 -7
  93. package/components/flows/utils.js +114 -45
  94. package/components/icons/AirtableIcon.svelte +17 -0
  95. package/components/icons/AirtableIcon.svelte.d.ts +17 -0
  96. package/components/icons/GCloudIcon.svelte +16 -0
  97. package/components/icons/GCloudIcon.svelte.d.ts +17 -0
  98. package/components/icons/GItlabIcon.svelte +16 -0
  99. package/components/icons/GItlabIcon.svelte.d.ts +17 -0
  100. package/components/icons/GSheetsIcon.svelte +16 -0
  101. package/components/icons/GSheetsIcon.svelte.d.ts +17 -0
  102. package/components/icons/GcalIcon.svelte +16 -0
  103. package/components/icons/GcalIcon.svelte.d.ts +17 -0
  104. package/components/icons/GdriveIcon.svelte +16 -0
  105. package/components/icons/GdriveIcon.svelte.d.ts +17 -0
  106. package/components/icons/GmailIcon.svelte +16 -0
  107. package/components/icons/GmailIcon.svelte.d.ts +17 -0
  108. package/components/icons/PostgresIcon.svelte +8 -49
  109. package/components/icons/Slack.svelte +9 -18
  110. package/components/icons/TogglIcon.svelte +59 -0
  111. package/components/icons/TogglIcon.svelte.d.ts +17 -0
  112. package/components/propertyPicker/ObjectViewer.svelte +35 -37
  113. package/components/propertyPicker/ObjectViewer.svelte.d.ts +2 -0
  114. package/components/propertyPicker/OverlayPropertyPicker.svelte +53 -53
  115. package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +5 -2
  116. package/components/propertyPicker/PropPicker.svelte +13 -15
  117. package/components/propertyPicker/PropPicker.svelte.d.ts +1 -1
  118. package/components/propertyPicker/WarningMessage.svelte +14 -41
  119. package/components/propertyPicker/WarningMessage.svelte.d.ts +11 -8
  120. package/components/propertyPicker/utils.d.ts +1 -0
  121. package/components/propertyPicker/utils.js +25 -0
  122. package/gen/core/OpenAPI.js +1 -1
  123. package/gen/index.d.ts +11 -2
  124. package/gen/index.js +1 -2
  125. package/gen/models/CompletedJob.d.ts +1 -1
  126. package/gen/models/Flow.d.ts +3 -13
  127. package/gen/models/FlowMetadata.d.ts +9 -0
  128. package/gen/models/FlowMetadata.js +4 -0
  129. package/gen/models/FlowModuleValue.d.ts +5 -22
  130. package/gen/models/FlowModuleValue.js +1 -15
  131. package/gen/models/ForloopFlow.d.ts +8 -0
  132. package/gen/models/ForloopFlow.js +4 -0
  133. package/gen/models/InputTransform.d.ts +3 -12
  134. package/gen/models/InputTransform.js +1 -8
  135. package/gen/models/JavascriptTransform.d.ts +4 -0
  136. package/gen/models/JavascriptTransform.js +4 -0
  137. package/gen/models/MainArgSignature.d.ts +1 -1
  138. package/gen/models/NewSchedule.d.ts +1 -0
  139. package/gen/models/OpenFlowWPath.d.ts +4 -0
  140. package/gen/models/OpenFlowWPath.js +4 -0
  141. package/gen/models/PathFlow.d.ts +4 -0
  142. package/gen/models/PathFlow.js +4 -0
  143. package/gen/models/PathScript.d.ts +4 -0
  144. package/gen/models/PathScript.js +4 -0
  145. package/gen/models/RawScript.d.ts +12 -0
  146. package/gen/models/RawScript.js +11 -0
  147. package/gen/models/Schedule.d.ts +1 -1
  148. package/gen/models/StaticTransform.d.ts +4 -0
  149. package/gen/models/StaticTransform.js +4 -0
  150. package/gen/models/TokenResponse.d.ts +3 -3
  151. package/gen/models/Usage.d.ts +5 -0
  152. package/gen/models/Usage.js +4 -0
  153. package/gen/models/User.d.ts +2 -0
  154. package/gen/schemas/$AuditLog.d.ts +32 -0
  155. package/gen/schemas/$AuditLog.js +35 -0
  156. package/gen/schemas/$CompletedJob.d.ts +98 -0
  157. package/gen/schemas/$CompletedJob.js +103 -0
  158. package/gen/schemas/$ContextualVariable.d.ts +16 -0
  159. package/gen/schemas/$ContextualVariable.js +19 -0
  160. package/gen/schemas/$CreateResource.d.ts +22 -0
  161. package/gen/schemas/$CreateResource.js +25 -0
  162. package/gen/schemas/$CreateVariable.d.ts +26 -0
  163. package/gen/schemas/$CreateVariable.js +29 -0
  164. package/gen/schemas/$CreateWorkspace.d.ts +20 -0
  165. package/gen/schemas/$CreateWorkspace.js +23 -0
  166. package/gen/schemas/$EditResource.d.ts +13 -0
  167. package/gen/schemas/$EditResource.js +16 -0
  168. package/gen/schemas/$EditResourceType.d.ts +10 -0
  169. package/gen/schemas/$EditResourceType.js +13 -0
  170. package/gen/schemas/$EditSchedule.d.ts +20 -0
  171. package/gen/schemas/$EditSchedule.js +23 -0
  172. package/gen/schemas/$EditVariable.d.ts +16 -0
  173. package/gen/schemas/$EditVariable.js +19 -0
  174. package/gen/schemas/$EditWorkspaceUser.d.ts +7 -0
  175. package/gen/schemas/$EditWorkspaceUser.js +10 -0
  176. package/gen/schemas/$Flow.d.ts +23 -0
  177. package/gen/schemas/$Flow.js +26 -0
  178. package/gen/schemas/$FlowMetadata.d.ts +31 -0
  179. package/gen/schemas/$FlowMetadata.js +34 -0
  180. package/gen/schemas/$FlowPreview.d.ts +80 -0
  181. package/gen/schemas/$FlowPreview.js +83 -0
  182. package/gen/schemas/$GlobalUserInfo.d.ts +26 -0
  183. package/gen/schemas/$GlobalUserInfo.js +29 -0
  184. package/gen/schemas/$Group.d.ts +23 -0
  185. package/gen/schemas/$Group.js +26 -0
  186. package/gen/schemas/$Job.d.ts +17 -0
  187. package/gen/schemas/$Job.js +20 -0
  188. package/gen/schemas/$ListableVariable.d.ts +35 -0
  189. package/gen/schemas/$ListableVariable.js +38 -0
  190. package/gen/schemas/$Login.d.ts +12 -0
  191. package/gen/schemas/$Login.js +15 -0
  192. package/gen/schemas/$MainArgSignature.d.ts +50 -0
  193. package/gen/schemas/$MainArgSignature.js +53 -0
  194. package/gen/schemas/$NewSchedule.d.ts +30 -0
  195. package/gen/schemas/$NewSchedule.js +33 -0
  196. package/gen/schemas/$NewToken.d.ts +11 -0
  197. package/gen/schemas/$NewToken.js +14 -0
  198. package/gen/schemas/$NewUser.d.ts +16 -0
  199. package/gen/schemas/$NewUser.js +19 -0
  200. package/gen/schemas/$Preview.d.ts +19 -0
  201. package/gen/schemas/$Preview.js +22 -0
  202. package/gen/schemas/$QueuedJob.d.ts +139 -0
  203. package/gen/schemas/$QueuedJob.js +144 -0
  204. package/gen/schemas/$Resource.d.ts +31 -0
  205. package/gen/schemas/$Resource.js +34 -0
  206. package/gen/schemas/$ResourceType.d.ts +17 -0
  207. package/gen/schemas/$ResourceType.js +20 -0
  208. package/gen/schemas/$Schedule.d.ts +47 -0
  209. package/gen/schemas/$Schedule.js +50 -0
  210. package/gen/schemas/$Script.d.ts +77 -0
  211. package/gen/schemas/$Script.js +80 -0
  212. package/gen/schemas/$ScriptArgs.d.ts +6 -0
  213. package/gen/schemas/$ScriptArgs.js +9 -0
  214. package/gen/schemas/$SlackToken.d.ts +24 -0
  215. package/gen/schemas/$SlackToken.js +27 -0
  216. package/gen/schemas/$TokenResponse.d.ts +23 -0
  217. package/gen/schemas/$TokenResponse.js +26 -0
  218. package/gen/schemas/$TruncatedToken.d.ts +25 -0
  219. package/gen/schemas/$TruncatedToken.js +28 -0
  220. package/gen/schemas/$Usage.d.ts +13 -0
  221. package/gen/schemas/$Usage.js +16 -0
  222. package/gen/schemas/$User.d.ts +42 -0
  223. package/gen/schemas/$User.js +45 -0
  224. package/gen/schemas/$UserWorkspaceList.d.ts +28 -0
  225. package/gen/schemas/$UserWorkspaceList.js +31 -0
  226. package/gen/schemas/$WorkerPing.d.ts +31 -0
  227. package/gen/schemas/$WorkerPing.js +34 -0
  228. package/gen/schemas/$Workspace.d.ts +19 -0
  229. package/gen/schemas/$Workspace.js +22 -0
  230. package/gen/schemas/$WorkspaceInvite.d.ts +16 -0
  231. package/gen/schemas/$WorkspaceInvite.js +19 -0
  232. package/gen/services/FlowService.d.ts +24 -23
  233. package/gen/services/FlowService.js +14 -0
  234. package/gen/services/JobService.d.ts +1 -1
  235. package/gen/services/ScriptService.d.ts +13 -19
  236. package/gen/services/ScriptService.js +0 -14
  237. package/gen/services/WorkspaceService.d.ts +1 -1
  238. package/gen/services/WorkspaceService.js +1 -1
  239. package/infer.js +8 -1
  240. package/package.json +85 -16
  241. package/script_helpers.d.ts +1 -1
  242. package/script_helpers.js +11 -13
  243. package/sql.d.ts +89 -0
  244. package/sql.js +817 -0
  245. package/stores.d.ts +0 -1
  246. package/stores.js +0 -6
  247. package/utils.d.ts +12 -5
  248. package/utils.js +55 -9
  249. package/components/RadioButtonV2.svelte +0 -33
  250. package/components/RadioButtonV2.svelte.d.ts +0 -20
@@ -1,11 +1,11 @@
1
- <script>import { InputTransform, Job, JobService } from '../gen';
1
+ <script>import { Job, JobService } from '../gen';
2
2
  import { workspaceStore } from '../stores';
3
3
  import { sendUserToast, truncateRev } from '../utils';
4
4
  import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons';
5
5
  import { createEventDispatcher, onDestroy } from 'svelte';
6
6
  import Icon from 'svelte-awesome';
7
7
  import FlowJobResult from './FlowJobResult.svelte';
8
- import { flowToMode } from './flows/utils';
8
+ import { flowToMode, runFlowPreview } from './flows/utils';
9
9
  import FlowStatusViewer from './FlowStatusViewer.svelte';
10
10
  import RunForm from './RunForm.svelte';
11
11
  import Tabs from './Tabs.svelte';
@@ -19,23 +19,17 @@ let stepArgs = {};
19
19
  let tab = 'upto';
20
20
  let viewPreview = false;
21
21
  let intervalId;
22
- let uptoText = i == flow.value.modules.length - 1 ? 'Preview whole flow' : 'Preview up to this step';
22
+ let uptoText = i >= flow.value.modules.length - 1 ? 'Preview whole flow' : 'Preview up to this step';
23
23
  let job;
24
24
  let jobs = [];
25
25
  let jobId;
26
+ $: dispatch('change', jobs);
26
27
  export async function runPreview(args) {
27
28
  viewPreview = true;
28
29
  intervalId && clearInterval(intervalId);
29
30
  let newFlow = flowToMode(flow, mode);
30
31
  newFlow = tab == 'upto' ? truncateFlow(newFlow) : extractStep(newFlow);
31
- jobId = await JobService.runFlowPreview({
32
- workspace: $workspaceStore ?? '',
33
- requestBody: {
34
- args,
35
- value: newFlow.value,
36
- path: newFlow.path
37
- }
38
- });
32
+ jobId = await runFlowPreview(args, newFlow);
39
33
  jobs = [];
40
34
  intervalId = setInterval(loadJob, 1000);
41
35
  sendUserToast(`started preview ${truncateRev(jobId, 10)}`);
@@ -51,7 +45,7 @@ function extractStep(flow) {
51
45
  localFlow.schema = schemas[i];
52
46
  stepArgs = {};
53
47
  Object.entries(flow.value.modules[i].input_transform).forEach((x) => {
54
- if (x[1].type == InputTransform.type.STATIC) {
48
+ if (x[1].type == 'static') {
55
49
  stepArgs[x[0]] = x[1].value;
56
50
  }
57
51
  });
@@ -64,7 +58,6 @@ async function loadJob() {
64
58
  //only CompletedJob has success property
65
59
  clearInterval(intervalId);
66
60
  }
67
- dispatch('change', job);
68
61
  }
69
62
  catch (err) {
70
63
  sendUserToast(err, true);
@@ -75,21 +68,22 @@ onDestroy(() => {
75
68
  });
76
69
  </script>
77
70
 
78
- <h2 class="flex justify-center">
79
- <button
80
- class="default-button "
81
- on:click={() => {
82
- viewPreview = !viewPreview
83
- }}
84
- >
71
+ <button
72
+ class="w-full rounded border-1 border border-gray-200"
73
+ on:click={() => {
74
+ viewPreview = !viewPreview
75
+ }}
76
+ >
77
+ <h2 class="flex justify-center text-gray-600">
85
78
  <div>
86
- Preview mode<Icon class="ml-1" data={viewPreview ? faChevronUp : faChevronDown} scale={1} />
79
+ Preview
80
+ <Icon class="ml-1" data={viewPreview ? faChevronUp : faChevronDown} scale={1} />
87
81
  </div>
88
- </button>
89
- </h2>
82
+ </h2>
83
+ </button>
90
84
 
91
85
  {#if viewPreview}
92
- {#if i != flow.value.modules.length - 1}
86
+ {#if i != flow.value.modules.length}
93
87
  <Tabs
94
88
  tabs={[
95
89
  ['upto', uptoText],
@@ -0,0 +1,68 @@
1
+ <script>import { Job, JobService } from '../gen';
2
+ import { workspaceStore } from '../stores';
3
+ import { sendUserToast, truncateRev } from '../utils';
4
+ import { faClose } from '@fortawesome/free-solid-svg-icons';
5
+ import { Button } from 'flowbite-svelte';
6
+ import { createEventDispatcher, onDestroy } from 'svelte';
7
+ import Icon from 'svelte-awesome';
8
+ import FlowJobResult from './FlowJobResult.svelte';
9
+ import { flowStore } from './flows/flowStore';
10
+ import { runFlowPreview } from './flows/utils';
11
+ import FlowStatusViewer from './FlowStatusViewer.svelte';
12
+ import SchemaForm from './SchemaForm.svelte';
13
+ const dispatch = createEventDispatcher();
14
+ export let args = {};
15
+ let intervalId;
16
+ let job;
17
+ let jobs = [];
18
+ let jobId;
19
+ let isValid = false;
20
+ $: dispatch('change', jobs);
21
+ export async function runPreview(args) {
22
+ intervalId && clearInterval(intervalId);
23
+ jobId = await runFlowPreview(args, $flowStore);
24
+ jobs = [];
25
+ intervalId = setInterval(loadJob, 1000);
26
+ sendUserToast(`started preview ${truncateRev(jobId, 10)}`);
27
+ }
28
+ async function loadJob() {
29
+ try {
30
+ job = await JobService.getJob({ workspace: $workspaceStore, id: jobId });
31
+ if (job?.type == 'CompletedJob') {
32
+ clearInterval(intervalId);
33
+ }
34
+ }
35
+ catch (err) {
36
+ sendUserToast(err, true);
37
+ }
38
+ }
39
+ onDestroy(() => {
40
+ intervalId && clearInterval(intervalId);
41
+ });
42
+ </script>
43
+
44
+ <div class="flex flex-col space-y-4 h-screen bg-white ">
45
+ <div class="flex flex-col space-y-4 p-6 border-b-2">
46
+ <div class="flex justify-between">
47
+ <h3 class="text-lg leading-6 font-bold text-gray-900">Flow Preview</h3>
48
+
49
+ <Button color="alternative" on:click={() => dispatch('close')}>
50
+ <Icon data={faClose} />
51
+ </Button>
52
+ </div>
53
+ <SchemaForm schema={$flowStore.schema} bind:isValid bind:args />
54
+ <Button disabled={!isValid} class="blue-button" on:click={() => runPreview(args)} size="md">
55
+ Preview
56
+ </Button>
57
+ </div>
58
+ <div class="h-full overflow-y-auto mb-16">
59
+ {#if job}
60
+ <div class="w-full">
61
+ <FlowStatusViewer {job} bind:jobs />
62
+ </div>
63
+ {#if `result` in job}
64
+ <FlowJobResult {job} />
65
+ {/if}
66
+ {/if}
67
+ </div>
68
+ </div>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ args?: Record<string, any> | undefined;
5
+ runPreview?: ((args: Record<string, any>) => Promise<void>) | undefined;
6
+ };
7
+ events: {
8
+ close: CustomEvent<any>;
9
+ change: CustomEvent<any>;
10
+ } & {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ };
15
+ export declare type FlowPreviewContentProps = typeof __propDef.props;
16
+ export declare type FlowPreviewContentEvents = typeof __propDef.events;
17
+ export declare type FlowPreviewContentSlots = typeof __propDef.slots;
18
+ export default class FlowPreviewContent extends SvelteComponentTyped<FlowPreviewContentProps, FlowPreviewContentEvents, FlowPreviewContentSlots> {
19
+ get runPreview(): (args: Record<string, any>) => Promise<void>;
20
+ }
21
+ export {};
@@ -1,32 +1,59 @@
1
- <script>import { faHourglassHalf, faSpinner, faTimes } from '@fortawesome/free-solid-svg-icons';
2
- import { scriptPathToHref, truncateRev } from '../utils';
1
+ <script>import { scriptPathToHref, truncateRev } from '../utils';
2
+ import { faHourglassHalf, faSpinner, faTimes } from '@fortawesome/free-solid-svg-icons';
3
3
  import Icon from 'svelte-awesome';
4
4
  import { check } from 'svelte-awesome/icons';
5
- import { CompletedJob, FlowModuleValue, FlowStatusModule, JobService, QueuedJob } from '../gen';
5
+ import { CompletedJob, FlowStatusModule, Job, JobService, QueuedJob } from '../gen';
6
6
  import { workspaceStore } from '../stores';
7
- import JobStatus from './JobStatus.svelte';
8
7
  import FlowJobResult from './FlowJobResult.svelte';
8
+ import JobStatus from './JobStatus.svelte';
9
9
  export let job;
10
10
  export let jobs = [];
11
+ export let fullyRetrieved = -1;
12
+ let lastJobid;
11
13
  let forloop_selected = '';
12
- function loadResults() {
14
+ let pres = {};
15
+ async function loadResults() {
16
+ if (!('success' in job)) {
17
+ const mods = job?.flow_status?.modules;
18
+ if (mods) {
19
+ let i = mods?.findIndex((x) => x.type == FlowStatusModule.type.IN_PROGRESS);
20
+ if (i != -1) {
21
+ let last = mods[i];
22
+ jobs[i] = await JobService.getJob({
23
+ workspace: $workspaceStore ?? '',
24
+ id: last.job ?? ''
25
+ });
26
+ jobs = jobs;
27
+ pres[i]?.scroll({ top: pres[i]?.scrollHeight, behavior: 'smooth' });
28
+ }
29
+ }
30
+ }
31
+ if (job.id != lastJobid) {
32
+ lastJobid = job.id;
33
+ jobs = [];
34
+ fullyRetrieved = -1;
35
+ }
13
36
  job?.flow_status?.modules?.forEach(async (x, i) => {
14
- if ((i >= jobs.length && x.type == FlowStatusModule.type.SUCCESS) ||
37
+ if ((i > fullyRetrieved && x.type == FlowStatusModule.type.SUCCESS) ||
15
38
  x.type == FlowStatusModule.type.FAILURE) {
16
39
  if (x.forloop_jobs) {
17
40
  const forloop_jobs = [];
18
41
  for (let j of x.forloop_jobs) {
19
42
  forloop_jobs.push(await JobService.getCompletedJob({ workspace: $workspaceStore, id: j }));
20
43
  }
21
- jobs.push(forloop_jobs);
44
+ jobs[i] = forloop_jobs;
22
45
  }
23
46
  else {
24
- jobs.push(await JobService.getCompletedJob({ workspace: $workspaceStore, id: x.job }));
47
+ jobs[i] = await JobService.getCompletedJob({ workspace: $workspaceStore, id: x.job });
25
48
  }
26
49
  jobs = jobs;
50
+ fullyRetrieved = i;
27
51
  }
28
52
  });
29
53
  }
54
+ function toJob(x) {
55
+ return x;
56
+ }
30
57
  function toCompletedJob(x) {
31
58
  return x;
32
59
  }
@@ -36,32 +63,31 @@ function toCompletedJobs(x) {
36
63
  $: $workspaceStore && job && loadResults();
37
64
  </script>
38
65
 
39
- <div class="flow-root max-w-lg w-full p-4">
40
- <div class="flex flex-row-reverse">
66
+ <div class="flow-root w-full p-6">
67
+ <div class="flex ">
41
68
  {#if job}
42
69
  <div class="flex-col">
43
- <a href="/run/{job?.id}" class="font-medium text-blue-600"
44
- >{truncateRev(job?.id ?? '', 10)}</a
45
- >
46
- <div>
47
- <JobStatus {job} />
48
- </div>
70
+ <a href="/run/{job?.id}" class="font-medium text-blue-600">
71
+ {truncateRev(job?.id ?? '', 10)}
72
+ </a>
49
73
  </div>
50
74
  {/if}
51
75
  </div>
76
+ <JobStatus {job} />
52
77
 
53
78
  <p class="text-gray-500 mb-6 w-full text-center">
54
79
  Step
55
- <span class="font-medium text-gray-900"
56
- >{Math.min((job?.flow_status?.step ?? 0) + 1, job?.raw_flow?.modules.length ?? 0)}</span
57
- >
80
+ <span class="font-medium text-gray-900">
81
+ {Math.min((job?.flow_status?.step ?? 0) + 1, job?.raw_flow?.modules.length ?? 0)}
82
+ </span>
58
83
  out of <span class="font-medium text-gray-900">{job?.raw_flow?.modules.length}</span>
59
84
  <span class="mt-4" />
60
85
  </p>
61
- <ul class="-mb-8 w-full">
86
+
87
+ <ul class="w-full">
62
88
  {#each job?.raw_flow?.modules ?? [] as mod, i}
63
89
  <li class="w-full">
64
- <div class="relative pb-8 w-full">
90
+ <div class="relative w-full">
65
91
  {#if i < (job?.raw_flow?.modules ?? []).length - 1}
66
92
  <span
67
93
  class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200"
@@ -109,7 +135,7 @@ $: $workspaceStore && job && loadResults();
109
135
  <div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
110
136
  <div class="w-full">
111
137
  <p class="text-sm text-gray-500">
112
- {#if mod.value.type == FlowModuleValue.type.SCRIPT}
138
+ {#if mod.value.type == 'script'}
113
139
  Script at path <a
114
140
  target="_blank"
115
141
  href={scriptPathToHref(mod.value.path ?? '')}
@@ -120,28 +146,34 @@ $: $workspaceStore && job && loadResults();
120
146
  </div>
121
147
  <div class="text-right text-sm whitespace-nowrap text-gray-500">
122
148
  {job.flow_status?.modules[i].type}
123
- {#if job.flow_status?.modules[i].forloop_jobs}
124
- {#each job.flow_status?.modules[i].forloop_jobs ?? [] as job}
125
- <div class="flex flex-col">
126
- <a href="/run/{job}" class="font-medium text-blue-600"
127
- >{truncateRev(job ?? '', 10)}</a
128
- >
129
- </div>
130
- {/each}
131
- {:else if job.flow_status?.modules[i].job}
132
- <a href="/run/{job.flow_status?.modules[i].job}" class="font-medium text-blue-600"
133
- >{truncateRev(job.flow_status?.modules[i].job ?? '', 10)}</a
134
- >
135
- {/if}
149
+ <div class=" max-h-40 overflow-y-auto">
150
+ {#if job.flow_status?.modules[i].forloop_jobs}
151
+ {#each job.flow_status?.modules[i].forloop_jobs ?? [] as job}
152
+ <div class="flex flex-col">
153
+ <a href="/run/{job}" class="font-medium text-blue-600">
154
+ {truncateRev(job ?? '', 10)}
155
+ </a>
156
+ </div>
157
+ {/each}
158
+ {:else if job.flow_status?.modules[i].job}
159
+ <a
160
+ href="/run/{job.flow_status?.modules[i].job}"
161
+ class="font-medium text-blue-600"
162
+ >
163
+ {truncateRev(job.flow_status?.modules[i].job ?? '', 10)}
164
+ </a>
165
+ {/if}
166
+ </div>
136
167
  </div>
137
168
  </div>
138
169
  </div>
139
170
  {#if jobs[i]}
140
171
  {#if Array.isArray(jobs[i])}
141
- <div class="flex flex-col space-y-2">
172
+ <div class="flex flex-col mt-2 space-y-2 max-h-60 overflow-y-auto shadow-inner">
142
173
  {#each toCompletedJobs(jobs[i]) as job, i}
143
174
  <button
144
175
  class="underline text-blue-600 hover:text-blue-700"
176
+ class:text-red-600={!job.success}
145
177
  on:click={() => {
146
178
  if (forloop_selected == job.id) {
147
179
  forloop_selected = ''
@@ -156,8 +188,24 @@ $: $workspaceStore && job && loadResults();
156
188
  {/if}
157
189
  {/each}
158
190
  </div>
159
- {:else}
191
+ {:else if toJob(jobs[i]).type == 'CompletedJob'}
160
192
  <FlowJobResult job={toCompletedJob(jobs[i])} />
193
+ {:else if jobs[i]}
194
+ {#if toJob(jobs[i])?.raw_flow}
195
+ <div class="border-2">
196
+ <h2>Forloop current iteration</h2>
197
+ <svelte:self job={jobs[i]} />
198
+ </div>
199
+ {:else}
200
+ <div class="max-w-2xl mt-2 h-full">
201
+ <pre
202
+ bind:this={pres[i]}
203
+ class="break-all p-4 relative h-full mx-2 bg-gray-50 text-xs max-h-40 overflow-y-auto border">{toJob(
204
+ jobs[i]
205
+ ).logs ?? ''}
206
+ </pre>
207
+ </div>
208
+ {/if}
161
209
  {/if}
162
210
  {/if}
163
211
  </div>
@@ -1,9 +1,10 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { CompletedJob, QueuedJob } from '../gen';
2
+ import { CompletedJob, Job, QueuedJob } from '../gen';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  job: QueuedJob | CompletedJob;
6
- jobs?: (CompletedJob | CompletedJob[] | undefined)[] | undefined;
6
+ jobs?: (Job | Job[] | undefined)[] | undefined;
7
+ fullyRetrieved?: number | undefined;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
@@ -3,13 +3,14 @@ import Highlight from 'svelte-highlight';
3
3
  import json from 'svelte-highlight/languages/json';
4
4
  import python from 'svelte-highlight/languages/python';
5
5
  import typescript from 'svelte-highlight/languages/typescript';
6
- import { FlowModuleValue } from '../gen';
7
- import github from 'svelte-highlight/styles/github';
8
6
  import { slide } from 'svelte/transition';
9
7
  import Tabs from './Tabs.svelte';
10
8
  import SchemaViewer from './SchemaViewer.svelte';
11
9
  import FieldHeader from './FieldHeader.svelte';
10
+ import InputTransformsViewer from './InputTransformsViewer.svelte';
11
+ import SvelteMarkdown from 'svelte-markdown';
12
12
  export let flow;
13
+ export let initialOpen = undefined;
13
14
  let flowFiltered = {
14
15
  summary: flow.summary,
15
16
  description: flow.description,
@@ -19,12 +20,14 @@ let flowFiltered = {
19
20
  export let embedded = false;
20
21
  export let tab = 'ui';
21
22
  let open = {};
23
+ if (initialOpen) {
24
+ open[initialOpen] = true;
25
+ }
26
+ function toAny(x) {
27
+ return x;
28
+ }
22
29
  </script>
23
30
 
24
- <svelte:head>
25
- {@html github}
26
- </svelte:head>
27
-
28
31
  {#if !embedded}
29
32
  <Tabs
30
33
  tabs={[
@@ -36,34 +39,40 @@ let open = {};
36
39
  />
37
40
  {/if}
38
41
  {#if tab == 'ui'}
39
- <div class="flow-root w-full p-4">
40
- <p class="font-black text-lg w-full ml-2">
41
- <span>Inputs</span>
42
- </p>
43
- {#if flow.schema && flow.schema.properties && Object.keys(flow.schema.properties).length > 0 && flow.schema}
44
- <ul class="my-4 ml-6">
45
- {#each Object.entries(flow.schema.properties) as [inp, v]}
46
- <li class="list-disc flex flex-row">
47
- <FieldHeader
48
- label={inp}
49
- required={flow.schema.required?.includes(inp)}
50
- type={v?.type}
51
- contentEncoding={v?.contentEncoding}
52
- format={v?.format}
53
- itemsType={v?.itemsType}
54
- /><span class="ml-4 mt-2 text-xs"
55
- >{v.default != undefined ? 'default: ' + JSON.stringify(v.default) : ''}</span
56
- >
57
- </li>
58
- {/each}
59
- </ul>
60
- {:else}
61
- <div class="text-gray-700 text-xs italic mb-4">
62
- This script has no argument or is ill-defined
63
- </div>
42
+ <div class="flow-root w-full pb-4">
43
+ {#if !embedded}
44
+ <h2 class="mt-4">{flow.summary}</h2>
45
+ <SvelteMarkdown source={flow.description ?? ''} />
46
+
47
+ <p class="font-black text-lg w-full my-4">
48
+ <span>Inputs</span>
49
+ </p>
50
+ {#if flow.schema && flow.schema.properties && Object.keys(flow.schema.properties).length > 0 && flow.schema}
51
+ <ul class="my-2">
52
+ {#each Object.entries(flow.schema.properties) as [inp, v]}
53
+ <li class="list-disc flex flex-row">
54
+ <FieldHeader
55
+ label={inp}
56
+ required={flow.schema.required?.includes(inp)}
57
+ type={toAny(v)?.type}
58
+ contentEncoding={toAny(v)?.contentEncoding}
59
+ format={toAny(v)?.format}
60
+ itemsType={toAny(v)?.itemsType}
61
+ /><span class="ml-4 mt-2 text-xs"
62
+ >{toAny(v)?.default != undefined
63
+ ? 'default: ' + JSON.stringify(toAny(v)?.default)
64
+ : ''}</span
65
+ >
66
+ </li>
67
+ {/each}
68
+ </ul>
69
+ {:else}
70
+ <div class="text-gray-700 text-xs italic mb-4">No inputs</div>
71
+ {/if}
64
72
  {/if}
65
- <p class="font-black text-lg my-6 w-full ml-2">
66
- <span>{flow?.value?.modules?.length} Steps </span>
73
+
74
+ <p class="font-black text-lg my-6 w-full">
75
+ <span>{flow?.value?.modules?.length} Step{flow?.value?.modules?.length > 1 ? 's' : ''} </span>
67
76
  <span class="mt-4" />
68
77
  </p>
69
78
  <ul class="-mb-8 w-full">
@@ -86,13 +95,39 @@ let open = {};
86
95
  <div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
87
96
  <div class="w-full">
88
97
  <p class="text-sm text-gray-500">
89
- {#if mod?.value?.type == FlowModuleValue.type.SCRIPT}
98
+ {#if mod?.value?.type == 'script'}
90
99
  Script at path <a
91
100
  target="_blank"
92
101
  href={scriptPathToHref(mod?.value?.path ?? '')}
93
102
  class="font-medium text-gray-900">{mod?.value?.path}</a
94
103
  >
95
- {:else if mod?.value?.type == FlowModuleValue.type.RAWSCRIPT}
104
+ {#if mod?.value?.path?.startsWith('hub/')}
105
+ <div>
106
+ <button
107
+ on:click={async () => {
108
+ open[i] = !open[i]
109
+ }}
110
+ class="mb-2 underline text-black"
111
+ >
112
+ View code and inputs {open[i] ? '(-)' : '(+)'}</button
113
+ >
114
+ {#if open[i]}
115
+ <InputTransformsViewer inputTransforms={mod?.input_transform} />
116
+ <div class="w-full h-full">
117
+ <iframe
118
+ style="height: 400px;"
119
+ class="w-full h-full text-sm"
120
+ title="embedded script from hub"
121
+ frameborder="0"
122
+ src="https://hub.windmill.dev/embed/script/{mod?.value?.path?.substring(
123
+ 4
124
+ )}"
125
+ />
126
+ </div>
127
+ {/if}
128
+ </div>
129
+ {/if}
130
+ {:else if mod?.value?.type == 'rawscript'}
96
131
  <button
97
132
  on:click={() => (open[i] = !open[i])}
98
133
  class="mb-2 underline text-black"
@@ -102,16 +137,18 @@ let open = {};
102
137
 
103
138
  {#if open[i]}
104
139
  <div transition:slide class="border border-black p-2 bg-gray-50 w-full">
140
+ <InputTransformsViewer inputTransforms={mod?.input_transform} />
141
+
105
142
  <Highlight
106
143
  language={mod?.value?.language == 'deno' ? typescript : python}
107
144
  code={mod?.value?.content}
108
145
  />
109
146
  </div>
110
147
  {/if}
111
- {:else if mod?.value?.type == FlowModuleValue.type.FLOW}
148
+ {:else if mod?.value?.type == 'flow'}
112
149
  Flow at path {mod?.value?.path}
113
- {:else if mod?.value?.type == FlowModuleValue.type.FORLOOPFLOW}
114
- For loop over step {i}'s result':
150
+ {:else if mod?.value?.type == 'forloopflow'}
151
+ For loop over all the elements of the list returned as a result of step {i}:
115
152
  <svelte:self flow={mod?.value} embedded={true} />
116
153
  {/if}
117
154
  </p>
@@ -124,13 +161,16 @@ let open = {};
124
161
  </ul>
125
162
  </div>
126
163
  {:else if tab == 'json'}
127
- <button
128
- on:click={async () => {
129
- await navigator.clipboard.writeText(JSON.stringify(flowFiltered, null, 4))
130
- }}
131
- class="default-primary-button-v2 float-right my-2 ml-4">copy content</button
132
- >
133
- <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
164
+ <div class="relative">
165
+ <button
166
+ on:click={async () => {
167
+ await navigator.clipboard.writeText(JSON.stringify(flowFiltered, null, 4))
168
+ }}
169
+ class="absolute default-secondary-button-v2 bg-white/30 right-0 my-2 ml-4"
170
+ >copy content</button
171
+ >
172
+ <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
173
+ </div>
134
174
  {:else if tab == 'schema'}
135
175
  <SchemaViewer schema={flow.schema} />
136
176
  {/if}
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import { type FlowValue } from '../gen';
2
+ import type { FlowValue } from '../gen';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  flow: {
@@ -8,6 +8,7 @@ declare const __propDef: {
8
8
  value: FlowValue;
9
9
  schema?: any;
10
10
  };
11
+ initialOpen?: number | undefined;
11
12
  embedded?: boolean | undefined;
12
13
  tab?: "json" | "schema" | "ui" | undefined;
13
14
  };
@@ -1,20 +1,29 @@
1
- <script>import Mysql from './icons/Mysql.svelte';
2
- import Mail from './icons/Mail.svelte';
1
+ <script>import { faGithub } from '@fortawesome/free-brands-svg-icons';
2
+ import Icon from 'svelte-awesome';
3
+ import AirtableIcon from './icons/AirtableIcon.svelte';
3
4
  import DbIcon from './icons/DbIcon.svelte';
5
+ import GcalIcon from './icons/GcalIcon.svelte';
6
+ import GCloudIcon from './icons/GCloudIcon.svelte';
7
+ import GdriveIcon from './icons/GdriveIcon.svelte';
8
+ import GitlabIcon from './icons/GItlabIcon.svelte';
9
+ import GmailIcon from './icons/GmailIcon.svelte';
10
+ import GSheetsIcon from './icons/GSheetsIcon.svelte';
11
+ import Mail from './icons/Mail.svelte';
12
+ import Mysql from './icons/Mysql.svelte';
4
13
  import PostgresIcon from './icons/PostgresIcon.svelte';
5
- import { faGithub } from '@fortawesome/free-brands-svg-icons';
6
14
  import Slack from './icons/Slack.svelte';
7
- import Icon from 'svelte-awesome';
15
+ import TogglIcon from './icons/TogglIcon.svelte';
8
16
  export let name;
9
17
  export let after = false;
10
18
  export let height = '24px';
11
19
  export let width = '24px';
12
20
  </script>
13
21
 
14
- <div class="flex flex-row gap-2">
22
+ <div class="flex flex-row gap-2 justify-center -pl-2 whitespace-nowrap">
15
23
  {#if !after}
16
24
  {name}
17
25
  {/if}
26
+
18
27
  {#if name === 'postgresql'}
19
28
  <PostgresIcon {height} {width} />
20
29
  {:else if name === 'mysql'}
@@ -27,6 +36,22 @@ export let width = '24px';
27
36
  <Slack {height} {width} />
28
37
  {:else if name === 'github'}
29
38
  <Icon data={faGithub} scale={1.4} />
39
+ {:else if name === 'gmail'}
40
+ <GmailIcon {height} {width} />
41
+ {:else if name === 'gsheets'}
42
+ <GSheetsIcon {height} {width} />
43
+ {:else if name === 'gitlab'}
44
+ <GitlabIcon {height} {width} />
45
+ {:else if name === 'gcloud'}
46
+ <GCloudIcon {height} {width} />
47
+ {:else if name === 'gcal'}
48
+ <GcalIcon {height} {width} />
49
+ {:else if name === 'gdrive'}
50
+ <GdriveIcon {height} {width} />
51
+ {:else if name === 'airtable'}
52
+ <AirtableIcon {height} {width} />
53
+ {:else if name === 'toggl'}
54
+ <TogglIcon {height} {width} />
30
55
  {/if}
31
56
  {#if after}
32
57
  {name}