mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-22 07:22:15 +01:00
show imported repositories and fix small selection bug
This commit is contained in:
@@ -35,7 +35,7 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{
|
||||
// TODO i18n
|
||||
titleText: 'Import Repositories',
|
||||
okText: 'Ok',
|
||||
cancelText: 'Cancel',
|
||||
closeText: 'Close',
|
||||
|
||||
// cache
|
||||
importForm: null,
|
||||
@@ -68,7 +68,7 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{
|
||||
scope: this,
|
||||
handler: this.importRepositories
|
||||
},{
|
||||
text: this.cancelText,
|
||||
text: this.closeText,
|
||||
scope: this,
|
||||
handler: this.close
|
||||
}],
|
||||
@@ -136,7 +136,15 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{
|
||||
}
|
||||
var form = this.getImportForm().getForm();
|
||||
var values = form.getValues().type;
|
||||
this.importJobs = values.length;
|
||||
if ( values ){
|
||||
if ( Ext.isArray(values) ){
|
||||
this.importJobs = values.length;
|
||||
} else {
|
||||
this.importJobs = 1;
|
||||
}
|
||||
} else {
|
||||
this.importJobs = 0;
|
||||
}
|
||||
Ext.each(values, function(value){
|
||||
this.importRepositoriesOfType(value);
|
||||
}, this);
|
||||
@@ -151,14 +159,47 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{
|
||||
if (debug){
|
||||
console.debug( 'import of ' + this.importJobsFinished + ' jobs finished' );
|
||||
}
|
||||
// print repositories
|
||||
this.printImported();
|
||||
}
|
||||
},
|
||||
|
||||
printImported: function(){
|
||||
var store = new Ext.data.JsonStore({
|
||||
fields: ['type', 'name']
|
||||
});
|
||||
store.loadData(this.imported);
|
||||
|
||||
var colModel = new Ext.grid.ColumnModel({
|
||||
defaults: {
|
||||
sortable: true,
|
||||
scope: this
|
||||
},
|
||||
columns: [
|
||||
{id: 'name', header: 'Name', dataIndex: 'name'},
|
||||
{id: 'type', header: 'Type', dataIndex: 'type'}
|
||||
]
|
||||
});
|
||||
|
||||
this.getImportForm().add({
|
||||
xtype: 'grid',
|
||||
autoExpandColumn: 'name',
|
||||
store: store,
|
||||
colModel: colModel,
|
||||
height: 100
|
||||
});
|
||||
var h = this.getHeight();
|
||||
this.setHeight( h + 100 );
|
||||
this.doLayout();
|
||||
},
|
||||
|
||||
importRepositoriesOfType: function(type){
|
||||
if (debug){
|
||||
console.debug('start import of ' + type + ' repositories');
|
||||
}
|
||||
var b = Ext.getCmp('startRepositoryImportButton');
|
||||
if ( b ){
|
||||
b.setDisabled(true);
|
||||
}
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'import/repositories/' + type + '.json',
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user