Commit 736f776c authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Respect frontpage gadget on header links

    Dont hardcode the slapos gadget everywhere
    Use service list rather then dashboard as frontpage
parent 073fdf6d
......@@ -130,15 +130,14 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "compute_node_module"
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "slap_add_compute_node"}}),
gadget.getUrlFor({command: "change", options: {page: "slap_compute_node_get_token"}}),
gadget.getUrlFor({command: "change", options: {"page": "slapos"}})
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.updatePanel({jio_key: "compute_node_module"})
]);
})
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1001.20429.28253.1211</string> </value>
<value> <string>1001.59387.30502.30993</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1656703797.9</float>
<float>1659068807.75</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -68,7 +68,6 @@
hateoas_url + gadget.state.jio_key + "/Login_edit", doc);
})
.push(function (response) {
var redirect_url;
if (response.target === undefined) {
return gadget.notifySubmitted({message: gadget.message2_translation, status: 'success'});
}
......@@ -77,10 +76,13 @@
// The script required to launch a redirect
return gadget.notifySubmitted({message: gadget.message2_translation, status: 'success'})
.push(function () {
return gadget.getSetting('frontpage_gadget');
})
.push(function (frontpage_gadget) {
return gadget.getUrlFor({
command: 'display',
absolute_url: true,
options: {"jio_key": "/", "page": "slapos"}
options: {"jio_key": "/", "page": frontpage_gadget}
})
})
.push(function (came_from) {
......
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>986.45437.22132.61764</string> </value>
<value> <string>1001.59838.52231.28228</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -265,7 +265,7 @@
</tuple>
<state>
<tuple>
<float>1602260156.69</float>
<float>1659068549.98</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -168,11 +168,6 @@
}
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "accounting_module"
});
})
.push(function () {
return RSVP.all([
gadget.getSetting("hateoas_url"),
......@@ -180,18 +175,22 @@
]);
})
.push(function (url_list) {
return gadget.jio_getAttachment("contract_relative_url",
url_list[0] + url_list[1] + "/Person_getCloudContractRelated?return_json=True");
return RSVP.all([
gadget.jio_getAttachment("contract_relative_url",
url_list[0] + url_list[1] + "/Person_getCloudContractRelated?return_json=True"),
gadget.updatePanel({jio_key: "accounting_module"}),
gadget.getSetting('frontpage_gadget')
]);
})
.push(function (contract_relative_url) {
.push(function (result) {
var promise_list = [
gadget.getUrlFor({command: "change", options: {"page": "slapos"}}),
gadget.getUrlFor({command: "change", options: {"page": result[2]}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_ticket",
"jio_key": "accounting_module"}})
];
if (contract_relative_url) {
if (result[0]) {
promise_list.push(
gadget.getUrlFor({command: "change", options: {"jio_key": contract_relative_url,
gadget.getUrlFor({command: "change", options: {"jio_key": result[0],
"page": "slap_controller"}})
);
}
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>992.9642.18182.11008</string> </value>
<value> <string>1001.59414.5078.17476</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1621359340.83</float>
<float>1659068942.39</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -123,14 +123,13 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "computer_network_module"
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "slap_add_network"}}),
gadget.getUrlFor({command: "change", options: {"page": "slapos"}})
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.updatePanel({jio_key: "computer_network_module"})
]);
})
.push(function (result) {
......
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1000.2322.46712.16657</string> </value>
<value> <string>1001.59379.40192.59272</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -265,7 +265,7 @@
</tuple>
<state>
<tuple>
<float>1656703774.51</float>
<float>1659068921.68</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -307,23 +307,22 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "person_module"
});
})
.push(function () {
return window.getSettingMe(gadget);
return RSVP.all([
window.getSettingMe(gadget),
gadget.getSetting('frontpage_gadget')
]);
})
.push(function (me) {
.push(function (setting_list) {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: "change", options: {jio_key: me, page: "slap_person_revoke_certificate"}}),
gadget.getUrlFor({command: "change", options: {jio_key: me, page: "slap_person_request_certificate"}}),
gadget.getUrlFor({command: "change", options: {jio_key: me, page: "slap_person_get_token"}}),
gadget.getUrlFor({command: "change", options: {jio_key: me, page: "slap_person_add_erp5_login"}}),
gadget.getUrlFor({command: "change", options: {jio_key: me, page: "slap_person_add_organisation"}}),
gadget.getUrlFor({command: "change", options: {page: "slapos"}}),
gadget.getUrlFor({command: "change", options: {jio_key: gadget.state.doc.contract_relative_url, page: "slap_controller"}})
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_revoke_certificate"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_request_certificate"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_get_token"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_add_erp5_login"}}),
gadget.getUrlFor({command: "change", options: {jio_key: setting_list[0], page: "slap_person_add_organisation"}}),
gadget.getUrlFor({command: "change", options: {page: setting_list[1]}}),
gadget.getUrlFor({command: "change", options: {jio_key: gadget.state.doc.contract_relative_url, page: "slap_controller"}}),
gadget.updatePanel({jio_key: "person_module"})
]);
})
.push(function (result) {
......
......@@ -245,7 +245,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>987.49476.87.8891</string> </value>
<value> <string>1001.59425.29682.52855</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -263,7 +263,7 @@
</tuple>
<state>
<tuple>
<float>1621547040.59</float>
<float>1659068534.69</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -84,14 +84,13 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "project_module"
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "slap_add_project"}}),
gadget.getUrlFor({command: "change", options: {"page": "slapos"}})
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.updatePanel({jio_key: "project_module"})
]);
})
.push(function (result) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1000.2322.46712.16657</string> </value>
<value> <string>1001.59376.11750.51012</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1656975508.53</float>
<float>1659068904.46</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -87,15 +87,13 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "instance_tree_module"
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({command: "display_dialog_with_history", options: {"page": "slap_select_software_product"}}),
gadget.getUrlFor({command: "change", options: {"page": "slapos"}})
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.updatePanel({jio_key: "instance_tree_module"})
]);
})
.push(function (result) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>999.2068.62564.17</string> </value>
<value> <string>1001.59388.52713.22408</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1655115655.51</float>
<float>1659068879.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -147,17 +147,16 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: 'organisation_module'
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({
command: 'change',
options: { page: 'slap_add_organisation' }
}),
gadget.getUrlFor({ command: 'change', options: { page: 'slapos' } })
gadget.getUrlFor({ command: 'change', options: { page: frontpage_gadget}}),
gadget.updatePanel({jio_key: 'organisation_module'})
]);
})
.push(function (result) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>999.2068.62564.17</string> </value>
<value> <string>1001.59386.28929.32102</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1656975585.67</float>
<float>1659068860.66</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -96,16 +96,15 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: "support_request_module"
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": "slap_add_ticket"}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_ticket"}}),
gadget.getUrlFor({command: "change", options: {"page": "slapos"}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_critical_ticket"}})
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_rss_critical_ticket"}}),
gadget.updatePanel({jio_key: "support_request_module"})
]);
})
.push(function (result) {
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>982.32417.7827.45414</string> </value>
<value> <string>1001.59377.44199.3498</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1584094338.1</float>
<float>1659068844.09</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -324,13 +324,18 @@
});
})
.push(function () {
return gadget.updatePanel({
jio_key: false
});
return gadget.getSetting('frontpage_gadget');
})
.push(function () {
.push(function (frontpage_gadget) {
return RSVP.all([
gadget.getUrlFor({command: "change", options: {"page": frontpage_gadget}}),
gadget.updatePanel({jio_key: false})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: gadget.page_title_translation
page_title: gadget.page_title_translation,
selection_url: url_list[0]
});
});
})
......
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1000.49358.14576.324</string> </value>
<value> <string>1001.59393.60810.27067</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -265,7 +265,7 @@
</tuple>
<state>
<tuple>
<float>1656976814.1</float>
<float>1659068824.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -414,7 +414,7 @@
</item>
<item>
<key> <string>configuration_frontpage_gadget_url</string> </key>
<value> <string>slapos</string> </value>
<value> <string>slap_service_list</string> </value>
</item>
<item>
<key> <string>configuration_hateoas_url</string> </key>
......@@ -701,7 +701,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1000.41365.61594.63982</string> </value>
<value> <string>1001.26171.19762.42854</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -719,7 +719,7 @@
</tuple>
<state>
<tuple>
<float>1654507392.23</float>
<float>1659036783.36</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -24,7 +24,7 @@
<tal:block metal:define-macro="slapos_wait_for_activities_and_front_page">
<tal:block tal:define="web_site_id python: 'hostingjs'">
<tal:block tal:define="web_site_id python: 'hostingjs';">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page_base" />
</tal:block>
</tal:block>
......@@ -220,18 +220,76 @@
</tal:block>
<tal:block metal:define-macro="slapos_wait_for_front_page">
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % (here.Base_translateString('Services', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % (here.Base_translateString('Services', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1//a[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<tr>
<td>assertElementNotPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1//a[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<tal:block define="menu_item python: 'Dashboard'; header menu_item ">
<tr>
<td colspan="3"><b tal:content="python: 'Access Entry on the Menu for : %s' % menu_item"> Menu Item </b></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_panel.html\')]//a[@data-i18n=\'%s\']' % (menu_item)"></td>
<td></td>
</tr>
<tr>
<td>click</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_panel.html\')]//a[@data-i18n=\'%s\']' % (menu_item)"></td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % here.Base_translateString(menu_item, lang=lang)"></td>
<td></td>
</tr>
</tal:block>
<tr>
<td colspan="3"><b>Wait for Dashboard on header and front page elements</b></td>
</tr>
<!-- Dashboard -->
<tr>
<td>waitForElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//span[@data-i18n=\'%s\']' % (here.Base_translateString('Dashboard', lang=lang))"></td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % (here.Base_translateString('Dashboard', lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//span[@data-i18n=\'%s\']' % (here.Base_translateString('Dashboard', lang=lang))"></td>
<td tal:content="python: '//div[contains(@data-gadget-url, \'gadget_slapos_header.html\')]//a[@data-i18n=\'%s\']' % (here.Base_translateString('Dashboard', lang=lang))"></td>
<td></td>
</tr>
<tr>
......@@ -1192,7 +1250,6 @@
<td>//div[contains(@data-gadget-url, 'gadget_slapos_panel.html')]//dl[@class="dl-contextual-help"]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="suspend_user_tickets">
......@@ -1213,4 +1270,4 @@
tal:define="global lang python: here.web_site_module[web_site_id].getDefaultAvailableLanguage()">
</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
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