Skip to content

Commit 2469800

Browse files
authored
Fix(ang-842) - Component creation location bug/Wiki delete button bug (#528)
* fix(ang-842): fixed wiki delete button bug * fix(ang-842): fixed location bug in create component dialog * fix(ang-842): refactor
1 parent 7cfe9ae commit 2469800

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,13 @@ export class AddComponentDialogComponent implements OnInit {
8484
constructor() {
8585
effect(() => {
8686
const storageLocations = this.storageLocations();
87-
if (!storageLocations) return;
87+
if (!storageLocations?.length) return;
8888

89-
const defaultRegion = this.currentUser()?.defaultRegionId || storageLocations[0].id;
90-
this.componentForm.controls[ComponentFormControls.StorageLocation].setValue(defaultRegion);
89+
const storageLocationControl = this.componentForm.controls[ComponentFormControls.StorageLocation];
90+
if (!storageLocationControl.value) {
91+
const defaultRegion = this.currentUser()?.defaultRegionId ?? storageLocations[0].id;
92+
storageLocationControl.setValue(defaultRegion);
93+
}
9194
});
9295
}
9396

src/app/shared/components/wiki/wiki-list/wiki-list.component.html

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,41 @@ <h4 class="ml-2">{{ item.label | translate }}</h4>
7171
</p-panel>
7272
} @else {
7373
<div class="mb-2">
74-
<p-button class="btn-icon-only" raised outlined severity="contrast" (onClick)="collapseNavigation()">
74+
<p-button
75+
class="btn-icon-only"
76+
styleClass="flex gap-3"
77+
raised
78+
outlined
79+
severity="contrast"
80+
(onClick)="collapseNavigation()"
81+
>
7582
<i class="fas fa-list-ul"></i>
7683
<i class="fas fa-forward"></i>
7784
</p-button>
7885
</div>
7986
@if (canEdit()) {
80-
<p-button
81-
class="btn-icon-only"
82-
icon="fas fa-plus"
83-
raised
84-
outlined
85-
severity="success"
86-
(onClick)="openAddWikiDialog()"
87-
/>
87+
<div class="flex gap-2">
88+
<p-button
89+
class="btn-icon-only"
90+
icon="fas fa-plus"
91+
raised
92+
outlined
93+
severity="success"
94+
(onClick)="openAddWikiDialog()"
95+
/>
96+
@if (list().length) {
97+
@if (!isHomeWikiSelected()) {
98+
<p-button
99+
class="btn-icon-only"
100+
icon="fas fa-trash"
101+
raised
102+
outlined
103+
severity="danger"
104+
(onClick)="openDeleteWikiDialog()"
105+
/>
106+
}
107+
}
108+
</div>
88109
}
89110
}
90111
}

0 commit comments

Comments
 (0)