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:
parent
7020a0e5fb
commit
874436b556
@ -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 = ' ';
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user