Add status to image
This commit is contained in:
parent
43e76785f0
commit
664cddd4fa
6 changed files with 279 additions and 236 deletions
|
@ -4,7 +4,7 @@
|
||||||
* @param {$scope} $scope The $scope service from angular
|
* @param {$scope} $scope The $scope service from angular
|
||||||
*/
|
*/
|
||||||
mainApp.controller('homeCtrl', ['$scope', 'Compute', '$rootScope', 'Loading', 'Identity', 'Image', function ($scope, Compute, $rootScope, Loading, Identity, Image)
|
mainApp.controller('homeCtrl', ['$scope', 'Compute', '$rootScope', 'Loading', 'Identity', 'Image', function ($scope, Compute, $rootScope, Loading, Identity, Image)
|
||||||
{
|
{
|
||||||
|
|
||||||
graph = new joint.dia.Graph;
|
graph = new joint.dia.Graph;
|
||||||
paper = new joint.dia.Paper({
|
paper = new joint.dia.Paper({
|
||||||
|
@ -61,7 +61,7 @@ mainApp.controller('homeCtrl', ['$scope', 'Compute', '$rootScope', 'Loading', 'I
|
||||||
var cells = buildGraphFromAdjacencyList(vmList);
|
var cells = buildGraphFromAdjacencyList(vmList);
|
||||||
|
|
||||||
this.graph.addCells(cells);
|
this.graph.addCells(cells);
|
||||||
console.log(this.graph);
|
//console.log(this.graph);
|
||||||
var test = joint.layout.DirectedGraph.layout(this.graph, {
|
var test = joint.layout.DirectedGraph.layout(this.graph, {
|
||||||
etLinkVertices: false,
|
etLinkVertices: false,
|
||||||
//Top to bottom generation
|
//Top to bottom generation
|
||||||
|
@ -199,4 +199,4 @@ mainApp.controller('homeCtrl', ['$scope', 'Compute', '$rootScope', 'Loading', 'I
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* @param {$scope} $scope The $scope service from angular
|
* @param {$scope} $scope The $scope service from angular
|
||||||
*/
|
*/
|
||||||
mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity','$rootScope', function ($scope, Image, Loading, Identity, $rootScope)
|
mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', '$rootScope', function ($scope, Image, Loading, Identity, $rootScope)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Update view
|
// Update view
|
||||||
|
@ -22,8 +22,13 @@ mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity','$root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.edit=function(image){
|
$scope.edit = function (image) {
|
||||||
$rootScope.$broadcast("editImageEvent", image, Image.getData().axioms);
|
$rootScope.$broadcast("editImageEvent", image, Image.getData().axioms);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.showUploadImageModal = function () {
|
||||||
|
$rootScope.$broadcast("showUploadImageModalEvent");
|
||||||
|
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -22,10 +22,11 @@ mainApp.controller('uploadImageCtrl', ['$scope', 'Image', 'Loading', 'Identity',
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$scope.doUpload = function () {
|
$scope.doUpload = function () {
|
||||||
console.log($('#imageToUpload').prop('files')[0]);
|
/* console.log($('#imageToUpload').prop('files')[0]);
|
||||||
Image.uploadImage($('#imageToUpload').prop('files')[0], function () {
|
Image.uploadImage($('#imageToUpload').prop('files')[0], function () {
|
||||||
alert("done")
|
alert("done");
|
||||||
})
|
});*/
|
||||||
|
Image.uploadImage("loic",function(){})
|
||||||
/*$("#drop-area-div").dmUploader({
|
/*$("#drop-area-div").dmUploader({
|
||||||
extraData: {
|
extraData: {
|
||||||
"token" : Identity.getToken(),
|
"token" : Identity.getToken(),
|
||||||
|
@ -57,6 +58,11 @@ mainApp.controller('uploadImageCtrl', ['$scope', 'Image', 'Loading', 'Identity',
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
// Manager logout event
|
||||||
|
$scope.$on('showUploadImageModalEvent', function () {
|
||||||
$scope.token = Identity.getToken();
|
$scope.token = Identity.getToken();
|
||||||
|
|
||||||
|
$('#uploadImageModal').modal("show");
|
||||||
|
});
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -84,7 +84,7 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
var uploadImage = function (fileToUpload, callback) {
|
var uploadImage = function (fileToUpload, callback) {
|
||||||
var form_data = new FormData();
|
/*var form_data = new FormData();
|
||||||
form_data.append('file', fileToUpload);
|
form_data.append('file', fileToUpload);
|
||||||
console.log(fileToUpload);
|
console.log(fileToUpload);
|
||||||
form_data.append("task", "image");
|
form_data.append("task", "image");
|
||||||
|
@ -109,19 +109,47 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
||||||
{
|
{
|
||||||
alert("success");
|
alert("success");
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
alert("send")
|
||||||
|
var result = $http.post('../server/index.php',
|
||||||
|
$.param({"token": Identity.getToken(), "task": "image", 'action': 'createImage', "opt": {"name": "loic"}}));
|
||||||
|
|
||||||
//var result=$http.post('../server/index.php',
|
//var result=$http.post('../server/index.php',
|
||||||
// $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'file_name':form_data, 'id':'6564'}));
|
// $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'file_name':form_data, 'id':'6564'}));
|
||||||
|
|
||||||
// Wait and handle the response
|
// Wait and handle the response
|
||||||
/* result.then(function (response){
|
result.then(function (response) {
|
||||||
callback(parseUploadImageAnswer(response, false));
|
//callback(parseUploadImageAnswer(response, false));
|
||||||
},function(response){
|
alert(response.data)
|
||||||
callback(parseUploadImageAnswer(response, true));
|
console.log(response.data)
|
||||||
});*/
|
callback()
|
||||||
|
}, function (response) {
|
||||||
|
alert(response.data)
|
||||||
|
callback()
|
||||||
|
//callback(parseUploadImageAnswer(response, true));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var createImage = function (name,callback) {
|
||||||
|
|
||||||
|
|
||||||
|
var result = $http.post('../server/index.php',
|
||||||
|
$.param({"token": Identity.getToken(), "task": "image", 'action': 'createImage', "opt": {"name": name}}));
|
||||||
|
|
||||||
|
//var result=$http.post('../server/index.php',
|
||||||
|
// $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'file_name':form_data, 'id':'6564'}));
|
||||||
|
|
||||||
|
// Wait and handle the response
|
||||||
|
result.then(function (response) {
|
||||||
|
callback()
|
||||||
|
}, function (response) {
|
||||||
|
alert(response.data)
|
||||||
|
callback()
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var getData = function (response) {
|
var getData = function (response) {
|
||||||
return data;
|
return data;
|
||||||
|
@ -132,6 +160,7 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
||||||
getImages: getImages,
|
getImages: getImages,
|
||||||
updateImage: updateImage,
|
updateImage: updateImage,
|
||||||
getData: getData,
|
getData: getData,
|
||||||
|
createImage: createImage,
|
||||||
uploadImage: uploadImage
|
uploadImage: uploadImage
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="btn-group btn-group-md" role="group" aria-label="...">
|
<div class="btn-group btn-group-md" role="group" aria-label="...">
|
||||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#uploadImageModal">Upload</button>
|
<button type="button" class="btn btn-default" ng-click="showUploadImageModal()">Upload</button>
|
||||||
<button type="button" class="btn btn-default">Download</button>
|
<button type="button" class="btn btn-default">Download</button>
|
||||||
</div>
|
</div>
|
||||||
<p></p>
|
<p></p>
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
<th>Status</th>
|
||||||
<th>Size</th>
|
<th>Size</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -23,6 +24,9 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="image in images">
|
<tr ng-repeat="image in images">
|
||||||
<td>{{ image.name}}</td>
|
<td>{{ image.name}}</td>
|
||||||
|
<td ng-if="image.status == 'queued'"><font color="red">{{ image.status}}</font></td>
|
||||||
|
<td ng-if="image.status != 'queued'"><font color="green">{{ image.status}}</font></td>
|
||||||
|
|
||||||
<td>{{ (image.size / 1048576).toFixed(2)}} MB</td>
|
<td>{{ (image.size / 1048576).toFixed(2)}} MB</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-primary" ng-click="edit(image)">Edit</button>
|
<button type="button" class="btn btn-primary" ng-click="edit(image)">Edit</button>
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<form action="../server/index.php" method="post">
|
<form action="../server/index.php" method="post">
|
||||||
<input type="hidden" name="task" value="image" />
|
<input type="hidden" name="task" value="image" />
|
||||||
<input type="hidden" name="token" value="{{ token }}" />
|
<input type="hidden" name="token" value="{{ token }}" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue