Merge branch 'main' of github.com:specklesystems/speckle-server into alessandro/web-957-dispatch-webhook-event
This commit is contained in:
Коммит
a7a74ac3ff
|
@ -203,9 +203,13 @@ const mixpanel = useMixpanel()
|
|||
const isOpenMobile = ref(false)
|
||||
const showWorkspaceCreateDialog = ref(false)
|
||||
|
||||
const { result: workspaceResult } = useQuery(settingsSidebarQuery, null, {
|
||||
enabled: isWorkspacesEnabled.value
|
||||
})
|
||||
const { result: workspaceResult, onResult: onWorkspaceResult } = useQuery(
|
||||
settingsSidebarQuery,
|
||||
null,
|
||||
{
|
||||
enabled: isWorkspacesEnabled.value
|
||||
}
|
||||
)
|
||||
|
||||
const isActive = (...routes: string[]): boolean => {
|
||||
return routes.some((routeTo) => route.path === routeTo)
|
||||
|
@ -233,4 +237,16 @@ const openWorkspaceCreateDialog = () => {
|
|||
source: 'sidebar'
|
||||
})
|
||||
}
|
||||
|
||||
onWorkspaceResult((result) => {
|
||||
if (result.data?.activeUser) {
|
||||
const workspaceIds = result.data.activeUser.workspaces.items.map(
|
||||
(workspace) => workspace.id
|
||||
)
|
||||
|
||||
if (workspaceIds.length > 0) {
|
||||
mixpanel.people.set('workspace_id', workspaceIds)
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -171,7 +171,6 @@ const onAcceptClick = (token?: string) => {
|
|||
// eslint-disable-next-line camelcase
|
||||
workspace_id: props.invite.workspace.id
|
||||
})
|
||||
mixpanel.add_group('workspace_id', props.invite.workspace.id)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -129,7 +129,6 @@ const processJoin = async (accept: boolean) => {
|
|||
// eslint-disable-next-line camelcase
|
||||
workspace_id: props.workspace.id
|
||||
})
|
||||
mixpanel.add_group('workspace_id', props.workspace.id)
|
||||
|
||||
router.push(`/workspaces/${props.workspace.id}`)
|
||||
} else {
|
||||
|
|
|
@ -196,7 +196,6 @@ export const useProcessWorkspaceInvite = () => {
|
|||
// eslint-disable-next-line camelcase
|
||||
workspace_id: workspaceId
|
||||
})
|
||||
mp.add_group('workspace_id', workspaceId)
|
||||
} else {
|
||||
const err = getFirstErrorMessage(errors)
|
||||
const preventErrorToasts = isFunction(options?.preventErrorToasts)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { knexLogger as logger } from '@/observability/logging.js'
|
||||
import { getPostgresConnectionString, getPostgresMaxConnections } from '@/utils/env.js'
|
||||
import * as knex from 'knex'
|
||||
import { get } from 'lodash-es'
|
||||
|
@ -18,6 +19,11 @@ export const db = knexBuilder({
|
|||
max: getPostgresMaxConnections(),
|
||||
acquireTimeoutMillis: 16000, //allows for 3x creation attempts plus idle time between attempts
|
||||
createTimeoutMillis: 5000
|
||||
},
|
||||
log: {
|
||||
warn: (message) => logger.warn(message),
|
||||
error: (message) => logger.error(message),
|
||||
debug: (message) => logger.debug(message)
|
||||
}
|
||||
// migrations are managed in the server package
|
||||
})
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { REQUEST_ID_HEADER } from '@/domain/const.js'
|
||||
import { logger } from '@/observability/logging.js'
|
||||
import { randomUUID } from 'crypto'
|
||||
import type { Request } from 'express'
|
||||
import type { IncomingHttpHeaders, IncomingMessage } from 'http'
|
||||
import { get } from 'lodash'
|
||||
import { pinoHttp } from 'pino-http'
|
||||
|
||||
function determineRequestId(headers: IncomingHttpHeaders, uuidGenerator = randomUUID) {
|
||||
|
@ -13,6 +15,13 @@ function determineRequestId(headers: IncomingHttpHeaders, uuidGenerator = random
|
|||
|
||||
const generateReqId = (req: IncomingMessage) => determineRequestId(req.headers)
|
||||
|
||||
export const getRequestPath = (req: IncomingMessage | Request) => {
|
||||
const path = ((get(req, 'originalUrl') || get(req, 'url') || '') as string).split(
|
||||
'?'
|
||||
)[0]
|
||||
return path?.length ? path : null
|
||||
}
|
||||
|
||||
export const loggingExpressMiddleware = pinoHttp({
|
||||
genReqId: generateReqId,
|
||||
logger,
|
||||
|
@ -21,6 +30,9 @@ export const loggingExpressMiddleware = pinoHttp({
|
|||
// and we don't really care about 3xx stuff
|
||||
// all the user related 4xx responses are treated as info
|
||||
customLogLevel: (req, res, error) => {
|
||||
const path = getRequestPath(req)
|
||||
const shouldBeDebug = ['/metrics'].includes(path || '') ?? false
|
||||
|
||||
if (res.statusCode >= 400 && res.statusCode < 500) {
|
||||
return 'info'
|
||||
} else if (res.statusCode >= 500 || error) {
|
||||
|
@ -29,6 +41,6 @@ export const loggingExpressMiddleware = pinoHttp({
|
|||
return 'silent'
|
||||
}
|
||||
|
||||
return 'info' //default
|
||||
return shouldBeDebug ? 'debug' : 'info'
|
||||
}
|
||||
})
|
||||
|
|
|
@ -11,3 +11,4 @@ export const logger = extendLoggerComponent(
|
|||
)
|
||||
export const serverLogger = extendLoggerComponent(logger, 'server')
|
||||
export const testLogger = getLogger(getLogLevel(), isLogPretty())
|
||||
export const knexLogger = extendLoggerComponent(logger, 'knex')
|
||||
|
|
|
@ -44,6 +44,10 @@ export const LoggingExpressMiddleware = HttpLogger({
|
|||
autoLogging: true,
|
||||
genReqId: GenerateRequestId,
|
||||
customLogLevel: (req, res, err) => {
|
||||
const path = getRequestPath(req)
|
||||
const shouldBeDebug =
|
||||
['/metrics', '/readiness', '/liveness'].includes(path || '') ?? false
|
||||
|
||||
if (res.statusCode >= 400 && res.statusCode < 500) {
|
||||
return 'info'
|
||||
} else if (res.statusCode >= 500 || err) {
|
||||
|
@ -52,9 +56,7 @@ export const LoggingExpressMiddleware = HttpLogger({
|
|||
return 'info'
|
||||
}
|
||||
|
||||
if (req.url === '/readiness' || req.url === '/liveness') return 'debug'
|
||||
if (req.url === '/metrics') return 'debug'
|
||||
return 'info'
|
||||
return shouldBeDebug ? 'debug' : 'info'
|
||||
},
|
||||
|
||||
customReceivedMessage() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { Request } from 'express'
|
||||
import type { IncomingMessage } from 'http'
|
||||
import type express from 'express'
|
||||
import { get } from 'lodash'
|
||||
|
||||
export const getRequestPath = (req: IncomingMessage | express.Request) => {
|
||||
const path = (get(req, 'originalUrl') || get(req, 'url') || '').split(
|
||||
export const getRequestPath = (req: IncomingMessage | Request) => {
|
||||
const path = ((get(req, 'originalUrl') || get(req, 'url') || '') as string).split(
|
||||
'?'
|
||||
)[0] as string
|
||||
)[0]
|
||||
return path?.length ? path : null
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче