Merge lp:~stevenwilkin/snapweb/snappy-2-0 into lp:~snappy-dev/snapweb/trunk
- snappy-2-0
- Merge into trunk
Proposed by
Steven Wilkin
Status: | Merged |
---|---|
Approved by: | Steven Wilkin |
Approved revision: | 191 |
Merged at revision: | 180 |
Proposed branch: | lp:~stevenwilkin/snapweb/snappy-2-0 |
Merge into: | lp:~snappy-dev/snapweb/trunk |
Diff against target: |
1070 lines (+94/-394) 23 files modified
cmd/snappyd/handlers.go (+3/-3) dependencies.tsv (+1/-1) pkg/meta/snap.yaml (+1/-7) pkg/meta/snappyd.profile (+0/-110) pkg/meta/snappyd.seccomp (+0/-4) pkg/snappyd (+1/-2) snappy/common_test.go (+9/-71) snappy/converge.go (+12/-48) snappy/converge_test.go (+11/-53) snappy/handlers.go (+12/-12) snappy/handlers_test.go (+1/-1) snappy/icon.go (+5/-5) snappy/icon_test.go (+12/-12) snappy/snapd_client.go (+5/-6) statustracker/statustracker.go (+7/-11) statustracker/statustracker_test.go (+4/-4) www/src/css/snaplist.css (+4/-4) www/src/js/config.js (+1/-1) www/src/js/models/snap.js (+3/-18) www/src/js/templates/snap-menu.hbs (+0/-5) www/src/js/templates/snaplist-item.hbs (+1/-1) www/src/js/templates/storelist-item.hbs (+1/-1) www/tests/modelSpec.js (+0/-14) |
To merge this branch: | bzr merge lp:~stevenwilkin/snapweb/snappy-2-0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Vogt (community) | Approve | ||
Review via email: mp+292902@code.launchpad.net |
Commit message
Get WebDM building against Snappy 2.0
Description of the change
Get WebDM building against Snappy 2.0.
NOTE: the resulting snap will still need to be sideloaded with `--devmode`
To post a comment you must log in.
Revision history for this message
Steven Wilkin (stevenwilkin) : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'cmd/snappyd/handlers.go' | |||
2 | --- cmd/snappyd/handlers.go 2016-03-08 18:55:57 +0000 | |||
3 | +++ cmd/snappyd/handlers.go 2016-04-26 10:36:16 +0000 | |||
4 | @@ -53,7 +53,7 @@ | |||
5 | 53 | snappyHandler := snappy.NewHandler() | 53 | snappyHandler := snappy.NewHandler() |
6 | 54 | http.Handle("/api/v2/packages/", snappyHandler.MakeMuxer("/api/v2/packages")) | 54 | http.Handle("/api/v2/packages/", snappyHandler.MakeMuxer("/api/v2/packages")) |
7 | 55 | 55 | ||
9 | 56 | http.Handle("/public/", loggingHandler(http.FileServer(http.Dir("./www")))) | 56 | http.Handle("/public/", loggingHandler(http.FileServer(http.Dir(filepath.Join(os.Getenv("SNAP"), "www"))))) |
10 | 57 | 57 | ||
11 | 58 | if iconDir, relativePath, err := snappy.IconDir(); err == nil { | 58 | if iconDir, relativePath, err := snappy.IconDir(); err == nil { |
12 | 59 | http.Handle(fmt.Sprintf("/%s/", relativePath), loggingHandler(http.FileServer(http.Dir(filepath.Join(iconDir, ".."))))) | 59 | http.Handle(fmt.Sprintf("/%s/", relativePath), loggingHandler(http.FileServer(http.Dir(filepath.Join(iconDir, ".."))))) |
13 | @@ -95,13 +95,13 @@ | |||
14 | 95 | } | 95 | } |
15 | 96 | 96 | ||
16 | 97 | func renderLayout(html string, data *page, w http.ResponseWriter) error { | 97 | func renderLayout(html string, data *page, w http.ResponseWriter) error { |
18 | 98 | htmlPath := filepath.Join("www", "templates", html) | 98 | htmlPath := filepath.Join(os.Getenv("SNAP"), "www", "templates", html) |
19 | 99 | if _, err := os.Stat(htmlPath); err != nil { | 99 | if _, err := os.Stat(htmlPath); err != nil { |
20 | 100 | http.Error(w, err.Error(), http.StatusInternalServerError) | 100 | http.Error(w, err.Error(), http.StatusInternalServerError) |
21 | 101 | return err | 101 | return err |
22 | 102 | } | 102 | } |
23 | 103 | 103 | ||
25 | 104 | layoutPath := filepath.Join("www", "templates", "base.html") | 104 | layoutPath := filepath.Join(os.Getenv("SNAP"), "www", "templates", "base.html") |
26 | 105 | t, err := template.ParseFiles(layoutPath, htmlPath) | 105 | t, err := template.ParseFiles(layoutPath, htmlPath) |
27 | 106 | if err != nil { | 106 | if err != nil { |
28 | 107 | http.Error(w, err.Error(), http.StatusInternalServerError) | 107 | http.Error(w, err.Error(), http.StatusInternalServerError) |
29 | 108 | 108 | ||
30 | === modified file 'dependencies.tsv' | |||
31 | --- dependencies.tsv 2016-02-23 16:00:47 +0000 | |||
32 | +++ dependencies.tsv 2016-04-26 10:36:16 +0000 | |||
33 | @@ -7,7 +7,7 @@ | |||
34 | 7 | github.com/miekg/dns git 5a357a6fc5e85268b929350aa6423e2d56dcc4ff 2015-04-18T05:52:30Z | 7 | github.com/miekg/dns git 5a357a6fc5e85268b929350aa6423e2d56dcc4ff 2015-04-18T05:52:30Z |
35 | 8 | github.com/mvo5/goconfigparser git 26426272dda20cc76aa1fa44286dc743d2972fe8 2015-02-12T09:37:50Z | 8 | github.com/mvo5/goconfigparser git 26426272dda20cc76aa1fa44286dc743d2972fe8 2015-02-12T09:37:50Z |
36 | 9 | github.com/mvo5/uboot-go git 69978a3e4b05cca9d7cfee489b3453dfed45e72c 2015-07-23T08:17:10Z | 9 | github.com/mvo5/uboot-go git 69978a3e4b05cca9d7cfee489b3453dfed45e72c 2015-07-23T08:17:10Z |
38 | 10 | github.com/ubuntu-core/snappy git 5bcb20229bb884b85144eab0fe5db7aa05a27ebf 2016-02-23T14:04:06Z | 10 | github.com/ubuntu-core/snappy git 462812cfc390aff5bc2861320edba4cf34b740cf 2016-04-19T15:04:48Z |
39 | 11 | golang.org/x/crypto git 60052bd85f2d91293457e8811b0cf26b773de469 2015-06-22T23:34:07Z | 11 | golang.org/x/crypto git 60052bd85f2d91293457e8811b0cf26b773de469 2015-06-22T23:34:07Z |
40 | 12 | gopkg.in/check.v1 git 64131543e7896d5bcc6bd5a76287eb75ea96c673 2014-10-24T13:38:53Z | 12 | gopkg.in/check.v1 git 64131543e7896d5bcc6bd5a76287eb75ea96c673 2014-10-24T13:38:53Z |
41 | 13 | gopkg.in/yaml.v2 git 49c95bdc21843256fb6c4e0d370a05f24a0bf213 2015-02-24T22:57:58Z | 13 | gopkg.in/yaml.v2 git 49c95bdc21843256fb6c4e0d370a05f24a0bf213 2015-02-24T22:57:58Z |
42 | 14 | 14 | ||
43 | === modified file 'pkg/meta/snap.yaml' | |||
44 | --- pkg/meta/snap.yaml 2016-03-06 16:59:32 +0000 | |||
45 | +++ pkg/meta/snap.yaml 2016-04-26 10:36:16 +0000 | |||
46 | @@ -24,10 +24,4 @@ | |||
47 | 24 | daemon: simple | 24 | daemon: simple |
48 | 25 | description: Snappy WebDM | 25 | description: Snappy WebDM |
49 | 26 | command: snappyd | 26 | command: snappyd |
57 | 27 | plugs: [snappyd] | 27 | plugs: [network, network-bind, snapd-control] |
51 | 28 | plugs: | ||
52 | 29 | snappyd: | ||
53 | 30 | interface: old-security | ||
54 | 31 | security-policy: | ||
55 | 32 | apparmor: meta/snappyd.profile | ||
56 | 33 | seccomp: meta/snappyd.seccomp | ||
58 | 34 | 28 | ||
59 | === removed file 'pkg/meta/snappyd.profile' | |||
60 | --- pkg/meta/snappyd.profile 2016-01-27 14:16:35 +0000 | |||
61 | +++ pkg/meta/snappyd.profile 1970-01-01 00:00:00 +0000 | |||
62 | @@ -1,110 +0,0 @@ | |||
63 | 1 | #include <tunables/global> | ||
64 | 2 | |||
65 | 3 | ###VAR### | ||
66 | 4 | |||
67 | 5 | ###PROFILEATTACH### (attach_disconnected) { | ||
68 | 6 | #include <abstractions/base> | ||
69 | 7 | #include <abstractions/nameservice> | ||
70 | 8 | |||
71 | 9 | # Read-only for the install directory | ||
72 | 10 | @{CLICK_DIR}/@{APP_PKGNAME}/ r, | ||
73 | 11 | @{CLICK_DIR}/@{APP_PKGNAME}/@{APP_VERSION}/ r, | ||
74 | 12 | @{CLICK_DIR}/@{APP_PKGNAME}/@{APP_VERSION}/** mrklix, | ||
75 | 13 | |||
76 | 14 | # Writable home area | ||
77 | 15 | owner @{HOMEDIRS}/snaps/@{APP_PKGNAME}/@{APP_VERSION}/ rw, | ||
78 | 16 | owner @{HOMEDIRS}/snaps/@{APP_PKGNAME}/@{APP_VERSION}/** mrwklix, | ||
79 | 17 | |||
80 | 18 | # Read-only system area for other versions | ||
81 | 19 | /var/lib/snaps/@{APP_PKGNAME}/ rw, | ||
82 | 20 | /var/lib/snaps/@{APP_PKGNAME}/** mrkix, | ||
83 | 21 | |||
84 | 22 | # Writable system area only for this version. | ||
85 | 23 | /var/lib/snaps/@{APP_PKGNAME}/@{APP_VERSION}/ w, | ||
86 | 24 | /var/lib/snaps/@{APP_PKGNAME}/@{APP_VERSION}/** wl, | ||
87 | 25 | |||
88 | 26 | # temp dirs | ||
89 | 27 | /tmp/snaps/@{APP_PKGNAME}/ r, | ||
90 | 28 | /tmp/snaps/@{APP_PKGNAME}/** rk, | ||
91 | 29 | /tmp/snaps/@{APP_PKGNAME}/@{APP_VERSION}/ rw, | ||
92 | 30 | /tmp/snaps/@{APP_PKGNAME}/@{APP_VERSION}/** mrwlkix, | ||
93 | 31 | |||
94 | 32 | # magic script | ||
95 | 33 | /bin/uname ixr, | ||
96 | 34 | /usr/bin/basename ixr, | ||
97 | 35 | /usr/bin/realpath ixr, | ||
98 | 36 | /usr/bin/dirname ixr, | ||
99 | 37 | /bin/dash ixr, | ||
100 | 38 | /bin/sed ixr, | ||
101 | 39 | /bin/mkdir ixr, | ||
102 | 40 | |||
103 | 41 | @{PROC}/sys/kernel/hostname r, | ||
104 | 42 | @{PROC}/sys/kernel/somaxconn r, | ||
105 | 43 | @{PROC}/sys/net/core/somaxconn r, | ||
106 | 44 | |||
107 | 45 | # system image | ||
108 | 46 | /etc/system-image/channel.ini r, | ||
109 | 47 | /writable/cache/system/etc/system-image/channel.ini r, | ||
110 | 48 | |||
111 | 49 | # snaps | ||
112 | 50 | /snaps/ r, | ||
113 | 51 | /snaps/** rwl, | ||
114 | 52 | /gadget/ r, | ||
115 | 53 | /gadget/** rwl, | ||
116 | 54 | /tmp/ r, | ||
117 | 55 | /tmp/** rwl, | ||
118 | 56 | /var/lib/snaps/ r, | ||
119 | 57 | /var/lib/snaps/** rwl, | ||
120 | 58 | /var/lib/snappy/ r, | ||
121 | 59 | /var/lib/snappy/** rwl, | ||
122 | 60 | /var/lib/click/hooks/ r, | ||
123 | 61 | /var/lib/click/hooks/** rwl, | ||
124 | 62 | /home/ r, | ||
125 | 63 | /home/** r, | ||
126 | 64 | |||
127 | 65 | |||
128 | 66 | # snappy unpack | ||
129 | 67 | /usr/bin/snappy uxr, | ||
130 | 68 | |||
131 | 69 | # snappy tty change | ||
132 | 70 | /dev/tty r, | ||
133 | 71 | |||
134 | 72 | # snappy requirements | ||
135 | 73 | /bin/lsblk Uxr, | ||
136 | 74 | /bin/mountpoint Uxr, | ||
137 | 75 | /bin/cp Uxr, | ||
138 | 76 | /usr/bin/debsig-verify Uxr, | ||
139 | 77 | /usr/bin/sc-filtergen Uxr, | ||
140 | 78 | /usr/bin/aa-clickhook Uxr, | ||
141 | 79 | /usr/bin/aa-profile-hook Uxr, | ||
142 | 80 | |||
143 | 81 | # snapd REST API | ||
144 | 82 | /run/snapd.socket rw, | ||
145 | 83 | |||
146 | 84 | # TODO: attention needed here | ||
147 | 85 | /etc/lsb-release r, | ||
148 | 86 | /sbin/apparmor_parser Uxr, | ||
149 | 87 | /usr/bin/unsquashfs Uxr, | ||
150 | 88 | /usr/share/apparmor/easyprof/policygroups/** r, | ||
151 | 89 | /usr/share/apparmor/easyprof/templates/** r, | ||
152 | 90 | /usr/share/seccomp/policygroups/** r, | ||
153 | 91 | /usr/share/seccomp/templates/** r, | ||
154 | 92 | /var/cache/apparmor/** w, | ||
155 | 93 | |||
156 | 94 | # snappy requirements for services | ||
157 | 95 | /etc/dbus-1/system.d/ r, | ||
158 | 96 | /etc/dbus-1/system.d/** rwl, | ||
159 | 97 | /etc/mime.types r, | ||
160 | 98 | /usr/share/click/hooks/ r, | ||
161 | 99 | /usr/share/click/hooks/** r, | ||
162 | 100 | /etc/systemd/system/ r, | ||
163 | 101 | /etc/systemd/system/** rwl, | ||
164 | 102 | /var/lib/apparmor/clicks/ r, | ||
165 | 103 | /var/lib/apparmor/clicks/** rwl, | ||
166 | 104 | /var/lib/apparmor/snappy/ r, | ||
167 | 105 | /var/lib/apparmor/snappy/** rwl, | ||
168 | 106 | /bin/systemctl Uxr, | ||
169 | 107 | |||
170 | 108 | capability net_admin, | ||
171 | 109 | capability dac_override, | ||
172 | 110 | } | ||
173 | 111 | 0 | ||
174 | === removed file 'pkg/meta/snappyd.seccomp' | |||
175 | --- pkg/meta/snappyd.seccomp 2015-06-11 22:03:29 +0000 | |||
176 | +++ pkg/meta/snappyd.seccomp 1970-01-01 00:00:00 +0000 | |||
177 | @@ -1,4 +0,0 @@ | |||
178 | 1 | # This has to be unrestricted since snappyd will fork/exec /usr/bin/snappy for | ||
179 | 2 | # various things and seccomp would apply this policy to snappy and it then | ||
180 | 3 | # doesn't run well. Once there is a proper IPC service, this can be revisited. | ||
181 | 4 | @unrestricted | ||
182 | 5 | 0 | ||
183 | === modified file 'pkg/snappyd' | |||
184 | --- pkg/snappyd 2016-02-23 12:15:07 +0000 | |||
185 | +++ pkg/snappyd 2016-04-26 10:36:16 +0000 | |||
186 | @@ -18,8 +18,7 @@ | |||
187 | 18 | ;; | 18 | ;; |
188 | 19 | esac | 19 | esac |
189 | 20 | 20 | ||
192 | 21 | mkdir -m1777 -p $SNAP_APP_TMPDIR | 21 | exec $SNAP/bin/$plat_abi/snappyd |
191 | 22 | exec $SNAP_APP_PATH/bin/$plat_abi/snappyd | ||
193 | 23 | 22 | ||
194 | 24 | # never reach this | 23 | # never reach this |
195 | 25 | exit 1 | 24 | exit 1 |
196 | 26 | 25 | ||
197 | === modified file 'snappy/common_test.go' | |||
198 | --- snappy/common_test.go 2016-04-21 04:33:37 +0000 | |||
199 | +++ snappy/common_test.go 2016-04-26 10:36:16 +0000 | |||
200 | @@ -18,7 +18,6 @@ | |||
201 | 18 | package snappy | 18 | package snappy |
202 | 19 | 19 | ||
203 | 20 | import ( | 20 | import ( |
204 | 21 | "errors" | ||
205 | 22 | "testing" | 21 | "testing" |
206 | 23 | 22 | ||
207 | 24 | "github.com/ubuntu-core/snappy/client" | 23 | "github.com/ubuntu-core/snappy/client" |
208 | @@ -41,7 +40,7 @@ | |||
209 | 41 | Icon: "/1.0/icons/chatroom.ogra/icon", | 40 | Icon: "/1.0/icons/chatroom.ogra/icon", |
210 | 42 | InstalledSize: 18976651, | 41 | InstalledSize: 18976651, |
211 | 43 | Name: "chatroom", | 42 | Name: "chatroom", |
213 | 44 | Origin: "ogra", | 43 | Developer: "ogra", |
214 | 45 | Status: client.StatusActive, | 44 | Status: client.StatusActive, |
215 | 46 | Type: client.TypeApp, | 45 | Type: client.TypeApp, |
216 | 47 | Version: "0.1-8", | 46 | Version: "0.1-8", |
217 | @@ -55,7 +54,7 @@ | |||
218 | 55 | return snap | 54 | return snap |
219 | 56 | } | 55 | } |
220 | 57 | 56 | ||
222 | 58 | func (f *fakeSnapdClient) Icon(pkgID string) (*client.Icon, error) { | 57 | func (f *fakeSnapdClient) Icon(name string) (*client.Icon, error) { |
223 | 59 | icon := &client.Icon{ | 58 | icon := &client.Icon{ |
224 | 60 | Filename: "icon.png", | 59 | Filename: "icon.png", |
225 | 61 | Content: []byte("png"), | 60 | Content: []byte("png"), |
226 | @@ -63,86 +62,25 @@ | |||
227 | 63 | return icon, nil | 62 | return icon, nil |
228 | 64 | } | 63 | } |
229 | 65 | 64 | ||
235 | 66 | func (f *fakeSnapdClient) Services(pkg string) (map[string]*client.Service, error) { | 65 | func (f *fakeSnapdClient) Snap(name string) (*client.Snap, *client.ResultInfo, error) { |
231 | 67 | return nil, errors.New("the package has no services") | ||
232 | 68 | } | ||
233 | 69 | |||
234 | 70 | func (f *fakeSnapdClient) Snap(name string) (*client.Snap, error) { | ||
236 | 71 | if len(f.snaps) > 0 { | 66 | if len(f.snaps) > 0 { |
238 | 72 | return f.snaps[0], f.err | 67 | return f.snaps[0], nil, f.err |
239 | 73 | } | 68 | } |
241 | 74 | return nil, f.err | 69 | return nil, nil, f.err |
242 | 75 | } | 70 | } |
243 | 76 | 71 | ||
245 | 77 | func (f *fakeSnapdClient) FilterSnaps(filter client.SnapFilter) (map[string]*client.Snap, error) { | 72 | func (f *fakeSnapdClient) FilterSnaps(filter client.SnapFilter) ([]*client.Snap, *client.ResultInfo, error) { |
246 | 78 | f.filter = filter // record the filter used | 73 | f.filter = filter // record the filter used |
247 | 79 | 74 | ||
254 | 80 | snaps := make(map[string]*client.Snap) | 75 | return f.snaps, nil, f.err |
249 | 81 | for _, s := range f.snaps { | ||
250 | 82 | snaps[s.Name] = s | ||
251 | 83 | } | ||
252 | 84 | |||
253 | 85 | return snaps, f.err | ||
255 | 86 | } | 76 | } |
256 | 87 | 77 | ||
258 | 88 | func (f *fakeSnapdClient) AddSnap(name string) (string, error) { | 78 | func (f *fakeSnapdClient) Install(name string, options *client.SnapOptions) (string, error) { |
259 | 89 | return "", nil | 79 | return "", nil |
260 | 90 | } | 80 | } |
261 | 91 | 81 | ||
263 | 92 | func (f *fakeSnapdClient) RemoveSnap(name string) (string, error) { | 82 | func (f *fakeSnapdClient) Remove(name string, options *client.SnapOptions) (string, error) { |
264 | 93 | return "", nil | 83 | return "", nil |
265 | 94 | } | 84 | } |
266 | 95 | 85 | ||
267 | 96 | var _ snapdClient = (*fakeSnapdClient)(nil) | 86 | var _ snapdClient = (*fakeSnapdClient)(nil) |
268 | 97 | |||
269 | 98 | type fakeSnapdClientServicesNoExternalUI struct { | ||
270 | 99 | fakeSnapdClient | ||
271 | 100 | } | ||
272 | 101 | |||
273 | 102 | func (f *fakeSnapdClientServicesNoExternalUI) Services(pkg string) (map[string]*client.Service, error) { | ||
274 | 103 | internal := map[string]client.ServicePort{"ui": client.ServicePort{Port: "200/tcp"}} | ||
275 | 104 | external := map[string]client.ServicePort{"web": client.ServicePort{Port: "1024/tcp"}} | ||
276 | 105 | s1 := &client.Service{ | ||
277 | 106 | Spec: client.ServiceSpec{ | ||
278 | 107 | Ports: client.ServicePorts{ | ||
279 | 108 | Internal: internal, | ||
280 | 109 | External: external, | ||
281 | 110 | }, | ||
282 | 111 | }, | ||
283 | 112 | } | ||
284 | 113 | |||
285 | 114 | s2 := &client.Service{} | ||
286 | 115 | |||
287 | 116 | services := map[string]*client.Service{ | ||
288 | 117 | "s1": s1, | ||
289 | 118 | "s2": s2, | ||
290 | 119 | } | ||
291 | 120 | |||
292 | 121 | return services, nil | ||
293 | 122 | } | ||
294 | 123 | |||
295 | 124 | type fakeSnapdClientServicesExternalUI struct { | ||
296 | 125 | fakeSnapdClient | ||
297 | 126 | } | ||
298 | 127 | |||
299 | 128 | func (f *fakeSnapdClientServicesExternalUI) Services(pkg string) (map[string]*client.Service, error) { | ||
300 | 129 | s1 := &client.Service{} | ||
301 | 130 | |||
302 | 131 | internal := map[string]client.ServicePort{"ui": client.ServicePort{Port: "200/tcp"}} | ||
303 | 132 | external := map[string]client.ServicePort{"ui": client.ServicePort{Port: "1024/tcp"}} | ||
304 | 133 | s2 := &client.Service{ | ||
305 | 134 | Spec: client.ServiceSpec{ | ||
306 | 135 | Ports: client.ServicePorts{ | ||
307 | 136 | Internal: internal, | ||
308 | 137 | External: external, | ||
309 | 138 | }, | ||
310 | 139 | }, | ||
311 | 140 | } | ||
312 | 141 | |||
313 | 142 | services := map[string]*client.Service{ | ||
314 | 143 | "s1": s1, | ||
315 | 144 | "s2": s2, | ||
316 | 145 | } | ||
317 | 146 | |||
318 | 147 | return services, nil | ||
319 | 148 | } | ||
320 | 149 | 87 | ||
321 | === modified file 'snappy/converge.go' | |||
322 | --- snappy/converge.go 2016-04-21 04:33:37 +0000 | |||
323 | +++ snappy/converge.go 2016-04-26 10:36:16 +0000 | |||
324 | @@ -19,8 +19,6 @@ | |||
325 | 19 | 19 | ||
326 | 20 | import ( | 20 | import ( |
327 | 21 | "sort" | 21 | "sort" |
328 | 22 | "strconv" | ||
329 | 23 | "strings" | ||
330 | 24 | 22 | ||
331 | 25 | "log" | 23 | "log" |
332 | 26 | 24 | ||
333 | @@ -31,7 +29,7 @@ | |||
334 | 31 | type snapPkg struct { | 29 | type snapPkg struct { |
335 | 32 | ID string `json:"id"` | 30 | ID string `json:"id"` |
336 | 33 | Name string `json:"name"` | 31 | Name string `json:"name"` |
338 | 34 | Origin string `json:"origin"` | 32 | Developer string `json:"developer"` |
339 | 35 | Version string `json:"version"` | 33 | Version string `json:"version"` |
340 | 36 | Description string `json:"description"` | 34 | Description string `json:"description"` |
341 | 37 | Icon string `json:"icon"` | 35 | Icon string `json:"icon"` |
342 | @@ -41,7 +39,6 @@ | |||
343 | 41 | InstalledSize int64 `json:"installed_size,omitempty"` | 39 | InstalledSize int64 `json:"installed_size,omitempty"` |
344 | 42 | DownloadSize int64 `json:"download_size,omitempty"` | 40 | DownloadSize int64 `json:"download_size,omitempty"` |
345 | 43 | Type snap.Type `json:"type,omitempty"` | 41 | Type snap.Type `json:"type,omitempty"` |
346 | 44 | UIPort uint64 `json:"ui_port,omitempty"` | ||
347 | 45 | } | 42 | } |
348 | 46 | 43 | ||
349 | 47 | type response struct { | 44 | type response struct { |
350 | @@ -50,7 +47,7 @@ | |||
351 | 50 | } | 47 | } |
352 | 51 | 48 | ||
353 | 52 | func (h *Handler) packagePayload(resource string) (snapPkg, error) { | 49 | func (h *Handler) packagePayload(resource string) (snapPkg, error) { |
355 | 53 | snap, err := h.snapdClient.Snap(resource) | 50 | snap, _, err := h.snapdClient.Snap(resource) |
356 | 54 | if err != nil { | 51 | if err != nil { |
357 | 55 | return snapPkg{}, err | 52 | return snapPkg{}, err |
358 | 56 | } | 53 | } |
359 | @@ -59,7 +56,7 @@ | |||
360 | 59 | } | 56 | } |
361 | 60 | 57 | ||
362 | 61 | func (h *Handler) allPackages(filter client.SnapFilter) ([]snapPkg, error) { | 58 | func (h *Handler) allPackages(filter client.SnapFilter) ([]snapPkg, error) { |
364 | 62 | snaps, err := h.snapdClient.FilterSnaps(filter) | 59 | snaps, _, err := h.snapdClient.FilterSnaps(filter) |
365 | 63 | if err != nil { | 60 | if err != nil { |
366 | 64 | return nil, err | 61 | return nil, err |
367 | 65 | } | 62 | } |
368 | @@ -74,56 +71,45 @@ | |||
369 | 74 | return snapPkgs, nil | 71 | return snapPkgs, nil |
370 | 75 | } | 72 | } |
371 | 76 | 73 | ||
374 | 77 | func (h *Handler) removePackage(ID string) error { | 74 | func (h *Handler) removePackage(name string) error { |
375 | 78 | snap, err := h.snapdClient.Snap(ID) | 75 | snap, _, err := h.snapdClient.Snap(name) |
376 | 79 | if err != nil { | 76 | if err != nil { |
377 | 80 | return err | 77 | return err |
378 | 81 | } | 78 | } |
379 | 82 | 79 | ||
380 | 83 | h.statusTracker.TrackUninstall(snap) | 80 | h.statusTracker.TrackUninstall(snap) |
381 | 84 | 81 | ||
383 | 85 | _, err = h.snapdClient.RemoveSnap(ID) | 82 | _, err = h.snapdClient.Remove(name, nil) |
384 | 86 | return err | 83 | return err |
385 | 87 | } | 84 | } |
386 | 88 | 85 | ||
389 | 89 | func (h *Handler) installPackage(ID string) error { | 86 | func (h *Handler) installPackage(name string) error { |
390 | 90 | snap, err := h.snapdClient.Snap(ID) | 87 | snap, _, err := h.snapdClient.Snap(name) |
391 | 91 | if err != nil { | 88 | if err != nil { |
392 | 92 | return err | 89 | return err |
393 | 93 | } | 90 | } |
394 | 94 | 91 | ||
395 | 95 | h.statusTracker.TrackInstall(snap) | 92 | h.statusTracker.TrackInstall(snap) |
396 | 96 | 93 | ||
398 | 97 | _, err = h.snapdClient.AddSnap(ID) | 94 | _, err = h.snapdClient.Install(name, nil) |
399 | 98 | return err | 95 | return err |
400 | 99 | } | 96 | } |
401 | 100 | 97 | ||
402 | 101 | func hasPortInformation(snapQ *client.Snap) bool { | ||
403 | 102 | snapType := snap.Type(snapQ.Type) | ||
404 | 103 | return snapType == snap.TypeApp || snapType == snap.TypeFramework | ||
405 | 104 | } | ||
406 | 105 | |||
407 | 106 | func (h *Handler) snapToPayload(snapQ *client.Snap) snapPkg { | 98 | func (h *Handler) snapToPayload(snapQ *client.Snap) snapPkg { |
408 | 107 | snap := snapPkg{ | 99 | snap := snapPkg{ |
410 | 108 | ID: snapQ.Name + "." + snapQ.Origin, | 100 | ID: snapQ.Name, |
411 | 109 | Name: snapQ.Name, | 101 | Name: snapQ.Name, |
413 | 110 | Origin: snapQ.Origin, | 102 | Developer: snapQ.Developer, |
414 | 111 | Version: snapQ.Version, | 103 | Version: snapQ.Version, |
415 | 112 | Description: snapQ.Description, | 104 | Description: snapQ.Description, |
416 | 113 | Type: snap.Type(snapQ.Type), | 105 | Type: snap.Type(snapQ.Type), |
417 | 114 | Status: h.statusTracker.Status(snapQ), | 106 | Status: h.statusTracker.Status(snapQ), |
418 | 115 | } | 107 | } |
419 | 116 | 108 | ||
420 | 117 | if hasPortInformation(snapQ) { | ||
421 | 118 | if services, err := h.snapdClient.Services(snap.ID); err == nil { | ||
422 | 119 | snap.UIPort = uiAccess(services) | ||
423 | 120 | } | ||
424 | 121 | } | ||
425 | 122 | |||
426 | 123 | isInstalled := snapQ.Status == client.StatusInstalled || snapQ.Status == client.StatusActive | 109 | isInstalled := snapQ.Status == client.StatusInstalled || snapQ.Status == client.StatusActive |
427 | 124 | 110 | ||
428 | 125 | if isInstalled { | 111 | if isInstalled { |
430 | 126 | iconPath, err := localIconPath(h.snapdClient, snap.ID) | 112 | iconPath, err := localIconPath(h.snapdClient, snap.Name) |
431 | 127 | if err != nil { | 113 | if err != nil { |
432 | 128 | log.Println("Icon path for installed package cannot be set", err) | 114 | log.Println("Icon path for installed package cannot be set", err) |
433 | 129 | iconPath = "" | 115 | iconPath = "" |
434 | @@ -138,25 +124,3 @@ | |||
435 | 138 | 124 | ||
436 | 139 | return snap | 125 | return snap |
437 | 140 | } | 126 | } |
438 | 141 | |||
439 | 142 | func uiAccess(services map[string]*client.Service) uint64 { | ||
440 | 143 | for i := range services { | ||
441 | 144 | if services[i].Spec.Ports.External == nil { | ||
442 | 145 | continue | ||
443 | 146 | } | ||
444 | 147 | |||
445 | 148 | if ui, ok := services[i].Spec.Ports.External["ui"]; ok { | ||
446 | 149 | ui := strings.Split(ui.Port, "/") | ||
447 | 150 | if len(ui) == 2 { | ||
448 | 151 | port, err := strconv.ParseUint(ui[0], 0, 64) | ||
449 | 152 | if err != nil { | ||
450 | 153 | return 0 | ||
451 | 154 | } | ||
452 | 155 | |||
453 | 156 | return port | ||
454 | 157 | } | ||
455 | 158 | } | ||
456 | 159 | } | ||
457 | 160 | |||
458 | 161 | return 0 | ||
459 | 162 | } | ||
460 | 163 | 127 | ||
461 | === modified file 'snappy/converge_test.go' | |||
462 | --- snappy/converge_test.go 2016-03-08 18:30:48 +0000 | |||
463 | +++ snappy/converge_test.go 2016-04-26 10:36:16 +0000 | |||
464 | @@ -35,7 +35,7 @@ | |||
465 | 35 | var _ = Suite(&PackagePayloadSuite{}) | 35 | var _ = Suite(&PackagePayloadSuite{}) |
466 | 36 | 36 | ||
467 | 37 | func (s *PackagePayloadSuite) SetUpTest(c *C) { | 37 | func (s *PackagePayloadSuite) SetUpTest(c *C) { |
469 | 38 | os.Setenv("SNAP_APP_DATA_PATH", c.MkDir()) | 38 | os.Setenv("SNAP_DATA", c.MkDir()) |
470 | 39 | s.h.statusTracker = statustracker.New() | 39 | s.h.statusTracker = statustracker.New() |
471 | 40 | s.c = &fakeSnapdClient{} | 40 | s.c = &fakeSnapdClient{} |
472 | 41 | s.h.setClient(s.c) | 41 | s.h.setClient(s.c) |
473 | @@ -44,23 +44,23 @@ | |||
474 | 44 | func (s *PackagePayloadSuite) TestPackageNotFound(c *C) { | 44 | func (s *PackagePayloadSuite) TestPackageNotFound(c *C) { |
475 | 45 | s.c.err = errors.New("the snap could not be retrieved") | 45 | s.c.err = errors.New("the snap could not be retrieved") |
476 | 46 | 46 | ||
478 | 47 | _, err := s.h.packagePayload("chatroom.ogra") | 47 | _, err := s.h.packagePayload("chatroom") |
479 | 48 | c.Assert(err, NotNil) | 48 | c.Assert(err, NotNil) |
480 | 49 | } | 49 | } |
481 | 50 | 50 | ||
482 | 51 | func (s *PackagePayloadSuite) TestPackage(c *C) { | 51 | func (s *PackagePayloadSuite) TestPackage(c *C) { |
483 | 52 | s.c.snaps = []*client.Snap{newDefaultSnap()} | 52 | s.c.snaps = []*client.Snap{newDefaultSnap()} |
484 | 53 | 53 | ||
486 | 54 | pkg, err := s.h.packagePayload("chatroom.ogra") | 54 | pkg, err := s.h.packagePayload("chatroom") |
487 | 55 | c.Assert(err, IsNil) | 55 | c.Assert(err, IsNil) |
488 | 56 | c.Assert(pkg, DeepEquals, snapPkg{ | 56 | c.Assert(pkg, DeepEquals, snapPkg{ |
490 | 57 | ID: "chatroom.ogra", | 57 | ID: "chatroom", |
491 | 58 | Description: "WebRTC Video chat server for Snappy", | 58 | Description: "WebRTC Video chat server for Snappy", |
492 | 59 | DownloadSize: 0, | 59 | DownloadSize: 0, |
494 | 60 | Icon: "/icons/chatroom.ogra_icon.png", | 60 | Icon: "/icons/chatroom_icon.png", |
495 | 61 | InstalledSize: 18976651, | 61 | InstalledSize: 18976651, |
496 | 62 | Name: "chatroom", | 62 | Name: "chatroom", |
498 | 63 | Origin: "ogra", | 63 | Developer: "ogra", |
499 | 64 | Status: "installed", | 64 | Status: "installed", |
500 | 65 | Type: "app", | 65 | Type: "app", |
501 | 66 | Version: "0.1-8", | 66 | Version: "0.1-8", |
502 | @@ -74,12 +74,12 @@ | |||
503 | 74 | var _ = Suite(&PayloadSuite{}) | 74 | var _ = Suite(&PayloadSuite{}) |
504 | 75 | 75 | ||
505 | 76 | func (s *PayloadSuite) SetUpTest(c *C) { | 76 | func (s *PayloadSuite) SetUpTest(c *C) { |
507 | 77 | os.Setenv("SNAP_APP_DATA_PATH", c.MkDir()) | 77 | os.Setenv("SNAP_DATA", c.MkDir()) |
508 | 78 | s.h.statusTracker = statustracker.New() | 78 | s.h.statusTracker = statustracker.New() |
509 | 79 | s.h.setClient(&fakeSnapdClient{}) | 79 | s.h.setClient(&fakeSnapdClient{}) |
510 | 80 | } | 80 | } |
511 | 81 | 81 | ||
513 | 82 | func (s *PayloadSuite) TestPayloadWithNoServices(c *C) { | 82 | func (s *PayloadSuite) TestPayload(c *C) { |
514 | 83 | fakeSnap := newDefaultSnap() | 83 | fakeSnap := newDefaultSnap() |
515 | 84 | 84 | ||
516 | 85 | q := s.h.snapToPayload(fakeSnap) | 85 | q := s.h.snapToPayload(fakeSnap) |
517 | @@ -88,55 +88,13 @@ | |||
518 | 88 | c.Check(q.Version, Equals, fakeSnap.Version) | 88 | c.Check(q.Version, Equals, fakeSnap.Version) |
519 | 89 | c.Check(q.Status, Equals, statustracker.StatusInstalled) | 89 | c.Check(q.Status, Equals, statustracker.StatusInstalled) |
520 | 90 | c.Check(q.Type, Equals, snap.Type(fakeSnap.Type)) | 90 | c.Check(q.Type, Equals, snap.Type(fakeSnap.Type)) |
523 | 91 | c.Check(q.UIPort, Equals, uint64(0)) | 91 | c.Check(q.Icon, Equals, "/icons/chatroom_icon.png") |
522 | 92 | c.Check(q.Icon, Equals, "/icons/chatroom.ogra_icon.png") | ||
524 | 93 | c.Check(q.Description, Equals, fakeSnap.Description) | 92 | c.Check(q.Description, Equals, fakeSnap.Description) |
525 | 94 | } | 93 | } |
526 | 95 | 94 | ||
527 | 96 | func (s *PayloadSuite) TestPayloadWithServicesButNoUI(c *C) { | ||
528 | 97 | s.h.setClient(&fakeSnapdClientServicesNoExternalUI{}) | ||
529 | 98 | |||
530 | 99 | fakeSnap := newDefaultSnap() | ||
531 | 100 | q := s.h.snapToPayload(fakeSnap) | ||
532 | 101 | |||
533 | 102 | c.Assert(q.Name, Equals, fakeSnap.Name) | ||
534 | 103 | c.Assert(q.Version, Equals, fakeSnap.Version) | ||
535 | 104 | c.Assert(q.Status, Equals, statustracker.StatusInstalled) | ||
536 | 105 | c.Assert(q.Type, Equals, snap.Type(fakeSnap.Type)) | ||
537 | 106 | c.Assert(q.UIPort, Equals, uint64(0)) | ||
538 | 107 | } | ||
539 | 108 | |||
540 | 109 | func (s *PayloadSuite) TestPayloadWithServicesUI(c *C) { | ||
541 | 110 | s.h.setClient(&fakeSnapdClientServicesExternalUI{}) | ||
542 | 111 | |||
543 | 112 | fakeSnap := newDefaultSnap() | ||
544 | 113 | q := s.h.snapToPayload(fakeSnap) | ||
545 | 114 | |||
546 | 115 | c.Assert(q.Name, Equals, fakeSnap.Name) | ||
547 | 116 | c.Assert(q.Version, Equals, fakeSnap.Version) | ||
548 | 117 | c.Assert(q.Status, Equals, statustracker.StatusInstalled) | ||
549 | 118 | c.Assert(q.Type, Equals, snap.Type(fakeSnap.Type)) | ||
550 | 119 | c.Assert(q.UIPort, Equals, uint64(1024)) | ||
551 | 120 | } | ||
552 | 121 | |||
553 | 122 | func (s *PayloadSuite) TestPayloadTypeGadget(c *C) { | ||
554 | 123 | s.h.setClient(&fakeSnapdClientServicesExternalUI{}) | ||
555 | 124 | |||
556 | 125 | fakeSnap := newDefaultSnap() | ||
557 | 126 | fakeSnap.Type = string(snap.TypeGadget) | ||
558 | 127 | |||
559 | 128 | q := s.h.snapToPayload(fakeSnap) | ||
560 | 129 | |||
561 | 130 | c.Assert(q.Name, Equals, fakeSnap.Name) | ||
562 | 131 | c.Assert(q.Version, Equals, fakeSnap.Version) | ||
563 | 132 | c.Assert(q.Status, Equals, statustracker.StatusInstalled) | ||
564 | 133 | c.Assert(q.Type, Equals, snap.Type(fakeSnap.Type)) | ||
565 | 134 | c.Assert(q.UIPort, Equals, uint64(0)) | ||
566 | 135 | } | ||
567 | 136 | |||
568 | 137 | func (s *PayloadSuite) TestPayloadSnapInstalling(c *C) { | 95 | func (s *PayloadSuite) TestPayloadSnapInstalling(c *C) { |
569 | 138 | fakeSnap := newDefaultSnap() | 96 | fakeSnap := newDefaultSnap() |
571 | 139 | fakeSnap.Status = client.StatusNotInstalled | 97 | fakeSnap.Status = client.StatusAvailable |
572 | 140 | s.h.statusTracker.TrackInstall(fakeSnap) | 98 | s.h.statusTracker.TrackInstall(fakeSnap) |
573 | 141 | 99 | ||
574 | 142 | payload := s.h.snapToPayload(fakeSnap) | 100 | payload := s.h.snapToPayload(fakeSnap) |
575 | @@ -151,7 +109,7 @@ | |||
576 | 151 | var _ = Suite(&AllPackagesSuite{}) | 109 | var _ = Suite(&AllPackagesSuite{}) |
577 | 152 | 110 | ||
578 | 153 | func (s *AllPackagesSuite) SetUpTest(c *C) { | 111 | func (s *AllPackagesSuite) SetUpTest(c *C) { |
580 | 154 | os.Setenv("SNAP_APP_DATA_PATH", c.MkDir()) | 112 | os.Setenv("SNAP_DATA", c.MkDir()) |
581 | 155 | s.h.statusTracker = statustracker.New() | 113 | s.h.statusTracker = statustracker.New() |
582 | 156 | s.c = &fakeSnapdClient{} | 114 | s.c = &fakeSnapdClient{} |
583 | 157 | s.h.setClient(s.c) | 115 | s.h.setClient(s.c) |
584 | 158 | 116 | ||
585 | === modified file 'snappy/handlers.go' | |||
586 | --- snappy/handlers.go 2016-03-08 18:30:48 +0000 | |||
587 | +++ snappy/handlers.go 2016-04-26 10:36:16 +0000 | |||
588 | @@ -82,13 +82,13 @@ | |||
589 | 82 | w.Header().Set("Content-Type", "application/json") | 82 | w.Header().Set("Content-Type", "application/json") |
590 | 83 | // Get the Key. | 83 | // Get the Key. |
591 | 84 | vars := mux.Vars(r) | 84 | vars := mux.Vars(r) |
593 | 85 | resource := vars["id"] | 85 | name := vars["name"] |
594 | 86 | enc := json.NewEncoder(w) | 86 | enc := json.NewEncoder(w) |
595 | 87 | 87 | ||
597 | 88 | payload, err := h.packagePayload(resource) | 88 | payload, err := h.packagePayload(name) |
598 | 89 | if err != nil { | 89 | if err != nil { |
599 | 90 | w.WriteHeader(http.StatusNotFound) | 90 | w.WriteHeader(http.StatusNotFound) |
601 | 91 | enc.Encode(fmt.Sprintln(err, resource)) | 91 | enc.Encode(fmt.Sprintln(err, name)) |
602 | 92 | return | 92 | return |
603 | 93 | } | 93 | } |
604 | 94 | 94 | ||
605 | @@ -104,12 +104,12 @@ | |||
606 | 104 | w.Header().Set("Content-Type", "application/json") | 104 | w.Header().Set("Content-Type", "application/json") |
607 | 105 | // Get the Key. | 105 | // Get the Key. |
608 | 106 | vars := mux.Vars(r) | 106 | vars := mux.Vars(r) |
610 | 107 | ID := vars["id"] | 107 | name := vars["name"] |
611 | 108 | 108 | ||
613 | 109 | err := h.installPackage(ID) | 109 | err := h.installPackage(name) |
614 | 110 | msg, status := respond(err) | 110 | msg, status := respond(err) |
615 | 111 | 111 | ||
617 | 112 | response := response{Message: msg, Package: ID} | 112 | response := response{Message: msg, Package: name} |
618 | 113 | bs, err := json.Marshal(response) | 113 | bs, err := json.Marshal(response) |
619 | 114 | if err != nil { | 114 | if err != nil { |
620 | 115 | // giving up on json | 115 | // giving up on json |
621 | @@ -127,12 +127,12 @@ | |||
622 | 127 | w.Header().Set("Content-Type", "application/json") | 127 | w.Header().Set("Content-Type", "application/json") |
623 | 128 | // Get the Key. | 128 | // Get the Key. |
624 | 129 | vars := mux.Vars(r) | 129 | vars := mux.Vars(r) |
626 | 130 | ID := vars["id"] | 130 | name := vars["name"] |
627 | 131 | 131 | ||
629 | 132 | err := h.removePackage(ID) | 132 | err := h.removePackage(name) |
630 | 133 | msg, status := respond(err) | 133 | msg, status := respond(err) |
631 | 134 | 134 | ||
633 | 135 | response := response{Message: msg, Package: ID} | 135 | response := response{Message: msg, Package: name} |
634 | 136 | bs, err := json.Marshal(response) | 136 | bs, err := json.Marshal(response) |
635 | 137 | if err != nil { | 137 | if err != nil { |
636 | 138 | // giving up on json | 138 | // giving up on json |
637 | @@ -180,13 +180,13 @@ | |||
638 | 180 | m.HandleFunc("/", h.getAll).Methods("GET") | 180 | m.HandleFunc("/", h.getAll).Methods("GET") |
639 | 181 | 181 | ||
640 | 182 | // get specific package | 182 | // get specific package |
642 | 183 | m.HandleFunc("/{id}", h.get).Methods("GET") | 183 | m.HandleFunc("/{name}", h.get).Methods("GET") |
643 | 184 | 184 | ||
644 | 185 | // Add a package | 185 | // Add a package |
646 | 186 | m.HandleFunc("/{id}", h.add).Methods("PUT") | 186 | m.HandleFunc("/{name}", h.add).Methods("PUT") |
647 | 187 | 187 | ||
648 | 188 | // Remove a package | 188 | // Remove a package |
650 | 189 | m.HandleFunc("/{id}", h.remove).Methods("DELETE") | 189 | m.HandleFunc("/{name}", h.remove).Methods("DELETE") |
651 | 190 | 190 | ||
652 | 191 | return m | 191 | return m |
653 | 192 | } | 192 | } |
654 | 193 | 193 | ||
655 | === modified file 'snappy/handlers_test.go' | |||
656 | --- snappy/handlers_test.go 2016-03-08 18:30:48 +0000 | |||
657 | +++ snappy/handlers_test.go 2016-04-26 10:36:16 +0000 | |||
658 | @@ -35,7 +35,7 @@ | |||
659 | 35 | var _ = Suite(&HandlersSuite{}) | 35 | var _ = Suite(&HandlersSuite{}) |
660 | 36 | 36 | ||
661 | 37 | func (s *HandlersSuite) SetUpTest(c *C) { | 37 | func (s *HandlersSuite) SetUpTest(c *C) { |
663 | 38 | os.Setenv("SNAP_APP_DATA_PATH", c.MkDir()) | 38 | os.Setenv("SNAP_DATA", c.MkDir()) |
664 | 39 | s.c = &fakeSnapdClient{} | 39 | s.c = &fakeSnapdClient{} |
665 | 40 | s.h.setClient(s.c) | 40 | s.h.setClient(s.c) |
666 | 41 | } | 41 | } |
667 | 42 | 42 | ||
668 | === modified file 'snappy/icon.go' | |||
669 | --- snappy/icon.go 2016-01-27 14:16:35 +0000 | |||
670 | +++ snappy/icon.go 2016-04-26 10:36:16 +0000 | |||
671 | @@ -26,7 +26,7 @@ | |||
672 | 26 | ) | 26 | ) |
673 | 27 | 27 | ||
674 | 28 | var ( | 28 | var ( |
676 | 29 | // ErrDataPathNotSet indicates that SNAP_APP_DATA_PATH has not been set by the | 29 | // ErrDataPathNotSet indicates that SNAP_DATA has not been set by the |
677 | 30 | // launching system. | 30 | // launching system. |
678 | 31 | ErrDataPathNotSet = errors.New("package data path not set") | 31 | ErrDataPathNotSet = errors.New("package data path not set") |
679 | 32 | // ErrOnIconDataPathSet indicates that there has been an error when setting up | 32 | // ErrOnIconDataPathSet indicates that there has been an error when setting up |
680 | @@ -36,18 +36,18 @@ | |||
681 | 36 | ErrIconNotExist = errors.New("the icon does not exist") | 36 | ErrIconNotExist = errors.New("the icon does not exist") |
682 | 37 | ) | 37 | ) |
683 | 38 | 38 | ||
685 | 39 | func localIconPath(c snapdClient, ID string) (relativePath string, err error) { | 39 | func localIconPath(c snapdClient, name string) (relativePath string, err error) { |
686 | 40 | dataPath, relativePath, err := IconDir() | 40 | dataPath, relativePath, err := IconDir() |
687 | 41 | if err != nil { | 41 | if err != nil { |
688 | 42 | return "", err | 42 | return "", err |
689 | 43 | } | 43 | } |
690 | 44 | 44 | ||
692 | 45 | icon, err := c.Icon(ID) | 45 | icon, err := c.Icon(name) |
693 | 46 | if err != nil { | 46 | if err != nil { |
694 | 47 | return "", ErrIconNotExist | 47 | return "", ErrIconNotExist |
695 | 48 | } | 48 | } |
696 | 49 | 49 | ||
698 | 50 | baseIcon := fmt.Sprintf("%s_%s", ID, icon.Filename) | 50 | baseIcon := fmt.Sprintf("%s_%s", name, icon.Filename) |
699 | 51 | 51 | ||
700 | 52 | relativePath = filepath.Join(relativePath, baseIcon) | 52 | relativePath = filepath.Join(relativePath, baseIcon) |
701 | 53 | iconDstPath := filepath.Join(dataPath, baseIcon) | 53 | iconDstPath := filepath.Join(dataPath, baseIcon) |
702 | @@ -67,7 +67,7 @@ | |||
703 | 67 | 67 | ||
704 | 68 | // IconDir returns information to properly serve package icons with an http.FileServer | 68 | // IconDir returns information to properly serve package icons with an http.FileServer |
705 | 69 | func IconDir() (dataPath, relativeBasePath string, err error) { | 69 | func IconDir() (dataPath, relativeBasePath string, err error) { |
707 | 70 | dataPath = os.Getenv("SNAP_APP_DATA_PATH") | 70 | dataPath = os.Getenv("SNAP_DATA") |
708 | 71 | if dataPath == "" { | 71 | if dataPath == "" { |
709 | 72 | return "", "", ErrDataPathNotSet | 72 | return "", "", ErrDataPathNotSet |
710 | 73 | } | 73 | } |
711 | 74 | 74 | ||
712 | === modified file 'snappy/icon_test.go' | |||
713 | --- snappy/icon_test.go 2016-01-27 14:16:35 +0000 | |||
714 | +++ snappy/icon_test.go 2016-04-26 10:36:16 +0000 | |||
715 | @@ -36,7 +36,7 @@ | |||
716 | 36 | 36 | ||
717 | 37 | func (s *IconSuite) SetUpTest(c *C) { | 37 | func (s *IconSuite) SetUpTest(c *C) { |
718 | 38 | s.dataPath = c.MkDir() | 38 | s.dataPath = c.MkDir() |
720 | 39 | os.Setenv("SNAP_APP_DATA_PATH", s.dataPath) | 39 | os.Setenv("SNAP_DATA", s.dataPath) |
721 | 40 | } | 40 | } |
722 | 41 | 41 | ||
723 | 42 | func (s *IconSuite) TestIconDir(c *C) { | 42 | func (s *IconSuite) TestIconDir(c *C) { |
724 | @@ -47,7 +47,7 @@ | |||
725 | 47 | } | 47 | } |
726 | 48 | 48 | ||
727 | 49 | func (s *IconSuite) TestNoSnapAppDataPathCausesError(c *C) { | 49 | func (s *IconSuite) TestNoSnapAppDataPathCausesError(c *C) { |
729 | 50 | os.Setenv("SNAP_APP_DATA_PATH", "") | 50 | os.Setenv("SNAP_DATA", "") |
730 | 51 | _, _, err := IconDir() | 51 | _, _, err := IconDir() |
731 | 52 | c.Assert(err, Equals, ErrDataPathNotSet) | 52 | c.Assert(err, Equals, ErrDataPathNotSet) |
732 | 53 | } | 53 | } |
733 | @@ -55,7 +55,7 @@ | |||
734 | 55 | func (s *IconSuite) TestIconDirCreateFails(c *C) { | 55 | func (s *IconSuite) TestIconDirCreateFails(c *C) { |
735 | 56 | fileAsDir := filepath.Join(s.dataPath, "badDataPath") | 56 | fileAsDir := filepath.Join(s.dataPath, "badDataPath") |
736 | 57 | c.Assert(ioutil.WriteFile(fileAsDir, []byte{}, 0644), IsNil) | 57 | c.Assert(ioutil.WriteFile(fileAsDir, []byte{}, 0644), IsNil) |
738 | 58 | os.Setenv("SNAP_APP_DATA_PATH", fileAsDir) | 58 | os.Setenv("SNAP_DATA", fileAsDir) |
739 | 59 | _, _, err := IconDir() | 59 | _, _, err := IconDir() |
740 | 60 | c.Assert(err, Equals, ErrOnIconDataPathSet) | 60 | c.Assert(err, Equals, ErrOnIconDataPathSet) |
741 | 61 | } | 61 | } |
742 | @@ -66,7 +66,7 @@ | |||
743 | 66 | err error | 66 | err error |
744 | 67 | } | 67 | } |
745 | 68 | 68 | ||
747 | 69 | func (s *IconPathSuite) Icon(pkgID string) (*client.Icon, error) { | 69 | func (s *IconPathSuite) Icon(name string) (*client.Icon, error) { |
748 | 70 | icon := &client.Icon{ | 70 | icon := &client.Icon{ |
749 | 71 | Filename: "pkgIcon.png", | 71 | Filename: "pkgIcon.png", |
750 | 72 | Content: []byte("png"), | 72 | Content: []byte("png"), |
751 | @@ -78,14 +78,14 @@ | |||
752 | 78 | 78 | ||
753 | 79 | func (s *IconPathSuite) SetUpTest(c *C) { | 79 | func (s *IconPathSuite) SetUpTest(c *C) { |
754 | 80 | s.dataPath = c.MkDir() | 80 | s.dataPath = c.MkDir() |
756 | 81 | os.Setenv("SNAP_APP_DATA_PATH", s.dataPath) | 81 | os.Setenv("SNAP_DATA", s.dataPath) |
757 | 82 | s.err = nil | 82 | s.err = nil |
758 | 83 | } | 83 | } |
759 | 84 | 84 | ||
760 | 85 | func (s *IconPathSuite) TestIconCopy(c *C) { | 85 | func (s *IconPathSuite) TestIconCopy(c *C) { |
762 | 86 | relativePath, err := localIconPath(s, "mypackage.sergiusens") | 86 | relativePath, err := localIconPath(s, "mypackage") |
763 | 87 | c.Assert(err, IsNil) | 87 | c.Assert(err, IsNil) |
765 | 88 | iconBaseName := "icons/mypackage.sergiusens_pkgIcon.png" | 88 | iconBaseName := "icons/mypackage_pkgIcon.png" |
766 | 89 | c.Check(relativePath, Equals, filepath.Join("/", iconBaseName)) | 89 | c.Check(relativePath, Equals, filepath.Join("/", iconBaseName)) |
767 | 90 | 90 | ||
768 | 91 | contents, err := ioutil.ReadFile(filepath.Join(s.dataPath, iconBaseName)) | 91 | contents, err := ioutil.ReadFile(filepath.Join(s.dataPath, iconBaseName)) |
769 | @@ -95,23 +95,23 @@ | |||
770 | 95 | } | 95 | } |
771 | 96 | 96 | ||
772 | 97 | func (s *IconPathSuite) TestIconCopyNoDataPath(c *C) { | 97 | func (s *IconPathSuite) TestIconCopyNoDataPath(c *C) { |
775 | 98 | os.Setenv("SNAP_APP_DATA_PATH", "") | 98 | os.Setenv("SNAP_DATA", "") |
776 | 99 | _, err := localIconPath(s, "mypackage.sergiusens") | 99 | _, err := localIconPath(s, "mypackage") |
777 | 100 | c.Assert(err, Equals, ErrDataPathNotSet) | 100 | c.Assert(err, Equals, ErrDataPathNotSet) |
778 | 101 | } | 101 | } |
779 | 102 | 102 | ||
780 | 103 | func (s *IconPathSuite) TestIconCopyNoIcon(c *C) { | 103 | func (s *IconPathSuite) TestIconCopyNoIcon(c *C) { |
781 | 104 | s.err = errors.New("Not Found") | 104 | s.err = errors.New("Not Found") |
783 | 105 | _, err := localIconPath(s, "mypackage.sergiusens") | 105 | _, err := localIconPath(s, "mypackage") |
784 | 106 | c.Assert(err, Equals, ErrIconNotExist) | 106 | c.Assert(err, Equals, ErrIconNotExist) |
785 | 107 | } | 107 | } |
786 | 108 | 108 | ||
787 | 109 | func (s *IconPathSuite) TestIconCopyTargetIconExists(c *C) { | 109 | func (s *IconPathSuite) TestIconCopyTargetIconExists(c *C) { |
789 | 110 | iconBaseName := "icons/mypackage.sergiusens_pkgIcon.png" | 110 | iconBaseName := "icons/mypackage_pkgIcon.png" |
790 | 111 | c.Assert(os.MkdirAll(filepath.Join(s.dataPath, "icons"), 0755), IsNil) | 111 | c.Assert(os.MkdirAll(filepath.Join(s.dataPath, "icons"), 0755), IsNil) |
791 | 112 | c.Assert(ioutil.WriteFile(filepath.Join(s.dataPath, iconBaseName), []byte{}, 0644), IsNil) | 112 | c.Assert(ioutil.WriteFile(filepath.Join(s.dataPath, iconBaseName), []byte{}, 0644), IsNil) |
792 | 113 | 113 | ||
794 | 114 | relativePath, err := localIconPath(s, "mypackage.sergiusens") | 114 | relativePath, err := localIconPath(s, "mypackage") |
795 | 115 | c.Assert(err, IsNil) | 115 | c.Assert(err, IsNil) |
796 | 116 | c.Check(relativePath, Equals, filepath.Join("/", iconBaseName)) | 116 | c.Check(relativePath, Equals, filepath.Join("/", iconBaseName)) |
797 | 117 | } | 117 | } |
798 | 118 | 118 | ||
799 | === modified file 'snappy/snapd_client.go' | |||
800 | --- snappy/snapd_client.go 2016-04-21 04:33:37 +0000 | |||
801 | +++ snappy/snapd_client.go 2016-04-26 10:36:16 +0000 | |||
802 | @@ -22,10 +22,9 @@ | |||
803 | 22 | ) | 22 | ) |
804 | 23 | 23 | ||
805 | 24 | type snapdClient interface { | 24 | type snapdClient interface { |
812 | 25 | Icon(pkgID string) (*client.Icon, error) | 25 | Icon(name string) (*client.Icon, error) |
813 | 26 | Services(pkg string) (map[string]*client.Service, error) | 26 | Snap(name string) (*client.Snap, *client.ResultInfo, error) |
814 | 27 | Snap(name string) (*client.Snap, error) | 27 | FilterSnaps(filter client.SnapFilter) ([]*client.Snap, *client.ResultInfo, error) |
815 | 28 | FilterSnaps(filter client.SnapFilter) (map[string]*client.Snap, error) | 28 | Install(name string, options *client.SnapOptions) (string, error) |
816 | 29 | AddSnap(name string) (string, error) | 29 | Remove(name string, options *client.SnapOptions) (string, error) |
811 | 30 | RemoveSnap(name string) (string, error) | ||
817 | 31 | } | 30 | } |
818 | 32 | 31 | ||
819 | === modified file 'statustracker/statustracker.go' | |||
820 | --- statustracker/statustracker.go 2016-03-08 18:30:49 +0000 | |||
821 | +++ statustracker/statustracker.go 2016-04-26 10:36:16 +0000 | |||
822 | @@ -62,13 +62,13 @@ | |||
823 | 62 | s.Lock() | 62 | s.Lock() |
824 | 63 | defer s.Unlock() | 63 | defer s.Unlock() |
825 | 64 | 64 | ||
827 | 65 | status, ok := s.statuses[snapID(snap)] | 65 | status, ok := s.statuses[snap.Name] |
828 | 66 | if !ok { | 66 | if !ok { |
829 | 67 | return translateStatus(snap) | 67 | return translateStatus(snap) |
830 | 68 | } | 68 | } |
831 | 69 | 69 | ||
832 | 70 | if hasCompleted(status, snap) { | 70 | if hasCompleted(status, snap) { |
834 | 71 | delete(s.statuses, snapID(snap)) | 71 | delete(s.statuses, snap.Name) |
835 | 72 | return translateStatus(snap) | 72 | return translateStatus(snap) |
836 | 73 | } | 73 | } |
837 | 74 | 74 | ||
838 | @@ -81,19 +81,19 @@ | |||
839 | 81 | return | 81 | return |
840 | 82 | } | 82 | } |
841 | 83 | 83 | ||
843 | 84 | s.trackOperation(snapID(snap), StatusInstalling) | 84 | s.trackOperation(snap.Name, StatusInstalling) |
844 | 85 | } | 85 | } |
845 | 86 | 86 | ||
847 | 87 | func (s *StatusTracker) trackOperation(id, operation string) { | 87 | func (s *StatusTracker) trackOperation(name, operation string) { |
848 | 88 | s.Lock() | 88 | s.Lock() |
849 | 89 | defer s.Unlock() | 89 | defer s.Unlock() |
850 | 90 | 90 | ||
852 | 91 | s.statuses[id] = operation | 91 | s.statuses[name] = operation |
853 | 92 | 92 | ||
854 | 93 | go func() { | 93 | go func() { |
855 | 94 | <-time.After(trackerDuration) | 94 | <-time.After(trackerDuration) |
856 | 95 | s.Lock() | 95 | s.Lock() |
858 | 96 | delete(s.statuses, id) | 96 | delete(s.statuses, name) |
859 | 97 | s.Unlock() | 97 | s.Unlock() |
860 | 98 | }() | 98 | }() |
861 | 99 | } | 99 | } |
862 | @@ -104,11 +104,7 @@ | |||
863 | 104 | return | 104 | return |
864 | 105 | } | 105 | } |
865 | 106 | 106 | ||
871 | 107 | s.trackOperation(snapID(snap), StatusUninstalling) | 107 | s.trackOperation(snap.Name, StatusUninstalling) |
867 | 108 | } | ||
868 | 109 | |||
869 | 110 | func snapID(s *client.Snap) string { | ||
870 | 111 | return s.Name + "." + s.Origin | ||
872 | 112 | } | 108 | } |
873 | 113 | 109 | ||
874 | 114 | func isInstalled(s *client.Snap) bool { | 110 | func isInstalled(s *client.Snap) bool { |
875 | 115 | 111 | ||
876 | === modified file 'statustracker/statustracker_test.go' | |||
877 | --- statustracker/statustracker_test.go 2016-04-21 06:03:28 +0000 | |||
878 | +++ statustracker/statustracker_test.go 2016-04-26 10:36:16 +0000 | |||
879 | @@ -45,7 +45,7 @@ | |||
880 | 45 | }{ | 45 | }{ |
881 | 46 | {client.StatusInstalled, StatusInstalled}, | 46 | {client.StatusInstalled, StatusInstalled}, |
882 | 47 | {client.StatusActive, StatusInstalled}, | 47 | {client.StatusActive, StatusInstalled}, |
884 | 48 | {client.StatusNotInstalled, StatusUninstalled}, | 48 | {client.StatusAvailable, StatusUninstalled}, |
885 | 49 | {client.StatusRemoved, StatusUninstalled}, | 49 | {client.StatusRemoved, StatusUninstalled}, |
886 | 50 | } | 50 | } |
887 | 51 | 51 | ||
888 | @@ -85,7 +85,7 @@ | |||
889 | 85 | } | 85 | } |
890 | 86 | 86 | ||
891 | 87 | func (s *StatusTrackerSuite) TestTrackInstall(c *C) { | 87 | func (s *StatusTrackerSuite) TestTrackInstall(c *C) { |
893 | 88 | snap := &client.Snap{Status: client.StatusNotInstalled} | 88 | snap := &client.Snap{Status: client.StatusAvailable} |
894 | 89 | s.t.TrackInstall(snap) | 89 | s.t.TrackInstall(snap) |
895 | 90 | c.Assert(s.t.Status(snap), Equals, StatusInstalling) | 90 | c.Assert(s.t.Status(snap), Equals, StatusInstalling) |
896 | 91 | // installation completes | 91 | // installation completes |
897 | @@ -96,7 +96,7 @@ | |||
898 | 96 | func (s *StatusTrackerSuite) TestTrackInstallExpiry(c *C) { | 96 | func (s *StatusTrackerSuite) TestTrackInstallExpiry(c *C) { |
899 | 97 | trackerDuration = 200 * time.Millisecond | 97 | trackerDuration = 200 * time.Millisecond |
900 | 98 | 98 | ||
902 | 99 | snap := &client.Snap{Status: client.StatusNotInstalled} | 99 | snap := &client.Snap{Status: client.StatusAvailable} |
903 | 100 | s.t.TrackInstall(snap) | 100 | s.t.TrackInstall(snap) |
904 | 101 | c.Assert(s.t.Status(snap), Equals, StatusInstalling) | 101 | c.Assert(s.t.Status(snap), Equals, StatusInstalling) |
905 | 102 | 102 | ||
906 | @@ -106,7 +106,7 @@ | |||
907 | 106 | } | 106 | } |
908 | 107 | 107 | ||
909 | 108 | func (s *StatusTrackerSuite) TestTrackUninstallNotInstalled(c *C) { | 108 | func (s *StatusTrackerSuite) TestTrackUninstallNotInstalled(c *C) { |
911 | 109 | snap := &client.Snap{Status: client.StatusNotInstalled} | 109 | snap := &client.Snap{Status: client.StatusAvailable} |
912 | 110 | s.t.TrackUninstall(snap) | 110 | s.t.TrackUninstall(snap) |
913 | 111 | c.Assert(s.t.Status(snap), Equals, StatusUninstalled) | 111 | c.Assert(s.t.Status(snap), Equals, StatusUninstalled) |
914 | 112 | } | 112 | } |
915 | 113 | 113 | ||
916 | === modified file 'www/src/css/snaplist.css' | |||
917 | --- www/src/css/snaplist.css 2015-12-11 15:07:16 +0000 | |||
918 | +++ www/src/css/snaplist.css 2016-04-26 10:36:16 +0000 | |||
919 | @@ -62,7 +62,7 @@ | |||
920 | 62 | 62 | ||
921 | 63 | .b-snaplist_grid .b-snaplist__version, | 63 | .b-snaplist_grid .b-snaplist__version, |
922 | 64 | .b-snaplist_grid .b-snaplist__type, | 64 | .b-snaplist_grid .b-snaplist__type, |
924 | 65 | .b-snaplist_grid .b-snaplist__origin, | 65 | .b-snaplist_grid .b-snaplist__developer, |
925 | 66 | .b-snaplist_grid .b-snaplist__actions { | 66 | .b-snaplist_grid .b-snaplist__actions { |
926 | 67 | display:none; | 67 | display:none; |
927 | 68 | } | 68 | } |
928 | @@ -114,7 +114,7 @@ | |||
929 | 114 | 114 | ||
930 | 115 | .b-snaplist_row .b-snaplist__name, | 115 | .b-snaplist_row .b-snaplist__name, |
931 | 116 | .b-snaplist_row .b-snaplist__version, | 116 | .b-snaplist_row .b-snaplist__version, |
933 | 117 | .b-snaplist_row .b-snaplist__origin, | 117 | .b-snaplist_row .b-snaplist__developer, |
934 | 118 | .b-snaplist_row .b-snaplist__size { | 118 | .b-snaplist_row .b-snaplist__size { |
935 | 119 | white-space: nowrap; | 119 | white-space: nowrap; |
936 | 120 | width: 100%; | 120 | width: 100%; |
937 | @@ -142,8 +142,8 @@ | |||
938 | 142 | display:none; | 142 | display:none; |
939 | 143 | } | 143 | } |
940 | 144 | 144 | ||
943 | 145 | .b-snaplist_row .b-snaplist__origin | 145 | .b-snaplist_row .b-snaplist__developer |
944 | 146 | .b-snaplist_row .b-snaplist__origin { | 146 | .b-snaplist_row .b-snaplist__developer { |
945 | 147 | text-transform: capitalize; | 147 | text-transform: capitalize; |
946 | 148 | } | 148 | } |
947 | 149 | 149 | ||
948 | 150 | 150 | ||
949 | === modified file 'www/src/js/config.js' | |||
950 | --- www/src/js/config.js 2016-01-27 14:16:35 +0000 | |||
951 | +++ www/src/js/config.js 2016-04-26 10:36:16 +0000 | |||
952 | @@ -7,7 +7,7 @@ | |||
953 | 7 | ], | 7 | ], |
954 | 8 | NON_INSTALLABLE_IDS: [ | 8 | NON_INSTALLABLE_IDS: [ |
955 | 9 | 'webdm', | 9 | 'webdm', |
957 | 10 | 'ubuntu-core.ubuntu' | 10 | 'ubuntu-core' |
958 | 11 | ], | 11 | ], |
959 | 12 | NON_INSTALLABLE_TYPES: [ | 12 | NON_INSTALLABLE_TYPES: [ |
960 | 13 | 'gadget' | 13 | 'gadget' |
961 | 14 | 14 | ||
962 | === modified file 'www/src/js/models/snap.js' | |||
963 | --- www/src/js/models/snap.js 2015-06-03 11:45:59 +0000 | |||
964 | +++ www/src/js/models/snap.js 2016-04-26 10:36:16 +0000 | |||
965 | @@ -166,8 +166,8 @@ | |||
966 | 166 | response.icon = this.defaults.icon; | 166 | response.icon = this.defaults.icon; |
967 | 167 | } | 167 | } |
968 | 168 | 168 | ||
971 | 169 | if (response.hasOwnProperty('origin') && !response.origin.length) { | 169 | if (response.hasOwnProperty('developer') && !response.developer.length) { |
972 | 170 | response.origin = this.defaults.origin; | 170 | response.developer = this.defaults.developer; |
973 | 171 | } | 171 | } |
974 | 172 | 172 | ||
975 | 173 | if (type) { | 173 | if (type) { |
976 | @@ -200,28 +200,13 @@ | |||
977 | 200 | ); | 200 | ); |
978 | 201 | } | 201 | } |
979 | 202 | 202 | ||
980 | 203 | if (response.hasOwnProperty('ui_port')) { | ||
981 | 204 | //jscs:disable requireCamelCaseOrUpperCaseIdentifiers | ||
982 | 205 | var port = response.ui_port; | ||
983 | 206 | //jscs:enable requireCamelCaseOrUpperCaseIdentifiers | ||
984 | 207 | |||
985 | 208 | if (_.isFinite(port) && port > 0) { | ||
986 | 209 | |||
987 | 210 | this.set('vendorGuiHref', window.location.protocol + '//' + | ||
988 | 211 | window.location.hostname + ':' + port + '/' | ||
989 | 212 | ); | ||
990 | 213 | } else { | ||
991 | 214 | this.unset('vendorGuiHref'); | ||
992 | 215 | } | ||
993 | 216 | } | ||
994 | 217 | |||
995 | 218 | return response; | 203 | return response; |
996 | 219 | }, | 204 | }, |
997 | 220 | 205 | ||
998 | 221 | defaults: { | 206 | defaults: { |
999 | 222 | icon: '/public/images/default-package-icon.svg', | 207 | icon: '/public/images/default-package-icon.svg', |
1000 | 223 | installActionString: false, | 208 | installActionString: false, |
1002 | 224 | origin: '-', | 209 | developer: '-', |
1003 | 225 | isInstallable: true | 210 | isInstallable: true |
1004 | 226 | } | 211 | } |
1005 | 227 | 212 | ||
1006 | 228 | 213 | ||
1007 | === modified file 'www/src/js/templates/snap-menu.hbs' | |||
1008 | --- www/src/js/templates/snap-menu.hbs 2015-06-03 11:33:11 +0000 | |||
1009 | +++ www/src/js/templates/snap-menu.hbs 2016-04-26 10:36:16 +0000 | |||
1010 | @@ -8,9 +8,4 @@ | |||
1011 | 8 | <a class="b-snap__nav-item" href="settings"> | 8 | <a class="b-snap__nav-item" href="settings"> |
1012 | 9 | Settings | 9 | Settings |
1013 | 10 | </a> | 10 | </a> |
1014 | 11 | {{#if vendorGuiHref}} | ||
1015 | 12 | <a class="b-snap__nav-item" href="{{vendorGuiHref}}" target="_blank"> | ||
1016 | 13 | Open / Manage | ||
1017 | 14 | </a> | ||
1018 | 15 | {{/if}} | ||
1019 | 16 | </div> | 11 | </div> |
1020 | 17 | 12 | ||
1021 | === modified file 'www/src/js/templates/snaplist-item.hbs' | |||
1022 | --- www/src/js/templates/snaplist-item.hbs 2015-12-11 15:07:16 +0000 | |||
1023 | +++ www/src/js/templates/snaplist-item.hbs 2016-04-26 10:36:16 +0000 | |||
1024 | @@ -6,7 +6,7 @@ | |||
1025 | 6 | <div class="b-snaplist__version">{{ version }}</div> | 6 | <div class="b-snaplist__version">{{ version }}</div> |
1026 | 7 | </div> | 7 | </div> |
1027 | 8 | <div class="b-snaplist__src"> | 8 | <div class="b-snaplist__src"> |
1029 | 9 | <div class="b-snaplist__origin">{{ origin }}</div> | 9 | <div class="b-snaplist__developer">{{ developer }}</div> |
1030 | 10 | </div> | 10 | </div> |
1031 | 11 | <div class="b-snaplist__size" title="Installed file size">{{ prettyInstalledSize }}</div> | 11 | <div class="b-snaplist__size" title="Installed file size">{{ prettyInstalledSize }}</div> |
1032 | 12 | <div class="b-snaplist__actions"> | 12 | <div class="b-snaplist__actions"> |
1033 | 13 | 13 | ||
1034 | === modified file 'www/src/js/templates/storelist-item.hbs' | |||
1035 | --- www/src/js/templates/storelist-item.hbs 2015-12-11 15:07:16 +0000 | |||
1036 | +++ www/src/js/templates/storelist-item.hbs 2016-04-26 10:36:16 +0000 | |||
1037 | @@ -6,7 +6,7 @@ | |||
1038 | 6 | <div class="b-snaplist__version">{{ version }}</div> | 6 | <div class="b-snaplist__version">{{ version }}</div> |
1039 | 7 | </div> | 7 | </div> |
1040 | 8 | <div class="b-snaplist__src"> | 8 | <div class="b-snaplist__src"> |
1042 | 9 | <div class="b-snaplist__origin">{{ origin }}</div> | 9 | <div class="b-snaplist__developer">{{ developer }}</div> |
1043 | 10 | </div> | 10 | </div> |
1044 | 11 | <div class="b-snaplist__actions"> | 11 | <div class="b-snaplist__actions"> |
1045 | 12 | {{> installer}} | 12 | {{> installer}} |
1046 | 13 | 13 | ||
1047 | === modified file 'www/tests/modelSpec.js' | |||
1048 | --- www/tests/modelSpec.js 2015-06-03 11:45:59 +0000 | |||
1049 | +++ www/tests/modelSpec.js 2016-04-26 10:36:16 +0000 | |||
1050 | @@ -88,20 +88,6 @@ | |||
1051 | 88 | expect(this.model.get('prettyDownloadSize')).toBe('0 B'); | 88 | expect(this.model.get('prettyDownloadSize')).toBe('0 B'); |
1052 | 89 | }); | 89 | }); |
1053 | 90 | 90 | ||
1054 | 91 | it('should parse response to create vendorGuiHref', function() { | ||
1055 | 92 | this.model.parse({'ui_port': 8080}); | ||
1056 | 93 | expect(this.model.get('vendorGuiHref')).toBe('http://localhost:8080/'); | ||
1057 | 94 | }); | ||
1058 | 95 | |||
1059 | 96 | it('should not set vendorGuiHref if not a finite number', function() { | ||
1060 | 97 | this.model.parse({'ui_port': NaN}); | ||
1061 | 98 | expect(this.model.get('vendorGuiHref')).not.toBeDefined(); | ||
1062 | 99 | this.model.parse({'ui_port': ''}); | ||
1063 | 100 | expect(this.model.get('vendorGuiHref')).not.toBeDefined(); | ||
1064 | 101 | this.model.parse({'ui_port': -9}); | ||
1065 | 102 | expect(this.model.get('vendorGuiHref')).not.toBeDefined(); | ||
1066 | 103 | }); | ||
1067 | 104 | |||
1068 | 105 | }); | 91 | }); |
1069 | 106 | 92 | ||
1070 | 107 | describe('sync methods', function() { | 93 | describe('sync methods', function() { |
Looks good!