From 0e44acbb2fec928a1606dc60f427a148fff405c9 Mon Sep 17 00:00:00 2001
From: Mohamed Ragab <moragab@gmail.com>
Date: Wed, 02 May 2012 11:15:01 -0400
Subject: [PATCH] Added a script to facilitate setting the proxy host and port and no proxy hosts, and then it concatenates all the java system properties for setting the java proxy configurations and puts the resulting string in an environment variable JAVA_PROXY_CONFIG, modified the scirpts gitblit, gitblit-ubuntu, and gitblit-centos to source the java-proxy-config.sh script and then include the resulting java proxy configuration in the java command
---
src/com/gitblit/client/StatusPanel.java | 77 ++++++++++++++++++++++++++------------
1 files changed, 53 insertions(+), 24 deletions(-)
diff --git a/src/com/gitblit/client/StatusPanel.java b/src/com/gitblit/client/StatusPanel.java
index 797ae9b..f22d69c 100644
--- a/src/com/gitblit/client/StatusPanel.java
+++ b/src/com/gitblit/client/StatusPanel.java
@@ -21,13 +21,18 @@
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import com.gitblit.Constants;
+import com.gitblit.Constants.RpcRequest;
import com.gitblit.models.ServerStatus;
import com.gitblit.utils.ByteFormat;
import com.gitblit.utils.TimeUtils;
@@ -40,29 +45,32 @@
public class StatusPanel extends JPanel {
private static final long serialVersionUID = 1L;
- private final Insets insets = new Insets(5, 5, 5, 5);
+ private final GitblitClient gitblit;
private JLabel bootDate;
private JLabel url;
private JLabel servletContainer;
private JLabel heapMaximum;
private JLabel heapAllocated;
private JLabel heapUsed;
- private PropertiesTableModel model;
- private HeaderPanel headerPanel;
+ private PropertiesTableModel tableModel;
+ private HeaderPanel header;
private JLabel version;
private JLabel releaseDate;
- public StatusPanel() {
+ public StatusPanel(GitblitClient gitblit) {
super();
+ this.gitblit = gitblit;
initialize();
}
- public StatusPanel(String url, ServerStatus status) {
- this();
- setStatus(url, status);
- }
-
private void initialize() {
+ JButton refreshStatus = new JButton(Translation.get("gb.refresh"));
+ refreshStatus.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ refreshStatus();
+ }
+ });
+
version = new JLabel();
releaseDate = new JLabel();
bootDate = new JLabel();
@@ -73,13 +81,13 @@
heapAllocated = new JLabel();
heapUsed = new JLabel();
- JPanel fieldsPanel = new JPanel(new GridLayout(0, 1, 0, 5)) {
+ JPanel fieldsPanel = new JPanel(new GridLayout(0, 1, 0, Utils.MARGIN)) {
private static final long serialVersionUID = 1L;
@Override
public Insets getInsets() {
- return insets;
+ return Utils.INSETS;
}
};
fieldsPanel.add(createFieldPanel("gb.version", version));
@@ -91,25 +99,29 @@
fieldsPanel.add(createFieldPanel("gb.heapAllocated", heapAllocated));
fieldsPanel.add(createFieldPanel("gb.heapMaximum", heapMaximum));
- model = new PropertiesTableModel();
- JTable propertiesTable = Utils.newTable(model, Utils.DATE_FORMAT);
+ tableModel = new PropertiesTableModel();
+ JTable propertiesTable = Utils.newTable(tableModel, Utils.DATE_FORMAT);
String name = propertiesTable.getColumnName(PropertiesTableModel.Columns.Name.ordinal());
NameRenderer nameRenderer = new NameRenderer();
propertiesTable.setRowHeight(nameRenderer.getFont().getSize() + 8);
propertiesTable.getColumn(name).setCellRenderer(nameRenderer);
- JPanel centerPanel = new JPanel(new BorderLayout());
+ JPanel centerPanel = new JPanel(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
centerPanel.add(fieldsPanel, BorderLayout.NORTH);
centerPanel.add(new JScrollPane(propertiesTable), BorderLayout.CENTER);
- headerPanel = new HeaderPanel(Translation.get("gb.status"), "health_16x16.png");
- setLayout(new BorderLayout());
- add(headerPanel, BorderLayout.NORTH);
+ JPanel controls = new JPanel(new FlowLayout(FlowLayout.CENTER, Utils.MARGIN, 0));
+ controls.add(refreshStatus);
+
+ header = new HeaderPanel(Translation.get("gb.status"), "health_16x16.png");
+ setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
+ add(header, BorderLayout.NORTH);
add(centerPanel, BorderLayout.CENTER);
+ add(controls, BorderLayout.SOUTH);
}
private JPanel createFieldPanel(String key, JLabel valueLabel) {
- JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 0));
JLabel textLabel = new JLabel(Translation.get(key));
textLabel.setFont(textLabel.getFont().deriveFont(Font.BOLD));
textLabel.setPreferredSize(new Dimension(120, 10));
@@ -120,23 +132,40 @@
@Override
public Insets getInsets() {
- return insets;
+ return Utils.INSETS;
}
- public void setStatus(String url, ServerStatus status) {
- headerPanel.setText(Translation.get("gb.status"));
+ protected void refreshStatus() {
+ GitblitWorker worker = new GitblitWorker(StatusPanel.this, RpcRequest.LIST_STATUS) {
+ @Override
+ protected Boolean doRequest() throws IOException {
+ gitblit.refreshStatus();
+ return true;
+ }
+
+ @Override
+ protected void onSuccess() {
+ updateTable(false);
+ }
+ };
+ worker.execute();
+ }
+
+ protected void updateTable(boolean pack) {
+ ServerStatus status = gitblit.getStatus();
+ header.setText(Translation.get("gb.status"));
version.setText(Constants.NAME + (status.isGO ? " GO v" : " WAR v") + status.version);
releaseDate.setText(status.releaseDate);
bootDate.setText(status.bootDate.toString() + " (" + TimeUtils.timeAgo(status.bootDate)
+ ")");
- this.url.setText(url);
+ url.setText(gitblit.url);
servletContainer.setText(status.servletContainer);
ByteFormat byteFormat = new ByteFormat();
heapMaximum.setText(byteFormat.format(status.heapMaximum));
heapAllocated.setText(byteFormat.format(status.heapAllocated));
heapUsed.setText(byteFormat.format(status.heapAllocated - status.heapFree) + " ("
+ byteFormat.format(status.heapFree) + " " + Translation.get("gb.free") + ")");
- model.setProperties(status.systemProperties);
- model.fireTableDataChanged();
+ tableModel.setProperties(status.systemProperties);
+ tableModel.fireTableDataChanged();
}
}
--
Gitblit v1.9.1