ui: tape/TapeRestore: improve SnapshotGrid
* handle not rendered call of getErrors * return 'all' as value if all snaphots where selected (for better distinction) * remove the default height * add checkChange on stores filterChange (now change also fires on the gridfilter plugin change) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
		
				
					committed by
					
						
						Thomas Lamprecht
					
				
			
			
				
	
			
			
			
						parent
						
							5e989333cd
						
					
				
				
					commit
					e01ca6a2dd
				
			@ -336,6 +336,13 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
 | 
			
		||||
	    }
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// getSource returns null if data is not filtered
 | 
			
		||||
	let originalData = me.store.getData().getSource() || me.store.getData();
 | 
			
		||||
 | 
			
		||||
	if (snapshots.length === originalData.length) {
 | 
			
		||||
	    return "all";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return snapshots;
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@ -347,20 +354,25 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
 | 
			
		||||
 | 
			
		||||
    getErrors: function(value) {
 | 
			
		||||
	let me = this;
 | 
			
		||||
	if (me.getSelection() < 1) {
 | 
			
		||||
	if (me.getSelection().length < 1) {
 | 
			
		||||
	    me.addCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']);
 | 
			
		||||
	    let errorMsg = gettext("Need at least one snapshot");
 | 
			
		||||
	    me.getActionEl().dom.setAttribute('data-errorqtip', errorMsg);
 | 
			
		||||
	    let el = me.getActionEl();
 | 
			
		||||
	    if (el) {
 | 
			
		||||
		el.dom.setAttribute('data-errorqtip', errorMsg);
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    return [errorMsg];
 | 
			
		||||
	}
 | 
			
		||||
	me.removeCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']);
 | 
			
		||||
	me.getActionEl().dom.setAttribute('data-errorqtip', "");
 | 
			
		||||
	let el = me.getActionEl();
 | 
			
		||||
	if (el) {
 | 
			
		||||
	    el.dom.setAttribute('data-errorqtip', "");
 | 
			
		||||
	}
 | 
			
		||||
	return [];
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    scrollable: true,
 | 
			
		||||
    height: 350,
 | 
			
		||||
    plugins: 'gridfilters',
 | 
			
		||||
 | 
			
		||||
    viewConfig: {
 | 
			
		||||
@ -424,5 +436,7 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', {
 | 
			
		||||
		},
 | 
			
		||||
	    );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	me.mon(me.store, 'filterchange', () => me.checkChange());
 | 
			
		||||
    },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user