Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 3 commits
  • 10 files changed
  • 0 commit comments
  • 1 contributor
@@ -14,22 +14,31 @@ angular.module('fifoApp')
if (c[entity][e]) {
callback(c[entity][e]);
} else {
wiggle[entity].get({id: e}, function(elem) {
// wiggle[entity].get(
// {id: e},
// {
// success: function(elem) {
// c[entity][e] = elem;
// callback(elem);
// },
// failure: function(err,status){
// c[entity][e] = {id: e, alias: "DELETED"};
// console.log("Err",err,status);
// }
// });
wiggle[entity].get({id: e}, function success(elem) {
console.log("Got", entity, e);
c[entity][e] = elem;
callback(elem);
}, function failure(err,status){
c[entity][e] = {id: e, alias: "<b>DELETED</b>"};
console.log("Err",err,status);
})

}
}
})();


$scope.orgs = {}
wiggle.orgs.query(function(ids) {
ids.forEach(function(res) {
$scope.orgs[res.uuid] = res;
});
});

$scope.org_join = function () {
var org = $scope.org_to_join;
wiggle.users.put({
@@ -109,6 +118,7 @@ angular.module('fifoApp')
$scope.ssh_keys = $scope.user.mdata('ssh_keys')
$scope.permissions = [];
$scope.user._groups = {};
$scope.user._orgs = {};
if ($scope.user.keys.length == 0) {
$scope.user.keys = {};
};
@@ -120,9 +130,17 @@ angular.module('fifoApp')
if ($scope.groups[gid]) {
$scope.user._groups[gid] = $scope.groups[gid];
} else {
$scope.user._groups[gid] = {uuid: gid};
$scope.user._groups[gid] = {uuid: gid, name: "DELETED", deleted:true};
}
});
$scope.user.orgs.map(function (gid){
if ($scope.orgs[gid]) {
$scope.user._orgs[gid] = $scope.orgs[gid];
} else {
$scope.user._orgs[gid] = {uuid: gid, name: "DELETED", deleted:true};
}
});

$scope.permissions = res.permissions.map(update_permission);
});

