@@ -517,6 +519,7 @@ export class AppRoot extends mixinBehaviors
type: Boolean,
computed: '_computeIsDigitalOceanAccountConnected(digitalOceanAccountName)',
},
+ gcpAccountName: String,
outlineVersion: String,
userAcceptedTos: {
type: Boolean,
@@ -546,6 +549,7 @@ export class AppRoot extends mixinBehaviors
/** @type {ServerListEntry[]} */
this.serverList = [];
this.digitalOceanAccountName = '';
+ this.gcpAccountName = '';
this.outlineVersion = '';
this.currentPage = 'intro';
this.shouldShowSideBar = false;
@@ -626,6 +630,13 @@ export class AppRoot extends mixinBehaviors
return oauthFlow;
}
+ getAndShowGcpOauthFlow(onCancel) {
+ this.currentPage = 'gcpOauth';
+ const oauthFlow = this.$.gcpOauth;
+ oauthFlow.onCancel = onCancel;
+ return oauthFlow;
+ }
+
getAndShowRegionPicker() {
this.currentPage = 'regionPicker';
this.$.regionPicker.reset();
diff --git a/src/server_manager/web_app/ui_components/outline-gcp-oauth-step.ts b/src/server_manager/web_app/ui_components/outline-gcp-oauth-step.ts
new file mode 100644
index 000000000..9395c6837
--- /dev/null
+++ b/src/server_manager/web_app/ui_components/outline-gcp-oauth-step.ts
@@ -0,0 +1,106 @@
+// Copyright 2021 The Outline Authors
+//
+// Licensed 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.
+
+import '@polymer/polymer/polymer-legacy.js';
+import '@polymer/iron-pages/iron-pages.js';
+import '../ui_components/outline-step-view.js';
+
+import {css, customElement, html, LitElement, property} from 'lit-element';
+import {COMMON_STYLES} from '../ui_components/cloud-install-styles';
+
+@customElement('outline-gcp-oauth-step')
+export class GcpConnectAccountApp extends LitElement {
+ @property({type: Function}) onCancel: Function;
+ @property({type: Function}) localize: Function;
+
+ static get styles() {
+ return [
+ COMMON_STYLES, css`
+ :host {
+ }
+ .container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ height: 100%;
+ align-items: center;
+ padding: 132px 0;
+ font-size: 14px;
+ }
+ #connectAccount img {
+ width: 48px;
+ height: 48px;
+ margin-bottom: 12px;
+ }
+ .card {
+ display: flex;
+ flex-direction: column;
+ align-items: stretch;
+ justify-content: space-between;
+ margin: 24px 0;
+ padding: 24px;
+ background: var(--background-contrast-color);
+ box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.14), 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.2);
+ border-radius: 2px;
+ }
+ @media (min-width: 1025px) {
+ paper-card {
+ /* Set min with for the paper-card to grow responsively. */
+ min-width: 600px;
+ }
+ }
+ .card p {
+ color: var(--light-gray);
+ width: 100%;
+ text-align: center;
+ }
+ .card paper-button {
+ color: var(--light-gray);
+ width: 100%;
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ border-radius: 2px;
+ }
+ .card paper-button[disabled] {
+ color: var(--medium-gray);
+ background: transparent;
+ }
+ /* Mirror images */
+ :host(:dir(rtl)) .mirror {
+ transform: scaleX(-1);
+ }`
+ ];
+ // TODO: RTL
+ }
+
+ render() {
+ return html`
+
+ ${this.localize('gcp-oauth-connect-title')}
+ ${this.localize('oauth-connect-description')}
+
+
+
+
${this.localize('oauth-connect-tag')}
+
+ ${this.localize('cancel')}
+
+ `;
+ }
+
+ private onCancelTapped() {
+ if (this.onCancel) {
+ this.onCancel();
+ }
+ }
+}
diff --git a/src/server_manager/web_app/ui_components/outline-intro-step.js b/src/server_manager/web_app/ui_components/outline-intro-step.js
index ca03f1503..df32eaa94 100644
--- a/src/server_manager/web_app/ui_components/outline-intro-step.js
+++ b/src/server_manager/web_app/ui_components/outline-intro-step.js
@@ -270,11 +270,18 @@ Polymer({
is: 'outline-intro-step',
properties: {
- digitalOceanAccountName: String,
+ digitalOceanAccountName: {
+ type: String,
+ value: null,
+ },
isDigitalOceanAccountConnected: {
type: Boolean,
computed: '_computeIsDigitalOceanAccountConnected(digitalOceanAccountName)',
},
+ gcpAccountName: {
+ type: String,
+ value: null,
+ },
localize: {
type: Function,
readonly: true,
@@ -302,6 +309,14 @@ Polymer({
},
setUpGcpTapped: function() {
- this.fire('SetUpGcpRequested');
+ if (outline.gcpAuthEnabled) {
+ if (this.gcpAccountName) {
+ this.fire('CreateGcpServerRequested');
+ } else {
+ this.fire('ConnectGcpAccountRequested');
+ }
+ } else {
+ this.fire('SetUpGcpRequested');
+ }
}
});
diff --git a/yarn.lock b/yarn.lock
index 17a74ee72..b0cff6a42 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1284,6 +1284,13 @@ agent-base@5:
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
+agent-base@6:
+ version "6.0.2"
+ resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77"
+ integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==
+ dependencies:
+ debug "4"
+
agent-base@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
@@ -1791,6 +1798,11 @@ bignumber.js@^7.0.0:
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f"
integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==
+bignumber.js@^9.0.0:
+ version "9.0.1"
+ resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5"
+ integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==
+
bin-build@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/bin-build/-/bin-build-3.0.0.tgz#c5780a25a8a9f966d8244217e6c1f5082a143861"
@@ -3510,7 +3522,7 @@ ecc-jsbn@~0.1.1:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
-ecdsa-sig-formatter@1.0.11:
+ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf"
integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==
@@ -4554,6 +4566,17 @@ gaxios@^1.0.2, gaxios@^1.0.4, gaxios@^1.2.1, gaxios@^1.5.0:
https-proxy-agent "^2.2.1"
node-fetch "^2.3.0"
+gaxios@^4.0.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-4.1.0.tgz#e8ad466db5a4383c70b9d63bfd14dfaa87eb0099"
+ integrity sha512-vb0to8xzGnA2qcgywAjtshOKKVDf2eQhJoiL6fHhgW5tVN7wNk7egnYIO9zotfn3lQ3De1VPdf7V5/BWfCtCmg==
+ dependencies:
+ abort-controller "^3.0.0"
+ extend "^3.0.2"
+ https-proxy-agent "^5.0.0"
+ is-stream "^2.0.0"
+ node-fetch "^2.3.0"
+
gcp-metadata@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-1.0.0.tgz#5212440229fa099fc2f7c2a5cdcb95575e9b2ca6"
@@ -4562,6 +4585,14 @@ gcp-metadata@^1.0.0:
gaxios "^1.0.2"
json-bigint "^0.3.0"
+gcp-metadata@^4.2.0:
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-4.2.1.tgz#31849fbcf9025ef34c2297c32a89a1e7e9f2cd62"
+ integrity sha512-tSk+REe5iq/N+K+SK1XjZJUrFPuDqGZVzCy2vocIHIGmPlTGsa8owXMJwGkrXr73NO0AzhPW4MF2DEHz7P2AVw==
+ dependencies:
+ gaxios "^4.0.0"
+ json-bigint "^1.0.0"
+
gcs-resumable-upload@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/gcs-resumable-upload/-/gcs-resumable-upload-1.1.0.tgz#2b06f5876dcf60f18a309343f79ed951aff01399"
@@ -4844,6 +4875,21 @@ google-auth-library@^3.0.0, google-auth-library@^3.1.1:
lru-cache "^5.0.0"
semver "^5.5.0"
+google-auth-library@^7.0.2:
+ version "7.0.2"
+ resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-7.0.2.tgz#cab6fc7f94ebecc97be6133d6519d9946ccf3e9d"
+ integrity sha512-vjyNZR3pDLC0u7GHLfj+Hw9tGprrJwoMwkYGqURCXYITjCrP9HprOyxVV+KekdLgATtWGuDkQG2MTh0qpUPUgg==
+ dependencies:
+ arrify "^2.0.0"
+ base64-js "^1.3.0"
+ ecdsa-sig-formatter "^1.0.11"
+ fast-text-encoding "^1.0.0"
+ gaxios "^4.0.0"
+ gcp-metadata "^4.2.0"
+ gtoken "^5.0.4"
+ jws "^4.0.0"
+ lru-cache "^6.0.0"
+
google-p12-pem@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-1.0.4.tgz#b77fb833a2eb9f7f3c689e2e54f095276f777605"
@@ -4852,6 +4898,13 @@ google-p12-pem@^1.0.0:
node-forge "^0.8.0"
pify "^4.0.0"
+google-p12-pem@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-3.0.3.tgz#673ac3a75d3903a87f05878f3c75e06fc151669e"
+ integrity sha512-wS0ek4ZtFx/ACKYF3JhyGe5kzH7pgiQ7J5otlumqR9psmWMYc+U9cErKlCYVYHoUaidXHdZ2xbo34kB+S+24hA==
+ dependencies:
+ node-forge "^0.10.0"
+
got@^7.0.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/got/-/got-7.1.0.tgz#05450fd84094e6bbea56f451a43a9c289166385a"
@@ -4928,6 +4981,15 @@ gtoken@^2.3.2:
mime "^2.2.0"
pify "^4.0.0"
+gtoken@^5.0.4:
+ version "5.2.1"
+ resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-5.2.1.tgz#4dae1fea17270f457954b4a45234bba5fc796d16"
+ integrity sha512-OY0BfPKe3QnMsY9MzTHTSKn+Vl2l1CcLe6BwDEQj00mbbkl5nyQ/7EUREstg4fQNZ8iYE7br4JJ7TdKeDOPWmw==
+ dependencies:
+ gaxios "^4.0.0"
+ google-p12-pem "^3.0.3"
+ jws "^4.0.0"
+
gulp-cli@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/gulp-cli/-/gulp-cli-2.2.1.tgz#376e427661b7996430a89d71c15df75defa3360a"
@@ -5325,6 +5387,14 @@ https-proxy-agent@^4.0.0:
agent-base "5"
debug "4"
+https-proxy-agent@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2"
+ integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==
+ dependencies:
+ agent-base "6"
+ debug "4"
+
husky@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/husky/-/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0"
@@ -6093,6 +6163,13 @@ json-bigint@^0.3.0:
dependencies:
bignumber.js "^7.0.0"
+json-bigint@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1"
+ integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==
+ dependencies:
+ bignumber.js "^9.0.0"
+
json-buffer@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
@@ -6194,6 +6271,15 @@ jwa@^1.4.1:
ecdsa-sig-formatter "1.0.11"
safe-buffer "^5.0.1"
+jwa@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc"
+ integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==
+ dependencies:
+ buffer-equal-constant-time "1.0.1"
+ ecdsa-sig-formatter "1.0.11"
+ safe-buffer "^5.0.1"
+
jws@^3.1.5:
version "3.2.2"
resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304"
@@ -6202,6 +6288,14 @@ jws@^3.1.5:
jwa "^1.4.1"
safe-buffer "^5.0.1"
+jws@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4"
+ integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==
+ dependencies:
+ jwa "^2.0.0"
+ safe-buffer "^5.0.1"
+
karma-chrome-launcher@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz#805a586799a4d05f4e54f72a204979f3f3066738"
@@ -6539,6 +6633,13 @@ lru-cache@^5.0.0, lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"
+lru-cache@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
+ integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
+ dependencies:
+ yallist "^4.0.0"
+
lru_map@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
@@ -10588,6 +10689,11 @@ yallist@^3.0.2:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
+yallist@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
+ integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
+
yargs-parser@5.0.0-security.0:
version "5.0.0-security.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0-security.0.tgz#4ff7271d25f90ac15643b86076a2ab499ec9ee24"