Revert "F #1147: Permit to rename disk snapshot names in Sunstone"

This reverts commit a36d024993.
This commit is contained in:
Ruben S. Montero committed 2018-10-11 17:08:53 +02:00
1 parent a8ae272302
commit dc52cd3a45
22 files changed
-230

No files matched your search

@@ -393,7 +393,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.resched: true
VM.unresched: true
@@ -79,7 +79,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.save_as_template: true
dashboard:
@@ -392,7 +392,6 @@ tabs:
VM.snapshot_delete: false
VM.disk_snapshot_create: false
VM.disk_snapshot_revert: false
VM.disk_snapshot_rename: false
VM.disk_snapshot_delete: false
VM.resched: false
VM.unresched: false
@@ -385,7 +385,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.resched: false
VM.unresched: false
@@ -393,7 +393,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.resched: true
VM.unresched: true
@@ -79,7 +79,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.save_as_template: true
dashboard:
@@ -392,7 +392,6 @@ tabs:
VM.snapshot_delete: false
VM.disk_snapshot_create: false
VM.disk_snapshot_revert: false
VM.disk_snapshot_rename: false
VM.disk_snapshot_delete: false
VM.resched: false
VM.unresched: false
@@ -385,7 +385,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.resched: false
VM.unresched: false
@@ -391,7 +391,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: false
VM.disk_snapshot_revert: false
VM.disk_snapshot_rename: false
VM.disk_snapshot_delete: false
VM.resched: true
VM.unresched: true
@@ -80,7 +80,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.save_as_template: true
dashboard:
@@ -392,7 +392,6 @@ tabs:
VM.snapshot_delete: false
VM.disk_snapshot_create: false
VM.disk_snapshot_revert: false
VM.disk_snapshot_rename: false
VM.disk_snapshot_delete: false
VM.resched: false
VM.unresched: false
@@ -385,7 +385,6 @@ tabs:
VM.snapshot_delete: true
VM.disk_snapshot_create: true
VM.disk_snapshot_revert: true
VM.disk_snapshot_rename: true
VM.disk_snapshot_delete: true
VM.resched: false
VM.unresched: false
@@ -57,7 +57,6 @@ module OpenNebulaJSON
when "snapshot_delete" then self.snapshot_delete(action_hash['params'])
when "disk_snapshot_create" then self.disk_snapshot_create(action_hash['params'])
when "disk_snapshot_revert" then self.disk_snapshot_revert(action_hash['params'])
when "disk_snapshot_rename" then self.disk_snapshot_rename(action_hash['params'])
when "disk_snapshot_delete" then self.disk_snapshot_delete(action_hash['params'])
when "terminate" then self.terminate(action_hash['params'])
when "reboot" then self.reboot(action_hash['params'])
@@ -140,10 +139,6 @@ module OpenNebulaJSON
super(params['disk_id'].to_i, params['snapshot_id'].to_i)
end
def disk_snapshot_rename(params=Hash.new)
super(params['disk_id'].to_i, params['snapshot_id'].to_i, params['new_name'])
end
def disk_snapshot_delete(params=Hash.new)
super(params['disk_id'].to_i, params['snapshot_id'].to_i)
end
-4
View File
@@ -471,10 +471,6 @@ define(function(require) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "disk_snapshot_revert", action_obj);
},
"disk_snapshot_rename": function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "disk_snapshot_rename", action_obj);
},
"disk_snapshot_delete": function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "disk_snapshot_delete", action_obj);
@@ -736,7 +736,6 @@ define(function(require) {
require("./vms-tab/dialogs/attach-disk"),
require("./vms-tab/dialogs/disk-snapshot"),
require("./vms-tab/dialogs/disk-saveas"),
require("./vms-tab/dialogs/disk-snapshot-rename"),
require("./vms-tab/dialogs/attach-nic"),
require("./vms-tab/dialogs/revert"),
require("./vms-tab/dialogs/snapshot"),
-1
View File
@@ -30,7 +30,6 @@ define(function(require) {
require('./vms-tab/dialogs/attach-disk'),
require('./vms-tab/dialogs/disk-snapshot'),
require('./vms-tab/dialogs/disk-saveas'),
require('./vms-tab/dialogs/disk-snapshot-rename'),
require('./vms-tab/dialogs/disk-resize'),
require('./vms-tab/dialogs/attach-nic'),
require('./vms-tab/dialogs/snapshot'),
@@ -98,7 +98,6 @@ define(function(require) {
"VM.snapshot_delete": _commonActions.singleAction('snapshot_delete'),
"VM.disk_snapshot_create": _commonActions.singleAction('disk_snapshot_create'),
"VM.disk_snapshot_revert": _commonActions.singleAction('disk_snapshot_revert'),
"VM.disk_snapshot_rename": _commonActions.singleAction('disk_snapshot_rename'),
"VM.disk_snapshot_delete": _commonActions.singleAction('disk_snapshot_delete'),
"VM.disk_saveas" : _commonActions.singleAction('disk_saveas'),
@@ -1,108 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2018, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
/*
DEPENDENCIES
*/
var BaseDialog = require('utils/dialogs/dialog');
var TemplateHTML = require('hbs!./disk-snapshot-rename/html');
var Sunstone = require('sunstone');
var Tips = require('utils/tips');
/*
CONSTANTS
*/
var DIALOG_ID = require('./disk-snapshot-rename/dialogId');
var TAB_ID = require('../tabId');
/*
CONSTRUCTOR
*/
function Dialog() {
this.dialogId = DIALOG_ID;
BaseDialog.call(this);
}
Dialog.DIALOG_ID = DIALOG_ID;
Dialog.prototype = Object.create(BaseDialog.prototype);
Dialog.prototype.constructor = Dialog;
Dialog.prototype.html = _html;
Dialog.prototype.onShow = _onShow;
Dialog.prototype.setup = _setup;
Dialog.prototype.setParams = _setParams;
return Dialog;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return TemplateHTML({
'dialogId': this.dialogId
});
}
function _setup(context) {
var that = this;
$('#' + DIALOG_ID + 'Form', context).submit(function() {
var new_name = $('#snapshot_new_name', this).val();
var obj = {
"disk_id" : that.diskId,
"new_name": new_name,
"snapshot_id": that.snapshotId,
};
Sunstone.runAction('VM.disk_snapshot_rename', that.element.ID, obj);
Sunstone.getDialog(DIALOG_ID).hide();
Sunstone.getDialog(DIALOG_ID).reset();
return false;
});
return false;
}
function _onShow(context) {
this.setNames( {tabId: TAB_ID} );
$("#disk_id", context).val(this.diskId);
$("#snapshot_id", context).val(this.snapshotId);
$("#disk_rename", context).focus();
return false;
}
/**
* @param {object} params
* - params.element : VM element
* - params.diskId : Disk ID to save as
* - params.snapshotId : Disk snapshot ID to save as. Can be undefined
*/
function _setParams(params) {
this.element = params.element;
this.diskId = params.diskId;
this.snapshotId = -1;
if(params.snapshotId){
this.snapshotId = params.snapshotId;
}
}
});
@@ -1,19 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2018, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
return 'diskSnapshotRenameVMDialog';
});
@@ -1,50 +0,0 @@
{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2018, OpenNebula Project, OpenNebula Systems }}
{{! }}
{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }}
{{! not use this file except in compliance with the License. You may obtain }}
{{! a copy of the License at }}
{{! }}
{{! http://www.apache.org/licenses/LICENSE-2.0 }}
{{! }}
{{! Unless required by applicable law or agreed to in writing, software }}
{{! distributed under the License is distributed on an "AS IS" BASIS, }}
{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }}
{{! See the License for the specific language governing permissions and }}
{{! limitations under the License. }}
{{! -------------------------------------------------------------------------- }}
<div id="{{dialogId}}" class="reveal small" data-reveal>
<div class="row">
<div class="large-12 columns">
<h3 class="subheader" id="">{{tr "Rename"}}</h3>
</div>
</div>
<div class="confirm-resources-header"></div>
<div class="reveal-body">
<form id="{{dialogId}}Form" action="">
<div class="row">
<div class="large-6 columns">
<label for="disk_id">{{tr "Disk ID"}}</label>
<input style="border-style: inset; background-color: lightgrey" type="text" name="disk_id" id="disk_id" disabled/>
</div>
<div class="large-6 columns snapshot_id_row">
<label for="snapshot_id">{{tr "Snapshot ID"}}</label>
<input style="border-style: inset; background-color: lightgrey" type="text" name="snapshot_id" id="snapshot_id" disabled/>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label for="snapshot_new_name">{{tr "New name"}}</label>
<input type="text" name="snapshot_new_name" id="snapshot_new_name" />
</div>
</div>
<div class="form_buttons">
<button class="button radius right success" type="submit">{{tr "Rename"}}</button>
</div>
<button class="close-button" data-close aria-label="{{tr "Close modal"}}" type="button">
<span aria-hidden="true">&times;</span>
</button>
</form>
</div>
</div>
@@ -43,7 +43,6 @@ define(function(require) {
var ATTACH_DISK_DIALOG_ID = require('../dialogs/attach-disk/dialogId');
var DISK_SNAPSHOT_DIALOG_ID = require('../dialogs/disk-snapshot/dialogId');
var DISK_SAVEAS_DIALOG_ID = require('../dialogs/disk-saveas/dialogId');
var DISK_SNAPSHOT_RENAME_DIALOG_ID = require('../dialogs/disk-snapshot-rename/dialogId');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
var DISK_RESIZE_DIALOG_ID = require('../dialogs/disk-resize/dialogId');
var RESOURCE = "VM"
@@ -525,12 +524,10 @@ define(function(require) {
// Enable/disable buttons
if ($(this).is(":checked")) {
$(".disk_snapshot_saveas", snapshotsSection).prop('disabled', false);
$(".disk_snapshot_rename", snapshotsSection).prop('disabled', false);
$(".disk_snapshot_revert", snapshotsSection).prop('disabled', false);
$(".disk_snapshot_delete", snapshotsSection).prop('disabled', false);
} else {
$(".disk_snapshot_saveas", snapshotsSection).prop('disabled', true);
$(".disk_snapshot_rename", snapshotsSection).prop('disabled', true);
$(".disk_snapshot_revert", snapshotsSection).prop('disabled', true);
$(".disk_snapshot_delete", snapshotsSection).prop('disabled', true);
}
@@ -557,27 +554,6 @@ define(function(require) {
});
}
if (Config.isTabActionEnabled("vms-tab", "VM.disk_snapshot_rename")) {
context.off('click', '.disk_snapshot_rename');
context.on('click', '.disk_snapshot_rename', function() {
var snapshotsSection = $(this).closest('.snapshots');
var disk_id = snapshotsSection.attr('disk_id');
var snapshot_id = $(".snapshot_check_item:checked", snapshotsSection).attr('snapshot_id');
var dialog = Sunstone.getDialog(DISK_SNAPSHOT_RENAME_DIALOG_ID);
dialog.setParams(
{ element: that.element,
diskId: disk_id,
snapshotId: snapshot_id
});
dialog.reset();
dialog.show();
return false;
});
}
if (Config.isTabActionEnabled("vms-tab", "VM.disk_snapshot_revert")) {
context.off('click', '.disk_snapshot_revert');
context.on('click', '.disk_snapshot_revert', function() {
@@ -22,11 +22,6 @@
<span class="fas fa-save fa-fw"></span>{{tr "Save as"}}
</button>
{{/isTabActionEnabled}}
{{#isTabActionEnabled "vms-tab" "VM.disk_snapshot_rename"}}
<button class="disk_snapshot_rename button secondary small radius" disabled="disabled">
<span class="fas fa-edit fa-fw"></span>{{tr "Rename"}}
</button>
{{/isTabActionEnabled}}
{{#isTabActionEnabled "vms-tab" "VM.disk_snapshot_revert"}}
<button class="disk_snapshot_revert button secondary small radius" disabled="disabled">
<span class="fas fa-reply fa-fw"></span>{{tr "Revert"}}