ktmud commented on a change in pull request #9628:
URL: 
https://github.com/apache/incubator-superset/pull/9628#discussion_r421851735



##########
File path: 
superset-frontend/cypress-base/cypress/integration/explore/chart.test.js
##########
@@ -39,7 +38,6 @@ describe('No Results', () => {
           comparator: ['Fake State'],
           clause: 'WHERE',
           sqlExpression: null,
-          fromFormData: true,

Review comment:
       This is replaced with `AdhocFilter.isNew` and `AdhocMetric.isNew`. It 
was used to detect whether a adhoc metric/filter comes from stored metadata and 
to automatically open the edit popover when adding a new metric/filter.

##########
File path: 
superset-frontend/cypress-base/cypress/integration/explore/control.test.js
##########
@@ -211,17 +202,15 @@ describe('Advanced analytics', () => {
     cy.visitChartByName('Num Births Trend');
     cy.verifySliceSuccess({ waitAlias: '@postJson' });
 
-    cy.get('span')
-      .contains('Advanced Analytics')
-      .parent()
-      .siblings()
-      .first()
-      .click();
+    cy.get('.panel-title').contains('Advanced Analytics').click();
 
     cy.get('[data-test=time_compare]').within(() => {
-      cy.get('.Select-control').click({ force: true });
-      cy.get('input').type('364 days', { force: true });
-      cy.get('.VirtualizedSelectOption').trigger('mousedown').click();
+      cy.get('.Select__control').click();
+      cy.get('input[type=text]').type('28 days{enter}');

Review comment:
       Add one more option to account that this control allows for multiple 
values.

##########
File path: superset-frontend/package.json
##########
@@ -97,12 +97,15 @@
     "@superset-ui/translation": "^0.13.3",
     "@superset-ui/validator": "^0.13.3",
     "@types/classnames": "^2.2.9",
+    "@types/react-bootstrap": "^0.32.21",
     "@types/react-json-tree": "^0.6.11",
-    "@types/react-select": "^1.2.1",
+    "@types/react-select": "^3.0.12",
+    "@types/react-window": "^1.8.2",
     "@types/rison": "0.0.6",
     "@vx/responsive": "^0.0.195",
     "abortcontroller-polyfill": "^1.1.9",
     "aphrodite": "^2.3.1",
+    "array-move": "^2.2.1",

Review comment:
       Needed for `react-sortable-hoc`.

##########
File path: superset-frontend/spec/javascripts/components/OnPasteSelect_spec.jsx
##########
@@ -20,14 +20,16 @@
 import React from 'react';
 import sinon from 'sinon';
 import { shallow } from 'enzyme';
-import VirtualizedSelect from 'react-virtualized-select';
-import Select, { Creatable } from 'react-select';
-
-import OnPasteSelect from 'src/components/OnPasteSelect';
+import {
+  Select,
+  AsyncSelect,
+  OnPasteSelect,
+  CreatableSelect,
+} from 'src/components/Select';
 
 const defaultProps = {
   onChange: sinon.spy(),
-  multi: true,
+  isMulti: true,

Review comment:
       `OnPasteSelect` now uses `isMulti` to be consistent with `react-select`, 
but the `SelectControl` still uses `multi` to keep backward compatibility.

##########
File path: 
superset-frontend/spec/javascripts/explore/components/AdhocFilterEditPopoverSimpleTabContent_spec.jsx
##########
@@ -95,58 +95,50 @@ describe('AdhocFilterEditPopoverSimpleTabContent', () => {
       .instance()
       .onSubjectChange({ type: 'VARCHAR(255)', column_name: 'source' });
     expect(onChange.calledOnce).toBe(true);
-    expect(
-      onChange.lastCall.args[0].equals(
-        simpleAdhocFilter.duplicateWith({ subject: 'source' }),
-      ),
-    ).toBe(true);
+    expect(onChange.lastCall.args[0]).toEqual(
+      simpleAdhocFilter.duplicateWith({ subject: 'source' }),
+    );
   });
 
   it('may alter the clause in onSubjectChange if the old clause is not 
appropriate', () => {
     const { wrapper, onChange } = setup();
     wrapper.instance().onSubjectChange(sumValueAdhocMetric);
     expect(onChange.calledOnce).toBe(true);
-    expect(
-      onChange.lastCall.args[0].equals(
-        simpleAdhocFilter.duplicateWith({
-          subject: sumValueAdhocMetric.label,
-          clause: CLAUSES.HAVING,
-        }),
-      ),
-    ).toBe(true);
+    expect(onChange.lastCall.args[0]).toEqual(
+      simpleAdhocFilter.duplicateWith({
+        subject: sumValueAdhocMetric.label,
+        clause: CLAUSES.HAVING,
+      }),
+    );
   });
 
   it('will convert from individual comparator to array if the operator changes 
to multi', () => {
     const { wrapper, onChange } = setup();
-    wrapper.instance().onOperatorChange({ operator: 'in' });
+    wrapper.instance().onOperatorChange('in');

Review comment:
       Operator and aggregate options used in Select are now primitive strings 
instead of objects. Translations are handled by custom label renderer.

##########
File path: 
superset-frontend/spec/javascripts/explore/components/MetricsControl_spec.jsx
##########
@@ -297,7 +315,7 @@ describe('MetricsControl', () => {
         !!wrapper
           .instance()
           .selectFilterOption(
-            { aggregate_name: 'AVG', optionName: '_aggregate_AVG' },
+            { data: { aggregate_name: 'AVG', optionName: '_aggregate_AVG' } },

Review comment:
       This is because the signature of `react-select`'s `filterOption` changed.

##########
File path: superset-frontend/src/components/ListView/LegacyFilters.tsx
##########
@@ -112,32 +110,34 @@ export const FilterInputs = ({
                 bsSize="small"
                 value={ft.operator}
                 placeholder={filter ? getDefaultFilterOperator(filter) : ''}
+                // @ts-ignore
                 onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
                   updateInternalFilter(i, {
                     operator: e.currentTarget.value,
                   });
                 }}
               >
-                {(filter.operators || []).map(({ label, value }: Select) => (
-                  <option key={label} value={value}>
-                    {label}
-                  </option>
-                ))}
+                {(filter.operators || []).map(
+                  ({ label, value }: SelectOption) => (
+                    <option key={label} value={value}>
+                      {label}
+                    </option>
+                  ),
+                )}
               </FormControl>
             </Col>
             <Col md={1} />
             <Col md={4}>
               {filter.input === 'select' && (
-                <VirtualizedSelect
+                <Select

Review comment:
       `src/components/Select` now transparently apply virtualization (via 
`react-window`) when the options list is too large.

##########
File path: superset-frontend/src/components/styles.ts
##########
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Variables ported from "src/stylesheets/less/variables.less"
+// TODO: move to `@superset-ui/style`
+// Keep it here to make PRs easier for review.

Review comment:
       **Highlight this**

##########
File path: superset-frontend/src/dashboard/components/PropertiesModal.jsx
##########
@@ -238,14 +237,16 @@ class PropertiesModal extends React.PureComponent {
                 <label className="control-label" htmlFor="owners">
                   {t('Owners')}
                 </label>
-                <SelectAsync
+                <AsyncSelect
                   name="owners"
-                  multi
+                  isMulti
                   value={values.owners}
                   loadOptions={this.loadOwnerOptions}
+                  defaultOptions // load options on render
+                  cacheOptions
                   onChange={this.onOwnersChange}
                   disabled={!isDashboardLoaded}
-                  filterOption={() => true} // options are filtered at the api
+                  filterOption={null} // options are filtered at the api

Review comment:
       TODO: add test cases for this component (dashboard edit properties 
modal).




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to