File tree Expand file tree Collapse file tree
src/db-provider/filter-query
nextjs-app/src/features/app/blocks/db-connection/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -216,7 +216,20 @@ export abstract class AbstractCellValueFilter implements ICellValueFilterInterfa
216216 _operator : IFilterOperator ,
217217 _value : IFilterValue
218218 ) : Knex . QueryBuilder {
219- builderClient . whereNull ( this . tableColumnRef ) ;
219+ const tableColumnRef = this . tableColumnRef ;
220+ const { cellValueType, isStructuredCellValue, isMultipleCellValue } = this . field ;
221+
222+ builderClient . where ( function ( ) {
223+ this . whereNull ( tableColumnRef ) ;
224+
225+ if (
226+ cellValueType === CellValueType . String &&
227+ ! isStructuredCellValue &&
228+ ! isMultipleCellValue
229+ ) {
230+ this . orWhere ( tableColumnRef , '=' , '' ) ;
231+ }
232+ } ) ;
220233 return builderClient ;
221234 }
222235
@@ -225,7 +238,13 @@ export abstract class AbstractCellValueFilter implements ICellValueFilterInterfa
225238 _operator : IFilterOperator ,
226239 _value : IFilterValue
227240 ) : Knex . QueryBuilder {
241+ const { cellValueType, isStructuredCellValue, isMultipleCellValue } = this . field ;
242+
228243 builderClient . whereNotNull ( this . tableColumnRef ) ;
244+
245+ if ( cellValueType === CellValueType . String && ! isStructuredCellValue && ! isMultipleCellValue ) {
246+ builderClient . where ( this . tableColumnRef , '!=' , '' ) ;
247+ }
229248 return builderClient ;
230249 }
231250
Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ export const x_20 = {
135135 // actual number of items: 23
136136 records : [
137137 {
138- fields : { } ,
138+ fields : {
139+ [ textField . name ] : '' ,
140+ } ,
139141 } ,
140142 {
141143 fields : {
Original file line number Diff line number Diff line change 11import { useQuery } from '@tanstack/react-query' ;
2- import { getDbConnection } from '@teable/openapi' ;
3- import { useBaseId } from '@teable/sdk/hooks' ;
2+ import { BillingProductLevel , getDbConnection } from '@teable/openapi' ;
3+ import { useBaseId , useBasePermission } from '@teable/sdk/hooks' ;
4+ import { useBaseUsage } from '@/features/app/hooks/useBaseUsage' ;
5+ import { useIsCloud } from '@/features/app/hooks/useIsCloud' ;
46
57export const useDbConnection = ( ) => {
68 const baseId = useBaseId ( ) as string ;
9+ const permissions = useBasePermission ( ) ;
10+ const hasPermission = permissions ?. [ 'base|db_connection' ] ;
11+ const isCloud = useIsCloud ( ) ;
12+ const usage = useBaseUsage ( ) ;
13+ const isUnavailable = isCloud && usage ?. level !== BillingProductLevel . Enterprise ;
714
815 const { data, isLoading } = useQuery ( {
916 queryKey : [ 'connection' , baseId ] ,
1017 queryFn : ( { queryKey } ) => getDbConnection ( queryKey [ 1 ] ) . then ( ( data ) => data . data ) ,
18+ enabled : hasPermission && ! isUnavailable ,
1119 } ) ;
1220
1321 const dataArray = data ?. dsn
You can’t perform that action at this time.
0 commit comments