Skip to content

Commit

Permalink
fix user space calculation for truncate/drop buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Apr 25, 2017
1 parent c01d3f7 commit 40d486f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions public/admin/js/Database/Spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ Ext.define('Admin.Database.Spaces', {
title: 'Spaces',
iconCls: 'fa fa-bars',

isUserSpace(record) {
return record.get('id') >= 512
},

refreshSpaces: function() {
dispatch('database.spaces', this.up('database-tab').params)
.then(result => {
this.store.loadData(result.spaces);
this.store.clearFilter();
if(!this.down('[name=system-spaces]').value) {
this.store.filterBy(r => r.get('id') >= 512);
this.store.filterBy(this.isUserSpace)
}
});
},
Expand Down Expand Up @@ -126,8 +130,8 @@ Ext.define('Admin.Database.Spaces', {
},
selectionchange(sm, sel) {
this.down('[name=open-button]').setDisabled(!sel.length);
this.down('[name=drop-button]').setDisabled(!sel.length || sel[0].get('owner'));
this.down('[name=truncate-button]').setDisabled(!sel.length || sel[0].get('owner'));
this.down('[name=drop-button]').setDisabled(!sel.length || !this.isUserSpace(sel[0]));
this.down('[name=truncate-button]').setDisabled(!sel.length || !this.isUserSpace(sel[0]));
}
},

Expand Down

0 comments on commit 40d486f

Please sign in to comment.