mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
Merge remote-tracking branch 'origin/master' into feature-4317
This commit is contained in:
commit
9818ae0bbd
@ -36,7 +36,19 @@ define(function(require) {
|
||||
"MarketPlaceApp.export_dialog" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
Sunstone.showFormPanel(TAB_ID, EXPORT_DIALOG_ID, "export");
|
||||
var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
|
||||
if (selected_nodes.length != 1) {
|
||||
Notifier.notifyMessage("Please select one (and just one) app to export.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var resourceId = "" + selected_nodes[0];
|
||||
|
||||
Sunstone.resetFormPanel(TAB_ID, EXPORT_DIALOG_ID);
|
||||
Sunstone.showFormPanel(TAB_ID, EXPORT_DIALOG_ID, "export",
|
||||
function(formPanelInstance, context) {
|
||||
formPanelInstance.setResourceId(context, resourceId);
|
||||
});
|
||||
}
|
||||
},
|
||||
"MarketPlaceApp.export" : {
|
||||
|
@ -73,6 +73,7 @@ define(function(require) {
|
||||
FormPanel.prototype.constructor = FormPanel;
|
||||
FormPanel.prototype.htmlWizard = _htmlWizard;
|
||||
FormPanel.prototype.submitWizard = _submitWizard;
|
||||
FormPanel.prototype.setResourceId = _setResourceId;
|
||||
FormPanel.prototype.onShow = _onShow;
|
||||
FormPanel.prototype.setup = _setup;
|
||||
|
||||
@ -105,6 +106,9 @@ define(function(require) {
|
||||
this.datastoresTable.idInput().attr('required', '');
|
||||
}
|
||||
|
||||
function _setResourceId(context, resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
function _submitWizard(context) {
|
||||
var marketPlaceAppObj = {
|
||||
@ -112,7 +116,7 @@ define(function(require) {
|
||||
"dsid" : this.datastoresTable.idInput().val()
|
||||
};
|
||||
|
||||
Sunstone.runAction("MarketPlaceApp.export", Sunstone.getDataTable(TAB_ID).elements(), marketPlaceAppObj);
|
||||
Sunstone.runAction("MarketPlaceApp.export", [this.resourceId], marketPlaceAppObj);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -94,7 +94,13 @@ define(function(require) {
|
||||
datatable.fnAddData(item_list);
|
||||
LabelsUtils.clearLabelsFilter(datatable, TEMPLATE_LABELS_COLUMN);
|
||||
var context = $('.labels-dropdown', datatable.closest('.content'));
|
||||
LabelsUtils.insertLabelsMenu(context, datatable, TEMPLATE_LABELS_COLUMN, "VMTEMPLATE.TEMPLATE.LABELS");
|
||||
LabelsUtils.insertLabelsMenu({
|
||||
'context': context,
|
||||
'dataTable': datatable,
|
||||
'labelsColumn': TEMPLATE_LABELS_COLUMN,
|
||||
'labelsPath': 'VMTEMPLATE.TEMPLATE.LABELS',
|
||||
'placeholder': Locale.tr("No labels defined")
|
||||
});
|
||||
}
|
||||
},
|
||||
error: Notifier.onError
|
||||
|
@ -58,7 +58,7 @@ define(function(require) {
|
||||
},
|
||||
"VM.migrate_live" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Migrate") + ' <span class="label secondary radius">live</span>',
|
||||
text: Locale.tr("Migrate") + ' <span class="label secondary radius">' + Locale.tr("live") + '</span>',
|
||||
tip: Locale.tr("This will live-migrate the selected VMs to the chosen host"),
|
||||
layout: "vmsplanification_buttons",
|
||||
custom_classes : "state-dependent"
|
||||
@ -107,7 +107,7 @@ define(function(require) {
|
||||
},
|
||||
"VM.reboot_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Reboot") + ' <span class="label secondary radius">hard</span>',
|
||||
text: Locale.tr("Reboot") + ' <span class="label secondary radius">' + Locale.tr("hard") + '</span>',
|
||||
layout: "vmsrepeat_buttons",
|
||||
tip: Locale.tr("This will perform a hard reboot on selected VMs"),
|
||||
custom_classes : "state-dependent"
|
||||
@ -121,7 +121,7 @@ define(function(require) {
|
||||
},
|
||||
"VM.poweroff_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Power Off") + ' <span class="label secondary radius">hard</span>',
|
||||
text: Locale.tr("Power Off") + ' <span class="label secondary radius">' + Locale.tr("hard") + '</span>',
|
||||
layout: "vmspause_buttons",
|
||||
tip: Locale.tr("This will send a forced power off signal to running VMs. They can be resumed later."),
|
||||
custom_classes : "state-dependent"
|
||||
@ -135,7 +135,7 @@ define(function(require) {
|
||||
},
|
||||
"VM.undeploy_hard" : {
|
||||
type: "action",
|
||||
text: Locale.tr("Undeploy") + ' <span class="label secondary radius">hard</span>',
|
||||
text: Locale.tr("Undeploy") + ' <span class="label secondary radius">' + Locale.tr("hard") + '</span>',
|
||||
layout: "vmsstop_buttons",
|
||||
tip: Locale.tr("Shuts down the given VM. The VM is saved in the system Datastore."),
|
||||
custom_classes : "state-dependent"
|
||||
@ -149,7 +149,7 @@ define(function(require) {
|
||||
},
|
||||
"VM.shutdown_hard" : {
|
||||
type: "confirm",
|
||||
text: Locale.tr("Shutdown") + ' <span class="label secondary radius">hard</span>',
|
||||
text: Locale.tr("Shutdown") + ' <span class="label secondary radius">' + Locale.tr("hard") + '</span>',
|
||||
layout: "vmsdelete_buttons",
|
||||
tip: Locale.tr("This will initiate the shutdown-hard (forced) process in the selected VMs"),
|
||||
custom_classes : "state-dependent"
|
||||
@ -164,7 +164,7 @@ define(function(require) {
|
||||
},
|
||||
"VM.delete_recreate" : {
|
||||
type: "confirm",
|
||||
text: Locale.tr("Delete") + ' <span class="label secondary radius">recreate</span>',
|
||||
text: Locale.tr("Delete") + ' <span class="label secondary radius">' + Locale.tr("recreate") + '</span>',
|
||||
layout: "vmsrepeat_buttons",
|
||||
tip: Locale.tr("This will delete and recreate VMs to PENDING state"),
|
||||
custom_classes : "state-dependent"
|
||||
|
@ -77,7 +77,20 @@ define(function(require) {
|
||||
|
||||
var deployId = (typeof(this.element.DEPLOY_ID) == "object" ? "--" : this.element.DEPLOY_ID);
|
||||
var resched = (parseInt(this.element.RESCHED) ? Locale.tr("yes") : Locale.tr("no"))
|
||||
var templateTableHTML = TemplateTable.html(this.element.USER_TEMPLATE, RESOURCE, Locale.tr("Attributes"));
|
||||
|
||||
// Get rid of the unwanted (for show) SCHED_* keys
|
||||
var that = this;
|
||||
var strippedTemplate = {};
|
||||
var unshownValues = {};
|
||||
$.each(that.element.USER_TEMPLATE, function(key, value) {
|
||||
if (!key.match(/^SCHED_*/)) {
|
||||
strippedTemplate[key] = value;
|
||||
} else {
|
||||
unshownValues[key] = value;
|
||||
}
|
||||
})
|
||||
|
||||
var templateTableHTML = TemplateTable.html(strippedTemplate, RESOURCE, Locale.tr("Attributes"), unshownValues);
|
||||
|
||||
var monitoring = $.extend({}, this.element.MONITORING);
|
||||
delete monitoring.CPU;
|
||||
|
@ -25,6 +25,7 @@ define(function(require) {
|
||||
var Vis = require('vis');
|
||||
|
||||
var TemplateDashboard = require('hbs!./vnets-topology-tab/html');
|
||||
var TemplateEmptyTable = require('hbs!utils/tab-datatable/empty-table');
|
||||
|
||||
var _network;
|
||||
var _vnetList;
|
||||
@ -120,26 +121,32 @@ define(function(require) {
|
||||
var i = 0;
|
||||
|
||||
function _getVNet(index){
|
||||
var vnetId = item_list[index].VNET.ID;
|
||||
var element = item_list[index];
|
||||
if (element !== undefined) {
|
||||
var vnetId = element.VNET.ID;
|
||||
|
||||
OpenNebula.Network.show({
|
||||
data : {
|
||||
id: vnetId
|
||||
},
|
||||
timeout:true,
|
||||
success: function(request,info){
|
||||
vnetList.push(info);
|
||||
OpenNebula.Network.show({
|
||||
data : {
|
||||
id: vnetId
|
||||
},
|
||||
timeout:true,
|
||||
success: function(request,info){
|
||||
vnetList.push(info);
|
||||
|
||||
i += 1;
|
||||
if (i == item_list.length){
|
||||
_vnetList = vnetList;
|
||||
_doTopology();
|
||||
} else {
|
||||
_getVNet(i);
|
||||
}
|
||||
},
|
||||
error: Notifier.onError
|
||||
});
|
||||
i += 1;
|
||||
if (i == item_list.length){
|
||||
_vnetList = vnetList;
|
||||
_doTopology();
|
||||
} else {
|
||||
_getVNet(i);
|
||||
}
|
||||
},
|
||||
error: Notifier.onError
|
||||
});
|
||||
} else {
|
||||
_vnetList = vnetList;
|
||||
$('#visgraph').html(TemplateEmptyTable());
|
||||
}
|
||||
}
|
||||
|
||||
_getVNet(i);
|
||||
|
@ -14,4 +14,5 @@
|
||||
{{! limitations under the License. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div id="visgraph" style="width: 100%; min-height: 400px; height: 75vh;"></div>
|
||||
<div id="visgraph" style="width: 100%; min-height: 400px; height: 75vh;">
|
||||
</div>
|
||||
|
@ -39,20 +39,48 @@ define(function(require) {
|
||||
|
||||
/* FUNCTION DEFINITIONS */
|
||||
|
||||
/*
|
||||
Add labels tree to the left menu
|
||||
/**
|
||||
* Add labels tree to the left menu
|
||||
* @param {Object} opts - Options
|
||||
* @param {string} opts.tabName - Tab Name to retrieve the rest of the opts
|
||||
* @param {jQuery Object} [opts.context] - jQuery object to insert the menu, if not
|
||||
* provided the link of the tab in the left menu will be used
|
||||
* @param {DataTable} [opts.dataTable] - Datatable to apply the filter, if not
|
||||
* provided the one defined in the Sunstone tab will be used
|
||||
* @param {Number} [opts.labelsColumn] - Column of the labels in the datatable,
|
||||
* if not provided the one defined in the Sunstone tab datatable
|
||||
* will be used
|
||||
* @param {string} [opts.labelsPath] - Path of the labels attr, this value will be
|
||||
* used if the datatable uses aData object instead of an array w
|
||||
* ith the values
|
||||
* @param {string} [opts.placeholder] - Message to be shown in no labels are defined
|
||||
*/
|
||||
function _insertLabelsMenu(context, dataTable, labelsColumn, labelsPath) {
|
||||
function _insertLabelsMenu(opts) {
|
||||
var context = opts.context || $('#li_' + opts.tabName);
|
||||
var dataTable = opts.dataTable || Sunstone.getDataTable(opts.tabName).dataTable;
|
||||
var labelsColumn = opts.labelsColumn || Sunstone.getDataTable(opts.tabName).labelsColumn;
|
||||
var labelsPath = opts.labelsPath;
|
||||
|
||||
var labels = _getLabels(dataTable, labelsColumn, labelsPath);
|
||||
$('.labels-tree', context).remove();
|
||||
context.append(Tree.html(_makeTree(labels), true));
|
||||
Tree.setup($('.labels-tree', context));
|
||||
if ($.isEmptyObject(labels)) {
|
||||
if (opts.placeholder) {
|
||||
context.append('<div class="text-center">' + opts.placeholder + '</div>');
|
||||
}
|
||||
} else {
|
||||
context.append(Tree.html(_makeTree(labels), true));
|
||||
Tree.setup($('.labels-tree', context));
|
||||
}
|
||||
|
||||
/*
|
||||
Filter datatable when a label in the left menu is clicked
|
||||
*/
|
||||
context.off('click', '.one-label');
|
||||
context.on('click', '.one-label', function() {
|
||||
if (opts.tabName && !Sunstone.rightListVisible($('#' + opts.tabName))) {
|
||||
Sunstone.showTab(opts.tabName);
|
||||
}
|
||||
|
||||
var regExp = [];
|
||||
var label = $(this).attr('one-label-full-name');
|
||||
regExp.push('^' + label + '$');
|
||||
@ -94,7 +122,7 @@ define(function(require) {
|
||||
|
||||
var selectedItems = tabTable.elements();
|
||||
$.each(selectedItems, function(index, resourceId) {
|
||||
labelsStr = _getLabel(dataTable, labelsColumn, resourceId);
|
||||
labelsStr = _getLabel(tabName, dataTable, labelsColumn, resourceId);
|
||||
if (labelsStr != '') {
|
||||
$.each(labelsStr.split(','), function(){
|
||||
if (labelsIndexed[this]) {
|
||||
@ -159,7 +187,7 @@ define(function(require) {
|
||||
var labelsArray, labelIndex;
|
||||
var selectedItems = tabTable.elements();
|
||||
$.each(selectedItems, function(index, resourceId) {
|
||||
labelsStr = _getLabel(dataTable, labelsColumn, resourceId);
|
||||
labelsStr = _getLabel(tabName, dataTable, labelsColumn, resourceId);
|
||||
if (labelsStr != '') {
|
||||
labelsArray = labelsStr.split(',')
|
||||
} else {
|
||||
@ -190,7 +218,7 @@ define(function(require) {
|
||||
var labelsArray, labelIndex;
|
||||
var selectedItems = tabTable.elements();
|
||||
$.each(selectedItems, function(index, resourceId) {
|
||||
labelsStr = _getLabel(dataTable, labelsColumn, resourceId);
|
||||
labelsStr = _getLabel(tabName, dataTable, labelsColumn, resourceId);
|
||||
if (labelsStr != '') {
|
||||
labelsArray = labelsStr.split(',')
|
||||
} else {
|
||||
@ -233,7 +261,7 @@ define(function(require) {
|
||||
}
|
||||
|
||||
|
||||
_insertLabelsMenu($('#li_' + tabName), tabTable.dataTable, tabTable.labelsColumn);
|
||||
_insertLabelsMenu({'tabName': tabName});
|
||||
_insertLabelsDropdown(tabName);
|
||||
},
|
||||
error: Notifier.onError
|
||||
@ -333,10 +361,9 @@ define(function(require) {
|
||||
return _deserializeLabels(labels.join(','));
|
||||
}
|
||||
|
||||
function _getLabel(dataTable, labelsColumn, resourceId) {
|
||||
var tab = dataTable.parents(".tab")
|
||||
if (Sunstone.rightInfoVisible(tab)) {
|
||||
var element = Sunstone.getElementRightInfo(tab.attr('id'));
|
||||
function _getLabel(tabName, dataTable, labelsColumn, resourceId) {
|
||||
if (Sunstone.rightInfoVisible($('#' + tabName))) {
|
||||
var element = Sunstone.getElementRightInfo(tabName);
|
||||
if (element && element.TEMPLATE) {
|
||||
return element.TEMPLATE[LABELS_ATTR]||'';
|
||||
} else {
|
||||
|
@ -485,9 +485,7 @@ define(function(require) {
|
||||
}
|
||||
|
||||
if (that.labelsColumn) {
|
||||
var dataTable = that.dataTable;
|
||||
var labelsColumn = that.labelsColumn;
|
||||
LabelsUtils.insertLabelsMenu($('#li_' + that.tabId), dataTable, labelsColumn);
|
||||
LabelsUtils.insertLabelsMenu({'tabName': that.tabId});
|
||||
LabelsUtils.insertLabelsDropdown(that.tabId);
|
||||
}
|
||||
|
||||
@ -504,8 +502,13 @@ define(function(require) {
|
||||
|
||||
$.each(that.dataTable.fnGetData(), function(index, aData) {
|
||||
if (aData[that.selectOptions.id_index] === elementId) {
|
||||
element[0] = aData[0];
|
||||
var nodes = that.dataTable.fnGetNodes();
|
||||
var checkId = '#' + that.resource.toLowerCase() + '_' + elementId;
|
||||
var checkVal = $(checkId, nodes).prop('checked');
|
||||
that.dataTable.fnUpdate(element, index, undefined, false);
|
||||
if (checkVal) {
|
||||
$(checkId, nodes).prop('checked', checkVal);
|
||||
}
|
||||
that.recountCheckboxes();
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user