Skip to content

Commit

Permalink
Update handling of Backbone view options
Browse files Browse the repository at this point in the history
Newer versions of Backbone no longer implicitly attach these
to the view, so the relevant initialize functions now do so
explicitly.
  • Loading branch information
sfranzen committed Oct 18, 2016
1 parent 055221b commit bf3756b
Show file tree
Hide file tree
Showing 28 changed files with 322 additions and 292 deletions.
535 changes: 269 additions & 266 deletions src/rockstor/storageadmin/static/storageadmin/js/rockstor.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf3756b

Please sign in to comment.