mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
* F #5528: Standardized js * F #5528: Applied standard in 2 random files * F #5528: Added no-trailing-spaces rule
This commit is contained in:
parent
790d620780
commit
3805f5380d
27
src/sunstone/public/.eslintrc.json
Normal file
27
src/sunstone/public/.eslintrc.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"eqeqeq": 2,
|
||||
"no-trailing-spaces": [
|
||||
"error"
|
||||
]
|
||||
}
|
||||
}
|
@ -15,18 +15,18 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
define(function(require) {
|
||||
var Sunstone = require('sunstone');
|
||||
var Notifier = require('utils/notifier');
|
||||
var Locale = require('utils/locale');
|
||||
var OpenNebulaResource = require('opennebula/servicetemplate');
|
||||
var CommonActions = require('utils/common-actions');
|
||||
var OpenNebulaAction = require('opennebula/action');
|
||||
var Navigation = require('utils/navigation');
|
||||
var Sunstone = require("sunstone");
|
||||
var Notifier = require("utils/notifier");
|
||||
var Locale = require("utils/locale");
|
||||
var OpenNebulaResource = require("opennebula/servicetemplate");
|
||||
var CommonActions = require("utils/common-actions");
|
||||
var OpenNebulaAction = require("opennebula/action");
|
||||
var Navigation = require("utils/navigation");
|
||||
|
||||
var TAB_ID = require('./tabId');
|
||||
var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId');
|
||||
var INSTANTIATE_DIALOG_ID = require('./form-panels/instantiate/formPanelId');
|
||||
var CLONE_DIALOG_ID = require('./dialogs/clone/dialogId');
|
||||
var TAB_ID = require("./tabId");
|
||||
var CREATE_DIALOG_ID = require("./form-panels/create/formPanelId");
|
||||
var INSTANTIATE_DIALOG_ID = require("./form-panels/instantiate/formPanelId");
|
||||
var CLONE_DIALOG_ID = require("./dialogs/clone/dialogId");
|
||||
var XML_ROOT = "DOCUMENT";
|
||||
var RESOURCE = "ServiceTemplate";
|
||||
|
||||
@ -39,10 +39,10 @@ define(function(require) {
|
||||
"ServiceTemplate.show" : _commonActions.show(),
|
||||
"ServiceTemplate.refresh" : _commonActions.refresh(),
|
||||
"ServiceTemplate.delete" : _commonActions.del(),
|
||||
"ServiceTemplate.chown": _commonActions.multipleAction('chown'),
|
||||
"ServiceTemplate.chgrp": _commonActions.multipleAction('chgrp'),
|
||||
"ServiceTemplate.chmod": _commonActions.singleAction('chmod'),
|
||||
"ServiceTemplate.rename": _commonActions.singleAction('rename'),
|
||||
"ServiceTemplate.chown": _commonActions.multipleAction("chown"),
|
||||
"ServiceTemplate.chgrp": _commonActions.multipleAction("chgrp"),
|
||||
"ServiceTemplate.chmod": _commonActions.singleAction("chmod"),
|
||||
"ServiceTemplate.rename": _commonActions.singleAction("rename"),
|
||||
"ServiceTemplate.update" : _commonActions.update(),
|
||||
"ServiceTemplate.update_dialog" : _commonActions.checkAndShowUpdate(),
|
||||
"ServiceTemplate.show_to_update" : _commonActions.showUpdate(CREATE_DIALOG_ID),
|
||||
@ -85,7 +85,7 @@ define(function(require) {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
|
||||
if (selected_nodes.length != 1) {
|
||||
if (selected_nodes.length !== 1) {
|
||||
Notifier.notifyMessage("Please select one (and just one) template to instantiate.");
|
||||
return false;
|
||||
}
|
||||
@ -106,7 +106,7 @@ define(function(require) {
|
||||
Sunstone.getDialog(CLONE_DIALOG_ID).show();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"ServiceTemplate.clone" : {
|
||||
type: "single",
|
||||
call: OpenNebulaResource.clone,
|
||||
|
@ -19,31 +19,31 @@ define(function(require) {
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
// require('foundation.tab');
|
||||
var BaseFormPanel = require('utils/form-panels/form-panel');
|
||||
var Sunstone = require('sunstone');
|
||||
var Locale = require('utils/locale');
|
||||
var Tips = require('utils/tips');
|
||||
var OpenNebulaServiceTemplate = require('opennebula/servicetemplate');
|
||||
var OpenNebulaTemplate = require('opennebula/template');
|
||||
var Notifier = require('utils/notifier');
|
||||
var WizardFields = require('utils/wizard-fields');
|
||||
var UserInputs = require('utils/user-inputs');
|
||||
var Config = require('sunstone-config');
|
||||
var TemplateUtils = require('utils/template-utils');
|
||||
// require("foundation.tab");
|
||||
var BaseFormPanel = require("utils/form-panels/form-panel");
|
||||
var Sunstone = require("sunstone");
|
||||
var Locale = require("utils/locale");
|
||||
var Tips = require("utils/tips");
|
||||
var OpenNebulaServiceTemplate = require("opennebula/servicetemplate");
|
||||
var OpenNebulaTemplate = require("opennebula/template");
|
||||
var Notifier = require("utils/notifier");
|
||||
var WizardFields = require("utils/wizard-fields");
|
||||
var UserInputs = require("utils/user-inputs");
|
||||
var Config = require("sunstone-config");
|
||||
var TemplateUtils = require("utils/template-utils");
|
||||
|
||||
/*
|
||||
TEMPLATES
|
||||
*/
|
||||
|
||||
var TemplateHTML = require('hbs!./instantiate/html');
|
||||
var TemplateHTML = require("hbs!./instantiate/html");
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var FORM_PANEL_ID = require('./instantiate/formPanelId');
|
||||
var TAB_ID = require('../tabId');
|
||||
var FORM_PANEL_ID = require("./instantiate/formPanelId");
|
||||
var TAB_ID = require("../tabId");
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
@ -53,10 +53,10 @@ define(function(require) {
|
||||
this.formPanelId = FORM_PANEL_ID;
|
||||
this.tabId = TAB_ID;
|
||||
this.actions = {
|
||||
'instantiate': {
|
||||
'title': Locale.tr("Instantiate Service Template"),
|
||||
'buttonText': Locale.tr("Instantiate"),
|
||||
'resetButton': false
|
||||
"instantiate": {
|
||||
"title": Locale.tr("Instantiate Service Template"),
|
||||
"buttonText": Locale.tr("Instantiate"),
|
||||
"resetButton": false
|
||||
}
|
||||
};
|
||||
|
||||
@ -80,7 +80,7 @@ define(function(require) {
|
||||
|
||||
function _html() {
|
||||
return TemplateHTML({
|
||||
'formPanelId': this.formPanelId
|
||||
"formPanelId": this.formPanelId
|
||||
});
|
||||
}
|
||||
|
||||
@ -127,8 +127,8 @@ define(function(require) {
|
||||
var div_id = "user_input_role_"+index;
|
||||
|
||||
$("#instantiate_service_role_user_inputs", context).append(
|
||||
'<div id="'+div_id+'" class="large-6 columns">\
|
||||
</div>'
|
||||
"<div id=\""+div_id+"\" class=\"large-6 columns\">\
|
||||
</div>"
|
||||
);
|
||||
|
||||
OpenNebulaTemplate.show({
|
||||
@ -164,16 +164,16 @@ define(function(require) {
|
||||
delete roleTemplate.APPEND;
|
||||
$.extend(true, that.vm_template_json.VMTEMPLATE.TEMPLATE, roleTemplate);
|
||||
}
|
||||
if (vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_COST'] && vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_UNIT_COST'] && vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_UNIT_COST'] == "GB") {
|
||||
vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_COST'] = vm_template_json.VMTEMPLATE.TEMPLATE['MEMORY_COST']*1024;
|
||||
if (vm_template_json.VMTEMPLATE.TEMPLATE["MEMORY_COST"] && vm_template_json.VMTEMPLATE.TEMPLATE["MEMORY_UNIT_COST"] && vm_template_json.VMTEMPLATE.TEMPLATE["MEMORY_UNIT_COST"] === "GB") {
|
||||
vm_template_json.VMTEMPLATE.TEMPLATE["MEMORY_COST"] = vm_template_json.VMTEMPLATE.TEMPLATE["MEMORY_COST"]*1024;
|
||||
}
|
||||
if (vm_template_json.VMTEMPLATE.TEMPLATE['DISK_COST']) {
|
||||
vm_template_json.VMTEMPLATE.TEMPLATE['DISK_COST'] = vm_template_json.VMTEMPLATE.TEMPLATE['DISK_COST']*1024;
|
||||
if (vm_template_json.VMTEMPLATE.TEMPLATE["DISK_COST"]) {
|
||||
vm_template_json.VMTEMPLATE.TEMPLATE["DISK_COST"] = vm_template_json.VMTEMPLATE.TEMPLATE["DISK_COST"]*1024;
|
||||
}
|
||||
|
||||
var cost = OpenNebulaTemplate.cost(that.vm_template_json);
|
||||
|
||||
if (cost != 0 && Config.isFeatureEnabled("showback")) {
|
||||
if (cost !== 0 && Config.isFeatureEnabled("showback")) {
|
||||
total_cost += (cost * role.cardinality);
|
||||
|
||||
$(".total_cost_div", context).show();
|
||||
@ -190,7 +190,7 @@ define(function(require) {
|
||||
|
||||
n_roles_done += 1;
|
||||
|
||||
if(n_roles_done == n_roles){
|
||||
if(n_roles_done === n_roles){
|
||||
Sunstone.enableFormPanelSubmit();
|
||||
}
|
||||
},
|
||||
@ -211,8 +211,8 @@ define(function(require) {
|
||||
function _submitWizard(context) {
|
||||
var that = this;
|
||||
|
||||
var service_name = $('#service_name',context).val();
|
||||
var n_times = $('#service_n_times',context).val();
|
||||
var service_name = $("#service_name",context).val();
|
||||
var n_times = $("#service_n_times",context).val();
|
||||
var n_times_int=1;
|
||||
|
||||
if (n_times.length){
|
||||
@ -225,7 +225,7 @@ define(function(require) {
|
||||
}
|
||||
|
||||
var extra_info = {
|
||||
'merge_template': {}
|
||||
"merge_template": {}
|
||||
};
|
||||
|
||||
var tmp_json = WizardFields.retrieve($("#instantiate_service_user_inputs", context));
|
||||
@ -251,8 +251,8 @@ define(function(require) {
|
||||
Sunstone.runAction("ServiceTemplate.instantiate", that.templateId, extra_info);
|
||||
}
|
||||
} else {
|
||||
if (service_name.indexOf("%i") == -1){//no wildcard, all with the same name
|
||||
extra_info['merge_template']['name'] = service_name;
|
||||
if (service_name.indexOf("%i") === -1){//no wildcard, all with the same name
|
||||
extra_info["merge_template"]["name"] = service_name;
|
||||
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
Sunstone.runAction(
|
||||
@ -261,7 +261,7 @@ define(function(require) {
|
||||
}
|
||||
} else { //wildcard present: replace wildcard
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
extra_info['merge_template']['name'] = service_name.replace(/%i/gi,i);
|
||||
extra_info["merge_template"]["name"] = service_name.replace(/%i/gi,i);
|
||||
|
||||
Sunstone.runAction(
|
||||
"ServiceTemplate.instantiate",
|
||||
|
Loading…
Reference in New Issue
Block a user