<commit_before><?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">

<CSP name="DeepSeeLightPivotTable.css" application="">
<![CDATA[{{replace:css}}]]>
</CSP>

<CSP name="DeepSeeLightPivotTable.js" application="">
<![CDATA[{{replace:js}}]]>
</CSP>

    <Class name="DeepSee.LightPivotTable">
        <Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
        <TimeChanged>63522,308.015025</TimeChanged>
        <TimeCreated>63515,61322.546099</TimeCreated>

        <Parameter name="INCLUDEFILES">
            <Default>style:DeepSeeLightPivotTable.css,script:DeepSeeLightPivotTable.js</Default>
        </Parameter>

        <Property name="DataSource">
            <Type>%String</Type>
        </Property>

        <Property name="ShowSummary">
            <Type>%Boolean</Type>
        </Property>

        <Method name="%OnGetPortletName">
            <ClassMethod>1</ClassMethod>
            <ReturnType>%String</ReturnType>
            <Implementation><![CDATA[    quit "Light pivot table"
]]></Implementation>
        </Method>

        <Method name="%OnGetPortletIcon">
            <ClassMethod>1</ClassMethod>
            <ReturnType>%String</ReturnType>
            <Implementation><![CDATA[    quit "deepsee/ds2_dialpad_44.png"
]]></Implementation>
        </Method>

        <Method name="%OnGetPortletSettings">
            <ClassMethod>1</ClassMethod>
            <FormalSpec>*pInfo:%List</FormalSpec>
            <ReturnType>%Status</ReturnType>
            <Implementation><![CDATA[
    kill pInfo // $LB(name,value,type,caption,title)

    set pInfo($I(pInfo)) = $LB("DataSource", "/SAMPLES", "%String", $$$Text("MDX2JSON source", "%DeepSee"), "Set the URL of MDX2JSON source. Example: ""/SAMPLES""")
    set pInfo($I(pInfo)) = $LB("ShowSummary", 1, "%Boolean", $$$Text("Show summary?", "%DeepSee"), "Show summary row")

    quit $$$OK
]]></Implementation>
        </Method>

        <Method name="getConnectedController">
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    var controller = this.getController();

    if (null === controller) {
        this.connectToController();
        controller = this.getController();
    }

    return controller;
]]></Implementation>
        </Method>

        <Method name="notifyViewHandler">
            <FormalSpec>reason,data1,data2,data3</FormalSpec>
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    if (!this.LightPivotTable) return;

    var controller = this.getConnectedController();

    if (reason === "dataChange") {

        this.LightPivotTable.clearFilters();

        // updateFilters
        for (var i in controller.filters) {
            this.LightPivotTable.setFilter(controller.filters[i].spec);
        }

        this.LightPivotTable.refresh();

    }
]]></Implementation>
        </Method>

        <Method name="renderContents">
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[    this.getConnectedController(); // to receive notifications
]]></Implementation>
        </Method>

        <Method name="onCreate">
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    var container = document.getElementById(this.id),
        source,
        setup,
        _ = this,
        widget = this, // It's lie. It changes later.
        widgetKey,
        i, info = {};

    var post = function (url, data, callback) {

        var xhr = new XMLHttpRequest();
        xhr.open("POST", url);
        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4 && xhr.status === 200) {
                callback((function () {
                    try {
                        return JSON.parse(xhr.responseText) || {}
                    } catch (e) {
                        return {
                            error: "<h1>Unable to parse server response</h1><p>" + xhr.responseText
                                + "</p>"
                            };
                    }
                })());
            } else if (xhr.readyState === 4 && xhr.status !== 200) {
                callback({ error: xhr.responseText
                    || "Error while trying to retrieve data from server." });
            }
        };
        xhr.send(JSON.stringify(data));

    };

    if (!container) {
        console.error("Light pivot table: Unable to get widget with ID=" + this.id);
        return;
    }

    for (i in container.childNodes) {
        if (container.childNodes[i].className === "lpt-container") {
            container = container.childNodes[i];
            break;
        }
    }

    setTimeout(function() { // onCreate fired when scripts are ready, but this.parent is missed.

        // !ultra-bydlocode (get the widget object)
        while (widget["parent"]) {
            widget = widget["parent"];
        }
        // !ultra-bydlocode (possible you will have better suggestions to get widget key)
        widgetKey = parseInt(_.parent.parent.onwindowgrab.match(/[0-9]+/)[0]);

        post((source = location.origin + container.getAttribute("data-source")) + "/Widgets", {
            Dashboard: widget["dashboardName"]
            }, function (data) {
                if (data.error) {
                    container.innerHTML = "<br/><br/><h3>Unable to get data from server.</h3><p>Check if data source is configured and accessible: " + source + "/Widgets" + "</p>"
                } else {
                    for (i in data.children) {
                        if (data.children[i].key === widgetKey) {
                            info = data.children[i];
                            break;
                        }
                    }
                    //console.log(info);
                    //console.log(AA = _.getConnectedController());
                    setup = {
                        container: container,
                        dataSource: {
                            MDX2JSONSource: source,
                            basicMDX: info["mdx"]
                        }
                    }
                    if (info["drillDownDataSource"]) setup["drillDownTarget"] = info["drillDownDataSource"];
                    setup["showSummary"] = !!parseInt(container.getAttribute("show-summary"));

                    post(source + "/DataSource", { DataSource: info["dataSource"] }, function (data) {

                        //console.log(data);
                        if (data["rowAxisOptions"]) {
                            if (data["rowAxisOptions"]["drilldownSpec"]) {
                                console.log(data["rowAxisOptions"]["drilldownSpec"]);
                                setup.DrillDownExpression = data["rowAxisOptions"]["drilldownSpec"];
                            }
                            if (data["rowAxisOptions"]["levelFormat"] || data["columnAxisOptions"] && data["columnAxisOptions"]["levelFormat"]) {
                                setup["formatNumbers"] = data["columnAxisOptions"]["levelFormat"] || data["rowAxisOptions"]["levelFormat"];
                            }
                        }

                        _.LightPivotTable = new LightPivotTable(setup);

                    });
                }
        });

    }, 0);
]]></Implementation>
        </Method>

        <Method name="%DrawHTML">
            <Implementation><![CDATA[
    set ..renderFlag = ..renderFlag + 1

    // copy ..settings into properties
    #dim propName As %String = $order(..settings(""))
    while (propName '= "")
    {
        if ("" '= $get(..settings(propName)))
            try
            {
                set $property($this, propName) = ..settings(propName)
            }
            catch {}

        set propName = $order(..settings(propName))
    }

    &html<
        <div data-source="#(..DataSource)#" show-summary="#(..ShowSummary)#" class="lpt-container" style="position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;">

        </div>
    >
]]></Implementation>
        </Method>

        <Method name="adjustContentSize">
            <FormalSpec>load,width,height</FormalSpec>
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    if (!load && this.LightPivotTable) {
        this.LightPivotTable.updateSizes();
    }

    // cheat-codes to make instrument panel visible

    var outContainer = document.getElementById(this.id),
        inContainer;

    if (outContainer) {
        for (var i in outContainer.childNodes) {
            if (outContainer.childNodes[i].className === "lpt-container") {
                inContainer = outContainer.childNodes[i];
                inContainer.style.height = outContainer.clientHeight + "px";
                break;
            }
        }
    }
]]></Implementation>
        </Method>
    </Class>

