blob: 80f6da9bb01fd09a42a534262c10d5c417be4180 [file] [log] [blame]
Matteo Scandolobf14f882016-06-02 10:01:34 -07001/*
Brian O'Connor8fb63ec2017-08-03 22:46:35 -07002 * Copyright 2015 Open Networking Foundation
Matteo Scandolobf14f882016-06-02 10:01:34 -07003 *
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 () {
18 'use strict';
19
20 var urlSuffix = '/rs/bundle';
21
22 var basic = 'basic',
23 family = 'family';
24
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070025 angular.module('mCord')
Matteo Scandolobf14f882016-06-02 10:01:34 -070026 .controller('CordBundleCtrl', function ($log, $scope, $resource, cordConfig) {
27 var BundleData, resource,
28 getData;
Matteo Scandolobf14f882016-06-02 10:01:34 -070029 $scope.show = false;
30
31 // set the current bundle
32 $scope.name = cordConfig.bundles[cordConfig.activeBundle].name;
33 $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc;
34 $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions;
35
36 // set the available bundle
37 if(cordConfig.activeBundle === 0) {
38 $scope.available = cordConfig.bundles[1];
39 }
40 else{
41 $scope.available = cordConfig.bundles[0];
42 }
43
44 // switching the bundles
45 $scope.changeBundle = function (id) {
46 if(cordConfig.activeBundle === 0){
47 cordConfig.activeBundle = 1;
48 $scope.available = cordConfig.bundles[0];
49 }
50 else{
51 cordConfig.activeBundle = 0;
52 $scope.available = cordConfig.bundles[1];
53 }
54 $scope.name = cordConfig.bundles[cordConfig.activeBundle].name;
55 $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc;
56 $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions;
57 };
58
59 // hiding and showing bundles
60 $scope.showBundles = function () {
61 $scope.show = !$scope.show;
62 };
63
64 $log.debug('Cord Bundle Ctrl has been created.');
65 })
66 .directive('bundleAvailable', function () {
67 return {
Matteo Scandoloa3844ec2016-06-02 15:45:19 -070068 templateUrl: 'app/view/services/available.html'
Matteo Scandolobf14f882016-06-02 10:01:34 -070069 };
70 });
71}());