Merge lp:~stephen-stewart/snapweb/link-to-external-ui into lp:~snappy-dev/snapweb/trunk

Proposed by Stephen Stewart
Status: Merged
Approved by: Sergio Schvezov
Approved revision: 155
Merged at revision: 155
Proposed branch: lp:~stephen-stewart/snapweb/link-to-external-ui
Merge into: lp:~snappy-dev/snapweb/trunk
Diff against target: 184 lines (+69/-16)
7 files modified
www/src/css/snap.css (+10/-0)
www/src/images/external-link.svg (+1/-0)
www/src/js/models/snap.js (+17/-0)
www/src/js/templates/snap-menu.hbs (+5/-0)
www/src/js/views/snap-layout.js (+16/-13)
www/src/js/views/snap-menu.js (+6/-3)
www/tests/modelSpec.js (+14/-0)
To merge this branch: bzr merge lp:~stephen-stewart/snapweb/link-to-external-ui
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
Review via email: mp+260833@code.launchpad.net

Commit message

add a link to the service ui

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

Added a question inline.

One of the original requirements was to open directly if possible, this seems a bit better except for the text.

review: Needs Information
Revision history for this message
Stephen Stewart (stephen-stewart) wrote :

> Added a question inline.
>
> One of the original requirements was to open directly if possible, this seems
> a bit better except for the text.

I honestly don't know what to call this.

I have 2 pieces of information to work on:

1) What a user will find at the end of this link could literally be anything.
2) Claire reports that following discussion with dkirkland and sadfl this link shouldn't be promoted; that the user should not be using webdm to find this link, and that it should not be exposed at a higher level (say, in lists) and should not be given prominence.

So I came up with the weak and non descript 'service ui' :)

Revision history for this message
Stephen Stewart (stephen-stewart) wrote :

The unique way in which lp works means i have to type something in here and hit save.

155. By Stephen Stewart

new name, same great taste

Revision history for this message
Stephen Stewart (stephen-stewart) wrote :