@@ -285,15 +303,25 @@ angular.module('fifoApp')
$scope.init = function() {
$scope.pass1 = "";
$scope.pass2 = "";
$scope.groups = [];
wiggle.groups.query(function(ids) {
ids.forEach(function(g) {
$scope.groups[g.uuid] = g;
$scope.groups = {};
$scope.orgs = {};
wiggle.groups.query(function(gs) {
$scope.groups = gs;
gs.forEach(function(g) {
if ($scope.user._groups[g.uuid]) {
$scope.user._groups[g.uuid] = g;
}
});
})
wiggle.orgs.query(function(o) {
$scope.orgs = os;
os.forEach(function(o) {

if ($scope.user._orgs[o.uuid]) {
$scope.user._orgs[o.uuid] = o;
}
});
})
};
$scope.init();

@@ -1,8 +1,54 @@
'use strict';

angular.module('fifoApp')
.controller('UsersCtrl', function ($scope, wiggle) {
angular.module('fifoApp').controller('UsersCtrl', function ($scope, wiggle) {

$scope.users = wiggle.users.queryFull()
$scope.init = function() {
$scope.groups = {};
$scope.orgs = {};
$scope.users = [];
wiggle.users.query(function(users) {
$scope.users = users.map(function(user) {
user._orgs = {};
user._groups = {};
user.orgs.forEach(function (uuid) {
if ($scope.orgs[uuid]) {
user._orgs[uuid] = $scope.orgs[uuid]
} else {
user._orgs[uuid] = {uuid: uuid, name: "DELETED", deleted: true}
}
});

});
user.groups.forEach(function (uuid) {
if ($scope.groups[uuid]) {
user._groups[uuid] = $scope.groups[uuid]
} else {
user._groups[uuid] = {uuid: uuid, name: "DELETED", deleted: true}
}
});
return user;
});
});
wiggle.groups.query(function(gs) {
$scope.groups = gs;
for (var i = 0; i < $scope.users.length; i++) {
gs.forEach(function(g) {
if ($scope.users[i]._groups[g.uuid]) {
$scope.users[i]._groups[g.uuid] = g;
};
});
};
});
wiggle.orgs.query(function(os) {
$scope.orgs = os;
for (var i = 0; i < $scope.users.length; i++) {
os.forEach(function(o) {
if ($scope.users[i]._orgs[o.uuid]) {
$scope.users[i]._orgs[o.uuid] = o;
};
});
};
})

};
$scope.init();
});
@@ -40,7 +40,7 @@ angular.module('fifoApp').factory('wiggle', function ($resource, $http, $cacheFa

var addListFunctions = function() {
/* Response with list of strings are not $resource friendly..
https://groups.google.com/forum/#!msg/angular/QjhN9-UeBVM/UjSgc5CNDqMJ
https://groups.google.com/forum/#!msg/angular/QjhN9-UeBVM/UjSgc5CNDqMJ
Only auth.js seems to be using this...
*/
['hypervisors', 'vms'].forEach(function(resource) {
@@ -56,7 +56,7 @@ angular.module('fifoApp').factory('wiggle', function ($resource, $http, $cacheFa

/* Add metadata helpers in the resources */
var addMetadataFunctions = function() {

['hypervisors', 'orgs', 'vms', 'networks', 'ipranges', 'datasets', 'packages', 'users', 'sessions', 'groups', 'dtrace'].forEach(function(resource) {

/* Resources that has put may save metadata, i.e. PUT vms/metadata/jingles {locked: true} */
@@ -165,8 +165,19 @@ angular.module('fifoApp').factory('wiggle', function ($resource, $http, $cacheFa
response: function(res) {

res.resource.forEach(function(el) {
el._groups = el.groups.map(function(g) {return services.groups.get({id: g})})
el._orgs = el.orgs.map(function(o) {return services.orgs.get({id: o})})
el._groups = el.groups.map(function(e){
return {uuid: e, name:"DELETED", deleted:true}
});
el.groups.map(function(uuid) {
services.groups.get({id: uuid}, function(g) {
console.log(g);
el._groups[uuid] = g;
});
})
el._orgs = el.orgs.map(function(e){
return {uuid: e, name:"DELETED", deleted:true}
});
el._orgs = el.orgs.map(function(o) {return services.orgs.get({id: o})})
})

// res.resource.hash = hashFromArray(res.resource)
@@ -112,7 +112,7 @@ <h3>{{user.name}}</h3>
<th translate>Actions</th>
</tr>
<tr ng-repeat="group in user._groups">
<td>{{group.name}}</td>
<td><span ng-class="{deleted: group.deleted}">{{group.name}}</span></td>
<td>{{group.uuid}}</td>
<td><a ng-click="leave_group(group.uuid)" translate>delete</a></td>
</tr>
@@ -130,10 +130,10 @@ <h3>{{user.name}}</h3>
<th translate>UUID</th>
<th translate>Actions</th>
</tr>
<tr ng-repeat="org in user.orgs">
<td>{{orgs[org].name}}</td>
<td>{{orgs[org].uuid}}</td>
<td><a ng-click="org_leave(orgs[org].uuid)" translate>delete</a></td>
<tr ng-repeat="org in user._orgs">
<td><span ng-class="{deleted: org.deleted}">{{org.name}}</span></td>
<td>{{org.uuid}}</td>
<td><a ng-click="org_leave(org.uuid)" translate>delete</a></td>
</tr>
</table>
</div>
@@ -15,11 +15,16 @@
<tbody>
<tr ng-repeat='u in users'>
<td><a href="#/configuration/users/{{u.uuid}}">{{u.name}}</a></td>
<td><span style='margin-right: 5px' ng-repeat='g in u._groups'><a class='nocolor' href="#/configuration/groups/{{g.uuid}}">{{g.name}}</a></span></td>
<td>
<a class='nocolor' ng-repeat='g in u._groups' href="#/configuration/groups/{{g.uuid}}">
<span style='margin-right: 5px' ng-class="{'deleted': g.deleted}">{{g.name}}</span>
</a>
</td>
<td>
<a class='nocolor' ng-repeat='o in u._orgs' href="#/configuration/organizations/{{o.uuid}}">
<span style='margin-right: 5px' ng-class="{'strong': o.uuid == u.org}">{{o.name}}</span>
</a></td>
<span style='margin-right: 5px' ng-class="{'strong': o.uuid == u.org, 'deleted': o.deleted}">{{o.name}}</span>
</a>
</td>
</tr>
</tbody>
</table>
@@ -18,7 +18,7 @@
<script src="scripts/4bea0a84.bower_components.js"></script>

<script src="scripts/config.js"></script>
<script src="scripts/ebd2e223.main.js"></script>
<script src="scripts/a4b1203a.main.js"></script>

<script src="scripts/ce98c266.vendor.js"></script>

Large diffs are not rendered by default.

This file was deleted.

@@ -112,7 +112,7 @@ <h3>{{user.name}}</h3>
<th translate>Actions</th>
</tr>
<tr ng-repeat="group in user._groups">
<td>{{group.name}}</td>
<td><span ng-class="{deleted: group.deleted}">{{group.name}}</span></td>
<td>{{group.uuid}}</td>
<td><a ng-click="leave_group(group.uuid)" translate>delete</a></td>
</tr>
@@ -130,10 +130,10 @@ <h3>{{user.name}}</h3>
<th translate>UUID</th>
<th translate>Actions</th>
</tr>
<tr ng-repeat="org in user.orgs">
<td>{{orgs[org].name}}</td>
<td>{{orgs[org].uuid}}</td>
<td><a ng-click="org_leave(orgs[org].uuid)" translate>delete</a></td>
<tr ng-repeat="org in user._orgs">
<td><span ng-class="{deleted: org.deleted}">{{org.name}}</span></td>
<td>{{org.uuid}}</td>
<td><a ng-click="org_leave(org.uuid)" translate>delete</a></td>
</tr>
</table>
</div>
@@ -15,11 +15,16 @@
<tbody>
<tr ng-repeat='u in users'>
<td><a href="#/configuration/users/{{u.uuid}}">{{u.name}}</a></td>
<td><span style='margin-right: 5px' ng-repeat='g in u._groups'><a class='nocolor' href="#/configuration/groups/{{g.uuid}}">{{g.name}}</a></span></td>
<td>
<a class='nocolor' ng-repeat='g in u._groups' href="#/configuration/groups/{{g.uuid}}">
<span style='margin-right: 5px' ng-class="{'deleted': g.deleted}">{{g.name}}</span>
</a>
</td>
<td>
<a class='nocolor' ng-repeat='o in u._orgs' href="#/configuration/organizations/{{o.uuid}}">
<span style='margin-right: 5px' ng-class="{'strong': o.uuid == u.org}">{{o.name}}</span>
</a></td>
<span style='margin-right: 5px' ng-class="{'strong': o.uuid == u.org, 'deleted': o.deleted}">{{o.name}}</span>
</a>
</td>
</tr>
</tbody>
</table>

No commit comments for this range

You can’t perform that action at this time.