alert and pagination
diff --git a/views/ngXosLib/.gitignore b/views/ngXosLib/.gitignore
index 34bf3a1..5df6f2d 100644
--- a/views/ngXosLib/.gitignore
+++ b/views/ngXosLib/.gitignore
@@ -1,4 +1,5 @@
node_modules
bower_components
docs
-xosHelpers/.tmp
\ No newline at end of file
+xosHelpers/.tmp
+xos
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/spec/ui/alert.test.js b/views/ngXosLib/xosHelpers/spec/ui/alert.test.js
new file mode 100644
index 0000000..c67d03a
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/spec/ui/alert.test.js
@@ -0,0 +1,131 @@
+/**
+ * © OpenCORD
+ *
+ * Created by teone on 4/15/16.
+ */
+
+(function () {
+ 'use strict';
+
+ describe('The xos.helper module', function(){
+ describe('The xos-alert component', () => {
+
+ let element, scope, isolatedScope;
+
+ let message = 'Test Error Message';
+
+ beforeEach(module('xos.helpers'));
+
+ it('should throw an error if no config is specified', inject(($compile, $rootScope) => {
+ function errorFunctionWrapper(){
+ $compile(angular.element('<xos-alert></xos-alert>'))($rootScope);
+ $rootScope.$digest();
+ }
+ expect(errorFunctionWrapper).toThrow(new Error('[xosAlert] Please provide a configuration via the "config" attribute'));
+ }));
+
+ describe('when correctly configured', () => {
+ beforeEach(inject(($compile, $rootScope) => {
+
+ scope = $rootScope.$new();
+
+ scope.config = {
+ type: 'danger',
+ closeBtn: true
+ };
+
+ element = angular.element(`<xos-alert config="config">${message}</xos-alert>`);
+ $compile(element)(scope);
+ scope.$digest();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should transclude the message', () => {
+ let textContainer = element[0].getElementsByTagName('p')[0];
+ let text = angular.element(textContainer).text();
+ expect(text).toEqual(message)
+ });
+
+ it('should have a close button', () => {
+ let btn = element[0].getElementsByTagName('button');
+ expect(btn.length).toEqual(1);
+ });
+
+ describe('when the close button is clicked', () => {
+ it('should hide the alert', () => {
+ let btn = element[0].getElementsByTagName('button')[0];
+ btn.click();
+ let alert = angular.element(element[0].querySelectorAll('.alert')[0]);
+ expect(alert.hasClass('ng-hide')).toBeTruthy();
+ });
+ });
+
+ describe('when autoHide is set', () => {
+
+ let to;
+
+ beforeEach(inject(($compile, $rootScope, $timeout) => {
+ scope = $rootScope.$new();
+
+ scope.config = {
+ type: 'danger',
+ closeBtn: true,
+ autoHide: 500
+ };
+
+ to = $timeout;
+
+ element = angular.element(`<xos-alert config="config">${message}</xos-alert>`);
+ $compile(element)(scope);
+ scope.$digest();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should hide the alert', () => {
+ to.flush();
+ expect(isolatedScope.show).toBeFalsy();
+ let alert = angular.element(element[0].querySelectorAll('.alert')[0]);
+ expect(alert.hasClass('ng-hide')).toBeTruthy();
+ });
+ });
+
+ describe('when show is set to false', () => {
+
+ beforeEach(inject(($compile, $rootScope) => {
+ scope = $rootScope.$new();
+
+ scope.config = {
+ type: 'danger',
+ closeBtn: true
+ };
+
+ scope.show = false;
+
+ element = angular.element(`<xos-alert config="config" show="show">${message}</xos-alert>`);
+ $compile(element)(scope);
+ scope.$digest();
+ isolatedScope = element.isolateScope().vm;
+ }));
+
+ it('should hide the alert', () => {
+ let alert = angular.element(element[0].querySelectorAll('.alert')[0]);
+ expect(alert.hasClass('ng-hide')).toBeTruthy();
+ });
+
+ describe('when show is changed to true', () => {
+ beforeEach(() => {
+ scope.show = true;
+ scope.$digest();
+ });
+
+ it('should show the alert', () => {
+ let alert = angular.element(element[0].querySelectorAll('.alert')[0]);
+ expect(alert.hasClass('ng-hide')).toBeFalsy();
+ });
+ });
+ });
+
+ });
+ });
+ });
+})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/table/alert.component.js b/views/ngXosLib/xosHelpers/src/ui_components/table/alert.component.js
new file mode 100644
index 0000000..7d7a026
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/ui_components/table/alert.component.js
@@ -0,0 +1,145 @@
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 4/15/16.
+ */
+
+(function () {
+ 'use strict';
+
+ angular.module('xos.uiComponents')
+
+ /**
+ * @ngdoc directive
+ * @name xos.uiComponents.directive:xosAlert
+ * @restrict E
+ * @description The xos-alert directive
+ * @param {Object} config The configuration object
+ * ```
+ * {
+ * type: 'danger', //info, success, warning
+ * closeBtn: true, //default false
+ * autoHide: 3000 //delay to automatically hide the alert
+ * }
+ * ```
+ * @param {Boolean=} show Binding to show and hide the alert, default to true
+ * @element ANY
+ * @scope
+ * @example
+ <example module="sampleAlert1">
+ <file name="index.html">
+ <div ng-controller="SampleCtrl1 as vm">
+ <xos-alert config="vm.config1">
+ A sample alert message
+ </xos-alert>
+ <xos-alert config="vm.config2">
+ A sample alert message (with close button)
+ </xos-alert>
+ <xos-alert config="vm.config3">
+ A sample info message
+ </xos-alert>
+ <xos-alert config="vm.config4">
+ A sample success message
+ </xos-alert>
+ <xos-alert config="vm.config5">
+ A sample warning message
+ </xos-alert>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('sampleAlert1', ['xos.uiComponents'])
+ .controller('SampleCtrl1', function(){
+ this.config1 = {
+ type: 'danger'
+ };
+
+ this.config2 = {
+ type: 'danger',
+ closeBtn: true
+ };
+
+ this.config3 = {
+ type: 'info'
+ };
+
+ this.config4 = {
+ type: 'success'
+ };
+
+ this.config5 = {
+ type: 'warning'
+ };
+ });
+ </file>
+ </example>
+
+ <example module="sampleAlert2">
+ <file name="index.html">
+ <div ng-controller="SampleCtrl as vm" class="row">
+ <div class="col-sm-4">
+ <a class="btn btn-default btn-block" ng-show="!vm.show" ng-click="vm.show = true">Show Alert</a>
+ <a class="btn btn-default btn-block" ng-show="vm.show" ng-click="vm.show = false">Hide Alert</a>
+ </div>
+ <div class="col-sm-8">
+ <xos-alert config="vm.config1" show="vm.show">
+ A sample alert message, not displayed by default.
+ </xos-alert>
+ </div>
+ </div>
+ </file>
+ <file name="script.js">
+ angular.module('sampleAlert2', ['xos.uiComponents'])
+ .controller('SampleCtrl', function(){
+ this.config1 = {
+ type: 'success'
+ };
+
+ this.show = false;
+ });
+ </file>
+ </example>
+ **/
+
+ .directive('xosAlert', function(){
+ return {
+ restrict: 'E',
+ scope: {
+ config: '=',
+ show: '=?'
+ },
+ template: `
+ <div class="alert alert-{{vm.config.type}}" ng-show="vm.show">
+ <button type="button" class="close" ng-if="vm.config.closeBtn" ng-click="vm.dismiss()">
+ <span aria-hidden="true">×</span>
+ </button>
+ <p ng-transclude></p>
+ </div>
+ `,
+ transclude: true,
+ bindToController: true,
+ controllerAs: 'vm',
+ controller: function($timeout){
+
+ if(!this.config){
+ throw new Error('[xosAlert] Please provide a configuration via the "config" attribute');
+ }
+
+ // default the value to true
+ this.show = this.show !== false;
+
+ this.dismiss = () => {
+ this.show = false;
+ }
+
+ if(this.config.autoHide){
+ let to = $timeout(() => {
+ this.dismiss();
+ $timeout.cancel(to);
+ }, this.config.autoHide);
+ }
+ }
+ }
+ })
+})();
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/table/pagination.component.js b/views/ngXosLib/xosHelpers/src/ui_components/table/pagination.component.js
index 6266303..b7b1701 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/table/pagination.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/table/pagination.component.js
@@ -106,7 +106,6 @@
this.pages = Math.ceil(this.totalElements / this.pageSize);
this.pageList = this.createPages(this.pages);
}
- // scope.getPages();
});
}
}
diff --git a/views/ngXosViews/sampleView/src/js/main.js b/views/ngXosViews/sampleView/src/js/main.js
index 798cb0e..b00aa0b 100644
--- a/views/ngXosViews/sampleView/src/js/main.js
+++ b/views/ngXosViews/sampleView/src/js/main.js
@@ -59,6 +59,12 @@
// }
};
+ this.alertConfig = {
+ type: 'danger',
+ closeBtn: true
+ }
+
+
// retrieving user list
Users.query().$promise
.then((users) => {
diff --git a/views/ngXosViews/sampleView/src/templates/users-list.tpl.html b/views/ngXosViews/sampleView/src/templates/users-list.tpl.html
index 10d7208..c0c58cb 100644
--- a/views/ngXosViews/sampleView/src/templates/users-list.tpl.html
+++ b/views/ngXosViews/sampleView/src/templates/users-list.tpl.html
@@ -5,6 +5,8 @@
</div>
</div>
+ <xos-alert config="vm.alertConfig">Alert message Here</xos-alert>
+
<div class="row">
<div class="col-xs-12">
<xos-table data="vm.users" config="vm.tableConfig"></xos-table>
diff --git a/xos/core/xoslib/static/js/vendor/ngXosHelpers.js b/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
index 3722b8a..f981551 100644
--- a/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
+++ b/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
@@ -1,598 +1 @@
-'use strict';
-
-/**
- * © OpenCORD
- *
- * Visit http://guide.xosproject.org/devguide/addview/ for more information
- *
- * Created by teone on 3/24/16.
- */
-
-(function () {
- 'use strict';
-
- /**
- * @ngdoc overview
- * @name xos.uiComponents
- * @description A collection of UI components useful for Dashboard development
- **/
-
- angular.module('xos.uiComponents', []);
-})();
-//# sourceMappingURL=../maps/ui_components/ui-components.module.js.map
-
-'use strict';
-
-/**
- * © OpenCORD
- *
- * Visit http://guide.xosproject.org/devguide/addview/ for more information
- *
- * Created by teone on 3/24/16.
- */
-
-(function () {
- 'use strict';
-
- angular.module('xos.uiComponents')
-
- /**
- * @ngdoc directive
- * @name xos.uiComponents.directive:xosTable
- * @restrict E
- * @description The xos-table directive
- * @param {Object} config The configuration for the component.
- * ```
- * {
- * columns: [
- * {
- * label: 'Human readable name',
- * prop: 'Property to read in the model object'
- * }
- * ],
- * classes: 'table table-striped table-bordered',
- * actions: [ // if defined add an action column
- {
- label: 'delete',
- icon: 'remove', // refers to bootstraps glyphicon
- cb: (user) => { // receive the model
- console.log(user);
- },
- color: 'red'
- }
- ],
- filter: 'field', // can be by `field` or `fulltext`
- order: true // whether to show ordering arrows
- * }
- * ```
- * @param {Array} data The data that should be rendered
- * @element ANY
- * @scope
- * @example
- <example module="sampleTable1">
- <file name="index.html">
- <div ng-controller="SampleCtrl1 as vm">
- <xos-table data="vm.data" config="vm.config"></xos-table>
- </div>
- </file>
- <file name="script.js">
- angular.module('sampleTable1', ['xos.uiComponents'])
- .controller('SampleCtrl1', function(){
- this.config = {
- columns: [
- {
- label: 'First Name', // column title
- prop: 'name' // property to read in the data array
- },
- {
- label: 'Last Name',
- prop: 'lastname'
- }
- ]
- };
- this.data = [
- {
- name: 'John',
- lastname: 'Doe'
- },
- {
- name: 'Gili',
- lastname: 'Fereydoun'
- }
- ]
- });
- </file>
- </example>
- <example module="sampleTable2">
- <file name="index.html">
- <div ng-controller="SampleCtrl2 as vm">
- <xos-table data="vm.data" config="vm.config"></xos-table>
- </div>
- </file>
- <file name="script.js">
- angular.module('sampleTable2', ['xos.uiComponents'])
- .controller('SampleCtrl2', function(){
- this.config = {
- columns: [
- {
- label: 'First Name', // column title
- prop: 'name' // property to read in the data array
- },
- {
- label: 'Last Name',
- prop: 'lastname'
- }
- ],
- classes: 'table table-striped table-condensed', // table classes, default to `table table-striped table-bordered`
- actions: [ // if defined add an action column
- {
- label: 'delete', // label
- icon: 'remove', // icons, refers to bootstraps glyphicon
- cb: (user) => { // callback, get feeded with the full object
- console.log(user);
- },
- color: 'red' // icon color
- }
- ],
- filter: 'field', // can be by `field` or `fulltext`
- order: true
- };
- this.data = [
- {
- name: 'John',
- lastname: 'Doe'
- },
- {
- name: 'Gili',
- lastname: 'Fereydoun'
- }
- ]
- });
- </file>
- </example>
- <example module="sampleTable3">
- <file name="index.html">
- <div ng-controller="SampleCtrl3 as vm">
- <xos-table data="vm.data" config="vm.config"></xos-table>
- </div>
- </file>
- <file name="script.js">
- angular.module('sampleTable3', ['xos.uiComponents'])
- .controller('SampleCtrl3', function(){
- this.config = {
- columns: [
- {
- label: 'First Name', // column title
- prop: 'name' // property to read in the data array
- },
- {
- label: 'Last Name',
- prop: 'lastname'
- }
- ],
- pagination: {
- pageSize: 2
- }
- };
- this.data = [
- {
- name: 'John',
- lastname: 'Doe'
- },
- {
- name: 'Gili',
- lastname: 'Fereydoun'
- },
- {
- name: 'Lucky',
- lastname: 'Clarkson'
- },
- {
- name: 'Tate',
- lastname: 'Spalding'
- }
- ]
- });
- </file>
- </example>
- **/
-
- .directive('xosTable', function () {
- return {
- restrict: 'E',
- scope: {
- data: '=',
- config: '='
- },
- template: '\n <div ng-show="vm.data.length > 0">\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-show="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 class="form-control"\n placeholder="Type to search by {{col.label}}"\n type="text"\n ng-model="vm.query[col.prop]"/>\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 | 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">{{item[col.prop]}}</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">\n <div class="alert alert-info">\n No data to show.\n </div>\n </div>\n ',
- bindToController: true,
- controllerAs: 'vm',
- controller: function controller() {
- var _this = this;
-
- if (!this.config) {
- throw new Error('[xosTable] Please provide a configuration via the "config" attribute');
- }
-
- if (!this.config.columns) {
- throw new Error('[xosTable] Please provide a columns list in the configuration');
- }
-
- this.columns = this.config.columns;
- this.classes = this.config.classes || 'table table-striped table-bordered';
-
- if (this.config.actions) {
- // TODO validate action format
- }
- if (this.config.pagination) {
- this.currentPage = 0;
- this.goToPage = function (n) {
- _this.currentPage = n;
- };
- }
- }
- };
- });
-})();
-//# sourceMappingURL=../../maps/ui_components/table/table.component.js.map
-
-'use strict';
-
-/**
- * © OpenCORD
- *
- * Visit http://guide.xosproject.org/devguide/addview/ for more information
- *
- * Created by teone on 4/15/16.
- */
-
-(function () {
- 'use strict';
-
- angular.module('xos.uiComponents')
-
- /**
- * @ngdoc directive
- * @name xos.uiComponents.directive:xosPagination
- * @restrict E
- * @description The xos-table directive
- * @param {Number} pageSize Number of elements per page
- * @param {Number} totalElements Number of total elements in the collection
- * @param {Function} change The callback to be triggered on page change.
- * * @element ANY
- * @scope
- * @example
- <example module="samplePagination">
- <file name="index.html">
- <div ng-controller="SampleCtrl1 as vm">
- <xos-pagination
- page-size="vm.pageSize"
- total-elements="vm.totalElements"
- change="vm.change">
- </xos-pagination>
- </div>
- </file>
- <file name="script.js">
- angular.module('samplePagination', ['xos.uiComponents'])
- .controller('SampleCtrl1', function(){
- this.pageSize = 10;
- this.totalElements = 35;
- this.change = (pageNumber) => {
- console.log(pageNumber);
- }
- });
- </file>
- </example>
- **/
-
- .directive('xosPagination', function () {
- return {
- restrict: 'E',
- scope: {
- pageSize: '=',
- totalElements: '=',
- change: '='
- },
- 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">«</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">»</span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n ',
- bindToController: true,
- controllerAs: 'vm',
- controller: ["$scope", function controller($scope) {
- var _this = this;
-
- this.currentPage = 0;
-
- this.goToPage = function (n) {
- if (n < 0 || n === _this.pages) {
- return;
- }
- _this.currentPage = n;
- _this.change(n);
- };
-
- this.createPages = function (pages) {
- var arr = [];
- for (var i = 0; i < pages; i++) {
- arr.push(i);
- }
- return arr;
- };
-
- // watch for data changes
- $scope.$watch(function () {
- return _this.totalElements;
- }, function () {
- if (_this.totalElements) {
- _this.pages = Math.ceil(_this.totalElements / _this.pageSize);
- _this.pageList = _this.createPages(_this.pages);
- }
- // scope.getPages();
- });
- }]
- };
- }).filter('pagination', function () {
- return function (input, start) {
- if (!input || !angular.isArray(input)) {
- return input;
- }
- start = parseInt(start, 10);
- return input.slice(start);
- };
- });
-})();
-//# sourceMappingURL=../../maps/ui_components/table/pagination.component.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- config.$inject = ["$httpProvider", "$interpolateProvider", "$resourceProvider"];
- angular.module('bugSnag', []).factory('$exceptionHandler', function () {
- return function (exception, cause) {
- if (window.Bugsnag) {
- Bugsnag.notifyException(exception, { diagnostics: { cause: cause } });
- } else {
- console.error(exception, cause, exception.stack);
- }
- };
- });
-
- /**
- * @ngdoc overview
- * @name xos.helpers
- * @description this is the module that group all the helpers service and components for XOS
- **/
-
- angular.module('xos.helpers', ['ngCookies', 'ngResource', 'bugSnag', 'xos.uiComponents']).config(config);
-
- function config($httpProvider, $interpolateProvider, $resourceProvider) {
- $httpProvider.interceptors.push('SetCSRFToken');
-
- $interpolateProvider.startSymbol('{$');
- $interpolateProvider.endSymbol('$}');
-
- // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
- $resourceProvider.defaults.stripTrailingSlashes = false;
- }
-})();
-//# sourceMappingURL=maps/xosHelpers.module.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.vSG-Collection
- * @description Angular resource to fetch /api/service/vsg/
- **/
- .service('vSG-Collection', ["$resource", function ($resource) {
- return $resource('/api/service/vsg/');
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/vSG.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.vOLT-Collection
- * @description Angular resource to fetch /api/tenant/cord/volt/:volt_id/
- **/
- .service('vOLT-Collection', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/volt/:volt_id/', { volt_id: '@id' });
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/vOLT.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.Users
- * @description Angular resource to fetch /api/core/users/
- **/
- .service('Users', ["$resource", function ($resource) {
- return $resource('/api/core/users/');
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/Users.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.Truckroll-Collection
- * @description Angular resource to fetch /api/tenant/truckroll/:truckroll_id/
- **/
- .service('Truckroll-Collection', ["$resource", function ($resource) {
- return $resource('/api/tenant/truckroll/:truckroll_id/', { truckroll_id: '@id' });
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/Truckroll.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.Subscribers
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/
- **/
- .service('Subscribers', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/', { subscriber_id: '@id' });
- }])
- /**
- * @ngdoc service
- * @name xos.helpers.Subscriber-features
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/features/
- **/
- .service('Subscriber-features', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/', { subscriber_id: '@id' });
- }])
- /**
- * @ngdoc service
- * @name xos.helpers.Subscriber-features-uplink_speed
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/features/uplink_speed/
- **/
- .service('Subscriber-features-uplink_speed', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/uplink_speed/', { subscriber_id: '@id' });
- }])
- /**
- * @ngdoc service
- * @name xos.helpers.Subscriber-features-downlink_speed
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/features/downlink_speed/
- **/
- .service('Subscriber-features-downlink_speed', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/downlink_speed/', { subscriber_id: '@id' });
- }])
- /**
- * @ngdoc service
- * @name xos.helpers.Subscriber-features-cdn
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/features/cdn/
- **/
- .service('Subscriber-features-cdn', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/cdn/', { subscriber_id: '@id' });
- }])
- /**
- * @ngdoc service
- * @name xos.helpers.Subscriber-features-uverse
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/features/uverse/
- **/
- .service('Subscriber-features-uverse', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/uverse/', { subscriber_id: '@id' });
- }])
- /**
- * @ngdoc service
- * @name xos.helpers.Subscriber-features-status
- * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/features/status/
- **/
- .service('Subscriber-features-status', ["$resource", function ($resource) {
- return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/status/', { subscriber_id: '@id' });
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/Subscribers.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.ONOS-Services-Collection
- * @description Angular resource to fetch /api/service/onos/
- **/
- .service('ONOS-Services-Collection', ["$resource", function ($resource) {
- return $resource('/api/service/onos/');
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/ONOS-Services.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- angular.module('xos.helpers')
- /**
- * @ngdoc service
- * @name xos.helpers.ONOS-App-Collection
- * @description Angular resource to fetch /api/tenant/onos/app/
- **/
- .service('ONOS-App-Collection', ["$resource", function ($resource) {
- return $resource('/api/tenant/onos/app/');
- }]);
-})();
-//# sourceMappingURL=../../maps/services/rest/ONOS-Apps.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- /**
- * @ngdoc service
- * @name xos.helpers.NoHyperlinks
- * @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
- **/
-
- angular.module('xos.helpers').factory('NoHyperlinks', noHyperlinks);
-
- function noHyperlinks() {
- return {
- request: function request(_request) {
- if (_request.url.indexOf('.html') === -1) {
- _request.url += '?no_hyperlinks=1';
- }
- return _request;
- }
- };
- }
-})();
-//# sourceMappingURL=../maps/services/noHyperlinks.interceptor.js.map
-
-'use strict';
-
-(function () {
- 'use strict';
-
- /**
- * @ngdoc service
- * @name xos.helpers.SetCSRFToken
- * @description This factory is automatically loaded trough xos.helpers and will add an $http interceptor that will the CSRF-Token to your request headers
- **/
-
- setCSRFToken.$inject = ["$cookies"];
- angular.module('xos.helpers').factory('SetCSRFToken', setCSRFToken);
-
- function setCSRFToken($cookies) {
- return {
- request: function request(_request) {
- if (_request.method !== 'GET') {
- _request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
- }
- return _request;
- }
- };
- }
-})();
-//# sourceMappingURL=../maps/services/csrfToken.interceptor.js.map
+"use strict";!function(){angular.module("xos.uiComponents",[])}(),function(){angular.module("xos.uiComponents").directive("xosTable",function(){return{restrict:"E",scope:{data:"=",config:"="},template:'\n <div ng-show="vm.data.length > 0">\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-show="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 class="form-control"\n placeholder="Type to search by {{col.label}}"\n type="text"\n ng-model="vm.query[col.prop]"/>\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 | 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">{{item[col.prop]}}</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">\n <div class="alert alert-info">\n No data to show.\n </div>\n </div>\n ',bindToController:!0,controllerAs:"vm",controller:function(){var n=this;if(!this.config)throw new Error('[xosTable] Please provide a configuration via the "config" attribute');if(!this.config.columns)throw new Error("[xosTable] Please provide a columns list in the configuration");this.columns=this.config.columns,this.classes=this.config.classes||"table table-striped table-bordered",this.config.actions,this.config.pagination&&(this.currentPage=0,this.goToPage=function(e){n.currentPage=e})}}})}(),function(){angular.module("xos.uiComponents").directive("xosPagination",function(){return{restrict:"E",scope:{pageSize:"=",totalElements:"=",change:"="},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">«</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">»</span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n ',bindToController:!0,controllerAs:"vm",controller:["$scope",function(n){var e=this;this.currentPage=0,this.goToPage=function(n){0>n||n===e.pages||(e.currentPage=n,e.change(n))},this.createPages=function(n){for(var e=[],r=0;n>r;r++)e.push(r);return e},n.$watch(function(){return e.totalElements},function(){e.totalElements&&(e.pages=Math.ceil(e.totalElements/e.pageSize),e.pageList=e.createPages(e.pages))})}]}}).filter("pagination",function(){return function(n,e){return n&&angular.isArray(n)?(e=parseInt(e,10),n.slice(e)):n}})}(),function(){angular.module("xos.uiComponents").directive("xosAlert",function(){return{restrict:"E",scope:{config:"=",show:"=?"},template:'\n <div class="alert alert-{{vm.config.type}}" ng-show="vm.show">\n <button type="button" class="close" ng-if="vm.config.closeBtn" ng-click="vm.dismiss()">\n <span aria-hidden="true">×</span>\n </button>\n <p ng-transclude></p>\n </div>\n ',transclude:!0,bindToController:!0,controllerAs:"vm",controller:["$timeout",function(n){var e=this;if(!this.config)throw new Error('[xosAlert] Please provide a configuration via the "config" attribute');this.show=this.show!==!1,this.dismiss=function(){e.show=!1},this.config.autoHide&&!function(){var r=n(function(){e.dismiss(),n.cancel(r)},e.config.autoHide)}()}]}})}(),function(){function n(n,e,r){n.interceptors.push("SetCSRFToken"),e.startSymbol("{$"),e.endSymbol("$}"),r.defaults.stripTrailingSlashes=!1}n.$inject=["$httpProvider","$interpolateProvider","$resourceProvider"],angular.module("bugSnag",[]).factory("$exceptionHandler",function(){return function(n,e){window.Bugsnag?Bugsnag.notifyException(n,{diagnostics:{cause:e}}):console.error(n,e,n.stack)}}),angular.module("xos.helpers",["ngCookies","ngResource","bugSnag","xos.uiComponents"]).config(n)}(),function(){angular.module("xos.helpers").service("vSG-Collection",["$resource",function(n){return n("/api/service/vsg/")}])}(),function(){angular.module("xos.helpers").service("vOLT-Collection",["$resource",function(n){return n("/api/tenant/cord/volt/:volt_id/",{volt_id:"@id"})}])}(),function(){angular.module("xos.helpers").service("Users",["$resource",function(n){return n("/api/core/users/")}])}(),function(){angular.module("xos.helpers").service("Truckroll-Collection",["$resource",function(n){return n("/api/tenant/truckroll/:truckroll_id/",{truckroll_id:"@id"})}])}(),function(){angular.module("xos.helpers").service("Subscribers",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/",{subscriber_id:"@id"})}]).service("Subscriber-features",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/features/",{subscriber_id:"@id"})}]).service("Subscriber-features-uplink_speed",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/features/uplink_speed/",{subscriber_id:"@id"})}]).service("Subscriber-features-downlink_speed",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/features/downlink_speed/",{subscriber_id:"@id"})}]).service("Subscriber-features-cdn",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/features/cdn/",{subscriber_id:"@id"})}]).service("Subscriber-features-uverse",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/features/uverse/",{subscriber_id:"@id"})}]).service("Subscriber-features-status",["$resource",function(n){return n("/api/tenant/cord/subscriber/:subscriber_id/features/status/",{subscriber_id:"@id"})}])}(),function(){angular.module("xos.helpers").service("ONOS-Services-Collection",["$resource",function(n){return n("/api/service/onos/")}])}(),function(){angular.module("xos.helpers").service("ONOS-App-Collection",["$resource",function(n){return n("/api/tenant/onos/app/")}])}(),function(){function n(){return{request:function(n){return-1===n.url.indexOf(".html")&&(n.url+="?no_hyperlinks=1"),n}}}angular.module("xos.helpers").factory("NoHyperlinks",n)}(),function(){function n(n){return{request:function(e){return"GET"!==e.method&&(e.headers["X-CSRFToken"]=n.get("xoscsrftoken")),e}}}n.$inject=["$cookies"],angular.module("xos.helpers").factory("SetCSRFToken",n)}();
\ No newline at end of file