From f9c98d8f908bbd05321456d06c82b402bfc63c61 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 1 Nov 2024 14:53:08 +0000 Subject: [PATCH 1/3] Fix datasource renames being reverted when changing schema --- .../frontend-core/src/components/grid/lib/websocket.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/frontend-core/src/components/grid/lib/websocket.js b/packages/frontend-core/src/components/grid/lib/websocket.js index b0fd236989..e7b89ff58a 100644 --- a/packages/frontend-core/src/components/grid/lib/websocket.js +++ b/packages/frontend-core/src/components/grid/lib/websocket.js @@ -61,6 +61,15 @@ export const createGridWebsocket = context => { } } ) + socket.on( + GridSocketEvent.DatasourceChange, + ({ datasource: newDatasource }) => { + // Listen builder renames, as these aren't handled otherwise + if (newDatasource?.name !== get(definition).name) { + definition.set(newDatasource) + } + } + ) // Change websocket connection when table changes datasource.subscribe(connectToDatasource) From dc7cc49410a96cff7bb23d56556a49cffbf89474 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 1 Nov 2024 15:38:18 +0000 Subject: [PATCH 2/3] Fix multiplayer collab for data --- packages/server/src/websockets/grid.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/websockets/grid.ts b/packages/server/src/websockets/grid.ts index a36413454e..3911313cc3 100644 --- a/packages/server/src/websockets/grid.ts +++ b/packages/server/src/websockets/grid.ts @@ -80,7 +80,8 @@ export default class GridSocket extends BaseSocket { } emitRowUpdate(ctx: any, row: Row) { - const resourceId = ctx.params?.viewId || getSourceId(ctx) + const source = getSourceId(ctx) + const resourceId = source.viewId ?? source.tableId const room = `${ctx.appId}-${resourceId}` this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { id: row._id, @@ -89,7 +90,8 @@ export default class GridSocket extends BaseSocket { } emitRowDeletion(ctx: any, row: Row) { - const resourceId = ctx.params?.viewId || getSourceId(ctx) + const source = getSourceId(ctx) + const resourceId = source.viewId ?? source.tableId const room = `${ctx.appId}-${resourceId}` this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { id: row._id, From 792d8910684041586090d3f11dbf3b326a98f971 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 1 Nov 2024 15:43:36 +0000 Subject: [PATCH 3/3] Some openAPI changes, fixing defaults for app ID, role endpoint permissions and export role examples. --- packages/server/specs/parameters.ts | 4 ++-- packages/server/specs/resources/index.ts | 1 + packages/server/src/api/routes/public/index.ts | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/server/specs/parameters.ts b/packages/server/specs/parameters.ts index a4f2b27ae4..2726ca5064 100644 --- a/packages/server/specs/parameters.ts +++ b/packages/server/specs/parameters.ts @@ -24,7 +24,7 @@ export const appId = { required: true, description: "The ID of the app which this request is targeting.", schema: { - default: "{{ appId }}", + default: "{{appId}}", type: "string", }, } @@ -35,7 +35,7 @@ export const appIdUrl = { required: true, description: "The ID of the app which this request is targeting.", schema: { - default: "{{ appId }}", + default: "{{appId}}", type: "string", }, } diff --git a/packages/server/specs/resources/index.ts b/packages/server/specs/resources/index.ts index c06148b7de..49508e2e4f 100644 --- a/packages/server/specs/resources/index.ts +++ b/packages/server/specs/resources/index.ts @@ -15,6 +15,7 @@ export const examples = { ...user.getExamples(), ...misc.getExamples(), ...metrics.getExamples(), + ...roles.getExamples(), } export const schemas = { diff --git a/packages/server/src/api/routes/public/index.ts b/packages/server/src/api/routes/public/index.ts index 36e0f74bee..b665e83f6f 100644 --- a/packages/server/src/api/routes/public/index.ts +++ b/packages/server/src/api/routes/public/index.ts @@ -4,6 +4,7 @@ import queryEndpoints from "./queries" import tableEndpoints from "./tables" import rowEndpoints from "./rows" import userEndpoints from "./users" +import roleEndpoints from "./roles" import authorized from "../../../middleware/authorized" import publicApi from "../../../middleware/publicApi" import { paramResource, paramSubResource } from "../../../middleware/resourceId" @@ -145,6 +146,7 @@ function applyRoutes( } applyAdminRoutes(metricEndpoints) +applyAdminRoutes(roleEndpoints) applyRoutes(appEndpoints, PermissionType.APP, "appId") applyRoutes(tableEndpoints, PermissionType.TABLE, "tableId") applyRoutes(userEndpoints, PermissionType.USER, "userId")