From ca5987271f2278c8b320c31597ba12b3842e0ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 14 Jul 2015 11:48:06 +0200 Subject: [PATCH] Feature #3748: VM network panel saves the state on refresh --- .../public/app/tabs/vms-tab/panels/network.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/network.js b/src/sunstone/public/app/tabs/vms-tab/panels/network.js index 7acf64a23d..74af7343aa 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/network.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/network.js @@ -41,6 +41,8 @@ define(function(require) { Panel.prototype.html = _html; Panel.prototype.setup = _setup; Panel.prototype.onShow = _onShow; + Panel.prototype.getState = _getState; + Panel.prototype.setState = _setState; return Panel; @@ -410,4 +412,24 @@ define(function(require) { }); } } + + function _getState(context) { + var state = { + openNicsDetails : [] + }; + + $.each($("#tab_network_form .nics_table .fa-chevron-up", context), function(){ + state.openNicsDetails.push($(this).closest("tr").attr("nic_id")); + }); + + return state; + } + + function _setState(state, context) { + var that = this; + + $.each(state["openNicsDetails"], function(){ + $('#tab_network_form .nics_table tr[nic_id="'+this+'"] td.open-control', context).click(); + }); + } });