Added form to smart table
diff --git a/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js b/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js
index e8cc030..bcc34e1 100644
--- a/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js
+++ b/views/ngXosLib/xosHelpers/spec/ui/smart-table.test.js
@@ -30,6 +30,9 @@
this.query = jasmine.createSpy('query').and.callFake(() => {
return {$promise: {then: (cb) => cb(mockData)}};
});
+ this.delete = jasmine.createSpy('delete').and.callFake(() => {
+ return {$promise: {then: (cb) => cb({})}};
+ });
});
$provide.service('EmptyResource', function(){
@@ -62,9 +65,40 @@
});
it('should hide hidden fields', () => {
- expect($(element).find('thead th').length).toEqual(2);
+ // the 4th field is the mocked save method
+ expect($(element).find('thead th').length).toEqual(3);
expect($(element).find('thead th')[0]).toContainText('First name:');
expect($(element).find('thead th')[1]).toContainText('Last name:');
+ expect($(element).find('thead th')[2]).toContainText('Actions:');
+ });
+
+ it('should delete a model', () => {
+ $(element).find('a[title="delete"]')[0].click();
+ expect(spy.delete).toHaveBeenCalledWith({id: mockData[0].id});
+ expect($(element).find('.alert')).toContainText(`MockResource with id ${mockData[0].id} successfully deleted`);
+ });
+
+ it('should show the form', () => {
+ expect($(element).find('.panel')[0]).toHaveClass('ng-hide');
+ $(element).find('a[title="details"]')[0].click();
+ expect($(element).find('.panel')).not.toHaveClass('ng-hide');
+ });
+
+ it('should save an item', () => {
+ const saveMethod = jasmine.createSpy('$save').and.callFake(() => {
+ return {then: (cb) => cb(mockData[0])};
+ });
+ let model = {
+ id: 1,
+ first_name: 'Jon',
+ last_name: 'Snow',
+ hidden_field: 'hidden',
+ $save: saveMethod
+ };
+ isolatedScope.detailedItem = model;
+ scope.$apply();
+ $(element).find('xos-form .btn.btn-success').click();
+ expect(saveMethod).toHaveBeenCalled();
});
describe('when fetching an empty collection', () => {
diff --git a/views/ngXosLib/xosHelpers/src/services/rest/Instances.js b/views/ngXosLib/xosHelpers/src/services/rest/Instances.js
new file mode 100644
index 0000000..2e74f33
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/services/rest/Instances.js
@@ -0,0 +1,13 @@
+(function() {
+ 'use strict';
+
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Instances
+ * @description Angular resource to fetch /api/core/instances/
+ **/
+ .service('Instances', function($resource){
+ return $resource('/api/core/instances/');
+ })
+})();
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
index 7eb837e..745c3ca 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/table/table.component.js
@@ -210,7 +210,7 @@
</a>
</span>
</th>
- <th ng-if="vm.config.actions">Actions</th>
+ <th ng-if="vm.config.actions">Actions:</th>
</tr>
</thead>
<tbody ng-if="vm.config.filter == 'field'">
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
index 4a0ecd9..734c54b 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/smartComponents/smartTable/smartTable.component.js
@@ -28,26 +28,53 @@
config: '='
},
template: `
+ <pre>{{vm.responseErr}}</pre>
<xos-table config="vm.tableConfig" data="vm.data"></xos-table>
+ <div class="panel panel-default" ng-show="vm.detailedItem">
+ <div class="panel-heading">
+ <h3 class="panel-title">Update {{vm.config.resource}} {{vm.detailedItem.id}}</h3>
+ </div>
+ <div class="panel-body">
+ <xos-form config="vm.formConfig" ng-model="vm.detailedItem"></xos-form>
+ </div>
+ </div>
+ <xos-alert config="{type: 'success', closeBtn: true}" show="vm.responseMsg">{{vm.responseMsg}}</xos-alert>
+ <xos-alert config="{type: 'danger', closeBtn: true}" show="vm.responseErr">{{vm.responseErr}}</xos-alert>
`,
bindToController: true,
controllerAs: 'vm',
controller: function($injector, LabelFormatter, _){
+ this.responseMsg = false;
+ this.responseErr = false;
+
this.tableConfig = {
columns: [
],
- // actions: [
- // {
- // label: 'delete',
- // icon: 'remove',
- // cb: (user) => {
- // console.log(user);
- // // _.remove(this.users, {id: user.id});
- // },
- // color: 'red'
- // }
- // ],
+ actions: [
+ {
+ label: 'delete',
+ icon: 'remove',
+ cb: (item) => {
+ this.Resource.delete({id: item.id}).$promise
+ .then(() => {
+ console.log(this.config.resource);
+ this.responseMsg = `${this.config.resource} with id ${item.id} successfully deleted`;
+ })
+ .catch(err => {
+ this.responseErr = err.data.detail || `Error while deleting ${this.config.resource} with id ${item.id}`;
+ });
+ },
+ color: 'red'
+ },
+ {
+ label: 'details',
+ icon: 'search',
+ cb: (item) => {
+ this.detailedItem = item;
+ }
+ }
+ ],
classes: 'table table-striped table-bordered table-responsive',
filter: 'field',
order: true,
@@ -56,6 +83,27 @@
}
};
+ this.formConfig = {
+ exclude: this.config.hiddenFields,
+ formName: `${this.config.resource}Form`,
+ actions: [
+ {
+ label: 'Save',
+ icon: 'ok',
+ cb: (item) => {
+ item.$save()
+ .then(() => {
+ this.responseMsg = `${this.config.resource} with id ${item.id} successfully saved`;
+ })
+ .catch((err) => {
+ this.responseErr = err.data.detail || `Error while saving ${this.config.resource} with id ${item.id}`;
+ })
+ },
+ class: 'success'
+ }
+ ]
+ }
+
this.Resource = $injector.get(this.config.resource);
this.Resource.query().$promise
@@ -71,6 +119,7 @@
return p == 'id' || p == 'password' || p == 'validators'
});
+ // TODO move out cb
if(angular.isArray(this.config.hiddenFields)){
props = _.difference(props, this.config.hiddenFields)
}
diff --git a/views/ngXosViews/sampleView/src/js/main.js b/views/ngXosViews/sampleView/src/js/main.js
index 790eb49..5d6ff39 100644
--- a/views/ngXosViews/sampleView/src/js/main.js
+++ b/views/ngXosViews/sampleView/src/js/main.js
@@ -61,7 +61,19 @@
this.smartTableConfig = {
resource: 'Users',
- hiddenFields: ['last_login']
+ hiddenFields: [
+ 'email',
+ 'username',
+ 'created',
+ 'updated',
+ 'last_login',
+ 'is_active',
+ 'is_admin',
+ 'is_staff',
+ 'is_readonly',
+ 'is_registering',
+ 'is_appuser'
+ ]
}
this.alertConfig = {
diff --git a/xos/core/xoslib/static/js/vendor/ngXosHelpers.js b/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
index 0dd6043..5f8e245 100644
--- a/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
+++ b/xos/core/xoslib/static/js/vendor/ngXosHelpers.js
@@ -52,25 +52,36 @@
scope: {
config: '='
},
- template: '\n <xos-table config="vm.tableConfig" data="vm.data"></xos-table>\n ',
+ template: '\n <pre>{{vm.responseErr}}</pre>\n <xos-table config="vm.tableConfig" data="vm.data"></xos-table>\n <div class="panel panel-default" ng-show="vm.detailedItem">\n <div class="panel-heading">\n <h3 class="panel-title">Update {{vm.config.resource}} {{vm.detailedItem.id}}</h3>\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 ',
bindToController: true,
controllerAs: 'vm',
controller: ["$injector", "LabelFormatter", "_", function controller($injector, LabelFormatter, _) {
var _this = this;
+ this.responseMsg = false;
+ this.responseErr = false;
+
this.tableConfig = {
columns: [],
- // actions: [
- // {
- // label: 'delete',
- // icon: 'remove',
- // cb: (user) => {
- // console.log(user);
- // // _.remove(this.users, {id: user.id});
- // },
- // color: 'red'
- // }
- // ],
+ actions: [{
+ label: 'delete',
+ icon: 'remove',
+ cb: function cb(item) {
+ _this.Resource.delete({ id: item.id }).$promise.then(function () {
+ console.log(_this.config.resource);
+ _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully deleted';
+ }).catch(function (err) {
+ _this.responseErr = err.data.detail || 'Error while deleting ' + _this.config.resource + ' with id ' + item.id;
+ });
+ },
+ color: 'red'
+ }, {
+ label: 'details',
+ icon: 'search',
+ cb: function cb(item) {
+ _this.detailedItem = item;
+ }
+ }],
classes: 'table table-striped table-bordered table-responsive',
filter: 'field',
order: true,
@@ -79,6 +90,23 @@
}
};
+ this.formConfig = {
+ exclude: this.config.hiddenFields,
+ formName: this.config.resource + 'Form',
+ actions: [{
+ label: 'Save',
+ icon: 'ok',
+ cb: function cb(item) {
+ item.$save().then(function () {
+ _this.responseMsg = _this.config.resource + ' with id ' + item.id + ' successfully saved';
+ }).catch(function (err) {
+ _this.responseErr = err.data.detail || 'Error while saving ' + _this.config.resource + ' with id ' + item.id;
+ });
+ },
+ class: 'success'
+ }]
+ };
+
this.Resource = $injector.get(this.config.resource);
this.Resource.query().$promise.then(function (res) {
@@ -93,6 +121,7 @@
return p == 'id' || p == 'password' || p == 'validators';
});
+ // TODO move out cb
if (angular.isArray(_this.config.hiddenFields)) {
props = _.difference(props, _this.config.hiddenFields);
}
@@ -393,7 +422,7 @@
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-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 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 <xos-alert config="{type: \'info\'}">\n No data to show.\n </xos-alert>\n </div>\n ',
+ 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-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 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 <xos-alert config="{type: \'info\'}">\n No data to show.\n </xos-alert>\n </div>\n ',
bindToController: true,
controllerAs: 'vm',
controller: function controller() {
@@ -531,145 +560,6 @@
'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: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" animations="true">
- <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', 'ngAnimate'])
- .controller('SampleCtrl', function(){
- this.config1 = {
- type: 'success'
- };
- this.show = false;
- });
- </file>
- </example>
- **/
-
- .directive('xosAlert', function () {
- return {
- restrict: 'E',
- scope: {
- config: '=',
- show: '=?'
- },
- 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">×</span>\n </button>\n <p ng-transclude></p>\n </div>\n ',
- transclude: true,
- bindToController: true,
- controllerAs: 'vm',
- controller: ["$timeout", function controller($timeout) {
- var _this = this;
-
- 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 = function () {
- _this.show = false;
- };
-
- if (this.config.autoHide) {
- (function () {
- var to = $timeout(function () {
- _this.dismiss();
- $timeout.cancel(to);
- }, _this.config.autoHide);
- })();
- }
- }]
- };
- });
-})();
-//# sourceMappingURL=../../../maps/ui_components/dumbComponents/alert/alert.component.js.map
-
-'use strict';
-
var _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; };
/**
@@ -859,6 +749,145 @@
'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: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" animations="true">
+ <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', 'ngAnimate'])
+ .controller('SampleCtrl', function(){
+ this.config1 = {
+ type: 'success'
+ };
+ this.show = false;
+ });
+ </file>
+ </example>
+ **/
+
+ .directive('xosAlert', function () {
+ return {
+ restrict: 'E',
+ scope: {
+ config: '=',
+ show: '=?'
+ },
+ 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">×</span>\n </button>\n <p ng-transclude></p>\n </div>\n ',
+ transclude: true,
+ bindToController: true,
+ controllerAs: 'vm',
+ controller: ["$timeout", function controller($timeout) {
+ var _this = this;
+
+ 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 = function () {
+ _this.show = false;
+ };
+
+ if (this.config.autoHide) {
+ (function () {
+ var to = $timeout(function () {
+ _this.dismiss();
+ $timeout.cancel(to);
+ }, _this.config.autoHide);
+ })();
+ }
+ }]
+ };
+ });
+})();
+//# sourceMappingURL=../../../maps/ui_components/dumbComponents/alert/alert.component.js.map
+
+'use strict';
+
(function () {
'use strict';
@@ -1067,6 +1096,23 @@
(function () {
'use strict';
+ angular.module('xos.helpers')
+ /**
+ * @ngdoc service
+ * @name xos.helpers.Instances
+ * @description Angular resource to fetch /api/core/instances/
+ **/
+ .service('Instances', ["$resource", function ($resource) {
+ return $resource('/api/core/instances/');
+ }]);
+})();
+//# sourceMappingURL=../../maps/services/rest/Instances.js.map
+
+'use strict';
+
+(function () {
+ 'use strict';
+
/**
* @ngdoc service
* @name xos.helpers.NoHyperlinks
diff --git a/xos/tests/api/apiary.apib b/xos/tests/api/apiary.apib
index 6cbfac9..fad78fc 100644
--- a/xos/tests/api/apiary.apib
+++ b/xos/tests/api/apiary.apib
@@ -3,6 +3,54 @@
# XOS
+# Group Instances
+
+List of the XOS instances
+
+## Instances [/api/core/instances/]
+
+### List all Instances [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 1,
+ "humanReadableName": "uninstantiated-1",
+ "created": "2016-04-26T00:36:22.465259Z",
+ "updated": "2016-04-26T00:36:22.465288Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "instance_id": null,
+ "instance_uuid": null,
+ "name": "mysite_vcpe",
+ "instance_name": null,
+ "ip": null,
+ "image": "http://xos.dev:9999/api/core/images/1/",
+ "creator": "http://xos.dev:9999/api/core/users/1/",
+ "slice": "http://xos.dev:9999/api/core/slices/1/",
+ "deployment": "http://xos.dev:9999/api/core/deployments/1/",
+ "node": "http://xos.dev:9999/api/core/nodes/1/",
+ "numberCores": 0,
+ "flavor": "http://xos.dev:9999/api/core/flavors/1/",
+ "userData": null,
+ "isolation": "vm",
+ "volumes": "/etc/dnsmasq.d,/etc/ufw",
+ "parent": null,
+ "networks": [
+ "http://xos.dev:9999/api/core/networks/2/"
+ ]
+ }
+ ]
+
+
+
# Group Users
List of the XOS users
@@ -89,24 +137,6 @@
]
-# Group ONOS Apps
-
-## ONOS App Collection [/api/tenant/onos/app/]
-
-### List all apps [GET]
-
-+ Response 200 (application/json)
-
- [
- {
- "humanReadableName": "onos-tenant-7",
- "id": 7,
- "name": "vBNG_ONOS_app",
- "dependencies": "org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd"
- }
- ]
-
-
# Group Subscribers
Resource related to the CORD Subscribers.
@@ -503,3 +533,22 @@
"compute_node_name": "node2.opencloud.us"
}
}
+
+
+
+# Group ONOS Apps
+
+## ONOS App Collection [/api/tenant/onos/app/]
+
+### List all apps [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "humanReadableName": "onos-tenant-7",
+ "id": 7,
+ "name": "vBNG_ONOS_app",
+ "dependencies": "org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd"
+ }
+ ]
\ No newline at end of file
diff --git a/xos/tests/api/source/core/instances.md b/xos/tests/api/source/core/instances.md
new file mode 100644
index 0000000..7af247f
--- /dev/null
+++ b/xos/tests/api/source/core/instances.md
@@ -0,0 +1,46 @@
+# Group Instances
+
+List of the XOS instances
+
+## Instances [/api/core/instances/]
+
+### List all Instances [GET]
+
++ Response 200 (application/json)
+
+ [
+ {
+ "id": 1,
+ "humanReadableName": "uninstantiated-1",
+ "created": "2016-04-26T00:36:22.465259Z",
+ "updated": "2016-04-26T00:36:22.465288Z",
+ "enacted": null,
+ "policed": null,
+ "backend_register": "{}",
+ "backend_status": "0 - Provisioning in progress",
+ "deleted": false,
+ "write_protect": false,
+ "lazy_blocked": false,
+ "no_sync": false,
+ "instance_id": null,
+ "instance_uuid": null,
+ "name": "mysite_vcpe",
+ "instance_name": null,
+ "ip": null,
+ "image": "http://xos.dev:9999/api/core/images/1/",
+ "creator": "http://xos.dev:9999/api/core/users/1/",
+ "slice": "http://xos.dev:9999/api/core/slices/1/",
+ "deployment": "http://xos.dev:9999/api/core/deployments/1/",
+ "node": "http://xos.dev:9999/api/core/nodes/1/",
+ "numberCores": 0,
+ "flavor": "http://xos.dev:9999/api/core/flavors/1/",
+ "userData": null,
+ "isolation": "vm",
+ "volumes": "/etc/dnsmasq.d,/etc/ufw",
+ "parent": null,
+ "networks": [
+ "http://xos.dev:9999/api/core/networks/2/"
+ ]
+ }
+ ]
+
\ No newline at end of file