X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=validation.git;a=blobdiff_plain;f=ui%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FBluvalUI%2FNewSubmission%2FNewSubmissionController.js;fp=ui%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FAECBlueprintValidationUI%2FNewSubmission%2FAECNewSubmissionController.js;h=1f65975b69a3abbeb09cb35f2912f4e2322fc08b;hp=2135680d0eee28265fb205cd85ad3b5334c9b2cc;hb=2eba847ebb6acb2686be08eb1cdafc1b12071e7d;hpb=f86b9715d156238532fcb0bf464bd72e9cf7ce96 diff --git a/ui/src/main/webapp/app/AECBlueprintValidationUI/NewSubmission/AECNewSubmissionController.js b/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js similarity index 74% rename from ui/src/main/webapp/app/AECBlueprintValidationUI/NewSubmission/AECNewSubmissionController.js rename to ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js index 2135680..1f65975 100644 --- a/ui/src/main/webapp/app/AECBlueprintValidationUI/NewSubmission/AECNewSubmissionController.js +++ b/ui/src/main/webapp/app/BluvalUI/NewSubmission/NewSubmissionController.js @@ -14,10 +14,10 @@ * limitations under the License. */ -var app = angular.module('AECNewSubmission'); +var app = angular.module('NewSubmission'); app .controller( - 'AECNewSubmissionController', + 'NewSubmissionController', function($scope, restAPISvc) { initialize(); @@ -25,7 +25,7 @@ app function initialize() { restAPISvc .getRestAPI( - "/api/blueprintInstanceForValidation/", + "/api/v1/blueprintinstanceforvalidation/", function(data) { $scope.blueprintInstancesForValidation = data; $scope.blueprintNames = []; @@ -41,12 +41,12 @@ app } }); }); - 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 @@ -57,11 +57,15 @@ app + " 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, @@ -76,7 +80,13 @@ app }); } $scope.selectedBluePrintVersionChange = function() { + if (!$scope.selectedBlueprintName) { + return; + } $scope.blueprintLayers = []; + $scope.optionals = []; + $scope.selectedBlueprintLayer = {}; + $scope.selectedOptional = ""; angular .forEach( $scope.blueprintInstancesForValidation, @@ -91,30 +101,23 @@ app } } }); + $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 @@ -131,17 +134,35 @@ app 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 { @@ -151,6 +172,7 @@ app $scope.selectedBlueprintName = {}; $scope.selectedBlueprintVersion = {}; $scope.selectedBlueprintLayer = {}; + $scope.selectedOptional = ""; $scope.selectedDeclerativeTimeslot = {}; }