Commits

Sebastian Sdorra committed 226817c

added plugin config api

Comments (0)

Files changed (5)

plugins/scm-hg-plugin/src/main/resources/sonia/scm/hg.config.js

  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
+repositoryConfigPanels.push({
+  style: 'margin: 10px',
+  trackResetOnLoad : true,
+  autoScroll : true,
+  border : false,
+  frame : false,
+  collapsible : false,
+  collapsed : false,
+  layoutConfig : {
+    labelSeparator : ''
+  },
+  items : [{
+    xtype : 'fieldset',
+    checkboxToggle : false,
+    title : 'Mercurial Settings',
+    collapsible : true,
+    autoHeight : true,
+    labelWidth : 140,
+    buttonAlign: 'left',
+    layoutConfig : {
+      labelSeparator : ''
+    },
+    items : [{
+      xtype : 'textfield',
+      fieldLabel : 'HG Binary',
+      name : 'hgBinary',
+      allowBlank : false
+    },{
+      xtype: 'textfield',
+      name: 'hgRepoDirectroy',
+      fieldLabel: 'Repository directory',
+      allowBlank : false
+    },{
+      xtype: 'textfield',
+      name: 'hgBaseUrl',
+      fieldLabel: 'Base URL',
+      allowBlank : false
+    }],
+    buttons: [{
+      text: 'Save'
+    },{
+      text: 'Cancel'
+    }]
+  }]
 
-
+});

scm-webapp/src/main/webapp/index.html

     <script type="text/javascript" src="resources/js/sonia.login.js"></script>
     <script type="text/javascript" src="resources/js/sonia.group.js"></script>
     <script type="text/javascript" src="resources/js/sonia.repository.js"></script>
+    <script type="text/javascript" src="resources/js/sonia.config.js"></script>
     <script type="text/javascript" src="resources/js/layout.js"></script>
     <script type="text/javascript" src="plugins/sonia.plugin.js"></script>
 

scm-webapp/src/main/webapp/resources/js/global.js

 
 var debug = true;
 var state = null;
+
+// functions called after login
 var authCallbacks = [];
 
+// config form panels
+var repositoryConfigPanels = [];
+
 var repositoryTypeStore = new Ext.data.JsonStore({
   id: 1,
   fields: [ 'displayName', 'name' ]
       callback(state);
     }
   });
-}
+}

scm-webapp/src/main/webapp/resources/js/layout.js

     tabPanel
   ]});
 
-  function addGroupPanel(){
+  function addTabPanel(id, xtype, title){
     tabPanel.add({
-      id: 't_group',
-      xtype: 'groupGrid',
-      title: 'Groups',
+      id: id,
+      xtype: xtype,
+      title: title,
       closable: true,
       autoScroll: true
     });
-    tabPanel.setActiveTab('t_group');
+    tabPanel.setActiveTab(id);
+  }
+
+  function addGroupPanel(){
+    addTabPanel('t_group', 'groupGrid', 'Groups');
   }
 
   function addRepositoryPanel(){
-    tabPanel.add({
-      id: 't_repository',
-      xtype: 'repositoryGrid',
-      title: 'Repositories',
-      closable: true,
-      autoScroll: true
-    });
-    tabPanel.setActiveTab('t_repository');
+    addTabPanel('t_repository', 'repositoryGrid', 'Repositories');
+  }
+
+  function addConfigPanel(){
+    addTabPanel('t_config', 'configPanel', 'Repository Config');
   }
 
   function createMainMenu(){
         fn: function(){ console.debug( 'General Config' ); }
       },{
         label: 'Repository Types',
-        fn: function(){ console.debug( 'Repository Type Config' ); }
+        fn: addConfigPanel
       },{
         label: 'Server',
         fn: function(){ console.debug( 'Server Config' ); }

scm-webapp/src/main/webapp/resources/js/sonia.config.js

+/* 
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+Ext.ns("Sonia.config");
+
+Sonia.config.ConfigPanel = Ext.extend(Ext.Panel, {
+
+  initComponent: function(){
+
+    var config = {
+      region: 'center',
+      bodyCssClass: 'x-panel-mc',
+      trackResetOnLoad: true,
+      autoScroll: true,
+      border: false,
+      frame: false,
+      collapsible: false,
+      collapsed: false,
+      items: repositoryConfigPanels
+    }
+
+    Ext.apply(this, Ext.apply(this.initialConfig, config));
+    Sonia.config.ConfigPanel.superclass.initComponent.apply(this, arguments);
+  }
+
+});
+
+Ext.reg("configPanel", Sonia.config.ConfigPanel);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.