@budibase/frontend-core 2.7.36-alpha.1 → 2.7.36-alpha.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.
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "2.7.36-alpha.
|
|
3
|
+
"version": "2.7.36-alpha.2",
|
|
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.7.36-alpha.
|
|
10
|
-
"@budibase/shared-core": "2.7.36-alpha.
|
|
9
|
+
"@budibase/bbui": "2.7.36-alpha.2",
|
|
10
|
+
"@budibase/shared-core": "2.7.36-alpha.2",
|
|
11
11
|
"dayjs": "^1.11.7",
|
|
12
12
|
"lodash": "^4.17.21",
|
|
13
13
|
"socket.io-client": "^4.6.1",
|
|
14
14
|
"svelte": "^3.46.2"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "9e73358c0b5d945e052a08f6a9277a4d263eec01"
|
|
17
17
|
}
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
rowHeight,
|
|
69
69
|
contentLines,
|
|
70
70
|
gridFocused,
|
|
71
|
+
error,
|
|
71
72
|
} = context
|
|
72
73
|
|
|
73
74
|
// Keep config store up to date with props
|
|
@@ -149,8 +150,15 @@
|
|
|
149
150
|
</div>
|
|
150
151
|
</div>
|
|
151
152
|
</div>
|
|
153
|
+
{:else if $error}
|
|
154
|
+
<div class="grid-error">
|
|
155
|
+
<div class="grid-error-title">There was a problem loading your grid</div>
|
|
156
|
+
<div class="grid-error-subtitle">
|
|
157
|
+
{$error}
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
152
160
|
{/if}
|
|
153
|
-
{#if $loading}
|
|
161
|
+
{#if $loading && !$error}
|
|
154
162
|
<div in:fade|local={{ duration: 130 }} class="grid-loading">
|
|
155
163
|
<ProgressCircle />
|
|
156
164
|
</div>
|
|
@@ -273,6 +281,25 @@
|
|
|
273
281
|
opacity: 0.6;
|
|
274
282
|
}
|
|
275
283
|
|
|
284
|
+
/* Error */
|
|
285
|
+
.grid-error {
|
|
286
|
+
position: absolute;
|
|
287
|
+
width: 100%;
|
|
288
|
+
height: 100%;
|
|
289
|
+
display: flex;
|
|
290
|
+
flex-direction: column;
|
|
291
|
+
justify-content: center;
|
|
292
|
+
align-items: center;
|
|
293
|
+
gap: 8px;
|
|
294
|
+
}
|
|
295
|
+
.grid-error-title {
|
|
296
|
+
font-size: 18px;
|
|
297
|
+
font-weight: 600;
|
|
298
|
+
}
|
|
299
|
+
.grid-error-subtitle {
|
|
300
|
+
font-size: 16px;
|
|
301
|
+
}
|
|
302
|
+
|
|
276
303
|
/* Disable checkbox animation anywhere in the grid data */
|
|
277
304
|
.grid-data-outer :global(.spectrum-Checkbox-box:before),
|
|
278
305
|
.grid-data-outer :global(.spectrum-Checkbox-box:after),
|
|
@@ -14,6 +14,7 @@ export const createStores = () => {
|
|
|
14
14
|
const rowChangeCache = writable({})
|
|
15
15
|
const inProgressChanges = writable({})
|
|
16
16
|
const hasNextPage = writable(false)
|
|
17
|
+
const error = writable(null)
|
|
17
18
|
|
|
18
19
|
// Generate a lookup map to quick find a row by ID
|
|
19
20
|
const rowLookupMap = derived(
|
|
@@ -47,6 +48,7 @@ export const createStores = () => {
|
|
|
47
48
|
rowChangeCache,
|
|
48
49
|
inProgressChanges,
|
|
49
50
|
hasNextPage,
|
|
51
|
+
error,
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -68,6 +70,7 @@ export const deriveStores = context => {
|
|
|
68
70
|
inProgressChanges,
|
|
69
71
|
previousFocusedRowId,
|
|
70
72
|
hasNextPage,
|
|
73
|
+
error,
|
|
71
74
|
} = context
|
|
72
75
|
const instanceLoaded = writable(false)
|
|
73
76
|
const fetch = writable(null)
|
|
@@ -122,7 +125,17 @@ export const deriveStores = context => {
|
|
|
122
125
|
|
|
123
126
|
// Subscribe to changes of this fetch model
|
|
124
127
|
unsubscribe = newFetch.subscribe(async $fetch => {
|
|
125
|
-
if ($fetch.
|
|
128
|
+
if ($fetch.error) {
|
|
129
|
+
// Present a helpful error to the user
|
|
130
|
+
let message = "An unknown error occurred"
|
|
131
|
+
if ($fetch.error.status === 403) {
|
|
132
|
+
message = "You don't have access to this data"
|
|
133
|
+
} else if ($fetch.error.message) {
|
|
134
|
+
message = $fetch.error.message
|
|
135
|
+
}
|
|
136
|
+
error.set(message)
|
|
137
|
+
} else if ($fetch.loaded && !$fetch.loading) {
|
|
138
|
+
error.set(null)
|
|
126
139
|
hasNextPage.set($fetch.hasNextPage)
|
|
127
140
|
const $instanceLoaded = get(instanceLoaded)
|
|
128
141
|
const resetRows = $fetch.resetKey !== lastResetKey
|
package/src/fetch/DataFetch.js
CHANGED
|
@@ -57,6 +57,7 @@ export default class DataFetch {
|
|
|
57
57
|
cursor: null,
|
|
58
58
|
cursors: [],
|
|
59
59
|
resetKey: Math.random(),
|
|
60
|
+
error: null,
|
|
60
61
|
})
|
|
61
62
|
|
|
62
63
|
// Merge options with their default values
|
|
@@ -252,6 +253,10 @@ export default class DataFetch {
|
|
|
252
253
|
try {
|
|
253
254
|
return await this.API.fetchTableDefinition(datasource.tableId)
|
|
254
255
|
} catch (error) {
|
|
256
|
+
this.store.update(state => ({
|
|
257
|
+
...state,
|
|
258
|
+
error,
|
|
259
|
+
}))
|
|
255
260
|
return null
|
|
256
261
|
}
|
|
257
262
|
}
|