Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / app / policyApp / policy-models / Editor / src / js / controllers / selector-controller.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP Policy Engine
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 (function(angular, $) {
22     'use strict';
23     angular.module('abs').controller('ModalFileManagerCtrl',
24         ['$scope', '$rootScope', 'fileNavigator', 
25         function($scope, $rootScope, FileNavigator) {
26
27         $scope.reverse = false;
28         $scope.predicate = ['model.type', 'model.name'];
29         $scope.order = function(predicate) {
30             $scope.reverse = ($scope.predicate[1] === predicate) ? !$scope.reverse : false;
31             $scope.predicate[1] = predicate;
32         };
33
34         $scope.fileNavigator = new FileNavigator();
35         $rootScope.select = function(item, temp) {
36             temp.tempModel.path = item.model.fullPath().split('/');
37             $('#selector').modal('hide');
38         };
39         
40         $rootScope.openNavigator = function(item) {
41             $scope.fileNavigator.currentPath = item.model.path.slice();
42             $scope.fileNavigator.refresh();
43             $('#selector').modal('show');
44         };
45
46     }]);
47 })(angular, jQuery);