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
  • 14 files changed
  • 0 commit comments
  • 1 contributor
@@ -80,7 +80,6 @@ angular.module('fifoApp')
on connection. */
socket.onmessage = function(message){
var message = msgpack.unpack(new Uint8Array(message.data));
console.log(message)
if (message.config) {
switch (message.config.type) {
case "heatmap":
@@ -745,7 +745,6 @@ angular.module('fifoApp')
status.info('Creating ' + r.name + ' ' + r.version);
updateVm();
});
console.log(vm + "@" + snap, config);
}

var init = function() {
@@ -10,14 +10,11 @@ function init_scope($scope, org) {
var a = t.action;
t.uuid = k;
if (a == "group_grant" || a == "user_grant") {
console.log(t);
$scope.grant_triggers[k]= t;
} else if (a == "join_org" || a == "join_group") {
console.log(t);
$scope.join_triggers[k]= t;
}
};
console.log("join: ", $scope.join_triggers);
return $scope;
};

@@ -93,7 +90,6 @@ angular.module('fifoApp')


$scope.add_group_join_trigger = function() {
console.log($scope.join_group)
wiggle.orgs.create({
id: uuid,
controller: "triggers",
@@ -121,7 +117,6 @@ angular.module('fifoApp')
};

$scope.delete_join_trigger = function(trigger) {
console.log(trigger);
wiggle.orgs.delete({
id: $scope.org.uuid,
controller: "triggers",
@@ -15,7 +15,6 @@ angular.module('fifoApp')
callback(c[entity][e]);
} else {
wiggle[entity].get({id: e}, function success(elem) {
console.log("Got", entity, e);
c[entity][e] = elem;
callback(elem);
}, function failure(err,status){
@@ -34,9 +33,10 @@ angular.module('fifoApp')
controller: "orgs",
controller_id: org
}, {}, function(e) {
if ($scope.user.orgs.indexOf(org) == -1)
if ($scope.user.orgs.indexOf(org) == -1) {
$scope.user.orgs.push(org);
$scope.user._orgs[org] = _orgs[org];
$scope.user._orgs[org] = $scope.orgs[org]
}
});
}

@@ -55,10 +55,8 @@ angular.module('fifoApp')
controller: "orgs",
controller_id: org
}, function() {
$scope.user.orgs = $scope.user.orgs.filter(function(o) {
return o != org;
});
delete $scope.user.orgs[org];
$scope.user.orgs.splice($scope.user.orgs.indexOf(org), 1);
delete $scope.user._orgs[org];
});
};

@@ -101,39 +99,6 @@ angular.module('fifoApp')
return res;
};

wiggle.users.get({id: uuid}, function(res) {
res.groups = res.groups || [];
$scope.user = res;
breadcrumbs.setLast(res.name)
$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 = {};
};
if (! $scope.user.yubikeys) {
$scope.user.yubikeys = []
}

$scope.user.groups.map(function (gid){
if ($scope.groups[gid]) {
$scope.user._groups[gid] = $scope.groups[gid];
} else {
$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);
});

$scope.delete_permission = function(permission) {
var p = {controller: "permissions",
id: $scope.user.uuid};
@@ -286,37 +251,77 @@ angular.module('fifoApp')
controller: 'keys'},
o,
function() {
console.log($scope.user.keys);
$scope.user.keys[key_id] = key;
console.log($scope.user.keys);
status.success('SSH Key added')
}, function error(err) {
var msg = err.status === 422
? 'SSH public key format not recognized'
: 'Could not save SSH Key'

status.error(msg)
console.log('SSH Key save error:', err)
});
//$scope.user.mdata_set({ssh_keys: $scope.ssh_keys})
//status.info('SSH key saved')
}

$scope.init = function() {
var load_additional_data = function() {
$scope.pass1 = "";
$scope.pass2 = "";
$scope.groups = {};
$scope.orgs = {};
wiggle.groups.query(function(gs) {
$scope.groups = gs;
gs.forEach(function(g) {
$scope.groups[g.uuid] = g
if ($scope.user._groups[g.uuid]) {
$scope.user._groups[g.uuid] = g;
}
});
})
wiggle.orgs.query(function(os) {
$scope.orgs = os;
os.forEach(function(o) {
$scope.orgs[o.uuid] = o
if ($scope.user._orgs[o.uuid]) {
$scope.user._orgs[o.uuid] = o;
}
});
console.log($scope.user._orgs, $scope.user.org);
})
};
$scope.init();


wiggle.users.get({id: uuid}, function(res) {
res.groups = res.groups || [];
$scope.user = res;
load_additional_data()
breadcrumbs.setLast(res.name)
$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 = {};
};
if (! $scope.user.yubikeys) {
$scope.user.yubikeys = []
}

$scope.user.groups.map(function (gid){
if ($scope.groups[gid]) {
$scope.user._groups[gid] = $scope.groups[gid];
} else {
$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);
});


});
@@ -2,53 +2,6 @@

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

