Skip to content

Commit de92100

Browse files
committed
Created common view for list of groups
1 parent a0227b0 commit de92100

File tree

13 files changed

+56
-102
lines changed

13 files changed

+56
-102
lines changed

ITSWebMgmt/Controllers/ComputerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public ActionResult LoadTab(string tabName, string computername)
5757
break;
5858
case "groups":
5959
viewName = "Groups";
60-
break;
60+
return PartialView(viewName, new PartialGroupModel(ComputerModel.ADcache, "memberOf"));
6161
case "tasks":
6262
viewName = "Tasks";
6363
break;

ITSWebMgmt/Models/Computer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ public class ComputerModel
5656
public string SCCMDisk;
5757
public string ErrorCountMessage;
5858
public string ErrorMessages;
59-
public string GroupSegment;
60-
public string GroupsAllSegment;
6159
public bool ShowResultDiv = false;
6260
public bool ShowResultGetPassword = false;
6361
public bool ShowMoveComputerOUdiv = false;

ITSWebMgmt/Models/Group.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,17 @@ public void buildResult()
4242

4343
if (GroupController.isFileShare(DistinguishedName))
4444
{
45-
string[] tables = group.GetFileshareTables();
45+
// TODO move to different view
46+
/*string[] tables = group.GetFileshareTables();
4647
GroupSegment = tables[0];
4748
GroupsAllSegment = tables[1];
4849
GroupOfSegment = tables[2];
4950
GroupsOfAllSegment = tables[3];
5051
5152
FileshareInfo = "Contains information from the other fileshares with the other accesses<br>";
52-
Title = "Fileshare Info";
53-
}
54-
else
55-
{
56-
GroupSegment = TableGenerator.BuildgroupssegmentLabel(getGroups("member"));
57-
GroupsAllSegment = TableGenerator.BuildgroupssegmentLabel(getGroupsTransitive("member"));
58-
GroupOfSegment = TableGenerator.BuildgroupssegmentLabel(getGroups("memberOf"));
59-
GroupsOfAllSegment = TableGenerator.BuildgroupssegmentLabel(getGroupsTransitive("memberOf"));
60-
Title = "Group Info";
53+
Title = "Fileshare Info";*/
6154
}
55+
Title = "Group Info";
6256
}
6357

6458
private void buildRaw()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using ITSWebMgmt.Caches;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
7+
namespace ITSWebMgmt.Models
8+
{
9+
public class PartialGroupModel : WebMgmtModel<ADcache>
10+
{
11+
public List<string> GroupList;
12+
public List<string> GroupListAll;
13+
public string GroupSegment;
14+
public string GroupsAllSegment;
15+
public string AttributeName;
16+
public string Title;
17+
18+
public List<string> getGroups(string name) => ADcache.getGroups(name);
19+
public List<string> getGroupsTransitive(string name) => ADcache.getGroupsTransitive(name);
20+
21+
public PartialGroupModel(ADcache aDcache, string attributeName, string title = "Groups")
22+
{
23+
ADcache = aDcache;
24+
AttributeName = attributeName;
25+
Title = title;
26+
}
27+
}
28+
}

ITSWebMgmt/Models/User.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ public string[] getUserInfo()
6969
public string BasicInfoTable;
7070
public string BasicInfoRomaing;
7171
public string Print;
72-
public string GroupSegment;
73-
public string GroupsAllSegment;
74-
public string Filesharessegment;
7572
public string CalAgenda;
76-
public string Exchange;
7773
public string ServiceManager;
7874
public string ComputerInformation;
7975
public string Loginscript;
@@ -86,8 +82,6 @@ public string[] getUserInfo()
8682
public bool ShowErrorDiv = false;
8783
public bool ShowFixUserOU = false;
8884
public bool ShowLoginScript = false;
89-
public List<string> GroupList;
90-
public List<string> GroupListAll;
9185

9286
public UserModel(UserController controller, string username, string adpath)
9387
{

ITSWebMgmt/Models/WebMgmtModel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public abstract class WebMgmtModel<T> where T : ADcache
1111
public T ADcache;
1212
public string Path { get => ADcache.Path; }
1313
public virtual string adpath { get => ADcache.adpath; set { ADcache.adpath = value; } }
14-
public List<string> getGroups(string name) => ADcache.getGroups(name);
15-
public List<string> getGroupsTransitive(string name) => ADcache.getGroupsTransitive(name);
1614
public List<PropertyValueCollection> getAllProperties() => ADcache.getAllProperties();
1715
}
1816
}

