Skip to content

Commit b543788

Browse files
nabramovitznorman-abramovitz
authored andcommitted
Fix Variables tab L5 form regressions
Three fixes for the inline Add Variable form on the L5 sub-nav: 1. The legacy .form-field wrapper carried margin-bottom: 16px which pushed the input box off-center within the row's flex layout, misaligning the inputs against the done/clear buttons. Drop the wrapper and style the inputs with Tailwind primitives matching the "Filter by Name" input below: white bg, rounded-md, border gray-300, slate-800 text, gray-400 70% placeholder. 2. ListComponent's isAddingOrSelecting$ collapsed the legacy toolbar (title, filter, sort, refresh) whenever isAdding$ was true. With suppressAddButton=true the inline form lives outside the list in an L5 sub-nav, so isAdding$ no longer means "the list's toolbar is in form mode". Gate the collapse on suppressAddButton so the toolbar stays visible while the L5 form is open. 3. Reserve form-row height on the L5 sub-nav when the consumer wires `isAdding` (i.e., plans to host an inline form). Pages without an inline form keep their compact button-row height; pages with one render at a constant 68px in both closed and open states so the user doesn't see the row grow when they click Add.
1 parent 7d0d128 commit b543788

4 files changed

Lines changed: 28 additions & 20 deletions

File tree

src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/variables-tab/variables-tab.component.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
Replaces the +Add Variable button. Uses the same data-source
77
model bindings the legacy in-toolbar form used; save/cancel
88
call dataSource methods directly. -->
9-
<div subNavForm class="variables-tab__env-table--add-form flex items-center gap-2">
9+
<div subNavForm class="flex items-center gap-2">
1010
<form #addForm="ngForm" novalidate class="flex items-center gap-2">
11-
<div class="form-field">
12-
<input class="input" id="envVarName" name="envVarName" #envVarName="ngModel" placeholder="Name"
11+
<div class="flex flex-col">
12+
<input class="bg-white rounded-md border border-gray-300 px-3 py-2 text-base text-slate-800 placeholder:text-gray-400 placeholder:opacity-70 focus:outline-none focus:ring-1 focus:ring-primary" id="envVarName" name="envVarName" #envVarName="ngModel" placeholder="Name"
1313
[(ngModel)]="envVarsDataSource.addItem.name" required [appUnique]="envVarNames()">
1414
@if (envVarName.errors?.required && envVarName.dirty) {
15-
<div class="text-red-500 text-sm mt-1">Name is required</div>
15+
<div class="text-red-500 text-xs mt-0.5">Name is required</div>
1616
}
1717
@if (envVarName.errors?.appUnique && envVarName.dirty) {
18-
<div class="text-red-500 text-sm mt-1">{{envVarName.errors.appUnique.message}}</div>
18+
<div class="text-red-500 text-xs mt-0.5">{{envVarName.errors.appUnique.message}}</div>
1919
}
2020
</div>
21-
<div class="form-field">
22-
<input class="input" id="envVarValue" name="envVarValue" placeholder="Value"
21+
<div class="flex flex-col">
22+
<input class="bg-white rounded-md border border-gray-300 px-3 py-2 text-base text-slate-800 placeholder:text-gray-400 placeholder:opacity-70 focus:outline-none focus:ring-1 focus:ring-primary" id="envVarValue" name="envVarValue" placeholder="Value"
2323
[(ngModel)]="envVarsDataSource.addItem.value">
2424
</div>
2525
</form>
26-
<button id="addFormButtonAdd" class="btn btn-icon btn-success"
26+
<button id="addFormButtonAdd" class="btn btn-icon btn-success h-9"
2727
type="button"
2828
(click)="envVarsDataSource.saveAdd()" [disabled]="!addForm.valid">
2929
<span class="material-icons">done</span>
3030
</button>
31-
<button id="addFormButtonCancel" class="btn btn-icon"
31+
<button id="addFormButtonCancel" class="btn btn-icon h-9"
3232
type="button"
3333
(click)="envVarsDataSource.cancelAdd()">
3434
<span class="material-icons">clear</span>

src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/variables-tab/variables-tab.component.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,4 @@
1515
}
1616
}
1717
}
18-
&__env-table--add-form {
19-
form {
20-
@apply flex flex-row;
21-
}
22-
.form-field {
23-
@apply pr-2.5;
24-
}
25-
}
2618
}

src/frontend/packages/core/src/shared/components/list-sub-nav/list-sub-nav.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export interface ListSubNavAddAction {
4444
changeDetection: ChangeDetectionStrategy.OnPush,
4545
template: `
4646
<div data-test="list-sub-nav"
47-
class="flex items-center justify-between gap-3 px-6 py-3 bg-content-bg border-b border-content-border">
47+
[class]="rowClasses">
4848
<div class="text-base font-semibold text-content-text whitespace-nowrap" data-test="list-sub-nav-title">
4949
{{ title }}: <span class="text-content-muted font-medium">{{ count() }}</span>
5050
</div>
@@ -97,6 +97,15 @@ export class ListSubNavComponent {
9797
return v ? v() : true;
9898
});
9999

100+
/** Row classes. When the consumer wires `isAdding` (i.e., plans to host
101+
* an inline form), reserve enough height to accommodate the form so
102+
* the row doesn't shift between closed and open states. Pages without
103+
* an inline form keep the natural compact button-row height. */
104+
protected get rowClasses(): string {
105+
const base = 'flex items-center justify-between gap-3 px-6 py-3 bg-content-bg border-b border-content-border';
106+
return this.isAdding ? `${base} min-h-[4.25rem]` : base;
107+
}
108+
100109
protected readonly isAddDisabled = computed(() => {
101110
const d = this.addAction?.disabled;
102111
return d ? d() : false;

src/frontend/packages/core/src/shared/components/list/list.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,19 @@ export class ListComponent<T> implements OnInit, OnChanges, OnDestroy, AfterView
364364
}
365365
this.multiFilterManagers = this.getMultiFilterManagers();
366366

367-
// Create convenience observables that make the html clearer
367+
// Create convenience observables that make the html clearer.
368+
//
369+
// When `suppressAddButton` is set the inline add form lives outside
370+
// the list (in an L5 sub-nav above it), so `isAdding$` here means
371+
// "the upstream form is open" — it should NOT collapse the list's
372+
// own toolbar (title, filter row, sort/view/refresh). `isSelecting$`
373+
// still does, because multi-select replaces the toolbar with batch
374+
// actions in-place.
368375
this.isAddingOrSelecting$ = observableCombineLatest(
369376
this.dataSource.isAdding$,
370377
this.dataSource.isSelecting$
371378
).pipe(
372-
map(([isAdding, isSelecting]) => isAdding || isSelecting)
379+
map(([isAdding, isSelecting]) => isSelecting || (isAdding && !this.suppressAddButton))
373380
);
374381
// Set up an observable containing the current view (card/table)
375382
this.listViewKey = this.dataSource.entityKey + '-' + this.dataSource.paginationKey;

0 commit comments

Comments
 (0)