From ff7c2d1c21a12eeb2aa8e8be8aa016a3aec9c32d Mon Sep 17 00:00:00 2001
From: Tom Robinson <tlrobinson@gmail.com>
Date: Wed, 3 May 2017 11:00:09 -0700
Subject: [PATCH] Add link with Google Drive scope to BQ db details

---
 frontend/src/metabase/components/DatabaseDetailsForm.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/frontend/src/metabase/components/DatabaseDetailsForm.jsx b/frontend/src/metabase/components/DatabaseDetailsForm.jsx
index 38e331696a3..c72bc0c2ec4 100644
--- a/frontend/src/metabase/components/DatabaseDetailsForm.jsx
+++ b/frontend/src/metabase/components/DatabaseDetailsForm.jsx
@@ -15,6 +15,7 @@ function isEmpty(str) {
 
 const AUTH_URL_PREFIXES = {
     bigquery: 'https://accounts.google.com/o/oauth2/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/bigquery&client_id=',
+    bigquery_with_drive: 'https://accounts.google.com/o/oauth2/auth?redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/bigquery%20https://www.googleapis.com/auth/drive&client_id=',
     googleanalytics: 'https://accounts.google.com/o/oauth2/auth?access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/analytics.readonly&client_id=',
 };
 
@@ -222,7 +223,10 @@ export default class DatabaseDetailsForm extends Component {
                 authURLLink = (
                     <div className="flex align-center Form-offset">
                         <div className="Grid-cell--top">
-                            <a href={authURL} target='_blank'>Click here to get an auth code 😋</a>
+                            <a href={authURL} target='_blank'>Click here</a> to get an auth code
+                            { engine === "bigquery" &&
+                                <span> (or <a href={AUTH_URL_PREFIXES["bigquery_with_drive"] + clientID} target='_blank'>with Google Drive permissions</a>)</span>
+                            }
                         </div>
                     </div>);
             }
-- 
GitLab