@budibase/frontend-core 2.14.2 → 2.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.14.2",
3
+ "version": "2.14.4",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
7
7
  "svelte": "src/index.js",
8
8
  "dependencies": {
9
- "@budibase/bbui": "2.14.2",
10
- "@budibase/shared-core": "2.14.2",
9
+ "@budibase/bbui": "2.14.4",
10
+ "@budibase/shared-core": "2.14.4",
11
11
  "dayjs": "^1.10.8",
12
12
  "lodash": "4.17.21",
13
13
  "socket.io-client": "^4.6.1",
14
14
  "svelte": "^3.49.0"
15
15
  },
16
- "gitHead": "fa039f66c3b280e0ddc1f5dd60394cee34c3ec5d"
16
+ "gitHead": "2b86f98aca406873ea576d0335d4c262e6c1ad5c"
17
17
  }
package/src/api/index.js CHANGED
@@ -33,6 +33,7 @@ import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
33
33
  import { buildEventEndpoints } from "./events"
34
34
  import { buildAuditLogsEndpoints } from "./auditLogs"
35
35
  import { buildLogsEndpoints } from "./logs"
36
+ import { buildMigrationEndpoints } from "./migrations"
36
37
 
37
38
  /**
38
39
  * Random identifier to uniquely identify a session in a tab. This is
@@ -298,6 +299,7 @@ export const createAPIClient = config => {
298
299
  ...buildEventEndpoints(API),
299
300
  ...buildAuditLogsEndpoints(API),
300
301
  ...buildLogsEndpoints(API),
302
+ ...buildMigrationEndpoints(API),
301
303
  viewV2: buildViewV2Endpoints(API),
302
304
  }
303
305
  }
@@ -0,0 +1,10 @@
1
+ export const buildMigrationEndpoints = API => ({
2
+ /**
3
+ * Gets the info about the current app migration
4
+ */
5
+ getMigrationStatus: async () => {
6
+ return await API.get({
7
+ url: "/api/migrations/status",
8
+ })
9
+ },
10
+ })
@@ -0,0 +1,79 @@
1
+ <script>
2
+ export let isMigrationDone
3
+ export let onMigrationDone
4
+ export let timeoutSeconds = 10 // 3 minutes
5
+
6
+ const loadTime = Date.now()
7
+ let timedOut = false
8
+
9
+ async function checkMigrationsFinished() {
10
+ setTimeout(async () => {
11
+ const isMigrated = await isMigrationDone()
12
+
13
+ const timeoutMs = timeoutSeconds * 1000
14
+ if (!isMigrated) {
15
+ if (loadTime + timeoutMs > Date.now()) {
16
+ return checkMigrationsFinished()
17
+ }
18
+
19
+ return migrationTimeout()
20
+ }
21
+
22
+ onMigrationDone()
23
+ }, 1000)
24
+ }
25
+
26
+ checkMigrationsFinished()
27
+
28
+ function migrationTimeout() {
29
+ timedOut = true
30
+ }
31
+ </script>
32
+
33
+ <div class="loading" class:timeout={timedOut}>
34
+ <span class="header">
35
+ {#if !timedOut}
36
+ System update
37
+ {:else}
38
+ Something went wrong!
39
+ {/if}
40
+ </span>
41
+ <span class="subtext">
42
+ {#if !timedOut}
43
+ Please wait and we will be back in a second!
44
+ {:else}
45
+ An error occurred, please try again later.
46
+ <br />
47
+ Contact
48
+ <a href="https://budibase.com/support/" target="_blank">support</a> if the
49
+ issue persists.
50
+ {/if}</span
51
+ >
52
+ </div>
53
+
54
+ <style>
55
+ .loading {
56
+ display: flex;
57
+ justify-content: center;
58
+ flex-direction: column;
59
+ gap: var(--spacing-l);
60
+ height: 100vh;
61
+ text-align: center;
62
+ font-size: 18px;
63
+ }
64
+ .header {
65
+ font-weight: 700;
66
+ }
67
+ .timeout .header {
68
+ color: rgb(196, 46, 46);
69
+ }
70
+ .subtext {
71
+ font-size: 16px;
72
+ color: var(--grey-7);
73
+ }
74
+
75
+ .subtext a {
76
+ color: var(--grey-7);
77
+ font-weight: 700;
78
+ }
79
+ </style>
@@ -3,4 +3,5 @@ export { default as TestimonialPage } from "./TestimonialPage.svelte"
3
3
  export { default as Testimonial } from "./Testimonial.svelte"
4
4
  export { default as UserAvatar } from "./UserAvatar.svelte"
5
5
  export { default as UserAvatars } from "./UserAvatars.svelte"
6
+ export { default as Updating } from "./Updating.svelte"
6
7
  export { Grid } from "./grid"
@@ -116,7 +116,7 @@ export const domDebounce = callback => {
116
116
  *
117
117
  * @param {any} props
118
118
  * */
119
- export const buildDynamicButtonConfig = props => {
119
+ export const buildFormBlockButtonConfig = props => {
120
120
  const {
121
121
  _id,
122
122
  actionType,
@@ -130,7 +130,6 @@ export const buildDynamicButtonConfig = props => {
130
130
  } = props || {}
131
131
 
132
132
  if (!_id) {
133
- console.log("MISSING ID")
134
133
  return
135
134
  }
136
135
  const formId = `${_id}-form`
@@ -228,7 +227,7 @@ export const buildDynamicButtonConfig = props => {
228
227
  })
229
228
  }
230
229
 
231
- if (actionType == "Update" && showDeleteButton !== false) {
230
+ if (actionType === "Update" && showDeleteButton !== false) {
232
231
  defaultButtons.push({
233
232
  text: deleteText || "Delete",
234
233
  _id: Helpers.uuid(),
@@ -241,3 +240,108 @@ export const buildDynamicButtonConfig = props => {
241
240
 
242
241
  return defaultButtons
243
242
  }
243
+
244
+ export const buildMultiStepFormBlockDefaultProps = props => {
245
+ const { _id, stepCount, currentStep, actionType, dataSource } = props || {}
246
+
247
+ // Sanity check
248
+ if (!_id || !stepCount) {
249
+ return
250
+ }
251
+
252
+ const title = `Step {{ [${_id}-form].[__currentStep] }}`
253
+ const resourceId = dataSource?.resourceId
254
+ const formId = `${_id}-form`
255
+ let buttons = []
256
+
257
+ // Add previous step button if we aren't the first step
258
+ if (currentStep !== 0) {
259
+ buttons.push({
260
+ _id: Helpers.uuid(),
261
+ _component: "@budibase/standard-components/button",
262
+ _instanceName: Helpers.uuid(),
263
+ text: "Back",
264
+ type: "secondary",
265
+ size: "M",
266
+ onClick: [
267
+ {
268
+ parameters: {
269
+ type: "prev",
270
+ componentId: formId,
271
+ },
272
+ "##eventHandlerType": "Change Form Step",
273
+ },
274
+ ],
275
+ })
276
+ }
277
+
278
+ // Add a next button if we aren't the last step
279
+ if (currentStep !== stepCount - 1) {
280
+ buttons.push({
281
+ _id: Helpers.uuid(),
282
+ _component: "@budibase/standard-components/button",
283
+ _instanceName: Helpers.uuid(),
284
+ text: "Next",
285
+ type: "cta",
286
+ size: "M",
287
+ onClick: [
288
+ {
289
+ "##eventHandlerType": "Validate Form",
290
+ parameters: {
291
+ componentId: formId,
292
+ },
293
+ },
294
+ {
295
+ parameters: {
296
+ type: "next",
297
+ componentId: formId,
298
+ },
299
+ "##eventHandlerType": "Change Form Step",
300
+ },
301
+ ],
302
+ })
303
+ }
304
+
305
+ // Add save button if we are the last step
306
+ if (actionType !== "View" && currentStep === stepCount - 1) {
307
+ buttons.push({
308
+ _id: Helpers.uuid(),
309
+ _component: "@budibase/standard-components/button",
310
+ _instanceName: Helpers.uuid(),
311
+ text: "Save",
312
+ type: "cta",
313
+ size: "M",
314
+ onClick: [
315
+ {
316
+ "##eventHandlerType": "Validate Form",
317
+ parameters: {
318
+ componentId: formId,
319
+ },
320
+ },
321
+ {
322
+ "##eventHandlerType": "Save Row",
323
+ parameters: {
324
+ tableId: resourceId,
325
+ providerId: formId,
326
+ },
327
+ },
328
+ // Clear a create form once submitted
329
+ ...(actionType !== "Create"
330
+ ? []
331
+ : [
332
+ {
333
+ "##eventHandlerType": "Clear Form",
334
+ parameters: {
335
+ componentId: formId,
336
+ },
337
+ },
338
+ ]),
339
+ ],
340
+ })
341
+ }
342
+
343
+ return {
344
+ buttons,
345
+ title,
346
+ }
347
+ }