mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-22 20:54:49 +09:00
Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
1 parent
38dcada9b7
commit
692c802d3c
5 files changed
+140
-9
No files matched your search
+21
-2
@@ -72,8 +72,27 @@ define(function(require) {
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
var actions = ["terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume", "reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard", "snapshot-create"];
|
||||
|
||||
var actions = [
|
||||
"terminate",
|
||||
"terminate-hard",
|
||||
"hold",
|
||||
"release",
|
||||
"stop",
|
||||
"suspend",
|
||||
"resume",
|
||||
"reboot",
|
||||
"reboot-hard",
|
||||
"poweroff",
|
||||
"poweroff-hard",
|
||||
"undeploy",
|
||||
"undeploy-hard",
|
||||
"snapshot-create",
|
||||
"snapshot-delete",
|
||||
"snapshot-revert",
|
||||
"disk-snapshot-create",
|
||||
"disk-snapshot-delete",
|
||||
"disk-snapshot-revert"
|
||||
];
|
||||
context.off("click", "#add_scheduling_temp_action");
|
||||
context.on("click", "#add_scheduling_temp_action", function() {
|
||||
$("#add_scheduling_temp_action", context).attr("disabled", "disabled");
|
||||
|
||||
@@ -128,7 +128,27 @@ define(function(require) {
|
||||
|
||||
context.off("click", "#add_scheduling_inst_action");
|
||||
context.on("click", "#add_scheduling_inst_action", function() {
|
||||
var actions = ["terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume", "reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard", "snapshot-create"];
|
||||
var actions = [
|
||||
"terminate",
|
||||
"terminate-hard",
|
||||
"hold",
|
||||
"release",
|
||||
"stop",
|
||||
"suspend",
|
||||
"resume",
|
||||
"reboot",
|
||||
"reboot-hard",
|
||||
"poweroff",
|
||||
"poweroff-hard",
|
||||
"undeploy",
|
||||
"undeploy-hard",
|
||||
"snapshot-create",
|
||||
"snapshot-delete",
|
||||
"snapshot-revert",
|
||||
"disk-snapshot-create",
|
||||
"disk-snapshot-delete",
|
||||
"disk-snapshot-revert"
|
||||
];
|
||||
$("#add_scheduling_inst_action", context).attr("disabled", "disabled");
|
||||
ScheduleActions.htmlNewAction(actions, context, "inst");
|
||||
ScheduleActions.setup(context);
|
||||
|
||||
@@ -95,13 +95,27 @@ define(function(require) {
|
||||
var that = this;
|
||||
that.formContext = context;
|
||||
Leases.actions(that,'vm','update');
|
||||
|
||||
var actions = [
|
||||
"terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume",
|
||||
"reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard",
|
||||
"snapshot-create"
|
||||
"terminate",
|
||||
"terminate-hard",
|
||||
"hold",
|
||||
"release",
|
||||
"stop",
|
||||
"suspend",
|
||||
"resume",
|
||||
"reboot",
|
||||
"reboot-hard",
|
||||
"poweroff",
|
||||
"poweroff-hard",
|
||||
"undeploy",
|
||||
"undeploy-hard",
|
||||
"snapshot-create",
|
||||
"snapshot-delete",
|
||||
"snapshot-revert",
|
||||
"disk-snapshot-create",
|
||||
"disk-snapshot-delete",
|
||||
"disk-snapshot-revert"
|
||||
];
|
||||
|
||||
context.off("click", "#add_scheduling_vms_action");
|
||||
context.on("click" , "#add_scheduling_vms_action", function(){
|
||||
$(this).attr("disabled", "disabled");
|
||||
|
||||
@@ -25,6 +25,8 @@ define(function (require) {
|
||||
var TemplateHTML = require("hbs!./schedule_action/html");
|
||||
var TemplateTableHTML = require("hbs!./schedule_action/table");
|
||||
|
||||
var selector = '';
|
||||
|
||||
function _html(resource, leases = null) {
|
||||
this.res = resource;
|
||||
return TemplateTableHTML({
|
||||
@@ -55,7 +57,7 @@ define(function (require) {
|
||||
};
|
||||
var that = this;
|
||||
$.each(actions, function (key, action) {
|
||||
var actionAux = action.replace("-", "_");
|
||||
var actionAux = action.replace(/\-/g, "_");
|
||||
if (Config.isTabActionEnabled("vms-tab", "VM." + actionAux)) {
|
||||
options += "<option value=\"" + action + "\">" + Locale.tr(action) + "</option>";
|
||||
}
|
||||
@@ -103,7 +105,50 @@ define(function (require) {
|
||||
}
|
||||
$("#date_input", context).attr("value", yyyy + "-" + mm + "-" + dd);
|
||||
$(".periodic", context).hide();
|
||||
this.selector = $("select#select_new_action");
|
||||
$("select#select_new_action").on("change",function(){
|
||||
var snap_name = $("#snapname");
|
||||
var snap_id = $("#snapid");
|
||||
var disk_id = $("#diskid");
|
||||
|
||||
switch ($(this).val()) {
|
||||
case "snapshot-create":
|
||||
snap_name.removeClass("hide");
|
||||
snap_id.addClass("hide");
|
||||
disk_id.addClass("hide");
|
||||
break;
|
||||
case "snapshot-revert":
|
||||
snap_name.addClass("hide");
|
||||
snap_id.removeClass("hide");
|
||||
disk_id.addClass("hide");
|
||||
break;
|
||||
case "snapshot-delete":
|
||||
snap_name.addClass("hide");
|
||||
snap_id.removeClass("hide");
|
||||
disk_id.addClass("hide");
|
||||
break;
|
||||
case "disk-snapshot-create":
|
||||
snap_name.removeClass("hide");
|
||||
snap_id.addClass("hide");
|
||||
disk_id.removeClass("hide");
|
||||
break;
|
||||
case "disk-snapshot-revert":
|
||||
snap_name.addClass("hide");
|
||||
snap_id.removeClass("hide");
|
||||
disk_id.removeClass("hide");
|
||||
break;
|
||||
case "disk-snapshot-delete":
|
||||
snap_name.addClass("hide");
|
||||
snap_id.removeClass("hide");
|
||||
disk_id.removeClass("hide");
|
||||
break;
|
||||
default:
|
||||
snap_name.addClass("hide");
|
||||
snap_id.addClass("hide");
|
||||
disk_id.addClass("hide");
|
||||
break;
|
||||
}
|
||||
});
|
||||
$("input#schedule_type", context).on("change", function () {
|
||||
var periodic = $(this).prop("checked");
|
||||
|
||||
@@ -192,6 +237,7 @@ define(function (require) {
|
||||
function _retrieve(context) {
|
||||
$("#scheduling_" + this.res + "_actions_table .create", context).remove();
|
||||
var actionsJSON = [];
|
||||
var that = this;
|
||||
$("#scheduling_" + this.res + "_actions_table tbody tr").each(function (index) {
|
||||
var first = $(this).children("td")[0];
|
||||
if (!$("select", first).html()) {
|
||||
@@ -199,6 +245,22 @@ define(function (require) {
|
||||
if ($(this).attr("data")) {
|
||||
actionJSON = JSON.parse($(this).attr("data"));
|
||||
actionJSON.ID = String(index);
|
||||
var actions = [
|
||||
'snapshot-create',
|
||||
'snapshot-revert',
|
||||
'snapshot-delete',
|
||||
'disk-snapshot-create',
|
||||
'disk-snapshot-revert',
|
||||
'disk-snapshot-delete'
|
||||
];
|
||||
|
||||
if(actions.includes(that.selector.val())){
|
||||
var snap_name = $("#snapname").val();
|
||||
var snap_id = $("#snapid").val();
|
||||
var disk_id = $("#diskid").val();
|
||||
var rawData = [disk_id,snap_id,snap_name];
|
||||
actionJSON.ARGS = rawData.filter(function (e) {return e;}).join();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$.isEmptyObject(actionJSON)) { actionsJSON.push(actionJSON); };
|
||||
|
||||
@@ -21,6 +21,22 @@ the License for the specific language governing permissions and }} {{! limitatio
|
||||
<label for="relative_time">{{tr "Relative Time"}}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="only_name_form" class="hide">
|
||||
<td></td>
|
||||
<td>
|
||||
<input type="number" id="time_number" placeholder="{{tr 'Time'}}" style="width: 80%">
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="input_sched_action_form">
|
||||
<td></td>
|
||||
<td colspan="6">
|
||||
<div style="display: flex;">
|
||||
<input type="number" class="hide" id="diskid" placeholder="{{tr 'Disk Id'}}" style="width: 100%">
|
||||
<input type="number" class="hide" id="snapid" placeholder="{{tr 'Snap Id'}}" style="width: 100%">
|
||||
<input id="snapname" class="hide" placeholder="{{tr 'Snap Name'}}" style="width: 100%">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="relative_time_form" class="hide">
|
||||
<td></td>
|
||||
<td>
|
||||
|
||||
Reference in new issue
Block a user