|
@@ -2,16 +2,27 @@ import React from 'react';
|
|
import { ReactWidget } from '@jupyterlab/apputils';
|
|
import { ReactWidget } from '@jupyterlab/apputils';
|
|
import { Widget } from '@lumino/widgets';
|
|
import { Widget } from '@lumino/widgets';
|
|
import { DagDataView } from './dataview';
|
|
import { DagDataView } from './dataview';
|
|
-import { tableContent } from './api/datamanage';
|
|
|
|
|
|
+import { tableContent, tableInfo } from './api/datamanage';
|
|
import { message } from 'antd';
|
|
import { message } from 'antd';
|
|
|
|
|
|
class DataTableWidget extends ReactWidget {
|
|
class DataTableWidget extends ReactWidget {
|
|
constructor(table: any, options?: Widget.IOptions) {
|
|
constructor(table: any, options?: Widget.IOptions) {
|
|
super(options);
|
|
super(options);
|
|
void this._requestData(table, 1, 100);
|
|
void this._requestData(table, 1, 100);
|
|
|
|
+ void this._tableInfo(table);
|
|
this._table = table;
|
|
this._table = table;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private _tableInfo = async (table: any) => {
|
|
|
|
+ const { data } = await tableInfo(table.id);
|
|
|
|
+ if (data.code === 200) {
|
|
|
|
+ this._info = data.data;
|
|
|
|
+ } else {
|
|
|
|
+ void message.error(data.msg);
|
|
|
|
+ }
|
|
|
|
+ this.update();
|
|
|
|
+ };
|
|
|
|
+
|
|
private _requestData = async (table: any, page: number, size: number) => {
|
|
private _requestData = async (table: any, page: number, size: number) => {
|
|
const { data } = await tableContent({
|
|
const { data } = await tableContent({
|
|
table_name: table.table_name,
|
|
table_name: table.table_name,
|
|
@@ -31,7 +42,7 @@ class DataTableWidget extends ReactWidget {
|
|
return (
|
|
return (
|
|
<DagDataView
|
|
<DagDataView
|
|
data={this._data}
|
|
data={this._data}
|
|
- info={this._table}
|
|
|
|
|
|
+ info={this._info}
|
|
changePage={(page, size) => this._requestData(this._table, page, size)}
|
|
changePage={(page, size) => this._requestData(this._table, page, size)}
|
|
/>
|
|
/>
|
|
);
|
|
);
|
|
@@ -39,6 +50,7 @@ class DataTableWidget extends ReactWidget {
|
|
|
|
|
|
private _data: any | null = null;
|
|
private _data: any | null = null;
|
|
private _table: any;
|
|
private _table: any;
|
|
|
|
+ private _info: any | null = null;
|
|
}
|
|
}
|
|
|
|
|
|
export default DataTableWidget;
|
|
export default DataTableWidget;
|