1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

Feature #4215: Remove vrouter clone action

This commit is contained in:
Carlos Martín 2016-01-08 16:37:09 +01:00
parent 5523c818f0
commit 166e0fd586
13 changed files with 0 additions and 251 deletions

View File

@ -95,25 +95,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
# TODO: implement or remove
=begin
clone_desc = <<-EOT.unindent
Creates a new Virtual Router from an existing one
EOT
command :clone, clone_desc, :vrouterid, :name do
helper.perform_action(args[0],options,"cloned") do |t|
res = t.clone(args[1])
if !OpenNebula.is_error?(res)
puts "ID: #{res}"
else
puts res.message
end
end
end
=end
delete_desc = <<-EOT.unindent
Deletes the given Virtual Router
EOT

View File

@ -30,8 +30,6 @@ module OpenNebula
:delete => "vrouter.delete",
:chown => "vrouter.chown",
:chmod => "vrouter.chmod",
# TODO: remove or implement
# :clone => "vrouter.clone",
:rename => "vrouter.rename"
}
@ -125,21 +123,7 @@ module OpenNebula
super(VIRTUAL_ROUTER_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
group_m, group_a, other_u, other_m, other_a)
end
=begin
# Clones this VirtualRouter into a new one
#
# @param [String] name for the new VirtualRouter.
#
# @return [Integer, OpenNebula::Error] The new VirtualRouter ID in case
# of success, Error otherwise
def clone(name)
return Error.new('ID not defined') if !@pe_id
rc = @client.call(VIRTUAL_ROUTER_METHODS[:clone], @pe_id, name)
return rc
end
=end
# Renames this VirtualRouter
#
# @param name [String] New name for the VirtualRouter.

View File

@ -451,7 +451,6 @@ tabs:
VirtualRouter.chown: true
VirtualRouter.chgrp: true
VirtualRouter.chmod: true
VirtualRouter.clone_dialog: true
VirtualRouter.delete: true
marketplace-tab:
panel_tabs:

View File

@ -445,7 +445,6 @@ tabs:
VirtualRouter.chown: true
VirtualRouter.chgrp: true
VirtualRouter.chmod: true
VirtualRouter.clone_dialog: true
VirtualRouter.delete: true
marketplace-tab:
panel_tabs:

View File

@ -446,7 +446,6 @@ tabs:
VirtualRouter.chown: true
VirtualRouter.chgrp: true
VirtualRouter.chmod: true
VirtualRouter.clone_dialog: true
VirtualRouter.delete: true
marketplace-tab:
panel_tabs:

View File

@ -47,7 +47,6 @@ module OpenNebulaJSON
when "update" then self.update(action_hash['params'])
when "chown" then self.chown(action_hash['params'])
when "chmod" then self.chmod_json(action_hash['params'])
when "clone" then self.clone(action_hash['params'])
when "rename" then self.rename(action_hash['params'])
else
error_msg = "#{action_hash['perform']} action not " <<
@ -80,10 +79,6 @@ module OpenNebulaJSON
end
end
def clone(params=Hash.new)
super(params['name'])
end
def rename(params=Hash.new)
super(params['name'])
end

View File

