\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts
deleted file mode 100644
index 36b187e79..000000000
--- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-add.component.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { Component, OnInit } from "@angular/core";
-import { Router } from "@angular/router";
-
-import { ICheckbox, IUser, UserType } from "../interfaces";
-import { IdentityService, NotificationService } from "../services";
-
-@Component({
- templateUrl: "./usermanagement-add.component.html",
-})
-export class UserManagementAddComponent implements OnInit {
- public user: IUser;
- public availableClaims: ICheckbox[];
- public confirmPass: "";
-
- constructor(private identityService: IdentityService,
- private notificationSerivce: NotificationService,
- private router: Router) { }
-
- public ngOnInit() {
- this.identityService.getAllAvailableClaims().subscribe(x => this.availableClaims = x);
- this.user = {
- alias: "",
- claims: [],
- emailAddress: "",
- id: "",
- password: "",
- userName: "",
- userType: UserType.LocalUser,
- checked: false,
- hasLoggedIn: false,
- lastLoggedIn: new Date(),
- episodeRequestLimit: 0,
- movieRequestLimit: 0,
- userAccessToken: "",
- };
- }
-
- public create() {
- this.user.claims = this.availableClaims;
-
- if (this.user.password) {
- if (this.user.password !== this.confirmPass) {
- this.notificationSerivce.error("Passwords do not match");
- return;
- }
- }
- const hasClaims = this.availableClaims.some((item) => {
- if (item.enabled) { return true; }
-
- return false;
- });
-
- if (!hasClaims) {
- this.notificationSerivce.error("Please assign a role");
- return;
- }
-
- this.identityService.createUser(this.user).subscribe(x => {
- if (x.successful) {
- this.notificationSerivce.success(`The user ${this.user.userName} has been created successfully`);
- this.router.navigate(["usermanagement"]);
- } else {
- x.errors.forEach((val) => {
- this.notificationSerivce.error(val);
- });
- }
- });
- }
-
-}
diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.html b/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.html
deleted file mode 100644
index 95a70cab0..000000000
--- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
User: {{user.userName}}
-
-
-
-
-
-
-
-
User Details
-
-
-
Roles
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html
new file mode 100644
index 000000000..0dcb24cb4
--- /dev/null
+++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.html
@@ -0,0 +1,154 @@
+
+
Create User
+
+
+
+
+
User Details
+
+
+
Roles
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
User: {{user.userName}}
+
+
+
+
+
+
+
+
User Details
+
+
+
Roles
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts
similarity index 51%
rename from src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts
rename to src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts
index a83ef5a97..bca4f1058 100644
--- a/src/Ombi/ClientApp/app/usermanagement/usermanagement-edit.component.ts
+++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement-user.component.ts
@@ -1,32 +1,92 @@
-import { Component } from "@angular/core";
-import { Router } from "@angular/router";
+import { Component, OnInit } from "@angular/core";
+import { ActivatedRoute, Router } from "@angular/router";
+
+import { ICheckbox, IUser, UserType } from "../interfaces";
+import { IdentityService, NotificationService } from "../services";
+
import { ConfirmationService } from "primeng/primeng";
-import { ActivatedRoute } from "@angular/router";
-import { IUser } from "../interfaces";
-import { IdentityService } from "../services";
-import { NotificationService } from "../services";
-
@Component({
- templateUrl: "./usermanagement-edit.component.html",
+ templateUrl: "./usermanagement-user.component.html",
})
-export class UserManagementEditComponent {
+export class UserManagementUserComponent implements OnInit {
+
public user: IUser;
public userId: string;
+ public availableClaims: ICheckbox[];
+ public confirmPass: "";
+
+ public edit: boolean;
constructor(private identityService: IdentityService,
- private route: ActivatedRoute,
private notificationService: NotificationService,
private router: Router,
+ private route: ActivatedRoute,
private confirmationService: ConfirmationService) {
- this.route.params
+ this.route.params
.subscribe((params: any) => {
- this.userId = params.id;
-
- this.identityService.getUserById(this.userId).subscribe(x => {
- this.user = x;
- });
+ if(params.id) {
+ this.userId = params.id;
+ this.edit = true;
+ this.identityService.getUserById(this.userId).subscribe(x => {
+ this.user = x;
+ });
+ }
});
+
+ }
+
+ public ngOnInit() {
+ this.identityService.getAllAvailableClaims().subscribe(x => this.availableClaims = x);
+ if(!this.edit) {
+ this.user = {
+ alias: "",
+ claims: [],
+ emailAddress: "",
+ id: "",
+ password: "",
+ userName: "",
+ userType: UserType.LocalUser,
+ checked: false,
+ hasLoggedIn: false,
+ lastLoggedIn: new Date(),
+ episodeRequestLimit: 0,
+ movieRequestLimit: 0,
+ userAccessToken: "",
+ };
+ }
+ }
+
+ public create() {
+ this.user.claims = this.availableClaims;
+
+ if (this.user.password) {
+ if (this.user.password !== this.confirmPass) {
+ this.notificationService.error("Passwords do not match");
+ return;
+ }
+ }
+ const hasClaims = this.availableClaims.some((item) => {
+ if (item.enabled) { return true; }
+
+ return false;
+ });
+
+ if (!hasClaims) {
+ this.notificationService.error("Please assign a role");
+ return;
+ }
+
+ this.identityService.createUser(this.user).subscribe(x => {
+ if (x.successful) {
+ this.notificationService.success(`The user ${this.user.userName} has been created successfully`);
+ this.router.navigate(["usermanagement"]);
+ } else {
+ x.errors.forEach((val) => {
+ this.notificationService.error(val);
+ });
+ }
+ });
}
public delete() {
diff --git a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html
index 519db023f..de78f64f8 100644
--- a/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html
+++ b/src/Ombi/ClientApp/app/usermanagement/usermanagement.component.html
@@ -2,7 +2,7 @@
-
+