From 53278e3d67147adff27790c74a8d18f19f164231 Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Mon, 22 Feb 2021 15:13:44 +0100 Subject: [PATCH] F #1428: Backup interface (#852) Signed-off-by: Frederick Borges --- .../form-panels/create/wizard-tabs/general.js | 48 +++++++++++++++++++ .../create/wizard-tabs/general/html.hbs | 21 ++++++++ .../public/app/tabs/vms-tab/panels/info.js | 2 +- .../app/utils/panel/permissions-table.js | 21 +++++++- .../utils/panel/permissions-table/backup.hbs | 43 +++++++++++++++++ .../utils/panel/permissions-table/html.hbs | 3 +- 6 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 src/sunstone/public/app/utils/panel/permissions-table/backup.hbs diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js index aeff213504..c7fc7dcec7 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js @@ -31,6 +31,8 @@ define(function(require) { var GroupTable = require("tabs/groups-tab/datatable"); var OpenNebulaHost = require("opennebula/host"); var CoresPerSocket = require("tabs/templates-tab/form-panels/create/wizard-tabs/utils/cores-per-socket"); + var OpenNebulaMarketplace = require('opennebula/marketplace'); + var Notifier = require('utils/notifier'); /* TEMPLATES @@ -328,6 +330,34 @@ define(function(require) { } fillLXDProfiles(context) + + fillMarketplaces(); + } + + function fillMarketplaces(){ + var fillMP = function(_, marketplaces){ + // EMPTY + $('#MARKETPLACE_ID').empty(); + $('#MARKETPLACE_ID').append(''); + + $.each(marketplaces, function(index, marketplace){ + var id = marketplace.MARKETPLACE.ID; + var text = id + ' - ' + marketplace.MARKETPLACE.NAME; + var type = marketplace.MARKETPLACE.MARKET_MAD; + + if (type == "http" || type == "s3"){ + $('#MARKETPLACE_ID').append('") + } + + }); + } + + OpenNebulaMarketplace.list({ + success: fillMP, + error: Notifier.onError, + options: {force: true} // Do not use cache + }); + } function fillLXDProfiles(context){ @@ -437,6 +467,13 @@ define(function(require) { delete templateJSON.CPU_HOT_ADD_ENABLED; delete templateJSON.MEMORY_HOT_ADD_ENABLED; + templateJSON.BACKUP = { + 'FREQUENCY_SECONDS': templateJSON['FREQUENCY_SECONDS'], + 'MARKETPLACE_ID': templateJSON['MARKETPLACE_ID'], + } + delete templateJSON.FREQUENCY_SECONDS; + delete templateJSON.MARKETPLACE_ID; + return templateJSON; } @@ -563,6 +600,17 @@ define(function(require) { delete templateJSON['HOT_RESIZE']; } + // Fill backup attributes + if (templateJSON['BACKUP']){ + if (templateJSON.BACKUP['FREQUENCY_SECONDS']){ + WizardFields.fillInput($('#FREQUENCY_SECONDS',context), templateJSON.BACKUP['FREQUENCY_SECONDS']); + } + if (templateJSON.BACKUP['MARKETPLACE_ID']){ + WizardFields.fillInput($('#MARKETPLACE_ID',context), templateJSON.BACKUP['MARKETPLACE_ID']); + } + delete templateJSON['BACKUP']; + } + WizardFields.fill(context, templateJSON); } diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs index 0e12fb63eb..b405687b2e 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs @@ -213,6 +213,27 @@ +
+
+
+ + {{tr "Backups"}} + +
+ + +
+
+ +