X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=ui%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FAECBlueprintValidationUI%2FNewSubmission%2FAECNewSubmissionController.js;fp=ui%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FAECBlueprintValidationUI%2FNewSubmission%2FAECNewSubmissionController.js;h=0000000000000000000000000000000000000000;hb=2eba847ebb6acb2686be08eb1cdafc1b12071e7d;hp=2135680d0eee28265fb205cd85ad3b5334c9b2cc;hpb=f86b9715d156238532fcb0bf464bd72e9cf7ce96;p=validation.git diff --git a/ui/src/main/webapp/app/AECBlueprintValidationUI/NewSubmission/AECNewSubmissionController.js b/ui/src/main/webapp/app/AECBlueprintValidationUI/NewSubmission/AECNewSubmissionController.js deleted file mode 100644 index 2135680..0000000 --- a/ui/src/main/webapp/app/AECBlueprintValidationUI/NewSubmission/AECNewSubmissionController.js +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var app = angular.module('AECNewSubmission'); -app - .controller( - 'AECNewSubmissionController', - function($scope, restAPISvc) { - - initialize(); - - function initialize() { - restAPISvc - .getRestAPI( - "/api/blueprintInstanceForValidation/", - function(data) { - $scope.blueprintInstancesForValidation = data; - $scope.blueprintNames = []; - angular - .forEach( - $scope.blueprintInstancesForValidation, - function( - blueprintInstance) { - if ($scope.blueprintNames - .indexOf(blueprintInstance["blueprint"]["blueprintName"]) === -1) { - $scope.blueprintNames - .push(blueprintInstance["blueprint"]["blueprintName"]); - } - }); - }); - restAPISvc.getRestAPI("/api/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 - /* - * + " duration(in sec) :" + - * blueprintInstance["timeslot"].duration - */ - + " lab :" + timeslot.lab.lab; - $scope.declerativeTimeslots.push(temp); - }); - }); - } - $scope.selectedBluePrintNameChange = function() { - $scope.blueprintVersions = []; - $scope.blueprintLayers = []; - angular - .forEach( - $scope.blueprintInstancesForValidation, - function(blueprintInstance) { - if ($scope.selectedBlueprintName === blueprintInstance["blueprint"]["blueprintName"]) { - if ($scope.blueprintVersions - .indexOf(blueprintInstance["version"]) === -1) { - $scope.blueprintVersions - .push(blueprintInstance["version"]); - } - } - }); - } - $scope.selectedBluePrintVersionChange = function() { - $scope.blueprintLayers = []; - angular - .forEach( - $scope.blueprintInstancesForValidation, - function(blueprintInstance) { - if ($scope.selectedBlueprintName === blueprintInstance["blueprint"]["blueprintName"]) { - if ($scope.selectedBlueprintVersion === blueprintInstance["version"]) { - if ($scope.blueprintLayers - .indexOf(blueprintInstance["layer"]) === -1) { - $scope.blueprintLayers - .push(blueprintInstance["layer"]); - } - } - } - }); - } - - $scope.submit = function() { - if (!$scope.selectedBlueprintName - || !$scope.selectedBlueprintVersion - || !$scope.selectedBlueprintLayer - || !$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 - .indexOf("id:") + 4, - $scope.selectedDeclerativeTimeslot - .indexOf("Start date and time:") - 1); - angular - .forEach( - $scope.timeslots, - function(timeslot) { - if (selectedDeclerativeTimeslotId - .toString().trim() === timeslot.timeslotId - .toString().trim()) { - finalTimeslot = timeslot; - } - }); - var submission = { - "blueprintInstanceForValidation" : finalBlueprint, - "timeslot" : finalTimeslot - }; - restAPISvc - .postRestAPI( - "/api/submission/", - submission, - function(data) { - if (data !== undefined) { - var confirmText = "The blueprint instance for validation has been submitted successfully. Submissionn id:" - + data.submissionId; - confirm(confirmText); - } else { - confirm("Error when committing the submission"); - } - }); - $scope.selectedBlueprintName = {}; - $scope.selectedBlueprintVersion = {}; - $scope.selectedBlueprintLayer = {}; - $scope.selectedDeclerativeTimeslot = {}; - } - - });