Commit ccca660c authored by Rafael Monnerat's avatar Rafael Monnerat

Implement ContextualHelpList for Panel

See merge request nexedi/slapos.core!300
parents 69095b74 7a75536c
Pipeline #15710 failed with stage
in 0 seconds
import json import json
contextual_help_list = [] contextual_help_list = []
web_site = context.getWebSiteValue()
#contextual_help_list.append( if web_site is None:
# {"title": "XX", "href": "LLLL"} return json.dumps(contextual_help_list)
#)
web_site_id = web_site.getRelativeUrl().split('/')[1]
if web_site_id not in ["rapidspacejs", "hostingjs"]:
return json.dumps(contextual_help_list)
if context.getPortalType() == "Hosting Subscription":
if web_site_id == "hostingjs" and context.getSourceReference() == "kvm-cluster":
contextual_help_list.extend([
{"title": "Connect noVNC Over IPv4",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Connect.To.A.VPS.Via.VNC.Over.IPv4.On.Rapid.Space"},
{"title": "Connect noVNC Over IPv6",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Connect.To.A.VPS.Via.VNC.Over.IPv6.On.Rapid.Space"},
{"title": "Install Default Debian OS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.VPS.Install.Default.Linux"},
{"title": "Install Other Linux OS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Deploy.A.VPS.With.A.Different.Linux.Distribution.On.Rapid.Space"},
{"title": "Redirect VPS Ports",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Redirect.VPS.Ports.On.Rapid.Space"},
{"title": "Install IPv6 Inside VPS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Install.IPv6.Inside.VM"},
{"title": "SSH to VPS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Access.A.VPS.Via.Ssh.On.Rapid.Space"},
{"title": "SSH to VPS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Access.A.VPS.Via.Ssh.On.Rapid.Space"},
{"title": "Install Other OS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Deploy.A.VPS.With.Other.OS.On.Rapid.Space"},
{"title": "Install Windows OS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Deploy.A.VPS.With.Windows.On.Rapid.Space"},
{"title": "Configure IPv6 For Windows",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Configure.IPv6.Address.To.Get.Remote.Access.To.Windows.VPS"},
{"title": "Monitor VPS",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Monitor.A.VPS.On.Rapid.Space"}
])
elif context.getPortalType() == "Accounting Transaction Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Payment Options",
"href": "https://handbook.rapid.space/user/faq/rapidspace-Faq.What.Are.The.Payment.Options"}
])
elif context.getPortalType() == "Hosting Subscription Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Access Services",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Access.Rapid.Space.Services"},
{"title": "Use Panel",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Use.Rapid.Space.Panel"},
{"title": "Order A Second Machine",
"href": "https://handbook.rapid.space/user/faq/rapidspace-Faq.Can.I.Order.A.Second.Machine"},
{"title": "Get Free Services",
"href": "https://handbook.rapid.space/user/faq/rapidspace-Faq.Is.There.Any.Free.Services.I.Can.Access"},
{"title": "Purchase Other Services",
"href": "https://handbook.rapid.space/user/faq/rapidspace-Faq.Can.I.Purchase.Other.Types.Of.Service"},
{"title": "Know More Services",
"href": "https://handbook.rapid.space/user/faq/rapidspace-What.Are.The.Services.That.Rapid.Space.Cloud.Can.Provide"}
])
elif context.getPortalType() == "Person Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Request A Test Account",
"href": "https://handbook.rapid.space/user/faq/rapidspace-Can.I.Request.A.Test.Account.To.Try"},
{"title": "Associate With More VMs",
"href": "http://handbook.rapid.space/user/faq/rapidspace-Faq.My.Account.Is.Associate.With.Only.One.VM"}
])
elif context.getPortalType() == "Support Request Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Add Tickets",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Add.A.Ticket.To.Contact.Rapid.Space.Team"},
{"title": "Use Panel",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Use.Rapid.Space.Panel"},
{"title": "User Handbook",
"href": "https://handbook.rapid.space/user"},
{"title": "Learning Track",
"href": "https://handbook.rapid.space/user/rapidspace-Learning.Track"},
{"title": "User FAQ",
"href": "https://handbook.rapid.space/user/faq"},
{"title": "Contacts",
"href": "https://handbook.rapid.space/contact"}
])
elif context.getPortalType() == "Software Release Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Get Free Services",
"href": "https://handbook.rapid.space/user/faq/rapidspace-Faq.Is.There.Any.Free.Services.I.Can.Access"}
])
elif context.getPortalType() == "Project Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Add Projects",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Add.A.New.Project"}
])
elif context.getPortalType() == "Computer Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Install SlapOS Node On PC",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Install.Slapos.Node.Comp.123"},
{"title": "Install SlapOS Node On KVM",
"href": "https://handbook.rapid.space/user/rapidspace-Install.SlapOS.Node.Comp.123.On.Rapid.Space.KVM"},
{"title": "Associate Computers",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Associate.A.Computer"}
])
elif context.getPortalType() == "Computer Network Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Add Networks",
"href": "https://handbook.rapid.space/user/rapidspace-HowTo.Add.A.New.Network"}
])
elif context.getPortalType() == "Organisation Module":
if web_site_id == "hostingjs":
contextual_help_list.extend([
{"title": "Classify Nodes",
"href": "https://handbook.rapid.space/user/slapos-HowTo.Classify.Node.In.A.Network"}
])
# Translate titles
for contextual_help in contextual_help_list:
contextual_help['title'] = context.Base_translateString(contextual_help['title'])
return json.dumps(contextual_help_list) return json.dumps(contextual_help_list)
...@@ -91,48 +91,56 @@ ...@@ -91,48 +91,56 @@
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Sites'; header menu_item"> <tal:block define="menu_item python: 'Sites'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Projects'; header menu_item"> <tal:block define="menu_item python: 'Projects'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Invoices'; header menu_item"> <tal:block define="menu_item python: 'Invoices'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Services'; header menu_item"> <tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Servers'; header menu_item"> <tal:block define="menu_item python: 'Servers'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Networks'; header menu_item"> <tal:block define="menu_item python: 'Networks'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tal:block define="menu_item python: 'Language'; header menu_item"> <tal:block define="menu_item python: 'Language'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item_language" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item_language" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_page_header" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_contextual_help" />
</tal:block> </tal:block>
<tr> <tr>
......
...@@ -1044,6 +1044,19 @@ ...@@ -1044,6 +1044,19 @@
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="check_contextual_help">
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="ui-content"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@class="ui-content"]</td>
<td></td>
</tr>
</tal:block>
<!-- the macro to set the language globally --> <!-- the macro to set the language globally -->
<tal:block metal:define-macro="set_default_available_language" <tal:block metal:define-macro="set_default_available_language"
tal:define="global lang python: here.web_site_module[web_site_id].getDefaultAvailableLanguage()"> tal:define="global lang python: here.web_site_module[web_site_id].getDefaultAvailableLanguage()">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment