ends article branch
This commit is contained in:
@@ -14,12 +14,18 @@ import { ProgressBarModule } from 'primeng/progressbar';
|
||||
selector: 'app-knock-page',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule, RouterModule, ReactiveFormsModule,
|
||||
InputTextModule, CheckboxModule, ButtonModule, CardModule,
|
||||
DividerModule, ProgressBarModule
|
||||
CommonModule,
|
||||
RouterModule,
|
||||
ReactiveFormsModule,
|
||||
InputTextModule,
|
||||
CheckboxModule,
|
||||
ButtonModule,
|
||||
CardModule,
|
||||
DividerModule,
|
||||
ProgressBarModule,
|
||||
],
|
||||
templateUrl: './knock-page.component.html',
|
||||
styleUrls: ['./knock-page.component.scss']
|
||||
styleUrls: ['./knock-page.component.scss'],
|
||||
})
|
||||
export class KnockPageComponent {
|
||||
private readonly http = inject(HttpClient);
|
||||
@@ -36,7 +42,7 @@ export class KnockPageComponent {
|
||||
form = this.fb.group({
|
||||
targets: ['tcp:127.0.0.1:22', Validators.required],
|
||||
delay: ['1s', Validators.required],
|
||||
waitConnection: [false]
|
||||
waitConnection: [false],
|
||||
});
|
||||
|
||||
execute() {
|
||||
@@ -48,13 +54,14 @@ export class KnockPageComponent {
|
||||
const body: any = {
|
||||
targets: v.targets,
|
||||
delay: v.delay,
|
||||
waitConnection: v.waitConnection
|
||||
waitConnection: v.waitConnection,
|
||||
verbose: true,
|
||||
};
|
||||
|
||||
this.executing = true;
|
||||
this.startTimer();
|
||||
|
||||
// Без обязательного Basic-Auth: заголовок не добавляется, если пароль не требуется
|
||||
|
||||
this.http.post('/api/v1/knock-actions/execute', body).subscribe({
|
||||
next: () => {
|
||||
this.executing = false;
|
||||
@@ -64,8 +71,8 @@ export class KnockPageComponent {
|
||||
error: (e: HttpErrorResponse) => {
|
||||
this.executing = false;
|
||||
this.stopTimer();
|
||||
this.error = (e.error?.error) || e.message;
|
||||
}
|
||||
this.error = e.error?.error || e.message;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,5 +99,3 @@ export class KnockPageComponent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user