]> source.dussan.org Git - gitblit.git/commitdiff
Per-repository setting to skip summary metrics
authorJames Moger <james.moger@gitblit.com>
Sun, 23 Oct 2011 16:28:48 +0000 (12:28 -0400)
committerJames Moger <james.moger@gitblit.com>
Sun, 23 Oct 2011 16:28:48 +0000 (12:28 -0400)
docs/00_index.mkd
docs/04_releases.mkd
src/com/gitblit/GitBlit.java
src/com/gitblit/client/EditRepositoryDialog.java
src/com/gitblit/client/RepositoriesTableModel.java
src/com/gitblit/models/RepositoryModel.java
src/com/gitblit/wicket/GitBlitWebApp.properties
src/com/gitblit/wicket/pages/EditRepositoryPage.html
src/com/gitblit/wicket/pages/EditRepositoryPage.java
src/com/gitblit/wicket/pages/SummaryPage.java

index f34fd559827105407b00b64a59824c162ea5eba3..8627269097a7a831ed87d68192a9f8374b08a007 100644 (file)
@@ -38,6 +38,8 @@ Gitblit requires a Java 6 Runtime Environment (JRE) or a Java 6 Development Kit
     **New:** *web.enableRpcAdministration = false*\r
 - added: reusable JSON RPC client class\r
 - added: Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server.\r
+- added: per-repository setting to skip size calculation (faster repositories page loading)\r
+- added: per-repository setting to skip summary metrics calculation (faster summary page loading)\r
 - fixed: federation protocol timestamps.  dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard.  \r
     **This breaks 0.6.0 federation clients/servers.**\r
 - fixed: collision on rename for repositories and users\r
index 4b538ba9a1aee48e47a601a0c9c678ab4a235696..e844322bbe412a66ecf812a3456679b6e60c0bb2 100644 (file)
@@ -12,6 +12,8 @@
     **New:** *web.enableRpcAdministration = false*\r
 - added: reusable JSON RPC client class\r
 - added: Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server.\r
+- added: per-repository setting to skip size calculation (faster repositories page loading)\r
+- added: per-repository setting to skip summary metrics calculation (faster summary page loading)\r
 - fixed: federation protocol timestamps.  dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard.  \r
     **This breaks 0.6.0 federation clients/servers.**\r
 - fixed: collision on rename for repositories and users\r
