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({
|
export function Gpu({
|
||||||
values,
|
values,
|
||||||
onChange,
|
onChange,
|
||||||
gpus,
|
gpus = [],
|
||||||
usedGpus = [],
|
usedGpus = [],
|
||||||
usedAllGpus,
|
usedAllGpus,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const options = useMemo(() => {
|
const options = useMemo(() => {
|
||||||
const options = gpus.map((gpu) => ({
|
const options = (gpus || []).map((gpu) => ({
|
||||||
value: gpu.value,
|
value: gpu.value,
|
||||||
label:
|
label:
|
||||||
usedGpus.includes(gpu.value) || usedAllGpus
|
usedGpus.includes(gpu.value) || usedAllGpus
|
||||||
|
|
|
@ -46,7 +46,7 @@ angular.module('portainer.docker').controller('DashboardController', [
|
||||||
|
|
||||||
$scope.buildGpusStr = function (gpuUseSet) {
|
$scope.buildGpusStr = function (gpuUseSet) {
|
||||||
var gpusAvailable = new Object();
|
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)) {
|
if (!gpuUseSet.has($scope.endpoint.Gpus[i].name)) {
|
||||||
var exist = false;
|
var exist = false;
|
||||||
for (let gpuAvailable in gpusAvailable) {
|
for (let gpuAvailable in gpusAvailable) {
|
||||||
|
|
|
@ -175,7 +175,7 @@ function EndpointController(
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyGpus() {
|
function verifyGpus() {
|
||||||
var i = $scope.endpoint.Gpus.length;
|
var i = ($scope.endpoint.Gpus || []).length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if ($scope.endpoint.Gpus[i].name === '' || $scope.endpoint.Gpus[i].name === null) {
|
if ($scope.endpoint.Gpus[i].name === '' || $scope.endpoint.Gpus[i].name === null) {
|
||||||
$scope.endpoint.Gpus.splice(i, 1);
|
$scope.endpoint.Gpus.splice(i, 1);
|
||||||
|
|
Loading…
Reference in New Issue