Merge pull request #189 from cloud-inovasi/feat95-exception-mgmt

feat(ui): add missing exception management
pull/190/head
Anthony Lapenna 8 years ago committed by GitHub
commit b36767cdb7

@ -15,12 +15,12 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
Container.create(config, function (d) { Container.create(config, function (d) {
if (d.message) { if (d.message) {
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
Messages.error('Error', d.message); Messages.error('Error', {}, d.message);
} else { } else {
Container.start({id: d.Id}, {}, function (cd) { Container.start({id: d.Id}, {}, function (cd) {
if (cd.message) { if (cd.message) {
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
Messages.error('Error', cd.message); Messages.error('Error', {}, cd.message);
} else { } else {
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
Messages.send('Container Started', d.Id); Messages.send('Container Started', d.Id);
@ -28,20 +28,12 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
} }
}, function (e) { }, function (e) {
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
if (e.data.message) { Messages.error("Failure", e, 'Unable to start container');
Messages.error("Failure", e.data.message);
} else {
Messages.error("Failure", 'Unable to start container');
}
}); });
} }
}, function (e) { }, function (e) {
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
if (e.data.message) { Messages.error("Failure", e, 'Unable to create container');
Messages.error("Failure", e.data.message);
} else {
Messages.error("Failure", 'Unable to create container');
}
}); });
} }
@ -53,13 +45,13 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
if (err) { if (err) {
var detail = data[data.length - 1]; var detail = data[data.length - 1];
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
Messages.error('Error', detail.error); Messages.error("Error", {}, detail.error);
} else { } else {
createContainer(containerConfig); createContainer(containerConfig);
} }
}, function (e) { }, function (e) {
$('#createContainerSpinner').hide(); $('#createContainerSpinner').hide();
Messages.error('Error', 'Unable to pull image ' + image); Messages.error("Failure", e, "Unable to pull image");
}); });
} }
@ -120,18 +112,14 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
volumeQueries.push( volumeQueries.push(
Volume.create({}, function (d) { Volume.create({}, function (d) {
if (d.message) { if (d.message) {
Messages.error('Unable to create volume', d.message); Messages.error("Unable to create volume", {}, d.message);
} else { } else {
Messages.send("Volume created", d.Name); Messages.send("Volume created", d.Name);
containerConfig.Volumes[vol] = {}; containerConfig.Volumes[vol] = {};
containerConfig.HostConfig.Binds.push(d.Name + ':' + vol); containerConfig.HostConfig.Binds.push(d.Name + ':' + vol);
} }
}, function (e) { }, function (e) {
if (e.data.message) { Messages.error("Failure", e, "Unable to create volume");
Messages.error("Failure", e.data.message);
} else {
Messages.error("Failure", 'Unable to create volume');
}
}).$promise }).$promise
); );
}); });
@ -171,7 +159,7 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
$('#loadTemplatesSpinner').hide(); $('#loadTemplatesSpinner').hide();
}, function (e) { }, function (e) {
$('#loadTemplatesSpinner').hide(); $('#loadTemplatesSpinner').hide();
Messages.error("Unable to retrieve apps list", e.data); Messages.error("Failure", e, "Unable to retrieve apps list");
}); });
} }
@ -195,7 +183,7 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
} }
$scope.availableNetworks = networks; $scope.availableNetworks = networks;
}, function (e) { }, function (e) {
Messages.error("Unable to retrieve available networks", e.data); Messages.error("Failure", e, "Unable to retrieve networks");
}); });
Container.query({all: 0}, function (d) { Container.query({all: 0}, function (d) {
var containers = d; var containers = d;
@ -204,7 +192,7 @@ function ($scope, $q, $state, $filter, Config, Container, ContainerHelper, Image
} }
$scope.runningContainers = containers; $scope.runningContainers = containers;
}, function (e) { }, function (e) {
Messages.error("Unable to retrieve running containers", e.data); Messages.error("Failure", e, "Unable to retrieve running containers");
}); });
initTemplates(); initTemplates();
}); });

@ -41,7 +41,7 @@ function ($scope, $state, Volume, Messages) {
$scope.volumes.splice(index, 1); $scope.volumes.splice(index, 1);
complete(); complete();
}, function (e) { }, function (e) {
Messages.error("Failure", e.data); Messages.error("Failure", e, "Unable to remove volume");
complete(); complete();
}); });
} }
@ -54,8 +54,8 @@ function ($scope, $state, Volume, Messages) {
$scope.volumes = d.Volumes; $scope.volumes = d.Volumes;
$('#loadVolumesSpinner').hide(); $('#loadVolumesSpinner').hide();
}, function (e) { }, function (e) {
Messages.error("Failure", e.data);
$('#loadVolumesSpinner').hide(); $('#loadVolumesSpinner').hide();
Messages.error("Failure", e, "Unable to retrieve volumes");
}); });
} }
fetchVolumes(); fetchVolumes();

Loading…
Cancel
Save