blob: e6b9709594d91074f0a37fc7a442cfb65f174d9b [file] [log] [blame]
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001'use strict';
2
3/**
4 * © OpenCORD
5 *
6 * Visit http://guide.xosproject.org/devguide/addview/ for more information
7 *
8 * Created by teone on 3/24/16.
9 */
10
11(function () {
12 'use strict';
13
14 /**
15 * @ngdoc overview
16 * @name xos.uiComponents
17 * @description
18 * # xos.uiComponents
19 * A collection of UI components useful for Dashboard development. <br/>
20 * Currently available components are:
21 * - [xosAlert](/#/module/xos.uiComponents.directive:xosAlert)
22 * - [xosForm](/#/module/xos.uiComponents.directive:xosForm)
23 * - [xosPagination](/#/module/xos.uiComponents.directive:xosPagination)
24 * - [xosSmartTable](/#/module/xos.uiComponents.directive:xosSmartTable)
25 * - [xosTable](/#/module/xos.uiComponents.directive:xosTable)
26 * - [xosValidation](/#/module/xos.uiComponents.directive:xosValidation)
27 **/
28
Matteo Scandolo65116c42016-09-21 17:06:23 -070029 angular.module('xos.uiComponents', ['chart.js', 'RecursionHelper', 'dndLists']);
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -070030})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -070031//# sourceMappingURL=../maps/ui_components/ui-components.module.js.map
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -070032
Matteo Scandoloe57712f2016-09-21 15:27:36 -070033'use strict';
Arpit Agarwal34b63832016-08-08 11:59:45 -070034
35/**
36 * © OpenCORD
37 *
38 * Visit http://guide.xosproject.org/devguide/addview/ for more information
39 *
Arpit Agarwal43978742016-08-09 15:38:25 -070040 * Created by teone on 4/15/16.
Arpit Agarwal34b63832016-08-08 11:59:45 -070041 */
42
43(function () {
44 'use strict';
45
46 angular.module('xos.uiComponents')
47
48 /**
Arpit Agarwal43978742016-08-09 15:38:25 -070049 * @ngdoc directive
50 * @name xos.uiComponents.directive:xosValidation
51 * @restrict E
52 * @description The xos-validation directive
53 * @param {Object} errors The error object
54 * @element ANY
55 * @scope
Arpit Agarwal34b63832016-08-08 11:59:45 -070056 * @example
Arpit Agarwal43978742016-08-09 15:38:25 -070057 <example module="sampleValidation">
Arpit Agarwal34b63832016-08-08 11:59:45 -070058 <file name="index.html">
59 <div ng-controller="SampleCtrl as vm">
Arpit Agarwal43978742016-08-09 15:38:25 -070060 <div class="row">
61 <div class="col-xs-12">
62 <label>Set an error type:</label>
63 </div>
64 <div class="col-xs-2">
65 <a class="btn"
66 ng-click="vm.field.$error.required = !vm.field.$error.required"
67 ng-class="{'btn-default': !vm.field.$error.required, 'btn-success': vm.field.$error.required}">
68 Required
69 </a>
70 </div>
71 <div class="col-xs-2">
72 <a class="btn"
73 ng-click="vm.field.$error.email = !vm.field.$error.email"
74 ng-class="{'btn-default': !vm.field.$error.email, 'btn-success': vm.field.$error.email}">
75 Email
76 </a>
77 </div>
78 <div class="col-xs-2">
79 <a class="btn"
80 ng-click="vm.field.$error.minlength = !vm.field.$error.minlength"
81 ng-class="{'btn-default': !vm.field.$error.minlength, 'btn-success': vm.field.$error.minlength}">
82 Min Length
83 </a>
84 </div>
85 <div class="col-xs-2">
86 <a class="btn"
87 ng-click="vm.field.$error.maxlength = !vm.field.$error.maxlength"
88 ng-class="{'btn-default': !vm.field.$error.maxlength, 'btn-success': vm.field.$error.maxlength}">
89 Max Length
90 </a>
91 </div>
92 </div>
93 <xos-validation field ="vm.field" form = "vm.form"></xos-validation>
Arpit Agarwal34b63832016-08-08 11:59:45 -070094 </div>
95 </file>
96 <file name="script.js">
Arpit Agarwal43978742016-08-09 15:38:25 -070097 angular.module('sampleValidation', ['xos.uiComponents'])
Arpit Agarwal34b63832016-08-08 11:59:45 -070098 .controller('SampleCtrl', function(){
Arpit Agarwal43978742016-08-09 15:38:25 -070099 this.field = {
100 $error: {}
Arpit Agarwal34b63832016-08-08 11:59:45 -0700101 };
Arpit Agarwal43978742016-08-09 15:38:25 -0700102 this.form= {
103 $submitted:true
104 }
Arpit Agarwal34b63832016-08-08 11:59:45 -0700105 });
106 </file>
107 </example>
Arpit Agarwal43978742016-08-09 15:38:25 -0700108 */
Arpit Agarwal34b63832016-08-08 11:59:45 -0700109
Arpit Agarwal43978742016-08-09 15:38:25 -0700110 .component('xosValidation', {
Arpit Agarwal34b63832016-08-08 11:59:45 -0700111 restrict: 'E',
112 bindings: {
Arpit Agarwal43978742016-08-09 15:38:25 -0700113 field: '=',
114 form: '='
Arpit Agarwal34b63832016-08-08 11:59:45 -0700115 },
Arpit Agarwal43978742016-08-09 15:38:25 -0700116 template: '\n <div ng-cloak>\n <xos-alert config="vm.config" show="vm.field.$error.required !== undefined && vm.field.$error.required !== false && (vm.field.$touched || vm.form.$submitted)">\n Field required\n </xos-alert>\n <xos-alert config="vm.config" show="vm.field.$error.email !== undefined && vm.field.$error.email !== false && (vm.field.$touched || vm.form.$submitted)">\n This is not a valid email\n </xos-alert>\n <xos-alert config="vm.config" show="vm.field.$error.minlength !== undefined && vm.field.$error.minlength !== false && (vm.field.$touched || vm.form.$submitted)">\n Too short\n </xos-alert>\n <xos-alert config="vm.config" show="vm.field.$error.maxlength !== undefined && vm.field.$error.maxlength !== false && (vm.field.$touched || vm.form.$submitted)">\n Too long\n </xos-alert>\n <xos-alert config="vm.config" show="vm.field.$error.custom !== undefined && vm.field.$error.custom !== false && (vm.field.$touched || vm.form.$submitted)">\n Field invalid\n </xos-alert>\n </div>\n ',
117 transclude: true,
Arpit Agarwal34b63832016-08-08 11:59:45 -0700118 bindToController: true,
119 controllerAs: 'vm',
Arpit Agarwal43978742016-08-09 15:38:25 -0700120 controller: function controller() {
121 this.config = {
122 type: 'danger'
123 };
124 }
125 });
126})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -0700127//# sourceMappingURL=../../../maps/ui_components/dumbComponents/validation/validation.component.js.map
Arpit Agarwal43978742016-08-09 15:38:25 -0700128
Arpit Agarwal34b63832016-08-08 11:59:45 -0700129'use strict';
130
131/**
132 * © OpenCORD
133 *
134 * Visit http://guide.xosproject.org/devguide/addview/ for more information
135 *
Matteo Scandolo65116c42016-09-21 17:06:23 -0700136 * Created by teone on 4/15/16.
Arpit Agarwal34b63832016-08-08 11:59:45 -0700137 */
138
139(function () {
140 'use strict';
141
142 angular.module('xos.uiComponents')
Matteo Scandolo65116c42016-09-21 17:06:23 -0700143
Arpit Agarwal34b63832016-08-08 11:59:45 -0700144 /**
145 * @ngdoc directive
Matteo Scandolo65116c42016-09-21 17:06:23 -0700146 * @name xos.uiComponents.directive:xosPagination
Arpit Agarwal34b63832016-08-08 11:59:45 -0700147 * @restrict E
148 * @description The xos-table directive
Matteo Scandolo65116c42016-09-21 17:06:23 -0700149 * @param {Number} pageSize Number of elements per page
150 * @param {Number} totalElements Number of total elements in the collection
151 * @param {Function} change The callback to be triggered on page change.
152 * * @element ANY
Arpit Agarwal34b63832016-08-08 11:59:45 -0700153 * @scope
154 * @example
Matteo Scandolo65116c42016-09-21 17:06:23 -0700155 <example module="samplePagination">
156 <file name="index.html">
157 <div ng-controller="SampleCtrl1 as vm">
158 <xos-pagination
159 page-size="vm.pageSize"
160 total-elements="vm.totalElements"
161 change="vm.change">
162 </xos-pagination>
163 </div>
164 </file>
165 <file name="script.js">
166 angular.module('samplePagination', ['xos.uiComponents'])
167 .controller('SampleCtrl1', function(){
168 this.pageSize = 10;
169 this.totalElements = 35;
170 this.change = (pageNumber) => {
171 console.log(pageNumber);
172 }
173 });
174 </file>
175 </example>
176 **/
177
178 .component('xosPagination', {
Arpit Agarwal34b63832016-08-08 11:59:45 -0700179 restrict: 'E',
180 bindings: {
Matteo Scandolo65116c42016-09-21 17:06:23 -0700181 pageSize: '=',
182 totalElements: '=',
183 change: '='
Arpit Agarwal34b63832016-08-08 11:59:45 -0700184 },
Matteo Scandolo65116c42016-09-21 17:06:23 -0700185 template: '\n <div class="row" ng-if="vm.pageList.length > 1">\n <div class="col-xs-12 text-center">\n <ul class="pagination">\n <li\n ng-click="vm.goToPage(vm.currentPage - 1)"\n ng-class="{disabled: vm.currentPage == 0}">\n <a href="" aria-label="Previous">\n <span aria-hidden="true">&laquo;</span>\n </a>\n </li>\n <li ng-repeat="i in vm.pageList" ng-class="{active: i === vm.currentPage}">\n <a href="" ng-click="vm.goToPage(i)">{{i + 1}}</a>\n </li>\n <li\n ng-click="vm.goToPage(vm.currentPage + 1)"\n ng-class="{disabled: vm.currentPage == vm.pages - 1}">\n <a href="" aria-label="Next">\n <span aria-hidden="true">&raquo;</span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n ',
Arpit Agarwal34b63832016-08-08 11:59:45 -0700186 bindToController: true,
187 controllerAs: 'vm',
Matteo Scandolo65116c42016-09-21 17:06:23 -0700188 controller: ["$scope", function controller($scope) {
Arpit Agarwal34b63832016-08-08 11:59:45 -0700189 var _this = this;
190
Matteo Scandolo65116c42016-09-21 17:06:23 -0700191 this.currentPage = 0;
Arpit Agarwal34b63832016-08-08 11:59:45 -0700192
Matteo Scandolo65116c42016-09-21 17:06:23 -0700193 this.goToPage = function (n) {
194 if (n < 0 || n === _this.pages) {
195 return;
196 }
197 _this.currentPage = n;
198 _this.change(n);
Arpit Agarwal34b63832016-08-08 11:59:45 -0700199 };
200
Matteo Scandolo65116c42016-09-21 17:06:23 -0700201 this.createPages = function (pages) {
202 var arr = [];
203 for (var i = 0; i < pages; i++) {
204 arr.push(i);
205 }
206 return arr;
Arpit Agarwal34b63832016-08-08 11:59:45 -0700207 };
208
Matteo Scandolo65116c42016-09-21 17:06:23 -0700209 // watch for data changes
210 $scope.$watch(function () {
211 return _this.totalElements;
212 }, function () {
213 if (_this.totalElements) {
214 _this.pages = Math.ceil(_this.totalElements / _this.pageSize);
215 _this.pageList = _this.createPages(_this.pages);
216 }
Arpit Agarwal34b63832016-08-08 11:59:45 -0700217 });
218 }]
Matteo Scandolo65116c42016-09-21 17:06:23 -0700219 }).filter('pagination', function () {
220 return function (input, start) {
221 if (!input || !angular.isArray(input)) {
222 return input;
223 }
224 start = parseInt(start, 10);
225 return input.slice(start);
226 };
Arpit Agarwal34b63832016-08-08 11:59:45 -0700227 });
228})();
Matteo Scandolo65116c42016-09-21 17:06:23 -0700229//# sourceMappingURL=../../../maps/ui_components/dumbComponents/pagination/pagination.component.js.map
Matteo Scandoloe57712f2016-09-21 15:27:36 -0700230
Arpit Agarwal34b63832016-08-08 11:59:45 -0700231'use strict';
232
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700233/**
234 * © OpenCORD
235 *
236 * Visit http://guide.xosproject.org/devguide/addview/ for more information
237 *
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700238 * Created by teone on 3/24/16.
239 */
240
241(function () {
242 'use strict';
243
244 angular.module('xos.uiComponents')
245
246 /**
247 * @ngdoc directive
248 * @name xos.uiComponents.directive:xosTable
249 * @restrict E
250 * @description The xos-table directive
251 * @param {Object} config The configuration for the component.
252 * ```
253 * {
254 * columns: [
255 * {
256 * label: 'Human readable name',
257 * prop: 'Property to read in the model object',
258 * type: 'boolean'| 'array'| 'object'| 'custom'| 'date' | 'icon' // see examples for more details
259 formatter: fn(), // receive the whole item if tipe is custom and return a string
260 link: fn() // receive the whole item and return an url
261 * }
262 * ],
263 * classes: 'table table-striped table-bordered',
264 * actions: [ // if defined add an action column
265 {
266 label: 'delete',
267 icon: 'remove', // refers to bootstraps glyphicon
268 cb: (user) => { // receive the model
269 console.log(user);
270 },
271 color: 'red'
272 }
273 ],
274 filter: 'field', // can be by `field` or `fulltext`
275 order: true | {field: 'property name', reverse: true | false} // whether to show ordering arrows, or a configuration for a default ordering
276 * }
277 * ```
278 * @param {Array} data The data that should be rendered
279 * @element ANY
280 * @scope
281 * @example
282 # Basic usage
283 <example module="sampleTable1">
284 <file name="index.html">
285 <div ng-controller="SampleCtrl1 as vm">
286 <xos-table data="vm.data" config="vm.config"></xos-table>
287 </div>
288 </file>
289 <file name="script.js">
290 angular.module('sampleTable1', ['xos.uiComponents'])
291 .factory('_', function($window){
292 return $window._;
293 })
294 .controller('SampleCtrl1', function(){
295 this.config = {
296 columns: [
297 {
298 label: 'First Name', // column title
299 prop: 'name' // property to read in the data array
300 },
301 {
302 label: 'Last Name',
303 prop: 'lastname'
304 }
305 ]
306 };
307 this.data = [
308 {
309 name: 'John',
310 lastname: 'Doe'
311 },
312 {
313 name: 'Gili',
314 lastname: 'Fereydoun'
315 }
316 ]
317 });
318 </file>
319 </example>
320 # Filtering
321 <example module="sampleTable2" animations="true">
322 <file name="index.html">
323 <div ng-controller="SampleCtrl2 as vm">
324 <xos-table data="vm.data" config="vm.config"></xos-table>
325 </div>
326 </file>
327 <file name="script.js">
328 angular.module('sampleTable2', ['xos.uiComponents', 'ngAnimate'])
329 .factory('_', function($window){
330 return $window._;
331 })
332 .controller('SampleCtrl2', function(){
333 this.config = {
334 columns: [
335 {
336 label: 'First Name', // column title
337 prop: 'name' // property to read in the data array
338 },
339 {
340 label: 'Last Name',
341 prop: 'lastname'
342 }
343 ],
344 classes: 'table table-striped table-condensed', // table classes, default to `table table-striped table-bordered`
345 actions: [ // if defined add an action column
346 {
347 label: 'delete', // label
348 icon: 'remove', // icons, refers to bootstraps glyphicon
349 cb: (user) => { // callback, get feeded with the full object
350 console.log(user);
351 },
352 color: 'red' // icon color
353 }
354 ],
355 filter: 'field', // can be by `field` or `fulltext`
356 order: true
357 };
358 this.data = [
359 {
360 name: 'John',
361 lastname: 'Doe'
362 },
363 {
364 name: 'Gili',
365 lastname: 'Fereydoun'
366 }
367 ]
368 });
369 </file>
370 </example>
371 # Pagination
372 <example module="sampleTable3">
373 <file name="index.html">
374 <div ng-controller="SampleCtrl3 as vm">
375 <xos-table data="vm.data" config="vm.config"></xos-table>
376 </div>
377 </file>
378 <file name="script.js">
379 angular.module('sampleTable3', ['xos.uiComponents'])
380 .factory('_', function($window){
381 return $window._;
382 })
383 .controller('SampleCtrl3', function(){
384 this.config = {
385 columns: [
386 {
387 label: 'First Name', // column title
388 prop: 'name' // property to read in the data array
389 },
390 {
391 label: 'Last Name',
392 prop: 'lastname'
393 }
394 ],
395 pagination: {
396 pageSize: 2
397 }
398 };
399 this.data = [
400 {
401 name: 'John',
402 lastname: 'Doe'
403 },
404 {
405 name: 'Gili',
406 lastname: 'Fereydoun'
407 },
408 {
409 name: 'Lucky',
410 lastname: 'Clarkson'
411 },
412 {
413 name: 'Tate',
414 lastname: 'Spalding'
415 }
416 ]
417 });
418 </file>
419 </example>
420 # Field formatter
421 <example module="sampleTable4">
422 <file name="index.html">
423 <div ng-controller="SampleCtrl as vm">
424 <xos-table data="vm.data" config="vm.config"></xos-table>
425 </div>
426 </file>
427 <file name="script.js">
428 angular.module('sampleTable4', ['xos.uiComponents'])
429 .factory('_', function($window){
430 return $window._;
431 })
432 .controller('SampleCtrl', function(){
433 this.config = {
434 columns: [
435 {
436 label: 'First Name',
437 prop: 'name',
438 link: item => `https://www.google.it/#q=${item.name}`
439 },
440 {
441 label: 'Enabled',
442 prop: 'enabled',
443 type: 'boolean'
444 },
445 {
446 label: 'Services',
447 prop: 'services',
448 type: 'array'
449 },
450 {
451 label: 'Details',
452 prop: 'details',
453 type: 'object'
454 },
455 {
456 label: 'Created',
457 prop: 'created',
458 type: 'date'
459 },
460 {
461 label: 'Icon',
462 type: 'icon',
463 formatter: item => item.icon //note that this refer to [Bootstrap Glyphicon](http://getbootstrap.com/components/#glyphicons)
464 }
465 ]
466 };
467 this.data = [
468 {
469 name: 'John',
470 enabled: true,
471 services: ['Cdn', 'IpTv'],
472 details: {
473 c_tag: '243',
474 s_tag: '444'
475 },
476 created: new Date('December 17, 1995 03:24:00'),
477 icon: 'music'
478 },
479 {
480 name: 'Gili',
481 enabled: false,
482 services: ['Cdn', 'IpTv', 'Cache'],
483 details: {
484 c_tag: '675',
485 s_tag: '893'
486 },
487 created: new Date(),
488 icon: 'camera'
489 }
490 ]
491 });
492 </file>
493 </example>
494 # Custom formatter
495 <example module="sampleTable5">
496 <file name="index.html">
497 <div ng-controller="SampleCtrl as vm">
498 <xos-table data="vm.data" config="vm.config"></xos-table>
499 </div>
500 </file>
501 <file name="script.js">
502 angular.module('sampleTable5', ['xos.uiComponents'])
503 .factory('_', function($window){
504 return $window._;
505 })
506 .controller('SampleCtrl', function(){
507 this.config = {
508 columns: [
509 {
510 label: 'Username',
511 prop: 'username'
512 },
513 {
514 label: 'Features',
515 type: 'custom',
516 formatter: (val) => {
517
518 let cdnEnabled = val.features.cdn ? 'enabled' : 'disabled';
519 return `
520 Cdn is ${cdnEnabled},
521 uplink speed is ${val.features.uplink_speed}
522 and downlink speed is ${val.features.downlink_speed}
523 `;
524 }
525 }
526 ]
527 };
528 this.data = [
529 {
530 username: 'John',
531 features: {
532 "cdn": false,
533 "uplink_speed": 1000000000,
534 "downlink_speed": 1000000000,
535 "uverse": true,
536 "status": "enabled"
537 }
538 },
539 {
540 username: 'Gili',
541 features: {
542 "cdn": true,
543 "uplink_speed": 3000000000,
544 "downlink_speed": 2000000000,
545 "uverse": true,
546 "status": "enabled"
547 }
548 }
549 ]
550 });
551 </file>
552 </example>
553 **/
554
Arpit Agarwal34b63832016-08-08 11:59:45 -0700555 .component('xosTable', {
556 restrict: 'E',
557 bindings: {
558 data: '=',
559 config: '='
560 },
Matteo Scandoloe57712f2016-09-21 15:27:36 -0700561 template: '\n <div ng-show="vm.data.length > 0 && vm.loader == false">\n <div class="row" ng-if="vm.config.filter == \'fulltext\'">\n <div class="col-xs-12">\n <input\n class="form-control"\n placeholder="Type to search.."\n type="text"\n ng-model="vm.query"/>\n </div>\n </div>\n <table ng-class="vm.classes" ng-hide="vm.data.length == 0">\n <thead>\n <tr>\n <th ng-repeat="col in vm.columns">\n {{col.label}}\n <span ng-if="vm.config.order">\n <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = false">\n <i class="glyphicon glyphicon-chevron-up"></i>\n </a>\n <a href="" ng-click="vm.orderBy = col.prop; vm.reverse = true">\n <i class="glyphicon glyphicon-chevron-down"></i>\n </a>\n </span>\n </th>\n <th ng-if="vm.config.actions">Actions:</th>\n </tr>\n </thead>\n <tbody ng-if="vm.config.filter == \'field\'">\n <tr>\n <td ng-repeat="col in vm.columns">\n <input\n ng-if="col.type !== \'boolean\' && col.type !== \'array\' && col.type !== \'object\' && col.type !== \'custom\'"\n class="form-control"\n placeholder="Type to search by {{col.label}}"\n type="text"\n ng-model="vm.query[col.prop]"/>\n <select\n ng-if="col.type === \'boolean\'"\n class="form-control"\n ng-model="vm.query[col.prop]">\n <option value="">-</option>\n <option value="true">True</option>\n <option value="false">False</option>\n </select>\n </td>\n <td ng-if="vm.config.actions"></td>\n </tr>\n </tbody>\n <tbody>\n <tr ng-repeat="item in vm.data | filter:vm.query:vm.comparator | orderBy:vm.orderBy:vm.reverse | pagination:vm.currentPage * vm.config.pagination.pageSize | limitTo: (vm.config.pagination.pageSize || vm.data.length) track by $index">\n <td ng-repeat="col in vm.columns" xos-link-wrapper>\n <span ng-if="!col.type || col.type === \'text\'">{{item[col.prop]}}</span>\n <span ng-if="col.type === \'boolean\'">\n <i class="glyphicon"\n ng-class="{\'glyphicon-ok\': item[col.prop], \'glyphicon-remove\': !item[col.prop]}">\n </i>\n </span>\n <span ng-if="col.type === \'date\'">\n {{item[col.prop] | date:\'H:mm MMM d, yyyy\'}}\n </span>\n <span ng-if="col.type === \'array\'">\n {{item[col.prop] | arrayToList}}\n </span>\n <span ng-if="col.type === \'object\'">\n <dl class="dl-horizontal">\n <span ng-repeat="(k,v) in item[col.prop]">\n <dt>{{k}}</dt>\n <dd>{{v}}</dd>\n </span>\n </dl>\n </span>\n <span ng-if="col.type === \'custom\'">\n {{col.formatter(item)}}\n </span>\n <span ng-if="col.type === \'icon\'">\n <i class="glyphicon glyphicon-{{col.formatter(item)}}">\n </i>\n </span>\n </td>\n <td ng-if="vm.config.actions">\n <a href=""\n ng-repeat="action in vm.config.actions"\n ng-click="action.cb(item)"\n title="{{action.label}}">\n <i\n class="glyphicon glyphicon-{{action.icon}}"\n style="color: {{action.color}};"></i>\n </a>\n </td>\n </tr>\n </tbody>\n </table>\n <xos-pagination\n ng-if="vm.config.pagination"\n page-size="vm.config.pagination.pageSize"\n total-elements="vm.data.length"\n change="vm.goToPage">\n </xos-pagination>\n </div>\n <div ng-show="(vm.data.length == 0 || !vm.data) && vm.loader == false">\n <xos-alert config="{type: \'info\'}">\n No data to show.\n </xos-alert>\n </div>\n <div ng-show="vm.loader == true">\n <div class="loader"></div>\n </div>\n ',
Arpit Agarwal34b63832016-08-08 11:59:45 -0700562 bindToController: true,
563 controllerAs: 'vm',
564 controller: ["_", "$scope", "Comparator", function controller(_, $scope, Comparator) {
565 var _this = this;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700566
Arpit Agarwal34b63832016-08-08 11:59:45 -0700567 this.comparator = Comparator;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700568
Arpit Agarwal34b63832016-08-08 11:59:45 -0700569 this.loader = true;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700570
Arpit Agarwal34b63832016-08-08 11:59:45 -0700571 $scope.$watch(function () {
572 return _this.data;
573 }, function (data) {
574 if (angular.isDefined(data)) {
575 _this.loader = false;
576 }
577 });
578
579 if (!this.config) {
580 throw new Error('[xosTable] Please provide a configuration via the "config" attribute');
581 }
582
583 if (!this.config.columns) {
584 throw new Error('[xosTable] Please provide a columns list in the configuration');
585 }
586
587 // handle default ordering
588 if (this.config.order && angular.isObject(this.config.order)) {
589 this.reverse = this.config.order.reverse || false;
590 this.orderBy = this.config.order.field || 'id';
591 }
592
593 // if columns with type 'custom' are provided
594 // check that a custom formatte3 is provided too
595 var customCols = _.filter(this.config.columns, { type: 'custom' });
596 if (angular.isArray(customCols) && customCols.length > 0) {
597 _.forEach(customCols, function (col) {
598 if (!col.formatter || !angular.isFunction(col.formatter)) {
599 throw new Error('[xosTable] You have provided a custom field type, a formatter function should provided too.');
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700600 }
601 });
Arpit Agarwal34b63832016-08-08 11:59:45 -0700602 }
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700603
Arpit Agarwal34b63832016-08-08 11:59:45 -0700604 // if columns with type 'icon' are provided
605 // check that a custom formatte3 is provided too
606 var iconCols = _.filter(this.config.columns, { type: 'icon' });
607 if (angular.isArray(iconCols) && iconCols.length > 0) {
608 _.forEach(iconCols, function (col) {
609 if (!col.formatter || !angular.isFunction(col.formatter)) {
610 throw new Error('[xosTable] You have provided an icon field type, a formatter function should provided too.');
611 }
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700612 });
Arpit Agarwal34b63832016-08-08 11:59:45 -0700613 }
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700614
Arpit Agarwal34b63832016-08-08 11:59:45 -0700615 // if a link property is passed,
616 // it should be a function
617 var linkedColumns = _.filter(this.config.columns, function (col) {
618 return angular.isDefined(col.link);
619 });
620 if (angular.isArray(linkedColumns) && linkedColumns.length > 0) {
621 _.forEach(linkedColumns, function (col) {
622 if (!angular.isFunction(col.link)) {
623 throw new Error('[xosTable] The link property should be a function.');
624 }
625 });
626 }
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700627
Arpit Agarwal34b63832016-08-08 11:59:45 -0700628 this.columns = this.config.columns;
629 this.classes = this.config.classes || 'table table-striped table-bordered';
630
631 if (this.config.actions) {
632 // TODO validate action format
633 }
634 if (this.config.pagination) {
635 this.currentPage = 0;
636 this.goToPage = function (n) {
637 _this.currentPage = n;
638 };
639 }
640 }]
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700641 })
642 // TODO move in separate files
643 // TODO test
644 .filter('arrayToList', function () {
645 return function (input) {
646 if (!angular.isArray(input)) {
647 return input;
648 }
649 return input.join(', ');
650 };
651 })
652 // TODO test
653 .directive('xosLinkWrapper', function () {
654 return {
655 restrict: 'A',
656 transclude: true,
657 template: '\n <a ng-if="col.link" href="{{col.link(item)}}">\n <div ng-transclude></div>\n </a>\n <div ng-transclude ng-if="!col.link"></div>\n '
658 };
659 });
660})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -0700661//# sourceMappingURL=../../../maps/ui_components/dumbComponents/table/table.component.js.map
662
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700663'use strict';
664
665/**
666 * © OpenCORD
667 *
668 * Visit http://guide.xosproject.org/devguide/addview/ for more information
669 *
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700670 * Created by teone on 4/18/16.
671 */
672
673(function () {
674 'use strict';
675
676 angular.module('xos.uiComponents')
677
678 /**
679 * @ngdoc directive
680 * @name xos.uiComponents.directive:xosForm
681 * @restrict E
682 * @description The xos-form directive.
683 * This components have two usage, given a model it is able to autogenerate a form or it can be configured to create a custom form.
684 * @param {Object} config The configuration object
685 * ```
686 * {
687 * exclude: ['id', 'validators', 'created', 'updated', 'deleted'], //field to be skipped in the form, the provide values are concatenated
688 * actions: [ // define the form buttons with related callback
689 * {
690 label: 'save',
691 icon: 'ok', // refers to bootstraps glyphicon
692 cb: (user) => { // receive the model
693 console.log(user);
694 },
695 class: 'success'
696 }
697 * ],
698 * feedback: {
699 show: false,
700 message: 'Form submitted successfully !!!',
701 type: 'success' //refers to bootstrap class
702 },
703 * fields: {
704 * field_name: {
705 * label: 'Field Label',
706 * type: 'string' // options are: [date, boolean, number, email, string, select],
707 * validators: {
708 * minlength: number,
709 maxlength: number,
710 required: boolean,
711 min: number,
712 max: number,
713 custom: (value) => {
714 // do your validation here and return true | false
715 // alternatively you can return an array [errorName, true|false]
716 }
717 * }
718 * }
719 * }
720 * }
721 * ```
722 * @element ANY
723 * @scope
724 * @requires xos.uiComponents.directive:xosField
725 * @requires xos.uiComponents.XosFormHelpers
726 * @requires xos.helpers._
727 * @example
728
729 Autogenerated form
730 <example module="sampleForm">
731 <file name="script.js">
732 angular.module('sampleForm', ['xos.uiComponents'])
733 .factory('_', function($window){
734 return $window._;
735 })
736 .controller('SampleCtrl', function(){
737 this.model = {
738 first_name: 'Jhon',
739 last_name: 'Doe',
740 email: 'jhon.doe@sample.com',
741 active: true,
742 birthDate: '2015-02-17T22:06:38.059000Z'
743 }
744 this.config = {
745 exclude: ['password', 'last_login'],
746 formName: 'sampleForm',
747 actions: [
748 {
749 label: 'Save',
750 icon: 'ok', // refers to bootstraps glyphicon
751 cb: (user) => { // receive the model
752 console.log(user);
753 },
754 class: 'success'
755 }
756 ]
757 };
758 });
759 </file>
760 <file name="index.html">
761 <div ng-controller="SampleCtrl as vm">
762 <xos-form ng-model="vm.model" config="vm.config"></xos-form>
763 </div>
764 </file>
765 </example>
766 Configuration defined form
767 <example module="sampleForm1">
768 <file name="script.js">
769 angular.module('sampleForm1', ['xos.uiComponents','ngResource', 'ngMockE2E'])
770 .factory('_', function($window){
771 return $window._;
772 })
773 .controller('SampleCtrl1', function(SampleResource){
774 this.model = {
775 };
776 this.config = {
777 exclude: ['password', 'last_login'],
778 formName: 'sampleForm1',
779 feedback: {
780 show: false,
781 message: 'Form submitted successfully !!!',
782 type: 'success'
783 },
784 actions: [
785 {
786 label: 'Save',
787 icon: 'ok', // refers to bootstraps glyphicon
788 cb: (user) => { // receive the model
789 console.log(user);
790 this.config.feedback.show = true;
791 this.config.feedback.type='success';
792 },
793 class: 'success'
794 }
795 ],
796 fields: {
797 first_name: {
798 type: 'string',
799 validators: {
800 required: true
801 }
802 },
803 last_name: {
804 label: 'Surname',
805 type: 'string',
806 validators: {
807 required: true,
808 minlength: 10
809 }
810 },
811 age: {
812 type: 'number',
813 validators: {
814 required: true,
815 min: 21
816 }
817 },
818 site: {
819 label: 'Site',
820 type: 'select',
821 validators: { required: true},
822 hint: 'The Site this Slice belongs to',
823 options: []
824 },
825 }
826 };
827 SampleResource.query().$promise
828 .then((users) => {
829 //this.users_site = users;
830 //console.log(users);
831 this.optionVal = users;
832 this.config.fields['site'].options = this.optionVal;
833 //= this.optionVal;
834 })
835 .catch((e) => {
836 throw new Error(e);
837 });
838 });
839 </file>
840 <file name="backend.js">
841 angular.module('sampleForm1')
842 .run(function($httpBackend, _){
843 let datas = [{id: 1, label: 'site1'},{id: 4, label: 'site4'},{id: 3, label: 'site3'}];
844 let paramsUrl = new RegExp(/\/test\/(.+)/);
845 $httpBackend.whenGET('/test').respond(200, datas)
846 })
847 .service('SampleResource', function($resource){
848 return $resource('/test/:id', {id: '@id'});
849 });
850 </file>
851 <file name="index.html">
852 <div ng-controller="SampleCtrl1 as vm">
853 <xos-form ng-model="vm.model" config="vm.config"></xos-form>
854 </div>
855 </file>
856 </example>
857 **/
858
Arpit Agarwal34b63832016-08-08 11:59:45 -0700859 .component('xosForm', {
860 restrict: 'E',
861 bindings: {
862 config: '=',
863 ngModel: '='
864 },
865 template: '\n <form name="vm.{{vm.config.formName || \'form\'}}" novalidate>\n <div class="form-group" ng-repeat="(name, field) in vm.formField">\n <xos-field name="name" field="field" ng-model="vm.ngModel[name]"></xos-field>\n <xos-validation field="vm[vm.config.formName || \'form\'][name]" form = "vm[vm.config.formName || \'form\']"></xos-validation>\n <div class="alert alert-info" ng-show="(field.hint).length >0" role="alert">{{field.hint}}</div>\n </div>\n <div class="form-group" ng-if="vm.config.actions">\n <xos-alert config="vm.config.feedback" show="vm.config.feedback.show">{{vm.config.feedback.message}}</xos-alert>\n\n <button role="button" href=""\n ng-repeat="action in vm.config.actions"\n ng-click="action.cb(vm.ngModel, vm[vm.config.formName || \'form\'])"\n class="btn btn-{{action.class}}"\n title="{{action.label}}">\n <i class="glyphicon glyphicon-{{action.icon}}"></i>\n {{action.label}}\n </button>\n </div>\n </form>\n ',
866 bindToController: true,
867 controllerAs: 'vm',
868 controller: ["$scope", "$log", "_", "XosFormHelpers", function controller($scope, $log, _, XosFormHelpers) {
869 var _this = this;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700870
Arpit Agarwal34b63832016-08-08 11:59:45 -0700871 if (!this.config) {
872 throw new Error('[xosForm] Please provide a configuration via the "config" attribute');
873 }
874
875 if (!this.config.actions) {
876 throw new Error('[xosForm] Please provide an action list in the configuration');
877 }
878
879 if (!this.config.feedback) {
880 this.config.feedback = {
881 show: false,
882 message: 'Form submitted successfully !!!',
883 type: 'success'
884 };
885 }
886
887 this.excludedField = ['id', 'validators', 'created', 'updated', 'deleted', 'backend_status'];
888 if (this.config && this.config.exclude) {
889 this.excludedField = this.excludedField.concat(this.config.exclude);
890 }
891
892 this.formField = [];
893
894 $scope.$watch(function () {
895 return _this.config;
896 }, function () {
897 if (!_this.ngModel) {
898 return;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700899 }
Arpit Agarwal34b63832016-08-08 11:59:45 -0700900 var diff = _.difference(Object.keys(_this.ngModel), _this.excludedField);
901 var modelField = XosFormHelpers.parseModelField(diff);
902 _this.formField = XosFormHelpers.buildFormStructure(modelField, _this.config.fields, _this.ngModel);
903 }, true);
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700904
Arpit Agarwal34b63832016-08-08 11:59:45 -0700905 $scope.$watch(function () {
906 return _this.ngModel;
907 }, function (model) {
908 // empty from old stuff
909 _this.formField = {};
910 if (!model) {
911 return;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700912 }
Arpit Agarwal34b63832016-08-08 11:59:45 -0700913 var diff = _.difference(Object.keys(model), _this.excludedField);
914 var modelField = XosFormHelpers.parseModelField(diff);
915 _this.formField = XosFormHelpers.buildFormStructure(modelField, _this.config.fields, model);
916 });
917 }]
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700918 });
919})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -0700920//# sourceMappingURL=../../../maps/ui_components/dumbComponents/form/form.component.js.map
921
922'use strict';
923
924/**
925 * © OpenCORD
926 *
927 * Visit http://guide.xosproject.org/devguide/addview/ for more information
928 *
929 * Created by teone on 4/15/16.
930 */
931
932(function () {
933 'use strict';
934
935 angular.module('xos.uiComponents')
936
937 /**
938 * @ngdoc directive
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -0700939 * @name xos.uiComponents.directive:xosAlert
940 * @restrict E
941 * @description The xos-alert directive
942 * @param {Object} config The configuration object
943 * ```
944 * {
945 * type: 'danger', //info, success, warning
946 * closeBtn: true, //default false
947 * autoHide: 3000 //delay to automatically hide the alert
948 * }
949 * ```
950 * @param {Boolean=} show Binding to show and hide the alert, default to true
951 * @element ANY
952 * @scope
953 * @example
954 <example module="sampleAlert1">
955 <file name="index.html">
956 <div ng-controller="SampleCtrl1 as vm">
957 <xos-alert config="vm.config1">
958 A sample alert message
959 </xos-alert>
960 <xos-alert config="vm.config2">
961 A sample alert message (with close button)
962 </xos-alert>
963 <xos-alert config="vm.config3">
964 A sample info message
965 </xos-alert>
966 <xos-alert config="vm.config4">
967 A sample success message
968 </xos-alert>
969 <xos-alert config="vm.config5">
970 A sample warning message
971 </xos-alert>
972 </div>
973 </file>
974 <file name="script.js">
975 angular.module('sampleAlert1', ['xos.uiComponents'])
976 .controller('SampleCtrl1', function(){
977 this.config1 = {
978 type: 'danger'
979 };
980 this.config2 = {
981 type: 'danger',
982 closeBtn: true
983 };
984 this.config3 = {
985 type: 'info'
986 };
987 this.config4 = {
988 type: 'success'
989 };
990 this.config5 = {
991 type: 'warning'
992 };
993 });
994 </file>
995 </example>
996 <example module="sampleAlert2" animations="true">
997 <file name="index.html">
998 <div ng-controller="SampleCtrl as vm" class="row">
999 <div class="col-sm-4">
1000 <a class="btn btn-default btn-block" ng-show="!vm.show" ng-click="vm.show = true">Show Alert</a>
1001 <a class="btn btn-default btn-block" ng-show="vm.show" ng-click="vm.show = false">Hide Alert</a>
1002 </div>
1003 <div class="col-sm-8">
1004 <xos-alert config="vm.config1" show="vm.show">
1005 A sample alert message, not displayed by default.
1006 </xos-alert>
1007 </div>
1008 </div>
1009 </file>
1010 <file name="script.js">
1011 angular.module('sampleAlert2', ['xos.uiComponents', 'ngAnimate'])
1012 .controller('SampleCtrl', function(){
1013 this.config1 = {
1014 type: 'success'
1015 };
1016 this.show = false;
1017 });
1018 </file>
1019 </example>
1020 **/
1021
Arpit Agarwal34b63832016-08-08 11:59:45 -07001022 .component('xosAlert', {
1023 restrict: 'E',
1024 bindings: {
1025 config: '=',
1026 show: '=?'
1027 },
1028 template: '\n <div ng-cloak class="alert alert-{{vm.config.type}}" ng-hide="!vm.show">\n <button type="button" class="close" ng-if="vm.config.closeBtn" ng-click="vm.dismiss()">\n <span aria-hidden="true">&times;</span>\n </button>\n <p ng-transclude></p>\n </div>\n ',
1029 transclude: true,
1030 bindToController: true,
1031 controllerAs: 'vm',
1032 controller: ["$timeout", function controller($timeout) {
1033 var _this = this;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001034
Arpit Agarwal34b63832016-08-08 11:59:45 -07001035 if (!this.config) {
1036 throw new Error('[xosAlert] Please provide a configuration via the "config" attribute');
1037 }
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001038
Arpit Agarwal34b63832016-08-08 11:59:45 -07001039 // default the value to true
1040 this.show = this.show !== false;
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001041
Arpit Agarwal34b63832016-08-08 11:59:45 -07001042 this.dismiss = function () {
1043 _this.show = false;
1044 };
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001045
Arpit Agarwal34b63832016-08-08 11:59:45 -07001046 if (this.config.autoHide) {
1047 (function () {
1048 var to = $timeout(function () {
1049 _this.dismiss();
1050 $timeout.cancel(to);
1051 }, _this.config.autoHide);
1052 })();
1053 }
1054 }]
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001055 });
1056})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07001057//# sourceMappingURL=../../../maps/ui_components/dumbComponents/alert/alert.component.js.map
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001058
Arpit Agarwal43978742016-08-09 15:38:25 -07001059'use strict';
1060
Matteo Scandolo65116c42016-09-21 17:06:23 -07001061function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
1062
1063/**
1064 * © OpenCORD
1065 *
1066 * Visit http://guide.xosproject.org/devguide/addview/ for more information
1067 *
1068 * Created by teone on 5/25/16.
1069 */
1070
1071(function () {
1072 'use strict';
1073
1074 angular.module('xos.uiComponents')
1075 /**
1076 * @ngdoc directive
1077 * @name xos.uiComponents.directive:xosField
1078 * @restrict E
1079 * @description The xos-field directive.
1080 * This component decide, give a field wich kind of input it need to print.
1081 * @param {string} name The field name
1082 * @param {object} field The field configuration:
1083 * ```
1084 * {
1085 * label: 'Label',
1086 * type: 'number', //typeof field
1087 * validators: {} // see xosForm for more details
1088 * }
1089 * ```
1090 * @param {mixed} ngModel The field value
1091 *
1092 * @example
1093
1094 # Basic Example
1095
1096 <example module="sampleField1">
1097 <file name="script.js">
1098 angular.module('sampleField1', ['xos.uiComponents'])
1099 .factory('_', function($window){
1100 return $window._;
1101 })
1102 .controller('SampleCtrl', function(){
1103 this.name = 'input-name';
1104 this.field = {label: 'My String Value:', type: 'string'};
1105 this.model = 'my string';
1106 });
1107 </file>
1108 <file name="index.html">
1109 <div ng-controller="SampleCtrl as vm">
1110 <xos-field ng-model="vm.model" name="vm.name" field="vm.field"></xos-field>
1111 </div>
1112 </file>
1113 </example>
1114
1115 # Possible Values
1116 <example module="sampleField2">
1117 <file name="script.js">
1118 angular.module('sampleField2', ['xos.uiComponents'])
1119 .factory('_', function($window){
1120 return $window._;
1121 })
1122 .controller('SampleCtrl', function(){
1123 this.field1 = {
1124 name: 'number-field',
1125 field: {label: 'My Number Value:', type: 'number'},
1126 model: 2
1127 };
1128 this.field2 = {
1129 name: 'date-field',
1130 field: {label: 'My Date Value:', type: 'date'},
1131 model: new Date()
1132 };
1133 this.field3 = {
1134 name: 'boolean-field',
1135 field: {label: 'My Boolean Value:', type: 'boolean'},
1136 model: true
1137 };
1138 this.field4 = {
1139 name: 'email-field',
1140 field: {label: 'My Email Value:', type: 'email'},
1141 model: 'sample@domain.us'
1142 };
1143 this.field5 = {
1144 name: 'select',
1145 label: 'Select field:',
1146 type: 'select',
1147 model: 1,
1148 options: [
1149 {id: 1, label: 'One'},
1150 {id: 2, label: 'Two'},
1151 {id: 3, label: 'Three'},
1152 ]
1153 };
1154 });
1155 </file>
1156 <file name="index.html">
1157 <div ng-controller="SampleCtrl as vm">
1158 <xos-field ng-model="vm.field1.model" name="vm.field1.name" field="vm.field1.field"></xos-field>
1159 <xos-field ng-model="vm.field2.model" name="vm.field2.name" field="vm.field2.field"></xos-field>
1160 <xos-field ng-model="vm.field3.model" name="vm.field3.name" field="vm.field3.field"></xos-field>
1161 <xos-field ng-model="vm.field4.model" name="vm.field4.name" field="vm.field4.field"></xos-field>
1162 <xos-field ng-model="vm.field5.model" name="vm.field5.name" field="vm.field5.field"></xos-field>
1163 </div>
1164 </file>
1165 </example>
1166 # This element is recursive
1167 <example module="sampleField3">
1168 <file name="script.js">
1169 angular.module('sampleField3', ['xos.uiComponents'])
1170 .factory('_', function($window){
1171 return $window._;
1172 })
1173 .controller('SampleCtrl', function(){
1174 this.name1 = 'input-name';
1175 this.field1 = {label: 'My Object Field:', type: 'object'};
1176 this.model1 = {
1177 name: 'Jhon',
1178 age: '25',
1179 email: 'jhon@thewall.ru',
1180 active: true
1181 };
1182 this.name2 = 'another-name';
1183 this.field2 = {
1184 label: 'Empty Object Field',
1185 type: 'object',
1186 properties: {
1187 foo: {
1188 label: 'FooLabel:',
1189 type: 'string',
1190 validators: {
1191 required: true
1192 }
1193 },
1194 bar: {
1195 type: 'number'
1196 }
1197 }
1198 }
1199 });
1200 </file>
1201 <file name="index.html">
1202 <div ng-controller="SampleCtrl as vm">
1203 <h4>Autogenerated object field</h4>
1204 <xos-field ng-model="vm.model1" name="vm.name1" field="vm.field1"></xos-field>
1205 <h4>Configured object field</h4>
1206 <xos-field ng-model="vm.model2" name="vm.name2" field="vm.field2"></xos-field>
1207 </div>
1208 </file>
1209 </example>
1210 */
1211 .component('xosField', {
1212 restrict: 'E',
1213 bindings: {
1214 name: '=',
1215 field: '=',
1216 ngModel: '='
1217 },
1218 template: '\n <label ng-if="vm.field.type !== \'object\' && vm.field.type !== \'array\'">{{vm.field.label}}</label>\n <input\n xos-custom-validator custom-validator="vm.field.validators.custom || null"\n ng-if="vm.field.type !== \'boolean\' && vm.field.type !== \'object\' && vm.field.type !== \'select\' && vm.field.type !== \'array\'"\n type="{{vm.field.type}}"\n name="{{vm.name}}"\n class="form-control"\n ng-model="vm.ngModel"\n ng-minlength="vm.field.validators.minlength || 0"\n ng-maxlength="vm.field.validators.maxlength || 2000"\n ng-required="vm.field.validators.required || false" />\n <select class="form-control" ng-if ="vm.field.type === \'select\'"\n name = "{{vm.name}}"\n ng-options="item.id as item.label for item in vm.field.options"\n ng-model="vm.ngModel"\n ng-required="vm.field.validators.required || false">\n </select>\n <span class="boolean-field" ng-if="vm.field.type === \'boolean\'">\n <a href="#"\n class="btn btn-success"\n ng-show="vm.ngModel"\n ng-click="vm.ngModel = false">\n <i class="glyphicon glyphicon-ok"></i>\n </a>\n <a href="#"\n class="btn btn-danger"\n ng-show="!vm.ngModel"\n ng-click="vm.ngModel = true">\n <i class="glyphicon glyphicon-remove"></i>\n </a>\n </span>\n <div\n class="panel panel-default object-field"\n ng-if="vm.field.type == \'object\' && (!vm.isEmptyObject(vm.ngModel) || !vm.isEmptyObject(vm.field.properties))"\n >\n <div class="panel-heading">{{vm.field.label}}</div>\n <div class="panel-body">\n <div ng-if="!vm.field.properties" ng-repeat="(k, v) in vm.ngModel">\n <xos-field\n name="k"\n field="{label: vm.formatLabel(k), type: vm.getType(v)}"\n ng-model="v">\n </xos-field>\n </div>\n <div ng-if="vm.field.properties" ng-repeat="(k, v) in vm.field.properties">\n <xos-field\n name="k"\n field="{\n label: v.label || vm.formatLabel(k),\n type: v.type,\n validators: v.validators\n }"\n ng-model="vm.ngModel[k]">\n </xos-field>\n </div>\n </div>\n </div>\n <div\n class="panel panel-default array-field"\n ng-if="vm.field.type == \'array\'">\n <div class="panel-heading">{{vm.field.label}}</div>\n <div class="panel-body selected">\n <ul class="draggable" dnd-list="vm.ngModel">\n <li\n class="array-element"\n ng-repeat="item in vm.ngModel"\n dnd-draggable="item"\n dnd-moved="vm.ngModel.splice($index, 1)"\n dnd-effect-allowed="move"\n dnd-selected="models.selected = item"\n >\n <div class="well well-sm text-center">\n {{item}}\n </div>\n </li>\n <div class="clearfix"></div>\n </ul>\n </div>\n <div class="panel-body unselected">\n <ul class="draggable" dnd-list="vm.field.availableOptions">\n <li\n class="array-element"\n ng-repeat="item in vm.field.availableOptions"\n dnd-draggable="item"\n dnd-moved="vm.field.availableOptions.splice($index, 1)"\n dnd-effect-allowed="move"\n dnd-selected="models.selected = item"\n >\n <div class="well well-sm text-center">\n {{item}}\n </div>\n </li>\n <div class="clearfix"></div>\n </ul>\n </div>\n </div>\n ',
1219 bindToController: true,
1220 controllerAs: 'vm',
1221 controller: ["$attrs", "$scope", "XosFormHelpers", "LabelFormatter", "_", function controller($attrs, $scope, XosFormHelpers, LabelFormatter, _) {
1222 var _this = this;
1223
1224 if (!this.name) {
1225 throw new Error('[xosField] Please provide a field name');
1226 }
1227 if (!this.field) {
1228 throw new Error('[xosField] Please provide a field definition');
1229 }
1230 if (!this.field.type) {
1231 throw new Error('[xosField] Please provide a type in the field definition');
1232 }
1233 if (!$attrs.ngModel) {
1234 throw new Error('[xosField] Please provide an ng-model');
1235 }
1236 this.getType = XosFormHelpers._getFieldFormat;
1237 this.formatLabel = LabelFormatter.format;
1238
1239 this.isEmptyObject = function (o) {
1240 return o ? Object.keys(o).length === 0 : true;
1241 };
1242
1243 if (this.field.type === 'array') {
1244 $scope.$watch(function () {
1245 return _this.ngModel.length;
1246 }, function () {
1247 _this.field.availableOptions = _.difference(_this.field.options, _this.ngModel);
1248 });
1249 }
1250 }]
1251 })
1252
1253 /**
1254 * @ngdoc directive
1255 * @name xos.uiComponents.directive:xosCustomValidator
1256 * @restrict A
1257 * @description The xosCustomValidator directive.
1258 * This component apply a custom validation function
1259 * @param {function} customValidator The function that execute the validation.
1260 *
1261 * You should do your validation here and return true | false,
1262 * or alternatively you can return an array [errorName, true|false]
1263 */
1264 .directive('xosCustomValidator', function () {
1265 return {
1266 restrict: 'A',
1267 scope: {
1268 fn: '=customValidator'
1269 },
1270 require: 'ngModel',
1271 link: function link(scope, element, attr, ctrl) {
1272 if (!angular.isFunction(scope.fn)) {
1273 return;
1274 }
1275
1276 function customValidatorWrapper(ngModelValue) {
1277 var valid = scope.fn(ngModelValue);
1278 if (angular.isArray(valid)) {
1279 // ES6 spread rocks over fn.apply()
1280 ctrl.$setValidity.apply(ctrl, _toConsumableArray(valid));
1281 } else {
1282 ctrl.$setValidity('custom', valid);
1283 }
1284 return ngModelValue;
1285 }
1286
1287 ctrl.$parsers.push(customValidatorWrapper);
1288 }
1289 };
1290 });
1291})();
1292//# sourceMappingURL=../../../maps/ui_components/dumbComponents/field/field.component.js.map
1293
1294'use strict';
1295
1296/**
1297 * © OpenCORD
1298 *
1299 * Visit http://guide.xosproject.org/devguide/addview/ for more information
1300 *
1301 * Created by teone on 3/24/16.
1302 */
1303
1304(function () {
1305 'use strict';
1306
1307 angular.module('xos.uiComponents')
1308
1309 /**
1310 * @ngdoc directive
1311 * @name xos.uiComponents.directive:xosSmartTable
1312 * @link xos.uiComponents.directive:xosTable xosTable
1313 * @link xos.uiComponents.directive:xosForm xosForm
1314 * @restrict E
1315 * @description The xos-table directive
1316 * @param {Object} config The configuration for the component,
1317 * it is composed by the name of an angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource)
1318 * and an array of fields that shouldn't be printed.
1319 * ```
1320 * {
1321 resource: 'Users',
1322 hiddenFields: []
1323 }
1324 * ```
1325 * @scope
1326 * @example
1327 <example module="sampleSmartTable">
1328 <file name="index.html">
1329 <div ng-controller="SampleCtrl as vm">
1330 <xos-smart-table config="vm.config"></xos-smart-table>
1331 </div>
1332 </file>
1333 <file name="script.js">
1334 angular.module('sampleSmartTable', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
1335 // This is only for documentation purpose
1336 .run(function($httpBackend, _){
1337 let datas = [{id: 1, name: 'Jhon', surname: 'Doe'}];
1338 let count = 1;
1339 let paramsUrl = new RegExp(/\/test\/(.+)/);
1340 $httpBackend.whenDELETE(paramsUrl, undefined, ['id']).respond((method, url, data, headers, params) => {
1341 data = angular.fromJson(data);
1342 let id = url.match(paramsUrl)[1];
1343 _.remove(datas, (d) => {
1344 return d.id === parseInt(id);
1345 })
1346 return [204];
1347 });
1348 $httpBackend.whenGET('/test').respond(200, datas)
1349 $httpBackend.whenPOST('/test').respond((method, url, data) => {
1350 data = angular.fromJson(data);
1351 data.id = ++count;
1352 datas.push(data);
1353 return [201, data, {}];
1354 });
1355 })
1356 .factory('_', function($window){
1357 return $window._;
1358 })
1359 .service('SampleResource', function($resource){
1360 return $resource('/test/:id', {id: '@id'});
1361 })
1362 // End of documentation purpose, example start
1363 .controller('SampleCtrl', function(){
1364 this.config = {
1365 resource: 'SampleResource'
1366 };
1367 });
1368 </file>
1369 </example>
1370 */
1371
1372 .component('xosSmartTable', {
1373 restrict: 'E',
1374 bindings: {
1375 config: '='
1376 },
1377 template: '\n <div class="row" ng-show="vm.data.length > 0">\n <div class="col-xs-12 text-right">\n <a href="" class="btn btn-success" ng-click="vm.createItem()">\n Add\n </a>\n </div>\n </div>\n <div class="row">\n <div class="col-xs-12 table-responsive">\n <xos-table config="vm.tableConfig" data="vm.data"></xos-table>\n </div>\n </div>\n <div class="panel panel-default" ng-show="vm.detailedItem">\n <div class="panel-heading">\n <div class="row">\n <div class="col-xs-11">\n <h3 class="panel-title" ng-show="vm.detailedItem.id">Update {{vm.config.resource}} {{vm.detailedItem.id}}</h3>\n <h3 class="panel-title" ng-show="!vm.detailedItem.id">Create {{vm.config.resource}} item</h3>\n </div>\n <div class="col-xs-1">\n <a href="" ng-click="vm.cleanForm()">\n <i class="glyphicon glyphicon-remove pull-right"></i>\n </a>\n </div>\n </div>\n </div>\n <div class="panel-body">\n <xos-form config="vm.formConfig" ng-model="vm.detailedItem"></xos-form>\n </div>\n </div>\n <xos-alert config="{type: \'success\', closeBtn: true}" show="vm.responseMsg">{{vm.responseMsg}}</xos-alert>\n <xos-alert config="{type: \'danger\', closeBtn: true}" show="vm.responseErr">{{vm.responseErr}}</xos-alert>\n ',
1378 bindToController: true,
1379 controllerAs: 'vm',
1380 controller: ["$injector", "LabelFormatter", "_", "XosFormHelpers", function controller($injector, LabelFormatter, _, XosFormHelpers) {
1381 var _this = this;
1382
1383 // TODO
1384 // - Validate the config (what if resource does not exist?)
1385
1386 // NOTE
1387 // Corner case
1388 // - if response is empty, how can we generate a form ?
1389
1390 this.responseMsg = false;
1391 this.responseErr = false;
1392
1393 this.tableConfig = {
1394 columns: [],
1395 actions: [{
1396 label: 'delete',
1397 icon: 'remove',
1398 cb: function cb(item) {
1399 _this.Resource.delete({ id: item.id }).$promise.then(function () {
1400 _.remove(_this.data, function (d) {
1401 return d.id === item.id;
1402 });
1403 _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully deleted';
1404 }).catch(function (err) {
1405 _this.responseErr = err.data.detail || 'Error while deleting ' + _this.config.resource + ' with id ' + item.id;
1406 });
1407 },
1408 color: 'red'
1409 }, {
1410 label: 'details',
1411 icon: 'search',
1412 cb: function cb(item) {
1413 _this.detailedItem = item;
1414 }
1415 }],
1416 classes: 'table table-striped table-bordered table-responsive',
1417 filter: 'field',
1418 order: true,
1419 pagination: {
1420 pageSize: 10
1421 }
1422 };
1423
1424 this.formConfig = {
1425 exclude: this.config.hiddenFields,
1426 fields: {},
1427 formName: this.config.resource + 'Form',
1428 actions: [{
1429 label: 'Save',
1430 icon: 'ok',
1431 cb: function cb(item) {
1432 var p = void 0;
1433 var isNew = true;
1434
1435 if (item.id) {
1436 p = item.$update();
1437 isNew = false;
1438 } else {
1439 p = item.$save();
1440 }
1441
1442 p.then(function (res) {
1443 if (isNew) {
1444 _this.data.push(angular.copy(res));
1445 }
1446 delete _this.detailedItem;
1447 _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully saved';
1448 }).catch(function (err) {
1449 _this.responseErr = err.data.detail || 'Error while saving ' + _this.config.resource + ' with id ' + item.id;
1450 });
1451 },
1452 class: 'success'
1453 }]
1454 };
1455
1456 this.cleanForm = function () {
1457 delete _this.detailedItem;
1458 };
1459
1460 this.createItem = function () {
1461 _this.detailedItem = new _this.Resource();
1462 };
1463
1464 this.Resource = $injector.get(this.config.resource);
1465
1466 var getData = function getData() {
1467 _this.Resource.query().$promise.then(function (res) {
1468
1469 if (!res[0]) {
1470 _this.data = res;
1471 return;
1472 }
1473
1474 var item = res[0];
1475 var props = Object.keys(item);
1476
1477 _.remove(props, function (p) {
1478 return p === 'id' || p === 'validators';
1479 });
1480
1481 // TODO move out cb, non sense triggering a lot of times
1482 if (angular.isArray(_this.config.hiddenFields)) {
1483 props = _.difference(props, _this.config.hiddenFields);
1484 }
1485
1486 props.forEach(function (p) {
1487 var fieldConfig = {
1488 label: LabelFormatter.format(p),
1489 prop: p
1490 };
1491
1492 fieldConfig.type = XosFormHelpers._getFieldFormat(item[p]);
1493
1494 _this.tableConfig.columns.push(fieldConfig);
1495 });
1496
1497 // build form structure
1498 // TODO move in a pure function for testing purposes
1499 props.forEach(function (p, i) {
1500 _this.formConfig.fields[p] = {
1501 label: LabelFormatter.format(p).replace(':', ''),
1502 type: XosFormHelpers._getFieldFormat(item[p])
1503 };
1504 });
1505 _this.data = res;
1506 });
1507 };
1508
1509 getData();
1510 }]
1511 });
1512})();
1513//# sourceMappingURL=../../../maps/ui_components/smartComponents/smartTable/smartTable.component.js.map
1514
1515'use strict';
1516
1517/**
1518 * © OpenCORD
1519 *
1520 * Visit http://guide.xosproject.org/devguide/addview/ for more information
1521 *
1522 * Created by teone on 3/24/16.
1523 */
1524
1525(function () {
1526 'use strict';
1527
1528 angular.module('xos.uiComponents')
1529 /**
1530 * @ngdoc directive
1531 * @name xos.uiComponents.directive:xosSmartPie
1532 * @restrict E
1533 * @description The xos-table directive
1534 * @param {Object} config The configuration for the component,
1535 * it is composed by the name of an angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource)
1536 * and a field name that is used to group the data.
1537 * ```
1538 * {
1539 resource: 'Users',
1540 groupBy: 'fieldName',
1541 classes: 'my-custom-class',
1542 labelFormatter: (labels) => {
1543 // here you can format your label,
1544 // you should return an array with the same order
1545 return labels;
1546 }
1547 }
1548 * ```
1549 * @scope
1550 * @example
1551
1552 Displaying Local data
1553 <example module="sampleSmartPieLocal">
1554 <file name="index.html">
1555 <div ng-controller="SampleCtrlLocal as vm">
1556 <xos-smart-pie config="vm.configLocal"></xos-smart-pie>
1557 </div>
1558 </file>
1559 <file name="script.js">
1560 angular.module('sampleSmartPieLocal', ['xos.uiComponents'])
1561 .factory('_', function($window){
1562 return $window._;
1563 })
1564 .controller('SampleCtrlLocal', function($timeout){
1565
1566 this.datas = [
1567 {id: 1, first_name: 'Jon', last_name: 'aaa', category: 2},
1568 {id: 2, first_name: 'Danaerys', last_name: 'Targaryen', category: 1},
1569 {id: 3, first_name: 'Aria', last_name: 'Stark', category: 2}
1570 ];
1571 this.configLocal = {
1572 data: [],
1573 groupBy: 'category',
1574 classes: 'local',
1575 labelFormatter: (labels) => {
1576 return labels.map(l => l === '1' ? 'North' : 'Dragon');
1577 }
1578 };
1579
1580 $timeout(() => {
1581 // this need to be triggered in this way just because of ngDoc,
1582 // otherwise you can assign data directly in the config
1583 this.configLocal.data = this.datas;
1584 }, 1)
1585 });
1586 </file>
1587 </example>
1588 Fetching data from API
1589 <example module="sampleSmartPieResource">
1590 <file name="index.html">
1591 <div ng-controller="SampleCtrl as vm">
1592 <xos-smart-pie config="vm.config"></xos-smart-pie>
1593 </div>
1594 </file>
1595 <file name="script.js">
1596 angular.module('sampleSmartPieResource', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
1597 .controller('SampleCtrl', function(){
1598 this.config = {
1599 resource: 'SampleResource',
1600 groupBy: 'category',
1601 classes: 'resource',
1602 labelFormatter: (labels) => {
1603 return labels.map(l => l === '1' ? 'North' : 'Dragon');
1604 }
1605 };
1606 });
1607 </file>
1608 <file name="backendPoll.js">
1609 angular.module('sampleSmartPieResource')
1610 .run(function($httpBackend, _){
1611 let datas = [
1612 {id: 1, first_name: 'Jon', last_name: 'Snow', category: 1},
1613 {id: 2, first_name: 'Danaerys', last_name: 'Targaryen', category: 2},
1614 {id: 3, first_name: 'Aria', last_name: 'Stark', category: 1}
1615 ];
1616 $httpBackend.whenGET('/test').respond(200, datas)
1617 })
1618 .factory('_', function($window){
1619 return $window._;
1620 })
1621 .service('SampleResource', function($resource){
1622 return $resource('/test/:id', {id: '@id'});
1623 })
1624 </file>
1625 </example>
1626 Polling data from API
1627 <example module="sampleSmartPiePoll">
1628 <file name="index.html">
1629 <div ng-controller="SampleCtrl as vm">
1630 <xos-smart-pie config="vm.config"></xos-smart-pie>
1631 </div>
1632 </file>
1633 <file name="script.js">
1634 angular.module('sampleSmartPiePoll', ['xos.uiComponents', 'ngResource', 'ngMockE2E'])
1635 .controller('SampleCtrl', function(){
1636 this.config = {
1637 resource: 'SampleResource',
1638 groupBy: 'category',
1639 poll: 2,
1640 labelFormatter: (labels) => {
1641 return labels.map(l => l === '1' ? 'Active' : 'Banned');
1642 }
1643 };
1644 });
1645 </file>
1646 <file name="backend.js">
1647 angular.module('sampleSmartPiePoll')
1648 .run(function($httpBackend, _){
1649 let mock = [
1650 [
1651 {id: 1, first_name: 'Jon', last_name: 'Snow', category: 1},
1652 {id: 2, first_name: 'Danaerys', last_name: 'Targaryen', category: 2},
1653 {id: 3, first_name: 'Aria', last_name: 'Stark', category: 1},
1654 {id: 3, first_name: 'Tyrion', last_name: 'Lannister', category: 1}
1655 ],
1656 [
1657 {id: 1, first_name: 'Jon', last_name: 'Snow', category: 1},
1658 {id: 2, first_name: 'Danaerys', last_name: 'Targaryen', category: 2},
1659 {id: 3, first_name: 'Aria', last_name: 'Stark', category: 2},
1660 {id: 3, first_name: 'Tyrion', last_name: 'Lannister', category: 2}
1661 ],
1662 [
1663 {id: 1, first_name: 'Jon', last_name: 'Snow', category: 1},
1664 {id: 2, first_name: 'Danaerys', last_name: 'Targaryen', category: 2},
1665 {id: 3, first_name: 'Aria', last_name: 'Stark', category: 1},
1666 {id: 3, first_name: 'Tyrion', last_name: 'Lannister', category: 2}
1667 ]
1668 ];
1669 $httpBackend.whenGET('/test').respond(function(method, url, data, headers, params) {
1670 return [200, mock[Math.round(Math.random() * 3)]];
1671 });
1672 })
1673 .factory('_', function($window){
1674 return $window._;
1675 })
1676 .service('SampleResource', function($resource){
1677 return $resource('/test/:id', {id: '@id'});
1678 })
1679 </file>
1680 </example>
1681 */
1682 .component('xosSmartPie', {
1683 restrict: 'E',
1684 bindings: {
1685 config: '='
1686 },
1687 template: '\n <canvas\n class="chart chart-pie {{vm.config.classes}}"\n chart-data="vm.data" chart-labels="vm.labels"\n chart-legend="{{vm.config.legend}}">\n </canvas>\n ',
1688 bindToController: true,
1689 controllerAs: 'vm',
1690 controller: ["$injector", "$interval", "$scope", "$timeout", "_", function controller($injector, $interval, $scope, $timeout, _) {
1691 var _this = this;
1692
1693 if (!this.config.resource && !this.config.data) {
1694 throw new Error('[xosSmartPie] Please provide a resource or an array of data in the configuration');
1695 }
1696
1697 var groupData = function groupData(data) {
1698 return _.groupBy(data, _this.config.groupBy);
1699 };
1700 var formatData = function formatData(data) {
1701 return _.reduce(Object.keys(data), function (list, group) {
1702 return list.concat(data[group].length);
1703 }, []);
1704 };
1705 var formatLabels = function formatLabels(data) {
1706 return angular.isFunction(_this.config.labelFormatter) ? _this.config.labelFormatter(Object.keys(data)) : Object.keys(data);
1707 };
1708
1709 var prepareData = function prepareData(data) {
1710 // group data
1711 var grouped = groupData(data);
1712 _this.data = formatData(grouped);
1713 // create labels
1714 _this.labels = formatLabels(grouped);
1715 };
1716
1717 if (this.config.resource) {
1718 (function () {
1719
1720 _this.Resource = $injector.get(_this.config.resource);
1721 var getData = function getData() {
1722 _this.Resource.query().$promise.then(function (res) {
1723
1724 if (!res[0]) {
1725 return;
1726 }
1727
1728 prepareData(res);
1729 });
1730 };
1731
1732 getData();
1733
1734 if (_this.config.poll) {
1735 $interval(function () {
1736 getData();
1737 }, _this.config.poll * 1000);
1738 }
1739 })();
1740 } else {
1741 $scope.$watch(function () {
1742 return _this.config.data;
1743 }, function (data) {
1744 if (data) {
1745 prepareData(_this.config.data);
1746 }
1747 }, true);
1748 }
1749
1750 $scope.$on('create', function (event, chart) {
1751 console.log('create: ' + chart.id);
1752 });
1753
1754 $scope.$on('destroy', function (event, chart) {
1755 console.log('destroy: ' + chart.id);
1756 });
1757 }]
1758 });
1759})();
1760//# sourceMappingURL=../../../maps/ui_components/smartComponents/smartPie/smartPie.component.js.map
1761
1762'use strict';
1763
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001764(function () {
1765 'use strict';
1766
1767 /**
1768 * @ngdoc service
1769 * @name xos.uiComponents.LabelFormatter
1770 * @description This factory define a set of helper function to format label started from an object property
1771 **/
1772
1773 angular.module('xos.uiComponents').factory('LabelFormatter', labelFormatter);
1774
1775 function labelFormatter() {
1776
1777 /**
1778 * @ngdoc method
1779 * @name xos.uiComponents.LabelFormatter#_formatByUnderscore
1780 * @methodOf xos.uiComponents.LabelFormatter
1781 * @description
1782 * Convert a `snake_case` string to readable string.<br/>
1783 * Eg: `this_string` will became `this string`
1784 * @param {string} string The string to be converted
1785 * @returns {string} The converten string
1786 **/
1787
1788 var _formatByUnderscore = function _formatByUnderscore(string) {
1789 return string.split('_').join(' ').trim();
1790 };
1791
1792 /**
1793 * @ngdoc method
1794 * @name xos.uiComponents.LabelFormatter#_formatByUppercase
1795 * @methodOf xos.uiComponents.LabelFormatter
1796 * @description
1797 * Convert a `camelCase` string to readable string.<br/>
1798 * Eg: `thisString` will became `this string`
1799 * @param {string} string The string to be converted
1800 * @returns {string} The converten string
1801 **/
1802
1803 var _formatByUppercase = function _formatByUppercase(string) {
1804 return string.split(/(?=[A-Z])/).map(function (w) {
1805 return w.toLowerCase();
1806 }).join(' ');
1807 };
1808
1809 /**
1810 * @ngdoc method
1811 * @name xos.uiComponents.LabelFormatter#_capitalize
1812 * @methodOf xos.uiComponents.LabelFormatter
1813 * @description
1814 * Capitalize the first letter of a string.<br/>
1815 * Eg: `this string` will became `This string`
1816 * @param {string} string The string to be converted
1817 * @returns {string} The converten string
1818 **/
1819
1820 var _capitalize = function _capitalize(string) {
1821 return string.slice(0, 1).toUpperCase() + string.slice(1);
1822 };
1823
1824 /**
1825 * @ngdoc method
1826 * @name xos.uiComponents.LabelFormatter#format
1827 * @methodOf xos.uiComponents.LabelFormatter
1828 * @description
1829 * Apply in order:
1830 * - _formatByUnderscore
1831 * - _formatByUppercase
1832 * - _capitalize
1833 * - replace multiple space with a single one
1834 * - append `:` at the end
1835 * <br/>
1836 * Eg: `this_string` will became `This string:`<br/>
1837 * Eg: `thisString` will became `This string:`
1838 * @param {string} string The string to be converted
1839 * @returns {string} The converten string
1840 **/
1841
1842 var format = function format(string) {
1843 string = _formatByUnderscore(string);
1844 string = _formatByUppercase(string);
1845
1846 string = _capitalize(string).replace(/\s\s+/g, ' ') + ':';
1847 return string.replace('::', ':');
1848 };
1849
1850 return {
1851 // test export
1852 _formatByUnderscore: _formatByUnderscore,
1853 _formatByUppercase: _formatByUppercase,
1854 _capitalize: _capitalize,
1855 // export to use
1856 format: format
1857 };
1858 }
1859})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07001860//# sourceMappingURL=../../../maps/services/helpers/ui/label_formatter.service.js.map
1861
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001862'use strict';
1863
1864var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
1865
1866(function () {
1867
1868 angular.module('xos.uiComponents')
1869
1870 /**
1871 * @ngdoc service
1872 * @name xos.uiComponents.XosFormHelpers
1873 * @requires xos.uiComponents.LabelFormatter
1874 * @requires xos.helpers._
1875 **/
1876
1877 .service('XosFormHelpers', ["_", "LabelFormatter", function (_, LabelFormatter) {
1878 var _this = this;
1879
1880 /**
1881 * @ngdoc method
1882 * @name xos.uiComponents.XosFormHelpers#_isEmail
1883 * @methodOf xos.uiComponents.XosFormHelpers
1884 * @description
1885 * Return true if the string is an email address
1886 * @param {string} text The string to be evaluated
1887 * @returns {boolean} If the string match an email format
1888 **/
1889
1890 this._isEmail = function (text) {
1891 var re = /(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
1892 return re.test(text);
1893 };
1894
1895 /**
1896 * @ngdoc method
1897 * @name xos.uiComponents.XosFormHelpers#_getFieldFormat
1898 * @methodOf xos.uiComponents.XosFormHelpers
1899 * @description
1900 * Return the type of the input
1901 * @param {mixed} value The data to be evaluated
1902 * @returns {string} The type of the input
1903 **/
1904
1905 this._getFieldFormat = function (value) {
1906
1907 if (angular.isArray(value)) {
1908 return 'array';
1909 }
1910
1911 // check if is date
Matteo Scandoloe57712f2016-09-21 15:27:36 -07001912 if (angular.isDate(value) || !Number.isNaN(Date.parse(value)) && // Date.parse is a number
1913 /^\d+-\d+-\d+\D\d+:\d+:\d+\.\d+\D/.test(value) // the format match ISO dates
1914 ) {
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07001915 return 'date';
1916 }
1917
1918 // check if is boolean
1919 // isNaN(false) = false, false is a number (0), true is a number (1)
1920 if (typeof value === 'boolean') {
1921 return 'boolean';
1922 }
1923
1924 // check if a string is an email
1925 if (_this._isEmail(value)) {
1926 return 'email';
1927 }
1928
1929 // if null return string
1930 if (angular.isString(value) || value === null) {
1931 return 'text';
1932 }
1933
1934 return typeof value === 'undefined' ? 'undefined' : _typeof(value);
1935 };
1936
1937 /**
1938 * @ngdoc method
1939 * @name xos.uiComponents.XosFormHelpers#buildFormStructure
1940 * @methodOf xos.uiComponents.XosFormHelpers
1941 * @description
1942 * Return the type of the input
1943 * @param {object} modelField An object containing one property for each field of the model
1944 * @param {object} customField An object containing one property for each field custom field
1945 * @param {object} model The actual model on wich build the form structure (it is used to determine the type of the input)
1946 * @returns {object} An object describing the form structure in the form of:
1947 * ```
1948 * {
1949 * 'field-name': {
1950 * label: 'Label',
1951 * type: 'number', //typeof field
1952 * validators: {}, // see xosForm for more details
1953 * hint: 'A Custom hint for the field'
1954 * }
1955 * }
1956 * ```
1957 **/
1958
1959 this.buildFormStructure = function (modelField, customField, model) {
1960
1961 modelField = angular.extend(modelField, customField);
1962 customField = customField || {};
1963
1964 return _.reduce(Object.keys(modelField), function (form, f) {
1965
1966 form[f] = {
1967 label: customField[f] && customField[f].label ? customField[f].label + ':' : LabelFormatter.format(f),
1968 type: customField[f] && customField[f].type ? customField[f].type : _this._getFieldFormat(model[f]),
1969 validators: customField[f] && customField[f].validators ? customField[f].validators : {},
1970 hint: customField[f] && customField[f].hint ? customField[f].hint : ''
1971 };
1972
1973 if (customField[f] && customField[f].options) {
1974 form[f].options = customField[f].options;
1975 }
1976 if (customField[f] && customField[f].properties) {
1977 form[f].properties = customField[f].properties;
1978 }
1979 if (form[f].type === 'date') {
1980 model[f] = new Date(model[f]);
1981 }
1982
1983 if (form[f].type === 'number') {
1984 model[f] = parseInt(model[f], 10);
1985 }
1986
1987 return form;
1988 }, {});
1989 };
1990
1991 /**
1992 * @ngdoc method
1993 * @name xos.uiComponents.XosFormHelpers#parseModelField
1994 * @methodOf xos.uiComponents.XosFormHelpers
1995 * @description
1996 * Helpers for buildFormStructure, convert a list of model properties in an object used to build the form structure, eg:
1997 * ```
1998 * // input:
1999 * ['id', 'name'm 'mail']
2000 *
2001 * // output
2002 * {
2003 * id: {},
2004 * name: {},
2005 * mail: {}
2006 * }
2007 * ```
2008 * @param {array} fields An array of fields representing the model properties
2009 * @returns {object} An object containing one property for each field of the model
2010 **/
2011
2012 this.parseModelField = function (fields) {
2013 return _.reduce(fields, function (form, f) {
2014 form[f] = {};
2015 return form;
2016 }, {});
2017 };
2018 }]);
2019})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002020//# sourceMappingURL=../../../maps/services/helpers/ui/form.helpers.js.map
2021
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002022'use strict';
2023
2024(function () {
2025 'use strict';
2026
2027 /**
2028 * @ngdoc service
2029 * @name xos.uiComponents.Comparator
2030 * @description
2031 * This factory define a function that replace the native angular.filter comparator.
2032 *
2033 * It is done to allow the comparation between (0|1) values with booleans.
2034 * >Note that this factory return a single function, not an object.
2035 *
2036 * The tipical usage of this factory is inside an `ng-repeat`
2037 * @example
2038 * <example module="comparator">
2039 * <file name="index.html">
2040 * <div ng-controller="sample as vm">
2041 * <div class="row">
2042 * <div class="col-xs-6">
2043 * <label>Filter by name:</label>
2044 * <input class="form-control" type="text" ng-model="vm.query.name"/>
2045 * </div>
2046 * <div class="col-xs-6">
2047 * <label>Filter by status:</label>
2048 * <select
2049 * ng-model="vm.query.status"
2050 * ng-options="i for i in [true, false]">
2051 * </select>
2052 * </div>
2053 * </div>
2054 * <div ng-repeat="item in vm.data | filter:vm.query:vm.comparator">
2055 * <div class="row">
2056 * <div class="col-xs-6">{{item.name}}</div>
2057 * <div class="col-xs-6">{{item.status}}</div>
2058 * </div>
2059 * </div>
2060 * </div>
2061 * </file>
2062 * <file name="script.js">
2063 * angular.module('comparator', ['xos.uiComponents'])
2064 * .controller('sample', function(Comparator){
2065 * this.comparator = Comparator;
2066 * this.data = [
2067 * {name: 'Jhon', status: 1},
2068 * {name: 'Jack', status: 0},
2069 * {name: 'Mike', status: 1},
2070 * {name: 'Scott', status: 0}
2071 * ];
2072 * });
2073 * </file>
2074 * </example>
2075 **/
2076
2077 comparator.$inject = ["_"];
2078 angular.module('xos.uiComponents').factory('Comparator', comparator);
2079
2080 function comparator(_) {
2081
2082 return function (actual, expected) {
2083
2084 if (angular.isUndefined(actual)) {
2085 // No substring matching against `undefined`
2086 return false;
2087 }
2088 if (actual === null || expected === null) {
2089 // No substring matching against `null`; only match against `null`
2090 return actual === expected;
2091 }
2092 if (angular.isObject(expected) || angular.isObject(actual)) {
2093 return angular.equals(expected, actual);
2094 }
2095
2096 if (_.isBoolean(actual) || _.isBoolean(expected)) {
2097 if (actual === 0 || actual === 1) {
2098 actual = !!actual;
2099 }
2100 return angular.equals(expected, actual);
2101 }
2102
2103 if (!angular.isString(actual) || !angular.isString(expected)) {
2104 if (angular.isDefined(actual.toString) && angular.isDefined(expected.toString)) {
2105 actual = actual.toString();
2106 expected = expected.toString();
2107 } else {
2108 return actual === expected;
2109 }
2110 }
2111
2112 actual = actual.toLowerCase() + '';
2113 expected = expected.toLowerCase() + '';
2114 return actual.indexOf(expected) !== -1;
2115 };
2116 }
2117})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002118//# sourceMappingURL=../../../maps/services/helpers/ui/comparator.service.js.map
2119
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002120'use strict';
2121
2122(function () {
2123 'use strict';
2124
2125 /**
2126 * @ngdoc overview
2127 * @name xos.helpers
2128 * @description
2129 * # xos.Helpers
2130 * A collection of helpers to work with XOS <br/>
2131 * Currently available components are:
2132 * - [NoHyperlinks](/#/module/xos.helpers.NoHyperlinks)
2133 * - [SetCSRFToken](/#/module/xos.helpers.SetCSRFToken)
2134 * - [xosNotification](/#/module/xos.helpers.xosNotification)
2135 * - [XosUserPrefs](/#/module/xos.helpers.XosUserPrefs)
2136 * <br/><br/>
2137 * A set of angular [$resource](https://docs.angularjs.org/api/ngResource/service/$resource) is provided to work with the API.<br>
2138 * You can find the documentation [here](#/rest-api)
2139 **/
2140
2141 config.$inject = ["$httpProvider", "$interpolateProvider", "$resourceProvider"];
2142 angular.module('xos.helpers', ['ngCookies', 'ngResource', 'ngAnimate', 'xos.uiComponents']).config(config)
2143
2144 /**
2145 * @ngdoc service
2146 * @name xos.helpers._
2147 * @description Wrap [lodash](https://lodash.com/docs) in an Angular Service
2148 **/
2149
2150 .factory('_', ["$window", function ($window) {
2151 return $window._;
2152 }]);
2153
2154 function config($httpProvider, $interpolateProvider, $resourceProvider) {
2155 $httpProvider.interceptors.push('SetCSRFToken');
2156
2157 // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
2158 $resourceProvider.defaults.stripTrailingSlashes = false;
2159 }
2160})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002161//# sourceMappingURL=maps/xosHelpers.module.js.map
2162
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002163'use strict';
2164
2165(function () {
2166 'use strict';
2167
2168 angular.module('xos.helpers')
2169 /**
2170 * @ngdoc service
2171 * @name xos.helpers.vSG-Collection
2172 * @description Angular resource to fetch /api/service/vsg/
2173 **/
2174 .service('vSG-Collection', ["$resource", function ($resource) {
2175 return $resource('/api/service/vsg/');
2176 }]);
2177})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002178//# sourceMappingURL=../../maps/services/rest/vSG.js.map
2179
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002180'use strict';
2181
2182(function () {
2183 'use strict';
2184
2185 angular.module('xos.helpers')
2186 /**
2187 * @ngdoc service
2188 * @name xos.helpers.vOLT-Collection
2189 * @description Angular resource to fetch /api/tenant/cord/volt/:volt_id/
2190 **/
2191 .service('vOLT-Collection', ["$resource", function ($resource) {
2192 return $resource('/api/tenant/cord/volt/:volt_id/', { volt_id: '@id' }, {
2193 update: { method: 'PUT' }
2194 });
2195 }]);
2196})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002197//# sourceMappingURL=../../maps/services/rest/vOLT.js.map
2198
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002199'use strict';
2200
2201(function () {
2202 'use strict';
2203
2204 angular.module('xos.helpers')
2205 /**
2206 * @ngdoc service
2207 * @name xos.helpers.Login
2208 * @description Angular resource to fetch /api/utility/login/
2209 **/
2210 .service('Login', ["$resource", function ($resource) {
2211 return $resource('/api/utility/login/');
2212 }])
2213 /**
2214 * @ngdoc service
2215 * @name xos.helpers.Logout
2216 * @description Angular resource to fetch /api/utility/logout/
2217 **/
2218 .service('Logout', ["$resource", function ($resource) {
2219 return $resource('/api/utility/logout/');
2220 }]);
2221})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002222//# sourceMappingURL=../../maps/services/rest/Utility.js.map
2223
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002224'use strict';
2225
2226(function () {
2227 'use strict';
2228
2229 angular.module('xos.helpers')
2230 /**
2231 * @ngdoc service
2232 * @name xos.helpers.Users
2233 * @description Angular resource to fetch /api/core/users/:id/
2234 **/
2235 .service('Users', ["$resource", function ($resource) {
2236 return $resource('/api/core/users/:id/', { id: '@id' }, {
2237 update: { method: 'PUT' }
2238 });
2239 }]);
2240})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002241//# sourceMappingURL=../../maps/services/rest/Users.js.map
2242
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002243'use strict';
2244
2245(function () {
2246 'use strict';
2247
2248 angular.module('xos.helpers')
2249 /**
2250 * @ngdoc service
2251 * @name xos.helpers.Truckroll
2252 * @description Angular resource to fetch /api/tenant/truckroll/:id/
2253 **/
2254 .service('Truckroll', ["$resource", function ($resource) {
2255 return $resource('/api/tenant/truckroll/:id/', { id: '@id' }, {
2256 update: { method: 'PUT' }
2257 });
2258 }]);
2259})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002260//# sourceMappingURL=../../maps/services/rest/Truckroll.js.map
2261
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002262'use strict';
2263
2264(function () {
2265 'use strict';
2266
2267 angular.module('xos.helpers')
2268 /**
2269 * @ngdoc service
2270 * @name xos.helpers.Tenant
2271 * @description Angular resource to fetch /api/core/tenant/:id/
2272 **/
2273 .service('Tenants', ["$resource", function ($resource) {
2274 return $resource('/api/core/tenants/:id/', { id: '@id' }, {
2275 update: { method: 'PUT' }
2276 });
2277 }]);
2278})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002279//# sourceMappingURL=../../maps/services/rest/Tenant.js.map
2280
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002281'use strict';
2282
2283(function () {
2284 'use strict';
2285
2286 angular.module('xos.helpers')
2287 /**
2288 * @ngdoc service
2289 * @name xos.helpers.Subscribers
2290 * @description Angular resource to fetch Subscribers
2291 **/
2292 .service('Subscribers', ["$resource", function ($resource) {
2293 return $resource('/api/tenant/cord/subscriber/:id/', { id: '@id' }, {
2294 update: { method: 'PUT' },
2295 /**
2296 * @ngdoc method
2297 * @name xos.helpers.Subscribers#View-a-Subscriber-Features-Detail
2298 * @methodOf xos.helpers.Subscribers
2299 * @description
2300 * View-a-Subscriber-Features-Detail
2301 **/
2302 'View-a-Subscriber-Features-Detail': {
2303 method: 'GET',
2304 isArray: false,
2305 url: '/api/tenant/cord/subscriber/:id/features/'
2306 },
2307 /**
2308 * @ngdoc method
2309 * @name xos.helpers.Subscribers#Read-Subscriber-uplink_speed
2310 * @methodOf xos.helpers.Subscribers
2311 * @description
2312 * Read-Subscriber-uplink_speed
2313 **/
2314 'Read-Subscriber-uplink_speed': {
2315 method: 'GET',
2316 isArray: false,
2317 url: '/api/tenant/cord/subscriber/:id/features/uplink_speed/'
2318 },
2319 /**
2320 * @ngdoc method
2321 * @name xos.helpers.Subscribers#Update-Subscriber-uplink_speed
2322 * @methodOf xos.helpers.Subscribers
2323 * @description
2324 * Update-Subscriber-uplink_speed
2325 **/
2326 'Update-Subscriber-uplink_speed': {
2327 method: 'PUT',
2328 isArray: false,
2329 url: '/api/tenant/cord/subscriber/:id/features/uplink_speed/'
2330 },
2331 /**
2332 * @ngdoc method
2333 * @name xos.helpers.Subscribers#Read-Subscriber-downlink_speed
2334 * @methodOf xos.helpers.Subscribers
2335 * @description
2336 * Read-Subscriber-downlink_speed
2337 **/
2338 'Read-Subscriber-downlink_speed': {
2339 method: 'GET',
2340 isArray: false,
2341 url: '/api/tenant/cord/subscriber/:id/features/downlink_speed/'
2342 },
2343 /**
2344 * @ngdoc method
2345 * @name xos.helpers.Subscribers#Update-Subscriber-downlink_speed
2346 * @methodOf xos.helpers.Subscribers
2347 * @description
2348 * Update-Subscriber-downlink_speed
2349 **/
2350 'Update-Subscriber-downlink_speed': {
2351 method: 'PUT',
2352 isArray: false,
2353 url: '/api/tenant/cord/subscriber/:id/features/downlink_speed/'
2354 },
2355 /**
2356 * @ngdoc method
2357 * @name xos.helpers.Subscribers#Read-Subscriber-cdn
2358 * @methodOf xos.helpers.Subscribers
2359 * @description
2360 * Read-Subscriber-cdn
2361 **/
2362 'Read-Subscriber-cdn': {
2363 method: 'GET',
2364 isArray: false,
2365 url: '/api/tenant/cord/subscriber/:id/features/cdn/'
2366 },
2367 /**
2368 * @ngdoc method
2369 * @name xos.helpers.Subscribers#Update-Subscriber-cdn
2370 * @methodOf xos.helpers.Subscribers
2371 * @description
2372 * Update-Subscriber-cdn
2373 **/
2374 'Update-Subscriber-cdn': {
2375 method: 'PUT',
2376 isArray: false,
2377 url: '/api/tenant/cord/subscriber/:id/features/cdn/'
2378 },
2379 /**
2380 * @ngdoc method
2381 * @name xos.helpers.Subscribers#Read-Subscriber-uverse
2382 * @methodOf xos.helpers.Subscribers
2383 * @description
2384 * Read-Subscriber-uverse
2385 **/
2386 'Read-Subscriber-uverse': {
2387 method: 'GET',
2388 isArray: false,
2389 url: '/api/tenant/cord/subscriber/:id/features/uverse/'
2390 },
2391 /**
2392 * @ngdoc method
2393 * @name xos.helpers.Subscribers#Update-Subscriber-uverse
2394 * @methodOf xos.helpers.Subscribers
2395 * @description
2396 * Update-Subscriber-uverse
2397 **/
2398 'Update-Subscriber-uverse': {
2399 method: 'PUT',
2400 isArray: false,
2401 url: '/api/tenant/cord/subscriber/:id/features/uverse/'
2402 },
2403 /**
2404 * @ngdoc method
2405 * @name xos.helpers.Subscribers#Read-Subscriber-status
2406 * @methodOf xos.helpers.Subscribers
2407 * @description
2408 * Read-Subscriber-status
2409 **/
2410 'Read-Subscriber-status': {
2411 method: 'GET',
2412 isArray: false,
2413 url: '/api/tenant/cord/subscriber/:id/features/status/'
2414 },
2415 /**
2416 * @ngdoc method
2417 * @name xos.helpers.Subscribers#Update-Subscriber-status
2418 * @methodOf xos.helpers.Subscribers
2419 * @description
2420 * Update-Subscriber-status
2421 **/
2422 'Update-Subscriber-status': {
2423 method: 'PUT',
2424 isArray: false,
2425 url: '/api/tenant/cord/subscriber/:id/features/status/'
2426 }
2427 });
2428 }]);
2429})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002430//# sourceMappingURL=../../maps/services/rest/Subscribers.js.map
2431
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002432'use strict';
2433
2434(function () {
2435 'use strict';
2436
2437 angular.module('xos.helpers')
2438 /**
2439 * @ngdoc service
2440 * @name xos.helpers.SlicesPlus
2441 * @description Angular resource to fetch /api/utility/slicesplus/
2442 * This is a read-only API and only the `query` method is currently supported.
2443 **/
2444 .service('SlicesPlus', ["$http", "$q", function ($http, $q) {
2445 this.query = function (params) {
2446 var deferred = $q.defer();
2447
2448 $http.get('/api/utility/slicesplus/', { params: params }).then(function (res) {
2449 deferred.resolve(res.data);
2450 }).catch(function (res) {
2451 deferred.reject(res.data);
2452 });
2453
2454 return { $promise: deferred.promise };
2455 };
2456
2457 this.get = function (id, params) {
2458 var deferred = $q.defer();
2459
2460 $http.get('/api/utility/slicesplus/' + id, { params: params }).then(function (res) {
2461 deferred.resolve(res.data);
2462 }).catch(function (res) {
2463 deferred.reject(res.data);
2464 });
2465 return { $promise: deferred.promise };
2466 };
2467 }]);
2468})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002469//# sourceMappingURL=../../maps/services/rest/Slices_plus.js.map
2470
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002471'use strict';
2472
2473(function () {
2474 'use strict';
2475
2476 angular.module('xos.helpers')
2477 /**
2478 * @ngdoc service
2479 * @name xos.helpers.Slices
2480 * @description Angular resource to fetch /api/core/slices/:id/
2481 **/
2482 .service('Slices', ["$resource", function ($resource) {
2483 return $resource('/api/core/slices/:id/', { id: '@id' }, {
2484 update: { method: 'PUT' }
2485 });
2486 }]);
2487})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002488//# sourceMappingURL=../../maps/services/rest/Slices.js.map
2489
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002490'use strict';
2491
2492(function () {
2493 'use strict';
2494
2495 angular.module('xos.helpers')
2496 /**
2497 * @ngdoc service
2498 * @name xos.helpers.Sites
2499 * @description Angular resource to fetch /api/core/sites/:id/
2500 **/
2501 .service('Sites', ["$resource", function ($resource) {
2502 return $resource('/api/core/sites/:id/', { id: '@id' }, {
2503 update: { method: 'PUT' }
2504 });
2505 }]);
2506})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002507//# sourceMappingURL=../../maps/services/rest/Sites.js.map
2508
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002509'use strict';
2510
2511(function () {
2512 'use strict';
2513
2514 angular.module('xos.helpers')
2515 /**
2516 * @ngdoc service
2517 * @name xos.helpers.Services
2518 * @description Angular resource to fetch /api/core/services/:id/
2519 **/
2520 .service('Services', ["$resource", function ($resource) {
2521 return $resource('/api/core/services/:id/', { id: '@id' }, {
2522 update: { method: 'PUT' }
2523 });
2524 }]);
2525})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002526//# sourceMappingURL=../../maps/services/rest/Services.js.map
2527
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002528'use strict';
2529
2530(function () {
2531 'use strict';
2532
2533 angular.module('xos.helpers')
2534 /**
2535 * @ngdoc service
2536 * @name xos.helpers.ONOS-Services-Collection
2537 * @description Angular resource to fetch /api/service/onos/
2538 **/
2539 .service('ONOS-Services-Collection', ["$resource", function ($resource) {
2540 return $resource('/api/service/onos/');
2541 }]);
2542})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002543//# sourceMappingURL=../../maps/services/rest/ONOS-Services.js.map
2544
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002545'use strict';
2546
2547(function () {
2548 'use strict';
2549
2550 angular.module('xos.helpers')
2551 /**
2552 * @ngdoc service
2553 * @name xos.helpers.ONOS-App-Collection
2554 * @description Angular resource to fetch /api/tenant/onos/app/
2555 **/
2556 .service('ONOS-App-Collection', ["$resource", function ($resource) {
2557 return $resource('/api/tenant/onos/app/');
2558 }]);
2559})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002560//# sourceMappingURL=../../maps/services/rest/ONOS-Apps.js.map
2561
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002562'use strict';
2563
2564(function () {
2565 'use strict';
2566
2567 angular.module('xos.helpers')
2568 /**
2569 * @ngdoc service
2570 * @name xos.helpers.Nodes
2571 * @description Angular resource to fetch /api/core/nodes/:id/
2572 **/
2573 .service('Nodes', ["$resource", function ($resource) {
2574 return $resource('/api/core/nodes/:id/', { id: '@id' }, {
2575 update: { method: 'PUT' }
2576 });
2577 }]);
2578})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002579//# sourceMappingURL=../../maps/services/rest/Nodes.js.map
2580
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002581'use strict';
2582
2583(function () {
2584 'use strict';
2585
2586 angular.module('xos.helpers')
2587 /**
2588 * @ngdoc service
2589 * @name xos.helpers.Networkstemplates
2590 * @description Angular resource to fetch /api/core/networktemplates/:id/
2591 **/
2592 .service('Networkstemplates', ["$resource", function ($resource) {
2593 return $resource('/api/core/networktemplates/:id/', { id: '@id' }, {
2594 update: { method: 'PUT' }
2595 });
2596 }]);
2597})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002598//# sourceMappingURL=../../maps/services/rest/Networkstemplates.js.map
2599
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002600'use strict';
2601
2602(function () {
2603 'use strict';
2604
2605 angular.module('xos.helpers')
2606 /**
2607 * @ngdoc service
2608 * @name xos.helpers.Networks
2609 * @description Angular resource to fetch /api/core/networks/:id/
2610 **/
2611 .service('Networks', ["$resource", function ($resource) {
2612 return $resource('/api/core/networks/:id/', { id: '@id' }, {
2613 update: { method: 'PUT' }
2614 });
2615 }]);
2616})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002617//# sourceMappingURL=../../maps/services/rest/Networks.js.map
2618
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002619'use strict';
2620
2621(function () {
2622 'use strict';
2623
2624 angular.module('xos.helpers')
2625 /**
2626 * @ngdoc service
2627 * @name xos.helpers.Me
2628 * @description Http read-only api to fetch /api/utility/me/
2629 **/
2630 .service('Me', ["$q", "$http", function ($q, $http) {
2631
2632 this.get = function () {
2633 var deferred = $q.defer();
2634
2635 $http.get('/api/utility/me/').then(function (res) {
2636 deferred.resolve(res.data);
2637 }).catch(function (e) {
2638 deferred.reject(e);
2639 });
2640 return deferred.promise;
2641 };
2642 }]);
2643})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002644//# sourceMappingURL=../../maps/services/rest/Me.js.map
2645
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002646'use strict';
2647
2648(function () {
2649 'use strict';
2650
2651 angular.module('xos.helpers')
2652 /**
2653 * @ngdoc service
2654 * @name xos.helpers.Instances
2655 * @description Angular resource to fetch /api/core/instances/:id/
2656 **/
2657 .service('Instances', ["$resource", function ($resource) {
2658 return $resource('/api/core/instances/:id/', { id: '@id' }, {
2659 update: { method: 'PUT' }
2660 });
2661 }]);
2662})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002663//# sourceMappingURL=../../maps/services/rest/Instances.js.map
2664
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002665'use strict';
2666
2667(function () {
2668 'use strict';
2669
2670 angular.module('xos.helpers')
2671 /**
2672 * @ngdoc service
2673 * @name xos.helpers.Images
2674 * @description Angular resource to fetch /api/core/images/
2675 **/
2676 .service('Images', ["$resource", function ($resource) {
2677 return $resource('/api/core/images/:id/', { id: '@id' }, {
2678 update: { method: 'PUT' }
2679 });
2680 }]);
2681})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002682//# sourceMappingURL=../../maps/services/rest/Images.js.map
2683
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002684'use strict';
2685
2686(function () {
2687 'use strict';
2688
2689 angular.module('xos.helpers')
2690 /**
2691 * @ngdoc service
2692 * @name xos.helpers.Flavors
2693 * @description Angular resource to fetch /api/core/flavors/:id/
2694 **/
2695 .service('Flavors', ["$resource", function ($resource) {
2696 return $resource('/api/core/flavors/:id/', { id: '@id' }, {
2697 update: { method: 'PUT' }
2698 });
2699 }]);
2700})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002701//# sourceMappingURL=../../maps/services/rest/Flavors.js.map
2702
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002703'use strict';
2704
2705(function () {
2706 'use strict';
2707
2708 angular.module('xos.helpers')
2709 /**
2710 * @ngdoc service
2711 * @name xos.helpers.Example-Services-Collection
2712 * @description Angular resource to fetch /api/service/exampleservice/
2713 **/
2714 .service('Example-Services-Collection', ["$resource", function ($resource) {
2715 return $resource('/api/service/exampleservice/');
2716 }]);
2717})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002718//# sourceMappingURL=../../maps/services/rest/Example.js.map
2719
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002720'use strict';
2721
2722(function () {
2723 'use strict';
2724
2725 angular.module('xos.helpers')
2726 /**
2727 * @ngdoc service
2728 * @name xos.helpers.Deployments
2729 * @description Angular resource to fetch /api/core/deployments/:id/
2730 **/
2731 .service('Deployments', ["$resource", function ($resource) {
2732 return $resource('/api/core/deployments/:id/', { id: '@id' }, {
2733 update: { method: 'PUT' }
2734 });
2735 }]);
2736})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002737//# sourceMappingURL=../../maps/services/rest/Deployments.js.map
2738
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002739'use strict';
2740
2741(function () {
2742 'use strict';
2743
2744 angular.module('xos.helpers')
2745 /**
2746 * @ngdoc service
2747 * @name xos.helpers.Dashboards
2748 * @description Angular resource to fetch /api/core/dashboardviews/:id/
2749 **/
2750 .service('Dashboards', ["$resource", "$q", "$http", function ($resource, $q, $http) {
2751 var r = $resource('/api/core/dashboardviews/:id/', { id: '@id' }, {
2752 update: { method: 'PUT' }
2753 });
2754
2755 r.prototype.$save = function () {
2756 var d = $q.defer();
2757
2758 $http.put('/api/core/dashboardviews/' + this.id + '/', this).then(function (res) {
2759 d.resolve(res.data);
2760 }).catch(function (e) {
2761 d.reject(e.data);
2762 });
2763
2764 return d.promise;
2765 };
2766
2767 return r;
2768 }]);
2769})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002770//# sourceMappingURL=../../maps/services/rest/Dashboards.js.map
2771
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002772'use strict';
2773
2774(function () {
2775
2776 angular.module('xos.helpers')
2777
2778 /**
2779 * @ngdoc service
2780 * @name xos.helpers.XosUserPrefs
2781 * @description
2782 * This service is used to store the user preferences in cookies, so that they survive to page changes.
2783 * The structure of the user preference is:
2784 * ```
2785 * {
2786 * synchronizers: {
2787 * notification: {
2788 * 'volt': boolean,
2789 * 'openstack': boolean,
2790 * ...
2791 * }
2792 * }
2793 * userData: {
2794 * current_user_site_id: Number,
2795 * current_user_site_user_names: Array[1],
2796 * ...
2797 * }
2798 * }
2799 * ```
2800 **/
2801
2802 .service('XosUserPrefs', ["$cookies", "Me", "$q", function ($cookies, Me, $q) {
2803 var _this = this;
2804
2805 var userPrefs = $cookies.get('xosUserPrefs') ? angular.fromJson($cookies.get('xosUserPrefs')) : {};
2806
2807 /**
2808 * @ngdoc method
2809 * @name xos.helpers.XosUserPrefs#getAll
2810 * @methodOf xos.helpers.XosUserPrefs
2811 * @description
2812 * Return all the user preferences stored in cookies
2813 * @returns {object} The user preferences
2814 **/
2815 this.getAll = function () {
2816 userPrefs = $cookies.get('xosUserPrefs') ? angular.fromJson($cookies.get('xosUserPrefs')) : {};
2817 return userPrefs;
2818 };
2819
2820 /**
2821 * @ngdoc method
2822 * @name xos.helpers.XosUserPrefs#setAll
2823 * @methodOf xos.helpers.XosUserPrefs
2824 * @description
2825 * Override all user preferences
2826 * @param {object} prefs The user preferences
2827 **/
2828 this.setAll = function (prefs) {
2829 $cookies.put('xosUserPrefs', angular.toJson(prefs));
2830 };
2831
2832 /**
2833 * @ngdoc method
2834 * @name xos.helpers.XosUserPrefs#getSynchronizerNotificationStatus
2835 * @methodOf xos.helpers.XosUserPrefs
2836 * @description
2837 * Return the synchronizer notification status, if name is not provided return the status for all synchronizers
2838 * @param {string=} prefs The synchronizer name
2839 * @returns {object | string} The synchronizer status
2840 **/
2841 this.getSynchronizerNotificationStatus = function () {
2842 var name = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
2843
2844 if (name) {
2845 return _this.getAll().synchronizers.notification[name];
2846 }
2847 return _this.getAll().synchronizers.notification;
2848 };
2849
2850 /**
2851 * @ngdoc method
2852 * @name xos.helpers.XosUserPrefs#getUserDetailsCookie
2853 * @methodOf xos.helpers.XosUserPrefs
2854 * @description
2855 * Return all the user details stored in cookies or call the service
2856 * @returns {object} The user details
2857 **/
2858 this.getUserDetailsCookie = function () {
2859 var defer = $q.defer();
2860 var localPref = _this.getAll();
2861 if (!localPref.userData) {
2862 _this.setUserDetailsCookie().$promise.then(function (data) {
2863 defer.resolve(data);
2864 });
2865 } else {
2866 defer.resolve(localPref.userData);
2867 }
2868 return { $promise: defer.promise };
2869 };
2870
2871 /**
2872 * @ngdoc method
2873 * @name xos.helpers.XosUserPrefs#setUserDetailsCookie
2874 * @methodOf xos.helpers.XosUserPrefs
2875 * @description
2876 * Save the user details in the cookie
2877 * @param {object} details stored in cookie
2878 * @param {objects} returns the user details as a promise
2879 **/
2880 this.setUserDetailsCookie = function () {
2881 var userData = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
2882
2883
2884 var defer = $q.defer();
2885 var cookies = _this.getAll();
2886 if (!userData) {
2887 Me.get().then(function (user) {
2888 cookies.userData = user;
2889 _this.setAll(cookies);
2890 defer.resolve(user);
2891 }).catch(function (e) {
2892 defer.reject(e);
2893 });
2894 } else {
2895 cookies.userData = userData;
2896 _this.setAll(cookies);
2897 defer.resolve(userData);
2898 }
2899 return { $promise: defer.promise };
2900 };
2901
2902 /**
2903 * @ngdoc method
2904 * @name xos.helpers.XosUserPrefs#setSynchronizerNotificationStatus
2905 * @methodOf xos.helpers.XosUserPrefs
2906 * @description
2907 * Update the notification status for a single synchronizer
2908 * @param {string} name The synchronizer name
2909 * @param {boolean} value The notification status (true means that it has been sent)
2910 **/
2911
2912 this.setSynchronizerNotificationStatus = function () {
2913 var name = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
2914 var value = arguments[1];
2915
2916 if (!name) {
2917 throw new Error('[XosUserPrefs] When updating a synchronizer is mandatory to provide a name.');
2918 }
2919
2920 var cookies = _this.getAll();
2921
2922 if (!cookies.synchronizers) {
2923 cookies.synchronizers = {
2924 notification: {}
2925 };
2926 }
2927 cookies.synchronizers.notification[name] = value;
2928 _this.setAll(cookies);
2929 };
2930 }]);
2931})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002932//# sourceMappingURL=../../maps/services/helpers/user-prefs.service.js.map
2933
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002934'use strict';
2935
2936(function () {
2937 'use strict';
2938
2939 /**
2940 * @ngdoc service
2941 * @name xos.helpers.ServiceGraph
2942 * @description This factory define a set of helper function to query the service tenancy graph
2943 **/
2944
2945 angular.module('xos.helpers').service('GraphService', ["$q", "Tenants", "Services", function ($q, Tenants, Services) {
2946 var _this = this;
2947
2948 this.loadCoarseData = function () {
2949
2950 var services = void 0;
2951
2952 var deferred = $q.defer();
2953
2954 Services.query().$promise.then(function (res) {
2955 services = res;
2956 return Tenants.query({ kind: 'coarse' }).$promise;
2957 }).then(function (tenants) {
2958 deferred.resolve({
2959 tenants: tenants,
2960 services: services
2961 });
2962 });
2963
2964 return deferred.promise;
2965 };
2966
2967 this.getCoarseGraph = function () {
2968 _this.loadCoarseData().then(function (res) {
2969 console.log(res);
2970 });
2971 return 'ciao';
2972 };
2973 }]);
2974})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07002975//# sourceMappingURL=../maps/services/service_graph.service.js.map
2976
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07002977'use strict';
2978
2979/* eslint-disable angular/ng_window_service*/
2980(function () {
2981 'use strict';
2982
2983 angular.module('xos.helpers').factory('Notification', function () {
2984 return window.Notification;
2985 })
2986 /**
2987 * @ngdoc service
2988 * @name xos.helpers.xosNotification
2989 * @description This factory define a set of helper function to trigger desktop notification
2990 **/
2991 .service('xosNotification', ["$q", "$log", "Notification", function ($q, $log, Notification) {
2992 var _this = this;
2993
2994 this.checkPermission = function () {
2995 var deferred = $q.defer();
2996 Notification.requestPermission().then(function (permission) {
2997 if (permission === 'granted') {
2998 deferred.resolve(permission);
2999 } else {
3000 deferred.reject(permission);
3001 }
3002 });
3003 return deferred.promise;
3004 };
3005
3006 this.sendNotification = function (title, options) {
3007 var notification = new Notification(title, options);
3008 notification.onerror = function (err) {
3009 $log.error(err);
3010 };
3011 };
3012
3013 /**
3014 * @ngdoc method
3015 * @name xos.helpers.xosNotification#notify
3016 * @methodOf xos.helpers.xosNotification
3017 * @description
3018 * This method will check for user permission and if granted will send a browser notification.
3019 * @param {string} title The notification title
3020 * @param {object} options The notification options: `{icon: 'url', body: 'Notification body'}`
3021 **/
3022
3023 this.notify = function (title, options) {
3024 if (!('Notification' in window)) {
3025 $log.info('This browser does not support desktop notification');
3026 } else if (Notification.permission !== 'granted') {
3027 _this.checkPermission().then(function () {
3028 return _this.sendNotification(title, options);
3029 });
3030 } else if (Notification.permission === 'granted') {
3031 _this.sendNotification(title, options);
3032 }
3033 };
3034 }]);
3035})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07003036//# sourceMappingURL=../maps/services/notification.service.js.map
3037
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07003038'use strict';
3039
3040(function () {
3041 'use strict';
3042
3043 /**
3044 * @ngdoc service
3045 * @name xos.helpers.NoHyperlinks
3046 * @description This factory is automatically loaded trough xos.helpers and will add an $http interceptor that will add ?no_hyperlinks=1 to your api request, that is required by django
3047 **/
3048
3049 angular.module('xos.helpers').factory('NoHyperlinks', noHyperlinks);
3050
3051 function noHyperlinks() {
3052 return {
3053 request: function request(_request) {
3054 if (_request.url.indexOf('.html') === -1) {
3055 _request.url += '?no_hyperlinks=1';
3056 }
3057 return _request;
3058 }
3059 };
3060 }
3061})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07003062//# sourceMappingURL=../maps/services/noHyperlinks.interceptor.js.map
3063
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07003064'use strict';
3065
3066// TODO write tests for log
3067
3068/* eslint-disable angular/ng_window_service*/
3069
3070angular.module('xos.helpers').config(['$provide', function ($provide) {
3071 // Use the `decorator` solution to substitute or attach behaviors to
3072 // original service instance; @see angular-mocks for more examples....
3073
3074 $provide.decorator('$log', ['$delegate', function ($delegate) {
3075
3076 var isLogEnabled = function isLogEnabled() {
3077 return window.location.href.indexOf('debug=true') >= 0;
3078 };
3079 // Save the original $log.debug()
3080 var logFn = $delegate.log;
3081 var infoFn = $delegate.info;
3082 var warnFn = $delegate.warn;
3083 //let errorFn = $delegate.error;
3084 var debugFn = $delegate.debug;
3085
3086 // create the replacement function
3087 var replacement = function replacement(fn) {
3088 return function () {
3089 //console.log(`Is Log Enabled: ${isLogEnabled()}`)
3090 if (!isLogEnabled()) {
3091 // console.log('logging is disabled');
3092 return;
3093 }
3094
3095 var args = [].slice.call(arguments);
3096 var now = new Date();
3097
3098 // Prepend timestamp
3099 args[0] = '[' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() + '] ' + args[0];
3100
3101 // HACK awfull fix for angular mock implementation whithin jasmine test failing issue
3102 if (angular.isFunction($delegate.reset) && !($delegate.debug.logs instanceof Array)) {
3103 // if we are within the mock and did not reset yet, we call it to avoid issue
3104 // console.log('mock log impl fix to avoid logs array not existing...');
3105 $delegate.reset();
3106 }
3107
3108 // Call the original with the output prepended with formatted timestamp
3109
3110 return fn.apply(null, args);
3111 };
3112 };
3113
3114 $delegate.info = replacement(infoFn);
3115 $delegate.log = replacement(logFn);
3116 $delegate.warn = replacement(warnFn);
3117 //$delegate.error = replacement(errorFn); // note this will prevent errors to be printed
3118 $delegate.debug = replacement(debugFn);
3119
3120 return $delegate;
3121 }]);
3122}]);
Matteo Scandoloe57712f2016-09-21 15:27:36 -07003123//# sourceMappingURL=../maps/services/log.decorator.js.map
3124
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07003125'use strict';
3126
3127(function () {
3128 'use strict';
3129
3130 /**
3131 * @ngdoc service
3132 * @name xos.helpers.SetCSRFToken
3133 * @description This factory is automatically loaded trough xos.helpers and will add an $http interceptor that will the CSRF-Token to your request headers
3134 **/
3135
3136 setCSRFToken.$inject = ["$cookies"];
3137 angular.module('xos.helpers').factory('SetCSRFToken', setCSRFToken);
3138
3139 function setCSRFToken($cookies) {
3140 return {
3141 request: function request(_request) {
3142 if (_request.method !== 'GET') {
3143 _request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
3144 }
3145 return _request;
3146 }
3147 };
3148 }
3149})();
Matteo Scandoloe57712f2016-09-21 15:27:36 -07003150//# sourceMappingURL=../maps/services/csrfToken.interceptor.js.map
3151
Matteo Scandoloa71ccfd2016-07-22 10:19:15 -07003152/**
3153* @ngdoc overview
3154* @name ngXosLib
3155* @id index
3156* @description
3157* # Welcome to the ngXosLib documentation! <br/>
3158* This is the module that group all the helpers service and UI components for XOS.
3159* <br/><br/>
3160* You can find all the documentation related to the UI Component Library here: <a href="#/module/xos.uiComponents"> xos.uiComponents</a> <br/>
3161* and the documentation related to all the other helpers here: <a href="#/module/xos.helpers"> xos.helpers</a> <br/>
3162* ## Issues
3163* Please report issues at https://jira.opencord.org
3164**/
Matteo Scandoloe57712f2016-09-21 15:27:36 -07003165"use strict";
3166//# sourceMappingURL=maps/index.ngdoc.js.map