| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.swing.JButton;
|
| | | import javax.swing.JLabel;
|
| | |
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.Constants.RpcRequest;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.FeedModel;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
| | |
|
| | | private JTextField filterTextfield;
|
| | |
|
| | | private JButton clearCache;
|
| | |
|
| | | public RepositoriesPanel(GitblitClient gitblit) {
|
| | | super();
|
| | | this.gitblit = gitblit;
|
| | |
| | | refreshRepositories.addActionListener(new ActionListener() {
|
| | | public void actionPerformed(ActionEvent e) {
|
| | | refreshRepositories();
|
| | | }
|
| | | });
|
| | | |
| | | clearCache = new JButton(Translation.get("gb.clearCache"));
|
| | | clearCache.addActionListener(new ActionListener() {
|
| | | public void actionPerformed(ActionEvent e) {
|
| | | clearCache();
|
| | | }
|
| | | });
|
| | |
|
| | |
| | | repositoryTablePanel.add(new JScrollPane(table), BorderLayout.CENTER);
|
| | |
|
| | | JPanel repositoryControls = new JPanel(new FlowLayout(FlowLayout.CENTER, Utils.MARGIN, 0));
|
| | | repositoryControls.add(clearCache);
|
| | | repositoryControls.add(refreshRepositories);
|
| | | repositoryControls.add(browseRepository);
|
| | | repositoryControls.add(createRepository);
|
| | |
| | | repositoryControls.add(searchRepository);
|
| | |
|
| | | setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
|
| | | header = new HeaderPanel(Translation.get("gb.repositories"), "gitweb-favicon.png");
|
| | | header = new HeaderPanel(Translation.get("gb.repositories"), "git-orange-16x16.png");
|
| | | add(header, BorderLayout.NORTH);
|
| | | add(repositoryTablePanel, BorderLayout.CENTER);
|
| | | add(repositoryControls, BorderLayout.SOUTH);
|
| | |
| | | protected abstract void updateTeamsTable();
|
| | |
|
| | | protected void disableManagement() {
|
| | | clearCache.setVisible(false);
|
| | | createRepository.setVisible(false);
|
| | | editRepository.setVisible(false);
|
| | | delRepository.setVisible(false);
|
| | |
| | | };
|
| | | worker.execute();
|
| | | }
|
| | | |
| | | protected void clearCache() {
|
| | | GitblitWorker worker = new GitblitWorker(RepositoriesPanel.this,
|
| | | RpcRequest.CLEAR_REPOSITORY_CACHE) {
|
| | | @Override
|
| | | protected Boolean doRequest() throws IOException {
|
| | | if (gitblit.clearRepositoryCache()) {
|
| | | gitblit.refreshRepositories();
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void onSuccess() {
|
| | | updateTable(false);
|
| | | }
|
| | | };
|
| | | worker.execute();
|
| | | }
|
| | |
|
| | | /**
|
| | | * Displays the create repository dialog and fires a SwingWorker to update
|
| | |
| | | protected void createRepository() {
|
| | | EditRepositoryDialog dialog = new EditRepositoryDialog(gitblit.getProtocolVersion());
|
| | | dialog.setLocationRelativeTo(RepositoriesPanel.this);
|
| | | dialog.setAccessRestriction(gitblit.getDefaultAccessRestriction());
|
| | | dialog.setAuthorizationControl(gitblit.getDefaultAuthorizationControl());
|
| | | dialog.setUsers(null, gitblit.getUsernames(), null);
|
| | | dialog.setTeams(gitblit.getTeamnames(), null);
|
| | | dialog.setRepositories(gitblit.getRepositories());
|
| | |
| | | gitblit.getPreReceiveScriptsInherited(repository), repository.preReceiveScripts);
|
| | | dialog.setPostReceiveScripts(gitblit.getPostReceiveScriptsUnused(repository),
|
| | | gitblit.getPostReceiveScriptsInherited(repository), repository.postReceiveScripts);
|
| | | if (gitblit.getSettings().hasKey(Keys.groovy.customFields)) {
|
| | | Map<String, String> map = gitblit.getSettings().get(Keys.groovy.customFields).getMap();
|
| | | dialog.setCustomFields(repository, map);
|
| | | }
|
| | | dialog.setVisible(true);
|
| | | final RepositoryModel revisedRepository = dialog.getRepository();
|
| | | final List<String> permittedUsers = dialog.getPermittedUsers();
|