Few more fixes (#7161)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-11-13 01:18:58 +07:00 committed by GitHub
parent 76bcd3c52c
commit 8e511653cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 34 deletions

View File

@ -55,8 +55,12 @@ export async function onTagReference (txes: Tx[], control: TriggerControl): Prom
const actualTx = TxProcessor.extractTx(tx)
const isCreate = control.hierarchy.isDerived(actualTx._class, core.class.TxCreateDoc)
const isRemove = control.hierarchy.isDerived(actualTx._class, core.class.TxRemoveDoc)
if (!isCreate && !isRemove) return []
if (!control.hierarchy.isDerived((actualTx as TxCUD<Doc>).objectClass, tags.class.TagReference)) return []
if (!isCreate && !isRemove) {
continue
}
if (!control.hierarchy.isDerived((actualTx as TxCUD<Doc>).objectClass, tags.class.TagReference)) {
continue
}
if (isCreate) {
const doc = TxProcessor.createDoc2Doc(actualTx as TxCreateDoc<TagReference>)
result.push(

View File

@ -24,7 +24,9 @@ export async function OnStateUpdate (txes: Tx[], control: TriggerControl): Promi
const result: Tx[] = []
for (const tx of txes) {
const actualTx = TxProcessor.extractTx(tx) as TxCUD<Doc>
if (!control.hierarchy.isDerived(actualTx.objectClass, task.class.Task)) return []
if (!control.hierarchy.isDerived(actualTx.objectClass, task.class.Task)) {
continue
}
if (actualTx._class === core.class.TxCreateDoc) {
const doc = TxProcessor.createDoc2Doc(actualTx as TxCreateDoc<Task>)
const status = control.modelDb.findAllSync(core.class.Status, { _id: doc.status })[0]

View File

@ -102,31 +102,34 @@ export function initStatisticsContext (
const serviceId = encodeURIComponent(os.hostname() + '-' + serviceName)
const intTimer = setInterval(() => {
if (metricsFile !== undefined || ops?.logConsole === true) {
const val = metricsToString(metricsContext.metrics, serviceName, 140)
if (val !== oldMetricsValue) {
oldMetricsValue = val
if (metricsFile !== undefined) {
writeFile(metricsFile, val).catch((err) => {
console.error(err)
})
}
if (ops?.logConsole === true) {
console.info('METRICS:', val)
try {
if (metricsFile !== undefined || ops?.logConsole === true) {
const val = metricsToString(metricsContext.metrics, serviceName, 140)
if (val !== oldMetricsValue) {
oldMetricsValue = val
if (metricsFile !== undefined) {
void writeFile(metricsFile, val).catch((err) => {
console.error(err)
})
}
if (ops?.logConsole === true) {
console.info('METRICS:', val)
}
}
}
}
if (statsUrl !== undefined) {
const token = generateToken(systemAccountEmail, { name: '' }, { service: 'true' })
const data: ServiceStatistics = {
serviceName,
cpu: getCPUInfo(),
memory: getMemoryInfo(),
stats: metricsContext.metrics,
workspaces: ops?.getUsers?.()
}
if (statsUrl !== undefined) {
const token = generateToken(systemAccountEmail, { name: '' }, { service: 'true' })
const data: ServiceStatistics = {
serviceName,
cpu: getCPUInfo(),
memory: getMemoryInfo(),
stats: metricsContext.metrics,
workspaces: ops?.getUsers?.()
}
try {
const statData = JSON.stringify(data)
metricsContext.info('send stats:', { size: statData.length })
void fetch(
concatLink(statsUrl, '/api/v1/statistics') + `/?token=${encodeURIComponent(token)}&name=${serviceId}`,
{
@ -134,19 +137,19 @@ export function initStatisticsContext (
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
body: statData
}
).catch((err) => {
errorToSend++
if (errorToSend % 20 === 0) {
if (errorToSend % 2 === 0) {
console.error(err)
}
})
} catch (err: any) {
errorToSend++
if (errorToSend % 20 === 0) {
console.error(err)
}
}
} catch (err: any) {
errorToSend++
if (errorToSend % 20 === 0) {
console.error(err)
}
}
}, METRICS_UPDATE_INTERVAL)

View File

@ -121,6 +121,11 @@ export class IssuesPage extends CommonTrackerPage {
.locator('button')
selectPopup = (): Locator => this.page.locator('.selectPopup >> button:has-text("Appleseed John")')
closePopup = async (): Promise<void> => {
await this.page.locator('.selectPopup').press('Escape')
}
notificationTimeoutSetting = (timeout: string): Promise<void> => {
return this.page.evaluate((timeout) => {
localStorage.setItem('#platform.notification.timeout', timeout)

View File

@ -392,7 +392,7 @@ test.describe('Tracker filters tests', () => {
})
test('Label filter', async () => {
const filterLabel = 'Filter Label'
const filterLabel = `Filter Label-${generateId(4)}`
const labelIssue: NewIssue = {
title: `Issue for the Label filter-${generateId()}`,
description: 'Issue for the Label filter',
@ -406,7 +406,7 @@ test.describe('Tracker filters tests', () => {
await test.step('Check Label filter for exist Label', async () => {
await issuesPage.selectFilter('Labels', filterLabel)
await issuesPage.inputSearch().press('Escape')
await issuesPage.closePopup()
await issuesPage.checkFilter('Labels', 'is', filterLabel)
for await (const issue of iterateLocator(issuesPage.issuesList())) {
await expect(issue.locator('div.compression-bar > div.label-box span.label')).toContainText(filterLabel)