<commit_before>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt

frappe.provide("frappe.views");
frappe.provide("frappe.query_reports");

frappe.standard_pages["query-report"] = function() {
	var wrapper = frappe.container.add_page('query-report');

	frappe.ui.make_app_page({
		parent: wrapper,
		title: __('Query Report'),
		single_column: true,
	});

	frappe.query_report = new frappe.views.QueryReport({
		parent: wrapper,
	});

	$(wrapper).bind("show", function() {
		frappe.query_report.load();
	});
}

frappe.views.QueryReport = Class.extend({
	init: function(opts) {
		$.extend(this, opts);
		this.flags = {};
		// globalify for slickgrid
		this.page = this.parent.page;
		this.parent.query_report = this;
		this.make();
	},
	slickgrid_options: {
		enableColumnReorder: false,
		showHeaderRow: true,
		headerRowHeight: 30,
		explicitInitialization: true,
		multiColumnSort: true
	},
	make: function() {
		var me = this;
		this.wrapper = $("<div>").appendTo(this.page.main);
		$('<div class="waiting-area" style="display: none;"></div>\
		<div class="no-report-area msg-box no-border" style="display: none;"></div>\
		<div class="chart_area" style="border-bottom: 1px solid #d1d8dd; padding: 0px 5%"></div>\
		<div class="results" style="display: none;">\
			<div class="result-area" style="height:400px;"></div>\
			<button class="btn btn-secondary btn-default btn-xs expand-all hidden" style="margin: 10px;">'+__('Expand All')+'</button>\
			<button class="btn btn-secondary btn-default btn-xs collapse-all hidden" style="margin: 10px; margin-left: 0px;">'+__('Collapse All')+'</button>\
			<p class="help-msg alert alert-warning text-center" style="margin: 15px; margin-top: 0px;"></p>\
			<p class="msg-box small">\
				'+__('For comparative filters, start with')+' ">" or "<" or "!", e.g. >5 or >01-02-2012 or !0\
				<br>'+__('For ranges')+' ('+__('values and dates')+') use ":", \
					e.g. "5:10"  (' + __("to filter values between 5 & 10") + ')</p>\
		</div>').appendTo(this.wrapper);
		this.wrapper.find(".expand-all").on("click", function() { me.toggle_all(false);});
		this.wrapper.find(".collapse-all").on("click", function() { me.toggle_all(true);});
		this.chart_area = this.wrapper.find(".chart_area");
		this.make_toolbar();
	},
	toggle_expand_collapse_buttons: function(show) {
		this.wrapper.find(".expand-all, .collapse-all").toggleClass('hidden', !!!show);
	},
	make_toolbar: function() {
		var me = this;
		this.page.set_secondary_action(__('Refresh'), function() { me.refresh(); });

		// Edit
		this.page.add_menu_item(__('Edit'), function() {<commit_msg>[minor] Increase Query Report Result Area size to 70vh (#4066)<commit_after>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt

frappe.provide("frappe.views");
frappe.provide("frappe.query_reports");

frappe.standard_pages["query-report"] = function() {
	var wrapper = frappe.container.add_page('query-report');

	frappe.ui.make_app_page({
		parent: wrapper,
		title: __('Query Report'),
		single_column: true,
	});

	frappe.query_report = new frappe.views.QueryReport({
		parent: wrapper,
	});

	$(wrapper).bind("show", function() {
		frappe.query_report.load();
	});
}

frappe.views.QueryReport = Class.extend({
	init: function(opts) {
		$.extend(this, opts);
		this.flags = {};
		// globalify for slickgrid
		this.page = this.parent.page;
		this.parent.query_report = this;
		this.make();
	},
	slickgrid_options: {
		enableColumnReorder: false,
		showHeaderRow: true,
		headerRowHeight: 30,
		explicitInitialization: true,
		multiColumnSort: true
	},
	make: function() {
		var me = this;
		this.wrapper = $("<div>").appendTo(this.page.main);
		$('<div class="waiting-area" style="display: none;"></div>\
		<div class="no-report-area msg-box no-border" style="display: none;"></div>\
		<div class="chart_area" style="border-bottom: 1px solid #d1d8dd; padding: 0px 5%"></div>\
		<div class="results" style="display: none;">\
			<div class="result-area" style="height:70vh;"></div>\
			<button class="btn btn-secondary btn-default btn-xs expand-all hidden" style="margin: 10px;">'+__('Expand All')+'</button>\
			<button class="btn btn-secondary btn-default btn-xs collapse-all hidden" style="margin: 10px; margin-left: 0px;">'+__('Collapse All')+'</button>\
			<p class="help-msg alert alert-warning text-center" style="margin: 15px; margin-top: 0px;"></p>\
			<p class="msg-box small">\
				'+__('For comparative filters, start with')+' ">" or "<" or "!", e.g. >5 or >01-02-2012 or !0\
				<br>'+__('For ranges')+' ('+__('values and dates')+') use ":", \
					e.g. "5:10"  (' + __("to filter values between 5 & 10") + ')</p>\
		</div>').appendTo(this.wrapper);
		this.wrapper.find(".expand-all").on("click", function() { me.toggle_all(false);});
		this.wrapper.find(".collapse-all").on("click", function() { me.toggle_all(true);});
		this.chart_area = this.wrapper.find(".chart_area");
		this.make_toolbar();
	},
	toggle_expand_collapse_buttons: function(show) {
		this.wrapper.find(".expand-all, .collapse-all").toggleClass('hidden', !!!show);
	},
	make_toolbar: function() {
		var me = this;
		this.page.set_secondary_action(__('Refresh'), function() { me.refresh(); });

		// Edit
		this.page.add_menu_item(__('Edit'), function() {
{'fraction_non_alphanumeric': 0.20259106271122793, 'fraction_numerical': 0.015208411565903118, 'mean_word_length': 4.654989384288747, 'pattern_counts': {'":': 2, '<': 45, '<?xml version=': 0, '>': 49, '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': '2647480', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1847, 'n_words': 377}