dashboard: initial UI to attach devices to apps

This commit is contained in:
Johannes Zellner
2024-12-05 14:49:36 +01:00
parent 8493022f75
commit 25fb467c02
2 changed files with 43 additions and 0 deletions

View File

@@ -613,6 +613,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
currentCpuQuota: 0,
cpuQuota: 0,
devices: '',
show: function () {
var app = $scope.app;
@@ -644,6 +645,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.resources.memoryLimit = $scope.resources.currentMemoryLimit;
$scope.resources.busy = false;
}, 500);
$scope.resources.devices = Object.keys(app.devices).join(', ');
},
submitMemoryLimit: function () {
@@ -687,6 +690,27 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
});
},
submitDevices: function () {
$scope.resources.busy = true;
$scope.resources.error = {};
const devices = {};
$scope.resources.devices.split(',').forEach(d => {
if (!d.trim()) return;
devices[d.trim()] = {};
});
Client.configureApp($scope.app.id, 'devices', { devices }, function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () { $scope.resources.busy = false; }, 1000);
});
});
},
};
$scope.services = {