ITSWebMgmt/Views/Computer/Groups.cshtml

Lines changed: 0 additions & 21 deletions
This file was deleted.

ITSWebMgmt/Views/Group/Index.cshtml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
@{
44
ViewData["Title"] = "GroupInfo";
55
}
6-
76
<!-- Loader -->
87
<div id="loader">
98
<div class="ui active dimmer" style="display: none">
@@ -23,11 +22,7 @@
2322
-->
2423
</div>
2524

26-
27-
2825
<!-- page content -->
29-
30-
3126
<script>
3227
$(document).ready(function () {
3328
$('.menu .item').tab({ history: false });
@@ -37,10 +32,6 @@
3732
<br />
3833
<br />
3934
<div runat="server" id="ResultDiv">
40-
41-
42-
43-
4435
<div class="ui grid">
4536
<div class="four wide column">
4637
<div class="ui vertical fluid tabular menu">
@@ -103,36 +94,12 @@
10394
</table>
10495
</div>
10596
<div class="ui tab segment" data-tab="members">
106-
<h2>Members</h2>
10797
@Html.Raw(Model.FileshareInfo)
108-
<div class="ui two item menu">
109-
<a data-tab="groups-direct" class="item">Direct Groups</a>
110-
<a data-tab="groups-all" class="item"> Recursive groups</a>
111-
</div>
112-
113-
<div class="ui active tab segment" data-tab="groups-direct">
114-
@Html.Raw(Model.GroupSegment)
115-
</div>
116-
117-
<div class="ui tab segment" data-tab="groups-all">
118-
@Html.Raw(Model.GroupsAllSegment)
119-
</div>
98+
@Html.Partial("Groups", new PartialGroupModel(Model.ADcache, "member", "Members"))
12099
</div>
121100
<div class="ui tab segment" data-tab="memberOf">
122-
<h2>Member Of</h2>
123101
@Html.Raw(Model.FileshareInfo)
124-
<div class="ui two item menu">
125-
<a data-tab="groups-direct" class="item">Direct Groups</a>
126-
<a data-tab="groups-all" class="item"> Recursive groups</a>
127-
</div>
128-
129-
<div class="ui active tab segment" data-tab="groups-direct">
130-
@Html.Raw(Model.GroupOfSegment)
131-
</div>
132-
133-
<div class="ui tab segment" data-tab="groups-all">
134-
@Html.Raw(Model.GroupsOfAllSegment)
135-
</div>
102+
@Html.Partial("Groups", new PartialGroupModel(Model.ADcache, "memberOf", "Members Of"))
136103
</div>
137104
<div class="ui tab segment" data-tab="rawData">
138105
<h2>Raw Data</h2>

ITSWebMgmt/Views/Shared/GroupList.cshtml

Lines changed: 0 additions & 4 deletions
This file was deleted.

ITSWebMgmt/Views/User/Groups.cshtml renamed to ITSWebMgmt/Views/Shared/Groups.cshtml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
@model ITSWebMgmt.Models.UserModel
1+
@model ITSWebMgmt.Models.PartialGroupModel
2+
23
@using ITSWebMgmt.Helpers
34
@{
4-
Model.GroupList = Model.ADcache.getGroups("memberOf");
5-
Model.GroupListAll = Model.ADcache.getGroupsTransitive("memberOf");
5+
Model.GroupList = Model.ADcache.getGroups(Model.AttributeName);
6+
Model.GroupListAll = Model.ADcache.getGroupsTransitive(Model.AttributeName);
67
Model.GroupSegment = TableGenerator.BuildgroupssegmentLabel(Model.GroupList);
78
Model.GroupsAllSegment = TableGenerator.BuildgroupssegmentLabel(Model.GroupListAll);
89
}
9-
<h2>Groups</h2>
10+
<h2>@Html.LabelFor(m => m.Title)</h2>
1011
<div class="ui two item menu">
1112
<a data-tab="groups-direct" class="item">Direct Groups</a>
1213
<a data-tab="groups-all" class="item">Recursive groups</a>

0 commit comments

Comments
 (0)