mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-14 01:57:24 +03:00
Signed-off-by: Frederick Borges <fborges@opennebula.io>
This commit is contained in:
parent
b319722855
commit
4ef730c166
@ -59,6 +59,7 @@ module OpenNebulaJSON
|
||||
when "enable" then self.enable
|
||||
when "lock" then self.lock(action_hash['params'])
|
||||
when "unlock" then self.unlock(action_hash['params'])
|
||||
when "vm.import" then self.app_vm_import(action_hash['params'])
|
||||
when "vm-template.import" then self.app_vm_import(action_hash['params'])
|
||||
when "service_template.import" then self.app_service_import(action_hash['params'])
|
||||
else
|
||||
|
@ -72,14 +72,9 @@
|
||||
<ul id='{{customId}}vmsrepeat_buttons' class='only-sunstone-info only-sunstone-list dropdown-pane menu vertical' data-dropdown></ul>
|
||||
|
||||
<button type='button' data-toggle='{{customId}}vmsplanification_buttons' class='only-sunstone-info only-sunstone-list top_button button secondary dropdown'>
|
||||
<i class='fas fa-th-list'/>
|
||||
</button>
|
||||
<ul id='{{customId}}vmsplanification_buttons' class='only-sunstone-info only-sunstone-list dropdown-pane menu vertical' data-dropdown></ul>
|
||||
|
||||
<button type='button' data-toggle='{{customId}}vmsmigration_buttons' class='only-sunstone-info only-sunstone-list top_button button secondary dropdown'>
|
||||
<i class='fas fa-share-square'/>
|
||||
</button>
|
||||
<ul id='{{customId}}vmsmigration_buttons' class='only-sunstone-info only-sunstone-list dropdown-pane menu vertical' data-dropdown></ul>
|
||||
<ul id='{{customId}}vmsplanification_buttons' class='only-sunstone-info only-sunstone-list dropdown-pane menu vertical' data-dropdown></ul>
|
||||
|
||||
</span>
|
||||
<span>
|
||||
@ -111,4 +106,3 @@
|
||||
</ul>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
@ -32,7 +32,7 @@ define(function(require) {
|
||||
},
|
||||
"Image.upload_marketplace_dialog" : {
|
||||
type: "action",
|
||||
text: '<i class="fas fa-share"/> '+ Locale.tr("MarketPlace")
|
||||
text: '<i class="fas fa-shopping-cart"/>'
|
||||
},
|
||||
"Image.import_dialog" : {
|
||||
type: "create_dialog",
|
||||
|
@ -27,6 +27,7 @@ define(function(require) {
|
||||
var ImagesTable = require("tabs/images-tab/datatable");
|
||||
var TemplatesTable = require("tabs/templates-tab/datatable");
|
||||
var ServicesTable = require("tabs/oneflow-templates-tab/datatable");
|
||||
var VMsTable = require("tabs/vms-tab/datatable");
|
||||
var MarketPlacesTable = require("tabs/marketplaces-tab/datatable");
|
||||
var Config = require("sunstone-config");
|
||||
var WizardFields = require("utils/wizard-fields");
|
||||
@ -73,6 +74,11 @@ define(function(require) {
|
||||
"title": Locale.tr("Create MarketPlace App from Service"),
|
||||
"buttonText": Locale.tr("Create"),
|
||||
"resetButton": true
|
||||
},
|
||||
"export_vm": {
|
||||
"title": Locale.tr("Create MarketPlace App from VM"),
|
||||
"buttonText": Locale.tr("Create"),
|
||||
"resetButton": true
|
||||
}
|
||||
};
|
||||
|
||||
@ -94,6 +100,10 @@ define(function(require) {
|
||||
FORM_PANEL_ID + "servicesTable",
|
||||
{ "select": true });
|
||||
|
||||
this.vmsTable = new VMsTable(
|
||||
FORM_PANEL_ID + "vmsTable",
|
||||
{ "select": true });
|
||||
|
||||
this.marketPlacesTable = new MarketPlacesTable(
|
||||
FORM_PANEL_ID + "marketPlacesTable",
|
||||
{ "select": true,
|
||||
@ -147,6 +157,7 @@ define(function(require) {
|
||||
FormPanel.prototype.setImageId = _setImageId;
|
||||
FormPanel.prototype.setTemplateId = _setTemplateId;
|
||||
FormPanel.prototype.setServiceId = _setServiceId;
|
||||
FormPanel.prototype.setVMId = _setVMId;
|
||||
FormPanel.prototype.onShow = _onShow;
|
||||
FormPanel.prototype.setup = _setup;
|
||||
|
||||
@ -162,6 +173,7 @@ define(function(require) {
|
||||
"imagesTableHTML": this.imagesTable.dataTableHTML,
|
||||
"templatesTableHTML": this.templatesTable.dataTableHTML,
|
||||
"servicesTableHTML": this.servicesTable.dataTableHTML,
|
||||
"vmsTableHTML": this.vmsTable.dataTableHTML,
|
||||
"marketPlacesImagesTableHTML": this.marketPlacesTable.dataTableHTML,
|
||||
"marketPlacesServicesTableHTML": this.marketPlacesServiceTable.dataTableHTML
|
||||
});
|
||||
@ -178,6 +190,7 @@ define(function(require) {
|
||||
this.imagesTable.resetResourceTableSelect();
|
||||
this.servicesTable.resetResourceTableSelect();
|
||||
this.templatesTable.resetResourceTableSelect();
|
||||
this.vmsTable.resetResourceTableSelect();
|
||||
this.marketPlacesTable.resetResourceTableSelect();
|
||||
this.marketPlacesServiceTable.resetResourceTableSelect();
|
||||
this.marketPlacesTableAdvanced.resetResourceTableSelect();
|
||||
@ -212,6 +225,13 @@ define(function(require) {
|
||||
this.servicesTable.selectResourceTableSelect(selectedResources);
|
||||
}
|
||||
|
||||
function _setVMId(serviceId) {
|
||||
var selectedResources = {
|
||||
ids : serviceId
|
||||
};
|
||||
|
||||
this.vmsTable.selectResourceTableSelect(selectedResources);
|
||||
}
|
||||
|
||||
// Set up the create datastore context
|
||||
function _setup(context) {
|
||||
@ -221,16 +241,13 @@ define(function(require) {
|
||||
this.imagesTable.initialize();
|
||||
this.templatesTable.initialize();
|
||||
this.servicesTable.initialize();
|
||||
this.vmsTable.initialize();
|
||||
this.marketPlacesServiceTable.initialize();
|
||||
this.marketPlacesTable.initialize();
|
||||
this.marketPlacesTableAdvanced.initialize();
|
||||
|
||||
this.marketPlacesTable.idInput().attr("required", "");
|
||||
this.marketPlacesTableAdvanced.idInput().attr("required", "");
|
||||
this.servicesTable.idInput().attr("required", "");
|
||||
// this.templatesTable.idInput().attr("required", "");
|
||||
|
||||
// this.marketPlacesServiceTable.idInput().attr("required", "");
|
||||
|
||||
$('#IMPORT_ALL', context).on('change', function(){
|
||||
if (
|
||||
@ -258,17 +275,46 @@ define(function(require) {
|
||||
that.servicesTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
that.vmsTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
|
||||
$('#importAllCheckBox',context).hide();
|
||||
|
||||
$('#servicesTableHTML', context).hide();
|
||||
$('#templatesTableHTML', context).hide();
|
||||
$('#imagesTableHTML', context).show();
|
||||
$('#vmsTableHTML', context).hide();
|
||||
|
||||
$('#serviceMarketPlaceHTML', context).hide();
|
||||
$('#appMarketPlaceHTML', context).show();
|
||||
$('#templatesForApp',context).show();
|
||||
break;
|
||||
case 'vm':
|
||||
that.imagesTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
that.templatesTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
that.servicesTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
that.vmsTable.idInput().
|
||||
attr("required", "").
|
||||
attr("wizard_field", "ORIGIN_ID");
|
||||
|
||||
$('#importAllCheckBox',context).show();
|
||||
|
||||
$('#servicesTableHTML', context).hide();
|
||||
$('#templatesTableHTML', context).hide();
|
||||
$('#imagesTableHTML', context).hide();
|
||||
$('#vmsTableHTML', context).show();
|
||||
|
||||
$('#serviceMarketPlaceHTML', context).hide();
|
||||
$('#appMarketPlaceHTML', context).show();
|
||||
$('#templatesForApp',context).hide();
|
||||
break;
|
||||
case 'vmtemplate':
|
||||
that.templatesTable.idInput().
|
||||
attr("required", "").
|
||||
@ -279,12 +325,16 @@ define(function(require) {
|
||||
that.servicesTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
that.vmsTable.idInput().
|
||||
removeAttr("required").
|
||||
removeAttr("wizard_field");
|
||||
|
||||
$('#importAllCheckBox',context).show();
|
||||
|
||||
$('#servicesTableHTML', context).hide();
|
||||
$('#templatesTableHTML', context).show();
|
||||
$('#imagesTableHTML', context).hide();
|
||||
$('#vmsTableHTML', context).hide();
|
||||
|
||||
$('#serviceMarketPlaceHTML', context).hide();
|
||||
$('#appMarketPlaceHTML', context).show();
|
||||
@ -306,6 +356,7 @@ define(function(require) {
|
||||
$('#servicesTableHTML', context).show();
|
||||
$('#templatesTableHTML', context).hide();
|
||||
$('#imagesTableHTML', context).hide();
|
||||
$('#vmsTableHTML', context).hide();
|
||||
|
||||
$('#serviceMarketPlaceHTML', context).hide();
|
||||
$('#appMarketPlaceHTML', context).show();
|
||||
@ -334,6 +385,7 @@ define(function(require) {
|
||||
|
||||
Sunstone.runAction("MarketPlaceApp.create", marketPlaceAppObj);
|
||||
break;
|
||||
case 'vm':
|
||||
case 'vmtemplate':
|
||||
var marketPlaceJSON = {};
|
||||
$.extend(marketPlaceJSON, WizardFields.retrieve(context));
|
||||
|
@ -25,6 +25,7 @@
|
||||
<label for="TYPE">{{tr "Type"}}</label>
|
||||
<select id="TYPE" wizard_field="TYPE" required>
|
||||
<option value="image">{{tr "Image"}}</option>
|
||||
<option value="vm">{{tr "VM"}}</option>
|
||||
<option value="vmtemplate">{{tr "VM Template"}}</option>
|
||||
<option value="service_template">{{tr "Service Template"}}</option>
|
||||
</select>
|
||||
@ -56,26 +57,53 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<fieldset id="servicesTableHTML">
|
||||
<legend>{{tr "Select the Service to create the App"}}</legend>
|
||||
{{{servicesTableHTML}}}
|
||||
</fieldset>
|
||||
|
||||
<!-- START IMAGES/SERVICES/VMTEMPLATES/VM TABLES -->
|
||||
|
||||
<div>
|
||||
<div class="row">
|
||||
<fieldset id="servicesTableHTML">
|
||||
<legend>{{tr "Select the Service to create the App"}}</legend>
|
||||
{{{servicesTableHTML}}}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="serviceMarketPlaceError" class="row oneflow_templates_error_message" hidden>
|
||||
<div class="small-6 columns small-centered text-center">
|
||||
<div class="label alert radius">{{tr "Cannot connect to OneFlow server"}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset id="templatesTableHTML">
|
||||
<legend>{{tr "Select the VM Template to create the App"}}</legend>
|
||||
{{{templatesTableHTML}}}
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="imagesTableHTML">
|
||||
<legend>{{tr "Select the Image to create the App"}}</legend>
|
||||
{{{imagesTableHTML}}}
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="vmsTableHTML">
|
||||
<legend>{{tr "Select the VM to create the App"}}</legend>
|
||||
{{{vmsTableHTML}}}
|
||||
</fieldset>
|
||||
|
||||
<!-- END IMAGES/SERVICES/VMTEMPLATES/VM TABLES -->
|
||||
|
||||
<!-- START MARKETPLACES TABLES -->
|
||||
<fieldset id="serviceMarketPlaceHTML">
|
||||
<legend>{{tr "Select the Marketplace where the Images will be created"}}</legend>
|
||||
{{{marketPlacesServicesTableHTML}}}
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="appMarketPlaceHTML">
|
||||
<legend>{{tr "Select the Marketplace where where the App will be created"}}</legend>
|
||||
{{{marketPlacesImagesTableHTML}}}
|
||||
</fieldset>
|
||||
|
||||
<!-- END MARKETPLACES TABLES -->
|
||||
|
||||
<fieldset id="templatesForApp">
|
||||
<legend>{{tr "Templates for the App"}}</legend>
|
||||
<div class="row">
|
||||
|
@ -32,7 +32,7 @@ define(function(require) {
|
||||
"ServiceTemplate.upload_marketplace_dialog" : {
|
||||
type: "action",
|
||||
layout: "main",
|
||||
text: "<i class=\"fas fa-share\"/> "+ Locale.tr("MarketPlace")
|
||||
text: "<i class=\"fas fa-shopping-cart\"/>"
|
||||
},
|
||||
"ServiceTemplate.update_dialog" : {
|
||||
type: "action",
|
||||
|
@ -40,7 +40,7 @@ define(function(require) {
|
||||
"Template.upload_marketplace_dialog" : {
|
||||
type: "action",
|
||||
layout: "main",
|
||||
text: '<i class="fas fa-share"/> '+ Locale.tr("MarketPlace")
|
||||
text: '<i class="fas fa-shopping-cart"/>'
|
||||
},
|
||||
"Template.update_dialog" : {
|
||||
type: "action",
|
||||
|
@ -36,6 +36,8 @@ define(function(require) {
|
||||
var GUAC_DIALOG_ID = require('./dialogs/guac/dialogId');
|
||||
var SAVE_AS_TEMPLATE_DIALOG_ID = require('./dialogs/saveas-template/dialogId');
|
||||
var UPDATECONF_FORM_ID = require('./form-panels/updateconf/formPanelId');
|
||||
var MARKETPLACEAPPS_TAB_ID = require('tabs/marketplaceapps-tab/tabId');
|
||||
var CREATE_APP_DIALOG_ID = require('tabs/marketplaceapps-tab/form-panels/create/formPanelId');
|
||||
|
||||
var XML_ROOT = "VM";
|
||||
var RESOURCE = "VM";
|
||||
@ -423,7 +425,42 @@ define(function(require) {
|
||||
Notifier.onError(request, response);
|
||||
},
|
||||
notify: false
|
||||
},
|
||||
"VM.upload_marketplace_dialog" : {
|
||||
type: "custom",
|
||||
call: function(params) {
|
||||
var selectedNodes = Sunstone.getDataTable(TAB_ID).elements();
|
||||
|
||||
if (selectedNodes.length !== 1) {
|
||||
Notifier.notifyMessage(Locale.tr("Please select one (and just one) VM to export."));
|
||||
return false;
|
||||
}
|
||||
|
||||
var resourceId = '' + selectedNodes[0];
|
||||
|
||||
OpenNebulaVM.show({
|
||||
data : {
|
||||
id: resourceId
|
||||
},
|
||||
success: function(){
|
||||
Sunstone.showTab(MARKETPLACEAPPS_TAB_ID);
|
||||
Sunstone.showFormPanel(
|
||||
MARKETPLACEAPPS_TAB_ID,
|
||||
CREATE_APP_DIALOG_ID,
|
||||
"export_vm",
|
||||
function(formPanelInstance, context) {
|
||||
formPanelInstance.setVMId(resourceId);
|
||||
$("#marketplaceapps-tab-wizardForms #TYPE").val("vm").change();
|
||||
}
|
||||
);
|
||||
},
|
||||
error: function(error){
|
||||
Notifier.onError("VM: " +error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return _actions;
|
||||
|
@ -34,6 +34,11 @@ define(function(require) {
|
||||
layout: "create",
|
||||
alwaysActive: true
|
||||
},
|
||||
"VM.upload_marketplace_dialog" : {
|
||||
type: "action",
|
||||
text: '<i class="fas fa-shopping-cart"/>',
|
||||
custom_classes : "state-dependent"
|
||||
},
|
||||
"VM.chown" : {
|
||||
type: "confirm_with_select",
|
||||
text: Locale.tr("Change owner"),
|
||||
@ -57,25 +62,25 @@ define(function(require) {
|
||||
"VM.migrate" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Migrate"),
|
||||
layout: "vmsmigration_buttons",
|
||||
layout: "vmsplanification_buttons",
|
||||
custom_classes : "state-dependent"
|
||||
},
|
||||
"VM.migrate_poff" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("Poweroff") + '</span>',
|
||||
layout: "vmsmigration_buttons",
|
||||
layout: "vmsplanification_buttons",
|
||||
custom_classes : "state-dependent"
|
||||
},
|
||||
"VM.migrate_poff_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("Poweroff-hard") + '</span>',
|
||||
layout: "vmsmigration_buttons",
|
||||
layout: "vmsplanification_buttons",
|
||||
custom_classes : "state-dependent"
|
||||
},
|
||||
"VM.migrate_live" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("live") + '</span>',
|
||||
layout: "vmsmigration_buttons",
|
||||
layout: "vmsplanification_buttons",
|
||||
custom_classes : "state-dependent not_firecracker"
|
||||
},
|
||||
"VM.hold" : {
|
||||
|
@ -44,7 +44,7 @@ define(function(require) {
|
||||
[];
|
||||
|
||||
STATE_ACTIONS[OpenNebulaVM.STATES.POWEROFF] =
|
||||
["VM.resched", "VM.resume", "VM.resize", "VM.attachdisk", "VM.detachdisk", "VM.attachnic", "VM.detachnic", "VM.disk_saveas", "VM.disk_snapshot_create", "VM.disk_snapshot_revert", "VM.disk_snapshot_delete", "VM.migrate", "VM.undeploy", "VM.undeploy_hard", "VM.save_as_template", "VM.updateconf", "VM.terminate_hard", "VM.recover", "VM.disk_resize", "VM.snapshot_delete"];
|
||||
["VM.resched", "VM.resume", "VM.resize", "VM.attachdisk", "VM.detachdisk", "VM.attachnic", "VM.detachnic", "VM.disk_saveas", "VM.disk_snapshot_create", "VM.disk_snapshot_revert", "VM.disk_snapshot_delete", "VM.migrate", "VM.undeploy", "VM.undeploy_hard", "VM.save_as_template", "VM.updateconf", "VM.terminate_hard", "VM.recover", "VM.disk_resize", "VM.snapshot_delete", "VM.upload_marketplace_dialog"];
|
||||
|
||||
STATE_ACTIONS[OpenNebulaVM.STATES.UNDEPLOYED] =
|
||||
["VM.resume", "VM.resize", "VM.deploy", "VM.updateconf", "VM.terminate_hard", "VM.recover"];
|
||||
|
Loading…
x
Reference in New Issue
Block a user