From 6c127c1ce12994ab4a235c53c254cf776e347e69 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 5 Dec 2012 17:39:11 -0500 Subject: [PATCH] Improving first-run setup of GCA and Gitblit GO --- .../gitblit/authority/GitblitAuthority.java | 34 ++++++++++++++----- .../gitblit/wicket/GitBlitWebApp.properties | 5 ++- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/com/gitblit/authority/GitblitAuthority.java b/src/com/gitblit/authority/GitblitAuthority.java index 59cd22e3..909831fe 100644 --- a/src/com/gitblit/authority/GitblitAuthority.java +++ b/src/com/gitblit/authority/GitblitAuthority.java @@ -21,6 +21,7 @@ import java.awt.Desktop; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; +import java.awt.GridLayout; import java.awt.Insets; import java.awt.Point; import java.awt.event.ActionEvent; @@ -69,6 +70,7 @@ import javax.swing.JSplitPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; +import javax.swing.JToolBar; import javax.swing.RowFilter; import javax.swing.SwingConstants; import javax.swing.UIManager; @@ -565,15 +567,26 @@ public class GitblitAuthority extends JFrame implements X509Log { } }; - JTextField durationTF = new JTextField(4); - durationTF.setInputVerifier(verifier); - durationTF.setVerifyInputWhenFocusTarget(true); - durationTF.setText("" + certificateConfig.duration); - JPanel durationPanel = Utils.newFieldPanel(Translation.get("gb.duration"), durationTF, Translation.get("gb.duration.days").replace("{0}", "").trim()); + JTextField siteNameTF = new JTextField(20); + siteNameTF.setText(gitblitSettings.getString(Keys.web.siteName, "Gitblit")); + JPanel siteNamePanel = Utils.newFieldPanel(Translation.get("gb.siteName"), + siteNameTF, Translation.get("gb.siteNameDescription")); + + JTextField validityTF = new JTextField(4); + validityTF.setInputVerifier(verifier); + validityTF.setVerifyInputWhenFocusTarget(true); + validityTF.setText("" + certificateConfig.duration); + JPanel validityPanel = Utils.newFieldPanel(Translation.get("gb.validity"), + validityTF, Translation.get("gb.duration.days").replace("{0}", "").trim()); + + JPanel p1 = new JPanel(new GridLayout(0, 1, 5, 2)); + p1.add(siteNamePanel); + p1.add(validityPanel); + DefaultOidsPanel oids = new DefaultOidsPanel(metadata); JPanel panel = new JPanel(new BorderLayout()); - panel.add(durationPanel, BorderLayout.NORTH); + panel.add(p1, BorderLayout.NORTH); panel.add(oids, BorderLayout.CENTER); int result = JOptionPane.showConfirmDialog(GitblitAuthority.this, @@ -582,9 +595,13 @@ public class GitblitAuthority extends JFrame implements X509Log { if (result == JOptionPane.OK_OPTION) { try { oids.update(metadata); - certificateConfig.duration = Integer.parseInt(durationTF.getText()); + certificateConfig.duration = Integer.parseInt(validityTF.getText()); certificateConfig.store(config, metadata); config.save(); + + Map updates = new HashMap(); + updates.put(Keys.web.siteName, siteNameTF.getText()); + gitblitSettings.saveSettings(updates); } catch (Exception e1) { Utils.showException(GitblitAuthority.this, e1); } @@ -728,7 +745,8 @@ public class GitblitAuthority extends JFrame implements X509Log { } }); - JPanel buttonControls = new JPanel(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, Utils.MARGIN)); + JToolBar buttonControls = new JToolBar(JToolBar.HORIZONTAL); + buttonControls.setFloatable(false); buttonControls.add(certificateDefaultsButton); buttonControls.add(newSSLCertificate); buttonControls.add(emailBundle); diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties index 4f4d60e0..5b42a2c0 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp.properties @@ -436,4 +436,7 @@ gb.maxActivityCommitsDescription = maximum number of commits to contribute to th gb.noMaximum = no maximum gb.attributes = attributes gb.serveCertificate = serve https with this certificate -gb.sslCertificateGeneratedRestart = Successfully generated new server SSL certificate for {0}.\nYou must restart Gitblit to use the new certificate.\n\nIf you are launching with the '--alias' parameter you will have to set that to ''--alias {0}''. \ No newline at end of file +gb.sslCertificateGeneratedRestart = Successfully generated new server SSL certificate for {0}.\nYou must restart Gitblit to use the new certificate.\n\nIf you are launching with the '--alias' parameter you will have to set that to ''--alias {0}''. +gb.validity = validity +gb.siteName = site name +gb.siteNameDescription = short, descriptive name of your server \ No newline at end of file -- 2.39.5