<commit_before>import Vue                      from 'vue'
import Welcome                  from './components/Welcome.vue'
import FileBrowser              from './components/FileBrowser.vue'
import VR                       from './components/VR.vue'
import ConnectedClients         from './components/central_server/connected_clients.vue'
import yazz_new_connection      from './components/yazz_new_connection.vue'
import connections_table        from './components/connections_table.vue'
import queries_table            from './components/queries_table.vue'
import output_table             from './components/output_table.vue'
import drivers_table            from './components/drivers_table.vue'
import store                    from './store.js'

window.store = store;
Vue.component('FileBrowser',FileBrowser);
var cardIndex = 0;
var cardViewY = 0;

window.vue = Vue;

function initWelcomeVuePane() {
    if (document.getElementById('welcome')) {
        //console.log(' Welcome pane exists');
        new Vue({
          el: '#welcome'
          ,
          template: `<welcome-component></welcome-component>`
          ,
          components: {'welcome-component': Welcome}
        });

    }
    if (document.getElementById('welcome')) {
        //console.log(' Welcome pane still exists');
    } else {
        //console.log(' Welcome pane does not exist anymore. Vue.js destroyed it with new Vue(...)');
    }
	if (window.system_type == 'client') {
		setupDB();
	}
}




function sendClientDetails() {
   $.ajax({
        url: '/send_client_details',
        data: {},
        success: function(data) {
            var ret = eval("(" + data + ")");
            store.dispatch('set_user_name', ret.username);
            store.dispatch('set_is_local_machine', ret.isLocalMachine);
            store.dispatch('set_locked', ret.locked);
            //alert(JSON.stringify(ret,null,2));
            setupWebSocket(ret.server, ret.port);
        },
        error: function(jqXHR, textStatus, errorThrown) {
          alert('error ' + textStatus + ' : ' +  errorThrown);
        }
      });
}




function setupSqlVuePane() {

    if (document.getElementById('select_source_parent')) {
        new Vue({
          el: '#select_source_parent'
          ,
          store: store
          ,
          template: `
                <select id=select_source>
                  <option v-for="option in options" v-bind:value="option.id">
                      {{ option.name }}
                  </option>
                </select>
        `
          ,
          computed: {
            options: function () {
              return this.$store.state.list_of_connections;
            }
          }
          ,
          components: {
							'connections-table': connections_table,
							'queries-table': queries_table
							}
        });
    }


    if (document.getElementById('select_query_source')) {
        new Vue({
          el: '#select_query_source'
          ,
          store: store
          ,
          template: `
                <select id=select_query v-bind:refresh_vr_items='get_refresh_view_counter'>
                  <option v-for="option in options()" v-bind:value="option.id" >
                      {{ option.name }}
                  </option>
                </select>
        `
        ,
        methods: {
            options: function () {
              return window.sqlGetAllQueries();
            }
          },
        computed: {
            get_refresh_view_counter: function () {
              return this.$store.state.refresh_view_counter;
            }
        }
        });
    }

}




var moveToX = 0;
var moveToY = 0;

var useX = 0;
var useY = 0;

var inMove = false;


