After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 762483 - If route request fails the spinner should not be shown
If route request fails the spinner should not be shown
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2016-02-22 19:33 UTC by Hashem Nasarat
Modified: 2016-03-01 08:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to avoid infinte display intsruction spinner (937 bytes, patch)
2016-02-27 20:26 UTC, Nayan Deshmukh
none Details | Review
route-not-found:revert to previous route if new one not found (3.28 KB, patch)
2016-02-29 11:21 UTC, Nayan Deshmukh
needs-work Details | Review
Routing: Remove latest place on failure (3.16 KB, patch)
2016-02-29 14:22 UTC, Nayan Deshmukh
none Details | Review
Routing: Remove latest place on failure (3.21 KB, patch)
2016-02-29 19:35 UTC, Nayan Deshmukh
needs-work Details | Review
Routing: Remove latest place on failure (3.26 KB, patch)
2016-03-01 07:59 UTC, Nayan Deshmukh
committed Details | Review

Description Hashem Nasarat 2016-02-22 19:33:57 UTC
http://i.imgur.com/xXYkK48.jpg

Easy way to get it to fail is set to/from to be the same location.
Comment 1 Jonas Danielsson 2016-02-23 11:34:06 UTC
Yes, agreed!

For whomever wants to work on this, check in src/sidebar.js where we set the visible child of the instructionStack to instructionSpinner...

Right now we show it if query.isValid(), maybe we should also check that the path array of the route has a length that is !== 0? Or is there a more elegant solution?
Comment 2 Nayan Deshmukh 2016-02-27 20:26:52 UTC
Created attachment 322553 [details] [review]
Patch to avoid infinte display intsruction spinner

If we enter source and destination to be the same place
or if route request fails for some reason then we need to
reset route to avoid infinite display of instruction spinner
Comment 3 Nayan Deshmukh 2016-02-29 11:21:57 UTC
Created attachment 322649 [details] [review]
route-not-found:revert to previous route if new one not found

if any new entry added to exixting results in route not found
then revert back to previous route and remove the point from
route list. Add latest field to routeQuery which keeps the
latest point added. and in routeService if route is not found
remove latest point from the points list.
Comment 4 Jonas Danielsson 2016-02-29 11:28:01 UTC
Review of attachment 322649 [details] [review]:

Thanks!

Some comments below!

Also for shortlog, maybe:

"Routing: Remove latest place on failure" ?

::: src/routeQuery.js
@@ +106,3 @@
     },
+    
+    get latest(){

space before brace!

@@ +111,3 @@
+
+    set latest(point){
+        this._latest=point;

Spaces! :)

@@ +117,3 @@
         this.parent(args);
         this._points = [];
+        this._latest=null;

No need for this, it can be undefined from start.

@@ +133,3 @@
         this.notify('points');
         this.emit('point-added', point, index);
+        this._latest=point;

this._latest = point; (and maybe set this before emit and notify.

@@ +140,3 @@
         let removedPoints = this._points.splice(index, 1);
         let point = removedPoints ? removedPoints[0] : null;
+        if(point===this._latest){

You need spaces!

if (point === this._latest) {
^^^^    ^^^^^^^^^^           ^^^
here    and here             also here

@@ +141,3 @@
         let point = removedPoints ? removedPoints[0] : null;
+        if(point===this._latest){
+            this._latest=null;

this._latest = null;

@@ +164,3 @@
             point.place = null;
         });
+        this._latest=null;

spaces...

::: src/routeService.js
@@ +101,3 @@
+                    else{
+                        this.route.reset();
+                                break; 

No, I do not like this!

We should _not_ remove the point. I want:

if (this.query.latest)
    this.query.latest.place = null;
else
    this.route.reset();

@@ +108,3 @@
             } catch(e) {
                 Application.notificationManager.showMessage(_("Route request failed."));
                 log(e);

And I want the same code here.
Comment 5 Nayan Deshmukh 2016-02-29 14:22:31 UTC
Created attachment 322661 [details] [review]
Routing: Remove latest place on failure

If a new entry is added to exixting route which results in
route not found then revert back to previous route and set the place
of the point to null. To implement this Add a latest field to routeQuery
which keeps the latest point added. and in routeService if route
is not found set latest.place to null.
Comment 6 Jonas Danielsson 2016-02-29 19:06:23 UTC
Review of attachment 322661 [details] [review]:

Thanks!

Other than small comments, looks great!

::: src/routeQuery.js
@@ +113,3 @@
+        this._latest = point;
+        this.notify('points');
+    },

Two things,

1) This is never used?
2) I do not see the need to notify here

@@ +130,2 @@
         point.connect('notify::place', (function() {
             this.notify('points');

We should set ...

this._latest = point;

... here as well, to catch latest place added.

::: src/routeService.js
@@ +89,3 @@
                 if (!result) {
                     Application.notificationManager.showMessage(_("No route found."));
+                    if(this.query.latest) 

if (

@@ +100,3 @@
             } catch(e) {
                 Application.notificationManager.showMessage(_("Route request failed."));
                 log(e);

if (
Comment 7 Nayan Deshmukh 2016-02-29 19:35:43 UTC
Created attachment 322695 [details] [review]
Routing: Remove latest place on failure

If a new entry is added to exixting route which results in
route not found then revert back to previous route and set the place
of the point to null. To implement this Add a latest field to routeQuery
which keeps the latest point added. and in routeService if route
is not found set latest.place to null.
Comment 8 Jonas Danielsson 2016-02-29 19:44:52 UTC
Review of attachment 322695 [details] [review]:

Thanks!

Looks great! Please run git diff --check before commiting! Or git diff HEAD~1 --check after commiting! This adds whitespace damage, and I will not apply it in this state.

$ git diff HEAD~1 --check
src/routeQuery.js:110: trailing whitespace.
+    
src/routeQuery.js:152: trailing whitespace.
+        if (point === this._latest) 
src/routeQuery.js:154: trailing whitespace.
+        
src/routeService.js:91: trailing whitespace.
+                    if(this.query.latest) 
src/routeService.js:93: trailing whitespace.
+                    else 
src/routeService.js:95: trailing whitespace.
+                    
src/routeService.js:103: trailing whitespace.
+                if(this.query.latest) 
src/routeService.js:105: trailing whitespace.
+                else

::: src/routeQuery.js
@@ +112,3 @@
+    set latest(point) {
+        this._latest = point;
+    },

Remove this if unused.
Comment 9 Nayan Deshmukh 2016-03-01 07:59:12 UTC
Created attachment 322724 [details] [review]
Routing: Remove latest place on failure

If a new entry is added to exixting route which results in
route not found then revert back to previous route and set the place
of the point to null. To implement this Add a latest field to routeQuery
which keeps the latest point added. and in routeService if route
is not found set latest.place to null.

https://bugzilla.gnome.org/show_bug.cgi?id=762483
Comment 10 Jonas Danielsson 2016-03-01 08:11:19 UTC
Review of attachment 322724 [details] [review]:

Thanks looks awesome!

::: src/routeService.js
@@ +92,3 @@
+                        this.query.latest.place = null;
+                        if (!this.query.isValid())
+                            this.route.reset();

I think is not needed, and instead we can do a small fix in sidebar.js
Comment 11 Jonas Danielsson 2016-03-01 08:11:42 UTC
Review of attachment 322724 [details] [review]:

pushed