angular
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import axios from 'axios';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@Component({
|
||||
selector: 'app-kill-process',
|
||||
templateUrl: './kill-process.component.html',
|
||||
styleUrls: ['./kill-process.component.scss'],
|
||||
imports: [FormsModule,CommonModule]
|
||||
})
|
||||
export class KillProcessComponent implements OnInit {
|
||||
processId: number = 0;
|
||||
message: string = '';
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
async killProcess() {
|
||||
try {
|
||||
const response = await axios.post('http://localhost:5000/api/kill-process', this.processId.toString());
|
||||
this.message = response.data;
|
||||
} catch (error) {
|
||||
console.error('Error killing process:', error);
|
||||
this.message = 'An error occurred while trying to kill the process.';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user