feature #3748: Add list method to the images datatable

This commit is contained in:
Daniel Molina committed 2015-04-30 14:33:07 +02:00
1 parent 3eaa116742
commit 2d9bee1829
4 files changed
+24 -6

No files matched your search

@@ -27,7 +27,7 @@ define(function(require) {
resource: 'Datastore',
buttons: Buttons,
actions: Actions,
dataTable: new Table(DATATABLE_ID),
dataTable: new Table(DATATABLE_ID, {actions: true, info: true}),
panels: _panels,
dialogs: _dialogs
};
@@ -20,7 +20,8 @@ define(function(require) {
CONSTRUCTOR
*/
function Table(dataTableId) {
function Table(dataTableId, conf) {
this.conf = conf || {};
this.dataTableId = dataTableId;
this.resource = RESOURCE;
+1 -1
View File
@@ -27,7 +27,7 @@ define(function(require) {
content: '<div id="upload_progress_bars" class="large-12 columns"></div>',
buttons: Buttons,
actions: Actions,
dataTable: new Table(DATATABLE_ID),
dataTable: new Table(DATATABLE_ID, {actions: true, info: true}),
//panels: _panels,
//dialogs: _dialogs
};
@@ -4,9 +4,10 @@ define(function(require) {
*/
var TabDataTable = require('utils/tab-datatable');
var Locale = require('utils/locale');
var SunstoneConfig = require('sunstone-config');
var Locale = require('utils/locale');
var Humanize = require('utils/humanize');
var Notifier = require('utils/notifier');
var OpenNebulaImage = require('opennebula/image');
/*
@@ -15,12 +16,16 @@ define(function(require) {
var RESOURCE = "Image"
var TAB_NAME = require('./tabId');
var COLUMN_IDS = {
"DATASTORE": 5
}
/*
CONSTRUCTOR
*/
function Table(dataTableId) {
function Table(dataTableId, conf, tabId) {
this.conf = conf || {};
this.tabId = tabId;
this.dataTableId = dataTableId;
this.resource = RESOURCE;
@@ -58,6 +63,8 @@ define(function(require) {
Table.prototype = Object.create(TabDataTable.prototype);
Table.prototype.constructor = Table;
Table.prototype.elementArray = _elementArray;
Table.prototype.list = _list;
Table.COLUMN_IDS = COLUMN_IDS;
return Table;
@@ -89,4 +96,14 @@ define(function(require) {
element.TEMPLATE.TARGET ? element.TEMPLATE.TARGET : '--'
];
}
function _list(){
var that = this;
OpenNebulaImage.list({
success: function(req, resp) {
that.updateView(req, resp);
},
error: Notifier.onError
});
}
});