From 3c08043c3e579e780f8ea1660797f5603be54ab1 Mon Sep 17 00:00:00 2001 From: Georg Bremer Date: Thu, 11 Apr 2024 12:01:22 +0200 Subject: [PATCH 1/5] chore: Improve Activity Library focus and hover states --- .../ActivityLibrary/ActivityCard.tsx | 2 +- .../ActivityLibrary/ActivityGrid.tsx | 8 ++-- .../ActivityLibrary/ActivityLibraryCard.tsx | 14 ------ .../ActivityLibrary/CreateActivityCard.tsx | 11 +++-- .../CreateNewActivity/CreateNewActivity.tsx | 4 +- .../components/RetroDrawerTemplateCard.tsx | 46 ++++++++++--------- 6 files changed, 38 insertions(+), 47 deletions(-) delete mode 100644 packages/client/components/ActivityLibrary/ActivityLibraryCard.tsx diff --git a/packages/client/components/ActivityLibrary/ActivityCard.tsx b/packages/client/components/ActivityLibrary/ActivityCard.tsx index e0ccdbdf51d..7165a009a29 100644 --- a/packages/client/components/ActivityLibrary/ActivityCard.tsx +++ b/packages/client/components/ActivityLibrary/ActivityCard.tsx @@ -94,7 +94,7 @@ export const ActivityCard = (props: ActivityCardProps) => { return (
diff --git a/packages/client/components/ActivityLibrary/ActivityGrid.tsx b/packages/client/components/ActivityLibrary/ActivityGrid.tsx index fca5f6c3524..3447e7556a3 100644 --- a/packages/client/components/ActivityLibrary/ActivityGrid.tsx +++ b/packages/client/components/ActivityLibrary/ActivityGrid.tsx @@ -2,7 +2,7 @@ import React from 'react' import {ActivityBadge} from './ActivityBadge' import {ActivityCardImage} from './ActivityCard' import {Template} from './ActivityLibrary' -import {ActivityLibraryCard} from './ActivityLibraryCard' +import {ActivityCard} from './ActivityCard' import {Link} from 'react-router-dom' import {CategoryID, CATEGORY_THEMES} from './Categories' import {ActivityLibraryCardDescription} from './ActivityLibraryCardDescription' @@ -23,9 +23,9 @@ const ActivityGrid = ({templates, selectedCategory}: ActivityGridProps) => { pathname: `/activity-library/details/${template.id}`, state: {prevCategory: selectedCategory} }} - className='flex focus:rounded-md focus:outline-primary' + className='flex rounded-2xl focus:outline-sky-500 hover:bg-slate-100' > - { className='hidden group-hover/card:flex' templateRef={template} /> - + ) })} diff --git a/packages/client/components/ActivityLibrary/ActivityLibraryCard.tsx b/packages/client/components/ActivityLibrary/ActivityLibraryCard.tsx deleted file mode 100644 index 55055d77d94..00000000000 --- a/packages/client/components/ActivityLibrary/ActivityLibraryCard.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import clsx from 'clsx' -import React from 'react' -import {ActivityCard, ActivityCardProps} from './ActivityCard' - -export const ActivityLibraryCard = (props: ActivityCardProps) => { - const {className, ...rest} = props - - return ( - - ) -} diff --git a/packages/client/components/ActivityLibrary/CreateActivityCard.tsx b/packages/client/components/ActivityLibrary/CreateActivityCard.tsx index ea574d4cf1c..ca6bcab2c85 100644 --- a/packages/client/components/ActivityLibrary/CreateActivityCard.tsx +++ b/packages/client/components/ActivityLibrary/CreateActivityCard.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {ActivityLibraryCard} from './ActivityLibraryCard' +import {ActivityCard} from './ActivityCard' import {ActivityBadge} from './ActivityBadge' import {Add as AddIcon} from '@mui/icons-material' import clsx from 'clsx' @@ -15,8 +15,11 @@ const CreateActivityCard = (props: Props) => { const {category, className} = props return ( - - + Premium} @@ -27,7 +30,7 @@ const CreateActivityCard = (props: Props) => {
Create Custom {category !== 'recommended' ? CATEGORY_ID_TO_NAME[category] : ''} Activity - + ) } diff --git a/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx b/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx index f105e0e1aab..47392d5c69f 100644 --- a/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx +++ b/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx @@ -245,11 +245,11 @@ export const CreateNewActivity = (props: Props) => { return ( { return (
- Premium - ) : null - } - > - - - +
+ Premium + ) : null + } + > + + + +
) } From 459ff627f715ce2632deac069d968c6f66f304d8 Mon Sep 17 00:00:00 2001 From: Georg Bremer Date: Mon, 15 Apr 2024 12:47:26 +0200 Subject: [PATCH 2/5] Make the aktivity type selection less cramped --- .../ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx b/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx index e7ca6cc49af..68760567279 100644 --- a/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx +++ b/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx @@ -245,7 +245,7 @@ export const CreateNewActivity = (props: Props) => { return ( Date: Thu, 11 Apr 2024 15:50:20 -0700 Subject: [PATCH 3/5] chore: migration reflection groups to pg (#9514) Signed-off-by: Matt Krick --- .../mutations/checkRethinkPgEquality.ts | 47 ++++++---- .../1708127504000_updateEmbeddingMetadata.ts | 6 +- .../1712075131388_retroReflectionGroups2.ts | 88 +++++++++++++++++++ packages/server/postgres/utils/checkEqBase.ts | 18 ++-- .../postgres/utils/rethinkEqualityFns.ts | 8 ++ packages/server/utils/PubSubPromise.ts | 2 +- 6 files changed, 145 insertions(+), 24 deletions(-) create mode 100644 packages/server/postgres/migrations/1712075131388_retroReflectionGroups2.ts diff --git a/packages/server/graphql/private/mutations/checkRethinkPgEquality.ts b/packages/server/graphql/private/mutations/checkRethinkPgEquality.ts index 137316624e8..818af10d9e6 100644 --- a/packages/server/graphql/private/mutations/checkRethinkPgEquality.ts +++ b/packages/server/graphql/private/mutations/checkRethinkPgEquality.ts @@ -1,12 +1,11 @@ import fs from 'fs' import path from 'path' import getRethink from '../../../database/rethinkDriver' -import getMeetingTemplatesByIds from '../../../postgres/queries/getMeetingTemplatesByIds' +import getKysely from '../../../postgres/getKysely' import {checkRowCount, checkTableEq} from '../../../postgres/utils/checkEqBase' import { compareDateAlmostEqual, - compareRValUndefinedAsFalse, - compareRValUndefinedAsNull, + compareRValUndefinedAsNullAndTruncateRVal, defaultEqFn } from '../../../postgres/utils/rethinkEqualityFns' import {MutationResolvers} from '../resolverTypes' @@ -35,22 +34,38 @@ const checkRethinkPgEquality: MutationResolvers['checkRethinkPgEquality'] = asyn ) => { const r = await getRethink() - if (tableName === 'MeetingTemplate') { + if (tableName === 'RetroReflectionGroup') { const rowCountResult = await checkRowCount(tableName) - const rethinkQuery = r.table('MeetingTemplate').orderBy('updatedAt', {index: 'updatedAt'}) - const errors = await checkTableEq(rethinkQuery, getMeetingTemplatesByIds, { + const rethinkQuery = (updatedAt: Date, id: string | number) => { + return r + .table('RetroReflectionGroup') + .between([updatedAt, id], [r.maxval, r.maxval], { + index: 'updatedAtId', + leftBound: 'open', + rightBound: 'closed' + }) + .orderBy({index: 'updatedAtId'}) as any + } + const pgQuery = (ids: string[]) => { + return getKysely() + .selectFrom('RetroReflectionGroup') + .selectAll() + .where('id', 'in', ids) + .execute() + } + const errors = await checkTableEq(rethinkQuery, pgQuery, { + id: defaultEqFn, createdAt: defaultEqFn, - isActive: defaultEqFn, - name: defaultEqFn, - teamId: defaultEqFn, updatedAt: compareDateAlmostEqual, - scope: defaultEqFn, - orgId: defaultEqFn, - parentTemplateId: compareRValUndefinedAsNull, - lastUsedAt: compareRValUndefinedAsNull, - type: defaultEqFn, - isStarter: compareRValUndefinedAsFalse, - isFree: compareRValUndefinedAsFalse + isActive: defaultEqFn, + meetingId: defaultEqFn, + promptId: defaultEqFn, + sortOrder: defaultEqFn, + voterIds: defaultEqFn, + smartTitle: compareRValUndefinedAsNullAndTruncateRVal(255), + title: compareRValUndefinedAsNullAndTruncateRVal(255), + summary: compareRValUndefinedAsNullAndTruncateRVal(2000), + discussionPromptQuestion: compareRValUndefinedAsNullAndTruncateRVal(2000) }) return handleResult(tableName, rowCountResult, errors, writeToFile) } diff --git a/packages/server/postgres/migrations/1708127504000_updateEmbeddingMetadata.ts b/packages/server/postgres/migrations/1708127504000_updateEmbeddingMetadata.ts index 3c93617c0b1..279dd6f90b7 100644 --- a/packages/server/postgres/migrations/1708127504000_updateEmbeddingMetadata.ts +++ b/packages/server/postgres/migrations/1708127504000_updateEmbeddingMetadata.ts @@ -4,9 +4,13 @@ import getPgConfig from '../getPgConfig' export async function up() { const client = new Client(getPgConfig()) await client.connect() - await client.query(` + try { + await client.query(` ALTER TABLE "EmbeddingsMetadata" RENAME COLUMN "embedText" TO "fullText"; `) + } catch { + // noop + } await client.end() } diff --git a/packages/server/postgres/migrations/1712075131388_retroReflectionGroups2.ts b/packages/server/postgres/migrations/1712075131388_retroReflectionGroups2.ts new file mode 100644 index 00000000000..c0027a0073d --- /dev/null +++ b/packages/server/postgres/migrations/1712075131388_retroReflectionGroups2.ts @@ -0,0 +1,88 @@ +import {Kysely, PostgresDialect} from 'kysely' +import {r} from 'rethinkdb-ts' +import connectRethinkDB from '../../database/connectRethinkDB' +import getPg from '../getPg' + +export async function up() { + await connectRethinkDB() + const pg = new Kysely({ + dialect: new PostgresDialect({ + pool: getPg() + }) + }) + try { + await r + .table('RetroReflectionGroup') + .indexCreate('updatedAtId', (row: any) => [row('updatedAt'), row('id')]) + .run() + await r.table('RetroReflectionGroup').indexWait().run() + } catch { + // index already exists + } + + const MAX_PG_PARAMS = 65545 + const PG_COLS = [ + 'id', + 'createdAt', + 'updatedAt', + 'isActive', + 'meetingId', + 'promptId', + 'sortOrder', + 'voterIds', + 'smartTitle', + 'title', + 'summary', + 'discussionPromptQuestion' + ] as const + type RetroReflectionGroup = { + [K in (typeof PG_COLS)[number]]: any + } + const BATCH_SIZE = Math.trunc(MAX_PG_PARAMS / PG_COLS.length) + + let curUpdatedAt = r.minval + let curId = r.minval + for (let i = 0; i < 1e6; i++) { + const rawRowsToInsert = (await r + .table('RetroReflectionGroup') + .between([curUpdatedAt, curId], [r.maxval, r.maxval], { + index: 'updatedAtId', + leftBound: 'open', + rightBound: 'closed' + }) + .orderBy({index: 'updatedAtId'}) + .limit(BATCH_SIZE) + .pluck(...PG_COLS) + .run()) as RetroReflectionGroup[] + + const rowsToInsert = rawRowsToInsert.map((row) => ({ + ...row, + title: row.title?.slice(0, 255), + smartTitle: row.smartTitle?.slice(0, 255), + summary: row.summary?.slice(0, 2000) + })) + if (rowsToInsert.length === 0) break + const lastRow = rowsToInsert[rowsToInsert.length - 1] + curUpdatedAt = lastRow.updatedAt + curId = lastRow.id + try { + await pg + .insertInto('RetroReflectionGroup') + .values(rowsToInsert) + .onConflict((oc) => oc.doNothing()) + .execute() + } catch (e) { + console.log({lastRow}, rowsToInsert.length) + throw e + } + } +} + +export async function down() { + await connectRethinkDB() + try { + await r.table('RetroReflectionGroup').indexDrop('updatedAtId').run() + } catch { + // index already dropped + } +} diff --git a/packages/server/postgres/utils/checkEqBase.ts b/packages/server/postgres/utils/checkEqBase.ts index c56da959aa3..20bc9914f43 100644 --- a/packages/server/postgres/utils/checkEqBase.ts +++ b/packages/server/postgres/utils/checkEqBase.ts @@ -1,5 +1,5 @@ +import {RSelection} from 'rethinkdb-ts' import getRethink from '../../database/rethinkDriver' -import {RTable, TableSchema} from '../../database/stricterR' import getPg from '../getPg' interface DBDoc { @@ -33,7 +33,7 @@ export const checkRowCount = async (tableName: string) => { } export async function checkTableEq( - rethinkQuery: RTable, + rethinkQuery: (updatedAt: Date, id: string | number) => RSelection, pgQuery: (ids: string[]) => Promise, equalityMap: Record boolean>, maxErrors = 10 @@ -41,11 +41,17 @@ export async function checkTableEq( const batchSize = 3000 const errors = [] as Diff[] const propsToCheck = Object.keys(equalityMap) - + const r = await getRethink() + let curUpdatedDate = r.minval + let curId = r.minval for (let i = 0; i < 1e6; i++) { - const offset = batchSize * i - const rethinkRows = (await rethinkQuery.skip(offset).limit(batchSize).run()) as RethinkDoc[] - if (!rethinkRows.length) break + const rethinkRows = (await rethinkQuery(curUpdatedDate, curId) + .limit(batchSize) + .run()) as RethinkDoc[] + if (rethinkRows.length === 0) break + const lastRow = rethinkRows[rethinkRows.length - 1]! + curUpdatedDate = lastRow.updatedAt + curId = lastRow.id const ids = rethinkRows.map((t) => t.id) const pgRows = (await pgQuery(ids)) ?? [] const pgRowsById = {} as {[key: string]: PGDoc} diff --git a/packages/server/postgres/utils/rethinkEqualityFns.ts b/packages/server/postgres/utils/rethinkEqualityFns.ts index 8cecaf562c1..69f0ec2bb20 100644 --- a/packages/server/postgres/utils/rethinkEqualityFns.ts +++ b/packages/server/postgres/utils/rethinkEqualityFns.ts @@ -2,6 +2,7 @@ import isValidDate from 'parabol-client/utils/isValidDate' export const defaultEqFn = (a: unknown, b: unknown) => { if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime() + if (Array.isArray(a) && Array.isArray(b)) return JSON.stringify(a) === JSON.stringify(b) return a === b } export const compareDateAlmostEqual = (rVal: unknown, pgVal: unknown) => { @@ -19,3 +20,10 @@ export const compareRValUndefinedAsFalse = (rVal: unknown, pgVal: unknown) => { const normalizedRVal = rVal === undefined ? false : rVal return normalizedRVal === pgVal } + +export const compareRValUndefinedAsNullAndTruncateRVal = + (length: number) => (rVal: unknown, pgVal: unknown) => { + const truncatedRVal = typeof rVal === 'string' ? rVal.slice(0, length) : rVal + const normalizedRVal = truncatedRVal === undefined ? null : truncatedRVal + return defaultEqFn(normalizedRVal, pgVal) + } diff --git a/packages/server/utils/PubSubPromise.ts b/packages/server/utils/PubSubPromise.ts index 8768ef1eb9d..cd95cbaf325 100644 --- a/packages/server/utils/PubSubPromise.ts +++ b/packages/server/utils/PubSubPromise.ts @@ -5,7 +5,7 @@ import numToBase64 from './numToBase64' import sendToSentry from './sendToSentry' const STANDARD_TIMEOUT = ms('10s') -const ADHOC_TIMEOUT = ms('1m') +const ADHOC_TIMEOUT = ms('10m') interface Job { resolve: (payload: any) => void From 46d11102365893362295603b71a2010866102440 Mon Sep 17 00:00:00 2001 From: Dale Bumblis <135627447+dbumblis-parabol@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:58:45 -0700 Subject: [PATCH 4/5] chore: fix ironbank action file copy (#9638) --- .github/workflows/ironbank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ironbank.yml b/.github/workflows/ironbank.yml index c60df2b134f..bbd88303041 100644 --- a/.github/workflows/ironbank.yml +++ b/.github/workflows/ironbank.yml @@ -50,7 +50,7 @@ jobs: run: | docker cp temp-container:/home/node/parabol/dist ./dist docker cp temp-container:/home/node/parabol/build ./build - docker cp temp-container:/home/node/tools/ip-to-server_id ./tools/ip-to-server_id + docker cp temp-container:/home/node/tools/ip-to-server_id ./ip-to-server_id - name: Zip the files run: zip -r ${{ github.event.inputs.version_number }}.zip dist build From 35cb33f2e69c0f84425ddfb1412bfeac59550b47 Mon Sep 17 00:00:00 2001 From: Georg Bremer Date: Mon, 15 Apr 2024 15:12:27 +0200 Subject: [PATCH 5/5] prettier --- packages/client/components/ActivityLibrary/ActivityCard.tsx | 2 +- .../ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/components/ActivityLibrary/ActivityCard.tsx b/packages/client/components/ActivityLibrary/ActivityCard.tsx index 7165a009a29..724e791960b 100644 --- a/packages/client/components/ActivityLibrary/ActivityCard.tsx +++ b/packages/client/components/ActivityLibrary/ActivityCard.tsx @@ -94,7 +94,7 @@ export const ActivityCard = (props: ActivityCardProps) => { return (
diff --git a/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx b/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx index 68760567279..8017e115b63 100644 --- a/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx +++ b/packages/client/components/ActivityLibrary/CreateNewActivity/CreateNewActivity.tsx @@ -245,7 +245,7 @@ export const CreateNewActivity = (props: Props) => { return (