You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/24 16:02:40 UTC

[GitHub] hughhhh commented on a change in pull request #5707: Refactor table

hughhhh commented on a change in pull request #5707: Refactor table
URL: https://github.com/apache/incubator-superset/pull/5707#discussion_r212676923
 
 

 ##########
 File path: superset/assets/src/visualizations/table.js
 ##########
 @@ -1,58 +1,108 @@
 import d3 from 'd3';
+import PropTypes from 'prop-types';
+import $ from 'jquery';
 import dt from 'datatables.net-bs';
 import 'datatables.net-bs/css/dataTables.bootstrap.css';
 import dompurify from 'dompurify';
-
 import { fixDataTableBodyHeight, d3TimeFormatPreset } from '../modules/utils';
 import './table.css';
 
-const $ = require('jquery');
-
 dt(window, $);
 
-function tableVis(slice, payload) {
-  const container = $(slice.selector);
-  const fC = d3.format('0,000');
+const propTypes = {
+  data: PropTypes.shape({
+    records: PropTypes.arrayOf(PropTypes.object),
+    columns: PropTypes.arrayOf(PropTypes.string),
+  }),
+  height: PropTypes.number,
+  alignPn: PropTypes.bool,
+  colorPn: PropTypes.bool,
+  columnFormats: PropTypes.object,
+  filters: PropTypes.object,
+  includeSearch: PropTypes.bool,
+  metrics: PropTypes.arrayOf(PropTypes.string),
+  onAddFilter: PropTypes.func,
+  onRemoveFilter: PropTypes.func,
+  orderDesc: PropTypes.bool,
+  pageLength: PropTypes.oneOfType([
+    PropTypes.number,
+    PropTypes.string,
+  ]),
+  percentMetrics: PropTypes.array,
+  tableFilter: PropTypes.bool,
+  tableTimestampFormat: PropTypes.string,
+  timeseriesLimitMetric: PropTypes.oneOfType([
+    PropTypes.string,
+    PropTypes.object,
+  ]),
+  verboseMap: PropTypes.object,
+};
+
+const fC = d3.format('0,000');
+function NOOP() {}
+
+function TableVis(element, props) {
+  PropTypes.checkPropTypes(propTypes, props, 'prop', 'TableVis');
+
+  const {
+    data,
+    height,
+    alignPn,
+    colorPn,
+    columnFormats,
+    filters,
+    includeSearch,
+    metrics: rawMetrics,
+    onAddFilter = NOOP,
 
 Review comment:
   Why do we need a No Op on these prop functions?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org