1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Feature #3748: VM storage panel saves the state on refresh

This commit is contained in:
Carlos Martín 2015-07-14 11:41:02 +02:00
parent 7020a0e5fb
commit 874436b556
2 changed files with 36 additions and 1 deletions

View File

@ -43,6 +43,8 @@ define(function(require) {
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
Panel.prototype.getState = _getState;
Panel.prototype.setState = _setState;
return Panel;
@ -413,6 +415,39 @@ define(function(require) {
Tree.setup(context);
}
function _getState(context) {
var state = {
openDisksDetails : [],
checkedSnapshots : []
};
$.each($("#tab_storage_form .disks_table .fa-chevron-up", context), function(){
state.openDisksDetails.push($(this).closest("tr").attr("disk_id"));
});
$.each($('#tab_storage_form .disks_table .snapshot_check_item:checked', context), function(){
state.checkedSnapshots.push({
snapshot_id : $(this).attr("snapshot_id"),
disk_id : $(this).closest(".snapshots").attr('disk_id')
});
});
return state;
}
function _setState(state, context) {
var that = this;
$.each(state["openDisksDetails"], function(){
$('#tab_storage_form .disks_table tr[disk_id="'+this+'"] td.open-control', context).click();
});
$.each(state["checkedSnapshots"], function(){
$('#tab_storage_form .disks_table .snapshots[disk_id="'+this.disk_id+'"] '+
'.snapshot_check_item[snapshot_id="'+this.snapshot_id+'"]', context).click();
});
}
function _makeTree(that, snapshot, indexedSnapshots){
var SPACE = '    ';

View File

@ -19,7 +19,7 @@
</div>
</div>
<div class="row collapse">
<div class="large-12 columns" style="width:900px; overflow-x:auto">
<div class="large-12 columns" style="width:800px; overflow-x:auto">
{{{snapshotsHTML}}}
</div>
</div>