12:14 < sergiusens> beowulf: maybe ogra_ has better words for it
12:15 < ogra_> for what ? renaming webdm ?
12:15 < sergiusens> ogra_: no, let me get a screenshot ;-)
12:15 < ogra_> (if i can open a browser without my laptop sutting down :P )
12:16 < ogra_> *shutting
12:17 < sergiusens> ogra_: http://imgur.com/grZ72cS
12:17 < beowulf> ogra_: in your webrtc snap, you define a ui port, in webdm we create a button for this
12:17 < sergiusens> the mouse is over "Service UI"
12:17 < beowulf> ogra_: what should that button say?
12:18 < beowulf> (talking buttons, who knew)
12:18 < ogra_> just "Open" ?
12:19 < ogra_> service Ui sounds confusingly as if i would access a configuration option there
12:19 < beowulf> ogra_: you might, in some snaps
12:19 < ogra_> (somehow like "Management UI")
12:20 < ogra_> well, then call it "Manage/Open" or some such ...
12:21 < beowulf> "Open" is actually open ended enough to cover all options, or about "Open $name"
12:21 < ogra_> its a bit tricky to find a unique name for a multi purpose button :)
12:21 < ogra_> yeah, i guess Open is the best here unless you want to indicate management/configuration can be accessed through it
12:22 < ogra_> but i guess thats up to the app

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/snap.css'
--- www/src/css/snap.css 2015-05-27 15:32:13 +0000
+++ www/src/css/snap.css 2015-06-03 11:33:26 +0000
@@ -52,6 +52,16 @@
52 padding:15px 0;52 padding:15px 0;
53}53}
5454
55.b-snap__nav-item[target="_blank"]::after {
56 content: '';
57 width:10px;
58 height:10px;
59 display:inline-block;
60 vertical-align:super;
61 background:transparent url("/public/images/external-link.svg") 0 0 no-repeat;
62 background-size:10px 10px;
63}
64
55.b-snap__nav-item_active::before {65.b-snap__nav-item_active::before {
56 position:absolute;66 position:absolute;
57 content:'';67 content:'';
5868
=== added file 'www/src/images/external-link.svg'
--- www/src/images/external-link.svg 1970-01-01 00:00:00 +0000
+++ www/src/images/external-link.svg 2015-06-03 11:33:26 +0000
@@ -0,0 +1,1 @@
1<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90"><path color="#000" fill="none" stroke-width="7.5" overflow="visible" enable-background="accumulate" d="M0 0h90v90H0z"/><path d="M33 13.012C8.994 13.042 6 13.747 6 31v36c0 18 3 18 30 18h12c27 0 30 0 30-18v-9h-9v6c0 12 0 12-24 12h-6c-24 0-24 0-24-12V34c0-10.864.192-11.885 18-11.982v-9.006z" fill="#808080"/><path color="#000" fill="none" stroke-width="6" overflow="visible" enable-background="accumulate" d="M0 0h90v90H0z"/><path d="M113.915 179.144c-.524.303-8.746-4.444-8.746-5.05 0-.605 8.22-5.352 8.744-5.05.525.304.525 9.797 0 10.1z" transform="matrix(-2.993 2.993 -3.111 -3.111 940.172 234.009)" xml:space="default" color="#000" fill="#808080" stroke-width="3" overflow="visible" enable-background="accumulate"/><path style="text-indent:0;text-align:start;line-height:normal;text-transform:none;block-progression:tb;-inkscape-font-specification:Sans" d="M56.426 24.633l-24.34 24.34 9.94 9.94 24.34-24.34z" xml:space="default" color="#000" fill="#808080" stroke-width="9" overflow="visible" enable-background="accumulate" font-family="Sans"/></svg>
0\ No newline at end of file2\ No newline at end of file
13
=== modified file 'www/src/js/models/snap.js'
--- www/src/js/models/snap.js 2015-06-01 16:27:13 +0000
+++ www/src/js/models/snap.js 2015-06-03 11:33:26 +0000
@@ -187,6 +187,7 @@
187 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers187 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers
188 'prettyDownloadSize',188 'prettyDownloadSize',
189 this.prettifyBytes(Number(response.download_size))189 this.prettifyBytes(Number(response.download_size))
190 //jscs:enable requireCamelCaseOrUpperCaseIdentifiers
190 );191 );
191 }192 }
192193
@@ -195,9 +196,25 @@
195 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers196 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers
196 'prettyInstalledSize',197 'prettyInstalledSize',
197 this.prettifyBytes(Number(response.installed_size))198 this.prettifyBytes(Number(response.installed_size))
199 //jscs:enable requireCamelCaseOrUpperCaseIdentifiers
198 );200 );
199 }201 }
200202
203 if (response.hasOwnProperty('ui_port')) {
204 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers
205 var port = response.ui_port;
206 //jscs:enable requireCamelCaseOrUpperCaseIdentifiers
207
208 if (_.isFinite(port) && port > 0) {
209
210 this.set('vendorGuiHref', window.location.protocol + '//' +
211 window.location.hostname + ':' + port + '/'
212 );
213 } else {
214 this.unset('vendorGuiHref');
215 }
216 }
217
201 return response;218 return response;
202 },219 },
203220
204221
=== modified file 'www/src/js/templates/snap-menu.hbs'
--- www/src/js/templates/snap-menu.hbs 2015-05-22 15:21:34 +0000
+++ www/src/js/templates/snap-menu.hbs 2015-06-03 11:33:26 +0000
@@ -8,4 +8,9 @@
8 <a class="b-snap__nav-item" href="settings">8 <a class="b-snap__nav-item" href="settings">
9 Settings9 Settings
10 </a>10 </a>
11 {{#if vendorGuiHref}}
12 <a class="b-snap__nav-item" href="{{vendorGuiHref}}" target="_blank">
13 Open / Manage
14 </a>
15 {{/if}}
11</div>16</div>
1217
=== modified file 'www/src/js/views/snap-layout.js'
--- www/src/js/views/snap-layout.js 2015-05-08 14:53:07 +0000
+++ www/src/js/views/snap-layout.js 2015-06-03 11:33:26 +0000
@@ -46,9 +46,10 @@
46 },46 },
4747
48 onBeforeShow: function() {48 onBeforeShow: function() {
49 var tabView = this._getSectionView(this.options.section);49 var tabView = this.getSectionView(this.options.section);
50 this.showChildView('menuRegion',50 this.showChildView('menuRegion',
51 new SnapMenuView({51 new SnapMenuView({
52 model: this.model,
52 section: this.options.section53 section: this.options.section
53 })54 })
54 );55 );
@@ -60,7 +61,7 @@
60 tabRegion: '.region-tab'61 tabRegion: '.region-tab'
61 },62 },
6263
63 _getSectionView: function(section) {64 getSectionView: function(section) {
64 var view;65 var view;
65 switch (section) {66 switch (section) {
66 case 'reviews':67 case 'reviews':
@@ -76,17 +77,19 @@
76 },77 },
7778
78 section: function(e) {79 section: function(e) {
79 e.preventDefault();80 if (!e.target.getAttribute('target')) {
80 var section = e.target.getAttribute('href');81 e.preventDefault();
81 var view = this._getSectionView(section);82 var section = e.target.getAttribute('href');
82 var name = this.model.get('id');83 var view = this.getSectionView(section);
83 // XXX url sane84 var name = this.model.get('id');
84 var url = 'snap/' + name + '/' + section;85 // XXX url sane
85 // if section is already in place, don't showChildView86 var url = 'snap/' + name + '/' + section;
86 var re = new RegExp('/' + section + '$', 'i');87 // if section is already in place, don't showChildView
87 if (!re.test(Backbone.history.fragment)) {88 var re = new RegExp('/' + section + '$', 'i');
88 this.showChildView('tabRegion', view);89 if (!re.test(Backbone.history.fragment)) {
89 Backbone.history.navigate(url);90 this.showChildView('tabRegion', view);
91 Backbone.history.navigate(url);
92 }
90 }93 }
91 }94 }
92});95});
9396
=== modified file 'www/src/js/views/snap-menu.js'
--- www/src/js/views/snap-menu.js 2015-05-08 20:03:48 +0000
+++ www/src/js/views/snap-menu.js 2015-06-03 11:33:26 +0000
@@ -17,13 +17,16 @@
17 'click': 'onNavClick'17 'click': 'onNavClick'
18 },18 },
1919
20 template: function() {20 template: function(model) {
21 return template();21 return template(model);
22 },22 },
2323
24 onNavClick: function(e) {24 onNavClick: function(e) {
25 var link = e.target.getAttribute('href');25 var link = e.target.getAttribute('href');
26 this.setActiveNav(link);26 if (!e.target.getAttribute('target')) {
27 e.preventDefault();
28 this.setActiveNav(link);
29 }
27 },30 },
2831
29 setActiveNav: function(link) {32 setActiveNav: function(link) {
3033
=== modified file 'www/tests/modelSpec.js'
--- www/tests/modelSpec.js 2015-06-01 22:09:08 +0000
+++ www/tests/modelSpec.js 2015-06-03 11:33:26 +0000
@@ -88,6 +88,20 @@
88 expect(this.model.get('prettyDownloadSize')).toBe('0 B');88 expect(this.model.get('prettyDownloadSize')).toBe('0 B');
89 });89 });
9090
91 it('should parse response to create vendorGuiHref', function() {
92 this.model.parse({'ui_port': 8080});
93 expect(this.model.get('vendorGuiHref')).toBe('http://localhost:8080/');
94 });
95
96 it('should not set vendorGuiHref if not a finite number', function() {
97 this.model.parse({'ui_port': NaN});
98 expect(this.model.get('vendorGuiHref')).not.toBeDefined();
99 this.model.parse({'ui_port': ''});
100 expect(this.model.get('vendorGuiHref')).not.toBeDefined();
101 this.model.parse({'ui_port': -9});
102 expect(this.model.get('vendorGuiHref')).not.toBeDefined();
103 });
104
91 });105 });
92106
93 describe('sync methods', function() {107 describe('sync methods', function() {

Subscribers

People subscribed via source and target branches