mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(ACI): add UAC to ACI
This commit is contained in:
parent
ad2910f3f0
commit
e3e7e84821
18 changed files with 410 additions and 18 deletions
|
@ -6,7 +6,9 @@ angular.module('portainer.azure').controller('AzureCreateContainerInstanceContro
|
|||
'$state',
|
||||
'AzureService',
|
||||
'Notifications',
|
||||
function ($q, $scope, $state, AzureService, Notifications) {
|
||||
'Authentication',
|
||||
'ResourceControlService',
|
||||
function ($q, $scope, $state, AzureService, Notifications, Authentication, ResourceControlService) {
|
||||
var allResourceGroups = [];
|
||||
var allProviders = [];
|
||||
|
||||
|
@ -42,12 +44,12 @@ angular.module('portainer.azure').controller('AzureCreateContainerInstanceContro
|
|||
|
||||
$scope.state.actionInProgress = true;
|
||||
AzureService.createContainerGroup(model, subscriptionId, resourceGroupName)
|
||||
.then(function success() {
|
||||
.then(applyResourceControl)
|
||||
.then(() => {
|
||||
Notifications.success('Container successfully created', model.Name);
|
||||
$state.go('azure.containerinstances');
|
||||
})
|
||||
.catch(function error(err) {
|
||||
err = err.data ? err.data.error : err;
|
||||
Notifications.error('Failure', err, 'Unable to create container');
|
||||
})
|
||||
.finally(function final() {
|
||||
|
@ -55,6 +57,14 @@ angular.module('portainer.azure').controller('AzureCreateContainerInstanceContro
|
|||
});
|
||||
};
|
||||
|
||||
function applyResourceControl(newResourceGroup) {
|
||||
const userId = Authentication.getUserDetails().ID;
|
||||
const resourceControl = newResourceGroup.Portainer.ResourceControl;
|
||||
const accessControlData = $scope.model.AccessControlData;
|
||||
|
||||
return ResourceControlService.applyResourceControl(userId, accessControlData, resourceControl);
|
||||
}
|
||||
|
||||
function validateForm(model) {
|
||||
if (!model.Ports || !model.Ports.length || model.Ports.every((port) => !port.host || !port.container)) {
|
||||
return 'At least one port binding is required';
|
||||
|
@ -73,7 +83,7 @@ angular.module('portainer.azure').controller('AzureCreateContainerInstanceContro
|
|||
}
|
||||
|
||||
function initView() {
|
||||
var model = new ContainerGroupDefaultModel();
|
||||
$scope.model = new ContainerGroupDefaultModel();
|
||||
|
||||
AzureService.subscriptions()
|
||||
.then(function success(data) {
|
||||
|
@ -93,8 +103,6 @@ angular.module('portainer.azure').controller('AzureCreateContainerInstanceContro
|
|||
var containerInstancesProviders = data.containerInstancesProviders;
|
||||
allProviders = containerInstancesProviders;
|
||||
|
||||
$scope.model = model;
|
||||
|
||||
var selectedSubscription = $scope.state.selectedSubscription;
|
||||
updateResourceGroupsAndLocations(selectedSubscription, resourceGroups, containerInstancesProviders);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue