basic 3.0 metrics
This commit is contained in:
parent
f51140801a
commit
9ef6cbd566
|
@ -23,3 +23,4 @@ export { default as plugin } from "./plugin"
|
||||||
export { default as backup } from "./backup"
|
export { default as backup } from "./backup"
|
||||||
export { default as environmentVariable } from "./environmentVariable"
|
export { default as environmentVariable } from "./environmentVariable"
|
||||||
export { default as auditLog } from "./auditLog"
|
export { default as auditLog } from "./auditLog"
|
||||||
|
export { default as rowAction } from "./rowAction"
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { publishEvent } from "../events"
|
||||||
|
import { Event, RowActionCreatedEvent } from "@budibase/types"
|
||||||
|
|
||||||
|
async function created(
|
||||||
|
rowAction: RowActionCreatedEvent,
|
||||||
|
timestamp?: string | number
|
||||||
|
) {
|
||||||
|
await publishEvent(Event.TABLE_CREATED, rowAction, timestamp)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
created,
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ import {
|
||||||
ViewFilterDeletedEvent,
|
ViewFilterDeletedEvent,
|
||||||
ViewFilterUpdatedEvent,
|
ViewFilterUpdatedEvent,
|
||||||
ViewUpdatedEvent,
|
ViewUpdatedEvent,
|
||||||
View,
|
ViewV2,
|
||||||
ViewCalculation,
|
ViewCalculation,
|
||||||
Table,
|
Table,
|
||||||
TableExportFormat,
|
TableExportFormat,
|
||||||
|
@ -19,9 +19,10 @@ import {
|
||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
|
||||||
async function created(view: View, timestamp?: string | number) {
|
async function created(view: Partial<ViewV2>, timestamp?: string | number) {
|
||||||
const properties: ViewCreatedEvent = {
|
const properties: ViewCreatedEvent = {
|
||||||
tableId: view.tableId,
|
name: view.name,
|
||||||
|
type: view.type,
|
||||||
}
|
}
|
||||||
await publishEvent(Event.VIEW_CREATED, properties, timestamp)
|
await publishEvent(Event.VIEW_CREATED, properties, timestamp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
RowActionResponse,
|
RowActionResponse,
|
||||||
RowActionsResponse,
|
RowActionsResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
import { events } from "@budibase/backend-core"
|
||||||
import sdk from "../../../sdk"
|
import sdk from "../../../sdk"
|
||||||
|
|
||||||
async function getTable(ctx: Ctx) {
|
async function getTable(ctx: Ctx) {
|
||||||
|
@ -59,6 +60,8 @@ export async function create(
|
||||||
name: ctx.request.body.name,
|
name: ctx.request.body.name,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await events.rowAction.created(createdAction)
|
||||||
|
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
tableId,
|
tableId,
|
||||||
id: createdAction.id,
|
id: createdAction.id,
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
CountDistinctCalculationFieldMetadata,
|
CountDistinctCalculationFieldMetadata,
|
||||||
CountCalculationFieldMetadata,
|
CountCalculationFieldMetadata,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
import { events } from "@budibase/backend-core"
|
||||||
import { builderSocket, gridSocket } from "../../../websockets"
|
import { builderSocket, gridSocket } from "../../../websockets"
|
||||||
import { helpers } from "@budibase/shared-core"
|
import { helpers } from "@budibase/shared-core"
|
||||||
|
|
||||||
|
@ -149,6 +150,9 @@ export async function create(ctx: Ctx<CreateViewRequest, ViewResponse>) {
|
||||||
primaryDisplay: view.primaryDisplay,
|
primaryDisplay: view.primaryDisplay,
|
||||||
}
|
}
|
||||||
const result = await sdk.views.create(tableId, parsedView)
|
const result = await sdk.views.create(tableId, parsedView)
|
||||||
|
|
||||||
|
await events.view.created(view)
|
||||||
|
|
||||||
ctx.status = 201
|
ctx.status = 201
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
data: result,
|
data: result,
|
||||||
|
|
|
@ -24,3 +24,4 @@ export * from "./plugin"
|
||||||
export * from "./backup"
|
export * from "./backup"
|
||||||
export * from "./environmentVariable"
|
export * from "./environmentVariable"
|
||||||
export * from "./auditLog"
|
export * from "./auditLog"
|
||||||
|
export * from "./rowAction"
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { BaseEvent } from "./event"
|
||||||
|
|
||||||
|
export interface RowActionCreatedEvent extends BaseEvent {
|
||||||
|
name: string
|
||||||
|
automationId: string
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
import { ViewCalculation } from "../../documents"
|
import { ViewCalculation, ViewV2Schema, ViewV2Type } from "../../documents"
|
||||||
import { BaseEvent, TableExportFormat } from "./event"
|
import { BaseEvent, TableExportFormat } from "./event"
|
||||||
|
import { LegacyFilter, SortOrder, SortType, UISearchFilter } from "../../api"
|
||||||
|
import { SearchFilters } from "../search"
|
||||||
|
|
||||||
export interface ViewCreatedEvent extends BaseEvent {
|
export interface ViewCreatedEvent extends BaseEvent {
|
||||||
tableId: string
|
name: string
|
||||||
|
type?: ViewV2Type
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ViewUpdatedEvent extends BaseEvent {
|
export interface ViewUpdatedEvent extends BaseEvent {
|
||||||
|
|
Loading…
Reference in New Issue