@@ -19,7 +19,7 @@ import {
19
19
generateTableDef ,
20
20
dataSource ,
21
21
findTableFromRel ,
22
- currentDriver ,
22
+ isFeatureSupported ,
23
23
} from '../../../../dataSources' ;
24
24
25
25
/* ****************** View actions *************/
@@ -59,10 +59,22 @@ const vMakeRowsRequest = () => {
59
59
const headers = dataHeaders ( getState ) ;
60
60
dispatch ( { type : V_REQUEST_PROGRESS , data : true } ) ;
61
61
62
- return dispatch ( dataSource . getTableRowRequest ( tables , headers ) ) . then (
62
+ const {
63
+ endpoint,
64
+ getTableRowRequestBody,
65
+ processTableRowData,
66
+ } = dataSource . generateTableRowRequest ( ) ;
67
+ const options = {
68
+ method : 'POST' ,
69
+ body : JSON . stringify ( getTableRowRequestBody ( tables ) ) ,
70
+ headers,
71
+ credentials : globalCookiePolicy ,
72
+ } ;
73
+
74
+ return dispatch ( requestAction ( endpoint , options ) ) . then (
63
75
data => {
64
76
const { currentSchema, currentTable : originalTable } = tables ;
65
- const { rows, estimatedCount } = dataSource . processTableRowData ( data , {
77
+ const { rows, estimatedCount } = processTableRowData ( data , {
66
78
currentSchema,
67
79
originalTable,
68
80
} ) ;
@@ -94,11 +106,22 @@ const vMakeExportRequest = () => {
94
106
return ( dispatch , getState ) => {
95
107
const { tables } = getState ( ) ;
96
108
const headers = dataHeaders ( getState ) ;
109
+ const {
110
+ endpoint,
111
+ getTableRowRequestBody,
112
+ processTableRowData,
113
+ } = dataSource . generateTableRowRequest ( ) ;
114
+ const options = {
115
+ method : 'POST' ,
116
+ body : JSON . stringify ( getTableRowRequestBody ( tables ) ) ,
117
+ headers,
118
+ credentials : globalCookiePolicy ,
119
+ } ;
97
120
return new Promise ( ( resolve , reject ) => {
98
- dispatch ( dataSource . getTableRowRequest ( tables , headers ) )
121
+ dispatch ( requestAction ( endpoint , options ) )
99
122
. then ( data => {
100
123
const { currentSchema, currentTable : originalTable } = tables ;
101
- const { rows } = dataSource . processTableRowData ( data , {
124
+ const { rows } = processTableRowData ( data , {
102
125
currentSchema,
103
126
originalTable,
104
127
} ) ;
@@ -108,11 +131,11 @@ const vMakeExportRequest = () => {
108
131
} ) ;
109
132
} ;
110
133
} ;
134
+
111
135
const vMakeCountRequest = ( ) => {
112
- // TODO: fix when aggregate is available
113
- if ( currentDriver === 'mssql' )
136
+ // For datasources that do not supported aggregation like count
137
+ if ( ! isFeatureSupported ( 'tables.browse.aggregation' ) )
114
138
return ( dispatch , getState ) => {
115
- // This is just for the moment, until aggregators for mssql is ready
116
139
const { estimatedCount } = getState ( ) . tables . view ;
117
140
dispatch ( {
118
141
type : V_COUNT_REQUEST_SUCCESS ,
0 commit comments