hide non auhorized containers for VMs (host or pool). Fix #545

This commit is contained in:
Olivier Lambert
2015-12-03 14:23:32 +01:00
parent aaf7927aa2
commit 35d20390a9
2 changed files with 6 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ export default angular.module('xoWebApp.list', [
template: view
})
})
.controller('ListCtrl', function (xoApi) {
.controller('ListCtrl', function (xoApi, $scope) {
this.hosts = xoApi.getView('host')
this.pools = xoApi.getView('pool')
this.SRs = xoApi.getView('SR')
@@ -29,7 +29,9 @@ export default angular.module('xoWebApp.list', [
this.hostsByPool = xoApi.getIndex('hostsByPool')
this.runningHostsByPool = xoApi.getIndex('runningHostsByPool')
this.vmsByContainer = xoApi.getIndex('vmsByContainer')
$scope.canView = function (id) {
return xoApi.canInteract(id, 'view')
}
})
// A module exports its name.
.name

View File

@@ -94,14 +94,14 @@
| {{VM.CPUs.number}} vCPUs
.grid-cell.flat-cell
| {{VM.memory.size | bytesToSize}} RAM
.grid-cell.flat-cell(ng-init="container = (VM.$container | resolve)")
.grid-cell.flat-cell(ng-init="container = (VM.$container | resolve)", ng-if="canView((VM.$container | resolve).id)")
div(ng-if="'pool' === container.type")
| Resident on:
a(ui-sref="pools_view({id: container.id})") {{container.name_label}}
div(ng-if="'host' === container.type", ng-init="pool = (container.$poolId | resolve)")
| Resident on:
a(ui-sref="hosts_view({id: container.id})") {{container.name_label}}
small(ng-if="pool.name_label")
small(ng-if="pool.name_label && canView(pool.id)")
| (
a(ui-sref="pools_view({id: pool.id})") {{pool.name_label}}
| )