> On July 3, 2017, 6:27 p.m., haosdent huang wrote:
> > src/webui/master/static/js/controllers.js
> > Lines 610 (patched)
> > <https://reviews.apache.org/r/60370/diff/3/?file=1766481#file1766481line610>
> >
> > How about
> >
> > ```
> > $scope.agent.resource_reservations = _($scope.state.reserved_resources).map(function(role,
reservation)) {
> > reservation.role = role
> > return reservation;
> > }
> >
> > ```
>
> Andrei Budnik wrote:
> This code:
> ```javascript
> $scope.agent.resource_reservations = _($scope.state.reserved_resources)
> .map(function(role, reservation) {
> reservation.role = role;
> return reservation;
> });
> ```
> causes an exception:
> ```
> angular-1.2.3.min.js:84 TypeError: Cannot create property 'role' on string 'dyn'
> at http://127.0.0.1:5050/static/js/controllers.js:607:32
> at http://127.0.0.1:5050/static/js/underscore-1.4.3.min.js:1:889
> at w.each.w.forEach (http://127.0.0.1:5050/static/js/underscore-1.4.3.min.js:1:743)
> at Function.w.map.w.collect (http://127.0.0.1:5050/static/js/underscore-1.4.3.min.js:1:855)
> at w.(anonymous function) [as map] (http://127.0.0.1:5050/static/js/underscore-1.4.3.min.js:1:11745)
> at http://127.0.0.1:5050/static/js/controllers.js:606:14
> at http://127.0.0.1:5050/static/js/angular-1.2.3.min.js:66:439
> at D (http://127.0.0.1:5050/static/js/angular-1.2.3.min.js:91:464)
> at D (http://127.0.0.1:5050/static/js/angular-1.2.3.min.js:91:464)
> at http://127.0.0.1:5050/static/js/angular-1.2.3.min.js:93:98
> ```
>
> haosdent huang wrote:
> what's the content of $scope.state.reserved_resources in your side?
>
> Andrei Budnik wrote:
> From `curl localhost:5051/state | jq`:
> ```javascript
> "reserved_resources": {
> "dyn": {
> "disk": 0,
> "gpus": 0,
> "mem": 1024,
> "cpus": 2
> },
> "ads": {
> "disk": 0,
> "gpus": 0,
> "mem": 5120,
> "cpus": 9
> }
> }
> ```
How about
```
$scope.agent.resource_reservations = _($scope.state.reserved_resources)
.map(function(reservation, role) {
reservation.role = role;
return reservation;
});
```
- haosdent
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60370/#review179531
-----------------------------------------------------------
On June 28, 2017, 8:52 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60370/
> -----------------------------------------------------------
>
> (Updated June 28, 2017, 8:52 p.m.)
>
>
> Review request for mesos, Benjamin Mahler and haosdent huang.
>
>
> Bugs: MESOS-6441
> https://issues.apache.org/jira/browse/MESOS-6441
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Updated agent webui page to display allocated resources per each role.
>
>
> Diffs
> -----
>
> src/webui/master/static/agent.html 71e5e702e5e64e6f46c84791247aa5156c046ed9
> src/webui/master/static/js/controllers.js 67bfd030649dd21840c16188a4964f814aa232d7
>
>
> Diff: https://reviews.apache.org/r/60370/diff/4/
>
>
> Testing
> -------
>
> See screenshot.
>
>
> File Attachments
> ----------------
>
> agent.html
> https://reviews.apache.org/media/uploaded/files/2017/06/22/66cc61b4-04c8-451e-a434-58f556397724__Resource_Reservations.png
> ui_bug
> https://reviews.apache.org/media/uploaded/files/2017/06/28/1b7755e3-0b11-46ab-9ae4-71f19bce0cd6__ui_bug.png
> ui_bug2
> https://reviews.apache.org/media/uploaded/files/2017/06/28/b89990c9-9aa5-432a-a0da-3f90c9428127__ui_bug2.png
> ui_bug3
> https://reviews.apache.org/media/uploaded/files/2017/06/28/51553e9d-7fb9-40c0-b47c-b62fc6c37393__ui_bug3.png
>
>
> Thanks,
>
> Andrei Budnik
>
>
|