Merge branch 'master' of github.com:Budibase/budibase into fix/13199-deleted-rows-issue
This commit is contained in:
commit
22753a6b04
|
@ -10,6 +10,7 @@ interface ProcessDocMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PERSIST_MAX_ATTEMPTS = 100
|
const PERSIST_MAX_ATTEMPTS = 100
|
||||||
|
let processor: DocWritethroughProcessor | undefined
|
||||||
|
|
||||||
export const docWritethroughProcessorQueue = createQueue<ProcessDocMessage>(
|
export const docWritethroughProcessorQueue = createQueue<ProcessDocMessage>(
|
||||||
JobQueue.DOC_WRITETHROUGH_QUEUE,
|
JobQueue.DOC_WRITETHROUGH_QUEUE,
|
||||||
|
@ -61,8 +62,6 @@ class DocWritethroughProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const processor = new DocWritethroughProcessor().init()
|
|
||||||
|
|
||||||
export class DocWritethrough {
|
export class DocWritethrough {
|
||||||
private db: Database
|
private db: Database
|
||||||
private _docId: string
|
private _docId: string
|
||||||
|
@ -84,3 +83,15 @@ export class DocWritethrough {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function init(): DocWritethroughProcessor {
|
||||||
|
processor = new DocWritethroughProcessor().init()
|
||||||
|
return processor
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProcessor(): DocWritethroughProcessor {
|
||||||
|
if (!processor) {
|
||||||
|
return init()
|
||||||
|
}
|
||||||
|
return processor
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { getDB } from "../../db"
|
||||||
import {
|
import {
|
||||||
DocWritethrough,
|
DocWritethrough,
|
||||||
docWritethroughProcessorQueue,
|
docWritethroughProcessorQueue,
|
||||||
|
init,
|
||||||
} from "../docWritethrough"
|
} from "../docWritethrough"
|
||||||
|
|
||||||
import InMemoryQueue from "../../queue/inMemoryQueue"
|
import InMemoryQueue from "../../queue/inMemoryQueue"
|
||||||
|
@ -19,6 +20,10 @@ async function waitForQueueCompletion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("docWritethrough", () => {
|
describe("docWritethrough", () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
init()
|
||||||
|
})
|
||||||
|
|
||||||
const config = new DBTestConfiguration()
|
const config = new DBTestConfiguration()
|
||||||
|
|
||||||
const db = getDB(structures.db.id())
|
const db = getDB(structures.db.id())
|
||||||
|
|
|
@ -1137,6 +1137,12 @@
|
||||||
"key": "color",
|
"key": "color",
|
||||||
"showInBar": true
|
"showInBar": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"label": "Text Color",
|
||||||
|
"key": "textColor",
|
||||||
|
"showInBar": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Allow delete",
|
"label": "Allow delete",
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
export let onClick
|
export let onClick
|
||||||
export let text = ""
|
export let text = ""
|
||||||
export let color
|
export let color
|
||||||
|
export let textColor
|
||||||
export let closable = false
|
export let closable = false
|
||||||
export let size = "M"
|
export let size = "M"
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
|
|
||||||
// Add color styles to main styles object, otherwise the styleable helper
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
// overrides the color when it's passed as inline style.
|
// overrides the color when it's passed as inline style.
|
||||||
$: styles = enrichStyles($component.styles, color)
|
$: styles = enrichStyles($component.styles, color, textColor)
|
||||||
$: componentText = getComponentText(text, $builderStore, $component)
|
$: componentText = getComponentText(text, $builderStore, $component)
|
||||||
|
|
||||||
const getComponentText = (text, builderState, componentState) => {
|
const getComponentText = (text, builderState, componentState) => {
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
return text || componentState.name || "Placeholder text"
|
return text || componentState.name || "Placeholder text"
|
||||||
}
|
}
|
||||||
|
|
||||||
const enrichStyles = (styles, color) => {
|
const enrichStyles = (styles, color, textColor) => {
|
||||||
if (!color) {
|
if (!color) {
|
||||||
return styles
|
return styles
|
||||||
}
|
}
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
...styles?.normal,
|
...styles?.normal,
|
||||||
"background-color": color,
|
"background-color": color,
|
||||||
"border-color": color,
|
"border-color": color,
|
||||||
color: "white",
|
color: textColor || "white",
|
||||||
"--spectrum-clearbutton-medium-icon-color": "white",
|
"--spectrum-clearbutton-medium-icon-color": "white",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
logging,
|
logging,
|
||||||
tenancy,
|
tenancy,
|
||||||
users,
|
users,
|
||||||
|
cache,
|
||||||
} from "@budibase/backend-core"
|
} from "@budibase/backend-core"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import { watch } from "./watch"
|
import { watch } from "./watch"
|
||||||
|
@ -74,6 +75,7 @@ export async function startup(app?: Koa, server?: Server) {
|
||||||
eventEmitter.emitPort(env.PORT)
|
eventEmitter.emitPort(env.PORT)
|
||||||
fileSystem.init()
|
fileSystem.init()
|
||||||
await redis.init()
|
await redis.init()
|
||||||
|
cache.docWritethrough.init()
|
||||||
eventInit()
|
eventInit()
|
||||||
if (app && server) {
|
if (app && server) {
|
||||||
initialiseWebsockets(app, server)
|
initialiseWebsockets(app, server)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
env as coreEnv,
|
env as coreEnv,
|
||||||
timers,
|
timers,
|
||||||
redis,
|
redis,
|
||||||
|
cache,
|
||||||
} from "@budibase/backend-core"
|
} from "@budibase/backend-core"
|
||||||
|
|
||||||
db.init()
|
db.init()
|
||||||
|
@ -90,6 +91,7 @@ export default server.listen(parseInt(env.PORT || "4002"), async () => {
|
||||||
console.log(`Worker running on ${JSON.stringify(server.address())}`)
|
console.log(`Worker running on ${JSON.stringify(server.address())}`)
|
||||||
await initPro()
|
await initPro()
|
||||||
await redis.clients.init()
|
await redis.clients.init()
|
||||||
|
cache.docWritethrough.init()
|
||||||
// configure events to use the pro audit log write
|
// configure events to use the pro audit log write
|
||||||
// can't integrate directly into backend-core due to cyclic issues
|
// can't integrate directly into backend-core due to cyclic issues
|
||||||
await events.processors.init(proSdk.auditLogs.write)
|
await events.processors.init(proSdk.auditLogs.write)
|
||||||
|
|
Loading…
Reference in New Issue