From b59634f8ed4a3a77afd039311cc0552b00fe7a3c Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Sat, 8 Sep 2018 17:38:09 +0200 Subject: [PATCH] Changed repo defaults to private in anticipation of first release. --- src/main/java/nl/andrewlalis/Main.java | 1 - .../java/nl/andrewlalis/git_api/GithubManager.java | 7 ++----- .../java/nl/andrewlalis/ui/view/InitializerApp.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/nl/andrewlalis/Main.java b/src/main/java/nl/andrewlalis/Main.java index 2249e3a..ed72ebc 100644 --- a/src/main/java/nl/andrewlalis/Main.java +++ b/src/main/java/nl/andrewlalis/Main.java @@ -1,6 +1,5 @@ package nl.andrewlalis; -import nl.andrewlalis.model.Organization; import nl.andrewlalis.ui.control.command.CommandExecutor; import nl.andrewlalis.ui.control.command.executables.*; import nl.andrewlalis.ui.view.InitializerApp; diff --git a/src/main/java/nl/andrewlalis/git_api/GithubManager.java b/src/main/java/nl/andrewlalis/git_api/GithubManager.java index 315bb72..c5b6450 100644 --- a/src/main/java/nl/andrewlalis/git_api/GithubManager.java +++ b/src/main/java/nl/andrewlalis/git_api/GithubManager.java @@ -6,9 +6,6 @@ import nl.andrewlalis.model.Student; import nl.andrewlalis.model.StudentTeam; import nl.andrewlalis.model.TATeam; import nl.andrewlalis.model.TeachingAssistant; -import nl.andrewlalis.model.error.Error; -import nl.andrewlalis.model.error.Severity; -import nl.andrewlalis.ui.view.InitializerApp; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPatch; import org.apache.http.entity.StringEntity; @@ -115,7 +112,7 @@ public class GithubManager { logger.fine("Deleted pre-existing assignments repository."); } - this.assignmentsRepo = this.createRepository(assignmentsRepoName, team, description, false, true, false); + this.assignmentsRepo = this.createRepository(assignmentsRepoName, team, description, false, true, true); if (this.assignmentsRepo == null) { logger.severe("Could not create assignments repository."); @@ -143,7 +140,7 @@ public class GithubManager { return; } - GHRepository repo = this.createRepository(team.generateUniqueName(prefix), taTeam.getGithubTeam(), team.generateRepoDescription(), false, true, false); + GHRepository repo = this.createRepository(team.generateUniqueName(prefix), taTeam.getGithubTeam(), team.generateRepoDescription(), false, true, true); if (repo == null) { logger.severe("Repository for student team " + team.getId() + " could not be created."); diff --git a/src/main/java/nl/andrewlalis/ui/view/InitializerApp.java b/src/main/java/nl/andrewlalis/ui/view/InitializerApp.java index ab856c9..bf5b353 100644 --- a/src/main/java/nl/andrewlalis/ui/view/InitializerApp.java +++ b/src/main/java/nl/andrewlalis/ui/view/InitializerApp.java @@ -34,6 +34,8 @@ public class InitializerApp extends JFrame { private JTextField organizationField = new JTextField(); private JTextField accessTokenField = new JTextField(); + private JCheckBox privateCheckbox = new JCheckBox("Private"); + /** * The executor responsible for performing meaningful actions. */ @@ -113,6 +115,8 @@ public class InitializerApp extends JFrame { this.organizationField.setText("InitializerTesting"); infoInputPanel.add(generateTextFieldPanel("Access Token", this.accessTokenField)); this.accessTokenField.setText("haha get your own"); + infoInputPanel.add(this.privateCheckbox); + this.privateCheckbox.disable(); githubManagerPanel.add(infoInputPanel, BorderLayout.NORTH); @@ -222,6 +226,14 @@ public class InitializerApp extends JFrame { return this.accessTokenField.getText().trim(); } + /** + * Gets whether or not the 'private' checkbox is selected. + * @return True if the user wishes for repositories to be made private, or false otherwise. + */ + public boolean isPrivateChecked() { + return this.privateCheckbox.isSelected(); + } + public Organization getOrganization() { return this.organization; }