Skip to content

Commit 69a10e1

Browse files
authored
Update trial messages in both vscode extension and trial web page (#1461)
* Update one click trial markdown contents * Update trial template to handle expiration within the next 90 days * Wrap the footer buttons in a bullseye item and fix indentation in this file
1 parent b420d50 commit 69a10e1

File tree

4 files changed

+130
-101
lines changed

4 files changed

+130
-101
lines changed

ansible_ai_connect/main/tests/test_views.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ def test_get_view_trial(self):
201201
Logged in as: test_user_name<br>
202202
Plan: trial of 90 days<br>
203203
Expiration: {expired_at}
204+
205+
<br>Accelerate Playbook creation with AI-driven content recommendations
206+
from <b>IBM Watsonx Code Assistant for Red Hat Ansible Lightspeed</b>,
207+
enabling faster, more efficient automation development. <a href=
208+
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
209+
Learn more</a>.
204210
"""
205211
self.assertEqual(dedent(expectation).strip(), content)
206212

@@ -223,7 +229,9 @@ def test_get_view_expired_trial(self):
223229
r = self.client.get(reverse("me_summary"))
224230
self.assertEqual(r.status_code, 200)
225231
content = r.json()["content"]
226-
self.assertTrue("Your trial has expired. Contact your Red Hat" in content)
232+
self.assertTrue(
233+
"Your trial has expired. To continue your Ansible automation journey" in content
234+
)
227235

228236
user.delete()
229237
trial_plan.delete()

ansible_ai_connect/users/one_click_trial.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ def get_markdown(self, host):
5050
Plan: {active_plan.plan.name}<br>
5151
Expiration: {expired_at}
5252
"""
53+
if (active_plan.expired_at - timezone.now()).days <= 90:
54+
markdown_value += """
55+
<br>Accelerate Playbook creation with AI-driven content recommendations
56+
from <b>IBM Watsonx Code Assistant for Red Hat Ansible Lightspeed</b>,
57+
enabling faster, more efficient automation development. <a href=
58+
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
59+
Learn more</a>.
60+
"""
5361
elif active_plan and not active_plan.expired_at:
5462
markdown_value = f"""
5563
Logged in as: {self.user.username}<br>
@@ -59,11 +67,11 @@ def get_markdown(self, host):
5967
elif expired_plan:
6068
markdown_value = f"""
6169
Logged in as: {self.user.username}<br>
62-
Your trial has expired. Contact your Red Hat Organization's
63-
administrator to request access to
64-
<a href =
65-
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
66-
Ansible Lightspeed with IBM watsonx Code Assistant</a>.
70+
Your trial has expired. To continue your Ansible automation journey,
71+
contact your Red Hat organization's administrator, or <a href=
72+
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed
73+
?schedulerform">connect with an IBM expert to subscribe to watsonx Code
74+
Assistant for Red Hat Ansible Lightspeed</a>.
6775
"""
6876
else:
6977
markdown_value = f"""

ansible_ai_connect/users/templates/users/trial.html

Lines changed: 105 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,49 @@
33

44
{% block content %}
55

6-
{% if start_trial_button and accept_trial_terms is False %}
7-
<div class="pf-c-alert pf-m-warning" aria-label="Terms and Conditions Information alert">
8-
<div class="pf-c-alert__icon">
9-
<i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
10-
</div>
11-
<p class="pf-c-alert__title">
12-
Please accept the Terms and Conditions and allow information to be shared with IBM.
13-
</p>
14-
</div>
15-
{% endif %}
16-
17-
<section class="pf-c-page__main-section pf-m-light">
18-
<div class="pf-l-bullseye">
19-
<div class="pf-l-bullseye__item">
20-
<div class="pf-c-empty-state">
21-
<div class="pf-c-empty-state__content">
22-
23-
<div class="pf-l-bullseye pf-u-p-xl ls_logo_home">
24-
<img src="{% static 'users/lightspeed.png' %}" width="95px" alt="{{ project_name }} logo"/>
25-
</div>
6+
{% if start_trial_button and accept_trial_terms is False %}
7+
<div class="pf-c-alert pf-m-warning" aria-label="Terms and Conditions Information alert">
8+
<div class="pf-c-alert__icon">
9+
<i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
10+
</div>
11+
<p class="pf-c-alert__title">
12+
Please accept the Terms and Conditions and allow information to be shared with IBM.
13+
</p>
14+
</div>
15+
{% endif %}
2616

17+
<section class="pf-c-page__main-section pf-m-light">
18+
<div class="pf-l-bullseye">
19+
<div class="pf-l-bullseye__item">
20+
<div class="pf-c-empty-state">
21+
<div class="pf-c-empty-state__content">
2722

28-
<h1 class="pf-c-title pf-m-lg">{{ project_name }}</h1>
23+
<div class="pf-l-bullseye pf-u-p-xl ls_logo_home">
24+
<img src="{% static 'users/lightspeed.png' %}" width="95px" alt="{{ project_name }} logo"/>
25+
</div>
2926

30-
{% if user.is_authenticated %}
31-
<div class = "ls_username">
32-
<p>{% firstof user.external_username user.username %}</p>
33-
</div>
3427

35-
{% if deployment_mode != "saas" or not one_click_trial_available %}
36-
<!-- Not supported -->
37-
{% elif has_active_plan %}
38-
<div class="ls_message_body">
39-
You have {{ days_left }} days left on your trial period
40-
</div>
28+
<h1 class="pf-c-title pf-m-lg">{{ project_name }}</h1>
4129

30+
{% if user.is_authenticated %}
31+
<div class = "ls_username">
32+
<p>{% firstof user.external_username user.username %}</p>
33+
</div>
34+
35+
{% if deployment_mode != "saas" or not one_click_trial_available %}
36+
<!-- Not supported -->
37+
{% elif has_active_plan %}
38+
<div class="ls_message_body">
39+
<p>You have {{ days_left }} days left on your trial period</p>
40+
{% if days_left <= 90 %}
41+
<p>
42+
Accelerate Playbook creation with AI-driven content recommendations from <b>IBM Watsonx Code Assistant for Red Hat Ansible Lightspeed</b>, enabling faster, more efficient automation development.
43+
<a href =
44+
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
45+
Learn more</a>.
46+
</p>
47+
{% endif %}
48+
</div>
4249

4350
<!--
4451
<div class="pf-v5-c-form__group pf-m-action">
@@ -53,94 +60,98 @@ <h1 class="pf-c-title pf-m-lg">{{ project_name }}</h1>
5360
-->
5461

5562
{% elif has_expired_plan %}
56-
<div class="ls_message_body">
57-
<p>
58-
Your trial has expired. Contact your Red Hat Organization's administrator to request access to
59-
<a href =
60-
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed">
61-
Ansible Lightspeed with IBM watsonx Code Assistant</a>.
62-
</p>
63-
</div>
63+
<div class="ls_message_body">
64+
<p>
65+
Your trial has expired. To continue your Ansible automation journey, contact your Red Hat organization's administrator, or
66+
<a href =
67+
"https://www.ibm.com/products/watsonx-code-assistant-ansible-lightspeed?schedulerform">
68+
connect with an IBM expert to subscribe to watsonx Code Assistant for Red Hat Ansible Lightspeed</a>.
69+
</p>
70+
</div>
6471
{% else %}
65-
<form action={% url 'trial' %} method="post">{% csrf_token %}
66-
67-
<div class="ls_button_checkbox_body pf-c-empty-state__content">
68-
<div class="ls_trial_text">
69-
<p>
70-
Start a trial to Ansible Lightspeed with IBM watsonx Code Assistant by accepting the terms below,
71-
and clicking the Start button.
72-
</p>
73-
</div>
72+
<form action={% url 'trial' %} method="post">{% csrf_token %}
7473

75-
<div class="ls_checkbox_body">
76-
<div id = "ls_checkbox_terms" class = "ls_checkbox_wrapper">
74+
<div class="ls_button_checkbox_body pf-c-empty-state__content">
75+
<div class="ls_trial_text">
7776
<p>
78-
<input type="checkbox" class="ls_checkbox" name="accept_trial_terms" {% if accept_trial_terms %}checked{% endif %} />
79-
By checking the box and activating this trial, you accept
80-
IBM <a href="https://www.ibm.com/terms/?id=i126-9853" target="_blank" rel="noopener">terms and conditions</a>
81-
and acknowledge that Red Hat will share your information with IBM.
82-
<i class = "ls_checkbox_required">Required <em class = "ls_checkbox_required_asterix">*</em></i>
77+
Start a trial to Ansible Lightspeed with IBM watsonx Code Assistant by accepting the terms below,
78+
and clicking the Start button.
8379
</p>
8480
</div>
85-
</div>
8681

87-
<div class="hr-line"></div>
82+
<div class="ls_checkbox_body">
83+
<div id = "ls_checkbox_terms" class = "ls_checkbox_wrapper">
84+
<p>
85+
<input type="checkbox" class="ls_checkbox" name="accept_trial_terms" {% if accept_trial_terms %}checked{% endif %} />
86+
By checking the box and activating this trial, you accept
87+
IBM <a href="https://www.ibm.com/terms/?id=i126-9853" target="_blank" rel="noopener">terms and conditions</a>
88+
and acknowledge that Red Hat will share your information with IBM.
89+
<i class = "ls_checkbox_required">Required <em class = "ls_checkbox_required_asterix">*</em></i>
90+
</p>
91+
</div>
92+
</div>
8893

89-
<div class="ls_trial_text">
90-
<p>
91-
Red Hat may use your personal data to inform you about its products, services, and events.
92-
</p>
93-
</div>
94+
<div class="hr-line"></div>
9495

95-
<div class="ls_checkbox_body">
96-
<div class = "ls_checkbox_wrapper">
96+
<div class="ls_trial_text">
9797
<p>
98-
<input type="checkbox" class="ls_checkbox" name="accept_marketing_emails" {% if accept_marketing_emails %}checked{% endif %}/>
99-
Notify me about products, services, and events.
98+
Red Hat may use your personal data to inform you about its products, services, and events.
10099
</p>
101100
</div>
102-
</div>
103101

102+
<div class="ls_checkbox_body">
103+
<div class = "ls_checkbox_wrapper">
104+
<p>
105+
<input type="checkbox" class="ls_checkbox" name="accept_marketing_emails" {% if accept_marketing_emails %}checked{% endif %}/>
106+
Notify me about products, services, and events.
107+
</p>
108+
</div>
109+
</div>
110+
111+
<p>
112+
You can stop receiving marketing emails by clicking the unsubscribe link in each email or
113+
withdraw your consent at any time in the
114+
<a href = "https://www.redhat.com/en/email-preferences" target="_blank" rel="noopener">preference center</a>.
115+
See <a href = "https://www.redhat.com/en/about/privacy-policy" target="_blank" rel="noopener">Privacy Statement</a> for details.
116+
</p>
117+
118+
</div>
104119
<p>
105-
You can stop receiving marketing emails by clicking the unsubscribe link in each email or
106-
withdraw your consent at any time in the
107-
<a href = "https://www.redhat.com/en/email-preferences" target="_blank" rel="noopener">preference center</a>.
108-
See <a href = "https://www.redhat.com/en/about/privacy-policy" target="_blank" rel="noopener">Privacy Statement</a> for details.
120+
<button class="pf-c-button pf-m-primary ls_start_trial_button" type="submit" name="start_trial_button" value="True">
121+
Start trial
122+
</button>
109123
</p>
110-
111-
</div>
112-
<p>
113-
<button class="pf-c-button pf-m-primary ls_start_trial_button" type="submit" name="start_trial_button" value="True">
114-
Start trial
115-
</button>
116-
</p>
117-
</form>
124+
</form>
118125
{% endif %}
119126
<div class="ls_message_body">
120127
<form id="logout-form" method="post" action="{% url 'logout' %}">
121128
{% csrf_token %}
122129
<button class="pf-c-button pf-m-secondary" type="submit">Log out</button>
123130
</form>
124131
</div>
125-
{% else %}
132+
{% else %}
126133
<div class="pf-c-empty-state__body">You are currently not logged in. Please log in using the button below.</div>
127134
<a class="pf-c-button pf-m-primary" type="button" href="{% url 'login' %}">Log in</a>
128-
{% endif %}
129-
130-
<div class="pf-l-level ls_bottom_menu">
131-
<a class="pf-l-level__item" href="{{ documentation_url }}" target="_blank" rel="noopener"><span class="fas fa-sharp fa-solid fa-external-link-alt"></span> Documentation</a>
132-
<a class="pf-l-level__item" href="https://status.redhat.com/" target="_blank" rel="noopener"><span class="fas fa-sharp fa-solid fa-check"></span> Status</a>
133-
134-
{% if deployment_mode == 'saas' and user.is_authenticated and user.rh_user_is_org_admin %}
135-
<a class="pf-l-level__item" href="/console"><span class="fas fa-solid fa-cog"></span> Admin Portal</a>
136-
{% endif %}
137-
{% if chatbot_enabled and deployment_mode == 'saas' and user.is_authenticated and rh_employee_or_test_user %}
138-
<a class="pf-l-level__item" href="/chatbot"><span class="fas fa-solid fa-comments"></span> Chatbot</a>
139-
{% endif %}
135+
{% endif %}
136+
137+
<div class="pf-l-bullseye">
138+
<div class="pf-l-bullseye__item">
139+
<div class="pf-l-level pf-m-gutter ls_bottom_menu">
140+
<a class="pf-l-level__item" href="{{ documentation_url }}" target="_blank"><span class="fas fa-sharp fa-solid fa-external-link-alt"></span> Documentation</a>
141+
<a class="pf-l-level__item" href="https://status.redhat.com/" target="_blank"><span class="fas fa-sharp fa-solid fa-check"></span> Status</a>
142+
143+
{% if deployment_mode == 'saas' and user.is_authenticated and user.rh_user_is_org_admin %}
144+
<a class="pf-l-level__item" href="/console"><span class="fas fa-solid fa-cog"></span> Admin Portal</a>
145+
{% endif %}
146+
{% if chatbot_enabled and deployment_mode == 'saas' and user.is_authenticated and rh_employee_or_test_user %}
147+
<a class="pf-l-level__item" href="/chatbot"><span class="fas fa-solid fa-comments"></span> Chatbot</a>
148+
{% endif %}
149+
</div>
140150
</div>
151+
</div>
152+
</div>
141153
</div>
142154
</div>
143155
</div>
144-
</div>
145-
</section>
156+
</section>
146157
{% endblock content %}

ansible_ai_connect/users/tests/test_views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ def test_trial_period_is_done(self):
344344
)
345345
self.user.plans.add(trial_plan)
346346
r = self.client.get(reverse("trial"))
347-
self.assertContains(r, "Your trial has expired. Contact your Red Hat")
347+
self.assertContains(
348+
r, "Your trial has expired. To continue your Ansible automation journey"
349+
)
348350

349351
@override_settings(SEGMENT_WRITE_KEY="blablabla")
350352
def test_accept_trial_schema1(self):

0 commit comments

Comments
 (0)