From d8f274f444febce7b5addc1aade075d2d3b5b6fc Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 16 Jan 2012 16:42:12 +0100 Subject: [PATCH] show imported repositories and fix small selection bug --- .../sonia.repository.importwindow.js | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js index 50354becfd..a9fa010acf 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.importwindow.js @@ -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',