2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
23 var iframeDialogController = function (COMPONENT, FIELD, PARAMETER, $scope, $http, $timeout, $log,
24 CreationService, UtilityService, DataService, $routeParams) {
26 $scope.isDialogVisible = false;
28 function receiveMessage(event) {
29 window.removeEventListener("message", receiveMessage, false);
30 $scope.isDialogVisible = false;
31 $scope.popup.isVisible = false;
33 if (event.data.eventId == 'submitIframe') {
34 CreationService.initializeComponent(COMPONENT.VNF);
35 var instanceId = $routeParams.serviceInstanceId;
36 DataService.setServiceInstanceId(instanceId);
37 console.log(event.data.data);
39 $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
40 url: CreationService.getMsoUrl(),
41 requestDetails: event.data.data,
42 componentId: COMPONENT.VNF,
43 callbackFunction: function (response) {
44 // if (response.isSuccessful) {
45 // $scope.popup.shouldShowIframePopup = false;
47 $scope.isDialogVisible = false;
48 $scope.popup.isVisible = false;
57 $scope.$on(COMPONENT.IFRAME_DIALOG, function (event, data) {
58 var queryString = Object.keys(data).map(function(key) {
59 return key + '=' + data[key]
61 $scope.url = COMPONENT.SUB_INTERFACE_POPUP_IFRAME_URL + queryString;
62 $scope.isDialogVisible = true;
63 $scope.popup.isVisible = true;
65 window.addEventListener("message", receiveMessage, false);
69 appDS2.controller("iframeDialogController", ["COMPONENT", "FIELD", "PARAMETER", "$scope", "$http",
70 "$timeout", "$log", "CreationService", "UtilityService", "DataService", "$routeParams",
71 iframeDialogController]);