|
|
@ -1,5 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
// Controller for the top masthead
|
|
|
|
|
|
|
|
function MastheadController($scope) {
|
|
|
|
function MastheadController($scope) {
|
|
|
|
$scope.template = 'partials/masthead.html';
|
|
|
|
$scope.template = 'partials/masthead.html';
|
|
|
|
|
|
|
|
|
|
|
@ -34,7 +33,7 @@ function MastheadController($scope) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function HomeController() {
|
|
|
|
function DashboardController($scope, Container) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -48,30 +47,18 @@ function SettingsController($scope, Auth, System, Docker, Settings) {
|
|
|
|
$('#response').hide();
|
|
|
|
$('#response').hide();
|
|
|
|
$scope.alertClass = 'block';
|
|
|
|
$scope.alertClass = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
var showAndHide = function(hide) {
|
|
|
|
|
|
|
|
$('#response').show();
|
|
|
|
|
|
|
|
if (hide) {
|
|
|
|
|
|
|
|
setTimeout(function() { $('#response').hide();}, 5000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.updateAuthInfo = function() {
|
|
|
|
$scope.updateAuthInfo = function() {
|
|
|
|
if ($scope.auth.password != $scope.auth.cpassword) {
|
|
|
|
if ($scope.auth.password != $scope.auth.cpassword) {
|
|
|
|
$scope.response = 'Your passwords do not match.';
|
|
|
|
setSuccessfulResponse($scope, 'Your passwords do not match.', '#response');
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Auth.update(
|
|
|
|
Auth.update(
|
|
|
|
{username: $scope.auth.username, email: $scope.auth.email, password: $scope.auth.password}, function(d) {
|
|
|
|
{username: $scope.auth.username, email: $scope.auth.email, password: $scope.auth.password}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Auto information updated.', '#response');
|
|
|
|
$scope.response = 'Auth information updated.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -93,52 +80,33 @@ function ContainerController($scope, $routeParams, $location, Container) {
|
|
|
|
$('#response').hide();
|
|
|
|
$('#response').hide();
|
|
|
|
$scope.alertClass = 'block';
|
|
|
|
$scope.alertClass = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
var showAndHide = function(hide) {
|
|
|
|
|
|
|
|
$('#response').show();
|
|
|
|
|
|
|
|
if (hide) {
|
|
|
|
|
|
|
|
setTimeout(function() { $('#response').hide();}, 5000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.start = function(){
|
|
|
|
$scope.start = function(){
|
|
|
|
Container.start({id: $routeParams.id}, function(d) {
|
|
|
|
Container.start({id: $routeParams.id}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Container started.', '#response');
|
|
|
|
$scope.response = 'Container started.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.stop = function() {
|
|
|
|
$scope.stop = function() {
|
|
|
|
Container.stop({id: $routeParams.id}, function(d) {
|
|
|
|
Container.stop({id: $routeParams.id}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Container stopped.', '#response');
|
|
|
|
$scope.response = 'Container stopped.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$scope.kill = function() {
|
|
|
|
$scope.kill = function() {
|
|
|
|
Container.kill({id: $routeParams.id}, function(d) {
|
|
|
|
Container.kill({id: $routeParams.id}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Container killed.', '#response');
|
|
|
|
$scope.response = 'Container killed.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -146,14 +114,10 @@ function ContainerController($scope, $routeParams, $location, Container) {
|
|
|
|
if (confirm("Are you sure you want to remove the container?")) {
|
|
|
|
if (confirm("Are you sure you want to remove the container?")) {
|
|
|
|
Container.remove({id: $routeParams.id}, function(d) {
|
|
|
|
Container.remove({id: $routeParams.id}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Container removed.', '#response');
|
|
|
|
$scope.response = 'Container removed.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e){
|
|
|
|
}, function(e){
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -218,25 +182,14 @@ function ImageController($scope, $routeParams, $location, Image) {
|
|
|
|
$('#response').hide();
|
|
|
|
$('#response').hide();
|
|
|
|
$scope.alertClass = 'block';
|
|
|
|
$scope.alertClass = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
var showAndHide = function(hide) {
|
|
|
|
|
|
|
|
$('#response').show();
|
|
|
|
|
|
|
|
if (hide) {
|
|
|
|
|
|
|
|
setTimeout(function() { $('#response').hide();}, 5000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.remove = function() {
|
|
|
|
$scope.remove = function() {
|
|
|
|
if (confirm("Are you sure you want to delete this image?")) {
|
|
|
|
if (confirm("Are you sure you want to delete this image?")) {
|
|
|
|
Image.remove({id: $routeParams.id}, function(d) {
|
|
|
|
Image.remove({id: $routeParams.id}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Image removed.', '#response');
|
|
|
|
$scope.response = 'Image removed.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -251,14 +204,10 @@ function ImageController($scope, $routeParams, $location, Image) {
|
|
|
|
var tag = $scope.tag;
|
|
|
|
var tag = $scope.tag;
|
|
|
|
Image.tag({id: $routeParams.id, repo: tag.repo, force: tag.force ? 1 : 0}, function(d) {
|
|
|
|
Image.tag({id: $routeParams.id, repo: tag.repo, force: tag.force ? 1 : 0}, function(d) {
|
|
|
|
console.log(d);
|
|
|
|
console.log(d);
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
setSuccessfulResponse($scope, 'Tag added.', '#response');
|
|
|
|
$scope.response = 'Tag added.';
|
|
|
|
|
|
|
|
showAndHide(true);
|
|
|
|
|
|
|
|
}, function(e) {
|
|
|
|
}, function(e) {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
setFailedResponse($scope, e.data, '#response');
|
|
|
|
$scope.response = e.data;
|
|
|
|
|
|
|
|
showAndHide(false);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -314,3 +263,16 @@ function StartContainerController($scope, $routeParams, $location, Container) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setSuccessfulResponse($scope, msg, msgId) {
|
|
|
|
|
|
|
|
$scope.alertClass = 'success';
|
|
|
|
|
|
|
|
$scope.response = msg;
|
|
|
|
|
|
|
|
$(msgId).show();
|
|
|
|
|
|
|
|
setTimeout(function() { $(msgId).hide();}, 5000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setFailedResponse($scope, msg, msgId) {
|
|
|
|
|
|
|
|
$scope.alertClass = 'error';
|
|
|
|
|
|
|
|
$scope.response = msg;
|
|
|
|
|
|
|
|
$(msgId).show();
|
|
|
|
|
|
|
|
}
|
|
|
|