Added ngDoc to generated API
diff --git a/views/ngXosLib/apigen/ngResourceTemplate.handlebars b/views/ngXosLib/apigen/ngResourceTemplate.handlebars
index 6048669..6176633 100644
--- a/views/ngXosLib/apigen/ngResourceTemplate.handlebars
+++ b/views/ngXosLib/apigen/ngResourceTemplate.handlebars
@@ -1,14 +1,13 @@
(function() {
'use strict';
- {{#if description}}
-
- /*
- * {{description}}
- */
- {{/if}}
angular.module('{{ngModule}}')
{{#each resources}}
+ /**
+ * @ngdoc service
+ * @name {{../ngModule}}.{{name}}
+ * @description Angular resource to fetch {{param.href}}
+ **/
.service('{{name}}', function($resource){
return $resource('{{param.href}}'{{#if param.name}}, { {{param.name}}: '@id' }{{/if}});
})
diff --git a/views/ngXosLib/gulp/ngXosHelpers.js b/views/ngXosLib/gulp/ngXosHelpers.js
index 407d70e..f833fb8 100644
--- a/views/ngXosLib/gulp/ngXosHelpers.js
+++ b/views/ngXosLib/gulp/ngXosHelpers.js
@@ -4,6 +4,7 @@
var ngAnnotate = require('gulp-ng-annotate');
var angularFilesort = require('gulp-angular-filesort');
var gulpDocs = require('gulp-ngdocs');
+var del = require('del');
module.exports = function(options){
gulp.task('helpers', function(){
@@ -15,15 +16,37 @@
.pipe(gulp.dest(options.ngXosVendor));
});
- gulp.task('docs', function(){
- return gulp.src(options.xosHelperSource + '**/*.js')
- .pipe(gulpDocs.process({
- title: 'XOS Helpers Module',
- scripts: [
- 'http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js',
- 'http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.min.js'
- ]
- }))
- .pipe(gulp.dest('./docs'));
+ gulp.task('cleanDocs', function(){
+ console.log(options);
+ return del([options.docs + '**/*']);
+ });
+
+ gulp.task('docs', ['cleanDocs'], function(){
+ var ngOptions = {
+ scripts: [
+ 'http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js',
+ 'http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-animate.min.js'
+ ],
+ html5Mode: true,
+ title: 'XOS Helpers documentation',
+ startPage: '/module',
+ }
+
+ return gulpDocs.sections({
+ module: {
+ glob: [
+ options.xosHelperSource + '*.js',
+ options.xosHelperSource + 'services/*.js'
+ ],
+ title: 'Module Documentation',
+ },
+ 'rest-api': {
+ glob: [
+ options.xosHelperSource + 'services/rest/*.js'
+ ],
+ api: true,
+ title: 'API Documentation',
+ }
+ }).pipe(gulpDocs.process(ngOptions)).pipe(gulp.dest('./docs'));
});
};
\ No newline at end of file
diff --git a/views/ngXosLib/gulpfile.js b/views/ngXosLib/gulpfile.js
index d893755..bb6bc5e 100644
--- a/views/ngXosLib/gulpfile.js
+++ b/views/ngXosLib/gulpfile.js
@@ -5,7 +5,8 @@
var options = {
ngXosVendor: '../../xos/core/xoslib/static/js/vendor/', //save here the minfied vendor file, this is automatically loaded in the django page
- xosHelperSource: './xosHelpers/src/'
+ xosHelperSource: './xosHelpers/src/',
+ docs: './docs'
};
wrench.readdirSyncRecursive('./gulp')
diff --git a/views/ngXosLib/package.json b/views/ngXosLib/package.json
index 246028f..486db22 100644
--- a/views/ngXosLib/package.json
+++ b/views/ngXosLib/package.json
@@ -7,7 +7,7 @@
"test": "karma start",
"apigen": "node apigen/blueprintToNgResource.js",
"swagger": "node xos-swagger-def.js",
- "doc": "gulp docs; cd ./docs; http-server -o",
+ "doc": "gulp docs; cd ./docs; http-server -o -c-1",
"build": "gulp vendor && gulp helpers"
},
"author": "Matteo Scandolo",
@@ -25,6 +25,7 @@
"devDependencies": {
"babel-preset-es2015": "^6.6.0",
"concat": "^2.0.0",
+ "del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-angular-filesort": "^1.1.1",
"gulp-concat": "^2.6.0",
diff --git a/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js b/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
index 283e90d..5f87de5 100644
--- a/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
+++ b/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
@@ -1,18 +1,24 @@
(function() {
- 'use strict';
+ 'use strict';
- angular
- .module('xos.helpers')
- .factory('SetCSRFToken', setCSRFToken);
+ /**
+ * @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
+ **/
- function setCSRFToken($cookies) {
- return {
- request: function(request){
- if(request.method !== 'GET'){
- request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
- }
- return request;
+ angular
+ .module('xos.helpers')
+ .factory('SetCSRFToken', setCSRFToken);
+
+ function setCSRFToken($cookies) {
+ return {
+ request: function(request){
+ if(request.method !== 'GET'){
+ request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
}
- };
- }
+ return request;
+ }
+ };
+ }
})();
diff --git a/views/ngXosLib/xosHelpers/src/services/noHyperlinks.interceptor.js b/views/ngXosLib/xosHelpers/src/services/noHyperlinks.interceptor.js
index 6059f99..af3dd63 100644
--- a/views/ngXosLib/xosHelpers/src/services/noHyperlinks.interceptor.js
+++ b/views/ngXosLib/xosHelpers/src/services/noHyperlinks.interceptor.js
@@ -1,18 +1,24 @@
(function() {
- 'use strict';
+ 'use strict';
- angular
- .module('xos.helpers')
- .factory('NoHyperlinks', noHyperlinks);
+ /**
+ * @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
+ **/
- function noHyperlinks() {
- return {
- request: function(request){
- if(request.url.indexOf('.html') === -1){
- request.url += '?no_hyperlinks=1';
- }
- return request;
+ angular
+ .module('xos.helpers')
+ .factory('NoHyperlinks', noHyperlinks);
+
+ function noHyperlinks() {
+ return {
+ request: function(request){
+ if(request.url.indexOf('.html') === -1){
+ request.url += '?no_hyperlinks=1';
}
- };
- }
+ return request;
+ }
+ };
+ }
})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Apps.js b/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Apps.js
index 5d0d1ba..8d4c104 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Apps.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Apps.js
@@ -2,6 +2,11 @@
'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', function($resource){
return $resource('/api/tenant/onos/app/');
})
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Services.js b/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Services.js
index 724ce9a..19270e1 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Services.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/ONOS-Services.js
@@ -1,12 +1,12 @@
(function() {
'use strict';
- /*
- * List of the active onos services
-
- */
-
angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.ONOS-Services-Collection
+ * @description Angular resource to fetch /api/service/onos/
+ **/
.service('ONOS-Services-Collection', function($resource){
return $resource('/api/service/onos/');
})
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Subscribers.js b/views/ngXosLib/xosHelpers/src/services/rest/Subscribers.js
index 2605c2a..ebab252 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/Subscribers.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Subscribers.js
@@ -1,30 +1,60 @@
(function() {
'use strict';
- /*
- * Resource related to the CORD Subscribers.
-
- */
-
angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Subscribers
+ * @description Angular resource to fetch /api/tenant/cord/subscriber/:subscriber_id/
+ **/
.service('Subscribers', 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', 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', 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', 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', 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', 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', function($resource){
return $resource('/api/tenant/cord/subscriber/:subscriber_id/features/status/', { subscriber_id: '@id' });
})
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Truckroll.js b/views/ngXosLib/xosHelpers/src/services/rest/Truckroll.js
index e7a631e..9927967 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/Truckroll.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Truckroll.js
@@ -1,12 +1,12 @@
(function() {
'use strict';
- /*
- * Virtual Truckroll, enable to perform basic test on user connectivity such as ping, traceroute and tcpdump.
-
- */
-
angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Truckroll-Collection
+ * @description Angular resource to fetch /api/tenant/truckroll/:truckroll_id/
+ **/
.service('Truckroll-Collection', function($resource){
return $resource('/api/tenant/truckroll/:truckroll_id/', { truckroll_id: '@id' });
})
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Users.js b/views/ngXosLib/xosHelpers/src/services/rest/Users.js
index b8301c7..deb18a4 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/Users.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Users.js
@@ -1,12 +1,12 @@
(function() {
'use strict';
- /*
- * List of the XOS users
-
- */
-
angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Users
+ * @description Angular resource to fetch /api/core/users/
+ **/
.service('Users', function($resource){
return $resource('/api/core/users/');
})
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/vOLT.js b/views/ngXosLib/xosHelpers/src/services/rest/vOLT.js
index 8bac542..f182c06 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/vOLT.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/vOLT.js
@@ -1,12 +1,12 @@
(function() {
'use strict';
- /*
- * OLT devices aggregate a set of subscriber connections
-
- */
-
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', function($resource){
return $resource('/api/tenant/cord/volt/:volt_id/', { volt_id: '@id' });
})
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/vSG.js b/views/ngXosLib/xosHelpers/src/services/rest/vSG.js
index b6af52c..121b5a3 100644
--- a/views/ngXosLib/xosHelpers/src/services/rest/vSG.js
+++ b/views/ngXosLib/xosHelpers/src/services/rest/vSG.js
@@ -2,6 +2,11 @@
'use strict';
angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.vSG-Collection
+ * @description Angular resource to fetch /api/service/vsg/
+ **/
.service('vSG-Collection', function($resource){
return $resource('/api/service/vsg/');
})