Skip to content

Commit

Permalink
Merge pull request #17 from wilbur-shi/master
Browse files Browse the repository at this point in the history
Deliverables 17 (final one)!
  • Loading branch information
jmkao committed Aug 24, 2016
2 parents 7ac86ae + 74abfd5 commit 1fb1c78
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 51 deletions.
8 changes: 3 additions & 5 deletions host/resourcesnew/cwh/js/printJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
this.currentBuildVideo = {width: 100, height: 100, url: null};
this.currentBuildLiveStream = {url: null, clientId: Math.random()}

this.loading = false;

function refreshSelectedPrintJob(printJobList) {
var foundPrintJob = false;

Expand Down Expand Up @@ -65,18 +63,18 @@
})
}
this.stopPrintJob = function stopPrintJob() {
controller.loading = true;
$('#stop-btn').attr('class', 'fa fa-refresh fa-spin');
var printJobId = encodeURIComponent(controller.currentPrintJob.id);
$http.post("/services/printJobs/stopJob/" + printJobId).success(function (data) {
if (data.response) {
controller.refreshPrintJobs();
} else {
$scope.$emit("MachineResponse", {machineResponse: data, successFunction:null, afterErrorFunction:null});
}
controller.loading = false;
$('#stop-btn').attr('class', 'fa fa-stop');
}).error(function (data, status, headers, config, statusText) {
$scope.$emit("HTTPError", {status:status, statusText:data});
controller.loading = false;
$('#stop-btn').attr('class', 'fa fa-stop');
})
}
this.changeCurrentPrintJob = function changeCurrentPrintJob(newPrintJob) {
Expand Down
6 changes: 2 additions & 4 deletions host/resourcesnew/cwh/js/printables.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
this.errorMsg = "";

this.projectImage = false;
// this.loading = false;

this.handlePreviewError = function handlePreviewError() {
var printableName = encodeURIComponent(controller.currentPrintable.name);
var printableExtension = encodeURIComponent(controller.currentPrintable.extension);
var printableExtension = encodeURIComponent(controller.currentPrintable.extension);
$http.get("/services/customizers/renderFirstSliceImage/" + printableName + "." + printableExtension + "?projectImage=" + controller.projectImage).success(
function (data) {

Expand Down Expand Up @@ -70,8 +69,7 @@
function (data) {
controller.currentPreviewImg = "/services/customizers/renderFirstSliceImage/" + printableName + "." + printableExtension + "?projectImage=" + controller.projectImage;
var jsonString = JSON.stringify(parameter.affineTransformSettings).replace(/\"/g, "");
controller.currentPreviewImg += '?decache=' + encodeURIComponent(jsonString);
// controller.loading = false;
controller.currentPreviewImg += '&decache=' + encodeURIComponent(jsonString);
// console.log("reached success while rendering first slice image, browser side");
}).error(
function (data, status, headers, config, statusText) {
Expand Down
56 changes: 21 additions & 35 deletions host/resourcesnew/cwh/js/printers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
this.loadingProfilesMessage = "--- Loading slicing profiles from server ---"
this.loadingMachineConfigMessage = "--- Loading machine configurations from server ---"
this.autodirect = $location.search().autodirect;
this.startLoading = false;
this.stopLoading = false;
function refreshSelectedPrinter(printerList) {
var foundPrinter = false;
if (printerList.length == 1 && printerList[0].started && controller.autodirect != 'disabled') {
Expand Down Expand Up @@ -59,38 +57,26 @@
}
var printerName = encodeURIComponent(targetPrinter.configuration.name);
if (postTargetPrinter) {
$http.post(service, targetPrinter).success(
function (data) {
$scope.$emit("MachineResponse", {machineResponse: data, successFunction:refreshPrinters, afterErrorFunction:null});
controller.startLoading = false;
controller.stopLoading = false;
}).error(
function (data, status, headers, config, statusText) {
$scope.$emit("HTTPError", {status:status, statusText:data});
controller.startLoading = false;
controller.stopLoading = false;
})
$http.post(service, targetPrinter).then(
function(response) {
},
function(response) {
$scope.$emit("HTTPError", {status:response.status, statusText:response.data});
}).then(function() {
$('#start-btn').attr('class', 'fa fa-play');
$('#stop-btn').attr('class', 'fa fa-stop');
});
} else {
$http.get(service + printerName).success(
function (data) {
$scope.$emit("MachineResponse", {machineResponse: data, successFunction:refreshPrinters, afterErrorFunction:null});
controller.startLoading = false;
controller.stopLoading = false;
}).error(
function (data, status, headers, config, statusText) {
$scope.$emit("HTTPError", {status:status, statusText:data});
controller.startLoading = false;
controller.stopLoading = false;
});
// $http.get(service + printerName).then(
// function(response) {
// $scope.$emit("MachineResponse", {machineResponse: response.data, successFunction:refreshPrinters, afterErrorFunction:null});
// },
// function(response) {
// $scope.$emit("HTTPError", {status:response.status, statusText:response.data});
// }).then(function() {
// controller.loading = false;
// });
$http.get(service + printerName).then(
function(response) {
$scope.$emit("MachineResponse", {machineResponse: response.data, successFunction:refreshPrinters, afterErrorFunction:null});
},
function(response) {
$scope.$emit("HTTPError", {status:response.status, statusText:response.data});
}).then(function() {
$('#start-btn').attr('class', 'fa fa-play');
$('#stop-btn').attr('class', 'fa fa-stop');
});
}
}

Expand Down Expand Up @@ -176,12 +162,12 @@
}

this.startCurrentPrinter = function startCurrentPrinter() {
controller.startLoading = true;
$('#start-btn').attr('class', 'fa fa-refresh fa-spin');
executeActionAndRefreshPrinters("Start Printer", "No printer selected to start.", '/services/printers/start/', controller.currentPrinter, false);
}

this.stopCurrentPrinter = function stopCurrentPrinter() {
controller.stopLoading = true;
$('#stop-btn').attr('class', 'fa fa-refresh fa-spin');
executeActionAndRefreshPrinters("Stop Printer", "No printer selected to Stop.", '/services/printers/stop/', controller.currentPrinter, false);
}

Expand Down
3 changes: 1 addition & 2 deletions host/resourcesnew/printJobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ <h3 class="panel-title pull-left">Print Jobs</h3>
<span>Continue</span>
</a>
<a class="btn btn-danger" ng-show="printJobsController.currentPrintJob.printInProgress" ng-click="printJobsController.stopPrintJob()">
<i ng-show="!printJobsController.loading" class="fa fa-stop"></i>
<i ng-show="printJobsController.loading" class='fa fa-refresh fa-spin'></i>
<i id="stop-btn" class="fa fa-stop"></i>
<span>Stop</span>
</a>
</div>
Expand Down
6 changes: 2 additions & 4 deletions host/resourcesnew/printer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
<h3 class="panel-title pull-left">Basic Printer Setup</h3>
<div class="btn-group pull-right">
<button class="btn btn-success" ng-disabled="printersController.currentPrinter.started" ng-click="printersController.startCurrentPrinter()">
<i ng-show="!printersController.startLoading" class="fa fa-play"></i>
<i ng-show="printersController.startLoading" class='fa fa-refresh fa-spin'></i>
<i id="start-btn" class="fa fa-play"></i>
<span>Start</span>
</button>
<button class="btn btn-danger" ng-disabled="!printersController.currentPrinter.started" ng-click="printersController.stopCurrentPrinter()">
<i ng-show="!printersController.stopLoading" class="fa fa-stop"></i>
<i ng-show="printersController.stopLoading" class='fa fa-refresh fa-spin'></i>
<i id="stop-btn" class="fa fa-stop"></i>
<span>Stop</span>
</button>
<button class="btn btn-primary" ng-disabled="!printersController.currentPrinter.started" ng-click="printersController.gotoPrinterControls()" >
Expand Down
2 changes: 1 addition & 1 deletion host/resourcesnew/slacer
Submodule slacer updated 1 files
+3 −1 js/photonic3d.js

0 comments on commit 1fb1c78

Please sign in to comment.