Commit d68ff10e authored by fv3rdugo's avatar fv3rdugo
Browse files

[#260] fixed missing rows when upgrading

Keep selected tab on page refresh
parent c0beecd8
......@@ -259,6 +259,169 @@ sub _update_domain_drivers_types($self) {
$self->_update_table('domain_drivers_types','id',$data);
}
sub _update_domain_drivers_options($self) {
my $data = {
qxl => {
id => 1,
,id_driver_type => 1,
,name => 'QXL'
,value => 'type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"'
},
vmvga => {
id => 2,
,id_driver_type => 1,
,name => 'VMVGA'
,value => 'type="vmvga" vram="16384" heads="1" primary="yes"'
},
cirrus => {
id => 3,
,id_driver_type => 1,
,name => 'Cirrus'
,value => 'type="cirrus" vram="16384" heads="1" primary="yes"'
},
vga => {
id => 4,
,id_driver_type => 1,
,name => 'VGA'
,value => 'type="vga" vram="16384" heads="1" primary="yes"'
},
ich6 => {
id => 6,
,id_driver_type => 2,
,name => 'ich6'
,value => 'model="ich6"'
},
ac97 => {
id => 7,
,id_driver_type => 2,
,name => 'ac97'
,value => 'model="ac97"'
},
virtio => {
id => 8,
,id_driver_type => 3,
,name => 'virtio'
,value => 'type="virtio"'
},
e1000 => {
id => 9,
,id_driver_type => 3,
,name => 'e1000'
,value => 'type="e1000"'
},
rtl8139 => {
id => 10,
,id_driver_type => 3,
,name => 'rtl8139'
,value => 'type="rtl8139"'
},
auto_glz => {
id => 11,
,id_driver_type => 4,
,name => 'auto_glz'
,value => 'compression="auto_glz"'
},
auto_lz => {
id => 12,
,id_driver_type => 4,
,name => 'auto_lz'
,value => 'compression="auto_lz"'
},
quic => {
id => 13,
,id_driver_type => 4,
,name => 'quic'
,value => 'compression="quic"'
},
glz => {
id => 14,
,id_driver_type => 4,
,name => 'glz'
,value => 'compression="glz"'
},
lz => {
id => 15,
,id_driver_type => 4,
,name => 'lz'
,value => 'compression="lz"'
},
off => {
id => 16,
,id_driver_type => 4,
,name => 'off'
,value => 'compression="off"'
},
auto => {
id => 17,
,id_driver_type => 5,
,name => 'auto'
,value => 'compression="auto"'
},
never => {
id => 18,
,id_driver_type => 5,
,name => 'never'
,value => 'compression="never"'
},
always => {
id => 19,
,id_driver_type => 5,
,name => 'always'
,value => 'compression="always"'
},
auto1 => {
id => 20,
,id_driver_type => 6,
,name => 'auto'
,value => 'compression="auto"'
},
never1 => {
id => 21,
,id_driver_type => 6,
,name => 'never'
,value => 'compression="never"'
},
always1 => {
id => 22,
,id_driver_type => 6,
,name => 'always'
,value => 'compression="always"'
},
on => {
id => 23,
,id_driver_type => 7,
,name => 'on'
,value => 'compression="on"'
},
off1 => {
id => 24,
,id_driver_type => 7,
,name => 'off'
,value => 'compression="off"'
},
filter => {
id => 25,
,id_driver_type => 8,
,name => 'filter'
,value => 'mode="filter"'
},
all => {
id => 26,
,id_driver_type => 8,
,name => 'all'
,value => 'mode="all"'
},
off2 => {
id => 27,
,id_driver_type => 8,
,name => 'off'
,value => 'mode="off"'
}
};
$self->_update_table('domain_drivers_options','id',$data);
}
sub _update_table($self, $table, $field, $data) {
my $sth_search = $CONNECTOR->dbh->prepare("SELECT id FROM $table WHERE $field = ?");
......@@ -290,6 +453,7 @@ sub _update_data {
$self->_update_isos();
$self->_update_user_grants();
$self->_update_domain_drivers_types();
$self->_update_domain_drivers_options();
}
sub _upgrade_table {
......
......@@ -52,5 +52,34 @@
</div> <!-- del wrapper -->
%= include 'bootstrap/scripts'
%= include 'bootstrap/messages'
<script type="text/javascript">
if (location.hash) {
$('a[href=\'' + location.hash + '\']').tab('show');
}
var activeTab = localStorage.getItem('activeTab');
if (activeTab) {
$('a[href="' + activeTab + '"]').tab('show');
}
$('body').on('click', 'a[data-toggle=\'tab\']', function (e) {
e.preventDefault()
var tab_name = this.getAttribute('href')
if (history.pushState) {
history.pushState(null, null, tab_name)
}
else {
location.hash = tab_name
}
localStorage.setItem('activeTab', tab_name)
$(this).tab('show');
return false;
});
$(window).on('popstate', function () {
var anchor = location.hash ||
$('a[data-toggle=\'tab\']').first().attr('href');
$('a[href=\'' + anchor + '\']').tab('show');
});
</script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment