This commit is contained in:
Loic GUEGAN 2016-04-16 22:06:18 +02:00
parent a3ff4d243e
commit 21b68f1da1
3 changed files with 77 additions and 78 deletions

View file

@ -1,19 +1,19 @@
<head>
<script src="../vendors/angularjs/angular.min.js"></script>
<script src="../vendors/angularjs/angular.min.js"></script>
<script src="../vendors/angularjs/angular-route.min.js"></script>
<script src="../vendors/angularjs/angular-sanitize.min.js"></script>
<script src="../vendors/angularjs/angular-cookies.min.js"></script>
<script src="../js/services/Test.js"></script>
<script src="../js/services/Test.js"></script>
<script src="../js/app.js"></script>
</head>
<body ng-app="mainApp">
<div ng-controller="hassan">
<ul>
<li ng-repeat="person in persons">
{{person.Name + ' : ' + person.Age}}
</li>
</ul>
</div>
<div ng-controller="hassan">
<ul>
<li ng-repeat="person in persons">
{{person.Name + ' : ' + person.Age}}
</li>
</ul>
</div>
</body>

View file

@ -11,27 +11,27 @@
<link rel="stylesheet" href="./css/style.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!-- Overlay -->
<!-- Overlay -->
<div ng-include="'./partials/login.html'"></div>
<div ng-include="'./partials/home/machineDetails.html'"></div>
<div ng-include="'./partials/loading.html'"></div>
<div ng-include="'./partials/image/upload.html'"></div>
<div ng-include="'./partials/loading.html'"></div>
<div ng-include="'./partials/image/upload.html'"></div>
<!-- MAIN GRID -->
<div class="container-lg">
<!-- Status bar -->
<div class="row" ng-controller="statusCtrl">
<div class="col-lg-12">
<!-- Status bar -->
<!-- Status bar -->
<div ng-include="'./partials/status.html'"></div>
</div>
</div>
@ -57,45 +57,45 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<!-- Include JQuery -->
<script src="./vendors/jquery/jquery-2.2.0.min.js"></script>
<script src="./vendors/jquery/dmuploader.min.js"></script>
<script src="./vendors/jquery/dmuploader.min.js"></script>
<!-- Include Bootstrap -->
<script src="./vendors/bootstrap/js/bootstrap.min.js"></script>
<!-- Include AngularJS and dependencies-->
<script src="./vendors/angularjs/angular.min.js"></script>
<script src="./vendors/angularjs/angular-route.min.js"></script>
<script src="./vendors/angularjs/angular-sanitize.min.js"></script>
<script src="./vendors/angularjs/angular-cookies.min.js"></script>
<script src="./vendors/angularjs/angular-upload.min.js"></script>
<script src="./vendors/angularjs/angular-upload.min.js"></script>
<script src="./js/app.js"></script>
<!-- Include services -->
<script src="./js/services/Identity.js"></script>
<script src="./js/services/Image.js"></script>
<script src="./js/services/Compute.js"></script>
<script src="./js/services/Loading.js"></script>
<!-- Include controller -->
<script src="./js/controllers/login.js"></script>
<script src="./js/controllers/status.js"></script>
<script src="./js/controllers/home/home.js"></script>
<script src="./js/controllers/home/machineDetails.js"></script>
<script src="./js/controllers/network/network.js"></script>
<script src="./js/controllers/image/image.js"></script>
<script src="./js/controllers/image/upload.js"></script>
<script src="./js/controllers/image/image.js"></script>
<script src="./js/controllers/image/upload.js"></script>

View file

@ -5,62 +5,61 @@
* @param {$sce} $sce The $sce angular service
* @param {$http} $http The $http angular service
* @param {Identity} The Identity service
*/
mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
{
// Check for login and define default states
if(!Identity.isAlreadyLogin()){
$('#loginModal').modal({backdrop: 'static', keyboard: false});
}
mainApp.controller('loginCtrl', ['$scope', '$sce', 'Identity', function ($scope, $sce, Identity)
{
// Check for login and define default states
if (!Identity.isAlreadyLogin()) {
$('#loginModal').modal({backdrop: 'static', keyboard: false});
}
// Manager logout event
$scope.$on('logoutEvent', function(){
$('#loginModal').modal({backdrop: 'static', keyboard: false});
});
// Manager logout event
$scope.$on('logoutEvent', function () {
$('#loginModal').modal({backdrop: 'static', keyboard: false});
});
// Hide loading button and message alert
$('#loadingLoginButton').hide();
$('#failedToLoginAlert').hide();
// Defined function for login
$scope.loginAction=function(){
// Begin login state for template
$('#loginButton').hide();
$('#loadingLoginButton').show();
// Hide loading button and message alert
$('#loadingLoginButton').hide();
$('#failedToLoginAlert').hide();
// Get data from templates
var username=$("#loginFormUsername").val();
var password=$("#loginFormPassword").val();
var projectname=$("#loginFormProjectname").val();
// Function to call to handle result
var responseCallback=function(response){
// Defined function for login
$scope.loginAction = function () {
if(response.status!==0){
// Set reason of fail
$scope.failReason=response.failReason;
// Begin login state for template
$('#loginButton').hide();
$('#loadingLoginButton').show();
$('#failedToLoginAlert').hide();
// Display the error
$('#failedToLoginAlert').show();
}
else {
// Else the user is online !
$('#loginModal').modal('hide');
// Get data from templates
var username = $("#loginFormUsername").val();
var password = $("#loginFormPassword").val();
var projectname = $("#loginFormProjectname").val();
// Function to call to handle result
var responseCallback = function (response) {
if (response.status !== 0) {
// Set reason of fail
$scope.failReason = response.failReason;
// Display the error
$('#failedToLoginAlert').show();
} else {
// Else the user is online !
$('#loginModal').modal('hide');
}
// Reset button state
$('#loginButton').show();
$('#loadingLoginButton').hide();
}
// Reset button state
$('#loginButton').show();
$('#loadingLoginButton').hide();
}
// Try to login
Identity.login(username, password, projectname, responseCallback);
};
}]);
// Try to login
Identity.login(username, password, projectname, responseCallback);
};
}]);