<commit_before>import $ from 'jquery';

import View from 'girder/views/View';
import { AccessType } from 'girder/constants';
import events from 'girder/events';
import candela from 'girder_plugins/candela/node/candela/dist/candela';
import datalib from 'girder_plugins/candela/node/datalib';

import CandelaWidgetTemplate from '../templates/candelaWidget.pug';
import '../stylesheets/candelaWidget.styl';

import CandelaParametersView from './CandelaParametersView';

var CandelaWidget = View.extend({
    events: {
        'change .g-item-candela-component': 'updateComponent'
    },

    initialize: function (settings) {
        this.item = settings.item;
        this.accessLevel = settings.accessLevel;
        this._components = [];
        for (let component in candela.components) {
            if (candela.components.hasOwnProperty(component)) {
                this._components.push(component);
            }
        }

        this.listenTo(this.item, 'change', function () {
            this.render();
        }, this);

        this.parametersView = new CandelaParametersView({
            component: candela.components[this.$('.g-item-candela-component').val()],
            parentView: this
        });

        this.render();
    },

    updateComponent: function () {<commit_msg>Only add vis components with specified options to the selection list<commit_after>import $ from 'jquery';

import View from 'girder/views/View';
import { AccessType } from 'girder/constants';
import events from 'girder/events';
import candela from 'girder_plugins/candela/node/candela/dist/candela';
import datalib from 'girder_plugins/candela/node/datalib';

import CandelaWidgetTemplate from '../templates/candelaWidget.pug';
import '../stylesheets/candelaWidget.styl';

import CandelaParametersView from './CandelaParametersView';

var CandelaWidget = View.extend({
    events: {
        'change .g-item-candela-component': 'updateComponent'
    },

    initialize: function (settings) {
        this.item = settings.item;
        this.accessLevel = settings.accessLevel;
        this._components = [];
        for (let component in candela.components) {
            if (candela.components.hasOwnProperty(component)) {
                if (candela.components[component].options) {
                    this._components.push(component);
                }
            }
        }

        this.listenTo(this.item, 'change', function () {
            this.render();
        }, this);

        this.parametersView = new CandelaParametersView({
            component: candela.components[this.$('.g-item-candela-component').val()],
            parentView: this
        });

        this.render();
    },

    updateComponent: function () {
{'fraction_non_alphanumeric': 0.12234432234432234, 'fraction_numerical': 0.0, 'mean_word_length': 2.7565337001375516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '128720', 'n_tokens_mistral': 775, 'n_tokens_neox': 760, 'n_words': 154}