blob: 310118b643838cf392aa6262d229430328a26767 [file] [log] [blame]
Matteo Scandolo4eb4ccb2016-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 Scandolo10fb87c2016-01-27 14:30:22 -080018 'use strict';
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080019
Matteo Scandolo10fb87c2016-01-27 14:30:22 -080020 var urlSuffix = '/rs/bundle';
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080021
Matteo Scandolo10fb87c2016-01-27 14:30:22 -080022 var basic = 'basic',
23 family = 'family';
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080024
Matteo Scandolo10fb87c2016-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 Scandolo4eb4ccb2016-01-26 11:02:16 -080031
Matteo Scandolo10fb87c2016-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 Scandolo4eb4ccb2016-01-26 11:02:16 -080036
Matteo Scandolo10fb87c2016-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 Scandolo4eb4ccb2016-01-26 11:02:16 -080044
Matteo Scandolo10fb87c2016-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 Scandolo4eb4ccb2016-01-26 11:02:16 -080059
Matteo Scandolo10fb87c2016-01-27 14:30:22 -080060 // hiding and showing bundles
61 $scope.showBundles = function () {
62 $scope.show = !$scope.show;
63 };
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080064
Matteo Scandolo10fb87c2016-01-27 14:30:22 -080065 $log.debug('Cord Bundle Ctrl has been created.');
66 })
Matteo Scandoloe0628502016-01-27 14:42:42 -080067 .directive('bundleAvailable', function () {
Matteo Scandolo10fb87c2016-01-27 14:30:22 -080068 return {
69 templateUrl: 'app/view/bundle/available.html'
70 };
Matteo Scandoloe0628502016-01-27 14:42:42 -080071 });
Matteo Scandolo4eb4ccb2016-01-26 11:02:16 -080072}());