Skip to content

Commit 8aee9ca

Browse files
author
William Leuschner
committed
[#2059] Remove some repetition; shrink spacing
Also that CSS rule wasn't being used for anything, so I deleted it.
1 parent 1dfd420 commit 8aee9ca

3 files changed

Lines changed: 31 additions & 80 deletions

File tree

webui/src/app/leases-list-table/leases-list-table.component.html

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -252,24 +252,12 @@
252252
</ng-template>
253253
<ng-template #body let-l>
254254
<tr id="lease-row-{{ l.id }}">
255-
<td>
256-
{{ l.ipAddress }}
257-
</td>
258-
<td>
259-
{{ l.hwAddress || '—' }}
260-
</td>
261-
<td>
262-
{{ l.duid || '—' }}
263-
</td>
264-
<td>
265-
{{ l.clientId || '—' }}
266-
</td>
267-
<td>
268-
{{ l.prefixLength || '—' }}
269-
</td>
270-
<td>
271-
{{ stateToString(l.state) }}
272-
</td>
255+
<td>{{ l.ipAddress }}</td>
256+
<td>{{ l.hwAddress || '—' }}</td>
257+
<td>{{ l.duid || '—' }}</td>
258+
<td>{{ l.clientId || '—' }}</td>
259+
<td>{{ l.prefixLength || '—' }}</td>
260+
<td>{{ stateToString(l.state) }}</td>
273261
<td>
274262
<app-entity-link
275263
entity="daemon"
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
.message
2-
// Sets the maximum non-flexible height of the message content of the modal
3-
// dialog to prevent it from exceeding its parent container.
4-
max-height: 50vh

webui/src/app/leases-list-table/leases-list-table.component.spec.ts

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ import { DHCPService, ServicesService } from '../backend'
1212
import { By } from '@angular/platform-browser'
1313
import { of, throwError } from 'rxjs'
1414

15+
const exampleV6Lease = {
16+
id: 1,
17+
daemonId: 8,
18+
daemonLabel: 'DHCPv6',
19+
cltt: 10,
20+
ipAddress: 'fe80::10',
21+
state: 1,
22+
subnetId: 24,
23+
validLifetime: 3600,
24+
}
25+
const exampleV4Lease = {
26+
id: 1,
27+
daemonId: 8,
28+
daemonLabel: 'DHCPv4',
29+
cltt: 11,
30+
ipAddress: '10.168.1.67',
31+
state: 1,
32+
subnetId: 27,
33+
validLifetime: 3600,
34+
}
35+
1536
describe('LeasesListTableComponent', () => {
1637
let component: LeasesListTableComponent
1738
let fixture: ComponentFixture<LeasesListTableComponent>
@@ -114,18 +135,7 @@ describe('LeasesListTableComponent', () => {
114135
}))
115136

116137
it('should be filtered by subnetId', fakeAsync(() => {
117-
component.dataCollection = [
118-
{
119-
id: 1,
120-
daemonId: 8,
121-
daemonLabel: 'DHCPv6',
122-
cltt: 10,
123-
ipAddress: 'fe80::10',
124-
state: 1,
125-
subnetId: 24,
126-
validLifetime: 3600,
127-
},
128-
]
138+
component.dataCollection = [exampleV6Lease]
129139
fixture.detectChanges()
130140

131141
getLeaseListSpy.and.callThrough()
@@ -146,18 +156,7 @@ describe('LeasesListTableComponent', () => {
146156
}))
147157

148158
it('should be filtered by localSubnetId', fakeAsync(() => {
149-
component.dataCollection = [
150-
{
151-
id: 1,
152-
daemonId: 8,
153-
daemonLabel: 'DHCPv4',
154-
cltt: 11,
155-
ipAddress: '10.168.1.67',
156-
state: 1,
157-
subnetId: 27,
158-
validLifetime: 3600,
159-
},
160-
]
159+
component.dataCollection = [exampleV4Lease]
161160
fixture.detectChanges()
162161

163162
getLeaseListSpy.and.callThrough()
@@ -178,18 +177,7 @@ describe('LeasesListTableComponent', () => {
178177
}))
179178

180179
it('should display errors using the MessageService', fakeAsync(() => {
181-
component.dataCollection = [
182-
{
183-
id: 1,
184-
daemonId: 8,
185-
daemonLabel: 'DHCPv4',
186-
cltt: 11,
187-
ipAddress: '10.168.1.67',
188-
state: 1,
189-
subnetId: 27,
190-
validLifetime: 3600,
191-
},
192-
]
180+
component.dataCollection = [exampleV4Lease]
193181
fixture.detectChanges()
194182

195183
getLeaseListSpy.and.returnValue(
@@ -211,28 +199,7 @@ describe('LeasesListTableComponent', () => {
211199
)
212200
}))
213201
it('should be filtered by machineId', fakeAsync(() => {
214-
component.dataCollection = [
215-
{
216-
id: 1,
217-
daemonId: 8,
218-
daemonLabel: 'DHCPv4',
219-
cltt: 11,
220-
ipAddress: '10.168.1.67',
221-
state: 1,
222-
subnetId: 9,
223-
validLifetime: 3600,
224-
},
225-
{
226-
id: 2,
227-
daemonId: 10,
228-
daemonLabel: 'DHCPv4',
229-
cltt: 11,
230-
ipAddress: '10.168.2.67',
231-
state: 0,
232-
subnetId: 10,
233-
validLifetime: 3600,
234-
},
235-
]
202+
component.dataCollection = [exampleV4Lease]
236203
fixture.detectChanges()
237204

238205
getLeaseListSpy.and.callThrough()

0 commit comments

Comments
 (0)