Re: Review Request 50482: Fixed the CORS error when redirect in WEB UI.

2016-07-29 Thread haosdent huang


> On July 29, 2016, 11:46 p.m., Jiang Yan Xu wrote:
> > src/webui/master/static/js/controllers.js, lines 399-402
> > 
> >
> > Committing with minor comment tweaking
> > 
> > ```
> >   // When the current master is not the leader, the request is 
> > redirected to
> >   // the leading master automatically. This would cause a CORS 
> > error if we
> >   // use XMLHttpRequest here. To avoid the CORS error, we use JSONP 
> > as a
> >   // workaround. Please refer to MESOS-5911 for further details.
> > ```

Thank you!


- haosdent


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50482/#review144221
---


On July 29, 2016, 7:02 a.m., haosdent huang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50482/
> ---
> 
> (Updated July 29, 2016, 7:02 a.m.)
> 
> 
> Review request for mesos, Adam B, Jie Yu, Michael Lunøe, Vinod Kone, and 
> Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5911
> https://issues.apache.org/jira/browse/MESOS-5911
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> The redirection in WEB UI is broken since the CORS restriction after
> we enabled redirection in `master/state` endpoint in
> https://reviews.apache.org/r/34646/. We change the request way to
> `master/state` endpoint from xhr to jsonp for bypassing the CORS
> restriction.
> 
> 
> Diffs
> -
> 
>   src/webui/master/static/index.html a083537cd718162d1913842bddbd2653d8c52337 
>   src/webui/master/static/js/controllers.js 
> ceaf1402ebdae4efd1a8a6fc9c7b795de69e2fc0 
> 
> Diff: https://reviews.apache.org/r/50482/diff/
> 
> 
> Testing
> ---
> 
> Testing video record
> 
> ![http_redirect.gif](https://issues.apache.org/jira/secure/attachment/12820401/http_redirect.gif)
> 
> 
> Thanks,
> 
> haosdent huang
> 
>



Re: Review Request 50482: Fixed the CORS error when redirect in WEB UI.

2016-07-29 Thread Jiang Yan Xu

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50482/#review144221
---


Ship it!





src/webui/master/static/js/controllers.js (lines 375 - 378)


Committing with minor comment tweaking

```
  // When the current master is not the leader, the request is 
redirected to
  // the leading master automatically. This would cause a CORS error if 
we
  // use XMLHttpRequest here. To avoid the CORS error, we use JSONP as a
  // workaround. Please refer to MESOS-5911 for further details.
```


- Jiang Yan Xu


On July 29, 2016, 12:02 a.m., haosdent huang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50482/
> ---
> 
> (Updated July 29, 2016, 12:02 a.m.)
> 
> 
> Review request for mesos, Adam B, Jie Yu, Michael Lunøe, Vinod Kone, and 
> Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5911
> https://issues.apache.org/jira/browse/MESOS-5911
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> The redirection in WEB UI is broken since the CORS restriction after
> we enabled redirection in `master/state` endpoint in
> https://reviews.apache.org/r/34646/. We change the request way to
> `master/state` endpoint from xhr to jsonp for bypassing the CORS
> restriction.
> 
> 
> Diffs
> -
> 
>   src/webui/master/static/index.html a083537cd718162d1913842bddbd2653d8c52337 
>   src/webui/master/static/js/controllers.js 
> ceaf1402ebdae4efd1a8a6fc9c7b795de69e2fc0 
> 
> Diff: https://reviews.apache.org/r/50482/diff/
> 
> 
> Testing
> ---
> 
> Testing video record
> 
> ![http_redirect.gif](https://issues.apache.org/jira/secure/attachment/12820401/http_redirect.gif)
> 
> 
> Thanks,
> 
> haosdent huang
> 
>



Re: Review Request 50482: Fixed the CORS error when redirect in WEB UI.

2016-07-29 Thread haosdent huang

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50482/
---

(Updated July 29, 2016, 7:02 a.m.)


Review request for mesos, Adam B, Jie Yu, Michael Lunøe, Vinod Kone, and Jiang 
Yan Xu.


Changes
---

Rebase.


Bugs: MESOS-5911
https://issues.apache.org/jira/browse/MESOS-5911


Repository: mesos


Description
---

The redirection in WEB UI is broken since the CORS restriction after
we enabled redirection in `master/state` endpoint in
https://reviews.apache.org/r/34646/. We change the request way to
`master/state` endpoint from xhr to jsonp for bypassing the CORS
restriction.


Diffs (updated)
-

  src/webui/master/static/index.html a083537cd718162d1913842bddbd2653d8c52337 
  src/webui/master/static/js/controllers.js 
ceaf1402ebdae4efd1a8a6fc9c7b795de69e2fc0 

Diff: https://reviews.apache.org/r/50482/diff/


Testing
---

Testing video record

![http_redirect.gif](https://issues.apache.org/jira/secure/attachment/12820401/http_redirect.gif)


Thanks,

haosdent huang



Re: Review Request 50482: Fixed the CORS error when redirect in WEB UI.

2016-07-28 Thread haosdent huang

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50482/
---

(Updated July 29, 2016, 4:35 a.m.)


Review request for mesos, Adam B, Jie Yu, Michael Lunøe, Vinod Kone, and Jiang 
Yan Xu.


Changes
---

Rebase.


Bugs: MESOS-5911
https://issues.apache.org/jira/browse/MESOS-5911


Repository: mesos


Description
---

The redirection in WEB UI is broken since the CORS restriction after
we enabled redirection in `master/state` endpoint in
https://reviews.apache.org/r/34646/. We change the request way to
`master/state` endpoint from xhr to jsonp for bypassing the CORS
restriction.


Diffs (updated)
-

  src/webui/master/static/index.html a083537cd718162d1913842bddbd2653d8c52337 
  src/webui/master/static/js/controllers.js 
ceaf1402ebdae4efd1a8a6fc9c7b795de69e2fc0 

Diff: https://reviews.apache.org/r/50482/diff/


Testing
---

Testing video record

![http_redirect.gif](https://issues.apache.org/jira/secure/attachment/12820401/http_redirect.gif)


Thanks,

haosdent huang



Re: Review Request 50482: Fixed the CORS error when redirect in WEB UI.

2016-07-28 Thread haosdent huang


> On July 27, 2016, 11:32 p.m., Vinod Kone wrote:
> > src/webui/master/static/js/controllers.js, line 60
> > 
> >
> > why is this scope.state instead of scope.data?

In the previous code, we didn't use JSONP, so the type of `data` and 
`$scope.data` here are string. `data` need to `JSON.parse` first then assign to 
`$scope.state` as a JSON object.
After we use JSONP here, the object passed into `updateState` is a parsed JSON 
object actually. Continue to use `data` as the variable name here is a bit 
confuse.
I change `data` to `state` now.


- haosdent


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50482/#review143849
---


On July 29, 2016, 4:24 a.m., haosdent huang wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50482/
> ---
> 
> (Updated July 29, 2016, 4:24 a.m.)
> 
> 
> Review request for mesos, Adam B, Jie Yu, Michael Lunøe, Vinod Kone, and 
> Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5911
> https://issues.apache.org/jira/browse/MESOS-5911
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> The redirection in WEB UI is broken since the CORS restriction after
> we enabled redirection in `master/state` endpoint in
> https://reviews.apache.org/r/34646/. We change the request way to
> `master/state` endpoint from xhr to jsonp for bypassing the CORS
> restriction.
> 
> 
> Diffs
> -
> 
>   src/webui/master/static/index.html a083537cd718162d1913842bddbd2653d8c52337 
>   src/webui/master/static/js/controllers.js 
> ceaf1402ebdae4efd1a8a6fc9c7b795de69e2fc0 
> 
> Diff: https://reviews.apache.org/r/50482/diff/
> 
> 
> Testing
> ---
> 
> Testing video record
> 
> ![http_redirect.gif](https://issues.apache.org/jira/secure/attachment/12820401/http_redirect.gif)
> 
> 
> Thanks,
> 
> haosdent huang
> 
>



Re: Review Request 50482: Fixed the CORS error when redirect in WEB UI.

2016-07-28 Thread haosdent huang

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50482/
---

(Updated July 29, 2016, 4:24 a.m.)


Review request for mesos, Adam B, Jie Yu, Michael Lunøe, Vinod Kone, and Jiang 
Yan Xu.


Changes
---

Address @vinodkone's comment.


Summary (updated)
-

Fixed the CORS error when redirect in WEB UI.


Bugs: MESOS-5911
https://issues.apache.org/jira/browse/MESOS-5911


Repository: mesos


Description
---

The redirection in WEB UI is broken since the CORS restriction after
we enabled redirection in `master/state` endpoint in
https://reviews.apache.org/r/34646/. We change the request way to
`master/state` endpoint from xhr to jsonp for bypassing the CORS
restriction.


Diffs (updated)
-

  src/webui/master/static/index.html a083537cd718162d1913842bddbd2653d8c52337 
  src/webui/master/static/js/controllers.js 
ceaf1402ebdae4efd1a8a6fc9c7b795de69e2fc0 

Diff: https://reviews.apache.org/r/50482/diff/


Testing
---

Testing video record

![http_redirect.gif](https://issues.apache.org/jira/secure/attachment/12820401/http_redirect.gif)


Thanks,

haosdent huang