Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f21783fd
Commit
f21783fd
authored
Oct 22, 2021
by
Alper Akgun
Committed by
David O'Regan
Oct 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefill form values for hand raise leads
parent
483126f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
33 deletions
+74
-33
ee/app/assets/javascripts/hand_raise_leads/hand_raise_lead/components/hand_raise_lead_button.vue
...ads/hand_raise_lead/components/hand_raise_lead_button.vue
+10
-19
ee/app/assets/javascripts/hand_raise_leads/hand_raise_lead/init_hand_raise_lead_button.js
...aise_leads/hand_raise_lead/init_hand_raise_lead_button.js
+11
-7
ee/app/helpers/billing_plans_helper.rb
ee/app/helpers/billing_plans_helper.rb
+10
-0
ee/app/views/shared/billings/_billing_plan.html.haml
ee/app/views/shared/billings/_billing_plan.html.haml
+1
-1
ee/spec/frontend/hand_raise_leads/components/hand_raise_lead_button_spec.js
...and_raise_leads/components/hand_raise_lead_button_spec.js
+28
-6
ee/spec/helpers/billing_plans_helper_spec.rb
ee/spec/helpers/billing_plans_helper_spec.rb
+14
-0
No files found.
ee/app/assets/javascripts/hand_raise_leads/hand_raise_lead/components/hand_raise_lead_button.vue
View file @
f21783fd
...
@@ -32,22 +32,13 @@ export default {
...
@@ -32,22 +32,13 @@ export default {
autofocusonshow
,
autofocusonshow
,
},
},
mixins
:
[
Tracking
.
mixin
()],
mixins
:
[
Tracking
.
mixin
()],
props
:
{
inject
:
[
'
user
'
],
namespaceId
:
{
type
:
Number
,
required
:
true
,
},
userName
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
data
()
{
return
{
return
{
isLoading
:
false
,
isLoading
:
false
,
firstName
:
''
,
firstName
:
this
.
user
.
firstName
,
lastName
:
''
,
lastName
:
this
.
user
.
lastName
,
companyName
:
''
,
companyName
:
this
.
user
.
companyName
,
companySize
:
null
,
companySize
:
null
,
phoneNumber
:
''
,
phoneNumber
:
''
,
country
:
null
,
country
:
null
,
...
@@ -76,7 +67,7 @@ export default {
...
@@ -76,7 +67,7 @@ export default {
computed
:
{
computed
:
{
modalHeaderText
()
{
modalHeaderText
()
{
return
sprintf
(
this
.
$options
.
i18n
.
modalHeaderText
,
{
return
sprintf
(
this
.
$options
.
i18n
.
modalHeaderText
,
{
userName
:
this
.
userName
,
userName
:
this
.
user
.
user
Name
,
});
});
},
},
mustEnterState
()
{
mustEnterState
()
{
...
@@ -141,11 +132,11 @@ export default {
...
@@ -141,11 +132,11 @@ export default {
},
},
formParams
()
{
formParams
()
{
return
{
return
{
namespaceId
:
this
.
namespaceId
,
namespaceId
:
Number
(
this
.
user
.
namespaceId
),
companyName
:
this
.
companyName
,
companySize
:
this
.
companySize
,
firstName
:
this
.
firstName
,
firstName
:
this
.
firstName
,
lastName
:
this
.
lastName
,
lastName
:
this
.
lastName
,
companyName
:
this
.
companyName
,
companySize
:
this
.
companySize
,
phoneNumber
:
this
.
phoneNumber
,
phoneNumber
:
this
.
phoneNumber
,
country
:
this
.
country
,
country
:
this
.
country
,
state
:
this
.
mustEnterState
?
this
.
state
:
null
,
state
:
this
.
mustEnterState
?
this
.
state
:
null
,
...
@@ -154,7 +145,7 @@ export default {
...
@@ -154,7 +145,7 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
clear
Form
()
{
reset
Form
()
{
this
.
firstName
=
''
;
this
.
firstName
=
''
;
this
.
lastName
=
''
;
this
.
lastName
=
''
;
this
.
companyName
=
''
;
this
.
companyName
=
''
;
...
@@ -173,7 +164,7 @@ export default {
...
@@ -173,7 +164,7 @@ export default {
message
:
this
.
$options
.
i18n
.
handRaiseActionSuccess
,
message
:
this
.
$options
.
i18n
.
handRaiseActionSuccess
,
type
:
FLASH_TYPES
.
SUCCESS
,
type
:
FLASH_TYPES
.
SUCCESS
,
});
});
this
.
clear
Form
();
this
.
reset
Form
();
this
.
track
(
'
hand_raise_submit_form_succeeded
'
);
this
.
track
(
'
hand_raise_submit_form_succeeded
'
);
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
...
...
ee/app/assets/javascripts/hand_raise_leads/hand_raise_lead/init_hand_raise_lead_button.js
View file @
f21783fd
...
@@ -3,18 +3,22 @@ import HandRaiseLeadButton from 'ee/hand_raise_leads/hand_raise_lead/components/
...
@@ -3,18 +3,22 @@ import HandRaiseLeadButton from 'ee/hand_raise_leads/hand_raise_lead/components/
import
apolloProvider
from
'
ee/subscriptions/buy_addons_shared/graphql
'
;
import
apolloProvider
from
'
ee/subscriptions/buy_addons_shared/graphql
'
;
export
const
initHandRaiseLeadButton
=
(
el
)
=>
{
export
const
initHandRaiseLeadButton
=
(
el
)
=>
{
const
{
namespaceId
,
userName
}
=
el
.
dataset
;
const
{
namespaceId
,
userName
,
firstName
,
lastName
,
companyName
}
=
el
.
dataset
;
return
new
Vue
({
return
new
Vue
({
el
,
el
,
apolloProvider
,
apolloProvider
,
provide
:
{
user
:
{
namespaceId
,
userName
,
firstName
,
lastName
,
companyName
,
},
},
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
HandRaiseLeadButton
,
{
return
createElement
(
HandRaiseLeadButton
);
props
:
{
namespaceId
:
Number
(
namespaceId
),
userName
,
},
});
},
},
});
});
};
};
ee/app/helpers/billing_plans_helper.rb
View file @
f21783fd
...
@@ -142,6 +142,16 @@ module BillingPlansHelper
...
@@ -142,6 +142,16 @@ module BillingPlansHelper
end
end
end
end
def
hand_raise_props
(
namespace
)
{
namespace_id:
namespace
.
id
,
user_name:
current_user
.
username
,
first_name:
current_user
.
first_name
,
last_name:
current_user
.
last_name
,
company_name:
current_user
.
organization
}
end
private
private
def
add_seats_url
(
group
)
def
add_seats_url
(
group
)
...
...
ee/app/views/shared/billings/_billing_plan.html.haml
View file @
f21783fd
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
.gl-min-h-7.gl-display-flex.gl-flex-wrap.gl-justify-content-end
.gl-min-h-7.gl-display-flex.gl-flex-wrap.gl-justify-content-end
-
if
show_contact_sales_button?
(
purchase_link
.
action
,
plan_offer_type
)
-
if
show_contact_sales_button?
(
purchase_link
.
action
,
plan_offer_type
)
-
if
Feature
.
enabled?
(
:in_app_hand_raise_pql
,
namespace
)
-
if
Feature
.
enabled?
(
:in_app_hand_raise_pql
,
namespace
)
.js-hand-raise-lead-button
{
data:
{
namespace_id:
namespace
.
id
,
user_name:
current_user
.
username
}
}
.js-hand-raise-lead-button
{
data:
hand_raise_props
(
namespace
)
}
-
else
-
else
=
link_to
s_
(
'BillingPlan|Contact sales'
),
"
#{
contact_sales_url
}
?test=inappcontactsales
#{
plan
.
code
}
"
,
class:
[
"btn gl-button"
,
show_upgrade_button
?
"btn-success-secondary"
:
"btn-success"
],
data:
{
'track-action'
:
'click_button'
,
'track-label'
:
'contact_sales'
,
'track-property'
:
plan
.
code
}
=
link_to
s_
(
'BillingPlan|Contact sales'
),
"
#{
contact_sales_url
}
?test=inappcontactsales
#{
plan
.
code
}
"
,
class:
[
"btn gl-button"
,
show_upgrade_button
?
"btn-success-secondary"
:
"btn-success"
],
data:
{
'track-action'
:
'click_button'
,
'track-label'
:
'contact_sales'
,
'track-property'
:
plan
.
code
}
-
if
show_upgrade_button
-
if
show_upgrade_button
...
...
ee/spec/frontend/hand_raise_leads/components/hand_raise_lead_button_spec.js
View file @
f21783fd
...
@@ -18,7 +18,7 @@ describe('HandRaiseLeadButton', () => {
...
@@ -18,7 +18,7 @@ describe('HandRaiseLeadButton', () => {
let
fakeApollo
;
let
fakeApollo
;
let
trackingSpy
;
let
trackingSpy
;
const
createComponent
=
(
props
=
{}
)
=>
{
const
createComponent
=
()
=>
{
const
mockResolvers
=
{
const
mockResolvers
=
{
Query
:
{
Query
:
{
countries
()
{
countries
()
{
...
@@ -34,16 +34,21 @@ describe('HandRaiseLeadButton', () => {
...
@@ -34,16 +34,21 @@ describe('HandRaiseLeadButton', () => {
return
shallowMountExtended
(
HandRaiseLeadButton
,
{
return
shallowMountExtended
(
HandRaiseLeadButton
,
{
localVue
,
localVue
,
apolloProvider
:
fakeApollo
,
apolloProvider
:
fakeApollo
,
propsData
:
{
provide
:
{
namespaceId
:
1
,
user
:
{
userName
:
'
Joe
'
,
namespaceId
:
'
1
'
,
...
props
,
userName
:
'
joe
'
,
firstName
:
'
Joe
'
,
lastName
:
'
Doe
'
,
companyName
:
'
ACME
'
,
},
},
},
});
});
};
};
const
findButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
const
findButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
const
findModal
=
()
=>
wrapper
.
findComponent
(
GlModal
);
const
findModal
=
()
=>
wrapper
.
findComponent
(
GlModal
);
const
findFormInput
=
(
testId
)
=>
wrapper
.
findByTestId
(
testId
);
afterEach
(()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
.
destroy
();
...
@@ -65,6 +70,23 @@ describe('HandRaiseLeadButton', () => {
...
@@ -65,6 +70,23 @@ describe('HandRaiseLeadButton', () => {
expect
(
findButton
().
text
()).
toBe
(
i18n
.
buttonText
);
expect
(
findButton
().
text
()).
toBe
(
i18n
.
buttonText
);
});
});
it
(
'
has the default injected values
'
,
async
()
=>
{
const
formInputValues
=
[
{
id
:
'
first-name
'
,
value
:
'
Joe
'
},
{
id
:
'
last-name
'
,
value
:
'
Doe
'
},
{
id
:
'
company-name
'
,
value
:
'
ACME
'
},
{
id
:
'
phone-number
'
,
value
:
''
},
{
id
:
'
company-size
'
,
value
:
undefined
},
{
id
:
'
country
'
,
value
:
undefined
},
];
formInputValues
.
forEach
(({
id
,
value
})
=>
{
expect
(
findFormInput
(
id
).
attributes
(
'
value
'
)).
toBe
(
value
);
});
expect
(
findFormInput
(
'
state
'
).
exists
()).
toBe
(
false
);
});
it
(
'
has the correct form input in the form content
'
,
()
=>
{
it
(
'
has the correct form input in the form content
'
,
()
=>
{
const
visibleFields
=
[
const
visibleFields
=
[
'
first-name
'
,
'
first-name
'
,
...
@@ -81,7 +103,7 @@ describe('HandRaiseLeadButton', () => {
...
@@ -81,7 +103,7 @@ describe('HandRaiseLeadButton', () => {
});
});
it
(
'
has the correct text in the modal content
'
,
()
=>
{
it
(
'
has the correct text in the modal content
'
,
()
=>
{
expect
(
findModal
().
text
()).
toContain
(
sprintf
(
i18n
.
modalHeaderText
,
{
userName
:
'
J
oe
'
}));
expect
(
findModal
().
text
()).
toContain
(
sprintf
(
i18n
.
modalHeaderText
,
{
userName
:
'
j
oe
'
}));
expect
(
findModal
().
text
()).
toContain
(
i18n
.
modalFooterText
);
expect
(
findModal
().
text
()).
toContain
(
i18n
.
modalFooterText
);
});
});
...
...
ee/spec/helpers/billing_plans_helper_spec.rb
View file @
f21783fd
...
@@ -394,6 +394,20 @@ RSpec.describe BillingPlansHelper, :saas do
...
@@ -394,6 +394,20 @@ RSpec.describe BillingPlansHelper, :saas do
end
end
end
end
describe
"#hand_raise_props"
do
let_it_be
(
:namespace
)
{
create
(
:namespace
)
}
let_it_be
(
:user
)
{
create
(
:user
,
username:
'Joe'
,
first_name:
'Joe'
,
last_name:
'Doe'
,
organization:
'ACME'
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
it
'builds correct hash'
do
props
=
helper
.
hand_raise_props
(
namespace
)
expect
(
props
).
to
eq
(
namespace_id:
namespace
.
id
,
user_name:
'Joe'
,
first_name:
'Joe'
,
last_name:
'Doe'
,
company_name:
'ACME'
)
end
end
describe
'#upgrade_button_text'
do
describe
'#upgrade_button_text'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment