<commit_before>var CoreView = require('backbone/core-view');
var template = require('./analyses-workflow.tpl');
var ListView = require('./analyses-workflow-list-view');
var ScrollView = require('../../../../components/scroll/scroll-view');
var checkAndBuildOpts = require('../../../../helpers/required-opts');

var REQUIRED_OPTS = [
  'analysisDefinitionNodesCollection',
  'analysisFormsCollection',
  'viewModel',
  'layerDefinitionModel'
];

module.exports = CoreView.extend({

  events: {
    'click .js-delete': '_deleteAnalysis'
  },

  initialize: function (opts) {
    checkAndBuildOpts(opts, REQUIRED_OPTS, this);

    this.listenTo(this._analysisDefinitionNodesCollection, 'add', this.render);
  },

  render: function () {
    this.clearSubViews();
    this.$el.html(this._html());
    this._renderAnalysesView();
    return this;
  },

  _html: function () {
    return template({
      canDelete: this._canDeleteSelectedNode(),
      deleteLabel: !this._nodeDefModel()
        ? _t('editor.layers.layer.cancel-delete-analysis')
        : _t('editor.layers.layer.delete'),
      selectedNodeId: this._viewModel.get('selectedNodeId'),
      layerAnalysisCount: this._layerDefinitionModel.getNumberOfAnalyses()<commit_msg>Fixed workflow not rendering header correctly<commit_after>var CoreView = require('backbone/core-view');
var template = require('./analyses-workflow.tpl');
var ListView = require('./analyses-workflow-list-view');
var ScrollView = require('../../../../components/scroll/scroll-view');
var checkAndBuildOpts = require('../../../../helpers/required-opts');

var REQUIRED_OPTS = [
  'analysisDefinitionNodesCollection',
  'analysisFormsCollection',
  'viewModel',
  'layerDefinitionModel'
];

module.exports = CoreView.extend({

  events: {
    'click .js-delete': '_deleteAnalysis'
  },

  initialize: function (opts) {
    checkAndBuildOpts(opts, REQUIRED_OPTS, this);

    this.listenTo(this._analysisDefinitionNodesCollection, 'add', function () {
      // change:source happens when a node is deleted as well, so we can't just listen to it all the time
      this._layerDefinitionModel.once('change:source', this.render, this);
    });
  },

  render: function () {
    this.clearSubViews();
    this.$el.html(this._html());
    this._renderAnalysesView();
    return this;
  },

  _html: function () {
    return template({
      canDelete: this._canDeleteSelectedNode(),
      deleteLabel: !this._nodeDefModel()
        ? _t('editor.layers.layer.cancel-delete-analysis')
        : _t('editor.layers.layer.delete'),
      selectedNodeId: this._viewModel.get('selectedNodeId'),
      layerAnalysisCount: this._layerDefinitionModel.getNumberOfAnalyses()
{'fraction_non_alphanumeric': 0.1538175046554935, 'fraction_numerical': 0.0, 'mean_word_length': 3.992565055762082, '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': '539914', 'n_tokens_mistral': 796, 'n_tokens_neox': 773, 'n_words': 140}