Skip to content

Commit

Permalink
Node addons analytics (#2256)
Browse files Browse the repository at this point in the history
  • Loading branch information
futa-ikeda authored Jun 27, 2024
1 parent de8b8a5 commit cc25e51
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 135 deletions.
24 changes: 18 additions & 6 deletions app/guid-node/addons/index/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
<AddonsService::TermsOfService
@provider={{provider.provider}}
/>
<div local-class='float-right'>
<div
data-analytics-scope='Addon terms'
local-class='float-right'
>
<Button
data-test-addon-cancel-button
data-analytics-name='Cancel'
Expand Down Expand Up @@ -87,7 +90,10 @@
{{t 'addons.accountSelect.no-accounts'}}
{{/each}}
</fieldset>
<div local-class='float-right'>
<div
data-analytics-scope='Account select'
local-class='float-right'
>
<Button
data-test-addon-cancel-button
data-analytics-name='Cancel'
Expand Down Expand Up @@ -127,7 +133,10 @@
{{else if (eq manager.pageMode 'confirm')}}
{{t 'addons.confirm.verify'}}
{{manager.selectedAccount.displayName}}
<div local-class='float-right'>
<div
data-analytics-scope='Confirm account setup'
local-class='float-right'
>
<Button
data-test-addon-cancel-button
data-analytics-name='Cancel'
Expand All @@ -146,7 +155,10 @@
</Button>
</div>
{{else if (eq manager.pageMode 'configurationList')}}
<div local-class='configured-addons'>
<div
data-analytics-scope='Configured Addons List'
local-class='configured-addons'
>
<div local-class='configured-addons-heading'>
<h4>{{t 'addons.list.connected-locations'}}</h4>
</div>
Expand Down Expand Up @@ -265,8 +277,8 @@
local-class='tab-list'
as |tablist|
>
<tablist.tab>{{t 'addons.list.all-addons'}}</tablist.tab>
<tablist.tab>{{t 'addons.list.connected-accounts'}}</tablist.tab>
<tablist.tab data-analytics-name='Select All Addons tab'>{{t 'addons.list.all-addons'}}</tablist.tab>
<tablist.tab data-analytics-name='Select Connected Accounts tab'>{{t 'addons.list.connected-accounts'}}</tablist.tab>
</tab.tabList>
<tab.tabPanel
data-test-all-addons-tab
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,125 @@
{{#if this.verifyingCredentials.isRunning}}
<LoadingIndicator @dark={{true}} />
{{else}}
{{#if this.useOauth}}
{{#if this.pendingOauth}}
<p>
{{t 'addons.accountCreate.oauth-pending'}}
</p>
<div data-analytics-scope='Addon Account Setup'>
{{#if this.verifyingCredentials.isRunning}}
<LoadingIndicator @dark={{true}} />
{{else}}
{{#if this.useOauth}}
{{#if this.pendingOauth}}
<p>
{{t 'addons.accountCreate.oauth-pending'}}
</p>
{{else}}
<div local-class='oauth-wrapper'>
{{t 'addons.accountCreate.oauth-description' providerName=@provider.name}}
{{#unless @reconnect}}
{{#let (unique-id 'display-name-label') as |displayNameId|}}
<label for={{displayNameId}} local-class='auth-text-input-label'>
{{t 'addons.accountCreate.display-name-label'}}
</label>
<div local-class='post-text'>
{{t 'addons.accountCreate.display-name-help'}}
</div>
<Input
data-test-oauth-display-name-input
local-class='input'
id={{displayNameId}}
placeholder={{t 'addons.accountCreate.display-name-placeholder'}}
@value={{@manager.displayName}}
/>
{{/let}}
{{/unless}}
<div local-class='button-wrapper'>
<Button
data-test-addon-cancel-button
data-analytics-name='Cancel'
{{on 'click' @manager.cancelSetup}}
>
{{t 'general.cancel'}}
</Button>
<Button
data-test-addon-oauth-button
data-analytics-name={{if @reconnect 'Reconnect account' 'Begin OAuth'}}
@type='primary'
{{on 'click' (if @reconnect (perform this.startOauthReconnectFlow) (perform this.startOauthFlow))}}
>
{{if @reconnect (t 'addons.accountCreate.reconnect') (t 'general.authorize')}}
</Button>
</div>
</div>
{{/if}}
{{else}}
<div local-class='oauth-wrapper'>
{{t 'addons.accountCreate.oauth-description' providerName=@provider.name}}
<form>
{{#if this.showRepoOptions}}
<label>
{{t 'addons.accountCreate.repo-label'}}
<PowerSelect
local-class='repo-select'
@options={{this.repoOptions}}
@selected={{this.selectedRepo}}
@onChange={{this.onRepoChange}}
@placeholder={{t 'addons.accountCreate.repo-placeholder'}}
as |selected|
>
{{selected}}
</PowerSelect>
</label>
{{#if this.otherRepoSelected}}
<Input
data-test-other-repo-input
local-class='auth-text-input-label'
placeholder={{t 'addons.accountCreate.repo-other-placeholder'}}
@value={{this.otherRepo}}
{{on 'keyup' this.onOtherRepoChange}}
/>
{{#if this.repoOtherPostText}}
<p>
{{this.repoOtherPostText}}
</p>
{{/if}}
{{/if}}
{{/if}}
{{#each this.inputFields as |field|}}
{{#let (unique-id (field.name)) as |id|}}
<label for={{id}} local-class='auth-text-input-label'>
{{field.labelText}}
</label>
<div local-class='post-text'>
{{field.postText}}
</div>
<Input
data-test-input={{field.name}}
id={{id}}
local-class='input'
name={{field.name}}
placeholder={{field.inputPlaceholder}}
autocomplete={{field.autocomplete}}
@type={{field.inputType}}
@value={{field.inputValue}}
{{on 'keyup' @onInput}}
/>
{{/let}}
{{/each}}
{{#unless @reconnect}}
{{#let (unique-id 'display-name-label') as |displayNameId|}}
<label for={{displayNameId}} local-class='auth-text-input-label'>
{{#let (unique-id 'displayNameField') as |id|}}
<label for={{id}} local-class='auth-text-input-label'>
{{t 'addons.accountCreate.display-name-label'}}
</label>
<div local-class='post-text'>
{{t 'addons.accountCreate.display-name-help'}}
</div>
<Input
data-test-oauth-display-name-input
data-test-display-name-input
id={{id}}
local-class='input'
id={{displayNameId}}
placeholder={{t 'addons.accountCreate.display-name-placeholder'}}
@value={{@manager.displayName}}
/>
{{/let}}
{{/unless}}
{{#if @manager.connectAccountError}}
<p local-class='connect-error'>
{{t 'addons.accountCreate.error'}}
</p>
{{/if}}
<div local-class='button-wrapper'>
<Button
data-test-addon-cancel-button
Expand All @@ -34,121 +128,29 @@
>
{{t 'general.cancel'}}
</Button>
<Button
data-test-addon-oauth-button
data-analytics-name={{if @reconnect 'Reconnect account' 'Begin OAuth'}}
@type='primary'
{{on 'click' (if @reconnect (perform this.startOauthReconnectFlow) (perform this.startOauthFlow))}}
>
{{if @reconnect (t 'addons.accountCreate.reconnect') (t 'general.authorize')}}
</Button>
{{#if @reconnect}}
<Button
data-test-addon-reconnect-account-button
data-analytics-name='Reconnect Account'
@type='primary'
disabled={{@manager.reconnectAccount.isRunning}}
{{on 'click' (perform @manager.reconnectAccount)}}
>
{{t 'addons.accountCreate.reconnect'}}
</Button>
{{else}}
<Button
data-test-addon-connect-account-button
data-analytics-name='Connect Account'
@type='primary'
disabled={{@manager.connectAccount.isRunning}}
{{on 'click' (perform @manager.connectAccount this.displayName)}}
>
{{t 'addons.accountCreate.connect'}}
</Button>
{{/if}}
</div>
</div>
</form>
{{/if}}
{{else}}
<form>
{{#if this.showRepoOptions}}
<label>
{{t 'addons.accountCreate.repo-label'}}
<PowerSelect
local-class='repo-select'
@options={{this.repoOptions}}
@selected={{this.selectedRepo}}
@onChange={{this.onRepoChange}}
@placeholder={{t 'addons.accountCreate.repo-placeholder'}}
as |selected|
>
{{selected}}
</PowerSelect>
</label>
{{#if this.otherRepoSelected}}
<Input
data-test-other-repo-input
local-class='auth-text-input-label'
placeholder={{t 'addons.accountCreate.repo-other-placeholder'}}
@value={{this.otherRepo}}
{{on 'keyup' this.onOtherRepoChange}}
/>
{{#if this.repoOtherPostText}}
<p>
{{this.repoOtherPostText}}
</p>
{{/if}}
{{/if}}
{{/if}}
{{#each this.inputFields as |field|}}
{{#let (unique-id (field.name)) as |id|}}
<label for={{id}} local-class='auth-text-input-label'>
{{field.labelText}}
</label>
<div local-class='post-text'>
{{field.postText}}
</div>
<Input
data-test-input={{field.name}}
id={{id}}
local-class='input'
name={{field.name}}
placeholder={{field.inputPlaceholder}}
autocomplete={{field.autocomplete}}
@type={{field.inputType}}
@value={{field.inputValue}}
{{on 'keyup' @onInput}}
/>
{{/let}}
{{/each}}
{{#unless @reconnect}}
{{#let (unique-id 'displayNameField') as |id|}}
<label for={{id}} local-class='auth-text-input-label'>
{{t 'addons.accountCreate.display-name-label'}}
</label>
<div local-class='post-text'>
{{t 'addons.accountCreate.display-name-help'}}
</div>
<Input
data-test-display-name-input
id={{id}}
local-class='input'
placeholder={{t 'addons.accountCreate.display-name-placeholder'}}
@value={{@manager.displayName}}
/>
{{/let}}
{{/unless}}
{{#if @manager.connectAccountError}}
<p local-class='connect-error'>
{{t 'addons.accountCreate.error'}}
</p>
{{/if}}
<div local-class='button-wrapper'>
<Button
data-test-addon-cancel-button
data-analytics-name='Cancel'
{{on 'click' @manager.cancelSetup}}
>
{{t 'general.cancel'}}
</Button>
{{#if @reconnect}}
<Button
data-test-addon-reconnect-account-button
data-analytics-name='Reconnect Account'
@type='primary'
disabled={{@manager.reconnectAccount.isRunning}}
{{on 'click' (perform @manager.reconnectAccount)}}
>
{{t 'addons.accountCreate.reconnect'}}
</Button>
{{else}}
<Button
data-test-addon-connect-account-button
data-analytics-name='Connect Account'
@type='primary'
disabled={{@manager.connectAccount.isRunning}}
{{on 'click' (perform @manager.connectAccount this.displayName)}}
>
{{t 'addons.accountCreate.connect'}}
</Button>
{{/if}}
</div>
</form>
{{/if}}
{{/if}}
</div>

0 comments on commit cc25e51

Please sign in to comment.