@ -48,11 +48,6 @@ define(function(require) {
var action_obj = {"template_raw" : params.data.extra_param};
OpenNebulaAction.simple_action(params, RESOURCE, "update", action_obj);
},
"clone" : function(params) {
var name = params.data.extra_param ? params.data.extra_param : "";
var action_obj = {"name" : name};
OpenNebulaAction.simple_action(params, RESOURCE, "clone", action_obj);
},
"rename" : function(params) {
var action_obj = params.data.extra_param;
OpenNebulaAction.simple_action(params, RESOURCE, "rename", action_obj);

View File

@ -24,7 +24,6 @@ define(function(require) {
var DATATABLE_ID = "dataTableVirtualRouters";
var _dialogs = [
require('./vrouters-tab/dialogs/clone')
];
var _panels = [

View File

@ -26,7 +26,6 @@ define(function(require) {
var XML_ROOT = "VROUTER";
var TAB_ID = require('./tabId');
var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId');
var CLONE_DIALOG_ID = require('./dialogs/clone/dialogId');
var _commonActions = new CommonActions(OpenNebulaResource, RESOURCE, TAB_ID, XML_ROOT);
@ -45,25 +44,6 @@ define(function(require) {
"VirtualRouter.update_template" : _commonActions.updateTemplate(),
"VirtualRouter.update_dialog" : _commonActions.checkAndShowUpdate(),
"VirtualRouter.show_to_update" : _commonActions.showUpdate(CREATE_DIALOG_ID),
"VirtualRouter.clone_dialog" : {
type: "custom",
call: function(){
Sunstone.getDialog(CLONE_DIALOG_ID).show();
}
},
"VirtualRouter.clone" : {
type: "single",
call: OpenNebulaResource.clone,
callback: function(request, response) {
Sunstone.getDialog(CLONE_DIALOG_ID).hide();
Sunstone.getDialog(CLONE_DIALOG_ID).reset();
Sunstone.runAction('VirtualRouter.refresh');
},
error: Notifier.onError,
notify: true
}
};
return _actions;

View File

@ -41,11 +41,6 @@ define(function(require) {
select: "Group",
tip: Locale.tr("Select the new group")+":"
},
"VirtualRouter.clone_dialog" : {
type: "action",
layout: "main",
text: Locale.tr("Clone")
},
"VirtualRouter.delete" : {
type: "confirm",
layout: "del",

View File

@ -1,113 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, 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!./clone/html');
var Sunstone = require('sunstone');
var Notifier = require('utils/notifier');
var Locale = require('utils/locale');
var OpenNebulaVirtualRouter = require('opennebula/virtualrouter');
/*
CONSTANTS
*/
var DIALOG_ID = require('./clone/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;
return Dialog;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return TemplateHTML({
'dialogId': this.dialogId
});
}
function _setup(context) {
var that = this;
context.foundation('abide', 'reflow');
context.off('invalid.fndtn.abide', '#' + DIALOG_ID + 'Form');
context.off('valid.fndtn.abide', '#' + DIALOG_ID + 'Form');
context.on('invalid.fndtn.abide', '#' + DIALOG_ID + 'Form', function(e) {
Notifier.notifyError(Locale.tr("One or more required fields are missing or malformed."));
}).on('valid.fndtn.abide', '#' + DIALOG_ID + 'Form', function(e) {
var name = $('input', this).val();
var sel_elems = Sunstone.getDataTable(TAB_ID).elements();
if (sel_elems.length > 1){
for (var i=0; i< sel_elems.length; i++)
//use name as prefix if several items selected
Sunstone.runAction('VirtualRouter.clone',
sel_elems[i],
name + OpenNebulaVirtualRouter.getName(sel_elems[i]));
} else {
Sunstone.runAction('VirtualRouter.clone',sel_elems[0],name);
}
return false;
});
return false;
}
function _onShow(context) {
var sel_elems = Sunstone.getDataTable(TAB_ID).elements();
//show different text depending on how many elements are selected
if (sel_elems.length > 1) {
$('.clone_one', context).hide();
$('.clone_several', context).show();
$('input',context).val('Copy of ');
} else {
$('.clone_one', context).show();
$('.clone_several', context).hide();
$('input',context).val('Copy of ' + OpenNebulaVirtualRouter.getName(sel_elems[0]));
}
$("input[name='name']",context).focus();
return false;
}
});

View File

@ -1,19 +0,0 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, 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 'cloneVirtualRouterDialog';
});

View File

@ -1,45 +0,0 @@
{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2015, 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-modal" role="dialog" data-reveal >
<div class="row">
<h3 class="subheader">{{tr "Clone Virtual Router"}}</h3>
</div>
<form data-abide="ajax" id="{{dialogId}}Form">
<div class="row">
<div class="large-12 columns">
<div class="clone_one"></div>
<div class="clone_several">
{{tr "Several virtual routers are selected, please choose a prefix to name the new copies"}}
<br>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label class="clone_one">{{tr "Name"}}</label>
<label class="clone_several">{{tr "Prefix"}}</label>
<input required type="text" name="name"></input>
</div>
</div>
<div class="form_buttons row">
<button type="submit" class="button radius right">
{{tr "Clone"}}
</button>
</div>
<a class="close-reveal-modal">&#215;</a>
</form>
</div>