Merge lp:~stephen-stewart/snapweb/install-progress-ui into lp:~snappy-dev/snapweb/trunk

Proposed by Stephen Stewart on 2015-05-05
Status: Merged
Approved by: John Lenton on 2015-05-05
Approved revision: 156
Merged at revision: 114
Proposed branch: lp:~stephen-stewart/snapweb/install-progress-ui
Merge into: lp:~snappy-dev/snapweb/trunk
Prerequisite: lp:~stephen-stewart/snapweb/success-and-failure-messaging-view
Diff against target: 130 lines (+34/-7)
3 files modified
www/src/css/installer.css (+9/-5)
www/src/js/templates/snap-layout.hbs (+5/-1)
www/src/js/views/snap-layout.js (+20/-1)
To merge this branch: bzr merge lp:~stephen-stewart/snapweb/install-progress-ui
Reviewer Review Type Date Requested Status
John Lenton 2015-05-05 Approve on 2015-05-05
Review via email: mp+258267@code.launchpad.net

Commit Message

add progress ui for install/downloading

To post a comment you must log in.
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'www/src/css/install.css' => 'www/src/css/installer.css'
2--- www/src/css/install.css 2015-05-05 15:25:11 +0000
3+++ www/src/css/installer.css 2015-05-05 15:25:11 +0000
4@@ -1,5 +1,7 @@
5 .b-installer {
6- max-width:300px;
7+ position:relative;
8+ width:300px;
9+ padding-bottom:9px;
10 }
11
12 .b-installer__button {
13@@ -25,7 +27,9 @@
14 }
15
16 .b-installer--thinking .b-installer__button {
17+ background-color:transparent;
18 cursor:progress;
19+ color:#dd4814;
20 }
21
22 .b-installer__message {
23@@ -38,15 +42,14 @@
24 background: white;
25 border-radius:10px;
26 border:1px solid #dd4814;
27- bottom:3px;
28- box-sizing:border-box;
29+ bottom:0;
30 display:none;
31 height:5px;
32- left:8px;
33+ left:0;
34 margin:0;
35 padding:0;
36 position:absolute;
37- right:8px;
38+ right:0;
39 }
40
41 .b-installer__value {
42@@ -56,6 +59,7 @@
43 position:absolute;
44 right:100%;
45 top:0;
46+ transition: right 0.1s;
47 }
48
49 .b-installer--thinking .b-installer__progress {
50
51=== modified file 'www/src/js/templates/snap-layout.hbs'
52--- www/src/js/templates/snap-layout.hbs 2015-05-05 15:25:11 +0000
53+++ www/src/js/templates/snap-layout.hbs 2015-05-05 15:25:11 +0000
54@@ -9,12 +9,16 @@
55 <div class="b-snap__actions">
56 <div class="b-installer {{ installHTMLClass }}">
57 {{#if installActionString}}
58- <div class="b-installer__button">{{ installActionString }} {{ name }}</div>
59+ <div class="b-installer__button">{{ installActionString }}</div>
60+ <div class="b-installer__progress" title="download progress">
61+ <div class="b-installer__value"></div>
62+ </div>
63 {{/if}}
64 <div class="b-installer__message"></div>
65 </div>
66 </div>
67 </div>
68+<div class="b-installer__error">{{ message }}</div>
69
70 <div class="region-menu"></div>
71
72
73=== modified file 'www/src/js/views/snap-layout.js'
74--- www/src/js/views/snap-layout.js 2015-05-05 15:25:11 +0000
75+++ www/src/js/views/snap-layout.js 2015-05-05 15:25:11 +0000
76@@ -23,12 +23,25 @@
77 this.listenTo(
78 this.model, 'change:message', this.onModelError
79 );
80+ this.listenTo(
81+ this.model, 'change:progress', this.onProgressChange
82+ );
83 },
84
85 onShow: function() {
86 window.scrollTo(0, 0);
87 },
88
89+ onProgressChange: function(model) {
90+ var state = model.get('status');
91+ var progress;
92+
93+ if (state === CONF.INSTALL_STATE.INSTALLING) {
94+ progress = (100 - (model.get('progress') | 0)) + '%';
95+ this.ui.installerProgress.css('right', progress);
96+ }
97+ },
98+
99 onModelError: function(model) {
100 chan.command('alert:error', model);
101 },
102@@ -46,6 +59,9 @@
103 var installer = this.ui.installer;
104 var installerButton = this.ui.installerButton;
105
106+ // reset progress
107+ this.ui.installerProgress.css('right', '100%');
108+
109 if (_.contains(CONF.INSTALL_STATE, state)) {
110 installerButton.text(msg);
111 } else {
112@@ -76,6 +92,7 @@
113 statusMessage: '.b-installer__message',
114 installer: '.b-installer',
115 installerButton: '.b-installer__button',
116+ installerProgress: '.b-installer__value',
117 menu: '.b-snap__nav-item'
118 },
119
120@@ -117,7 +134,9 @@
121 this.model.set({
122 status: CONF.INSTALL_STATE.UNINSTALLING
123 });
124- this.model.destroy();
125+ this.model.destroy({
126+ dataType : 'html'
127+ });
128 } else if (status === CONF.INSTALL_STATE.UNINSTALLED) {
129 // install
130 this.model.save({

Subscribers

People subscribed via source and target branches