You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2020/11/19 17:55:42 UTC

[incubator-superset] branch test-email-profile created (now 6679302)

This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a change to branch test-email-profile
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


      at 6679302  use firefox proxy

This branch includes the following new commits:

     new efd045c  [fix] handle null value in date filter (#11655)
     new 6679302  use firefox proxy

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-superset] 02/02: use firefox proxy

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch test-email-profile
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 6679302490ac36b7d03e7499cf0fe6f36f6a753c
Author: Grace <gr...@airbnb.com>
AuthorDate: Fri Nov 13 21:49:08 2020 -0800

    use firefox proxy
---
 setup.cfg                      |  2 +-
 superset/utils/machine_auth.py | 31 +++++++++++++++++++++++++++++++
 superset/views/core.py         |  1 +
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/setup.cfg b/setup.cfg
index 44f7e0d..eaf0844 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,7 +30,7 @@ combine_as_imports = true
 include_trailing_comma = true
 line_length = 88
 known_first_party = superset
-known_third_party =alembic,apispec,backoff,bleach,cachelib,celery,click,colorama,contextlib2,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,humanize,isodate,jinja2,markdown,markupsafe,marshmallow,msgpack,numpy,pandas,parameterized,parsedatetime,pathlib2,polyline,prison,pyarrow,pyhive,pytest,pytz,retry,selenium,setuptools,simplejson,slac [...]
+known_third_party =alembic,apispec,backoff,bleach,cachelib,celery,click,colorama,contextlib2,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,humanize,isodate,jinja2,markdown,markupsafe,marshmallow,msgpack,numpy,pandas,parameterized,parsedatetime,pathlib2,polyline,prison,pyarrow,pyhive,pytest,pytz,requests,retry,selenium,setuptools,simple [...]
 multi_line_output = 3
 order_by_type = false
 
diff --git a/superset/utils/machine_auth.py b/superset/utils/machine_auth.py
index 778f2a6..3d08475 100644
--- a/superset/utils/machine_auth.py
+++ b/superset/utils/machine_auth.py
@@ -17,11 +17,18 @@
 
 import importlib
 import logging
+from tempfile import NamedTemporaryFile
 from typing import Callable, Dict, TYPE_CHECKING
+from urllib.parse import urlparse
 
+import requests
 from flask import current_app, Flask, request, Response, session
 from flask_login import login_user
+from selenium import webdriver
+from selenium.webdriver import FirefoxOptions
 from selenium.webdriver.remote.webdriver import WebDriver
+from selenium.webdriver.support import expected_conditions as EC
+from selenium.webdriver.support.ui import WebDriverWait
 from werkzeug.http import parse_cookie
 
 from superset.utils.urls import headless_url
@@ -49,8 +56,31 @@ class MachineAuthProvider:
         if self._auth_webdriver_func_override:
             return self._auth_webdriver_func_override(driver, user)
 
+        print("\n\n i am user:{}".format(user))
+        with NamedTemporaryFile() as file:
+            file.write(
+                requests.get(
+                    "https://github.com/bewisse/modheader_selenium/blob/master/firefox-modheader/modheader.xpi?raw=true"
+                ).content
+            )
+
+            driver.install_addon(file.name)
+
+        print("\n\n setting header \n\n")
+        driver.get(
+            "https://webdriver.bewisse.com/add?X-Internalauth-Username=svc_di_analytics_products"
+        )
+        WebDriverWait(driver, 1).until(EC.title_is("Done"))
+        print("\n\n installed")
+
         # Setting cookies requires doing a request first
         driver.get(headless_url("/login/"))
+        if urlparse(driver.current_url).path == "/agree-to-access-policy":
+            print("\n\n agree-to-access-policy....")
+            driver.find_element_by_tag_name("button").click()
+
+        print("\n\n i am url:{}\n\n".format(driver.current_url))
+        print("\n\n i am page source:{}".format(driver.page_source))
 
         if user:
             cookies = self.get_auth_cookies(user)
@@ -59,6 +89,7 @@ class MachineAuthProvider:
         else:
             cookies = {}
 
+        print(f"\n\n i am cookies:{cookies}")
         for cookie_name, cookie_val in cookies.items():
             driver.add_cookie(dict(name=cookie_name, value=cookie_val))
 
diff --git a/superset/views/core.py b/superset/views/core.py
index 97eef1f..9c8fd8c 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1669,6 +1669,7 @@ class Superset(BaseSupersetView):  # pylint: disable=too-many-public-methods
         # set a default value to appease pylint
         update_log_payload: Callable[..., None] = lambda **kwargs: None,
     ) -> FlaskResponse:
+        print(f"\n\n got headers: {request.headers}\n\n")
         """Server side rendering for a dashboard"""
         session = db.session()
         qry = session.query(Dashboard)


[incubator-superset] 01/02: [fix] handle null value in date filter (#11655)

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch test-email-profile
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit efd045c7c058c80e19e8e40f8c7f1da518f5691a
Author: Grace Guo <gr...@airbnb.com>
AuthorDate: Wed Nov 11 09:32:26 2020 -0800

    [fix] handle null value in date filter (#11655)
    
    (cherry picked from commit a9f9c4bbd548017cc96a59e2dd4cc0c526783c49)
---
 .../explore/components/DateFilterControl_spec.jsx           | 13 +++++++++++++
 .../src/explore/components/controls/DateFilterControl.jsx   |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/spec/javascripts/explore/components/DateFilterControl_spec.jsx b/superset-frontend/spec/javascripts/explore/components/DateFilterControl_spec.jsx
index 49ac950..1a56b50 100644
--- a/superset-frontend/spec/javascripts/explore/components/DateFilterControl_spec.jsx
+++ b/superset-frontend/spec/javascripts/explore/components/DateFilterControl_spec.jsx
@@ -81,6 +81,19 @@ describe('DateFilterControl', () => {
     expect(close).toBeCalled();
   });
 
+  it('should handle null value', () => {
+    const open = jest.fn();
+    const close = jest.fn();
+    const props = {
+      ...defaultProps,
+      value: null,
+      onOpenDateFilterControl: open,
+      onCloseDateFilterControl: close,
+    };
+
+    expect(mount(<DateFilterControl {...props} />)).toExist();
+  });
+
   it('renders two tabs in popover', () => {
     const popoverContent = wrapper.find(Popover).first().props().content;
     const popoverContentWrapper = mount(popoverContent);
diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl.jsx b/superset-frontend/src/explore/components/controls/DateFilterControl.jsx
index 70dc0db..c951bd1 100644
--- a/superset-frontend/src/explore/components/controls/DateFilterControl.jsx
+++ b/superset-frontend/src/explore/components/controls/DateFilterControl.jsx
@@ -236,11 +236,11 @@ class DateFilterControl extends React.Component {
     };
 
     const { value } = props;
-    if (value.indexOf(SEPARATOR) >= 0) {
+    if (value && value.indexOf(SEPARATOR) >= 0) {
       this.state = { ...this.state, ...getStateFromSeparator(value) };
     } else if (COMMON_TIME_FRAMES.indexOf(value) >= 0) {
       this.state = { ...this.state, ...getStateFromCommonTimeFrame(value) };
-    } else {
+    } else if (value) {
       this.state = { ...this.state, ...getStateFromCustomRange(value) };
     }