</Export><commit_msg>MDX2JSON source default setting for namespace<commit_after><?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">

<CSP name="DeepSeeLightPivotTable.css" application="">
<![CDATA[{{replace:css}}]]>
</CSP>

<CSP name="DeepSeeLightPivotTable.js" application="">
<![CDATA[{{replace:js}}]]>
</CSP>

    <Class name="DeepSee.LightPivotTable">
        <Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
        <TimeChanged>63524,69651.14693</TimeChanged>
        <TimeCreated>63515,61322.546099</TimeCreated>

        <Parameter name="INCLUDEFILES">
            <Default>style:DeepSeeLightPivotTable.css,script:DeepSeeLightPivotTable.js</Default>
        </Parameter>

        <Property name="DataSource">
            <Type>%String</Type>
        </Property>

        <Property name="ShowSummary">
            <Type>%Boolean</Type>
        </Property>

        <Method name="%OnGetPortletName">
            <ClassMethod>1</ClassMethod>
            <ReturnType>%String</ReturnType>
            <Implementation><![CDATA[    quit "Light pivot table"
]]></Implementation>
        </Method>

        <Method name="%OnGetPortletIcon">
            <ClassMethod>1</ClassMethod>
            <ReturnType>%String</ReturnType>
            <Implementation><![CDATA[    quit "deepsee/ds2_dialpad_44.png"
]]></Implementation>
        </Method>

        <Method name="%OnGetPortletSettings">
            <ClassMethod>1</ClassMethod>
            <FormalSpec>*pInfo:%List</FormalSpec>
            <ReturnType>%Status</ReturnType>
            <Implementation><![CDATA[
    kill pInfo // $LB(name,value,type,caption,title)

    set pInfo($I(pInfo)) = $LB("DataSource", "/" _ $NAMESPACE, "%String", $$$Text("MDX2JSON source", "%DeepSee"), "Set the URL of MDX2JSON source. Example: ""/SAMPLES""")
    set pInfo($I(pInfo)) = $LB("ShowSummary", 1, "%Boolean", $$$Text("Show summary?", "%DeepSee"), "Show summary row")

    quit $$$OK
]]></Implementation>
        </Method>

        <Method name="getConnectedController">
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    var controller = this.getController();

    if (null === controller) {
        this.connectToController();
        controller = this.getController();
    }

    return controller;
]]></Implementation>
        </Method>

        <Method name="notifyViewHandler">
            <FormalSpec>reason,data1,data2,data3</FormalSpec>
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    if (!this.LightPivotTable) return;

    var controller = this.getConnectedController();

    if (reason === "dataChange") {

        this.LightPivotTable.clearFilters();

        // updateFilters
        for (var i in controller.filters) {
            this.LightPivotTable.setFilter(controller.filters[i].spec);
        }

        this.LightPivotTable.refresh();

    }
]]></Implementation>
        </Method>

        <Method name="renderContents">
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[    this.getConnectedController(); // to receive notifications
]]></Implementation>
        </Method>

        <Method name="onCreate">
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    var container = document.getElementById(this.id),
        source,
        setup,
        _ = this,
        widget = this, // It's lie. It changes later.
        widgetKey,
        i, info = {};

    var post = function (url, data, callback) {

        var xhr = new XMLHttpRequest();
        xhr.open("POST", url);
        xhr.onreadystatechange = function () {
            if (xhr.readyState === 4 && xhr.status === 200) {
                callback((function () {
                    try {
                        return JSON.parse(xhr.responseText) || {}
                    } catch (e) {
                        return {
                            error: "<h1>Unable to parse server response</h1><p>" + xhr.responseText
                                + "</p>"
                            };
                    }
                })());
            } else if (xhr.readyState === 4 && xhr.status !== 200) {
                callback({ error: xhr.responseText
                    || "Error while trying to retrieve data from server." });
            }
        };
        xhr.send(JSON.stringify(data));

    };

    if (!container) {
        console.error("Light pivot table: Unable to get widget with ID=" + this.id);
        return;
    }

    for (i in container.childNodes) {
        if (container.childNodes[i].className === "lpt-container") {
            container = container.childNodes[i];
            break;
        }
    }

    setTimeout(function() { // onCreate fired when scripts are ready, but this.parent is missed.

        // !ultra-bydlocode (get the widget object)
        while (widget["parent"]) {
            widget = widget["parent"];
        }
        // !ultra-bydlocode (possible you will have better suggestions to get widget key)
        widgetKey = parseInt(_.parent.parent.onwindowgrab.match(/[0-9]+/)[0]);

        post((source = location.origin + container.getAttribute("data-source")) + "/Widgets", {
            Dashboard: widget["dashboardName"]
            }, function (data) {
                if (data.error) {
                    container.innerHTML = "<br/><br/><h3>Unable to get data from server.</h3><p>Check if data source is configured and accessible: " + source + "/Widgets" + "</p>"
                } else {
                    for (i in data.children) {
                        if (data.children[i].key === widgetKey) {
                            info = data.children[i];
                            break;
                        }
                    }
                    //console.log(info);
                    //console.log(AA = _.getConnectedController());
                    setup = {
                        container: container,
                        dataSource: {
                            MDX2JSONSource: source,
                            basicMDX: info["mdx"]
                        }
                    }
                    if (info["drillDownDataSource"]) setup["drillDownTarget"] = info["drillDownDataSource"];
                    setup["showSummary"] = !!parseInt(container.getAttribute("show-summary"));

                    post(source + "/DataSource", { DataSource: info["dataSource"] }, function (data) {

                        //console.log(data);
                        if (data["rowAxisOptions"]) {
                            if (data["rowAxisOptions"]["drilldownSpec"]) {
                                console.log(data["rowAxisOptions"]["drilldownSpec"]);
                                setup.DrillDownExpression = data["rowAxisOptions"]["drilldownSpec"];
                            }
                            if (data["rowAxisOptions"]["levelFormat"] || data["columnAxisOptions"] && data["columnAxisOptions"]["levelFormat"]) {
                                setup["formatNumbers"] = data["columnAxisOptions"]["levelFormat"] || data["rowAxisOptions"]["levelFormat"];
                            }
                        }

                        _.LightPivotTable = new LightPivotTable(setup);

                    });
                }
        });

    }, 0);
]]></Implementation>
        </Method>

        <Method name="%DrawHTML">
            <Implementation><![CDATA[
    set ..renderFlag = ..renderFlag + 1

    // copy ..settings into properties
    #dim propName As %String = $order(..settings(""))
    while (propName '= "")
    {
        if ("" '= $get(..settings(propName)))
            try
            {
                set $property($this, propName) = ..settings(propName)
            }
            catch {}

        set propName = $order(..settings(propName))
    }

    &html<
        <div data-source="#(..DataSource)#" show-summary="#(..ShowSummary)#" class="lpt-container" style="position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;">

        </div>
    >
]]></Implementation>
        </Method>

        <Method name="adjustContentSize">
            <FormalSpec>load,width,height</FormalSpec>
            <Language>javascript</Language>
            <ClientMethod>1</ClientMethod>
            <Implementation><![CDATA[
    if (!load && this.LightPivotTable) {
        this.LightPivotTable.updateSizes();
    }

    // cheat-codes to make instrument panel visible

    var outContainer = document.getElementById(this.id),
        inContainer;

    if (outContainer) {
        for (var i in outContainer.childNodes) {
            if (outContainer.childNodes[i].className === "lpt-container") {
                inContainer = outContainer.childNodes[i];
                inContainer.style.height = outContainer.clientHeight + "px";
                break;
            }
        }
    }
]]></Implementation>
        </Method>
    </Class>

</Export>
{'fraction_non_alphanumeric': 0.14268433496453511, 'fraction_numerical': 0.00868752405564414, 'mean_word_length': 1.8374414976599065, 'pattern_counts': {'":': 0, '<': 253, '<?xml version=': 2, '>': 253, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6928867', 'n_tokens_mistral': 5010, 'n_tokens_neox': 4772, 'n_words': 896}