diff --git a/src/deploy/database-images/index.ts b/src/deploy/database-images/index.ts index fe8604cce..053ad556b 100644 --- a/src/deploy/database-images/index.ts +++ b/src/deploy/database-images/index.ts @@ -57,6 +57,8 @@ export const deserializeDeployDatabaseImage = ( export const hasDeployDatabaseImage = (a: DeployDatabaseImage) => a.id !== ""; export const selectDatabaseImageById = schema.databaseImages.selectById; +export const selectDatabaseImages = schema.databaseImages.selectTable; +export const findDatabaseImageById = schema.databaseImages.findById; export const selectDatabaseImagesAsList = createSelector( schema.databaseImages.selectTableAsList, (imgs) => diff --git a/src/deploy/database/index.ts b/src/deploy/database/index.ts index f2b7e35b2..1f9d2048b 100644 --- a/src/deploy/database/index.ts +++ b/src/deploy/database/index.ts @@ -135,6 +135,7 @@ export interface DeployDatabaseRow extends DeployDatabase { cost: number; diskSize: number; containerSize: number; + imageDesc: string; } export const hasDeployDatabase = (a: DeployDatabase) => a.id !== ""; diff --git a/src/deploy/search/index.ts b/src/deploy/search/index.ts index 9c5917271..e5893d01d 100644 --- a/src/deploy/search/index.ts +++ b/src/deploy/search/index.ts @@ -14,6 +14,10 @@ import { type DeployDatabaseRow, selectDatabasesByOrgAsList, } from "../database"; +import { + findDatabaseImageById, + selectDatabaseImages, +} from "../database-images"; import { findDiskById, selectDisks } from "../disk"; import { findEnvById, @@ -471,6 +475,7 @@ const computeSearchMatchDb = ( const handle = db.handle.toLocaleLowerCase(); const envHandle = db.envHandle.toLocaleLowerCase(); const dbType = db.type.toLocaleLowerCase(); + const dbImage = db.imageDesc.toLocaleLowerCase(); let lastOpUser = ""; let lastOpType = ""; @@ -487,10 +492,12 @@ const computeSearchMatchDb = ( const opMatch = lastOpType !== "" && lastOpType.includes(search); const opStatusMatch = lastOpStatus !== "" && lastOpStatus.includes(search); const dbTypeMatch = dbType.includes(search); + const imgDescMatch = dbImage.includes(search); const idMatch = search === db.id; return ( handleMatch || + imgDescMatch || dbTypeMatch || envMatch || opMatch || @@ -560,7 +567,8 @@ export const selectDatabasesForTable = createSelector( selectOperationsAsList, selectDisks, selectServices, - (dbs, envs, ops, disks, services) => + selectDatabaseImages, + (dbs, envs, ops, disks, services, images) => dbs .map((dbb): DeployDatabaseRow => { const env = findEnvById(envs, { id: dbb.environmentId }); @@ -581,8 +589,10 @@ export const selectDatabasesForTable = createSelector( disk.size, ); const metrics = calcMetrics([service]); + const img = findDatabaseImageById(images, { id: dbb.databaseImageId }); return { ...dbb, + imageDesc: img.description, envHandle: env.handle, lastOperation, diskSize: disk.size,