This commit is contained in:
tidusjar 2016-08-28 17:10:24 +01:00
commit 0f98f12756
13 changed files with 297 additions and 101 deletions

View file

@ -9,6 +9,7 @@
$scope.selectedUser = {}; // User on the right side
$scope.selectedClaims = {};
$scope.sortType = "username";
$scope.sortReverse = false;
$scope.searchTerm = "";
@ -27,20 +28,20 @@
// Get all users in the system
$scope.getUsers = function () {
$scope.users = userManagementService.getUsers()
.then(function (data) {
$scope.users = data.data;
});
.then(function (data) {
$scope.users = data.data;
});
};
// Get the claims and populate the create dropdown
$scope.getClaims = function () {
userManagementService.getClaims()
.then(function (data) {
$scope.claims = data.data;
});
.then(function (data) {
$scope.claims = data.data;
});
}
// Create a user, do some validation too
// Create a user, do some validation too
$scope.addUser = function () {
if (!$scope.user.username || !$scope.user.password) {
@ -50,23 +51,35 @@
return;
}
userManagementService.addUser($scope.user, $scope.selectedClaims).then(function (data) {
if (data.message) {
$scope.error.error = true;
$scope.error.errorMessage = data.message;
} else {
$scope.users.push(data); // Push the new user into the array to update the DOM
$scope.user = {};
$scope.selectedClaims = {};
}
});
userManagementService.addUser($scope.user, $scope.selectedClaims)
.then(function (data) {
if (data.message) {
$scope.error.error = true;
$scope.error.errorMessage = data.message;
} else {
$scope.users.push(data); // Push the new user into the array to update the DOM
$scope.user = {};
$scope.selectedClaims = {};
}
});
};
$scope.$watch('claims|filter:{selected:true}', function (nv) {
$scope.selectedClaims = nv.map(function (claim) {
return claim.name;
});
}, true);
$scope.$watch('claims|filter:{selected:true}',
function (nv) {
$scope.selectedClaims = nv.map(function (claim) {
return claim.name;
});
},
true);
$scope.updateUser = function () {
}
function getBaseUrl() {
return $('#baseUrl').val();
}
// On page load

View file

@ -5,6 +5,21 @@
return opts.inverse(this);
});
Function.prototype.bind = function (parent) {
var f = this;
var args = [];
for (var a = 1; a < arguments.length; a++) {
args[args.length] = arguments[a];
}
var temp = function () {
return f.apply(parent, args);
}
return (temp);
}
$(function () {

View file

@ -8,21 +8,6 @@
return s;
}
Function.prototype.bind = function (parent) {
var f = this;
var args = [];
for (var a = 1; a < arguments.length; a++) {
args[args.length] = arguments[a];
}
var temp = function () {
return f.apply(parent, args);
}
return (temp);
}
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});