mirror of https://github.com/portainer/portainer
fix(gpu): EE-3743 gpus null error (#7342)
parent
ce22544c60
commit
44737029a9
|
@ -84,12 +84,12 @@ function Option(props: OptionProps<GpuOption, true>) {
|
|||
export function Gpu({
|
||||
values,
|
||||
onChange,
|
||||
gpus,
|
||||
gpus = [],
|
||||
usedGpus = [],
|
||||
usedAllGpus,
|
||||
}: Props) {
|
||||
const options = useMemo(() => {
|
||||
const options = gpus.map((gpu) => ({
|
||||
const options = (gpus || []).map((gpu) => ({
|
||||
value: gpu.value,
|
||||
label:
|
||||
usedGpus.includes(gpu.value) || usedAllGpus
|
||||
|
|
|
@ -46,7 +46,7 @@ angular.module('portainer.docker').controller('DashboardController', [
|
|||
|
||||
$scope.buildGpusStr = function (gpuUseSet) {
|
||||
var gpusAvailable = new Object();
|
||||
for (let i = 0; i < $scope.endpoint.Gpus.length; i++) {
|
||||
for (let i = 0; i < ($scope.endpoint.Gpus || []).length; i++) {
|
||||
if (!gpuUseSet.has($scope.endpoint.Gpus[i].name)) {
|
||||
var exist = false;
|
||||
for (let gpuAvailable in gpusAvailable) {
|
||||
|
|
|
@ -175,7 +175,7 @@ function EndpointController(
|
|||
}
|
||||
|
||||
function verifyGpus() {
|
||||
var i = $scope.endpoint.Gpus.length;
|
||||
var i = ($scope.endpoint.Gpus || []).length;
|
||||
while (i--) {
|
||||
if ($scope.endpoint.Gpus[i].name === '' || $scope.endpoint.Gpus[i].name === null) {
|
||||
$scope.endpoint.Gpus.splice(i, 1);
|
||||
|
|
Loading…
Reference in New Issue