mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Feature 1271. Resource locking and status in Sunstone
* F #1271: Added new tag for show states and locks * F #1271: Changed resource to xml_root * F #1271: Removed state from resource that not has * F #1271: Added status for DOCUMENT * F #1271: Fixed bug with vms * F #1271 & #1377:Removed JGrowl when lock and unlock resources
This commit is contained in:
parent
01981ebc5b
commit
c660077f15
@ -22,6 +22,7 @@ define(function(require) {
|
||||
var TabDataTable = require('utils/tab-datatable');
|
||||
var SunstoneConfig = require('sunstone-config');
|
||||
var Locale = require('utils/locale');
|
||||
var Status = require('utils/status');
|
||||
|
||||
var OpenNebulaUser = require('opennebula/user');
|
||||
var OpenNebulaGroup = require('opennebula/group');
|
||||
@ -103,10 +104,13 @@ define(function(require) {
|
||||
|
||||
this.totalACLs++;
|
||||
|
||||
var color_html = Status.state_lock_to_color("ACL",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
acl_array[0],
|
||||
acl_array[1],
|
||||
|
@ -23,6 +23,7 @@ define(function(require) {
|
||||
var SunstoneConfig = require('sunstone-config');
|
||||
var Locale = require('utils/locale');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -98,10 +99,13 @@ define(function(require) {
|
||||
var element = element_json[XML_ROOT];
|
||||
this.totalClusters++;
|
||||
|
||||
var color_html = Status.state_lock_to_color("CLUSTER",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
_lengthOf(element.HOSTS.ID),
|
||||
|
@ -26,6 +26,7 @@ define(function(require) {
|
||||
var DatastoreCapacityBar = require('./utils/datastore-capacity-bar');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -152,10 +153,13 @@ define(function(require) {
|
||||
DS_MAD: element.DS_MAD
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("DATASTORE",state, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -26,6 +26,7 @@ define(function(require) {
|
||||
var QuotaWidgets = require('utils/quotas/quota-widgets');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var DashboardUtils = require('utils/dashboard');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -139,10 +140,13 @@ define(function(require) {
|
||||
default_group_quotas.VM_QUOTA.VM.CPU);
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("GROUP",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
users_str,
|
||||
|
@ -31,6 +31,7 @@ define(function(require) {
|
||||
var SearchDropdown = require("hbs!./datatable/search");
|
||||
var OpenNebulaAction = require("opennebula/action");
|
||||
var Sunstone = require("sunstone");
|
||||
var Status = require('utils/status');
|
||||
|
||||
|
||||
/*
|
||||
@ -175,10 +176,13 @@ define(function(require) {
|
||||
VM_MAD: element.VM_MAD
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("HOST",state, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
"<input class=\"check_item\" type=\"checkbox\" id=\"" + RESOURCE.toLowerCase() + "_" +
|
||||
element.ID + "\" name=\"selected_items\" value=\"" +
|
||||
element.ID + "\"/>",
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.CLUSTER.length ? element.CLUSTER : "-",
|
||||
|
@ -64,10 +64,10 @@ define(function(require) {
|
||||
"Image.snapshot_flatten": _commonActions.singleAction("snapshot_flatten"),
|
||||
"Image.snapshot_revert": _commonActions.singleAction("snapshot_revert"),
|
||||
"Image.snapshot_delete": _commonActions.singleAction("snapshot_delete"),
|
||||
"Image.lockM": _commonActions.multipleAction('lock'),
|
||||
"Image.lockU": _commonActions.multipleAction('lock'),
|
||||
"Image.lockA": _commonActions.multipleAction('lock'),
|
||||
"Image.unlock": _commonActions.multipleAction('unlock'),
|
||||
"Image.lockM": _commonActions.multipleAction('lock', false),
|
||||
"Image.lockU": _commonActions.multipleAction('lock', false),
|
||||
"Image.lockA": _commonActions.multipleAction('lock', false),
|
||||
"Image.unlock": _commonActions.multipleAction('unlock', false),
|
||||
"Image.upload_marketplace_dialog" : {
|
||||
type: "custom",
|
||||
call: function(params) {
|
||||
|
@ -26,6 +26,7 @@ define(function(require) {
|
||||
var OpenNebulaImage = require('opennebula/image');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -111,11 +112,13 @@ define(function(require) {
|
||||
REGTIME_AFTER: element.REGTIME,
|
||||
REGTIME_BEFORE: element.REGTIME
|
||||
}
|
||||
var color_html = Status.state_lock_to_color("IMAGES",state, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+this.resource.toLowerCase()+'_' +
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -37,10 +37,10 @@ define(function(require) {
|
||||
var _actions = {
|
||||
"MarketPlaceApp.create" : _commonActions.create(CREATE_DIALOG_ID),
|
||||
"MarketPlaceApp.create_dialog" : _commonActions.showCreate(CREATE_DIALOG_ID),
|
||||
"MarketPlaceApp.lockM": _commonActions.multipleAction('lock'),
|
||||
"MarketPlaceApp.lockU": _commonActions.multipleAction('lock'),
|
||||
"MarketPlaceApp.lockA": _commonActions.multipleAction('lock'),
|
||||
"MarketPlaceApp.unlock": _commonActions.multipleAction('unlock'),
|
||||
"MarketPlaceApp.lockM": _commonActions.multipleAction('lock', false),
|
||||
"MarketPlaceApp.lockU": _commonActions.multipleAction('lock', false),
|
||||
"MarketPlaceApp.lockA": _commonActions.multipleAction('lock', false),
|
||||
"MarketPlaceApp.unlock": _commonActions.multipleAction('unlock', false),
|
||||
"MarketPlaceApp.download_opennebula_dialog" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
|
@ -28,6 +28,7 @@ define(function(require) {
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var Humanize = require('utils/humanize');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -146,10 +147,13 @@ define(function(require) {
|
||||
REGTIME_BEFORE: element.REGTIME
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("MARKETPLACEAPP",state, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -27,6 +27,7 @@ define(function(require) {
|
||||
var DatastoreCapacityBar = require('../datastores-tab/utils/datastore-capacity-bar');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -136,10 +137,13 @@ define(function(require) {
|
||||
ZONE: zone
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("MARKETPLACE",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -25,6 +25,7 @@ define(function(require) {
|
||||
var OpenNebulaService = require('opennebula/service');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -109,10 +110,13 @@ define(function(require) {
|
||||
STATE: state
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("SERVICE",state, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="' + RESOURCE.toLowerCase() + '_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.UNAME,
|
||||
element.GNAME,
|
||||
|
@ -24,6 +24,7 @@ define(function(require) {
|
||||
var Locale = require('utils/locale');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -104,10 +105,13 @@ define(function(require) {
|
||||
GNAME: element.GNAME
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("SERVICE_TEMPLATE",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="' + RESOURCE.toLowerCase() + '_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -24,6 +24,7 @@ define(function(require) {
|
||||
var Locale = require('utils/locale');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -109,10 +110,13 @@ define(function(require) {
|
||||
GNAME: element.GNAME
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("SECGROUP",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -28,6 +28,7 @@ define(function(require) {
|
||||
var Notifier = require('utils/notifier');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -112,10 +113,13 @@ define(function(require) {
|
||||
REGTIME_BEFORE: element.REGTIME
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("TEMPLATE",false, element_json[this.xmlRoot.toUpperCase()]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="' + this.resource.toLowerCase() + '_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -28,6 +28,7 @@ define(function(require) {
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var DashboardUtils = require('utils/dashboard');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -150,10 +151,13 @@ define(function(require) {
|
||||
AUTH_DRIVER: element.AUTH_DRIVER
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("USER",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" ' +
|
||||
'value="' + element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.GNAME,
|
||||
|
@ -23,6 +23,7 @@ define(function(require) {
|
||||
var Config = require('sunstone-config');
|
||||
var Locale = require('utils/locale');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -113,10 +114,13 @@ define(function(require) {
|
||||
groupColumn = 1;
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("VDC",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
groupColumn,
|
||||
|
@ -47,10 +47,10 @@ define(function(require) {
|
||||
"VMGroup.chown": _commonActions.multipleAction('chown'),
|
||||
"VMGroup.chgrp": _commonActions.multipleAction('chgrp'),
|
||||
"VMGroup.chmod": _commonActions.singleAction('chmod'),
|
||||
"VMGroup.lockM": _commonActions.multipleAction('lock'),
|
||||
"VMGroup.lockU": _commonActions.multipleAction('lock'),
|
||||
"VMGroup.lockA": _commonActions.multipleAction('lock'),
|
||||
"VMGroup.unlock": _commonActions.multipleAction('unlock')
|
||||
"VMGroup.lockM": _commonActions.multipleAction('lock', false),
|
||||
"VMGroup.lockU": _commonActions.multipleAction('lock', false),
|
||||
"VMGroup.lockA": _commonActions.multipleAction('lock', false),
|
||||
"VMGroup.unlock": _commonActions.multipleAction('unlock', false)
|
||||
};
|
||||
|
||||
return _actions;
|
||||
|
@ -25,6 +25,7 @@ define(function(require) {
|
||||
var TemplateUtils = require('utils/template-utils');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -122,10 +123,13 @@ define(function(require) {
|
||||
GNAME: element.GNAME
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("VMGROUP",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -75,10 +75,10 @@ define(function(require) {
|
||||
"VM.recover": _commonActions.multipleAction('recover'),
|
||||
"VM.resched": _commonActions.multipleAction('resched'),
|
||||
"VM.unresched": _commonActions.multipleAction('unresched'),
|
||||
"VM.lockM": _commonActions.multipleAction('lock'),
|
||||
"VM.lockU": _commonActions.multipleAction('lock'),
|
||||
"VM.lockA": _commonActions.multipleAction('lock'),
|
||||
"VM.unlock": _commonActions.multipleAction('unlock'),
|
||||
"VM.lockM": _commonActions.multipleAction('lock', false),
|
||||
"VM.lockU": _commonActions.multipleAction('lock', false),
|
||||
"VM.lockA": _commonActions.multipleAction('lock', false),
|
||||
"VM.unlock": _commonActions.multipleAction('unlock', false),
|
||||
|
||||
"VM.chmod": _commonActions.singleAction('chmod'),
|
||||
"VM.rename": _commonActions.singleAction('rename'),
|
||||
|
@ -21,6 +21,7 @@ define(function(require) {
|
||||
var Humanize = require('utils/humanize');
|
||||
var TemplateUtils = require('utils/template-utils');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var Status = require('utils/status');
|
||||
|
||||
var RESOURCE = "VM";
|
||||
var XML_ROOT = "VM";
|
||||
@ -108,14 +109,21 @@ define(function(require) {
|
||||
STIME_AFTER: element.STIME,
|
||||
STIME_BEFORE: element.STIME
|
||||
}
|
||||
if (OpenNebulaVM.isFailureState(element.LCM_STATE)){
|
||||
value_state = "FAILED"
|
||||
} else {
|
||||
value_state = OpenNebulaVM.stateStr(element.STATE)
|
||||
}
|
||||
var color_html = Status.state_lock_to_color("VM", value_state, element_json[RESOURCE.toUpperCase()]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" '+
|
||||
'style="vertical-align: inherit;"'+
|
||||
'type="checkbox" '+
|
||||
'id="' + RESOURCE.toLowerCase() + '_' + element.ID + '" '+
|
||||
'name="selected_items" '+
|
||||
'value="' + element.ID + '" '+
|
||||
'state="'+element.STATE+'" lcm_state="'+element.LCM_STATE+'"/>',
|
||||
'state="'+element.STATE+'" lcm_state="'+element.LCM_STATE+'"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -55,10 +55,10 @@ define(function(require) {
|
||||
"Network.append_template" : _commonActions.appendTemplate(),
|
||||
"Network.update_dialog" : _commonActions.checkAndShowUpdate(),
|
||||
"Network.show_to_update" : _commonActions.showUpdate(CREATE_DIALOG_ID),
|
||||
"Network.lockM": _commonActions.multipleAction('lock'),
|
||||
"Network.lockU": _commonActions.multipleAction('lock'),
|
||||
"Network.lockA": _commonActions.multipleAction('lock'),
|
||||
"Network.unlock": _commonActions.multipleAction('unlock'),
|
||||
"Network.lockM": _commonActions.multipleAction('lock', false),
|
||||
"Network.lockU": _commonActions.multipleAction('lock', false),
|
||||
"Network.lockA": _commonActions.multipleAction('lock', false),
|
||||
"Network.unlock": _commonActions.multipleAction('unlock', false),
|
||||
|
||||
"Network.import_dialog" : {
|
||||
type: "custom",
|
||||
|
@ -28,6 +28,7 @@ define(function(require) {
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var OpenNebulaNetwork = require('opennebula/network');
|
||||
var DashboardUtils = require('utils/dashboard');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -143,10 +144,13 @@ define(function(require) {
|
||||
PARENT_NETWORK: parent_net
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("VNET",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="' + RESOURCE.toLowerCase() + '_' +
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -34,10 +34,10 @@ define(function(require) {
|
||||
var _actions = {
|
||||
"VirtualRouter.create" : _commonActions.create(CREATE_DIALOG_ID),
|
||||
"VirtualRouter.create_dialog" : _commonActions.showCreate(CREATE_DIALOG_ID),
|
||||
"VirtualRouter.lockM": _commonActions.multipleAction('lock'),
|
||||
"VirtualRouter.lockU": _commonActions.multipleAction('lock'),
|
||||
"VirtualRouter.lockA": _commonActions.multipleAction('lock'),
|
||||
"VirtualRouter.unlock": _commonActions.multipleAction('unlock'),
|
||||
"VirtualRouter.lockM": _commonActions.multipleAction('lock', false),
|
||||
"VirtualRouter.lockU": _commonActions.multipleAction('lock', false),
|
||||
"VirtualRouter.lockA": _commonActions.multipleAction('lock', false),
|
||||
"VirtualRouter.unlock": _commonActions.multipleAction('unlock', false),
|
||||
"VirtualRouter.instantiate_vms" : {
|
||||
type: "custom",
|
||||
call: function() {
|
||||
|
@ -24,6 +24,7 @@ define(function(require) {
|
||||
var Locale = require('utils/locale');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var SearchDropdown = require('hbs!./datatable/search');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -109,10 +110,13 @@ define(function(require) {
|
||||
GNAME: element.GNAME
|
||||
}
|
||||
|
||||
var color_html = Status.state_lock_to_color("VROUTER",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.UNAME,
|
||||
|
@ -23,6 +23,7 @@ define(function(require) {
|
||||
var SunstoneConfig = require('sunstone-config');
|
||||
var Locale = require('utils/locale');
|
||||
var LabelsUtils = require('utils/labels/utils');
|
||||
var Status = require('utils/status');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -96,10 +97,13 @@ define(function(require) {
|
||||
var element = element_json.ZONE;
|
||||
this.totalZones++;
|
||||
|
||||
var color_html = Status.state_lock_to_color("ZONE",false, element_json[XML_ROOT]["LOCK"]);
|
||||
|
||||
return [
|
||||
'<input class="check_item" type="checkbox" id="' + RESOURCE.toLowerCase() + '_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>',
|
||||
'<input class="check_item" type="checkbox" '+
|
||||
'style="vertical-align: inherit;" id="'+this.resource.toLowerCase()+'_' +
|
||||
element.ID + '" name="selected_items" value="' +
|
||||
element.ID + '"/>'+color_html,
|
||||
element.ID,
|
||||
element.NAME,
|
||||
element.TEMPLATE.ENDPOINT,
|
||||
|
@ -116,7 +116,11 @@ define(function(require) {
|
||||
}
|
||||
}
|
||||
|
||||
function _multipleAction(actionStr) {
|
||||
function _multipleAction(actionStr, notify) {
|
||||
notify_bool = true;
|
||||
if(notify != undefined){
|
||||
notify_bool = notify;
|
||||
}
|
||||
var that = this;
|
||||
return {
|
||||
type: "multiple",
|
||||
@ -128,7 +132,7 @@ define(function(require) {
|
||||
return Sunstone.getDataTable(that.tabId).elements(opts);
|
||||
},
|
||||
error: Notifier.onError,
|
||||
notify: true
|
||||
notify: notify_bool
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,50 @@
|
||||
define(function(require) {
|
||||
var Locale = require('utils/locale');
|
||||
var TemplateUtils = require('utils/template-utils');
|
||||
var resource_states = {
|
||||
IMAGES:{
|
||||
CLONE:"#4DBBD3",
|
||||
INIT:"#4DBBD3",
|
||||
READY:"#3adb76",
|
||||
USED:"#3adb76",
|
||||
ERROR:"#ec5840",
|
||||
DELETE:"#ec5840",
|
||||
LOCKED:"lightsalmon",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
HOST:{
|
||||
INIT:"#4DBBD3",
|
||||
ON:"#3adb76",
|
||||
OFF:"#ec5840",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
DATASTORE:{
|
||||
INIT:"#4DBBD3",
|
||||
READY:"#3adb76",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
MARKETPLACEAPP:{
|
||||
INIT:"#4DBBD3",
|
||||
READY:"#3adb76",
|
||||
LOCKED:"lightsalmon",
|
||||
ERROR:"#ec5840",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
VM:{
|
||||
INIT:"#4DBBD3",
|
||||
PENDING:"#4DBBD3",
|
||||
HOLD:"lightsalmon",
|
||||
ACTIVE:"#3adb76",
|
||||
STOPPED:"lightsalmon",
|
||||
SUSPENDED:"lightsalmon",
|
||||
DONE:"#ec5840",
|
||||
FAILED:"#ec5840",
|
||||
POWEROFF:"lightsalmon",
|
||||
UNDEPLOYED:"lightsalmon",
|
||||
CLONING:"#4DBBD3",
|
||||
CLONING_FAILURE:"#ec5840"
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
@ -35,7 +79,8 @@ define(function(require) {
|
||||
'prettyPrintJSON': _prettyPrintJSON,
|
||||
'prettyTimeAgo': _format_date,
|
||||
'prettyTimeDatatable': _prettyTimeDatatable,
|
||||
'lock_to_str': _lock_to_str
|
||||
'lock_to_str': _lock_to_str,
|
||||
'state_lock_to_color': _state_lock_to_color
|
||||
}
|
||||
|
||||
/*
|
||||
@ -329,4 +374,22 @@ define(function(require) {
|
||||
}
|
||||
return level_str;
|
||||
}
|
||||
|
||||
function _state_lock_to_color(resource,state,lock){
|
||||
var color = "transparent";
|
||||
var show_lock = "";
|
||||
|
||||
if (state && resource in resource_states){
|
||||
var available_states = resource_states[resource];
|
||||
if (state in available_states){
|
||||
color = available_states[state];
|
||||
}
|
||||
}
|
||||
|
||||
if (lock){
|
||||
show_lock = "border-left: 3px solid #373537;";
|
||||
}
|
||||
|
||||
return '<span style="'+show_lock+' float:left; margin-right: 3px; width: 5px; height: 20px; background: '+color+';"></span>'
|
||||
}
|
||||
})
|
||||
|
105
src/sunstone/public/app/utils/status.js
Normal file
105
src/sunstone/public/app/utils/status.js
Normal file
@ -0,0 +1,105 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 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) {
|
||||
var resource_states = {
|
||||
IMAGES:{
|
||||
CLONE:"#4DBBD3",
|
||||
INIT:"#4DBBD3",
|
||||
READY:"#3adb76",
|
||||
USED:"#3adb76",
|
||||
ERROR:"#ec5840",
|
||||
DELETE:"#ec5840",
|
||||
LOCKED:"lightsalmon",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
HOST:{
|
||||
INIT:"#4DBBD3",
|
||||
ON:"#3adb76",
|
||||
OFF:"#ec5840",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
DATASTORE:{
|
||||
INIT:"#4DBBD3",
|
||||
READY:"#3adb76",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
MARKETPLACEAPP:{
|
||||
INIT:"#4DBBD3",
|
||||
READY:"#3adb76",
|
||||
LOCKED:"lightsalmon",
|
||||
ERROR:"#ec5840",
|
||||
DISABLED:"lightsalmon"
|
||||
},
|
||||
VM:{
|
||||
INIT:"#4DBBD3",
|
||||
PENDING:"#4DBBD3",
|
||||
HOLD:"lightsalmon",
|
||||
ACTIVE:"#3adb76",
|
||||
STOPPED:"lightsalmon",
|
||||
SUSPENDED:"lightsalmon",
|
||||
DONE:"#ec5840",
|
||||
FAILED:"#ec5840",
|
||||
POWEROFF:"lightsalmon",
|
||||
UNDEPLOYED:"lightsalmon",
|
||||
CLONING:"#4DBBD3",
|
||||
CLONING_FAILURE:"#ec5840"
|
||||
},
|
||||
DOCUMENT:{
|
||||
PENDING:"#4DBBD3",
|
||||
DEPLOYING:"#4DBBD3",
|
||||
RUNNING:"#3adb76",
|
||||
UNDEPLOYING:"#4DBBD3",
|
||||
WARNING:"lightsalmon",
|
||||
DONE:"#ec5840",
|
||||
FAILED_UNDEPLOYING:"#ec5840",
|
||||
FAILED_DEPLOYING:"#ec5840",
|
||||
SCALING:"#4DBBD3",
|
||||
FAILED_SCALING:"#ec5840",
|
||||
COOLDOWN:"#4DBBD3"
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
return {
|
||||
'state_lock_to_color': _state_lock_to_color
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION DEFINITIONS
|
||||
*/
|
||||
|
||||
function _state_lock_to_color(resource,state,lock){
|
||||
var color = "transparent";
|
||||
var show_lock = "";
|
||||
|
||||
if (state && resource in resource_states){
|
||||
var available_states = resource_states[resource];
|
||||
if (state in available_states){
|
||||
color = available_states[state];
|
||||
}
|
||||
}
|
||||
|
||||
if (lock){
|
||||
show_lock = "border-left: 3px solid #373537;";
|
||||
}
|
||||
|
||||
return '<span style="'+show_lock+' float:left; margin-right: 3px; width: 5px; height: 20px; background: '+color+';"></span>'
|
||||
}
|
||||
})
|
@ -38,7 +38,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="check">
|
||||
<input type="checkbox" class="check_all" value=""/>
|
||||
<input style="vertical-align: inherit;" type="checkbox" class="check_all" value=""/>
|
||||
<span style="display: table; float:left; margin-right: 3px; width: 5px; height: 20px; background: transparent;"></span>
|
||||
</th>
|
||||
{{#each columns}}
|
||||
<th>{{this}}</th>
|
||||
|
Loading…
x
Reference in New Issue
Block a user