[settings] refactor root panel with AMD pattern

RESOLVED FIXED in 2.0 S3 (6june)

Status

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: gasolin, Assigned: arthurcc)

Tracking

unspecified
2.0 S3 (6june)
ARM
Gonk (Firefox OS)
Dependency tree / graph

Firefox Tracking Flags

(feature-b2g:2.0)

Details

(Whiteboard: [p=2])

Attachments

(1 attachment)

Overview Description:

Refactor root panel with AMD pattern referring to
https://github.com/crh0716/gaia/tree/settings2_iterative

to make it modularize and more easier to maintain

Steps to Reproduce:
1) run make test-perf APP=settings
2) run make test-integration APP=settings


Expected Results:

pass all settings test and act the same as original implementation

Additional Information:
Depends on bug 993948

* move out root panel from settings.js
* extract panel element from index.html
* wrap import js files
* add test cases
Depends on: 993948
Assignee: nobody → arthur.chen
Target Milestone: --- → 2.0 S2 (23may)
Whiteboard: [p=5]
Status: NEW → ASSIGNED
This patch simply moves the html elements of the root panel out of index.html and creates AMD modules for it. I will open subsequent bugs for converting the dependent scripts to AMD modules.
Attachment #8419315 - Flags: feedback?(gduan)
Attachment #8419315 - Flags: feedback?(gasolin)
Attachment #8419315 - Flags: feedback?(ejchen)
Whiteboard: [p=5] → [p=2]
Comment on attachment 8419315 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/19054

It currently breaks several test cases and ui test, please fix and rebase it.
Attachment #8419315 - Flags: feedback?(gasolin)
Blocks: 998847
Comment on attachment 8419315 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/19054

Tests fixed and rebased. Mind take a look at it again? Thanks!
Attachment #8419315 - Flags: feedback?(gasolin)
Comment on attachment 8419315 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/19054

looks good to me, thanks!
Attachment #8419315 - Flags: feedback?(gasolin) → feedback+
Comment on attachment 8419315 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/19054

Thanks Arthur,

please check my comments on Github to fix the problem about AsyncStorage !

Overall, it is good to me :)
Attachment #8419315 - Flags: feedback?(ejchen) → feedback+
Comment on attachment 8419315 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/19054

Hi Evelyn, this patch aims to separate the root panel in terms of UI (html file) and script loading. I kept the loading of the scripts used by the root panel in its own script. For the other scripts, if they are used by multiple panels (ex: utils.js), I moved them to main.js to make them get loaded upon the starting of the app. If they are only used by a specific panel (ex: mobile_operator.js is used only by the sim manager panel), I moved them to the html file of the panel.

Let me know if you need more information, thanks!
Attachment #8419315 - Flags: review?(ehung)
feature-b2g: --- → 2.0
Target Milestone: 2.0 S2 (23may) → 2.0 S3 (6june)
Comment on attachment 8419315 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/19054

r+ with a nit. The overall looks good, thanks! :)
Attachment #8419315 - Flags: review?(ehung) → review+
Thanks all for reviewing!

master: 72c2860e62cfbda9c5d21959d99daf0b44d92808
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
This also improved settings startup performance by 200ms on a flame!
The patch delayed the rendering of the root panel so the first paint event was triggered earlier. Not sure if it is a real performance improvement, ha.
You need to log in before you can comment on or make changes to this bug.