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
@@ -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,10 +3,11 @@ 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';
8
+ import SchemaViewer from './SchemaViewer.svelte';
9
+ import FieldHeader from './FieldHeader.svelte';
10
+ import InputTransformsViewer from './InputTransformsViewer.svelte';
10
11
  export let flow;
11
12
  let flowFiltered = {
12
13
  summary: flow.summary,
@@ -17,32 +18,64 @@ let flowFiltered = {
17
18
  export let embedded = false;
18
19
  export let tab = 'ui';
19
20
  let open = {};
21
+ let hubCode = {};
22
+ function toAny(x) {
23
+ return x;
24
+ }
20
25
  </script>
21
26
 
22
- <svelte:head>
23
- {@html github}
24
- </svelte:head>
25
-
26
27
  {#if !embedded}
27
28
  <Tabs
28
29
  tabs={[
29
30
  ['ui', 'Flow rendered'],
30
- ['json', 'JSON']
31
+ ['json', 'JSON'],
32
+ ['schema', 'Input schema of the flow']
31
33
  ]}
32
34
  bind:tab
33
35
  />
34
36
  {/if}
35
37
  {#if tab == 'ui'}
36
- <div class="flow-root w-full p-4">
37
- <p class="font-black text-lg mb-6 w-full ml-2">
38
- <span>{flow.value.modules.length} Steps </span>
38
+ <div class="flow-root w-full pb-4">
39
+ {#if !embedded}
40
+ <h2 class="mt-4">{flow.summary}</h2>
41
+ <h3 class="mt-4">{flow.description}</h3>
42
+
43
+ <p class="font-black text-lg w-full my-4">
44
+ <span>Inputs</span>
45
+ </p>
46
+ {#if flow.schema && flow.schema.properties && Object.keys(flow.schema.properties).length > 0 && flow.schema}
47
+ <ul class="my-2">
48
+ {#each Object.entries(flow.schema.properties) as [inp, v]}
49
+ <li class="list-disc flex flex-row">
50
+ <FieldHeader
51
+ label={inp}
52
+ required={flow.schema.required?.includes(inp)}
53
+ type={toAny(v)?.type}
54
+ contentEncoding={toAny(v)?.contentEncoding}
55
+ format={toAny(v)?.format}
56
+ itemsType={toAny(v)?.itemsType}
57
+ /><span class="ml-4 mt-2 text-xs"
58
+ >{toAny(v)?.default != undefined
59
+ ? 'default: ' + JSON.stringify(toAny(v)?.default)
60
+ : ''}</span
61
+ >
62
+ </li>
63
+ {/each}
64
+ </ul>
65
+ {:else}
66
+ <div class="text-gray-700 text-xs italic mb-4">No inputs</div>
67
+ {/if}
68
+ {/if}
69
+
70
+ <p class="font-black text-lg my-6 w-full">
71
+ <span>{flow?.value?.modules?.length} Step{flow?.value?.modules?.length > 1 ? 's' : ''} </span>
39
72
  <span class="mt-4" />
40
73
  </p>
41
74
  <ul class="-mb-8 w-full">
42
- {#each flow.value.modules ?? [] as mod, i}
75
+ {#each flow?.value?.modules ?? [] as mod, i}
43
76
  <li class="w-full">
44
77
  <div class="relative pb-8 w-full">
45
- {#if i < (flow.value.modules ?? []).length - 1}
78
+ {#if i < (flow?.value?.modules ?? []).length - 1}
46
79
  <span
47
80
  class="absolute top-4 left-4 -ml-px h-full w-0.5 bg-gray-200"
48
81
  aria-hidden="true"
@@ -58,33 +91,61 @@ let open = {};
58
91
  <div class="min-w-0 flex-1 pt-1.5 flex justify-between space-x-4 w-full">
59
92
  <div class="w-full">
60
93
  <p class="text-sm text-gray-500">
61
- {#if mod.value.type == FlowModuleValue.type.SCRIPT}
94
+ {#if mod?.value?.type == 'script'}
62
95
  Script at path <a
63
96
  target="_blank"
64
- href={scriptPathToHref(mod.value.path ?? '')}
65
- class="font-medium text-gray-900">{mod.value.path}</a
97
+ href={scriptPathToHref(mod?.value?.path ?? '')}
98
+ class="font-medium text-gray-900">{mod?.value?.path}</a
66
99
  >
67
- {:else if mod.value.type == FlowModuleValue.type.RAWSCRIPT}
100
+ {#if mod?.value?.path?.startsWith('hub/')}
101
+ <div>
102
+ <button
103
+ on:click={async () => {
104
+ open[i] = !open[i]
105
+ }}
106
+ class="mb-2 underline text-black"
107
+ >
108
+ View code and inputs {open[i] ? '(-)' : '(+)'}</button
109
+ >
110
+ {#if open[i]}
111
+ <InputTransformsViewer inputTransforms={mod?.input_transform} />
112
+ <div class="w-full h-full">
113
+ <iframe
114
+ style="height: 400px;"
115
+ class="w-full h-full text-sm"
116
+ title="embedded script from hub"
117
+ frameborder="0"
118
+ src="https://hub.windmill.dev/embed/script/{mod?.value?.path?.substring(
119
+ 4
120
+ )}"
121
+ />
122
+ </div>
123
+ {/if}
124
+ </div>
125
+ {/if}
126
+ {:else if mod?.value?.type == 'rawscript'}
68
127
  <button
69
128
  on:click={() => (open[i] = !open[i])}
70
129
  class="mb-2 underline text-black"
71
130
  >
72
- Raw {mod.value.language} script {open[i] ? '(-)' : '(+)'}</button
131
+ Raw {mod?.value?.language} script {open[i] ? '(-)' : '(+)'}</button
73
132
  >
74
133
 
75
134
  {#if open[i]}
76
135
  <div transition:slide class="border border-black p-2 bg-gray-50 w-full">
136
+ <InputTransformsViewer inputTransforms={mod?.input_transform} />
137
+
77
138
  <Highlight
78
- language={mod.value.language == 'deno' ? typescript : python}
79
- code={mod.value.content}
139
+ language={mod?.value?.language == 'deno' ? typescript : python}
140
+ code={mod?.value?.content}
80
141
  />
81
142
  </div>
82
143
  {/if}
83
- {:else if mod.value.type == FlowModuleValue.type.FLOW}
84
- Flow at path {mod.value.path}
85
- {:else if mod.value.type == FlowModuleValue.type.FORLOOPFLOW}
86
- For loop over step {i}'s result':
87
- <svelte:self flow={mod.value} embedded={true} />
144
+ {:else if mod?.value?.type == 'flow'}
145
+ Flow at path {mod?.value?.path}
146
+ {:else if mod?.value?.type == 'forloopflow'}
147
+ For loop over all the elements of the list returned as a result of step {i}:
148
+ <svelte:self flow={mod?.value} embedded={true} />
88
149
  {/if}
89
150
  </p>
90
151
  </div>
@@ -95,6 +156,17 @@ let open = {};
95
156
  {/each}
96
157
  </ul>
97
158
  </div>
98
- {:else}
99
- <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
159
+ {:else if tab == 'json'}
160
+ <div class="relative">
161
+ <button
162
+ on:click={async () => {
163
+ await navigator.clipboard.writeText(JSON.stringify(flowFiltered, null, 4))
164
+ }}
165
+ class="absolute default-secondary-button-v2 bg-white/30 right-0 my-2 ml-4"
166
+ >copy content</button
167
+ >
168
+ <Highlight language={json} code={JSON.stringify(flowFiltered, null, 4)} />
169
+ </div>
170
+ {:else if tab == 'schema'}
171
+ <SchemaViewer schema={flow.schema} />
100
172
  {/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: {
@@ -9,7 +9,7 @@ declare const __propDef: {
9
9
  schema?: any;
10
10
  };
11
11
  embedded?: boolean | undefined;
12
- tab?: "json" | "ui" | undefined;
12
+ tab?: "json" | "schema" | "ui" | undefined;
13
13
  };
14
14
  events: {
15
15
  [evt: string]: CustomEvent<any>;
@@ -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}
@@ -0,0 +1,209 @@
1
+ <script>import { faChain } from '@fortawesome/free-solid-svg-icons';
2
+ import { Button, Tooltip } from 'flowbite-svelte';
3
+ import Icon from 'svelte-awesome';
4
+ import ArgInput from './ArgInput.svelte';
5
+ import Editor from './Editor.svelte';
6
+ import FieldHeader from './FieldHeader.svelte';
7
+ import DynamicInputHelpBox from './flows/DynamicInputHelpBox.svelte';
8
+ import { codeToStaticTemplate } from './flows/flowStore';
9
+ import { getDefaultExpr, isCodeInjection } from './flows/utils';
10
+ import OverlayPropertyPicker from './propertyPicker/OverlayPropertyPicker.svelte';
11
+ import Toggle from './Toggle.svelte';
12
+ export let schema;
13
+ export let arg;
14
+ export let argName;
15
+ export let extraLib = 'missing extraLib';
16
+ export let inputCheck;
17
+ export let i = undefined;
18
+ export let pickableProperties = undefined;
19
+ let overlays = {};
20
+ let monacos = {};
21
+ let inputCats = {};
22
+ let propertyType = getPropertyType(arg);
23
+ function getPropertyType(arg) {
24
+ let type = arg.type;
25
+ if (type == 'javascript') {
26
+ if (codeToStaticTemplate(arg.expr)) {
27
+ type = 'static';
28
+ }
29
+ }
30
+ return type;
31
+ }
32
+ function setPropertyType(rawValue) {
33
+ if (!arg) {
34
+ return;
35
+ }
36
+ if (isCodeInjection(rawValue)) {
37
+ arg.expr = getDefaultExpr(i, argName, `\`${rawValue}\``);
38
+ arg.type = 'javascript';
39
+ propertyType = 'static';
40
+ }
41
+ else {
42
+ if (arg.type === 'javascript' && propertyType === 'static') {
43
+ arg.type = 'static';
44
+ }
45
+ if (arg.type) {
46
+ propertyType = arg.type;
47
+ }
48
+ }
49
+ }
50
+ function isStaticTemplate(inputCat) {
51
+ return inputCat === 'string' || inputCat === 'sql';
52
+ }
53
+ function focusProp(argName, monacoEditor = false) {
54
+ Object.keys(overlays).forEach((k) => {
55
+ if (k == argName && (isStaticTemplate(inputCats[argName]) || monacoEditor)) {
56
+ overlays[k].focus();
57
+ }
58
+ else {
59
+ overlays[k].unfocus();
60
+ }
61
+ });
62
+ }
63
+ function connectProperty(argName, rawValue) {
64
+ if (isStaticTemplate(inputCats[argName])) {
65
+ arg.value = `\$\{${rawValue}}`;
66
+ setPropertyType(arg.value);
67
+ }
68
+ else {
69
+ arg.expr = getDefaultExpr(i ?? -1, undefined, rawValue);
70
+ arg.type = 'javascript';
71
+ propertyType = 'javascript';
72
+ }
73
+ if (monacos[argName]) {
74
+ monacos[argName].setCode(arg.value);
75
+ }
76
+ }
77
+ $: checked = propertyType == 'javascript';
78
+ </script>
79
+
80
+ {#if arg != undefined}
81
+ <div class="flex justify-between items-center">
82
+ <div class="flex items-center">
83
+ <FieldHeader
84
+ label={argName}
85
+ format={schema.properties[argName].format}
86
+ contentEncoding={schema.properties[argName].contentEncoding}
87
+ required={schema.required.includes(argName)}
88
+ type={schema.properties[argName].type}
89
+ itemsType={schema.properties[argName].items}
90
+ />
91
+
92
+ {#if !checked && arg.type === 'javascript'}
93
+ <span class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded ml-2">
94
+ {'${...}'}
95
+ </span>
96
+ {/if}
97
+ </div>
98
+ <Toggle
99
+ bind:checked
100
+ options={{
101
+ right: 'Raw Javascript Editor'
102
+ }}
103
+ on:change={(e) => {
104
+ const type = e.detail ? 'javascript' : 'static'
105
+ const staticTemplate = isStaticTemplate(inputCats[argName])
106
+ if (type === 'javascript') {
107
+ arg.expr = getDefaultExpr(
108
+ i ?? -1,
109
+ argName,
110
+ staticTemplate ? `\`${arg.value ?? ''}\`` : arg.value
111
+ )
112
+
113
+ arg.value = undefined
114
+ propertyType = 'javascript'
115
+ } else {
116
+ arg.value = staticTemplate ? codeToStaticTemplate(arg.expr) : undefined
117
+
118
+ arg.expr = undefined
119
+ propertyType = 'static'
120
+ }
121
+
122
+ arg.type = type
123
+ }}
124
+ />
125
+ </div>
126
+ <div class="max-w-xs" />
127
+
128
+ {#if propertyType === undefined || !checked}
129
+ <OverlayPropertyPicker
130
+ {pickableProperties}
131
+ bind:this={overlays[argName]}
132
+ on:select={({ detail }) => {
133
+ if (detail.pickerVariation === 'connect') {
134
+ connectProperty(argName, detail.propPath)
135
+ } else {
136
+ const toAppend = `\$\{${detail.propPath}}`
137
+ arg.value = `${arg.value ?? ''}${toAppend}`
138
+ if (monacos[argName]) {
139
+ monacos[argName].setCode(arg.value)
140
+ }
141
+ if (isStaticTemplate(inputCats[argName])) {
142
+ setPropertyType(arg.value)
143
+ }
144
+ }
145
+ }}
146
+ >
147
+ <ArgInput
148
+ on:focus={() => focusProp(argName)}
149
+ label={argName}
150
+ bind:editor={monacos[argName]}
151
+ bind:description={schema.properties[argName].description}
152
+ bind:value={arg.value}
153
+ type={schema.properties[argName].type}
154
+ required={schema.required.includes(argName)}
155
+ bind:pattern={schema.properties[argName].pattern}
156
+ bind:valid={inputCheck[argName]}
157
+ defaultValue={schema.properties[argName].default}
158
+ bind:enum_={schema.properties[argName].enum}
159
+ bind:format={schema.properties[argName].format}
160
+ contentEncoding={schema.properties[argName].contentEncoding}
161
+ bind:itemsType={schema.properties[argName].items}
162
+ displayHeader={false}
163
+ bind:inputCat={inputCats[argName]}
164
+ on:input={(e) => {
165
+ if (isStaticTemplate(inputCats[argName])) {
166
+ setPropertyType(e.detail.rawValue)
167
+ }
168
+ }}
169
+ >
170
+ <div slot="actions">
171
+ <div on:click={() => overlays[argName]?.focus('connect')}>
172
+ <Tooltip placement="bottom" content="Input connect">
173
+ <Button size="sm" class="blue-button h-8">
174
+ <Icon data={faChain} />
175
+ </Button>
176
+ </Tooltip>
177
+ </div>
178
+ </div>
179
+ </ArgInput>
180
+ </OverlayPropertyPicker>
181
+ {:else if checked}
182
+ {#if arg.expr != undefined}
183
+ <OverlayPropertyPicker
184
+ bind:this={overlays[argName]}
185
+ {pickableProperties}
186
+ on:select={(event) => {
187
+ monacos[argName].insertAtCursor(event.detail.propPath)
188
+ }}
189
+ >
190
+ <div class="border rounded p-2 mt-2 border-gray-300">
191
+ <Editor
192
+ bind:this={monacos[argName]}
193
+ on:focus={() => focusProp(argName, true)}
194
+ bind:code={arg.expr}
195
+ lang="javascript"
196
+ class="few-lines-editor"
197
+ {extraLib}
198
+ extraLibPath="file:///node_modules/@types/windmill@{i}/index.d.ts"
199
+ />
200
+ </div>
201
+ </OverlayPropertyPicker>
202
+ <DynamicInputHelpBox />
203
+ {/if}
204
+ {:else}
205
+ <p>Not recognized arg type {arg.type}</p>
206
+ {/if}
207
+ {:else}
208
+ <p>Arg at {argName} is undefined</p>
209
+ {/if}