Utils.packColumns(settingsTable, 5);\r
} else {\r
// remove the settings tab\r
- String settingsTitle = Translation.get("gb.settings");\r
- for (int i = 0; i < tabs.getTabCount(); i++) {\r
- if (tabs.getTitleAt(i).equals(settingsTitle)) {\r
- tabs.removeTabAt(i);\r
- break;\r
+ String[] titles = { Translation.get("gb.settings"), Translation.get("gb.status") };\r
+ for (String title : titles) {\r
+ for (int i = 0; i < tabs.getTabCount(); i++) {\r
+ if (tabs.getTitleAt(i).equals(title)) {\r
+ tabs.removeTabAt(i);\r
+ break;\r
+ }\r
}\r
}\r
}\r
import javax.swing.JScrollPane;\r
import javax.swing.JTable;\r
\r
+import com.gitblit.Constants;\r
import com.gitblit.models.ServerStatus;\r
import com.gitblit.utils.ByteFormat;\r
+import com.gitblit.utils.TimeUtils;\r
\r
/**\r
* This panel displays the server status.\r
private JLabel heapUsed;\r
private PropertiesTableModel model;\r
private HeaderPanel headerPanel;\r
+ private JLabel version;\r
+ private JLabel releaseDate;\r
\r
public StatusPanel() {\r
super();\r
}\r
\r
private void initialize() {\r
+ version = new JLabel();\r
+ releaseDate = new JLabel();\r
bootDate = new JLabel();\r
servletContainer = new JLabel();\r
\r
heapAllocated = new JLabel();\r
heapUsed = new JLabel();\r
\r
- JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));\r
+ JPanel fieldsPanel = new JPanel(new GridLayout(0, 1, 0, 5)) {\r
+ \r
+ private static final long serialVersionUID = 1L;\r
+\r
+ @Override\r
+ public Insets getInsets() {\r
+ return insets;\r
+ }\r
+ };\r
+ fieldsPanel.add(createFieldPanel("gb.version", version));\r
+ fieldsPanel.add(createFieldPanel("gb.releaseDate", releaseDate));\r
fieldsPanel.add(createFieldPanel("gb.bootDate", bootDate));\r
fieldsPanel.add(createFieldPanel("gb.servletContainer", servletContainer));\r
fieldsPanel.add(createFieldPanel("gb.heapUsed", heapUsed));\r
}\r
\r
private JPanel createFieldPanel(String key, JLabel valueLabel) {\r
- JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));\r
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));\r
JLabel textLabel = new JLabel(Translation.get(key));\r
textLabel.setFont(textLabel.getFont().deriveFont(Font.BOLD));\r
- textLabel.setPreferredSize(new Dimension(120, valueLabel.getFont().getSize() + 4));\r
+ textLabel.setPreferredSize(new Dimension(120, 10));\r
panel.add(textLabel);\r
panel.add(valueLabel);\r
return panel;\r
\r
public void setStatus(ServerStatus status) {\r
headerPanel.setText(Translation.get("gb.status"));\r
- bootDate.setText(status.bootDate.toString());\r
+ version.setText(Constants.NAME + (status.isGO ? " GO v" : " WAR v") + status.version);\r
+ releaseDate.setText(status.releaseDate);\r
+ bootDate.setText(status.bootDate.toString() + " (" + TimeUtils.timeAgo(status.bootDate)\r
+ + ")");\r
servletContainer.setText(status.servletContainer);\r
ByteFormat byteFormat = new ByteFormat();\r
heapMaximum.setText(byteFormat.format(status.heapMaximum));\r
import java.util.Map;\r
import java.util.TreeMap;\r
\r
+import com.gitblit.Constants;\r
+\r
/**\r
* ServerStatus encapsulates runtime status information about the server\r
* including some information about the system environment.\r
private static final long serialVersionUID = 1L;\r
\r
public final Date bootDate;\r
- \r
+\r
+ public final String version;\r
+\r
+ public final String releaseDate;\r
+\r
public final boolean isGO;\r
- \r
+\r
public final Map<String, String> systemProperties;\r
\r
public final long heapMaximum;\r
\r
public volatile long heapAllocated;\r
- \r
+\r
public volatile long heapFree;\r
- \r
+\r
public String servletContainer;\r
\r
public ServerStatus(boolean isGO) {\r
- bootDate = new Date();\r
+ this.bootDate = new Date();\r
+ this.version = Constants.VERSION;\r
+ this.releaseDate = Constants.VERSION_DATE;\r
this.isGO = isGO;\r
- \r
- heapMaximum = Runtime.getRuntime().maxMemory();\r
- \r
- systemProperties = new TreeMap<String, String>();\r
+\r
+ this.heapMaximum = Runtime.getRuntime().maxMemory();\r
+\r
+ this.systemProperties = new TreeMap<String, String>();\r
put("file.encoding");\r
put("java.home");\r
put("java.io.tmpdir");\r