前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SAP CRM Fiori busy dialog的工作原理

SAP CRM Fiori busy dialog的工作原理

作者头像
Jerry Wang
发布2019-05-31 10:37:47
3780
发布2019-05-31 10:37:47
举报

版权声明:本文为博主汪子熙原创文章,未经博主允许不得转载。

为了更深入理解busy dialog,可以看附件两个视频。

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

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

  1. 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.
  2. 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–.
  3. it is obsolete. New application should use sap.m.BusyDialog instead.
clipboard1
clipboard1
clipboard2
clipboard2

Take the process to open Opportunity tile as example.

  1. The bindAggregation in S2.controller.js will trigger the Odata request sent to backend:
clipboard3
clipboard3

request url:

clipboard4
clipboard4

And connectionManager is responsible to call requireBusyDialog:

clipboard5
clipboard5

iRequiredCount changed from 0 to 1:

clipboard6
clipboard6
  1. OpportunityAttachment data is requested. ConnectionManager calls another requireBusyDialog, iRequiredCount changed from 1 tp 2:
clipboard7
clipboard7
clipboard8
clipboard8
  1. in detail view, ETAG refresh operations makes iRequiredCount changed from 2 to 3:
clipboard9
clipboard9
  1. At this time, the response of request in step1 has been returned to frontend, ConnectionManager calls releaseBusyDialog:
clipboard10
clipboard10

iRequiredCount changes from 3 to 2:

clipboard11
clipboard11

Since now iRequiredCount still > 0, the busyDialog will not be closed.

clipboard12
clipboard12
  1. the response for request in step2 is returnd, iRequiredCount changes from 2 to 1:
clipboard13
clipboard13
  1. the ETAG request sent in step3 has response now, iRequiredCount changes from 1 to 0:
clipboard14
clipboard14

now busy dialog is closed:

clipboard15
clipboard15
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年02月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档