$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}
}
});
$scope.users = wiggle.users.queryFull()

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();
});
@@ -165,23 +165,38 @@ angular.module('fifoApp').factory('wiggle', function ($resource, $http, $cacheFa
response: function(res) {

res.resource.forEach(function(el) {
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._groups = el.groups.map(function(g) {

var _g = services.groups.get({id: g})

//If != 200, at least put the uuid and a name to better manage it on the UI.
//TODO: maybe there is a way to make this more generic?
_g.$promise.catch(function(err) {
_g.name = '?'
_g.uuid = g
_g.deleted = true
})
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})})

return _g
})

el._orgs = el.orgs.map(function(o) {
var _o = services.orgs.get({id: o})

_o.$promise.catch(function(err) {
_o.name = '?'
_o.uuid = o
_o.deleted = true
})

return _o
})


})

// res.resource.hash = hashFromArray(res.resource)

return res.resource;
}

@@ -11,8 +11,6 @@
@import 'app/styles/custom/legacy.less';
@import 'app/styles/custom/typeahead.less';



.hide {
display: none !important;
}
@@ -112,7 +112,7 @@ <h3>{{user.name}}</h3>
<th translate>Actions</th>
</tr>
<tr ng-repeat="group in user._groups">
<td><span ng-class="{deleted: group.deleted}">{{group.name}}</span></td>
<td><span ng-class="{'text-danger': group.deleted}">{{group.name}}</span></td>
<td>{{group.uuid}}</td>
<td><a ng-click="leave_group(group.uuid)" translate>delete</a></td>
</tr>
@@ -131,7 +131,7 @@ <h3>{{user.name}}</h3>
<th translate>Actions</th>
</tr>
<tr ng-repeat="org in user._orgs">
<td><span ng-class="{deleted: org.deleted}">{{org.name}}</span></td>
<td><span ng-class="{'text-danger': org.deleted}">{{org.name}}</span></td>
<td>{{org.uuid}}</td>
<td><a ng-click="org_leave(org.uuid)" translate>delete</a></td>
</tr>
@@ -16,13 +16,13 @@
<tr ng-repeat='u in users'>
<td><a href="#/configuration/users/{{u.uuid}}">{{u.name}}</a></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 style='padding-right: 5px' class='nocolor' ng-repeat='g in u._groups' href="#/configuration/groups/{{g.uuid}}">
<span ng-class="{'text-danger': 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, 'deleted': o.deleted}">{{o.name}}</span>
<a style='padding-right: 5px' class='nocolor' ng-repeat='o in u._orgs' href="#/configuration/organizations/{{o.uuid}}">
<span ng-class="{'strong': o.uuid == u.org, 'text-danger': o.deleted}">{{o.name}}</span>
</a>
</td>
</tr>
@@ -18,7 +18,7 @@
<script src="scripts/5d0b108f.bower_components.js"></script>

<script src="scripts/config.js"></script>
<script src="scripts/a51987a7.main.js"></script>
<script src="scripts/b8d44ee7.main.js"></script>

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

This file was deleted.

Large diffs are not rendered by default.

@@ -112,7 +112,7 @@ <h3>{{user.name}}</h3>
<th translate>Actions</th>
</tr>
<tr ng-repeat="group in user._groups">
<td><span ng-class="{deleted: group.deleted}">{{group.name}}</span></td>
<td><span ng-class="{'text-danger': group.deleted}">{{group.name}}</span></td>
<td>{{group.uuid}}</td>
<td><a ng-click="leave_group(group.uuid)" translate>delete</a></td>
</tr>
@@ -131,7 +131,7 @@ <h3>{{user.name}}</h3>
<th translate>Actions</th>
</tr>
<tr ng-repeat="org in user._orgs">
<td><span ng-class="{deleted: org.deleted}">{{org.name}}</span></td>
<td><span ng-class="{'text-danger': org.deleted}">{{org.name}}</span></td>
<td>{{org.uuid}}</td>
<td><a ng-click="org_leave(org.uuid)" translate>delete</a></td>
</tr>

No commit comments for this range

You can’t perform that action at this time.