2016-03-08 13:22:42 +03:00
Ext . define ( 'PVE.storage.TPoolSelector' , {
extend : 'Ext.form.field.ComboBox' ,
alias : 'widget.pveTPSelector' ,
queryParam : 'vg' ,
2016-03-10 13:46:56 +03:00
valueField : 'lv' ,
displayField : 'lv' ,
editable : false ,
2016-03-08 13:22:42 +03:00
doRawQuery : function ( ) {
2021-05-18 15:12:15 +03:00
// nothing
2016-03-08 13:22:42 +03:00
} ,
onTriggerClick : function ( ) {
var me = this ;
if ( ! me . queryCaching || me . lastQuery !== me . vg ) {
me . store . removeAll ( ) ;
}
me . allQuery = me . vg ;
me . callParent ( ) ;
} ,
setVG : function ( myvg ) {
var me = this ;
me . vg = myvg ;
} ,
2021-01-19 19:39:15 +03:00
initComponent : function ( ) {
2016-03-08 13:22:42 +03:00
var me = this ;
if ( ! me . nodename ) {
me . nodename = 'localhost' ;
}
var store = Ext . create ( 'Ext.data.Store' , {
2021-01-19 19:39:15 +03:00
fields : [ 'lv' ] ,
2016-03-08 13:22:42 +03:00
proxy : {
2017-12-11 16:46:51 +03:00
type : 'proxmox' ,
2021-01-19 19:31:03 +03:00
url : '/api2/json/nodes/' + me . nodename + '/scan/lvmthin' ,
} ,
2016-03-08 13:22:42 +03:00
} ) ;
2016-10-05 15:27:56 +03:00
store . sort ( 'lv' , 'ASC' ) ;
2016-03-08 13:22:42 +03:00
Ext . apply ( me , {
store : store ,
listConfig : {
2021-01-19 19:31:03 +03:00
loadingText : gettext ( 'Scanning...' ) ,
} ,
2016-03-08 13:22:42 +03:00
} ) ;
me . callParent ( ) ;
2021-01-19 19:31:03 +03:00
} ,
2016-03-08 13:22:42 +03:00
} ) ;
Ext . define ( 'PVE.storage.BaseVGSelector' , {
extend : 'Ext.form.field.ComboBox' ,
alias : 'widget.pveBaseVGSelector' ,
2016-03-10 13:46:56 +03:00
valueField : 'vg' ,
displayField : 'vg' ,
queryMode : 'local' ,
editable : false ,
2021-01-19 19:39:15 +03:00
initComponent : function ( ) {
2016-03-08 13:22:42 +03:00
var me = this ;
if ( ! me . nodename ) {
me . nodename = 'localhost' ;
}
var store = Ext . create ( 'Ext.data.Store' , {
autoLoad : { } ,
2021-01-19 19:39:15 +03:00
fields : [ 'vg' , 'size' , 'free' ] ,
2016-03-08 13:22:42 +03:00
proxy : {
2017-12-11 16:46:51 +03:00
type : 'proxmox' ,
2021-01-19 19:31:03 +03:00
url : '/api2/json/nodes/' + me . nodename + '/scan/lvm' ,
} ,
2016-03-08 13:22:42 +03:00
} ) ;
Ext . apply ( me , {
store : store ,
listConfig : {
2021-01-19 19:31:03 +03:00
loadingText : gettext ( 'Scanning...' ) ,
} ,
2016-03-08 13:22:42 +03:00
} ) ;
me . callParent ( ) ;
2021-01-19 19:31:03 +03:00
} ,
2016-03-08 13:22:42 +03:00
} ) ;
Ext . define ( 'PVE.storage.LvmThinInputPanel' , {
2018-03-27 15:19:46 +03:00
extend : 'PVE.panel.StorageBase' ,
2016-03-08 13:22:42 +03:00
2018-12-07 13:33:41 +03:00
onlineHelp : 'storage_lvmthin' ,
2021-01-19 19:39:15 +03:00
initComponent : function ( ) {
2016-03-08 13:22:42 +03:00
var me = this ;
2018-03-27 15:19:46 +03:00
me . column1 = [ ] ;
2016-03-08 13:22:42 +03:00
2017-02-28 16:26:49 +03:00
var vgnameField = Ext . createWidget ( me . isCreate ? 'textfield' : 'displayfield' , {
2016-03-08 13:22:42 +03:00
name : 'vgname' ,
2017-02-28 16:26:49 +03:00
hidden : ! ! me . isCreate ,
disabled : ! ! me . isCreate ,
2016-03-08 13:22:42 +03:00
value : '' ,
fieldLabel : gettext ( 'Volume group' ) ,
2021-01-19 19:31:03 +03:00
allowBlank : false ,
2016-03-08 13:22:42 +03:00
} ) ;
2017-02-28 16:26:49 +03:00
var thinpoolField = Ext . createWidget ( me . isCreate ? 'textfield' : 'displayfield' , {
2016-03-08 13:22:42 +03:00
name : 'thinpool' ,
2017-02-28 16:26:49 +03:00
hidden : ! ! me . isCreate ,
disabled : ! ! me . isCreate ,
2016-03-08 13:22:42 +03:00
value : '' ,
fieldLabel : gettext ( 'Thin Pool' ) ,
2021-01-19 19:31:03 +03:00
allowBlank : false ,
2016-03-08 13:22:42 +03:00
} ) ;
2017-02-28 16:26:49 +03:00
if ( me . isCreate ) {
2016-03-08 13:22:42 +03:00
var vgField = Ext . create ( 'PVE.storage.TPoolSelector' , {
name : 'thinpool' ,
fieldLabel : gettext ( 'Thin Pool' ) ,
2021-01-19 19:31:03 +03:00
allowBlank : false ,
2016-03-08 13:22:42 +03:00
} ) ;
me . column1 . push ( {
xtype : 'pveBaseVGSelector' ,
name : 'vgname' ,
2016-04-04 17:59:52 +03:00
fieldLabel : gettext ( 'Volume group' ) ,
2016-03-08 13:22:42 +03:00
listeners : {
change : function ( f , value ) {
2017-02-28 16:26:49 +03:00
if ( me . isCreate ) {
2016-03-08 13:22:42 +03:00
vgField . setVG ( value ) ;
vgField . setValue ( '' ) ;
}
2021-01-19 19:31:03 +03:00
} ,
} ,
2016-03-08 13:22:42 +03:00
} ) ;
me . column1 . push ( vgField ) ;
}
me . column1 . push ( vgnameField ) ;
me . column1 . push ( thinpoolField ) ;
2016-04-29 13:06:27 +03:00
// here value is an array,
// while before it was a string
2016-03-08 13:22:42 +03:00
me . column1 . push ( {
xtype : 'pveContentTypeSelector' ,
cts : [ 'images' , 'rootdir' ] ,
fieldLabel : gettext ( 'Content' ) ,
name : 'content' ,
value : [ 'images' , 'rootdir' ] ,
multiSelect : true ,
2021-01-19 19:31:03 +03:00
allowBlank : false ,
2016-03-08 13:22:42 +03:00
} ) ;
2018-03-27 15:19:46 +03:00
me . column2 = [ ] ;
2016-03-08 13:22:42 +03:00
me . callParent ( ) ;
2021-01-19 19:31:03 +03:00
} ,
2016-03-08 13:22:42 +03:00
} ) ;