Skip to content

Commit

Permalink
Update all occurrences of this.options
Browse files Browse the repository at this point in the history
New Backbone versions no longer automatically set this on the object,
you have to pass it to initialize().
  • Loading branch information
sfranzen committed Oct 15, 2016
1 parent 055221b commit 4eca949
Show file tree
Hide file tree
Showing 30 changed files with 86 additions and 86 deletions.
22 changes: 11 additions & 11 deletions src/rockstor/storageadmin/static/storageadmin/js/rockstor.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ RockStorWidgetView = Backbone.View.extend({
'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;
initialize: function(options) {
this.maximized = options.maximized;
this.name = options.name;
this.displayName = options.displayName;
this.parentView = options.parentView;
this.dependencies = [];
},

Expand Down Expand Up @@ -455,9 +455,9 @@ var RockstorUtil = function() {

RockstorWizardPage = Backbone.View.extend({

initialize: function() {
this.evAgg = this.options.evAgg;
this.parent = this.options.parent;
initialize: function(options) {
this.evAgg = options.evAgg;
this.parent = options.parent;
},

render: function() {
Expand All @@ -480,7 +480,7 @@ WizardView = Backbone.View.extend({
'click #prev-page': 'prevPage'
},

initialize: function() {
initialize: function(options) {
this.template = window.JST.wizard_wizard;
this.pages = null;
this.currentPage = null;
Expand All @@ -489,8 +489,8 @@ WizardView = Backbone.View.extend({
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;
this.parent = options.parent;
this.title = options.title;
},

setPages: function(pages) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ AddAFPShareView = RockstorLayoutView.extend({
"click #cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.afp_add_afp_share;
this.shares = new ShareCollection();
// dont paginate shares for now
this.shares.pageSize = RockStorGlobals.maxPageSize;
this.dependencies.push(this.shares);
this.afpShareId = this.options.afpShareId || null;
this.afpShareId = options.afpShareId || null;
this.afpShares = new AFPCollection({afpShareId: this.afpShareId});
this.dependencies.push(this.afpShares);
this.yes_no_choices = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ AddGroupView = RockstorLayoutView.extend({
"click #cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
// call initialize of base
this.constructor.__super__.initialize.apply(this, arguments);
// set template
this.template = window.JST.users_add_group;
this.groupname = this.options.groupname;
this.groupname = options.groupname;
this.group = new Group({groupname: this.groupname});
this.dependencies.push(this.group);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AddReplicationTaskView = RockstorLayoutView.extend({
"change #appliance": "fetchRemotePools"
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.replication_add_replication_task;
this.shares = new ShareCollection();
Expand All @@ -44,7 +44,7 @@ AddReplicationTaskView = RockstorLayoutView.extend({
this.dependencies.push(this.replicas);
this.remote_pools = [];

this.replicaId = this.options.replicaId;
this.replicaId = options.replicaId;

if (!_.isUndefined(this.replicaId) && !_.isNull(this.replicaId)) {
this.replica = new Replica({id: this.replicaId});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AddSambaExportView = RockstorLayoutView.extend({
'click #shadow_copy': 'toggleSnapPrefix'
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.samba_add_samba_export;
this.shares = new ShareCollection();
Expand All @@ -41,7 +41,7 @@ AddSambaExportView = RockstorLayoutView.extend({
this.users.pageSize = RockStorGlobals.maxPageSize;
this.dependencies.push(this.shares);
this.dependencies.push(this.users);
this.sambaShareId = this.options.sambaShareId || null;
this.sambaShareId = options.sambaShareId || null;
this.sambaShares = new SambaCollection({sambaShareId: this.sambaShareId});
this.dependencies.push(this.sambaShares);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AddScheduledTaskView = RockstorLayoutView.extend({
"change #task_type": "renderOptionalFields"
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.scheduled_tasks_add_task;
this.snapshotFieldsTemplate = window.JST.scheduled_tasks_snapshot_fields;
Expand All @@ -42,7 +42,7 @@ AddScheduledTaskView = RockstorLayoutView.extend({
this.pools.pageSize = RockStorGlobals.maxPageSize;
this.dependencies.push(this.shares);
this.dependencies.push(this.pools);
this.taskDefId = this.options.taskDefId;
this.taskDefId = options.taskDefId;
if (!_.isUndefined(this.taskDefId) && !_.isNull(this.taskDefId)) {
this.taskDef = new TaskDef({id: this.taskDefId});
this.dependencies.push(this.taskDef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ AddShareView = Backbone.View.extend({
"click #js-cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
var _this = this;
this.pools = new PoolCollection();
this.pools.pageSize = RockStorGlobals.maxPageSize;
this.preSelectedPoolName = this.options.poolName || null;
this.preSelectedPoolName = options.poolName || null;
this.tickFormatter = function(d) {
var formatter = d3.format(",.1f");
if (d > 1024) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ AddUserView = RockstorLayoutView.extend({
"click #cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
// call initialize of base
this.constructor.__super__.initialize.apply(this, arguments);
// set template
this.template = window.JST.users_add_user;
this.username = this.options.username;
this.username = options.username;
if (!_.isUndefined(this.username)) {
this.user = new User({username: this.username});
this.dependencies.push(this.user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ BlinkDiskView = RockstorLayoutView.extend({
'click #cancel': 'cancel'
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.disk_blink_disks;
this.disks = new DiskCollection();
this.diskName = this.options.diskName;
this.diskName = options.diskName;
this.dependencies.push(this.disks);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ ConfigureServiceView = RockstorLayoutView.extend({
"click #mode": "toggleNutFields"
},

initialize: function() {
initialize: function(options) {
// call initialize of base
var _this = this;
this.constructor.__super__.initialize.apply(this, arguments);
this.serviceName = this.options.serviceName;
this.adStatus = this.options.adStatus;
this.serviceName = options.serviceName;
this.adStatus = options.adStatus;
// set template
this.template = window.JST['services_configure_' + this.serviceName];
this.rules = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ CreateCloneView = RockstorLayoutView.extend({
"click #js-cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.share_create_clone;
this.sourceType = this.options.sourceType;
this.shareName = this.options.shareName;
this.snapName = this.options.snapName;
this.sourceType = options.sourceType;
this.shareName = options.shareName;
this.snapName = options.snapName;
},

render: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ DashboardConfigView = Backbone.View.extend({
"click .widget-name": "widgetClicked"
},

initialize: function() {
this.dashboardconfig = this.options.dashboardconfig;
initialize: function(options) {
this.dashboardconfig = options.dashboardconfig;
this.template = window.JST.dashboard_dashboard_config;
this.parentView = this.options.parentView;
this.parentView = options.parentView;
this.initHandlebarHelpers();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

DiskDetailsLayoutView = RockstorLayoutView.extend({

initialize: function () {
initialize: function (options) {
// call initialize of base
this.constructor.__super__.initialize.apply(this, arguments);
this.diskName = this.options.diskName;
this.diskName = options.diskName;
this.template = window.JST.disk_disk_details_layout;
this.disk = new Disk({diskName: this.diskName});
this.smartinfo = new SmartInfo({diskName: this.diskName});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ DockerServiceView = Backbone.View.extend({
'switchChange.bootstrapSwitch': 'switchStatus',
},

initialize: function() {
initialize: function(options) {
this.template = window.JST.rockons_docker_service;
this.serviceName = 'docker';
this.service = new Service({name: this.serviceName});
this.parentView = this.options.parentView;
this.parentView = options.parentView;
this.updateFreq = 30000;
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ NetworkConnectionView = RockstorLayoutView.extend({
'change #ctype': 'renderCTypeOptionalFields'
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.connectionId = this.options.connectionId || null;
this.connectionId = options.connectionId || null;
this.connection = null;
this.template = window.JST.network_new_connection;
this.devices = new NetworkDeviceCollection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ EditNFSExportView = RockstorLayoutView.extend({
'click #cancel': 'cancel'
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
this.template = window.JST.nfs_edit_nfs_export;
this.shares = new ShareCollection();
this.nfsExportGroupId = this.options.nfsExportGroupId;
this.nfsExportGroupId = options.nfsExportGroupId;
if(this.nfsExportGroupId > 0) {
this.nfsExportGroup = new NFSExportGroup({id: this.nfsExportGroupId});
this.nfsExportNotEmpty = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

PoolDetailsLayoutView = RockstorLayoutView.extend({

initialize: function() {
initialize: function(options) {
// call initialize of base
this.constructor.__super__.initialize.apply(this, arguments);
this.poolName = this.options.poolName;
this.cView = this.options.cView;
this.poolName = options.poolName;
this.cView = options.cView;
this.template = window.JST.pool_pool_details_layout;
this.resize_pool_info_template = window.JST.pool_resize_pool_info;
this.compression_info_template = window.JST.pool_compression_info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ PoolRebalanceTableModule = RockstorModuleView.extend({
"click #js-poolrebalance-cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
this.template = window.JST.pool_poolrebalance_table_template;
this.startRebalanceTemplate = window.JST.pool_poolrebalance_start_template;
this.module_name = 'poolrebalances';
this.pool = this.options.pool;
this.poolrebalances = this.options.poolrebalances;
this.collection = this.options.poolrebalances;
this.pool = options.pool;
this.poolrebalances = options.poolrebalances;
this.collection = options.poolrebalances;
this.collection.on("reset", this.render, this);
this.parentView = this.options.parentView;
this.parentView = options.parentView;
this.initHandlebarHelpers();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ PoolScrubTableModule = RockstorModuleView.extend({
"click #js-poolscrub-cancel": "cancel"
},

initialize: function() {
initialize: function(options) {
this.template = window.JST.pool_poolscrub_table_template;
this.startScrubTemplate = window.JST.pool_poolscrub_start_template;
this.module_name = 'poolscrubs';
this.pool = this.options.pool;
this.poolscrubs = this.options.poolscrubs;
this.collection = this.options.poolscrubs;
this.pool = options.pool;
this.poolscrubs = options.poolscrubs;
this.collection = options.poolscrubs;
this.collection.on("reset", this.render, this);
this.parentView = this.options.parentView;
this.parentView = options.parentView;
this.initHandlebarHelpers();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ ReplicaReceiveTrailsView = RockstorLayoutView.extend({
events: {
},

initialize: function() {
initialize: function(options) {
// call initialize of base
this.constructor.__super__.initialize.apply(this, arguments);
// set template
this.template = window.JST.replication_receive_trails;
// add dependencies
this.replicaShareId = this.options.replicaShareId;
this.replicaShareId = options.replicaShareId;
this.replicaShare = new ReplicaShare({id: this.replicaShareId});
this.dependencies.push(this.replicaShare);
this.collection = new ReceiveTrailCollection(null, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ ReplicaTrailsView = RockstorLayoutView.extend({
events: {
},

initialize: function() {
initialize: function(options) {
// call initialize of base
this.constructor.__super__.initialize.apply(this, arguments);
// set template
this.template = window.JST.replication_replica_trails;
// add dependencies
this.replicaId = this.options.replicaId;
this.replicaId = options.replicaId;
this.replica = new Replica({id: this.replicaId});
this.dependencies.push(this.replica);
this.collection = new ReplicaTrailCollection(null, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ RollbackView = RockstorLayoutView.extend({
'click #js-confirm-rollback-submit': 'confirmRollback'
},

initialize: function() {
initialize: function(options) {
this.constructor.__super__.initialize.apply(this, arguments);
// Templates
this.template = window.JST.share_rollback;
this.snapshot_list_template = window.JST.share_rollback_snapshot_list;
// Dependencies
this.share = new Share({shareName: this.options.shareName});
this.share = new Share({shareName: options.shareName});
this.collection = new SnapshotCollection();
this.collection.pageSize = 10;
this.collection.setUrl(this.options.shareName);
this.collection.setUrl(options.shareName);
this.dependencies.push(this.share);
this.dependencies.push(this.collection);
this.collection.on('reset', this.renderSnapshotList, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
SetupSystemView = Backbone.View.extend({
tagName: 'div',

initialize: function() {
initialize: function(options) {
this.template = window.JST.setup_system;
this.sysinfo = this.options.sysinfo;
this.sysinfo = options.sysinfo;
},

render: function() {
Expand Down
Loading

0 comments on commit 4eca949

Please sign in to comment.