Sha256: fd1e7b05ce54dc8e406f04ab31b70b540c277c660e3240f4cf223b1b96f8c929

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

// Copyright 2018 Tristan Robert

// This file is part of ForemanFogProxmox.

// ForemanFogProxmox is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// ForemanFogProxmox is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.

function getIndex(item) {
  var id = $(item).attr('id');
  var pattern = /(host_compute_attributes_volumes_attributes_||compute_attribute_vm_attrs_volumes_attributes_)(\d+)[_](.*)/i;
  pattern_a = pattern.exec(id);
  var index = pattern_a[2];
  return index;
}

function volumeId(type,index){
  let id = '#volume_' + type + '_' + index;
  return id;
}

function enableField(id) {
  $(id).show();
  $(id).removeAttr('disabled');
}

function disableField(id) {  
  $(id).hide();
  $(id).attr('disabled','disabled');
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_fog_proxmox-0.13.1 app/assets/javascripts/foreman_fog_proxmox/proxmox_volume.js
foreman_fog_proxmox-0.13.0 app/assets/javascripts/foreman_fog_proxmox/proxmox_volume.js