* limitations under the License.
*/
-var app = angular.module('AECNewSubmission');
+var app = angular.module('NewSubmission');
app
.controller(
- 'AECNewSubmissionController',
+ 'NewSubmissionController',
function($scope, restAPISvc) {
initialize();
function initialize() {
restAPISvc
.getRestAPI(
- "/api/blueprintInstanceForValidation/",
+ "/api/v1/blueprintinstanceforvalidation/",
function(data) {
$scope.blueprintInstancesForValidation = data;
$scope.blueprintNames = [];
}
});
});
- restAPISvc.getRestAPI("/api/timeslots/",
- function(data) {
- $scope.timeslots = data;
- $scope.declerativeTimeslots = [];
- angular.forEach($scope.timeslots, function(
- timeslot) {
+ restAPISvc.getRestAPI("/api/v1/timeslots/", function(
+ data) {
+ $scope.timeslots = data;
+ $scope.declerativeTimeslots = [];
+ angular.forEach($scope.timeslots,
+ function(timeslot) {
var temp = "id: " + timeslot.timeslotId
+ " Start date and time: "
+ timeslot.startDateTime
+ " lab :" + timeslot.lab.lab;
$scope.declerativeTimeslots.push(temp);
});
- });
+ });
}
$scope.selectedBluePrintNameChange = function() {
$scope.blueprintVersions = [];
$scope.blueprintLayers = [];
+ $scope.optionals = [];
+ $scope.selectedBlueprintVersion = {};
+ $scope.selectedBlueprintLayer = {};
+ $scope.selectedOptional = "";
angular
.forEach(
$scope.blueprintInstancesForValidation,
});
}
$scope.selectedBluePrintVersionChange = function() {
+ if (!$scope.selectedBlueprintName) {
+ return;
+ }
$scope.blueprintLayers = [];
+ $scope.optionals = [];
+ $scope.selectedBlueprintLayer = {};
+ $scope.selectedOptional = "";
angular
.forEach(
$scope.blueprintInstancesForValidation,
}
}
});
+ $scope.blueprintLayers.push("all");
+ }
+
+ $scope.selectedBluePrintLayerChange = function() {
+ $scope.optionals = [ 'true', 'false' ];
}
$scope.submit = function() {
if (!$scope.selectedBlueprintName
|| !$scope.selectedBlueprintVersion
|| !$scope.selectedBlueprintLayer
+ || !$scope.selectedOptional
|| !$scope.selectedDeclerativeTimeslot) {
confirm("You must specify all data fields");
return;
}
- var finalBlueprint;
var finalTimeslot;
- angular
- .forEach(
- $scope.blueprintInstancesForValidation,
- function(blueprintInstance) {
- if (blueprintInstance["blueprint"]["blueprintName"] === $scope.selectedBlueprintName) {
- if (blueprintInstance["version"] === $scope.selectedBlueprintVersion) {
- if (blueprintInstance["layer"] === $scope.selectedBlueprintLayer) {
- finalBlueprint = blueprintInstance;
- }
- }
- }
- });
var selectedDeclerativeTimeslotId = $scope.selectedDeclerativeTimeslot
.substring(
$scope.selectedDeclerativeTimeslot
finalTimeslot = timeslot;
}
});
- var submission = {
- "blueprintInstanceForValidation" : finalBlueprint,
+ var allLayers = "false";
+ if ($scope.selectedBlueprintLayer === 'all') {
+ allLayers = "true";
+ }
+ var wRobotTestResults = [];
+ if (allLayers === "false") {
+ wRobotTestResults = [ {
+ "blueprintLayer" : $scope.selectedBlueprintLayer
+ } ];
+ }
+
+ var validationNexusTestResult = {
+ "blueprintName" : $scope.selectedBlueprintName,
+ "version" : $scope.selectedBlueprintVersion,
+ "allLayers" : allLayers,
+ "wRobotNexusTestResults" : wRobotTestResults,
+ "optional" : $scope.selectedOptional
+ };
+ var submissionData = {
+ "validationNexusTestResult" : validationNexusTestResult,
"timeslot" : finalTimeslot
};
restAPISvc
.postRestAPI(
- "/api/submission/",
- submission,
+ "/api/v1/submission/",
+ submissionData,
function(data) {
if (data !== undefined) {
- var confirmText = "The blueprint instance for validation has been submitted successfully. Submissionn id:"
+ var confirmText = "The blueprint instance for validation has been submitted successfully. Submission id:"
+ data.submissionId;
confirm(confirmText);
} else {
$scope.selectedBlueprintName = {};
$scope.selectedBlueprintVersion = {};
$scope.selectedBlueprintLayer = {};
+ $scope.selectedOptional = "";
$scope.selectedDeclerativeTimeslot = {};
}