Skip to content

Commit 3c73d69

Browse files
committed
fix: enhance action sidebar interaction and update action terminal for better context handling
1 parent 3091046 commit 3c73d69

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

frontend/src/app/incident-response/shared/component/action-builder/action-builder.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h4 class="panel-title m-0">Flow Actions</h4>
8686

8787
<div *ngFor="let action of workflow; let first = first" class="action-wrapper d-flex flex-column w-100">
8888
<!-- Action block -->
89-
<div class="action-block d-flex flex-column w-100 p-2" style="height: 120px;">
89+
<div (click)="openActionSidebar(action)" class="action-block cursor-pointer d-flex flex-column w-100 p-2" style="height: 120px;">
9090

9191
<div class="d-flex justify-content-between align-items-center w-100 mb-1">
9292
<div class="fw-bold pl-2">{{ action.title }}</div>

frontend/src/app/incident-response/shared/component/action-builder/action-builder.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ export class ActionBuilderComponent implements OnInit, OnDestroy {
112112
);
113113
}
114114

115-
openActionSidebar() {
115+
openActionSidebar(action: any = null) {
116116
const dialogRef = this.modalService.open(ActionTerminalComponent, {size: 'lg', centered: true});
117+
dialogRef.componentInstance.action = action || null;
117118

118119
dialogRef.result.then(
119120
result => {

frontend/src/app/incident-response/shared/component/action-terminal/action-terminal.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ <h6 class="font-weight-semibold mt-3 mb-2">Alert fields</h6>
7474
</button>
7575

7676
<button [disabled]="!form.valid" (click)="create()" class="btn utm-button utm-button-primary ml-2 ng-star-inserted">
77-
Create
77+
{{ action ? 'Update' : 'Create' }}
7878
</button>
7979
</div>
8080
</form>

frontend/src/app/incident-response/shared/component/action-terminal/action-terminal.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import {Component, Input, OnInit} from '@angular/core';
22
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
33
import {NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
44
import {ALERT_FIELDS, INCIDENT_AUTOMATION_ALERT_FIELDS} from '../../../../shared/constants/alert/alert-field.constant';
@@ -9,7 +9,7 @@ import {ALERT_FIELDS, INCIDENT_AUTOMATION_ALERT_FIELDS} from '../../../../shared
99
styleUrls: ['./action-terminal.component.scss']
1010
})
1111
export class ActionTerminalComponent implements OnInit {
12-
12+
@Input() action: any;
1313
form: FormGroup;
1414
alertFields = ALERT_FIELDS;
1515
command: any;
@@ -27,9 +27,9 @@ export class ActionTerminalComponent implements OnInit {
2727

2828
ngOnInit() {
2929
this.form = this.fb.group({
30-
title: ['', [Validators.required, Validators.minLength(5)]],
31-
description: ['', [Validators.required, Validators.minLength(5)]],
32-
command: ['', Validators.required],
30+
title: [ this.action ? this.action.title : '', [Validators.required, Validators.minLength(5)]],
31+
description: [this.action ? this.action.description : '', [Validators.required, Validators.minLength(5)]],
32+
command: [this.action ? this.action.command : '', Validators.required],
3333
});
3434
}
3535

0 commit comments

Comments
 (0)