blob: 054c7030059aa9f4c12736556fddaea18c0bc20c [file] [log] [blame]
Matteo Scandolo5d568612016-01-26 11:02:16 -08001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17(function () {
Matteo Scandolodd1e1902016-01-27 14:30:22 -080018 'use strict';
Matteo Scandolo5d568612016-01-26 11:02:16 -080019
Matteo Scandolodd1e1902016-01-27 14:30:22 -080020 var urlSuffix = '/rs/bundle';
Matteo Scandolo5d568612016-01-26 11:02:16 -080021
Matteo Scandolodd1e1902016-01-27 14:30:22 -080022 var basic = 'basic',
23 family = 'family';
Matteo Scandolo5d568612016-01-26 11:02:16 -080024
Matteo Scandolodd1e1902016-01-27 14:30:22 -080025 angular.module('cordBundle', [])
26 .controller('CordBundleCtrl', function ($log, $scope, $resource, cordConfig) {
27 var BundleData, resource,
28 getData;
29 $scope.page.curr = 'bundle';
30 $scope.show = false;
Matteo Scandolo5d568612016-01-26 11:02:16 -080031
Matteo Scandolodd1e1902016-01-27 14:30:22 -080032 // set the current bundle
33 $scope.name = cordConfig.bundles[cordConfig.activeBundle].name;
34 $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc;
35 $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions;
Matteo Scandolo5d568612016-01-26 11:02:16 -080036
Matteo Scandolodd1e1902016-01-27 14:30:22 -080037 // set the available bundle
38 if(cordConfig.activeBundle === 0) {
39 $scope.available = cordConfig.bundles[1];
40 }
41 else{
42 $scope.available = cordConfig.bundles[0];
43 }
Matteo Scandolo5d568612016-01-26 11:02:16 -080044
Matteo Scandolodd1e1902016-01-27 14:30:22 -080045 // switching the bundles
46 $scope.changeBundle = function (id) {
47 if(cordConfig.activeBundle === 0){
48 cordConfig.activeBundle = 1;
49 $scope.available = cordConfig.bundles[0];
50 }
51 else{
52 cordConfig.activeBundle = 0;
53 $scope.available = cordConfig.bundles[1];
54 }
55 $scope.name = cordConfig.bundles[cordConfig.activeBundle].name;
56 $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc;
57 $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions;
58 };
Matteo Scandolo5d568612016-01-26 11:02:16 -080059
Matteo Scandolodd1e1902016-01-27 14:30:22 -080060 // hiding and showing bundles
61 $scope.showBundles = function () {
62 $scope.show = !$scope.show;
63 };
Matteo Scandolo5d568612016-01-26 11:02:16 -080064
Matteo Scandolodd1e1902016-01-27 14:30:22 -080065 $log.debug('Cord Bundle Ctrl has been created.');
66 })
Matteo Scandolo5d568612016-01-26 11:02:16 -080067
Matteo Scandolodd1e1902016-01-27 14:30:22 -080068 .directive('bundleAvailable', [function () {
69 return {
70 templateUrl: 'app/view/bundle/available.html'
71 };
72 }]);
Matteo Scandolo5d568612016-01-26 11:02:16 -080073}());