<commit_before>define(['require', 'jquery', 'lodash', 'log', 'alerts', 'app/source-editor/completion-engine', 'functionModel'],

    function (require, $, _, log, Alerts, CompletionEngine, FunctionModel) {
        var FunctionInputOptionComponent = function (container, config) {
            var self = this;
            this.__container = container;
            this.__config = config;
            this.__functionData = {};
            this.__allowRepetitiveParameters = false;
            this.__repetitiveParameterTypes = [];

            var extensionData = CompletionEngine.getRawMetadata().extensions;

            Object.keys(extensionData)
                .filter(function (key) {
                    return extensionData[key].streamProcessors.length > 0;
                })
                .forEach(function (key) {
                    extensionData[key].streamProcessors.forEach(function (funcData) {
                        self.__functionData[`${funcData.namespace}:${funcData.name}`] = funcData;
                    });
                });

        }

        FunctionInputOptionComponent.prototype.constructor = FunctionInputOptionComponent;

        FunctionInputOptionComponent.prototype.render = function () {
            var self = this;
            var container = this.__container;
            var config = this.__config;

            container.empty();
            container.append(`
                <h3 style="margin-top: 0;color: #373737">Function configuration</h3>
                <div style="color: #373737">
                    <label for="function-name">Function type&nbsp;:&nbsp;</label>
                    <select name="function-name" id="function-name">
                        <option disabled selected value> -- select an option -- </option>
                    </select>
                </div>
                <div style="padding: 0 5px" class="function-parameter-section">
                </div>
            `);

            Object.keys(this.__functionData).forEach(function (key) {
                container.find('#function-name').append(`
                    <option>${key}</option>
                `);
            });

            if (config.query.function.text) {
                var functionName = config.query.function.text.match('([a-zA-Z:_0-9]+)\(.*\)')[1];
                console.log(functionName)
            } else {
                if (config.query.function.name) {
                    container.find('#function-name').val(config.query.function.name);
                }

                if (config.query.function['parameters'] && Object.keys(config.query.function['parameters']).length > 0) {

                    var functionDataContainer = container.find('.function-parameter-section');
                    functionDataContainer.empty();
                    functionDataContainer.append('<h6 style="color: #373737">Select function syntax to proceed</h6>');

                    Object.keys(config.query.function.parameters)
                        .forEach(function(key, i) {
                            var paramData = config.query.function.parameters[key];
                            functionDataContainer.append(`
                                <div style="width: 100%; padding-bottom: 10px" class="input-section">
                                    <label style="margin-bottom: 0" class="${paramData.length > 0 ? '' : 'not-visible'}" id="label-function-param-${key.replaceAll(/\./g, '-')}" for="function-param-${key.replaceAll(/\./g, '-')}">${key}</label>
                                    <input id="function-param-${key.replaceAll(/\./g, '-')}" style="width: 100%; border: none; background-color: transparent; border-bottom: 1px solid #373737" placeholder="${key}" type="text" value="${paramData.value}">
                                </div>
                            `);
                        })

                    container.find('.function-parameter-section .input-section input')
                        .on('focus', function (evt) {<commit_msg>filter-input-options handle text in the object ETL -Wizard<commit_after>define(['require', 'jquery', 'lodash', 'log', 'alerts', 'app/source-editor/completion-engine', 'functionModel'],

    function (require, $, _, log, Alerts, CompletionEngine, FunctionModel) {
        var FunctionInputOptionComponent = function (container, config) {
            var self = this;
            this.__container = container;
            this.__config = config;
            this.__functionData = {};
            this.__allowRepetitiveParameters = false;
            this.__repetitiveParameterTypes = [];

            var extensionData = CompletionEngine.getRawMetadata().extensions;

            Object.keys(extensionData)
                .filter(function (key) {
                    return extensionData[key].streamProcessors.length > 0;
                })
                .forEach(function (key) {
                    extensionData[key].streamProcessors.forEach(function (funcData) {
                        self.__functionData[`${funcData.namespace}:${funcData.name}`] = funcData;
                    });
                });

        }

        FunctionInputOptionComponent.prototype.constructor = FunctionInputOptionComponent;

        FunctionInputOptionComponent.prototype.render = function () {
            var self = this;
            var container = this.__container;
            var config = this.__config;

            container.empty();
            container.append(`
                <h3 style="margin-top: 0;color: #373737">Function configuration</h3>
                <div style="color: #373737">
                    <label for="function-name">Function type&nbsp;:&nbsp;</label>
                    <select name="function-name" id="function-name">
                        <option disabled selected value="0"> -- select an option -- </option>
                    </select>
                </div>
                <div style="padding: 0 5px" class="function-parameter-section">
                </div>
            `);

            Object.keys(this.__functionData).forEach(function (key) {
                container.find('#function-name').append(`
                    <option>${key}</option>
                `);
            });

            if (config.query.function.text) {
                var functionName = config.query.function.text.match('([a-zA-Z:_0-9]+)\(.*\)')[1];
                container.find('.function-parameter-section')
                    .append(`
                        <div style="display:flex;margin-top: 15px; text-align: center; font-size: 1.8rem;">
                            <div style="flex: 1">
                                <span>${config.query.function.text}</span>
                            </div>
                            <div>
                                <a style="color: #323232">
                                    <i title="clear stream processor function" class="fw fw-clear"></i>    
                                </a>    
                            </div>
                        </div>
                    `);

                container.find('#function-name').val(functionName);
                container.find('.fw-clear').on('click', function(evt) {
                    config.query.function = {enable: true}
                    self.render();
                });
            } else {
                if (config.query.function.name) {
                    container.find('#function-name').val(config.query.function.name);
                }

                if (config.query.function['parameters'] && Object.keys(config.query.function['parameters']).length > 0) {
                    var functionDataContainer = container.find('.function-parameter-section');
                    functionDataContainer.empty();
                    functionDataContainer.append('<h6 style="color: #373737">Select function syntax to proceed</h6>');

                    Object.keys(config.query.function.parameters)
                        .forEach(function(key, i) {
                            var paramData = config.query.function.parameters[key];
                            functionDataContainer.append(`
                                <div style="width: 100%; padding-bottom: 10px" class="input-section">
                                    <label style="margin-bottom: 0" class="${paramData.length > 0 ? '' : 'not-visible'}" id="label-function-param-${key.replaceAll(/\./g, '-')}" for="function-param-${key.replaceAll(/\./g, '-')}">${key}</label>
                                    <input id="function-param-${key.replaceAll(/\./g, '-')}" style="width: 100%; border: none; background-color: transparent; border-bottom: 1px solid #373737" placeholder="${key}" type="text" value="${paramData.value}">
                                </div>
                            `);
                        })

                    container.find('.function-parameter-section .input-section input')
                        .on('focus', function (evt) {
{'fraction_non_alphanumeric': 0.13605517855156302, 'fraction_numerical': 0.011792190455000556, 'mean_word_length': 1.597515169026293, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5838107', 'n_tokens_mistral': 2277, 'n_tokens_neox': 2092, 'n_words': 365}