From da73c8fb6bb350b93e5e60d86f2ef4c35d4c191b Mon Sep 17 00:00:00 2001 From: Steven Franzen Date: Mon, 10 Oct 2016 21:20:49 +0200 Subject: [PATCH 1/3] Update path to Underscore --- src/rockstor/storageadmin/templates/storageadmin/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rockstor/storageadmin/templates/storageadmin/base.html b/src/rockstor/storageadmin/templates/storageadmin/base.html index 145133602..d3f79f906 100644 --- a/src/rockstor/storageadmin/templates/storageadmin/base.html +++ b/src/rockstor/storageadmin/templates/storageadmin/base.html @@ -79,7 +79,7 @@ - + From 055221b7d71049bd04248635c7b24d17899cd67e Mon Sep 17 00:00:00 2001 From: Steven Franzen Date: Sat, 15 Oct 2016 20:46:41 +0200 Subject: [PATCH 2/3] Update Backbone script link --- src/rockstor/storageadmin/templates/storageadmin/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rockstor/storageadmin/templates/storageadmin/base.html b/src/rockstor/storageadmin/templates/storageadmin/base.html index d3f79f906..032fb4e9e 100644 --- a/src/rockstor/storageadmin/templates/storageadmin/base.html +++ b/src/rockstor/storageadmin/templates/storageadmin/base.html @@ -80,7 +80,7 @@ - + From bf3756b8b76c17f3e8e53d11c6e4c800139425fc Mon Sep 17 00:00:00 2001 From: Steven Franzen Date: Tue, 18 Oct 2016 21:47:08 +0200 Subject: [PATCH 3/3] Update handling of Backbone view options Newer versions of Backbone no longer implicitly attach these to the view, so the relevant initialize functions now do so explicitly. --- .../static/storageadmin/js/rockstor.js | 535 +++++++++--------- .../storageadmin/js/views/add_afp_share.js | 3 +- .../static/storageadmin/js/views/add_group.js | 3 +- .../js/views/add_replication_task.js | 1 + .../storageadmin/js/views/add_samba_export.js | 3 +- .../static/storageadmin/js/views/add_share.js | 3 +- .../static/storageadmin/js/views/add_user.js | 3 +- .../storageadmin/js/views/blink_disks.js | 3 +- .../js/views/configure_service.js | 3 +- .../storageadmin/js/views/dashboard_config.js | 3 +- .../js/views/disk_details_layout_view.js | 3 +- .../storageadmin/js/views/docker_service.js | 3 +- .../js/views/edit_network_connection.js | 3 +- .../storageadmin/js/views/edit_nfs_export.js | 3 +- .../js/views/pool_details_layout_view.js | 3 +- .../js/views/pool_rebalance_table.js | 3 +- .../storageadmin/js/views/pool_scrub_table.js | 3 +- .../js/views/replica_receive_trails.js | 3 +- .../storageadmin/js/views/replica_trails.js | 3 +- .../static/storageadmin/js/views/rollback.js | 3 +- .../storageadmin/js/views/setup_system.js | 3 +- .../js/views/share_details_layout_view.js | 3 +- .../js/views/share_usage_module.js | 3 +- .../js/views/smartcustom_disks.js | 3 +- .../static/storageadmin/js/views/snapshots.js | 3 +- .../storageadmin/js/views/snapshots_table.js | 3 +- .../storageadmin/js/views/spindown_disks.js | 3 +- .../static/storageadmin/js/views/tasks.js | 3 +- 28 files changed, 322 insertions(+), 292 deletions(-) diff --git a/src/rockstor/storageadmin/static/storageadmin/js/rockstor.js b/src/rockstor/storageadmin/static/storageadmin/js/rockstor.js index 06608af00..2bfa748c5 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/rockstor.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/rockstor.js @@ -26,21 +26,21 @@ PaginationMixin = { events: { - "click .go-to-page": "goToPage", - "click .prev-page": "prevPage", - "click .next-page": "nextPage" + "click .go-to-page": "goToPage", + "click .prev-page": "prevPage", + "click .next-page": "nextPage" }, goToPage: function(event) { - if (event) event.preventDefault(); - this.collection.goToPage(parseInt($(event.currentTarget).attr("data-page"))); + if (event) event.preventDefault(); + this.collection.goToPage(parseInt($(event.currentTarget).attr("data-page"))); }, prevPage: function(event) { - if (event) event.preventDefault(); - this.collection.prevPage(); + if (event) event.preventDefault(); + this.collection.prevPage(); }, nextPage: function(event) { - if (event) event.preventDefault(); - this.collection.nextPage(); + if (event) event.preventDefault(); + this.collection.nextPage(); } }; @@ -49,26 +49,26 @@ RockstorLayoutView = Backbone.View.extend({ className: 'layout', initialize: function() { - this.subviews = {}; - this.dependencies = []; + this.subviews = {}; + this.dependencies = []; }, fetch: function(callback, context) { - var allDependencies = []; - _.each(this.dependencies, function(dep) { - allDependencies.push(dep.fetch({silent: true})); - }); - $.when.apply($, allDependencies).done(function () { - if (callback) callback.apply(context); - }); + var allDependencies = []; + _.each(this.dependencies, function(dep) { + allDependencies.push(dep.fetch({silent: true})); + }); + $.when.apply($, allDependencies).done(function () { + if (callback) callback.apply(context); + }); }, renderDataTables: function(){ - $('table.data-table').DataTable({ - "iDisplayLength": 15, - "aLengthMenu": [[15, 30, 45, -1], [15, 30, 45, "All"]], - }); - }, + $('table.data-table').DataTable({ + "iDisplayLength": 15, + "aLengthMenu": [[15, 30, 45, -1], [15, 30, 45, "All"]], + }); + }, }); @@ -82,28 +82,28 @@ RockstorModuleView = Backbone.View.extend({ requestCount: 0, initialize: function() { - this.subviews = {}; - this.dependencies = []; + this.subviews = {}; + this.dependencies = []; }, fetch: function(callback, context) { - var allDependencies = []; - _.each(this.dependencies, function(dep) { - allDependencies.push(dep.fetch({silent: true})); - }); - $.when.apply($, allDependencies).done(function () { - if (callback) callback.apply(context); - }); + var allDependencies = []; + _.each(this.dependencies, function(dep) { + allDependencies.push(dep.fetch({silent: true})); + }); + $.when.apply($, allDependencies).done(function () { + if (callback) callback.apply(context); + }); }, render: function() { - $(this.el).html(this.template({ - module_name: this.module_name, - model: this.model, - collection: this.collection - })); + $(this.el).html(this.template({ + module_name: this.module_name, + model: this.model, + collection: this.collection + })); - return this; + return this; } }); @@ -112,118 +112,119 @@ RockStorWidgetView = Backbone.View.extend({ className: 'widget', events: { - 'click .configure-widget': 'configure', - 'click .resize-widget': 'resize', - 'click .close-widget': 'close', - 'click .download-widget': 'download' + 'click .configure-widget': 'configure', + 'click .resize-widget': 'resize', + 'click .close-widget': 'close', + 'click .download-widget': 'download' }, - initialize: function() { - this.maximized = this.options.maximized; - this.name = this.options.name; - this.displayName = this.options.displayName; - this.parentView = this.options.parentView; - this.dependencies = []; + initialize: function(options) { + this.options = options || {} + this.maximized = this.options.maximized; + this.name = this.options.name; + this.displayName = this.options.displayName; + this.parentView = this.options.parentView; + this.dependencies = []; }, render: function() { - $(this.el).attr('id', this.name + '_widget'); + $(this.el).attr('id', this.name + '_widget'); }, configure: function(event) { - if (!_.isUndefined(event) && !_.isNull(event)) { - event.preventDefault(); - } + if (!_.isUndefined(event) && !_.isNull(event)) { + event.preventDefault(); + } }, resize: function(event) { - if (!_.isUndefined(event) && !_.isNull(event)) { - event.preventDefault(); - } - var c = $(this.el).closest('div.widgets-container'); - var w = $(this.el).closest('div.widget-ph'); // current widget - var widgetDef = RockStorWidgets.findByName(this.name); - if (!this.maximized) { - // Maximizing - // Remember current position - this.originalPosition = w.index(); - // remove list item from current position - w.detach(); - // insert at first position in the list - c.prepend(w); - // resize to max - w.attr('data-ss-colspan',widgetDef.maxCols); - w.attr('data-ss-rowspan',widgetDef.maxRows); - this.maximized = true; - } else { - // Restoring - w.detach(); - w.attr('data-ss-colspan',widgetDef.cols); - w.attr('data-ss-rowspan',widgetDef.rows); - // find current list item at original index - if (_.isNull(this.originalPosition) || - _.isUndefined(this.originalPosition)) { - this.originalPosition = 0; - } - curr_w = c.find("div.widget-ph:eq("+this.originalPosition+")"); - // insert widget at original position - if (curr_w.length > 0) { - // if not last widget - curr_w.before(w); - } else { - c.append(w); - } - this.maximized = false; - } - // trigger rearrange so shapeshift can do its job - c.trigger('ss-rearrange'); - this.parentView.saveWidgetConfiguration(); + if (!_.isUndefined(event) && !_.isNull(event)) { + event.preventDefault(); + } + var c = $(this.el).closest('div.widgets-container'); + var w = $(this.el).closest('div.widget-ph'); // current widget + var widgetDef = RockStorWidgets.findByName(this.name); + if (!this.maximized) { + // Maximizing + // Remember current position + this.originalPosition = w.index(); + // remove list item from current position + w.detach(); + // insert at first position in the list + c.prepend(w); + // resize to max + w.attr('data-ss-colspan',widgetDef.maxCols); + w.attr('data-ss-rowspan',widgetDef.maxRows); + this.maximized = true; + } else { + // Restoring + w.detach(); + w.attr('data-ss-colspan',widgetDef.cols); + w.attr('data-ss-rowspan',widgetDef.rows); + // find current list item at original index + if (_.isNull(this.originalPosition) || + _.isUndefined(this.originalPosition)) { + this.originalPosition = 0; + } + curr_w = c.find("div.widget-ph:eq("+this.originalPosition+")"); + // insert widget at original position + if (curr_w.length > 0) { + // if not last widget + curr_w.before(w); + } else { + c.append(w); + } + this.maximized = false; + } + // trigger rearrange so shapeshift can do its job + c.trigger('ss-rearrange'); + this.parentView.saveWidgetConfiguration(); }, close: function(event) { - if (!_.isUndefined(event) && !_.isNull(event)) { - event.preventDefault(); - } - this.parentView.removeWidget(this.name, this); + if (!_.isUndefined(event) && !_.isNull(event)) { + event.preventDefault(); + } + this.parentView.removeWidget(this.name, this); }, download: function(event) { - if (!_.isUndefined(event) && !_.isNull(event)) { - event.preventDefault(); - } + if (!_.isUndefined(event) && !_.isNull(event)) { + event.preventDefault(); + } }, cleanup: function() { - logger.debug("In RockStorWidgetView close"); + logger.debug("In RockStorWidgetView close"); }, fetch: function(callback, context) { - var allDependencies = []; - _.each(this.dependencies, function(dep) { - allDependencies.push(dep.fetch({silent: true})); - }); - $.when.apply($, allDependencies).done(function () { - if (callback) callback.apply(context); - }); + var allDependencies = []; + _.each(this.dependencies, function(dep) { + allDependencies.push(dep.fetch({silent: true})); + }); + $.when.apply($, allDependencies).done(function () { + if (callback) callback.apply(context); + }); } }); function getCookie(name) { - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; } function csrfSafeMethod(method) { @@ -234,16 +235,16 @@ function csrfSafeMethod(method) { $.ajaxSetup({ crossDomain: false, // obviates need for sameOrigin test beforeSend: function(xhr, settings) { - if (!csrfSafeMethod(settings.type)) { - var csrftoken = getCookie('csrftoken'); - xhr.setRequestHeader("X-CSRFToken", csrftoken); - } + if (!csrfSafeMethod(settings.type)) { + var csrftoken = getCookie('csrftoken'); + xhr.setRequestHeader("X-CSRFToken", csrftoken); + } } }); function showApplianceList() { var applianceSelectPopup = $('#appliance-select-popup').modal({ - show: false + show: false }); $('#appliance-select-content').html((new AppliancesView()).render().el); $('#appliance-select-popup').modal('show'); @@ -296,32 +297,32 @@ function enableButton(button) { function buttonDisabled(button) { if (button.data("executing")) { - return true; + return true; } else { - return false; + return false; } } function refreshNavbar() { $.ajax({ - url: "api/commands/current-user", - type: "POST", - dataType: "json", - global: false, // dont show global loading indicator - success: function(data, status, xhr) { - var currentUser= data; - $('#user-name').css({textTransform: 'none'}); - $('#user-name').html(currentUser+' '); - }, - error: function(xhr, status, error) { - // $('#user-name').html("Hello, Admin! "); - } + url: "api/commands/current-user", + type: "POST", + dataType: "json", + global: false, // dont show global loading indicator + success: function(data, status, xhr) { + var currentUser= data; + $('#user-name').css({textTransform: 'none'}); + $('#user-name').html(currentUser+' '); + }, + error: function(xhr, status, error) { + // $('#user-name').html("Hello, Admin! "); + } }); var navbarTemplate = window.JST.common_navbar; $("#navbar-links").html(navbarTemplate({ - logged_in: logged_in + logged_in: logged_in })); @@ -334,14 +335,14 @@ function refreshNavbar() { function parseXhrError(xhr) { var msg = xhr.responseText; try { - msg = JSON.parse(msg).detail; + msg = JSON.parse(msg).detail; } catch(err) { } if (typeof(msg)=="string") { - try { - msg = JSON.parse(msg); - } catch(err) { - } + try { + msg = JSON.parse(msg); + } catch(err) { + } } return msg; } @@ -355,48 +356,48 @@ function getXhrErrorJson(xhr) { function setApplianceName() { var appliances = new ApplianceCollection(); appliances.fetch({ - success: function(request) { - if (appliances.length > 0) { - RockStorGlobals.currentAppliance = - appliances.find(function(appliance) { - return appliance.get('current_appliance') == true; - }); - $('#appliance-name').html(' Hostname: ' + RockStorGlobals.currentAppliance.get('hostname') + '    Mgmt IP: ' + RockStorGlobals.currentAppliance.get('ip')); - } - }, - error: function(request, response) { - } + success: function(request) { + if (appliances.length > 0) { + RockStorGlobals.currentAppliance = + appliances.find(function(appliance) { + return appliance.get('current_appliance') == true; + }); + $('#appliance-name').html(' Hostname: ' + RockStorGlobals.currentAppliance.get('hostname') + '    Mgmt IP: ' + RockStorGlobals.currentAppliance.get('ip')); + } + }, + error: function(request, response) { + } }); } function fetchDependencies(dependencies, callback, context) { if (dependencies.length == 0) { - if (callback) callback.apply(context); + if (callback) callback.apply(context); } var requestCount = dependencies.length; _.each(dependencies, function(dependency) { - dependency.fetch({ - success: function(request){ - requestCount -= 1; - if (requestCount == 0) { - if (callback) callback.apply(context); - } - }, - error: function(request, response) { - requestCount -= 1; - if (requestCount == 0) { - if (callback) callback.apply(context); - } - } - }); + dependency.fetch({ + success: function(request){ + requestCount -= 1; + if (requestCount == 0) { + if (callback) callback.apply(context); + } + }, + error: function(request, response) { + requestCount -= 1; + if (requestCount == 0) { + if (callback) callback.apply(context); + } + } + }); }); } function checkBrowser() { var userAgent = navigator.userAgent; if (!/firefox/i.test(userAgent) && !/chrome/i.test(userAgent)) { - $('#browsermsg').html('
The RockStor WebUI is supported only on Firefox or Chrome. Some features may not work correctly.
'); + $('#browsermsg').html('
The RockStor WebUI is supported only on Firefox or Chrome. Some features may not work correctly.
'); } RockStorGlobals.browserChecked = true; } @@ -423,52 +424,53 @@ probeStates = { var RockstorUtil = function() { var util = { - // maintain selected object list - // list is an array of contains models - - // does the list contain a model with attr 'name' with value 'value' - listContains: function(list, name, value) { - return _.find(list, function(obj) { - return obj.get(name) == value; - }); - }, - - // add obj from collection with attr 'name' and value 'value' to list - addToList: function(list, collection, name, value) { - list.push(collection.find(function(obj) { - return obj.get(name) == value; - })); - }, - - // remove obj with attr 'name' and value 'value' - removeFromList: function(list, name, value) { - var i = _.indexOf(_.map(list, function(obj) { - return obj.get(name); - }), value); - if (i != -1) { - list.splice(i,1); - } - } + // maintain selected object list + // list is an array of contains models + + // does the list contain a model with attr 'name' with value 'value' + listContains: function(list, name, value) { + return _.find(list, function(obj) { + return obj.get(name) == value; + }); + }, + + // add obj from collection with attr 'name' and value 'value' to list + addToList: function(list, collection, name, value) { + list.push(collection.find(function(obj) { + return obj.get(name) == value; + })); + }, + + // remove obj with attr 'name' and value 'value' + removeFromList: function(list, name, value) { + var i = _.indexOf(_.map(list, function(obj) { + return obj.get(name); + }), value); + if (i != -1) { + list.splice(i,1); + } + } }; return util; }(); RockstorWizardPage = Backbone.View.extend({ - initialize: function() { - this.evAgg = this.options.evAgg; - this.parent = this.options.parent; + initialize: function(options) { + this.options = options || {} + this.evAgg = this.options.evAgg; + this.parent = this.options.parent; }, render: function() { - $(this.el).html(this.template({ - model: this.model - })); - return this; + $(this.el).html(this.template({ + model: this.model + })); + return this; }, save: function() { - return $.Deferred().resolve(); + return $.Deferred().resolve(); } }); @@ -476,108 +478,109 @@ WizardView = Backbone.View.extend({ tagName: 'div', events: { - 'click #next-page': 'nextPage', - 'click #prev-page': 'prevPage' + 'click #next-page': 'nextPage', + 'click #prev-page': 'prevPage' }, - initialize: function() { - this.template = window.JST.wizard_wizard; - this.pages = null; - this.currentPage = null; - this.currentPageNum = -1; - this.contentEl = '#ph-wizard-contents'; - this.evAgg = _.extend({}, Backbone.Events); - this.evAgg.bind('nextPage', this.nextPage, this); - this.evAgg.bind('prevPage', this.prevPage, this); - this.parent = this.options.parent; - this.title = this.options.title; + initialize: function(options) { + this.options = options || {} + this.template = window.JST.wizard_wizard; + this.pages = null; + this.currentPage = null; + this.currentPageNum = -1; + this.contentEl = '#ph-wizard-contents'; + this.evAgg = _.extend({}, Backbone.Events); + this.evAgg.bind('nextPage', this.nextPage, this); + this.evAgg.bind('prevPage', this.prevPage, this); + this.parent = this.options.parent; + this.title = this.options.title; }, setPages: function(pages) { - this.pages = pages; + this.pages = pages; }, render: function() { - $(this.el).html(this.template({ - title: this.title, - model: this.model - })); - this.nextPage(); - return this; + $(this.el).html(this.template({ + title: this.title, + model: this.model + })); + this.nextPage(); + return this; }, nextPage: function() { - var _this = this; - var promise = !_.isNull(this.currentPage) ? - this.currentPage.save() : - $.Deferred().resolve(); - promise.done(function(result, status, jqXHR) { - _this.incrementPage(); - }); - promise.fail(function(jqXHR, status, error) { - console.log(error); - }); + var _this = this; + var promise = !_.isNull(this.currentPage) ? + this.currentPage.save() : + $.Deferred().resolve(); + promise.done(function(result, status, jqXHR) { + _this.incrementPage(); + }); + promise.fail(function(jqXHR, status, error) { + console.log(error); + }); }, incrementPageNum: function() { - this.currentPageNum = this.currentPageNum + 1; + this.currentPageNum = this.currentPageNum + 1; }, decrementPageNum: function() { - this.currentPageNum = this.currentPageNum - 1; + this.currentPageNum = this.currentPageNum - 1; }, incrementPage: function() { - if (!this.lastPage()) { - this.incrementPageNum(); - this.setCurrentPage(); - this.renderCurrentPage(); - } else { - this.finish(); - } + if (!this.lastPage()) { + this.incrementPageNum(); + this.setCurrentPage(); + this.renderCurrentPage(); + } else { + this.finish(); + } }, decrementPage: function() { - if (!this.firstPage()) { - this.decrementPageNum(); - this.setCurrentPage(); - this.renderCurrentPage(); - } + if (!this.firstPage()) { + this.decrementPageNum(); + this.setCurrentPage(); + this.renderCurrentPage(); + } }, setCurrentPage: function() { - this.currentPage = new this.pages[this.currentPageNum]({ - model: this.model, - evAgg: this.evAgg - }); + this.currentPage = new this.pages[this.currentPageNum]({ + model: this.model, + evAgg: this.evAgg + }); }, renderCurrentPage: function() { - this.$(this.contentEl).html(this.currentPage.render().el); - this.modifyButtonText(); + this.$(this.contentEl).html(this.currentPage.render().el); + this.modifyButtonText(); }, prevPage: function() { - this.decrementPage(); + this.decrementPage(); }, modifyButtonText: function() { - if (this.lastPage()) { - this.$('#next-page').html('Finish'); - } else { - this.$('#next-page').html('Next'); - } + if (this.lastPage()) { + this.$('#next-page').html('Finish'); + } else { + this.$('#next-page').html('Next'); + } }, firstPage: function() { - return (this.currentPageNum == 0); + return (this.currentPageNum == 0); }, lastPage: function() { - return (this.currentPageNum == (this.pages.length - 1)); + return (this.currentPageNum == (this.pages.length - 1)); }, finish: function() { - console.log('finish'); + console.log('finish'); } }); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/add_afp_share.js b/src/rockstor/storageadmin/static/storageadmin/js/views/add_afp_share.js index 117709d25..8d40f78af 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/add_afp_share.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/add_afp_share.js @@ -29,7 +29,8 @@ AddAFPShareView = RockstorLayoutView.extend({ "click #cancel": "cancel" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.afp_add_afp_share; this.shares = new ShareCollection(); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/add_group.js b/src/rockstor/storageadmin/static/storageadmin/js/views/add_group.js index dcee5c394..504359d76 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/add_group.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/add_group.js @@ -29,7 +29,8 @@ AddGroupView = RockstorLayoutView.extend({ "click #cancel": "cancel" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); // set template diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/add_replication_task.js b/src/rockstor/storageadmin/static/storageadmin/js/views/add_replication_task.js index 46835e5d3..488ea989f 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/add_replication_task.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/add_replication_task.js @@ -32,6 +32,7 @@ AddReplicationTaskView = RockstorLayoutView.extend({ }, initialize: function() { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.replication_add_replication_task; this.shares = new ShareCollection(); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/add_samba_export.js b/src/rockstor/storageadmin/static/storageadmin/js/views/add_samba_export.js index 8dfa71871..02d1d737e 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/add_samba_export.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/add_samba_export.js @@ -31,7 +31,8 @@ AddSambaExportView = RockstorLayoutView.extend({ 'click #shadow_copy': 'toggleSnapPrefix' }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.samba_add_samba_export; this.shares = new ShareCollection(); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/add_share.js b/src/rockstor/storageadmin/static/storageadmin/js/views/add_share.js index a2102b051..dfda086d4 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/add_share.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/add_share.js @@ -33,7 +33,8 @@ AddShareView = Backbone.View.extend({ "click #js-cancel": "cancel" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} var _this = this; this.pools = new PoolCollection(); this.pools.pageSize = RockStorGlobals.maxPageSize; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/add_user.js b/src/rockstor/storageadmin/static/storageadmin/js/views/add_user.js index c658d3499..7413276db 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/add_user.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/add_user.js @@ -29,7 +29,8 @@ AddUserView = RockstorLayoutView.extend({ "click #cancel": "cancel" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); // set template diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/blink_disks.js b/src/rockstor/storageadmin/static/storageadmin/js/views/blink_disks.js index 9258ec0f5..3dfbd0cb9 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/blink_disks.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/blink_disks.js @@ -29,7 +29,8 @@ BlinkDiskView = RockstorLayoutView.extend({ 'click #cancel': 'cancel' }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.disk_blink_disks; this.disks = new DiskCollection(); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/configure_service.js b/src/rockstor/storageadmin/static/storageadmin/js/views/configure_service.js index 81115b764..c4640d179 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/configure_service.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/configure_service.js @@ -32,7 +32,8 @@ ConfigureServiceView = RockstorLayoutView.extend({ "click #mode": "toggleNutFields" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base var _this = this; this.constructor.__super__.initialize.apply(this, arguments); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/dashboard_config.js b/src/rockstor/storageadmin/static/storageadmin/js/views/dashboard_config.js index fe358e111..fd19c0075 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/dashboard_config.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/dashboard_config.js @@ -29,7 +29,8 @@ DashboardConfigView = Backbone.View.extend({ "click .widget-name": "widgetClicked" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.dashboardconfig = this.options.dashboardconfig; this.template = window.JST.dashboard_dashboard_config; this.parentView = this.options.parentView; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/disk_details_layout_view.js b/src/rockstor/storageadmin/static/storageadmin/js/views/disk_details_layout_view.js index 97972c6ef..d7f036d1b 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/disk_details_layout_view.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/disk_details_layout_view.js @@ -26,7 +26,8 @@ DiskDetailsLayoutView = RockstorLayoutView.extend({ - initialize: function () { + initialize: function (options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); this.diskName = this.options.diskName; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/docker_service.js b/src/rockstor/storageadmin/static/storageadmin/js/views/docker_service.js index f060b0ed6..840adef74 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/docker_service.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/docker_service.js @@ -29,7 +29,8 @@ DockerServiceView = Backbone.View.extend({ 'switchChange.bootstrapSwitch': 'switchStatus', }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.template = window.JST.rockons_docker_service; this.serviceName = 'docker'; this.service = new Service({name: this.serviceName}); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/edit_network_connection.js b/src/rockstor/storageadmin/static/storageadmin/js/views/edit_network_connection.js index 67e87aa19..f48a79e19 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/edit_network_connection.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/edit_network_connection.js @@ -33,7 +33,8 @@ NetworkConnectionView = RockstorLayoutView.extend({ 'change #ctype': 'renderCTypeOptionalFields' }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.connectionId = this.options.connectionId || null; this.connection = null; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/edit_nfs_export.js b/src/rockstor/storageadmin/static/storageadmin/js/views/edit_nfs_export.js index 801d62ea0..c718fd8f4 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/edit_nfs_export.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/edit_nfs_export.js @@ -29,7 +29,8 @@ EditNFSExportView = RockstorLayoutView.extend({ 'click #cancel': 'cancel' }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.nfs_edit_nfs_export; this.shares = new ShareCollection(); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/pool_details_layout_view.js b/src/rockstor/storageadmin/static/storageadmin/js/views/pool_details_layout_view.js index 12b7ad778..a32b0e783 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/pool_details_layout_view.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/pool_details_layout_view.js @@ -26,7 +26,8 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({ - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); this.poolName = this.options.poolName; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/pool_rebalance_table.js b/src/rockstor/storageadmin/static/storageadmin/js/views/pool_rebalance_table.js index 6078d8903..17b16cba1 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/pool_rebalance_table.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/pool_rebalance_table.js @@ -30,7 +30,8 @@ PoolRebalanceTableModule = RockstorModuleView.extend({ "click #js-poolrebalance-cancel": "cancel" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.template = window.JST.pool_poolrebalance_table_template; this.startRebalanceTemplate = window.JST.pool_poolrebalance_start_template; this.module_name = 'poolrebalances'; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/pool_scrub_table.js b/src/rockstor/storageadmin/static/storageadmin/js/views/pool_scrub_table.js index 725ee577c..498971c6c 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/pool_scrub_table.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/pool_scrub_table.js @@ -30,7 +30,8 @@ PoolScrubTableModule = RockstorModuleView.extend({ "click #js-poolscrub-cancel": "cancel" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.template = window.JST.pool_poolscrub_table_template; this.startScrubTemplate = window.JST.pool_poolscrub_start_template; this.module_name = 'poolscrubs'; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/replica_receive_trails.js b/src/rockstor/storageadmin/static/storageadmin/js/views/replica_receive_trails.js index e2237e2d4..907a13a75 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/replica_receive_trails.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/replica_receive_trails.js @@ -29,7 +29,8 @@ ReplicaReceiveTrailsView = RockstorLayoutView.extend({ events: { }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); // set template diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/replica_trails.js b/src/rockstor/storageadmin/static/storageadmin/js/views/replica_trails.js index 6081ccfac..e016f3410 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/replica_trails.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/replica_trails.js @@ -29,7 +29,8 @@ ReplicaTrailsView = RockstorLayoutView.extend({ events: { }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); // set template diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/rollback.js b/src/rockstor/storageadmin/static/storageadmin/js/views/rollback.js index b21cd0715..8a2bf4a55 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/rollback.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/rollback.js @@ -30,7 +30,8 @@ RollbackView = RockstorLayoutView.extend({ 'click #js-confirm-rollback-submit': 'confirmRollback' }, - initialize: function() { + initialize: function(option) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); // Templates this.template = window.JST.share_rollback; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/setup_system.js b/src/rockstor/storageadmin/static/storageadmin/js/views/setup_system.js index d2aff64db..ee45c153f 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/setup_system.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/setup_system.js @@ -27,7 +27,8 @@ SetupSystemView = Backbone.View.extend({ tagName: 'div', - initialize: function() { + initialize: function(options) { + this.options = options || {} this.template = window.JST.setup_system; this.sysinfo = this.options.sysinfo; }, diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/share_details_layout_view.js b/src/rockstor/storageadmin/static/storageadmin/js/views/share_details_layout_view.js index 7516118b9..5f63bfe9a 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/share_details_layout_view.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/share_details_layout_view.js @@ -38,7 +38,8 @@ ShareDetailsLayoutView = RockstorLayoutView.extend({ "click #js-confirm-share-delete": "confirmShareDelete", }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); this.shareName = this.options.shareName; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/share_usage_module.js b/src/rockstor/storageadmin/static/storageadmin/js/views/share_usage_module.js index 46f796ab5..a37dafb7b 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/share_usage_module.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/share_usage_module.js @@ -32,7 +32,8 @@ ShareUsageModule = RockstorModuleView.extend({ }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.template = window.JST.share_share_usage_module; this.editTemplate = window.JST.share_share_usage_edit; this.module_name = 'share-usage'; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/smartcustom_disks.js b/src/rockstor/storageadmin/static/storageadmin/js/views/smartcustom_disks.js index f8e10b3cd..56a1567de 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/smartcustom_disks.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/smartcustom_disks.js @@ -29,7 +29,8 @@ SmartcustomDiskView = RockstorLayoutView.extend({ 'click #cancel': 'cancel' }, - initialize: function () { + initialize: function (options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.disk_smartcustom_disks; this.disks = new DiskCollection(); diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots.js b/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots.js index f23927361..77115303a 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots.js @@ -34,7 +34,8 @@ SnapshotsView = SnapshotsCommonView.extend({ "click #js-snapshot-delete-multiple": "deleteMultipleSnapshots" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.share_snapshots; this.addTemplate = window.JST.share_snapshot_add_template; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots_table.js b/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots_table.js index 478220317..03f54f303 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots_table.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/snapshots_table.js @@ -35,7 +35,8 @@ SnapshotsTableModule = SnapshotsCommonView.extend({ "click #js-snapshot-delete-multiple": "deleteMultipleSnapshots" }, - initialize: function() { + initialize: function(options) { + this.options = options || {} this.template = window.JST.share_snapshots_table_template; this.addTemplate = window.JST.share_snapshot_add; this.module_name = 'snapshots'; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/spindown_disks.js b/src/rockstor/storageadmin/static/storageadmin/js/views/spindown_disks.js index aa908a6ab..0fa1def73 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/spindown_disks.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/spindown_disks.js @@ -29,7 +29,8 @@ SpindownDiskView = RockstorLayoutView.extend({ 'click #cancel': 'cancel' }, - initialize: function () { + initialize: function (options) { + this.options = options || {} var _this = this; this.constructor.__super__.initialize.apply(this, arguments); this.template = window.JST.disk_spindown_disks; diff --git a/src/rockstor/storageadmin/static/storageadmin/js/views/tasks.js b/src/rockstor/storageadmin/static/storageadmin/js/views/tasks.js index 5c560c40d..16314a9e2 100644 --- a/src/rockstor/storageadmin/static/storageadmin/js/views/tasks.js +++ b/src/rockstor/storageadmin/static/storageadmin/js/views/tasks.js @@ -29,7 +29,8 @@ TasksView = RockstorLayoutView.extend({ events: { }, - initialize: function() { + initialize: function(options) { + this.options = options || {} // call initialize of base this.constructor.__super__.initialize.apply(this, arguments); // set template