fix(plugin-data-viewer): CB-679 empty lines

This commit is contained in:
Wroud
2021-01-20 20:58:55 +03:00
parent d870e0987d
commit 2b6bc68caf
7 changed files with 11 additions and 9 deletions
@@ -68,6 +68,7 @@ export class ContainerDataSource extends DatabaseDataSource<IDataContainerOption
}
const executionContext = await this.ensureContextCreated();
const offset = this.offset;
const limit = this.count;
const fetchTableProcess = new FetchTableDataAsyncProcess(this.graphQLService, this.notificationService);
@@ -79,7 +80,7 @@ export class ContainerDataSource extends DatabaseDataSource<IDataContainerOption
containerNodePath: this.options.containerNodePath,
},
{
offset: this.offset,
offset,
limit,
constraints: this.options.constraints,
where: this.options.whereFilter || undefined,
@@ -102,8 +103,6 @@ export class ContainerDataSource extends DatabaseDataSource<IDataContainerOption
id: result.resultSet?.id || '0',
dataFormat: result.dataFormat!,
loadedFully: (result.resultSet?.rows?.length || 0) < limit,
// allays returns false
// || !result.resultSet?.hasMoreData,
data: result.resultSet,
}));
}
@@ -57,6 +57,8 @@ export class DataViewerTableService {
})
.setSupportedDataFormats(connectionInfo.supportedDataFormats)
)
.setCountGain()
.setSlice(0)
.setAccess(connectionInfo.readOnly ? DatabaseDataAccessMode.Readonly : DatabaseDataAccessMode.Default);
return dataModel;
@@ -85,7 +85,7 @@ implements IDatabaseDataModel<TOptions, TResult> {
return this;
}
setSlice(offset: number, count: number): this {
setSlice(offset: number, count = this.countGain): this {
this.source.setSlice(offset, count);
return this;
}
@@ -32,7 +32,7 @@ export interface IDatabaseDataModel<TOptions, TResult extends IDatabaseDataResul
setCountGain: (count: number) => this;
setAccess: (access: DatabaseDataAccessMode) => this;
setSlice: (offset: number, count: number) => this;
setSlice: (offset: number, count?: number) => this;
setOptions: (options: TOptions) => this;
setDataFormat: (dataFormat: ResultDataFormat) => this;
setSupportedDataFormats: (dataFormats: ResultDataFormat[]) => this;
@@ -90,7 +90,7 @@ export class DataModelWrapper extends DatabaseDataModel<IDataContainerOptions, I
await this.requestData();
}
setCountGain(count: number): this {
setCountGain(count?: number): this {
const realCount = this.getDefaultRowsCount(count);
this.countGain = realCount;
@@ -171,9 +171,8 @@ export class TableViewerModel {
}
insertRows(position: number, rows: TableRow[], hasMore: boolean): void {
const isRowsAddition = this.tableDataModel.getRows().length < position + rows.length;
this.tableDataModel.insertRows(position, rows);
this._hasMoreRows = isRowsAddition ? hasMore : this._hasMoreRows;
this._hasMoreRows = hasMore;
}
setColumns(columns: TableColumn[]): void {
@@ -76,7 +76,9 @@ export class SqlResultTabsService {
if (inNewTab || !currentTab?.groupId) {
source = new QueryDataSource(this.graphQLService, this.notificationService, this);
model = this.tableViewerStorageService.create(source);
model = this.tableViewerStorageService.create(source)
.setCountGain()
.setSlice(0);
tabGroup = this.createGroup(sqlQueryParams, editorState, model.id);