天天看点

SAP CRM Fiori busy dialog的工作原理

我在Opp header ETAG的后台实现里加了一个10s的延时。

第一个video timeout_1500.wmv: 虽然list和detail的数据都ready了,但是因为ETAG需要10s才能返回,整个UI被这个ETAG的request造成的busy dialog锁住了,直到10s后UI才能点击

第二个video是把默认的timeout从1500毫秒改成30秒,即busy dialog不会显示。从video里看出UI始终是可操作的,尽管后台的ETAG还没有回来。

这个busy dialog实际上也是一种保护措施。如果UI上某些操作必须依赖于最新的ETAG,采用这种方式可以让user同步的ETAG请求返回UI之前就能够进行操作,会造成state的inconsistency。

Key message we could find in the source code:

after sap.ca.ui.utils.busydialog.requireBusyDialog() is called in application, we can only see the rotating wheel in UI after 1.5 seconds - defined in BUSYDIALOG_TIMEOUT.

the requireBusyDialog and releaseBusyDialog must be called in pair. There is private variable _iRequiredCount maintained inside the implementation. When require function is called, _iRequiredCount++; release for _iRequiredCount–.

it is obsolete. New application should use sap.m.BusyDialog instead.

SAP CRM Fiori busy dialog的工作原理
SAP CRM Fiori busy dialog的工作原理
SAP CRM Fiori busy dialog的工作原理
SAP CRM Fiori busy dialog的工作原理

继续阅读