Commit c3167f14 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: fix maximize button cancellation

parent 1d691a23
......@@ -378,10 +378,7 @@
promise_list.push(null);
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(promise_list);
})
return new RSVP.Queue(RSVP.all(promise_list))
.push(function (result_list) {
var j;
for (j = 0; j < result_list.length; j += 1) {
......
......@@ -202,7 +202,7 @@
// Gadget has not yet been correctly initialized
throw error;
}
if (error_response && error_response.text) {
if (error_response && error_response.text) {
return error_response.text().then(
function (request_error_text) {
return gadget.changeState({
......@@ -243,7 +243,7 @@
function triggerMaximize(gadget, maximize) {
if (gadget.props.deferred_minimize !== undefined) {
gadget.props.deferred_minimize.resolve();
gadget.props.deferred_minimize.cancel();
gadget.props.deferred_minimize = undefined;
}
hideDesktopPanel(gadget, maximize);
......@@ -253,13 +253,16 @@
action: "maximize"
}])
.push(function () {
gadget.props.deferred_minimize = RSVP.defer();
return gadget.props.deferred_minimize.promise;
})
.push(undefined, function (error) {
if (error instanceof RSVP.CancellationError) {
return triggerMaximize(gadget, false);
}
gadget.props.deferred_minimize = new RSVP.Promise(
function () {return; },
function () {
// Wait for cancellation
// return triggerMaximize(gadget, false);
hideDesktopPanel(gadget, false);
return route(gadget, 'header', 'setButtonTitle', [{}]);
}
);
return gadget.props.deferred_minimize;
});
}
return route(gadget, 'header', 'setButtonTitle', [{}]);
......@@ -771,7 +774,7 @@
element.appendChild(container);
// make an iframe to display error page from XMLHttpRequest.
if (gadget.state.request_error_text) {
if (gadget.state.request_error_text) {
iframe = document.createElement('iframe');
container.appendChild(iframe);
iframe.srcdoc = gadget.state.request_error_text;
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>981.63449.54271.9625</string> </value>
<value> <string>982.16935.24089.33911</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1582196761.8</float>
<float>1583166534.25</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -29,7 +29,9 @@
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<!-- Wait for Maximize button -->
<tr>
<td colspan="3"><b>Maximize</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='maximize']//button[text()='Maximize' and @type='button']</td>
......@@ -40,10 +42,18 @@
<td>//div[@data-gadget-scope='maximize']//button[text()='Maximize' and @type='button']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-role='page' and @class='desktop-panel-hidden']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check full screen</b></td>
</tr>
<!-- Wait For full screen -->
<tr>
<td>waitForElementPresent</td>
<td>assertElementPresent</td>
<td>//div[@data-role='page' and @class='desktop-panel-hidden']</td>
<td></td>
</tr>
......@@ -59,6 +69,9 @@
</tr>
<!-- minimize with header button -->
<tr>
<td colspan="3"><b>Minimize with header button</b></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='header']//button[@name='maximize' and @type='submit']</td>
......@@ -66,6 +79,9 @@
</tr>
<!-- Check is minimize -->
<tr>
<td colspan="3"><b>Check not full screen</b></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//div[@data-role='page' and @class='desktop-panel-hidden']</td>
......@@ -83,6 +99,9 @@
</tr>
<!-- Re maximize -->
<tr>
<td colspan="3"><b>Maximize</b></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='maximize']//button[text()='Maximize' and @type='button']</td>
......@@ -90,6 +109,9 @@
</tr>
<!-- Wait For full screen -->
<tr>
<td colspan="3"><b>Check full screen</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-role='page' and @class='desktop-panel-hidden']</td>
......@@ -108,16 +130,17 @@
<!-- make some change in url -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/</td>
<td></td>
<td colspan="3"><b>Minimize with url change</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Search'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_panel_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<!-- Check is minimize -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@role='main']</td>
<td></td>
<td colspan="3"><b>Check not full screen</b></td>
</tr>
<!-- Check is minimize -->
<tr>
<td>assertElementNotPresent</td>
<td>//div[@data-role='page' and @class='desktop-panel-hidden']</td>
......
......@@ -38,7 +38,7 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
this.element.classList.toggle('editor-maximize');
}
return this.triggerMaximize.apply(this, param_list)
.push(function () {
.push(undefined, function () {
if (gadget.element.classList.contains('editor-maximize')) {
gadget.element.classList.remove('editor-maximize');
}
......
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