mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-1134 hide value panel for empty result (#1574)
This commit is contained in:
@@ -13,13 +13,17 @@ import type { IDatabaseDataResult } from './IDatabaseDataResult';
|
||||
import type { IDatabaseDataSource } from './IDatabaseDataSource';
|
||||
|
||||
export abstract class DatabaseDataAction<TOptions, TResult extends IDatabaseDataResult>
|
||||
implements IDatabaseDataAction<TOptions, TResult> {
|
||||
implements IDatabaseDataAction<TOptions, TResult> {
|
||||
result: TResult;
|
||||
|
||||
get resultIndex(): number {
|
||||
return this.source.results.indexOf(this.result);
|
||||
}
|
||||
|
||||
get empty(): boolean {
|
||||
return !this.result.data;
|
||||
}
|
||||
|
||||
readonly source: IDatabaseDataSource<TOptions, TResult>;
|
||||
|
||||
constructor(source: IDatabaseDataSource<TOptions, TResult>, result: TResult) {
|
||||
|
||||
@@ -51,6 +51,7 @@ export type IDatabaseDataActionClass<
|
||||
|
||||
export interface IDatabaseDataAction<TOptions, TResult extends IDatabaseDataResult> {
|
||||
readonly source: IDatabaseDataSource<TOptions, TResult>;
|
||||
readonly empty: boolean;
|
||||
result: TResult;
|
||||
resultIndex: number;
|
||||
updateResult: (result: TResult) => void;
|
||||
|
||||
+10
-1
@@ -10,6 +10,7 @@ import React from 'react';
|
||||
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
|
||||
import { ResultSetDataAction } from '../../DatabaseDataModel/Actions/ResultSet/ResultSetDataAction';
|
||||
import { DataPresentationService, DataPresentationType } from '../../DataPresentationService';
|
||||
import { DataValuePanelService } from './DataValuePanelService';
|
||||
|
||||
@@ -37,7 +38,15 @@ export class DataValuePanelBootstrap extends Bootstrap {
|
||||
dataFormat,
|
||||
model,
|
||||
resultIndex
|
||||
) => this.dataValuePanelService.getDisplayed({ model, resultIndex, dataFormat }).length === 0,
|
||||
) => {
|
||||
if (!model.source.hasResult(resultIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const data = model.source.getAction(resultIndex, ResultSetDataAction);
|
||||
return data.empty
|
||||
|| this.dataValuePanelService.getDisplayed({ model, resultIndex, dataFormat }).length === 0;
|
||||
},
|
||||
getPresentationComponent: () => ValuePanel,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user