Matteo Scandolo | d2044a4 | 2017-08-07 16:08:28 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2017-present Open Networking Foundation |
| 4 | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | |
Arpit Agarwal | 711b1ec | 2016-06-27 13:28:54 -0700 | [diff] [blame] | 19 | /**
|
| 20 | * Created by arpit on 7/7/2016.
|
| 21 | */
|
| 22 | 'use strict';
|
| 23 |
|
| 24 | angular.module('xos.tenant')
|
| 25 | .directive('siteDetail', function(){
|
| 26 | return {
|
| 27 | restrict: 'E',
|
| 28 | scope: {},
|
| 29 | bindToController: true,
|
| 30 | controllerAs: 'sl',
|
| 31 | templateUrl: 'templates/slicelist.html',
|
| 32 | controller: function(SlicesPlus, $stateParams){
|
| 33 | this.siteId = $stateParams.id;
|
| 34 | this.tableConfig = {
|
| 35 | columns: [
|
| 36 | {
|
| 37 | label: 'Slice List',
|
| 38 | prop: 'name',
|
| 39 | link: item => `#/site/${item.site}/slice/${item.id}`
|
| 40 | },
|
| 41 | {
|
| 42 | label: 'Allocated',
|
| 43 | prop: 'instance_total'
|
| 44 | },
|
| 45 | {
|
| 46 | label: 'Ready',
|
| 47 | prop: 'instance_total_ready'
|
| 48 | }
|
| 49 | ]
|
| 50 | };
|
| 51 |
|
| 52 | // retrieving user list
|
| 53 | SlicesPlus.query({
|
| 54 | site: $stateParams.id
|
| 55 | }).$promise
|
| 56 | .then((users) => {
|
| 57 | this.sliceList = users;
|
| 58 | })
|
| 59 | .catch((e) => {
|
| 60 | throw new Error(e);
|
| 61 | });
|
| 62 | }
|
| 63 | };
|
| 64 | }); |