diff --git a/scm-webapp/src/main/webapp/index.html b/scm-webapp/src/main/webapp/index.html index 9c432be086..672abb4ddb 100644 --- a/scm-webapp/src/main/webapp/index.html +++ b/scm-webapp/src/main/webapp/index.html @@ -109,7 +109,12 @@ - + + + + + + diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.plugin.js b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.center.js similarity index 66% rename from scm-webapp/src/main/webapp/resources/js/sonia.plugin.js rename to scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.center.js index af1f8e8a68..5045d886a4 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.plugin.js +++ b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.center.js @@ -29,8 +29,6 @@ * */ -// register namespace -Ext.ns("Sonia.plugin"); Sonia.plugin.Center = Ext.extend(Ext.util.Observable, { @@ -181,95 +179,3 @@ Sonia.plugin.Center = Ext.extend(Ext.util.Observable, { } }); - -// the plugin center -Sonia.plugin.CenterInstance = new Sonia.plugin.Center(); - -// plguin store - -Sonia.plugin.Store = Ext.extend(Sonia.rest.JsonStore, { - - constructor: function(config) { - var baseConfig = { - fields: [ 'name', 'author', 'description', 'url', 'version', 'state', 'groupId', 'artifactId' ], - sortInfo: { - field: 'name' - } - }; - Sonia.plugin.Store.superclass.constructor.call(this, Ext.apply(baseConfig, config)); - } - -}); - -// plugin grid - -Sonia.plugin.Grid = Ext.extend(Sonia.rest.Grid, { - - colNameText: 'Name', - colAuthorText: 'Author', - colDescriptionText: 'Description', - colVersionText: 'Version', - colActionText: 'Action', - colUrlText: 'Url', - emptyText: 'No plugins avaiable', - - actionLinkTemplate: '{0}', - - initComponent: function(){ - - var pluginColModel = new Ext.grid.ColumnModel({ - defaults: { - sortable: true, - scope: this, - width: 125 - }, - columns: [ - {id: 'name', header: this.colNameText, dataIndex: 'name'}, - {id: 'author', header: this.colAuthorText, dataIndex: 'author'}, - {id: 'description', header: this.colDescriptionText, dataIndex: 'description'}, - {id: 'version', header: this.colVersionText, dataIndex: 'version'}, - {id: 'action', header: this.colActionText, renderer: this.renderActionColumn}, - {id: 'Url', header: this.colUrlText, dataIndex: 'url', renderer: this.renderUrl, width: 150} - ] - }); - - var config = { - autoExpandColumn: 'description', - store: new Sonia.plugin.Store({ - url: restUrl + 'plugins/overview.json' - }), - colModel: pluginColModel, - emptyText: this.emptyText - }; - - Sonia.plugin.CenterInstance.addListener('changed', function(){ - if (debug){ - console.debug( 'receive change event, reload plugin store' ); - } - this.getStore().reload(); - }, this); - - Ext.apply(this, Ext.apply(this.initialConfig, config)); - Sonia.plugin.Grid.superclass.initComponent.apply(this, arguments); - }, - - renderActionColumn: function(val, meta, record){ - var out = ""; - var data = record.data; - var id = Sonia.plugin.CenterInstance.getPluginId(data); - if ( data.state == 'AVAILABLE' ){ - out = String.format(this.actionLinkTemplate, 'Install', 'install', id); - } else if ( data.state == 'INSTALLED' ){ - out = String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id); - } else if ( data.state == 'UPDATE_AVAILABLE' ){ - out = String.format(this.actionLinkTemplate, 'Update', 'update', id); - out += ', ' - out += String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id); - } - return out; - } - -}); - -// register xtype -Ext.reg('pluginGrid', Sonia.plugin.Grid); diff --git a/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.grid.js b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.grid.js new file mode 100644 index 0000000000..02cfc58c26 --- /dev/null +++ b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.grid.js @@ -0,0 +1,107 @@ +/* * + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + +// the plugin center +Sonia.plugin.CenterInstance = new Sonia.plugin.Center(); + + +// plugin grid +Sonia.plugin.Grid = Ext.extend(Sonia.rest.Grid, { + + colNameText: 'Name', + colAuthorText: 'Author', + colDescriptionText: 'Description', + colVersionText: 'Version', + colActionText: 'Action', + colUrlText: 'Url', + emptyText: 'No plugins avaiable', + + actionLinkTemplate: '{0}', + + initComponent: function(){ + + var pluginColModel = new Ext.grid.ColumnModel({ + defaults: { + sortable: true, + scope: this, + width: 125 + }, + columns: [ + {id: 'name', header: this.colNameText, dataIndex: 'name'}, + {id: 'author', header: this.colAuthorText, dataIndex: 'author'}, + {id: 'description', header: this.colDescriptionText, dataIndex: 'description'}, + {id: 'version', header: this.colVersionText, dataIndex: 'version'}, + {id: 'action', header: this.colActionText, renderer: this.renderActionColumn}, + {id: 'Url', header: this.colUrlText, dataIndex: 'url', renderer: this.renderUrl, width: 150} + ] + }); + + var config = { + autoExpandColumn: 'description', + store: new Sonia.plugin.Store({ + url: restUrl + 'plugins/overview.json' + }), + colModel: pluginColModel, + emptyText: this.emptyText + }; + + Sonia.plugin.CenterInstance.addListener('changed', function(){ + if (debug){ + console.debug( 'receive change event, reload plugin store' ); + } + this.getStore().reload(); + }, this); + + Ext.apply(this, Ext.apply(this.initialConfig, config)); + Sonia.plugin.Grid.superclass.initComponent.apply(this, arguments); + }, + + renderActionColumn: function(val, meta, record){ + var out = ""; + var data = record.data; + var id = Sonia.plugin.CenterInstance.getPluginId(data); + if ( data.state == 'AVAILABLE' ){ + out = String.format(this.actionLinkTemplate, 'Install', 'install', id); + } else if ( data.state == 'INSTALLED' ){ + out = String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id); + } else if ( data.state == 'UPDATE_AVAILABLE' ){ + out = String.format(this.actionLinkTemplate, 'Update', 'update', id); + out += ', ' + out += String.format(this.actionLinkTemplate, 'Uninstall', 'uninstall', id); + } + return out; + } + +}); + +// register xtype +Ext.reg('pluginGrid', Sonia.plugin.Grid); diff --git a/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.js b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.js new file mode 100644 index 0000000000..84f29c702f --- /dev/null +++ b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.js @@ -0,0 +1,33 @@ +/* * + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + +// register namespace +Ext.ns("Sonia.plugin"); diff --git a/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.store.js b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.store.js new file mode 100644 index 0000000000..0ce69a4c89 --- /dev/null +++ b/scm-webapp/src/main/webapp/resources/js/plugin/sonia.plugin.store.js @@ -0,0 +1,45 @@ +/* * + * Copyright (c) 2010, Sebastian Sdorra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of SCM-Manager; nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * http://bitbucket.org/sdorra/scm-manager + * + */ + + +Sonia.plugin.Store = Ext.extend(Sonia.rest.JsonStore, { + + constructor: function(config) { + var baseConfig = { + fields: [ 'name', 'author', 'description', 'url', 'version', 'state', 'groupId', 'artifactId' ], + sortInfo: { + field: 'name' + } + }; + Sonia.plugin.Store.superclass.constructor.call(this, Ext.apply(baseConfig, config)); + } + +});