Closed Bug 973453 Opened 8 years ago Closed 7 years ago

[settings] refactor root panel with AMD pattern


(Firefox OS Graveyard :: Gaia::Settings, defect)

Gonk (Firefox OS)
Not set



2.0 S3 (6june)
feature-b2g 2.0


(Reporter: gasolin, Assigned: arthurcc)



(Whiteboard: [p=2])


(1 file)

Overview Description:

Refactor root panel with AMD pattern referring to

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]
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

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

Tests fixed and rebased. Mind take a look at it again? Thanks!
Attachment #8419315 - Flags: feedback?(gasolin)
Comment on attachment 8419315 [details]
Link to

looks good to me, thanks!
Attachment #8419315 - Flags: feedback?(gasolin) → feedback+
Comment on attachment 8419315 [details]
Link to

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

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

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

master: 72c2860e62cfbda9c5d21959d99daf0b44d92808
Closed: 7 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.