2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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 detailsDialogController = function($scope, $http, $timeout, $log,
24 MsoService, DetailsService, UtilityService) {
26 $scope.isDialogVisible = false;
27 $scope.summaryControl = {};
28 $scope.detailsControl = {};
30 $scope.$on("showComponentDetails", function(event, request) {
33 $scope.isSpinnerVisible = true;
34 $scope.isErrorVisible = false;
35 $scope.isDialogVisible = true;
36 $scope.popup.isVisible = true;
38 DetailsService.initializeComponent(request.componentId);
40 $scope.componentName = DetailsService.getComponentDisplayName();
42 $scope.summaryControl.setList(DetailsService.getSummaryList());
44 $scope.detailsControl.setList(DetailsService.getDetailsList());
46 UtilityService.setHttpErrorHandler(function(response) {
47 showError("System failure", UtilityService
48 .getHttpErrorMessage(response));
51 MsoService.getOrchestrationRequests(
52 DetailsService.getMsoFilterString(), handleGetResponse);
55 var handleGetResponse = function(response) {
56 $scope.isSpinnerVisible = false;
58 $scope.log = MsoService
59 .getFormattedGetOrchestrationRequestsResponse(response);
61 $scope.log = MsoService.getFormattedCommonResponse(response);
62 MsoService.showResponseContentError(error, showError);
66 $scope.close = function() {
67 $scope.isDialogVisible = false;
68 $scope.popup.isVisible = false;
71 var showError = function(summary, details) {
72 var message = summary;
73 if (UtilityService.hasContents(details)) {
74 message += " (" + details + ")";
76 $scope.isSpinnerVisible = false;
77 $scope.isErrorVisible = true;
78 $scope.error = message;
82 app.controller("detailsDialogController", [ "$scope", "$http", "$timeout",
83 "$log", "MsoService", "DetailsService", "UtilityService",
84 detailsDialogController ]);