2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
19 import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core';
20 import {ActivatedRoute, Router} from "@angular/router";
21 import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
22 import {UserService} from "../../../../services/user.service";
25 selector: 'app-manage-users-delete',
26 templateUrl: './manage-users-delete.component.html',
27 styleUrls: ['./manage-users-delete.component.scss']
29 export class ManageUsersDeleteComponent implements OnInit, AfterViewInit {
31 @ViewChild('userdelete') askModal;
35 constructor(private route: ActivatedRoute, private modal: NgbModal,
36 private userService: UserService, private router : Router) {
37 this.route.params.subscribe((params)=>{
39 this.user_id = params.userid;
49 if (this.user_id!=null && this.user_id!='') {
50 let modalInstance = this.modal.open(this.askModal).result.then((result) => {
51 console.log("Result: " + result);
52 let userId = this.user_id;
53 if (result=='YES' && userId!=null && userId!='') {
54 let deleted = this.userService.deleteUser(userId).subscribe();
56 this.router.navigate(['/user','users','list']);
60 console.log("Reason: " + reason);
65 ngAfterViewInit(): void {
66 if (this.user_id!=null) {