Add multi-layer RIC instance selector
[portal/ric-dashboard.git] / dashboard / webapp-frontend / src / app / user / edit-dashboard-user-dialog / edit-dashboard-user-dialog.component.ts
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2019 AT&T Intellectual Property
6  * %%
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ========================LICENSE_END===================================
19  */
20
21 import { Component, Inject, OnInit } from '@angular/core';
22 import { FormControl, FormGroup, Validators } from '@angular/forms';
23 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
24 import { DashboardService } from '../../services/dashboard/dashboard.service';
25 import { ErrorDialogService } from '../../services/ui/error-dialog.service';
26
27
28 @Component({
29   selector: 'rd-edit-app-dashboard-user-dialog',
30   templateUrl: './edit-dashboard-user-dialog.component.html',
31   styleUrls: ['./edit-dashboard-user-dialog.component.scss']
32 })
33 export class EditDashboardUserDialogComponent implements OnInit {
34
35   public editUserDialogForm: FormGroup;
36
37   constructor(
38     @Inject(MAT_DIALOG_DATA) public data,
39     private dialogRef: MatDialogRef<EditDashboardUserDialogComponent>,
40     private dashSvc: DashboardService,
41     private errorService: ErrorDialogService) { }
42
43   ngOnInit() {
44     this.editUserDialogForm = new FormGroup({
45       firstName: new FormControl(this.data.firstName , [Validators.required]),
46       lastName: new FormControl(this.data.lastName, [Validators.required]),
47       status: new FormControl(this.data.status, [Validators.required])
48     });
49   }
50
51   onCancel() {
52     this.dialogRef.close(false);
53   }
54
55   public editUser = (FormValue) => {
56     if (this.editUserDialogForm.valid) {
57       // send the request to backend when it's ready
58       const aboutError = 'Not implemented yet';
59       this.errorService.displayError(aboutError);
60     }
61   }
62
63 }