From 1f422a3134a0060be7e1f768d113859ddd1b36a3 Mon Sep 17 00:00:00 2001
From: Ludek Novy <13610612+ludeknovy@users.noreply.github.com>
Date: Sun, 18 Feb 2024 14:48:22 +0100
Subject: [PATCH] Edit item status (#377)
---
.../item-detail/item-detail.component.html | 2 +-
src/app/item-detail/item-detail.component.ts | 3 +-
.../request-stats-compare.component.spec.ts | 45 +++++++++----------
src/app/items.service.model.ts | 1 +
.../add-new-item/add-new-item.model.ts | 3 +-
.../item-controls/item-controls.model.ts | 1 +
src/app/scenario/scenario.component.html | 2 +-
.../edit-item/edit-item.component.html | 8 ++++
.../edit-item/edit-item.component.ts | 30 ++++++++-----
9 files changed, 58 insertions(+), 37 deletions(-)
diff --git a/src/app/item-detail/item-detail.component.html b/src/app/item-detail/item-detail.component.html
index 6b3fc669..23814817 100644
--- a/src/app/item-detail/item-detail.component.html
+++ b/src/app/item-detail/item-detail.component.html
@@ -18,7 +18,7 @@
class="fas fa-bars">
+
+
+
+
();
+ note: string, environment: string, hostname: string, name: string
+ }>();
constructor(
private modalService: NgbModal,
private itemsApiService: ItemsApiService,
private itemsService: ItemsService,
private notification: NotificationMessage
- ) { }
+ ) {
+ }
ngOnInit(): void {
this.isBase = this.itemDetailData.isBase;
@@ -59,9 +66,11 @@ export class EditItemComponent implements OnInit {
this.base = new FormControl(this.itemDetailData.isBase, []);
this.name = new FormControl(this.itemDetailData.name, [
Validators.maxLength(200)
- ])
+ ]);
this.resourcesLink = new FormControl(this.itemDetailData.resourcesLink,
- [Validators.maxLength(350)])
+ [Validators.maxLength(350)]);
+ this.status = new FormControl(Object.keys(ItemStatusValue).find(x => ItemStatusValue[x] === this.itemDetailData.status), [
+ ]);
}
createForm() {
@@ -72,6 +81,7 @@ export class EditItemComponent implements OnInit {
base: this.base,
name: this.name,
resourcesLink: this.resourcesLink,
+ status: this.status,
});
}
@@ -81,20 +91,20 @@ export class EditItemComponent implements OnInit {
onSubmit() {
if (this.myform.valid) {
- const { note, environment, base, hostname, name, resourcesLink } = this.myform.value;
+ const { note, environment, base, hostname, name, resourcesLink, status } = this.myform.value;
const { projectName, id, scenarioName } = this.itemDetailData.params;
this.itemsApiService.updateItemInfo(id, projectName, scenarioName,
- { environment, note, base, hostname, name, resourcesLink })
+ { environment, note, base, hostname, name, resourcesLink, status: ItemStatusValue[status] })
.pipe(catchError(r => of(r)))
.subscribe(_ => {
this.itemDetailChange.emit({ note, environment, hostname, name });
const message = this.notification.itemUpdate(_);
return this.itemsApiService.setData(message);
}).add((_) => {
- if (this.reloadItems) {
- this.itemsService.fetchItems(projectName, scenarioName);
- }
- });
+ if (this.reloadItems) {
+ this.itemsService.fetchItems(projectName, scenarioName);
+ }
+ });
this.modalService.dismissAll();
}
}