-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAS-132095 / 25.04 / Add support for USB and GPU devices to containers (
#10987) * NAS-132095: Initial * NAS-132095: Add support for USB and GPU devices to containers * NAS-132095: Add support for USB and GPU devices to containers * NAS-132095: PR update * NAS-132095: PR update * NAS-132095: PR update --------- Co-authored-by: undsoft <[email protected]>
- Loading branch information
1 parent
960c5c2
commit daaea8e
Showing
98 changed files
with
533 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
|
||
.table-container { | ||
background: var(--bg2); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
@import 'scss-imports/variables'; | ||
|
||
:host { | ||
|
||
display: block; | ||
width: 100%; | ||
width: 100%; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 2 additions & 14 deletions
16
...omponents/all-instances/instance-details/instance-devices/instance-devices.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
@import 'mixins/cards'; | ||
@import 'scss-imports/variables'; | ||
|
||
:host { | ||
.card { | ||
@include details-card(); | ||
margin: 0; | ||
|
||
mat-card-header { | ||
button { | ||
margin-left: 8px; | ||
} | ||
} | ||
} | ||
mat-card-content p { | ||
margin: 0 0 6px; | ||
} |
66 changes: 66 additions & 0 deletions
66
...onents/all-instances/instance-details/instance-devices/instance-devices.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { MatProgressSpinner } from '@angular/material/progress-spinner'; | ||
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; | ||
import { MockComponents } from 'ng-mocks'; | ||
import { mockCall, mockWebSocket } from 'app/core/testing/utils/mock-websocket.utils'; | ||
import { VirtualizationDeviceType } from 'app/enums/virtualization.enum'; | ||
import { VirtualizationDevice, VirtualizationInstance } from 'app/interfaces/virtualization.interface'; | ||
import { InstanceDevicesComponent } from 'app/pages/virtualization/components/all-instances/instance-details/instance-devices/instance-devices.component'; | ||
|
||
describe('InstanceDevicesComponent', () => { | ||
let spectator: Spectator<InstanceDevicesComponent>; | ||
|
||
const demoInstance = { | ||
id: 'demo', | ||
name: 'Demo', | ||
type: 'CONTAINER', | ||
status: 'RUNNING', | ||
cpu: '525', | ||
autostart: true, | ||
image: { | ||
architecture: 'amd64', | ||
description: 'Almalinux 8 amd64 (20241030_23:38)', | ||
os: 'Almalinux', | ||
release: '8', | ||
}, | ||
memory: 131072000, | ||
} as unknown as VirtualizationInstance; | ||
|
||
const devices = [ | ||
{ dev_type: VirtualizationDeviceType.Gpu }, | ||
{ dev_type: VirtualizationDeviceType.Usb }, | ||
] as VirtualizationDevice[]; | ||
|
||
const createComponent = createComponentFactory({ | ||
component: InstanceDevicesComponent, | ||
declarations: [ | ||
MockComponents( | ||
MatProgressSpinner, | ||
), | ||
], | ||
providers: [ | ||
mockWebSocket([ | ||
mockCall('virt.instance.device_list', devices), | ||
]), | ||
], | ||
}); | ||
|
||
beforeEach(() => { | ||
spectator = createComponent({ | ||
props: { | ||
instance: demoInstance, | ||
}, | ||
}); | ||
}); | ||
|
||
it('checks card title', () => { | ||
const title = spectator.query('h3'); | ||
expect(title).toHaveText('Devices'); | ||
}); | ||
|
||
it('renders details in card', () => { | ||
const chartExtra = spectator.query('mat-card-content').querySelectorAll('p'); | ||
expect(chartExtra).toHaveLength(2); | ||
expect(chartExtra[0]).toHaveText('Device Type: Gpu'); | ||
expect(chartExtra[1]).toHaveText('Device Type: Usb'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...all-instances/instance-details/instance-general-info/instance-general-info.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
mat-card-content p { | ||
margin: 0 0 6px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.