Translated using Weblate.
[phpmyadmin.git] / js / replication.js
blobf3fdb1e93110a4e5022f85e77c10bf25e6dbdc88
1 /* vim: set expandtab sw=4 ts=4 sts=4: */
2 /**
3  * for server_replication.php
4  *
5  */
7 var random_server_id = Math.floor(Math.random() * 10000000);
8 var conf_prefix = "server-id=" + random_server_id + "\nlog-bin=mysql-bin\nlog-error=mysql-bin.err\n";
10 function update_config()
12     var conf_ignore = "binlog_ignore_db=";
13     var conf_do = "binlog_do_db=";
14     var database_list = $('#db_select option:selected:first').val();
15     $('#db_select option:selected:not(:first)').each(function() {
16         database_list += ',' + $(this).val();
17     });
19     if ($('#db_select option:selected').size() == 0) {
20         $('#rep').text(conf_prefix);
21     } else if ($('#db_type option:selected').val() == 'all') {
22         $('#rep').text(conf_prefix + conf_ignore + database_list);
23     } else {
24         $('#rep').text(conf_prefix + conf_do + database_list);
25     }
28 $(document).ready(function() {
29     $('#rep').text(conf_prefix);
30     $('#db_type').change(update_config);
31     $('#db_select').change(update_config);
33     $('#master_status_href').click(function() {
34         $('#replication_master_section').toggle();
35         });
36     $('#master_slaves_href').click(function() {
37         $('#replication_slaves_section').toggle();
38         });
39     $('#slave_status_href').click(function() {
40         $('#replication_slave_section').toggle();
41         });
42     $('#slave_control_href').click(function() {
43         $('#slave_control_gui').toggle();
44         });
45     $('#slave_errormanagement_href').click(function() {
46         $('#slave_errormanagement_gui').toggle();
47         });
48     $('#slave_synchronization_href').click(function() {
49         $('#slave_synchronization_gui').toggle();
50         });
51     $('#db_reset_href').click(function() {
52         $('#db_select option:selected').attr('selected', false);
53         });
54 });