index 49f93e4e99753d49ffde8fce7f501e1e511e6f6a..ffef94a7d4a8706b3f431f29b3a75855b4c1bcb4 100644 (file)
@@ -594,6 +594,7 @@ public class GitBlit implements ServletContextListener {
                        model.isFrozen = getConfig(config, "isFrozen", false);\r
                        model.showReadme = getConfig(config, "showReadme", false);\r
                        model.skipSizeCalculation = getConfig(config, "skipSizeCalculation", false);\r
+                       model.skipSummaryMetrics = getConfig(config, "skipSummaryMetrics", false);\r
                        model.federationStrategy = FederationStrategy.fromName(getConfig(config,\r
                                        "federationStrategy", null));\r
                        model.federationSets = new ArrayList<String>(Arrays.asList(config.getStringList(\r
@@ -814,6 +815,7 @@ public class GitBlit implements ServletContextListener {
                config.setBoolean("gitblit", null, "isFrozen", repository.isFrozen);\r
                config.setBoolean("gitblit", null, "showReadme", repository.showReadme);\r
                config.setBoolean("gitblit", null, "skipSizeCalculation", repository.skipSizeCalculation);\r
+               config.setBoolean("gitblit", null, "skipSummaryMetrics", repository.skipSummaryMetrics);\r
                config.setStringList("gitblit", null, "federationSets", repository.federationSets);\r
                config.setString("gitblit", null, "federationStrategy",\r
                                repository.federationStrategy.name());\r
index c2d8f67212d0a81a80c3e12248d885bf7c0b027a..55f5268e1facfeac46caa06d92a1777b8056e984 100644 (file)
@@ -85,6 +85,8 @@ public class EditRepositoryDialog extends JDialog {
 \r
        private JCheckBox skipSizeCalculation;\r
 \r
+       private JCheckBox skipSummaryMetrics;\r
+\r
        private JCheckBox isFrozen;\r
 \r
        private JComboBox accessRestriction;\r
@@ -150,6 +152,8 @@ public class EditRepositoryDialog extends JDialog {
                                anRepository.showReadme);\r
                skipSizeCalculation = new JCheckBox(Translation.get("gb.skipSizeCalculationDescription"),\r
                                anRepository.skipSizeCalculation);\r
+               skipSummaryMetrics = new JCheckBox(Translation.get("gb.skipSummaryMetricsDescription"),\r
+                               anRepository.skipSummaryMetrics);\r
                isFrozen = new JCheckBox(Translation.get("gb.isFrozenDescription"), anRepository.isFrozen);\r
 \r
                accessRestriction = new JComboBox(AccessRestrictionType.values());\r
@@ -180,6 +184,8 @@ public class EditRepositoryDialog extends JDialog {
                fieldsPanel.add(newFieldPanel(Translation.get("gb.showReadme"), showReadme));\r
                fieldsPanel.add(newFieldPanel(Translation.get("gb.skipSizeCalculation"),\r
                                skipSizeCalculation));\r
+               fieldsPanel\r
+                               .add(newFieldPanel(Translation.get("gb.skipSummaryMetrics"), skipSummaryMetrics));\r
                fieldsPanel.add(newFieldPanel(Translation.get("gb.isFrozen"), isFrozen));\r
 \r
                usersPalette = new JPalette<String>();\r
@@ -327,6 +333,7 @@ public class EditRepositoryDialog extends JDialog {
                repository.showRemoteBranches = showRemoteBranches.isSelected();\r
                repository.showReadme = showReadme.isSelected();\r
                repository.skipSizeCalculation = skipSizeCalculation.isSelected();\r
+               repository.skipSummaryMetrics = skipSummaryMetrics.isSelected();\r
                repository.isFrozen = isFrozen.isSelected();\r
 \r
                repository.accessRestriction = (AccessRestrictionType) accessRestriction.getSelectedItem();\r
index 9dd1a998425af2d021537691ef5ab5782483c49a..c3eaf6e5739584a8de3287f51ef48f403fb7e091 100644 (file)
@@ -117,7 +117,10 @@ public class RepositoriesTableModel extends AbstractTableModel {
                case Last_Change:\r
                        return model.lastChange;\r
                case Size:\r
-                       return model.size;\r
+                       if (model.hasCommits) {\r
+                               return model.size;\r
+                       }\r
+                       return "(empty)";\r
                }\r
                return null;\r
        }\r
index 6909f1a4f0d3baf79e702010c721e34e968ba603..9a774fbd2d04d531a0b780dedf30590a2170f6af 100644 (file)
@@ -51,6 +51,7 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel
        public List<String> federationSets;\r
        public boolean isFederated;\r
        public boolean skipSizeCalculation;\r
+       public boolean skipSummaryMetrics;\r
        public String frequency;\r
        public String origin;\r
        public String size;\r
index 6d713e3fadaa9ac0f357fe76cd08962ee6a1dce3..ae6f6cfa40d7d27479ae3dc6b2b8f46e5fa38843 100644 (file)
@@ -160,4 +160,6 @@ gb.settings = settings
 gb.manage = manage\r
 gb.lastLogin = last login\r
 gb.skipSizeCalculation = skip size calculation\r
-gb.skipSizeCalculationDescription = do not calculate the repository size
\ No newline at end of file
+gb.skipSizeCalculationDescription = do not calculate the repository size (reduces page load time)\r
+gb.skipSummaryMetrics = skip summary metrics\r
+gb.skipSummaryMetricsDescription = do not calculate metrics on the summary page (reduces page load time)
\ No newline at end of file
index cb2168706bbdfc4446d61c5523346612771ef705..27a5448bd42c75ce83511a270ec80a27a70bb6b4 100644 (file)
                                <tr><th><wicket:message key="gb.showRemoteBranches"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="showRemoteBranches" tabindex="7" /> &nbsp;<i><wicket:message key="gb.showRemoteBranchesDescription"></wicket:message></i></td></tr>\r
                                <tr><th><wicket:message key="gb.showReadme"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="showReadme" tabindex="8" /> &nbsp;<i><wicket:message key="gb.showReadmeDescription"></wicket:message></i></td></tr>\r
                                <tr><th><wicket:message key="gb.skipSizeCalculation"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="skipSizeCalculation" tabindex="9" /> &nbsp;<i><wicket:message key="gb.skipSizeCalculationDescription"></wicket:message></i></td></tr>\r
-                               <tr><th><wicket:message key="gb.isFrozen"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="isFrozen" tabindex="10" /> &nbsp;<i><wicket:message key="gb.isFrozenDescription"></wicket:message></i></td></tr>\r
+                               <tr><th><wicket:message key="gb.skipSummaryMetrics"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="skipSummaryMetrics" tabindex="10" /> &nbsp;<i><wicket:message key="gb.skipSummaryMetricsDescription"></wicket:message></i></td></tr>\r
+                               <tr><th><wicket:message key="gb.isFrozen"></wicket:message></th><td class="edit"><input type="checkbox" wicket:id="isFrozen" tabindex="11" /> &nbsp;<i><wicket:message key="gb.isFrozenDescription"></wicket:message></i></td></tr>\r
                                <tr><td colspan="2"><hr></hr></td></tr>\r
-                               <tr><th><wicket:message key="gb.accessRestriction"></wicket:message></th><td class="edit"><select class="span6" wicket:id="accessRestriction" tabindex="11" /></td></tr>                                \r
+                               <tr><th><wicket:message key="gb.accessRestriction"></wicket:message></th><td class="edit"><select class="span6" wicket:id="accessRestriction" tabindex="12" /></td></tr>                                \r
                                <tr><th style="vertical-align: top;"><wicket:message key="gb.permittedUsers"></wicket:message></th><td style="padding:2px;"><span wicket:id="users"></span></td></tr>\r
                                <tr><td colspan="2"><hr></hr></td></tr>         \r
-                               <tr><th><wicket:message key="gb.federationStrategy"></wicket:message></th><td class="edit"><select class="span6" wicket:id="federationStrategy" tabindex="12" /></td></tr>\r
+                               <tr><th><wicket:message key="gb.federationStrategy"></wicket:message></th><td class="edit"><select class="span6" wicket:id="federationStrategy" tabindex="13" /></td></tr>\r
                                <tr><th style="vertical-align: top;"><wicket:message key="gb.federationSets"></wicket:message></th><td style="padding:2px;"><span wicket:id="federationSets"></span></td></tr>\r
-                               <tr><th></th><td class="editButton"><input class="btn" type="submit" value="Cancel" wicket:message="value:gb.cancel" wicket:id="cancel" tabindex="13" /> &nbsp; <input class="btn primary" type="submit" value="Save" wicket:message="value:gb.save" wicket:id="save" tabindex="14" /> </td></tr>\r
+                               <tr><th></th><td class="editButton"><input class="btn" type="submit" value="Cancel" wicket:message="value:gb.cancel" wicket:id="cancel" tabindex="14" /> &nbsp; <input class="btn primary" type="submit" value="Save" wicket:message="value:gb.save" wicket:id="save" tabindex="15" /> </td></tr>\r
                        </tbody>\r
                </table>\r
        </form> \r
index ee79d500d3abfc5c03e30f8fe81f495fd5b381bc..be88bd5f9bed3b686a5d0a0e74fd50acbb51ada4 100644 (file)
@@ -213,6 +213,7 @@ public class EditRepositoryPage extends RootSubPage {
                form.add(new CheckBox("showRemoteBranches"));\r
                form.add(new CheckBox("showReadme"));\r
                form.add(new CheckBox("skipSizeCalculation"));\r
+               form.add(new CheckBox("skipSummaryMetrics"));\r
                form.add(usersPalette);\r
                form.add(federationSetsPalette);\r
 \r
index 50810a182932e411f5be502e1e504a5f706e4ff0..da573d5af2616b245a3747a40be9f5822038cd09 100644 (file)
@@ -43,6 +43,7 @@ import com.gitblit.GitBlit;
 import com.gitblit.Keys;\r
 import com.gitblit.models.Metric;\r
 import com.gitblit.models.PathModel;\r
+import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.MarkdownUtils;\r
 import com.gitblit.utils.StringUtils;\r
@@ -64,10 +65,11 @@ public class SummaryPage extends RepositoryPage {
                int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);\r
 \r
                Repository r = getRepository();\r
+               RepositoryModel model = getRepositoryModel();\r
                List<Metric> metrics = null;\r
                Metric metricsTotal = null;\r
-               if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
-                       metrics = GitBlit.self().getRepositoryDefaultMetrics(getRepositoryModel(), r);\r
+               if (!model.skipSummaryMetrics && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {\r
+                       metrics = GitBlit.self().getRepositoryDefaultMetrics(model, r);\r
                        metricsTotal = metrics.remove(0);\r
                }\r
 \r