1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #3748: Show images for files datastores

This commit is contained in:
Carlos Martín 2015-07-09 18:39:52 +02:00
parent 0adaf76875
commit 4c5410f447
3 changed files with 29 additions and 12 deletions

View File

@ -4,7 +4,9 @@ define(function(require){
*/
var Locale = require('utils/locale');
var OpenNebulaDatastore = require('opennebula/datastore');
var ImagesTable = require('tabs/images-tab/datatable');
var FilesTable = require('tabs/files-tab/datatable');
/*
CONSTANTS
@ -23,7 +25,6 @@ define(function(require){
this.icon = "fa-upload";
this.element = info[RESOURCE.toUpperCase()];
this.imagesDataTable = new ImagesTable(IMAGES_TABLE_ID, {info: true});
return this;
};
@ -39,13 +40,37 @@ define(function(require){
*/
function _html() {
var imgs = [];
if (this.element.IMAGES.ID != undefined){
imgs = this.element.IMAGES.ID;
if (!$.isArray(imgs)){
imgs = [imgs];
}
}
var opts = {
info: true,
select: true,
selectOptions: {
read_only: true,
fixed_ids: imgs
}
};
if (this.element.TYPE == OpenNebulaDatastore.TYPES.FILE_DS){
this.imagesDataTable = new FilesTable(IMAGES_TABLE_ID, opts);
} else {
this.imagesDataTable = new ImagesTable(IMAGES_TABLE_ID, opts);
}
return this.imagesDataTable.dataTableHTML;
}
function _setup(context) {
this.imagesDataTable.initialize();
this.imagesDataTable.filter(this.element.NAME, ImagesTable.COLUMN_IDS.DATASTORE);
this.imagesDataTable.list();
this.imagesDataTable.refreshResourceTableSelect();
return false;
}

View File

@ -17,10 +17,6 @@ define(function(require) {
var RESOURCE = "File";
var XML_ROOT = "IMAGE";
var TAB_NAME = require('./tabId');
var COLUMN_IDS = {
"DATASTORE": 5,
"TYPE": 7
};
/*
CONSTRUCTOR
@ -76,7 +72,6 @@ define(function(require) {
Table.prototype = Object.create(TabDataTable.prototype);
Table.prototype.constructor = Table;
Table.prototype.elementArray = _elementArray;
Table.COLUMN_IDS = COLUMN_IDS;
return Table;

View File

@ -17,9 +17,7 @@ define(function(require) {
var RESOURCE = "Image"
var XML_ROOT = "IMAGE"
var TAB_NAME = require('./tabId');
var COLUMN_IDS = {
"DATASTORE": 5
}
/*
CONSTRUCTOR
*/
@ -79,7 +77,6 @@ define(function(require) {
Table.prototype.elementArray = _elementArray;
Table.prototype.preUpdateView = _preUpdateView;
Table.prototype.postUpdateView = _postUpdateView;
Table.COLUMN_IDS = COLUMN_IDS;
return Table;