Merge lp:~stephen-stewart/snapweb/handle-missing-response-in-parse into lp:~snappy-dev/snapweb/trunk

Proposed by Stephen Stewart
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 125
Merged at revision: 130
Proposed branch: lp:~stephen-stewart/snapweb/handle-missing-response-in-parse
Merge into: lp:~snappy-dev/snapweb/trunk
Diff against target: 84 lines (+18/-11)
4 files modified
www/src/css/alert.css (+6/-8)
www/src/css/layout.css (+1/-1)
www/src/js/behaviors/install.js (+1/-1)
www/src/js/models/snap.js (+10/-1)
To merge this branch: bzr merge lp:~stephen-stewart/snapweb/handle-missing-response-in-parse
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Review via email: mp+258518@code.launchpad.net

Commit message

the api doesn't always return what we expect, so fail by returning to last known state

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'www/src/css/alert.css'
--- www/src/css/alert.css 2015-05-05 11:20:39 +0000
+++ www/src/css/alert.css 2015-05-07 15:42:32 +0000
@@ -2,27 +2,25 @@
2 position: relative;2 position: relative;
3 width: 600px;3 width: 600px;
4 margin: 0 auto;4 margin: 0 auto;
5 background-color: rgb(255, 255, 255);5 background-color: #fff;
6 border-radius: 0px;
7 border: 4px solid #DADADA;6 border: 4px solid #DADADA;
8 padding: 1em 2em;7 padding: 1em 2em;
9 border-top: none;8 color: #333;
10 color: #dd4814;9 font-weight:400;
11 border-bottom-left-radius: 6px;10 border-radius:6px;
12 border-bottom-right-radius: 6px;
13}11}
1412
15.b-alert__close {13.b-alert__close {
16 position: absolute;14 position: absolute;
17 top: 0;15 top: 0;
18 right: 0;16 right: -3px;
19 font-size: 14px;17 font-size: 14px;
20 line-height: 1;18 line-height: 1;
21}19}
2220
23.b-alert__close a {21.b-alert__close a {
24 text-decoration:none;22 text-decoration:none;
25 color: #ccc;23 color: #333;
26 display:block;24 display:block;
27 width:40px;25 width:40px;
28 height:40px;26 height:40px;
2927
=== modified file 'www/src/css/layout.css'
--- www/src/css/layout.css 2015-05-05 11:20:39 +0000
+++ www/src/css/layout.css 2015-05-07 15:42:32 +0000
@@ -30,7 +30,7 @@
3030
31.b-layout__alerts {31.b-layout__alerts {
32 position: absolute;32 position: absolute;
33 top: 60px;33 top: 30px;
34 width: 100%;34 width: 100%;
35 z-index: 10000;35 z-index: 10000;
36}36}
3737
=== modified file 'www/src/js/behaviors/install.js'
--- www/src/js/behaviors/install.js 2015-05-06 18:57:26 +0000
+++ www/src/js/behaviors/install.js 2015-05-07 15:42:32 +0000
@@ -36,7 +36,7 @@
36 var installer = this.ui.installer;36 var installer = this.ui.installer;
37 var installerButton = this.ui.installerButton;37 var installerButton = this.ui.installerButton;
3838
39 // reset progress 39 // reset progress
40 this.ui.installerProgress.css('right', '100%');40 this.ui.installerProgress.css('right', '100%');
4141
42 if (_.contains(CONF.INSTALL_STATE, state)) {42 if (_.contains(CONF.INSTALL_STATE, state)) {
4343
=== modified file 'www/src/js/models/snap.js'
--- www/src/js/models/snap.js 2015-05-06 18:57:26 +0000
+++ www/src/js/models/snap.js 2015-05-07 15:42:32 +0000
@@ -46,7 +46,16 @@
46 });46 });
4747
48 this.on('error', function(model, response, opts) {48 this.on('error', function(model, response, opts) {
49 this.set(this.parse(response.responseJSON));49 var json = JSON.parse(response.responseText);
50 var previous = model.previousAttributes();
51 var message;
52 if (json && json.message) {
53 message = json.message;
54 } else {
55 message = 'Sorry, something went wrong :(';
56 }
57 previous.message = message;
58 model.set(previous);
50 chan.command('alert:error', model);59 chan.command('alert:error', model);
51 });60 });
5261

Subscribers

People subscribed via source and target branches