Merge remote-tracking branch 'origin/feature/automation-branching-ux' into automation-branching-ux-updates

This commit is contained in:
Dean 2024-11-01 16:43:07 +00:00
commit 9b1f11636d
5 changed files with 18 additions and 4 deletions

View File

@ -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 // Change websocket connection when table changes
datasource.subscribe(connectToDatasource) datasource.subscribe(connectToDatasource)

View File

@ -24,7 +24,7 @@ export const appId = {
required: true, required: true,
description: "The ID of the app which this request is targeting.", description: "The ID of the app which this request is targeting.",
schema: { schema: {
default: "{{ appId }}", default: "{{appId}}",
type: "string", type: "string",
}, },
} }
@ -35,7 +35,7 @@ export const appIdUrl = {
required: true, required: true,
description: "The ID of the app which this request is targeting.", description: "The ID of the app which this request is targeting.",
schema: { schema: {
default: "{{ appId }}", default: "{{appId}}",
type: "string", type: "string",
}, },
} }

View File

@ -15,6 +15,7 @@ export const examples = {
...user.getExamples(), ...user.getExamples(),
...misc.getExamples(), ...misc.getExamples(),
...metrics.getExamples(), ...metrics.getExamples(),
...roles.getExamples(),
} }
export const schemas = { export const schemas = {

View File

@ -4,6 +4,7 @@ import queryEndpoints from "./queries"
import tableEndpoints from "./tables" import tableEndpoints from "./tables"
import rowEndpoints from "./rows" import rowEndpoints from "./rows"
import userEndpoints from "./users" import userEndpoints from "./users"
import roleEndpoints from "./roles"
import authorized from "../../../middleware/authorized" import authorized from "../../../middleware/authorized"
import publicApi from "../../../middleware/publicApi" import publicApi from "../../../middleware/publicApi"
import { paramResource, paramSubResource } from "../../../middleware/resourceId" import { paramResource, paramSubResource } from "../../../middleware/resourceId"
@ -145,6 +146,7 @@ function applyRoutes(
} }
applyAdminRoutes(metricEndpoints) applyAdminRoutes(metricEndpoints)
applyAdminRoutes(roleEndpoints)
applyRoutes(appEndpoints, PermissionType.APP, "appId") applyRoutes(appEndpoints, PermissionType.APP, "appId")
applyRoutes(tableEndpoints, PermissionType.TABLE, "tableId") applyRoutes(tableEndpoints, PermissionType.TABLE, "tableId")
applyRoutes(userEndpoints, PermissionType.USER, "userId") applyRoutes(userEndpoints, PermissionType.USER, "userId")

View File

@ -80,7 +80,8 @@ export default class GridSocket extends BaseSocket {
} }
emitRowUpdate(ctx: any, row: Row) { 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}` const room = `${ctx.appId}-${resourceId}`
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { this.emitToRoom(ctx, room, GridSocketEvent.RowChange, {
id: row._id, id: row._id,
@ -89,7 +90,8 @@ export default class GridSocket extends BaseSocket {
} }
emitRowDeletion(ctx: any, row: Row) { 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}` const room = `${ctx.appId}-${resourceId}`
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { this.emitToRoom(ctx, room, GridSocketEvent.RowChange, {
id: row._id, id: row._id,