function setupVRVuePane() {

    if (document.getElementById('vr_element')) {
        var vrParam = 'mouse';
        if (location.search) {
            vrParam = location.search.split('type=')[1];
        }
		 //alert(vrParam);

        new Vue({
          el: '#vr_element'
          ,
          store: store
          ,
          template: `
                <VR :vr_type=vrType>
                </VR>
        `
          ,
          computed: {
            options: function () {
              return this.$store.state.list_of_connections;
            },
			vrType: function() {
				return vrParam;
			}
          }
          ,
          components: {'VR': VR}
        });








		AFRAME.registerComponent('preview', {
		    schema: {	id: {type: 'string', default: ''}}
			,
		    init: function () {
			    var self = this;
		        this.el.addEventListener('mouseenter', function (evt) {
				   if (inMove) {
					   return;
				   };
			        var lll = window.sqlGetAllQueries().length;
                    var llx = window.sqlGetAllQueries();
				    for (var i = 0 ; i < lll ; i ++) {
						var query = llx[i];
					    if (query.id == self.data.id) {
						    if (query.preview) {
							    //setOutputData(query.preview);
								//alert(JSON.stringify(query.preview , null, 2));
							};
							return;
						};
					}
			   });
		    }
		});






		AFRAME.registerComponent('openquerynativeapp', {
			schema: {type: 'string'},
			init: function () {
				var self = this;
				var stringToLog = this.data;
				this.el.addEventListener('click', function (evt) {
					open_query_in_native_app(stringToLog);
				});
        this.el.addEventListener('mouseenter', function (evt) {
					var node = document.getElementById("animopenclick");
					if (node) {
					  node.parentNode.removeChild(node);
					};
					var animation = document.createElement('a-animation');
					animation.setAttribute('id', "animopenclick");
					animation.setAttribute('attribute', "rotation");
					animation.setAttribute('to', "00 0 90");
					animation.setAttribute('dur', "500");
					animation.setAttribute('repeat', "0");
					animation.setAttribute('direction', "alternate");
					self.el.appendChild(animation);
				});
        this.el.addEventListener('mouseleave', function (evt) {
					var node = document.getElementById("animopenclick");
					if (node) {
					  node.parentNode.removeChild(node);
					};
					var animation = document.createElement('a-animation');
					animation.setAttribute('id', "animopenclick");
					animation.setAttribute('attribute', "rotation");
					animation.setAttribute('to', "00 0 0");
					animation.setAttribute('dur', "500");
					animation.setAttribute('repeat', "0");
					animation.setAttribute('direction', "alternate");
					self.el.appendChild(animation);
				});
			}
		});



    window.get_query_property = function(id, property_name) {
        var qm = window.sqlGetQueryById(id);
        if ((!qm) || (typeof qm == 'undefined') || (typeof window.sqlGetQueryById(id)[property_name] == 'undefined')) {
            return "";
        }
        //return false;
        return JSON.stringify(qm[property_name],null,2);
    }



//zzz
    window.mouse_wheel = function(x,y) {
        console.log("Mouse moved (" + x + "," + y + ")")
        var node = document.getElementById("all_cards_anim");
        if (node) {
          node.parentNode.removeChild(node);
        };

        if (y > 0) {
            cardViewY --;
        } else if (y < 0) {
            cardViewY ++;
        }

        var nodeP = document.getElementById("all_cards");
        var animation = document.createElement('a-animation');
        animation.setAttribute('id', "all_cards_anim");
        animation.setAttribute('attribute', "position");
        animation.setAttribute('to', "0  " +  (0.03 * cardViewY) + "  0");
        animation.setAttribute('dur', "500");
        animation.setAttribute('repeat', "0");
        animation.setAttribute('direction', "alternate");
        nodeP.appendChild(animation);
    }




        window.gotoFunction = function(options) {

            var goto_name = options.goto_name;
            if (store.getters.get_current_location == goto_name) {<commit_msg>Make scrolling immediate<commit_after>import Vue                      from 'vue'
import Welcome                  from './components/Welcome.vue'
import FileBrowser              from './components/FileBrowser.vue'
import VR                       from './components/VR.vue'
import ConnectedClients         from './components/central_server/connected_clients.vue'
import yazz_new_connection      from './components/yazz_new_connection.vue'
import connections_table        from './components/connections_table.vue'
import queries_table            from './components/queries_table.vue'
import output_table             from './components/output_table.vue'
import drivers_table            from './components/drivers_table.vue'
import store                    from './store.js'

window.store = store;
Vue.component('FileBrowser',FileBrowser);
var cardIndex = 0;
var cardViewY = 0;

window.vue = Vue;

function initWelcomeVuePane() {
    if (document.getElementById('welcome')) {
        //console.log(' Welcome pane exists');
        new Vue({
          el: '#welcome'
          ,
          template: `<welcome-component></welcome-component>`
          ,
          components: {'welcome-component': Welcome}
        });

    }
    if (document.getElementById('welcome')) {
        //console.log(' Welcome pane still exists');
    } else {
        //console.log(' Welcome pane does not exist anymore. Vue.js destroyed it with new Vue(...)');
    }
	if (window.system_type == 'client') {
		setupDB();
	}
}




function sendClientDetails() {
   $.ajax({
        url: '/send_client_details',
        data: {},
        success: function(data) {
            var ret = eval("(" + data + ")");
            store.dispatch('set_user_name', ret.username);
            store.dispatch('set_is_local_machine', ret.isLocalMachine);
            store.dispatch('set_locked', ret.locked);
            //alert(JSON.stringify(ret,null,2));
            setupWebSocket(ret.server, ret.port);
        },
        error: function(jqXHR, textStatus, errorThrown) {
          alert('error ' + textStatus + ' : ' +  errorThrown);
        }
      });
}




function setupSqlVuePane() {

    if (document.getElementById('select_source_parent')) {
        new Vue({
          el: '#select_source_parent'
          ,
          store: store
          ,
          template: `
                <select id=select_source>
                  <option v-for="option in options" v-bind:value="option.id">
                      {{ option.name }}
                  </option>
                </select>
        `
          ,
          computed: {
            options: function () {
              return this.$store.state.list_of_connections;
            }
          }
          ,
          components: {
							'connections-table': connections_table,
							'queries-table': queries_table
							}
        });
    }


    if (document.getElementById('select_query_source')) {
        new Vue({
          el: '#select_query_source'
          ,
          store: store
          ,
          template: `
                <select id=select_query v-bind:refresh_vr_items='get_refresh_view_counter'>
                  <option v-for="option in options()" v-bind:value="option.id" >
                      {{ option.name }}
                  </option>
                </select>
        `
        ,
        methods: {
            options: function () {
              return window.sqlGetAllQueries();
            }
          },
        computed: {
            get_refresh_view_counter: function () {
              return this.$store.state.refresh_view_counter;
            }
        }
        });
    }

}




var moveToX = 0;
var moveToY = 0;

var useX = 0;
var useY = 0;

var inMove = false;


function setupVRVuePane() {

    if (document.getElementById('vr_element')) {
        var vrParam = 'mouse';
        if (location.search) {
            vrParam = location.search.split('type=')[1];
        }
		 //alert(vrParam);

        new Vue({
          el: '#vr_element'
          ,
          store: store
          ,
          template: `
                <VR :vr_type=vrType>
                </VR>
        `
          ,
          computed: {
            options: function () {
              return this.$store.state.list_of_connections;
            },
			vrType: function() {
				return vrParam;
			}
          }
          ,
          components: {'VR': VR}
        });








		AFRAME.registerComponent('preview', {
		    schema: {	id: {type: 'string', default: ''}}
			,
		    init: function () {
			    var self = this;
		        this.el.addEventListener('mouseenter', function (evt) {
				   if (inMove) {
					   return;
				   };
			        var lll = window.sqlGetAllQueries().length;
                    var llx = window.sqlGetAllQueries();
				    for (var i = 0 ; i < lll ; i ++) {
						var query = llx[i];
					    if (query.id == self.data.id) {
						    if (query.preview) {
							    //setOutputData(query.preview);
								//alert(JSON.stringify(query.preview , null, 2));
							};
							return;
						};
					}
			   });
		    }
		});






		AFRAME.registerComponent('openquerynativeapp', {
			schema: {type: 'string'},
			init: function () {
				var self = this;
				var stringToLog = this.data;
				this.el.addEventListener('click', function (evt) {
					open_query_in_native_app(stringToLog);
				});
        this.el.addEventListener('mouseenter', function (evt) {
					var node = document.getElementById("animopenclick");
					if (node) {
					  node.parentNode.removeChild(node);
					};
					var animation = document.createElement('a-animation');
					animation.setAttribute('id', "animopenclick");
					animation.setAttribute('attribute', "rotation");
					animation.setAttribute('to', "00 0 90");
					animation.setAttribute('dur', "500");
					animation.setAttribute('repeat', "0");
					animation.setAttribute('direction', "alternate");
					self.el.appendChild(animation);
				});
        this.el.addEventListener('mouseleave', function (evt) {
					var node = document.getElementById("animopenclick");
					if (node) {
					  node.parentNode.removeChild(node);
					};
					var animation = document.createElement('a-animation');
					animation.setAttribute('id', "animopenclick");
					animation.setAttribute('attribute', "rotation");
					animation.setAttribute('to', "00 0 0");
					animation.setAttribute('dur', "500");
					animation.setAttribute('repeat', "0");
					animation.setAttribute('direction', "alternate");
					self.el.appendChild(animation);
				});
			}
		});



    window.get_query_property = function(id, property_name) {
        var qm = window.sqlGetQueryById(id);
        if ((!qm) || (typeof qm == 'undefined') || (typeof window.sqlGetQueryById(id)[property_name] == 'undefined')) {
            return "";
        }
        //return false;
        return JSON.stringify(qm[property_name],null,2);
    }


var inScroll = false;
var scrollStarted = false;
//zzz
    window.mouse_wheel = function(x,y) {

        if (!inScroll) {
            inScroll = true;
        } else {
            return
        }

        //alert("wheel")
        console.log("Mouse moved (" + x + "," + y + ")")
        var node = document.getElementById("all_cards_anim");
        if (node) {
          node.parentNode.removeChild(node);
        };

        if (y > 0) {
            cardViewY --;
        } else if (y < 0) {
            cardViewY ++;
        }

        var nodeP = document.getElementById("all_cards");
        var animation = document.createElement('a-animation');
        animation.setAttribute('id', "all_cards_anim");
        animation.setAttribute('attribute', "position");
        animation.setAttribute('to', "0  " +  (0.3 * cardViewY) + "  0");
        animation.setAttribute('dur', "500");
        animation.setAttribute('repeat', "0");
        animation.setAttribute('direction', "alternate");
        animation.addEventListener('animationstart', function () {
            scrollStarted = true;
        });
        animation.addEventListener('animationend', function () {
            inScroll = false;
            scrollStarted = false;
        });
        nodeP.appendChild(animation);

    }




        window.gotoFunction = function(options) {

            var goto_name = options.goto_name;
            if (store.getters.get_current_location == goto_name) {
{'fraction_non_alphanumeric': 0.13588593202630447, 'fraction_numerical': 0.0047323458914633396, 'mean_word_length': 1.9171746145571888, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1912228', 'n_tokens_mistral': 5120, 'n_tokens_neox': 4491, 'n_words': 863}