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 2020/10/28 08:48:00 UTC

[GitHub] [incubator-superset] kgabryje commented on a change in pull request #11389: refactor: Replace react-bootstrap Modals with Antd in Explore

kgabryje commented on a change in pull request #11389:
URL: https://github.com/apache/incubator-superset/pull/11389#discussion_r513269144



##########
File path: superset-frontend/src/explore/components/controls/VizTypeControl.jsx
##########
@@ -157,86 +150,84 @@ export default class VizTypeControl extends React.PureComponent {
         </div>
       </div>
     );
+  };
+
+  const { value, labelBsStyle } = props;
+  const filterString = filter.toLowerCase();
+
+  const filteredTypes = DEFAULT_ORDER.filter(type => registry.has(type))
+    .map(type => ({
+      key: type,
+      value: registry.get(type),
+    }))
+    .concat(
+      registry.entries().filter(({ key }) => !typesWithDefaultOrder.has(key)),
+    )
+    .filter(entry => entry.value.name.toLowerCase().includes(filterString));
+
+  const rows = [];
+  for (let i = 0; i <= filteredTypes.length; i += IMAGE_PER_ROW) {
+    rows.push(
+      <Row data-test="viz-row" key={`row-${i}`}>
+        {filteredTypes.slice(i, i + IMAGE_PER_ROW).map(entry => (
+          <Col md={12 / IMAGE_PER_ROW} key={`grid-col-${entry.key}`}>
+            {renderItem(entry)}
+          </Col>
+        ))}
+      </Row>,
+    );
   }
 
-  render() {
-    const { filter, showModal } = this.state;
-    const { value, labelBsStyle } = this.props;
-
-    const filterString = filter.toLowerCase();
-    const filteredTypes = DEFAULT_ORDER.filter(type => registry.has(type))
-      .map(type => ({
-        key: type,
-        value: registry.get(type),
-      }))
-      .concat(
-        registry.entries().filter(({ key }) => !typesWithDefaultOrder.has(key)),
-      )
-      .filter(entry => entry.value.name.toLowerCase().includes(filterString));
-
-    const rows = [];
-    for (let i = 0; i <= filteredTypes.length; i += IMAGE_PER_ROW) {
-      rows.push(
-        <Row data-test="viz-row" key={`row-${i}`}>
-          {filteredTypes.slice(i, i + IMAGE_PER_ROW).map(entry => (
-            <Col md={12 / IMAGE_PER_ROW} key={`grid-col-${entry.key}`}>
-              {this.renderItem(entry)}
-            </Col>
-          ))}
-        </Row>,
-      );
-    }
-
-    return (
-      <div>
-        <ControlHeader {...this.props} />
-        <OverlayTrigger
-          placement="right"
-          overlay={
-            <Tooltip id="error-tooltip">
-              {t('Click to change visualization type')}
-            </Tooltip>
-          }
-        >
-          <>
-            <Label onClick={this.toggleModal} bsStyle={labelBsStyle}>
-              {registry.has(value) ? registry.get(value).name : `${value}`}
-            </Label>
-            {!registry.has(value) && (
-              <div className="text-danger">
-                <i className="fa fa-exclamation-circle text-danger" />{' '}
-                <small>{t('This visualization type is not supported.')}</small>
-              </div>
-            )}
-          </>
-        </OverlayTrigger>
-        <Modal
-          show={showModal}
-          onHide={this.toggleModal}
-          onEnter={this.focusSearch}
-          onExit={this.setSearchRef}
-          bsSize="large"
-        >
-          <Modal.Header closeButton>
-            <Modal.Title>{t('Select a visualization type')}</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            <div className="viztype-control-search-box">
-              <FormControl
-                inputRef={this.setSearchRef}
-                type="text"
-                value={filter}
-                placeholder={t('Search')}
-                onChange={this.changeSearch}
-              />
+  return (
+    <div>
+      <ControlHeader {...props} />
+      <OverlayTrigger
+        placement="right"
+        overlay={
+          <Tooltip id="error-tooltip">
+            {t('Click to change visualization type')}
+          </Tooltip>
+        }
+      >
+        <>

Review comment:
       Done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



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