Skip to content

Commit

Permalink
Revert "WIP: Button to remove exempt orgs (#131)"
Browse files Browse the repository at this point in the history
This reverts commit 070042a.
  • Loading branch information
SeanKilleen authored Feb 14, 2022
1 parent 070042a commit 2547b69
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 61 deletions.
23 changes: 0 additions & 23 deletions src/Konmaripo.Web/Controllers/OrgWideVisibilityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,8 @@ public async Task<IActionResult> CreateOrgWideTeam()

return RedirectToAction("Index");
}
public IActionResult ExemptRepositoryCheck()
{
var tagName = _settings.ExemptionTagName;

var repos = _gitHubService.GetRepositoriesWithTopicThatAreVisibleToTeam(
tagName,
_settings.AllOrgMembersGroupName);

var vm = new ExemptRepositoryCheckViewModel(tagName, repos);
// TODO
return View();
}
}

public class ExemptRepositoryCheckViewModel
{
public string TagName { get; }
public List<string> RepositoryNames { get; }

public ExemptRepositoryCheckViewModel(string tagName, List<string> repoNames)
{
TagName = tagName;
RepositoryNames = repoNames;
}
}
public class OrgWideVisibilityIndexVM
{
public string OrgWideTeamName { get; }
Expand Down
1 change: 0 additions & 1 deletion src/Konmaripo.Web/Models/OrgWideVisibilitySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ public class OrgWideVisibilitySettings
{
public string AllOrgMembersGroupName { get; set; }
public string AllOrgMembersGroupDescription { get; set; }
public string ExemptionTagName { get; set; }
}
}
5 changes: 0 additions & 5 deletions src/Konmaripo.Web/Services/CachedGitHubService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ public async Task AddMembersToTeam(int teamId, List<string> loginsToAdd)
await _gitHubService.AddMembersToTeam(teamId, loginsToAdd);
}

public Task<List<string>> GetRepositoriesWithTopicThatAreVisibleToTeam(string topicName, string teamName)
{
return _gitHubService.GetRepositoriesWithTopicThatAreVisibleToTeam(topicName, teamName);
}

public async Task<List<User>> GetUsersNotInTeam(string teamName)
{
var allTeams = await GetAllTeams();
Expand Down
7 changes: 0 additions & 7 deletions src/Konmaripo.Web/Services/GitHubService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,5 @@ public async Task AddMembersToTeam(int teamId, List<string> loginsToAdd)
await _githubClient.Organization.Team.AddOrEditMembership(teamId, login, request);
}
}

public async Task<List<string>> GetRepositoriesWithTopicThatAreVisibleToTeam(string topicName, string teamName)
{
var allRepos = await GetRepositoriesForOrganizationAsync();

// TODO Filter repos by topic.
}
}
}
1 change: 0 additions & 1 deletion src/Konmaripo.Web/Services/IGitHubService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ public interface IGitHubService
Task<IReadOnlyList<User>> GetTeamMembers(int teamId);
Task AddMembersToTeam(string teamName, List<string> loginsToAdd);
Task AddMembersToTeam(int teamId, List<string> loginsToAdd);
Task<List<string>> GetRepositoriesWithTopicThatAreVisibleToTeam(string topicName, string teamName);
}
}
34 changes: 11 additions & 23 deletions src/Konmaripo.Web/Views/OrgWideVisibility/AddOrgMembers.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,22 @@

<div class="text-center">
<h2>Step 2: Add Missing team members</h2>
<p>The @Model.Count below organization members are not a part of the org-wide group.</p>
</div>

@if (!Model.Any())
<div class="container">
@foreach (var row in Model.ToArray().Split(4))
{
<div class="alert alert-success">
<h4 class="alert-heading">Great! No missing members.</h4>
<p>All your org's members are within the group.</p>
@Html.ActionLink($"Next step: Remove access for exempt repositories", "ExemptRepositoryCheck", "OrgWideVisibility", null, new { @class = "btn btn-success", role = "button" })
</div>

}
else
{
<div class="container">
@foreach (var row in Model.ToArray().Split(4))
<div class="row">
@foreach (var login in row)
{
<div class="row">
@foreach (var login in row)
{
<div class="col">
@login
</div>
}
<div class="col">
@login
</div>
}
</div>
<div>
@Html.ActionLink($"Add these {Model.Count} members to the group.", "AddOrgMembersList", "OrgWideVisibility", new { loginsToAdd = Model }, new { @class = "btn btn-success", role = "button" })
</div>
}

</div>
<div>
@Html.ActionLink($"Add these {Model.Count} members to the group.", "AddOrgMembersList", "OrgWideVisibility", new { loginsToAdd = Model }, new { @class = "btn btn-success", role = "button" })
</div>
2 changes: 1 addition & 1 deletion src/Konmaripo.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"OrgWideVisibilitySettings": {
"AllOrgMembersGroupName": "all-org-members",
"AllOrgMembersGroupDescription": "A group created by the Konmaripo tool, which includes everyone who is a member of the GitHub organization.",
"ExemptionTagName": "exempt-from-org-visibility"
"ExemptionTagName": "ExemptFromOrgWideVisibility"
},
"ArchivalSettings": {
"ArchivalUrl": "CHANGE_ME"
Expand Down

0 comments on commit 2547b69

Please sign in to comment.