<commit_before>var _ = require('underscore');
var ContextMenuView = require('../../components/context-menu/context-menu-view');
var CustomListCollection = require('../../components/custom-list/custom-list-collection');
var REQUIRED_OPTS = [
  'ev',
  'isTableOwner',
  'isSync',
  'isCustomQuery',
  'triggerElementID'
];

module.exports = function (opts) {
  _.each(REQUIRED_OPTS, function (item) {
    if (opts[item] === undefined) throw new Error(item + ' is required');
    this['_' + item] = opts[item];
  }, this);

  var position = { x: this._ev.clientX, y: this._ev.clientY };
  var isRasterDataset = (opts.ev.currentTarget.baseURI.indexOf('_raster') > 0);
  var menuItems = [];
  if (!isRasterDataset) {
    menuItems.push({
      label: _t('dataset.duplicate.' + (this._isCustomQuery ? 'customOption' : 'option')),
      val: 'duplicate',
      action: function () {
        this.trigger('duplicate', this);
      }
    });
  }

  if (this._isTableOwner) {
    if (!this._isSync && !isRasterDataset) {
      menuItems.push({
        label: _t('dataset.rename.option'),
        val: 'rename',
        action: function () {
          this.trigger('rename', this);
        }<commit_msg>allow duplicating and renaming rasters<commit_after>var _ = require('underscore');
var ContextMenuView = require('../../components/context-menu/context-menu-view');
var CustomListCollection = require('../../components/custom-list/custom-list-collection');
var REQUIRED_OPTS = [
  'ev',
  'isTableOwner',
  'isSync',
  'isCustomQuery',
  'triggerElementID'
];

module.exports = function (opts) {
  _.each(REQUIRED_OPTS, function (item) {
    if (opts[item] === undefined) throw new Error(item + ' is required');
    this['_' + item] = opts[item];
  }, this);

  var position = { x: this._ev.clientX, y: this._ev.clientY };
  var menuItems = [];
    menuItems.push({
      label: _t('dataset.duplicate.' + (this._isCustomQuery ? 'customOption' : 'option')),
      val: 'duplicate',
      action: function () {
        this.trigger('duplicate', this);
      }
    });

  if (this._isTableOwner) {
    if (!this._isSync ) {
      menuItems.push({
        label: _t('dataset.rename.option'),
        val: 'rename',
        action: function () {
          this.trigger('rename', this);
        }
{'fraction_non_alphanumeric': 0.17484662576687116, 'fraction_numerical': 0.00043821209465381246, 'mean_word_length': 3.1660583941605838, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4943864', 'n_tokens_mistral': 737, 'n_tokens_neox': 738, 'n_words': 143}