Revision 1c8d43ef
src/sunstone/public/app/tabs/datastores-tab/datatable.js | ||
---|---|---|
13 | 13 |
CONSTANTS |
14 | 14 |
*/ |
15 | 15 |
|
16 |
var RESOURCE = "Datastore" |
|
16 |
var RESOURCE = "Datastore"; |
|
17 |
var XML_ROOT = "DATASTORE"; |
|
17 | 18 |
var TAB_NAME = require('./tabId'); |
18 | 19 |
|
19 | 20 |
/* |
... | ... | |
36 | 37 |
*/ |
37 | 38 |
function Table(dataTableId, conf) { |
38 | 39 |
this.conf = conf || {}; |
40 |
this.tabId = TAB_NAME; |
|
39 | 41 |
this.dataTableId = dataTableId; |
40 | 42 |
this.resource = RESOURCE; |
43 |
this.xmlRoot = XML_ROOT; |
|
41 | 44 |
|
42 | 45 |
this.dataTableOptions = { |
43 | 46 |
"bAutoWidth": false, |
src/sunstone/public/app/tabs/datastores-tab/panels/images.js | ||
---|---|---|
9 | 9 |
/* |
10 | 10 |
CONSTANTS |
11 | 11 |
*/ |
12 |
|
|
13 |
var IAMGES_TAB_ID = require('tabs/images-tab/tabId'); |
|
12 |
|
|
14 | 13 |
var PANEL_ID = require('./images/panelId'); |
15 | 14 |
var IMAGES_TABLE_ID = PANEL_ID + "ImagesTable" |
16 | 15 |
var RESOURCE = "Datastore" |
... | ... | |
24 | 23 |
this.icon = "fa-upload"; |
25 | 24 |
|
26 | 25 |
this.element = info[RESOURCE.toUpperCase()]; |
27 |
this.imagesDataTable = new ImagesTable(IMAGES_TABLE_ID, {info: true}, IAMGES_TAB_ID);
|
|
26 |
this.imagesDataTable = new ImagesTable(IMAGES_TABLE_ID, {info: true}); |
|
28 | 27 |
|
29 | 28 |
return this; |
30 | 29 |
}; |
src/sunstone/public/app/tabs/images-tab/datatable.js | ||
---|---|---|
15 | 15 |
*/ |
16 | 16 |
|
17 | 17 |
var RESOURCE = "Image" |
18 |
var XML_ROOT = "Image" |
|
18 | 19 |
var TAB_NAME = require('./tabId'); |
19 | 20 |
var COLUMN_IDS = { |
20 | 21 |
"DATASTORE": 5 |
... | ... | |
23 | 24 |
CONSTRUCTOR |
24 | 25 |
*/ |
25 | 26 |
|
26 |
function Table(dataTableId, conf, tabId) {
|
|
27 |
function Table(dataTableId, conf) { |
|
27 | 28 |
this.conf = conf || {}; |
28 |
this.tabId = tabId;
|
|
29 |
this.tabId = TAB_NAME;
|
|
29 | 30 |
this.dataTableId = dataTableId; |
30 | 31 |
this.resource = RESOURCE; |
32 |
this.xmlRoot = XML_ROOT; |
|
31 | 33 |
|
32 | 34 |
this.dataTableOptions = { |
33 | 35 |
"bAutoWidth": false, |
... | ... | |
71 | 73 |
Table.prototype = Object.create(TabDataTable.prototype); |
72 | 74 |
Table.prototype.constructor = Table; |
73 | 75 |
Table.prototype.elementArray = _elementArray; |
74 |
Table.prototype.list = _list; |
|
75 | 76 |
Table.COLUMN_IDS = COLUMN_IDS; |
76 | 77 |
|
77 | 78 |
return Table; |
... | ... | |
136 | 137 |
element.TEMPLATE.TARGET ? element.TEMPLATE.TARGET : '--' |
137 | 138 |
]; |
138 | 139 |
} |
139 |
|
|
140 |
function _list() { |
|
141 |
var that = this; |
|
142 |
OpenNebulaImage.list({ |
|
143 |
success: function(req, resp) { |
|
144 |
that.updateView(req, resp); |
|
145 |
}, |
|
146 |
error: Notifier.onError |
|
147 |
}); |
|
148 |
} |
|
149 | 140 |
}); |
src/sunstone/public/app/tabs/zones-tab/datatable.js | ||
---|---|---|
11 | 11 |
CONSTANTS |
12 | 12 |
*/ |
13 | 13 |
|
14 |
var RESOURCE = "Zone" |
|
14 |
var RESOURCE = "Zone"; |
|
15 |
var XML_ROOT = "ZONE"; |
|
15 | 16 |
var TAB_NAME = require('./tabId'); |
16 | 17 |
|
17 | 18 |
/* |
... | ... | |
20 | 21 |
|
21 | 22 |
function Table(dataTableId, conf) { |
22 | 23 |
this.conf = conf || {}; |
24 |
this.tabId = TAB_NAME; |
|
23 | 25 |
this.dataTableId = dataTableId; |
24 | 26 |
this.resource = RESOURCE; |
27 |
this.xmlRoot = XML_ROOT; |
|
25 | 28 |
|
26 | 29 |
this.dataTableOptions = { |
27 | 30 |
"bAutoWidth": false, |
src/sunstone/public/app/utils/tab-datatable.js | ||
---|---|---|
124 | 124 |
'initSelectResourceTableSelect': _initSelectResourceTableSelect, |
125 | 125 |
'retrieveResourceTableSelect': _retrieveResourceTableSelect, |
126 | 126 |
'updateFn': _updateFn, |
127 |
'getName': _getName |
|
127 |
'getName': _getName, |
|
128 |
'list': _list |
|
128 | 129 |
} |
129 | 130 |
|
130 | 131 |
return TabDatatable; |
... | ... | |
518 | 519 |
$('#refresh_button_' + that.dataTableId, section).off("click"); |
519 | 520 |
|
520 | 521 |
section.on('click', '#refresh_button_' + that.dataTableId, function() { |
521 |
that.updateFn($('table[id=datatable_' + that.dataTableId + ']', section).dataTable());
|
|
522 |
that.updateFn(); |
|
522 | 523 |
return false; |
523 | 524 |
}); |
524 | 525 |
|
... | ... | |
823 | 824 |
var add = true; |
824 | 825 |
|
825 | 826 |
if (that.selectOptions.filter_fn) { |
826 |
add = that.selectOptions.filter_fn(this.DATASTORE);
|
|
827 |
add = that.selectOptions.filter_fn(this[that.xmlRoot]);
|
|
827 | 828 |
} |
828 | 829 |
|
829 | 830 |
if (that.selectOptions.fixed_ids != undefined) { |
830 |
add = (add && fixed_ids_map[this.DATASTORE.ID]);
|
|
831 |
add = (add && fixed_ids_map[this[that.xmlRoot].ID]);
|
|
831 | 832 |
} |
832 | 833 |
|
833 | 834 |
if (add) { |
834 | 835 |
list_array.push(that.elementArray(this)); |
835 | 836 |
|
836 |
delete fixed_ids_map[this.DATASTORE.ID];
|
|
837 |
delete fixed_ids_map[this[that.xmlRoot].ID];
|
|
837 | 838 |
} |
838 | 839 |
}); |
839 | 840 |
|
... | ... | |
894 | 895 |
}); |
895 | 896 |
return name; |
896 | 897 |
}; |
898 |
|
|
899 |
// Used by panels that contain tables from other resources. |
|
900 |
// TODO: This is probably duplicated somewhere |
|
901 |
function _list() { |
|
902 |
var that = this; |
|
903 |
OpenNebula[that.resource].list({ |
|
904 |
success: function(req, resp) { |
|
905 |
that.updateView(req, resp); |
|
906 |
}, |
|
907 |
error: Notifier.onError |
|
908 |
}); |
|
909 |
} |
|
897 | 910 |
}) |
src/sunstone/public/app/utils/tab-datatable/table.hbs | ||
---|---|---|
1 | 1 |
<div id="{{dataTableId}}Container"> |
2 |
{{! TODO: show also refresh and search box when {info: true} is used in panels}} |
|
2 | 3 |
{{#if conf.select}} |
3 | 4 |
<div class="row"> |
4 | 5 |
<div class="large-8 small-2 columns"> |
Also available in: Unified diff