Correct conflicts
This commit is contained in:
commit
dde482df64
18 changed files with 434 additions and 227 deletions
|
@ -11,26 +11,28 @@
|
||||||
<link rel="stylesheet" href="./css/style.css">
|
<link rel="stylesheet" href="./css/style.css">
|
||||||
|
|
||||||
|
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<!-- Overlay -->
|
||||||
|
<div ng-include="'./partials/login.html'"></div>
|
||||||
|
<div ng-include="'./partials/home/machineDetails.html'"></div>
|
||||||
|
<div ng-include="'./partials/loading.html'"></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- MAIN GRID -->
|
<!-- MAIN GRID -->
|
||||||
<div class="container-lg">
|
<div class="container-lg">
|
||||||
<!-- Status bar -->
|
<!-- Status bar -->
|
||||||
<div class="row" ng-controller="statusCtrl">
|
<div class="row" ng-controller="statusCtrl">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<!-- Login Overlay -->
|
<!-- Status bar -->
|
||||||
<div ng-include="'./partials/login.html'"></div>
|
<div ng-include="'./partials/status.html'"></div>
|
||||||
<!-- Machine Details Overlay -->
|
|
||||||
<div ng-include="'./partials/home/machineDetails.html'"></div>
|
|
||||||
|
|
||||||
<!-- Nav -->
|
|
||||||
<div ng-include="'./partials/nav.html'"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Page content -->
|
<!-- Page content -->
|
||||||
|
@ -55,7 +57,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -79,13 +81,14 @@
|
||||||
<script src="./js/services/Identity.js"></script>
|
<script src="./js/services/Identity.js"></script>
|
||||||
<script src="./js/services/Image.js"></script>
|
<script src="./js/services/Image.js"></script>
|
||||||
<script src="./js/services/Compute.js"></script>
|
<script src="./js/services/Compute.js"></script>
|
||||||
|
<script src="./js/services/Loading.js"></script>
|
||||||
|
|
||||||
<!-- Include controller -->
|
<!-- Include controller -->
|
||||||
<script src="./js/controllers/login.js"></script>
|
<script src="./js/controllers/login.js"></script>
|
||||||
<script src="./js/controllers/status.js"></script>
|
<script src="./js/controllers/status.js"></script>
|
||||||
<script src="./js/controllers/home/main.js"></script>
|
<script src="./js/controllers/home/home.js"></script>
|
||||||
<script src="./js/controllers/home/machineDetails.js"></script>
|
<script src="./js/controllers/home/machineDetails.js"></script>
|
||||||
<script src="./js/controllers/network/main.js"></script>
|
<script src="./js/controllers/network/network.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
36
client/js/controllers/home/home.js
Normal file
36
client/js/controllers/home/home.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* The home controller
|
||||||
|
*
|
||||||
|
* @param {$scope} $scope The $scope service from angular
|
||||||
|
*/
|
||||||
|
mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', function ($scope, Compute, $rootScope, Loading, Identity)
|
||||||
|
{
|
||||||
|
|
||||||
|
var callMeAfterPullData=function(data){
|
||||||
|
$scope.machines=Compute.getData().machines;
|
||||||
|
Loading.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
if(Compute.getData().machines == null && Identity.isAlreadyLogin()){
|
||||||
|
Loading.start();
|
||||||
|
Compute.pullData(callMeAfterPullData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$scope.raiseShowMachineDetailsEvent=function(id){
|
||||||
|
|
||||||
|
var callback=function(){
|
||||||
|
Loading.stop();
|
||||||
|
var data=Compute.getData();
|
||||||
|
$rootScope.$broadcast("showMachineDetailsEvent", data.machines[id], data.axioms);
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading.start();
|
||||||
|
Compute.pullMachines(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}]);
|
|
@ -6,21 +6,25 @@
|
||||||
mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', '$timeout', function ($scope, Compute, $rootScope, $timeout)
|
mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', '$timeout', function ($scope, Compute, $rootScope, $timeout)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Init scope
|
||||||
$scope.machine={};
|
$scope.machine={};
|
||||||
$("#waitingForToggleMachine").hide();
|
$scope.machineIsStarting=false; // For loading icon
|
||||||
|
|
||||||
$scope.$on('showMachineDetailsEvent', function(eventName ,machine){
|
|
||||||
|
$scope.$on('showMachineDetailsEvent', function(eventName ,machine, axioms){
|
||||||
$scope.machine=machine;
|
$scope.machine=machine;
|
||||||
|
$scope.axioms=axioms;
|
||||||
$('#machineDetailsModal').modal({backdrop: false, keyboard: true});
|
$('#machineDetailsModal').modal({backdrop: false, keyboard: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$scope.toggleMachineState=function(){
|
$scope.toggleMachineState=function(){
|
||||||
$("#waitingForToggleMachine").show();
|
// Display gif
|
||||||
|
$scope.machineIsStarting=true;
|
||||||
|
|
||||||
// Fake timeout
|
// Fake timeout
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
$("#waitingForToggleMachine").hide();
|
$scope.machineIsStarting=false;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
$scope.machine.online=!$scope.machine.online;
|
$scope.machine.online=!$scope.machine.online;
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
/**
|
|
||||||
* The home controller
|
|
||||||
*
|
|
||||||
* @param {$scope} $scope The $scope service from angular
|
|
||||||
*/
|
|
||||||
mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($scope, Compute, $rootScope)
|
|
||||||
{
|
|
||||||
|
|
||||||
var updatePage=function(){
|
|
||||||
// TODO Update graph etc...
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve all Data
|
|
||||||
Compute.pullData(updatePage);
|
|
||||||
|
|
||||||
$scope.raiseShowMachineDetailsEvent=function(){
|
|
||||||
var machine={name: "Machine 1", online:true};
|
|
||||||
$rootScope.$broadcast("showMachineDetailsEvent", machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}]);
|
|
|
@ -16,10 +16,11 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
|
||||||
|
|
||||||
// Manager logout event
|
// Manager logout event
|
||||||
$scope.$on('logoutEvent', function(){
|
$scope.$on('logoutEvent', function(){
|
||||||
Identity.logout();
|
|
||||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Hide loading button and message alert
|
// Hide loading button and message alert
|
||||||
$('#loadingLoginButton').hide();
|
$('#loadingLoginButton').hide();
|
||||||
$('#failedToLoginAlert').hide();
|
$('#failedToLoginAlert').hide();
|
||||||
|
|
|
@ -11,10 +11,10 @@ mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($
|
||||||
|
|
||||||
// Give profile to model
|
// Give profile to model
|
||||||
$scope.profile=Identity.getProfile();
|
$scope.profile=Identity.getProfile();
|
||||||
|
|
||||||
// Function to logout
|
// Function to logout
|
||||||
$scope.raiseLogoutEvent=function(){
|
$scope.logout=function(){
|
||||||
$rootScope.$broadcast('logoutEvent');
|
Identity.logout();
|
||||||
};
|
};
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -2,38 +2,139 @@
|
||||||
mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
|
mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
|
||||||
|
|
||||||
|
|
||||||
|
// Init data
|
||||||
var data={};
|
var data={};
|
||||||
data.machines={};
|
data.machines=null;
|
||||||
|
data.axioms={} // Contain static data
|
||||||
|
data.axioms.ram=[128,512,1024,2048,4096];
|
||||||
|
data.axioms.disk=[1,2,5,10,25,50,100,150,200]
|
||||||
|
data.axioms.images={}; // Retrieve after
|
||||||
|
|
||||||
|
|
||||||
// Parser
|
/**
|
||||||
var parseGetMachinesAnswer=function(response, failedToSendRequest){
|
* Parse pullMachines answer
|
||||||
|
* @param {response} the server response
|
||||||
|
* @param {boolean} false if the request as been send true else
|
||||||
|
* @return {requestParserResult} the result of parsing
|
||||||
|
*/
|
||||||
|
var parsePullMachinesAnswer=function(response, failedToSendRequest){
|
||||||
|
|
||||||
|
// Defined return object
|
||||||
|
var requestParserResult={};
|
||||||
|
requestParserResult.status=1;
|
||||||
|
requestParserResult.failReason=null;
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof response.data.Servers !== 'undefined') {
|
||||||
|
// Set status code
|
||||||
|
requestParserResult.status=0;
|
||||||
|
data.machines=response.data.Servers;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(failedToSendRequest){
|
||||||
|
requestParserResult.failReason="Failed to send request";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
requestParserResult.failReason="Error";
|
||||||
|
}
|
||||||
|
return requestParserResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Get Machine
|
/**
|
||||||
var getMachines=function(callback){
|
* Retrieve machine list
|
||||||
|
* @param {callback} function to call after request complete
|
||||||
|
*/
|
||||||
|
var pullMachines=function(callback){
|
||||||
|
// Send listServers request
|
||||||
var result=$http.post('../server/index.php',
|
var result=$http.post('../server/index.php',
|
||||||
$.param({"token" : Identity.profile.token, "task" : "Compute"}));
|
$.param({"token" : Identity.getToken(), "task" : "compute", "action":"listServers"}));
|
||||||
|
|
||||||
|
// Wait and handle the response
|
||||||
|
result.then(function (response){
|
||||||
|
callback(parsePullMachinesAnswer(response, false));
|
||||||
|
},function(response){
|
||||||
|
callback(parsePullMachinesAnswer(response, true));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse pullImages answer
|
||||||
|
* @param {response} the server response
|
||||||
|
* @param {boolean} false if the request as been send true else
|
||||||
|
* @return {requestParserResult} the result of parsing
|
||||||
|
*/
|
||||||
|
var parsePullImagesAnswer=function(response, failedToSendRequest){
|
||||||
|
|
||||||
|
// Defined return object
|
||||||
|
var requestParserResult={};
|
||||||
|
requestParserResult.status=1;
|
||||||
|
requestParserResult.failReason=null;
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof response.data.Images !== 'undefined') {
|
||||||
|
// Set status code
|
||||||
|
requestParserResult.status=0;
|
||||||
|
data.axioms.images=response.data.Images;
|
||||||
|
}
|
||||||
|
else if(failedToSendRequest){
|
||||||
|
requestParserResult.failReason="Failed to send request";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
requestParserResult.failReason="Error";
|
||||||
|
}
|
||||||
|
return requestParserResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve machine list
|
||||||
|
* @param {callback} function to call after request complete
|
||||||
|
*/
|
||||||
|
var pullImages=function(callback){
|
||||||
|
// Send listServers request
|
||||||
|
var result=$http.post('../server/index.php',
|
||||||
|
$.param({"token" : Identity.getToken(), "task" : "compute", "action":"listImages"}));
|
||||||
|
|
||||||
|
// Wait and handle the response
|
||||||
|
result.then(function (response){
|
||||||
|
callback(parsePullImagesAnswer(response, false));
|
||||||
|
},function(response){
|
||||||
|
callback(parsePullImagesAnswer(response, true));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve all data
|
||||||
|
* @param {callback} function to call after request complete
|
||||||
|
*/
|
||||||
var pullData=function(callback){
|
var pullData=function(callback){
|
||||||
// TODO call getMachines etc...
|
var nextFunction=function(response){
|
||||||
|
if(response.status==0){
|
||||||
|
pullMachines(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pullImages(nextFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Data
|
||||||
|
* @return {data} return the data object
|
||||||
|
*/
|
||||||
|
var getData=function(){
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
// Return services objects
|
// Return services objects
|
||||||
return {
|
return {
|
||||||
getMachines: getMachines,
|
pullMachines: pullMachines,
|
||||||
pullData: pullData,
|
pullData: pullData,
|
||||||
data:data
|
getData: getData
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
|
|
||||||
/* Create profile structure to store informations
|
/* Create profile structure to store informations
|
||||||
* about current session
|
* about current session
|
||||||
|
@ -9,42 +9,37 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
profile.projectname=null;
|
profile.projectname=null;
|
||||||
var token=null;
|
var token=null;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @returns {boolean} Return true if a cookie is found (and load it in profile) false else
|
* @returns {boolean} Return true if a cookie is found (and load it in profile) false else
|
||||||
*/
|
*/
|
||||||
var isAlreadyLogin=function(){
|
var isAlreadyLogin=function(){
|
||||||
|
|
||||||
|
// Load cookies
|
||||||
var profileInCookie=$cookies.getObject('profile');
|
var profileInCookie=$cookies.getObject('profile');
|
||||||
var tokenPart_0InCookie=$cookies.getObject('token.part_0');
|
var tokenPart_0InCookie=$cookies.getObject('token.part_0');
|
||||||
var tokenPart_1InCookie=$cookies.getObject('token.part_1');
|
var tokenPart_1InCookie=$cookies.getObject('token.part_1');
|
||||||
|
|
||||||
|
|
||||||
|
// Check if cookie is defined
|
||||||
if(typeof profileInCookie !== 'undefined'
|
if(typeof profileInCookie !== 'undefined'
|
||||||
&& typeof tokenPart_0InCookie !== 'undefined'
|
&& typeof tokenPart_0InCookie !== 'undefined'
|
||||||
&& typeof tokenPart_1InCookie !== 'undefined'
|
&& typeof tokenPart_1InCookie !== 'undefined'
|
||||||
){
|
){
|
||||||
|
|
||||||
|
// If yes, put it into variables
|
||||||
angular.extend(profile, profileInCookie);
|
angular.extend(profile, profileInCookie);
|
||||||
token=tokenPart_0InCookie+tokenPart_1InCookie;
|
token=tokenPart_0InCookie+tokenPart_1InCookie;
|
||||||
|
|
||||||
|
// Return I'm Login
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return I'm not Login
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the profile
|
|
||||||
*/
|
|
||||||
var getProfile=function(){
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the token
|
|
||||||
*/
|
|
||||||
var getToken=function(){
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destroy profile cookies
|
* Destroy profile cookies
|
||||||
|
@ -53,6 +48,12 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
$cookies.remove('profile');
|
$cookies.remove('profile');
|
||||||
$cookies.remove('token.part_0');
|
$cookies.remove('token.part_0');
|
||||||
$cookies.remove('token.part_1');
|
$cookies.remove('token.part_1');
|
||||||
|
token=null;
|
||||||
|
profile.username=null;
|
||||||
|
profile.projectname=null;
|
||||||
|
|
||||||
|
// Reload Page
|
||||||
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
*/
|
*/
|
||||||
var parseLoginAnswer=function(response, failedToSendRequest){
|
var parseLoginAnswer=function(response, failedToSendRequest){
|
||||||
|
|
||||||
|
// Defined return object
|
||||||
var requestParserResult={};
|
var requestParserResult={};
|
||||||
requestParserResult.status=1;
|
requestParserResult.status=1;
|
||||||
requestParserResult.failReason=null;
|
requestParserResult.failReason=null;
|
||||||
|
@ -86,6 +87,10 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
$cookies.putObject('token.part_0', response.data.token.substring(0, middle), {'expires': expireDate});
|
$cookies.putObject('token.part_0', response.data.token.substring(0, middle), {'expires': expireDate});
|
||||||
// Save second part of token
|
// Save second part of token
|
||||||
$cookies.putObject('token.part_1', response.data.token.substring(middle, response.data.token.length), {'expires': expireDate});
|
$cookies.putObject('token.part_1', response.data.token.substring(middle, response.data.token.length), {'expires': expireDate});
|
||||||
|
|
||||||
|
// Put token in var
|
||||||
|
token=response.data.token;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(failedToSendRequest){
|
else if(failedToSendRequest){
|
||||||
requestParserResult.failReason="Failed to send request";
|
requestParserResult.failReason="Failed to send request";
|
||||||
|
@ -93,9 +98,11 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
else{
|
else{
|
||||||
requestParserResult.failReason="Please check your username, password and project name !";
|
requestParserResult.failReason="Please check your username, password and project name !";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return requestParserResult;
|
return requestParserResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to connect to OpenStack
|
* Function to connect to OpenStack
|
||||||
|
@ -106,25 +113,43 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
* @param {string} projectname The user project name
|
* @param {string} projectname The user project name
|
||||||
* @param {function} function to call when data is avalaible
|
* @param {function} function to call when data is avalaible
|
||||||
*/
|
*/
|
||||||
var login=function(username, password,projectname, callback){
|
var login=function(username, password,projectname,callback){
|
||||||
|
|
||||||
// Set profile information (early)
|
// Set profile information (early)
|
||||||
profile.username=username;
|
profile.username=username;
|
||||||
profile.projectname=projectname;
|
profile.projectname=projectname;
|
||||||
|
|
||||||
var result=$http.post('../server/index.php',
|
var result=$http.post('../server/index.php',
|
||||||
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
|
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
|
||||||
|
|
||||||
// Wait and handle the response
|
// Wait and handle the response
|
||||||
result.then(function (response){
|
result.then(function (response){
|
||||||
callback(parseLoginAnswer(response), false);
|
callback(parseLoginAnswer(response, false));
|
||||||
},function(response){
|
},function(response){
|
||||||
callback(parseLoginAnswer(response), true)
|
callback(parseLoginAnswer(response, true));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the profile
|
||||||
|
*/
|
||||||
|
var getProfile=function(){
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the token
|
||||||
|
*/
|
||||||
|
var getToken=function(){
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Return services objects
|
// Return services objects
|
||||||
return {
|
return {
|
||||||
login: login,
|
login: login,
|
||||||
|
|
23
client/js/services/Loading.js
Normal file
23
client/js/services/Loading.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
mainApp.factory('Loading',[ function(){
|
||||||
|
/**
|
||||||
|
* Display Loading modal
|
||||||
|
*/
|
||||||
|
var start=function(){
|
||||||
|
$('#loadingModal').modal({backdrop: 'static', keyboard: false});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide Loading modal
|
||||||
|
*/
|
||||||
|
var stop=function(){
|
||||||
|
$('#loadingModal').modal('hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Service returns
|
||||||
|
return {
|
||||||
|
start:start,
|
||||||
|
stop:stop
|
||||||
|
};
|
||||||
|
}]);
|
|
@ -21,12 +21,12 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-sm-2" for="pwd">State</label>
|
<label class="control-label col-sm-2" for="pwd">State</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<span ng-if="machine.online">Online</span>
|
<span ng-if="machine.status=='ACTIVE'">Online</span>
|
||||||
<span ng-if="!machine.online">Offline</span>
|
<span ng-if="machine.status!=='ACTIVE'">Offline</span>
|
||||||
|
|
||||||
<button class="btn btn-danger" ng-if="machine.online" ng-click="toggleMachineState()">Turn Off</button>
|
<button class="btn btn-danger" ng-if="machine.status=='ACTIVE'" ng-click="toggleMachineState()">Turn Off</button>
|
||||||
<button class="btn btn-success" ng-if="!machine.online" ng-click="toggleMachineState()">Turn On</button>
|
<button class="btn btn-success" ng-if="machine.status!=='ACTIVE'" ng-click="toggleMachineState()">Turn On</button>
|
||||||
<img src="images/spin/32x32/Preloader_1.gif" id="waitingForToggleMachine"></span>
|
<img src="images/spin/32x32/Preloader_1.gif" ng-if="machineIsStarting"></span>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -34,36 +34,22 @@
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label class="control-label col-sm-2">RAM</label>
|
<label class="control-label col-sm-2">RAM</label>
|
||||||
<select class="col-sm-20" id="ramSelected">
|
<select class="col-sm-20" id="ramSelected">
|
||||||
<option>128 MB</option>
|
<option ng-repeat="ram in axioms.ram" ng-selected="machine.ram == ram">{{ ram }}</option>
|
||||||
<option>512 MB</option>
|
|
||||||
<option>1024 MB</option>
|
|
||||||
<option>2048 MB</option>
|
|
||||||
<option>4096 MB</option>
|
|
||||||
</select>
|
</select>
|
||||||
|
<span>MB</span>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label class="control-label col-sm-2">Disk</label>
|
<label class="control-label col-sm-2">Disk</label>
|
||||||
<select class="col-sm-20" id="ramSelected">
|
<select class="col-sm-20" id="ramSelected">
|
||||||
<option>1 Go</option>
|
<option ng-repeat="disk in axioms.disk" ng-selected="machine.disk == disk">{{ disk }}</option>
|
||||||
<option>2 Go</option>
|
|
||||||
<option>5 Go</option>
|
|
||||||
<option>10 Go</option>
|
|
||||||
<option>25 Go</option>
|
|
||||||
<option>50 Go</option>
|
|
||||||
<option>100 Go</option>
|
|
||||||
<option>150 Go</option>
|
|
||||||
<option>200 Go</option>
|
|
||||||
</select>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label class="control-label col-sm-2">Image</label>
|
<label class="control-label col-sm-2">Image</label>
|
||||||
<select class="col-sm-20" id="ramSelected">
|
<select class="col-sm-20" id="ramSelected">
|
||||||
<option>Cirros</option>
|
<option ng-repeat="image in axioms.images" ng-selected="machine.imageId == Object.keys(image)">{{ image.name }}</option>
|
||||||
<option>Debian</option>
|
|
||||||
<option>Tiny Core</option>
|
|
||||||
<option>Centos</option>
|
|
||||||
</select>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
Home
|
Home
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
Main Content
|
|
||||||
<button ng-click="raiseShowMachineDetailsEvent()" > Show Machine details</button>
|
Pour charger les machines, recharger la page (temporaire)<br />
|
||||||
<div id="test">
|
Selectionner une machine:
|
||||||
</div>
|
<div ng-repeat="machine in machines"> <a ng-click="raiseShowMachineDetailsEvent(machine.id)"> {{ machine.name }}</a></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
18
client/partials/loading.html
Normal file
18
client/partials/loading.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<div class="modal fade" id="loadingModal" ng-controller="loginCtrl">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-dialog" style="width:200px;">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-body" >
|
||||||
|
<div align="center">
|
||||||
|
<img src="images/spin/128x128/Preloader_8.gif" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,41 +0,0 @@
|
||||||
<nav class="navbar navbar-default">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<!-- Brand and toggle get grouped for better mobile display -->
|
|
||||||
<div class="navbar-header">
|
|
||||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>
|
|
||||||
<a class="navbar-brand" href="#"><b>Status</b></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="navbar-"></div>
|
|
||||||
|
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
|
||||||
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li class="nav-divider"></li>
|
|
||||||
<li><a href="#">User : {{ profile.username }}</a></li>
|
|
||||||
<li><a href="#">Project Name : {{ profile.projectname }}</a></li>
|
|
||||||
|
|
||||||
<!--<li><a href="#" >Connection : <span ng-bind-html="connection"></span></a></li>-->
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul class="nav navbar-nav navbar-right">
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Account<span class="caret"></span></a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a href="#">Informations</a></li>
|
|
||||||
<li><a href="#">Settings</a></li>
|
|
||||||
<li role="separator" class="divider"></li>
|
|
||||||
<li><a href="#" ng-click="raiseLogoutEvent()">Logout</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div><!-- /.navbar-collapse -->
|
|
||||||
</div><!-- /.container-fluid -->
|
|
||||||
</nav>
|
|
29
client/partials/status.html
Normal file
29
client/partials/status.html
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<nav class="navbar navbar-default">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- Brand and toggle get grouped for better mobile display -->
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand"><b>Status</b></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="navbar-"></div>
|
||||||
|
|
||||||
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
|
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li class="nav-divider"></li>
|
||||||
|
<li><a>User : {{ profile.username }}</a></li>
|
||||||
|
<li><a>Project Name : {{ profile.projectname }}</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a ng-click="logout()">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
|
@ -1,35 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require '../vendor/autoload.php';
|
include('InitTest.php');
|
||||||
include('/istic-openstack/server/init.php');
|
include_once("../core/Image.php");
|
||||||
|
|
||||||
/*
|
|
||||||
$options = Array();
|
|
||||||
$options["user"] = Array("name"=>"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]);
|
|
||||||
$options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"]));
|
|
||||||
$options["authUrl"] = "http://148.60.11.31:5000/v3";
|
|
||||||
|
|
||||||
$openstack = new OpenStack\OpenStack($options);
|
|
||||||
|
|
||||||
//$identity = $openstack->identityV3();
|
|
||||||
//var_dump($identity);
|
|
||||||
// Since usernames will not be unique across an entire OpenStack installation,
|
|
||||||
// when authenticating with them you must also provide your domain ID. You do
|
|
||||||
// not have to do this if you authenticate with a user ID.
|
|
||||||
/*$token = $identity->generateToken([
|
|
||||||
'user' => [
|
|
||||||
'name' => 'admin',
|
|
||||||
'password' => 'ae5or6cn',
|
|
||||||
'domain' => [
|
|
||||||
'id' => 'Default'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
*/
|
|
||||||
//$compute = $openstack->computeV2(["region" => "RegionOne"]);
|
|
||||||
//$image= $openstack->imagesV2(["region" => "RegionOne"]);
|
|
||||||
//var_dump($compute->client);
|
|
||||||
//$servers = $compute->listServers(true);
|
|
||||||
echo 'toto';
|
|
||||||
|
|
||||||
$image = new Image($App);
|
$image = new Image($App);
|
||||||
|
|
||||||
|
@ -43,52 +14,54 @@ $opt['minDisk'] = 1;
|
||||||
$opt['protected'] = false;
|
$opt['protected'] = false;
|
||||||
$opt['minRam'] = 10;
|
$opt['minRam'] = 10;
|
||||||
|
|
||||||
//$new_image = $image->create_image($opt);
|
//$new_image = $image->createImage($opt);
|
||||||
|
|
||||||
|
|
||||||
//Liste des images
|
//Liste des images
|
||||||
$images = $image->list_images();
|
$image->action("listImage");
|
||||||
|
//$images = $image->listImage();
|
||||||
echo "Images présentes :";
|
$im = $App->show();
|
||||||
echo "</br>";
|
$images = json_decode($im, true)["Images"];
|
||||||
|
if(isset($images)){
|
||||||
foreach($images as $i){
|
echo "Images présentes :";
|
||||||
echo $i->name;
|
echo "</br>";
|
||||||
if($i->name == "Test"){
|
foreach($images as $i){
|
||||||
$id_image = $i->id;
|
echo $i['name'];
|
||||||
$list = $i->tags;
|
echo "</br>";
|
||||||
echo $i->status;
|
|
||||||
}
|
}
|
||||||
echo "</br>";
|
echo "</br>";
|
||||||
}
|
|
||||||
echo "</br>";
|
|
||||||
|
|
||||||
if(isset($list)){
|
if(isset($list)){
|
||||||
foreach ($list as $l) {
|
foreach ($list as $l) {
|
||||||
echo $l;
|
echo $l;
|
||||||
echo "</br>";
|
echo "</br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "Aucune image présente\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Détails Image
|
// Détails Image
|
||||||
//$details = $image->image_details($id_image);
|
//$details = $image->imageDetails($id_image);
|
||||||
|
|
||||||
//$image->delete_image('123456');
|
//$image->deleteImage('123456');
|
||||||
|
|
||||||
//$image->desactivate_image($id_image);
|
//$image->desactivateImage($id_image);
|
||||||
//$image->reactivate_image($id_image);
|
//$image->reactivateImage($id_image);
|
||||||
|
|
||||||
//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
|
//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
|
||||||
//$image->upload_image($id_image, $file_name);
|
//$image->uploadImage($id_image, $file_name);
|
||||||
|
|
||||||
//$image->download_image($id_image);
|
//$image->downloadImage($id_image);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$opt_update = Array();
|
$opt_update = Array();
|
||||||
$opt_update['name'] = "Test";
|
$opt_update['name'] = "Test";
|
||||||
$opt_update['tags'] = null;
|
$opt_update['tags'] = null;
|
||||||
|
|
||||||
$update = $image->update_image($id_image, $opt_update);
|
$update = $image->updateImage($id_image, $opt_update);
|
||||||
echo $update->name;
|
echo $update->name;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,20 @@ class compute
|
||||||
*/
|
*/
|
||||||
public function listServers()
|
public function listServers()
|
||||||
{
|
{
|
||||||
$servers = $this->libClass->listServers();
|
$serverList = $this->libClass->listServers(true);
|
||||||
|
$servers = Array();
|
||||||
|
foreach($serverList as $server){
|
||||||
|
$servers[$server->id] = Array();
|
||||||
|
$server->flavor->retrieve();
|
||||||
|
$server->image->retrieve();
|
||||||
|
$servers[$server->id]["id"] = $server->id;
|
||||||
|
$servers[$server->id]["name"] = $server->name;
|
||||||
|
$servers[$server->id]["imageId"] = $server->image->id;
|
||||||
|
$servers[$server->id]["flavorId"] = $server->flavor->id;
|
||||||
|
$servers[$server->id]["status"] = $server->status;
|
||||||
|
$servers[$server->id]["ram"] = $server->flavor->ram;
|
||||||
|
$servers[$server->id]["disk"] = $server->flavor->disk;
|
||||||
|
}
|
||||||
$this->app->setOutput("Servers", $servers);
|
$this->app->setOutput("Servers", $servers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +58,13 @@ class compute
|
||||||
*/
|
*/
|
||||||
public function listFlavors()
|
public function listFlavors()
|
||||||
{
|
{
|
||||||
$flavors = $this->libClass->listFlavors();
|
$flavorList = $this->libClass->listFlavors();
|
||||||
|
$flavors = Array();
|
||||||
|
foreach($flavorList as $flavor){
|
||||||
|
$flavors[$flavor->id] = Array();
|
||||||
|
$flavors[$flavor->id]["id"] = $flavor->id;
|
||||||
|
$flavors[$flavor->id]["name"] = $flavor->name;
|
||||||
|
}
|
||||||
$this->app->setOutput("Flavors", $flavors);
|
$this->app->setOutput("Flavors", $flavors);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +74,13 @@ class compute
|
||||||
*/
|
*/
|
||||||
public function listImages()
|
public function listImages()
|
||||||
{
|
{
|
||||||
$images = $this->libClass->listImages();
|
$imageList = $this->libClass->listImages();
|
||||||
|
$images = Array();
|
||||||
|
foreach($imageList as $image){
|
||||||
|
$images[$image->id] = Array();
|
||||||
|
$images[$image->id]["id"] = $image->id;
|
||||||
|
$images[$image->id]["name"] = $image->name;
|
||||||
|
}
|
||||||
$this->app->setOutput("Images", $images);
|
$this->app->setOutput("Images", $images);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@ use OpenStack\Common\Error\BaseError;
|
||||||
use OpenStack\Common\Error\NotImplementedError;
|
use OpenStack\Common\Error\NotImplementedError;
|
||||||
use OpenStack\Common\Error\UserInputError;
|
use OpenStack\Common\Error\UserInputError;
|
||||||
|
|
||||||
|
|
||||||
|
include("CoreInterface.php");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image Class of the back-end application
|
* Image Class of the back-end application
|
||||||
*
|
*
|
||||||
|
@ -78,6 +82,9 @@ class image implements Core{
|
||||||
**/
|
**/
|
||||||
private function createImage(array $opt){
|
private function createImage(array $opt){
|
||||||
|
|
||||||
|
$opt = $this->app->getPostParam("opt");
|
||||||
|
|
||||||
|
|
||||||
if(!isset($opt)){
|
if(!isset($opt)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -141,7 +148,8 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $image;
|
$this->app->setOutput("Images", $image);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,9 +159,10 @@ class image implements Core{
|
||||||
*/
|
*/
|
||||||
private function listImage(){
|
private function listImage(){
|
||||||
try{
|
try{
|
||||||
|
$result = array();
|
||||||
$l = $this->libClass->listImages();
|
$l = $this->libClass->listImages();
|
||||||
if(!isset($l)){ // if the list is empty there is no images
|
foreach($l as $tmp){
|
||||||
$this->app->setOutput("Error", "No image");
|
$result[] = $tmp;
|
||||||
}
|
}
|
||||||
}catch(BadResponseError $e){
|
}catch(BadResponseError $e){
|
||||||
$this->app->getErrorInstance()->BadResponseHandler($e);
|
$this->app->getErrorInstance()->BadResponseHandler($e);
|
||||||
|
@ -164,7 +173,8 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $l;
|
|
||||||
|
$this->app->setOutput("Images", $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,9 +185,11 @@ class image implements Core{
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
private function detailsImage($id){
|
private function detailsImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
// Renvoyer erreur
|
$this->app->setOutput("Error", "Incorrect id parameter");
|
||||||
|
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
$service = $this->libClass;
|
$service = $this->libClass;
|
||||||
|
@ -185,8 +197,9 @@ class image implements Core{
|
||||||
if($image == null){ // if the image don't exists -> error
|
if($image == null){ // if the image don't exists -> error
|
||||||
$this->app->setOutput("Error", "Image doesn't exist");
|
$this->app->setOutput("Error", "Image doesn't exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $image;
|
$this->app->setOutput("Images", $image);
|
||||||
|
|
||||||
}catch(BadResponseError $e){
|
}catch(BadResponseError $e){
|
||||||
$this->app->getErrorInstance()->BadResponseHandler($e);
|
$this->app->getErrorInstance()->BadResponseHandler($e);
|
||||||
}catch(UserInputError $e){
|
}catch(UserInputError $e){
|
||||||
|
@ -207,7 +220,11 @@ class image implements Core{
|
||||||
* @param array $opt
|
* @param array $opt
|
||||||
* options for the image creation
|
* options for the image creation
|
||||||
**/
|
**/
|
||||||
private function updateImage($id, array $opt){
|
|
||||||
|
private function updateImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
$opt = $this->app->getPostParam("opt");
|
||||||
|
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect id parameter");
|
$this->app->setOutput("Error", "Incorrect id parameter");
|
||||||
}
|
}
|
||||||
|
@ -254,7 +271,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $image;
|
$this->app->setOutput("Images", $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,9 +280,10 @@ class image implements Core{
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function deleteImage($id){
|
private function deleteImage(){
|
||||||
// si protected = true, demander de le mettre a false
|
// si protected = true, demander de le mettre a false
|
||||||
// vérifier existence image
|
// vérifier existence image
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Image doesn't exist");
|
$this->app->setOutput("Error", "Image doesn't exist");
|
||||||
}
|
}
|
||||||
|
@ -285,8 +303,7 @@ class image implements Core{
|
||||||
$this->app->getErrorInstance->BaseErrorHandler($e);
|
$this->app->getErrorInstance->BaseErrorHandler($e);
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,7 +312,9 @@ class image implements Core{
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function reactivateImage($id){
|
private function reactivateImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -324,7 +343,9 @@ class image implements Core{
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function desactivateImage($id){
|
private function desactivateImage(){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -357,6 +378,10 @@ class image implements Core{
|
||||||
* path of the image
|
* path of the image
|
||||||
**/
|
**/
|
||||||
private function uploadImage($id, $file_name){
|
private function uploadImage($id, $file_name){
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
$file_name = $this->app->getPostParam("file_name");
|
||||||
|
|
||||||
|
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect id parameter");
|
$this->app->setOutput("Error", "Incorrect id parameter");
|
||||||
}
|
}
|
||||||
|
@ -390,6 +415,10 @@ class image implements Core{
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function downloadImage($id){
|
private function downloadImage($id){
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
$id = $this->app->getPostParam("id");
|
||||||
|
>>>>>>> develop
|
||||||
if(!isset($id)){
|
if(!isset($id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter");
|
$this->app->setOutput("Error", "Incorrect parameter");
|
||||||
}
|
}
|
||||||
|
@ -410,7 +439,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $stream;
|
$this->app->setOutput("Images", $stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -422,7 +451,10 @@ class image implements Core{
|
||||||
* @param string $member_id
|
* @param string $member_id
|
||||||
* identifier of the member
|
* identifier of the member
|
||||||
**/
|
**/
|
||||||
private function addMemberImage($image_id, $member_id){
|
private function addMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -455,7 +487,10 @@ class image implements Core{
|
||||||
* @param string $image_id
|
* @param string $image_id
|
||||||
* identifier of the image
|
* identifier of the image
|
||||||
**/
|
**/
|
||||||
private function listMemberImage($image_id, $member_id){
|
private function listMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -482,7 +517,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $members;
|
$this->app->setOutput("Images", $member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -494,7 +529,10 @@ class image implements Core{
|
||||||
* @param string $member_id
|
* @param string $member_id
|
||||||
* identifier of the member
|
* identifier of the member
|
||||||
**/
|
**/
|
||||||
private function detailMemberImage($image_id, $member_id){
|
private function detailMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -525,7 +563,7 @@ class image implements Core{
|
||||||
}catch(NotImplementedError $e){
|
}catch(NotImplementedError $e){
|
||||||
$this->app->getErrorInstance->NotImplementedHandler($e);
|
$this->app->getErrorInstance->NotImplementedHandler($e);
|
||||||
}
|
}
|
||||||
return $member;
|
$this->app->setOutput("Images", $member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,7 +575,10 @@ class image implements Core{
|
||||||
* @param string $member_id
|
* @param string $member_id
|
||||||
* identifier of the member
|
* identifier of the member
|
||||||
**/
|
**/
|
||||||
private function removeMemberImage($image_id, $member_id){
|
private function removeMemberImage(){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
@ -580,6 +621,10 @@ class image implements Core{
|
||||||
* new status for the member
|
* new status for the member
|
||||||
**/
|
**/
|
||||||
private function updateMemberImage($image_id, $member_id, $status){
|
private function updateMemberImage($image_id, $member_id, $status){
|
||||||
|
$image_id = $this->app->getPostParam("image_id");
|
||||||
|
$member_id = $this->app->getPostParam("member_id");
|
||||||
|
$status = $this->app->getPostParam("status");
|
||||||
|
|
||||||
if(!isset($image_id)){
|
if(!isset($image_id)){
|
||||||
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
$this->app->setOutput("Error", "Incorrect parameter image_id");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue