dashboard: initial UI to attach devices to apps
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user