Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/LoginRequired/Admin.cshtml @ 11036

Last change on this file since 11036 was 11036, checked in by mroscoe, 10 years ago
File size: 10.7 KB
Line 
1@model HeuristicLab.Services.Hive.Statistics.Models.AdminModel
2
3@{
4    ViewBag.Title = "Admin";
5}
6
7@if(!Model.IsAdmin) {
8  <h1>The user you are logged in as: @Model.UserName, is not an administrator.</h1>
9}
10else {
11    <!--[if gte IE 9]>
12    <style type="text/css">
13      .innerBar {
14          filter: none;
15      }
16    </style>
17  <![endif]-->
18  <h1>Welcome to the administrator page @Model.UserName!</h1>
19  <button id="UserOverviewButton" class="tabButton">User Overview</button>
20  <button id="TaskOverviewButton" class="tabButton">Task Overview</button>
21  <button id="SlaveOverviewButton" class="tabButton">Slave Overview</button>
22  <button id="ExceptionOverviewButton" class="tabButton">Exception Overview</button>
23  //User overview
24  <section id="UserOverviewTab" class="tabSection">
25    <fieldset id="Users" class="usersField">
26      <legend>Users</legend>
27      <select id="UserList" class="mainList">
28      </select>
29      <fieldset class="filterChoices">
30        <legend>Filter by</legend>
31        <label>Date</label>
32        <input type="checkbox" name="filterChoice" value="UserDate" checked="checked">
33        <label>Job Name</label>
34        <input type="checkbox" name="filterChoice" value="JobName">
35        <label>Task State</label>
36        <input type="checkbox" name="filterChoice" value="TaskState">
37        <label>Limit</label>
38        <select id="UserLimit">
39          <option>20</option>
40          <option>50</option>
41          <option selected="selected">100</option>
42          <option>200</option>
43        </select>
44      </fieldset>
45    </fieldset>
46    <fieldset class="filters">
47      <legend>Filters</legend>
48      <fieldset id="FilterUserDate" class="filterContainer">
49        <legend>Date</legend>
50        <label>Start</label>
51        @Html.TextBox("UserStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
52        <label>End</label>
53        @Html.TextBox("UserEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
54      </fieldset>
55      <fieldset id="FilterJobName" class="filterContainer">
56        <legend>Job Name</legend>
57        @Html.DropDownList("JobNames")
58      </fieldset>
59      <fieldset id="FilterTaskState" class="filterContainer">
60        <legend>Task State</legend>
61        @Html.DropDownList("TaskStates")
62      </fieldset>
63      <button id="UserApply">Apply</button>
64    </fieldset>
65    <button id="ScrollTop">^</button>
66    <section id="TasksContainer" class="tabDataContainer"></section>
67  </section>
68  //Task overview
69  <section id="TaskOverviewTab" class="tabSection">
70    <fieldset id="TaskUsers" class="usersField">
71      <legend>Users</legend>
72      <select id="TaskUserList" class="mainList">
73      </select>
74      <label>Start</label>
75      @Html.TextBox("TaskStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
76      <label>End</label>
77      @Html.TextBox("TaskEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
78    </fieldset>
79    <section id="TaskStatsContainer" class="tabDataContainer taskOverview"></section>
80  </section>
81  //Slave overview
82  <section id="SlaveOverviewTab" class="tabSection">
83    <fieldset class="filterChoices">
84      <legend>Filter by</legend>
85      <label>Date</label>
86      <input type="checkbox" name="filterChoice" value="SlaveDate" checked="checked">
87      <label>Users</label>
88      <input type="checkbox" name="filterChoice" value="User">
89      <label>Limit</label>
90      <select id="SlaveLimit">
91        <option>10</option>
92        <option>50</option>
93        <option selected="selected">100</option>
94        <option>200</option>
95      </select>
96    </fieldset>
97    <fieldset class="filters">
98      <legend>Filters</legend>
99      <fieldset id="FilterSlaveDate" class="filterContainer">
100        <legend>Date</legend>
101        <label>Start</label>
102        @Html.TextBox("SlaveStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
103        <label>End</label>
104        @Html.TextBox("SlaveEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
105      </fieldset>
106      <fieldset id="FilterUser" class="filterContainer">
107        <legend>User</legend>
108        <select id="SlaveUserList">
109        </select>
110      </fieldset>
111      <button id="SlaveApply">Apply</button>
112    </fieldset>
113    <section id="SlavesContainer" class="tabDataContainer"></section>
114  </section>
115  //Slave overview
116  <section id="ExceptionOverviewTab" class="tabSection">
117    <fieldset class="filterChoices">
118      <legend>Filter by</legend>
119      <label>Date</label>
120      <input type="checkbox" name="filterChoice" value="ExceptionDate" checked="checked">
121      <label>Users</label>
122      <input type="checkbox" name="filterChoice" value="ExceptionUser">
123      <label>Limit</label>
124      <select id="ExceptionLimit">
125        <option>20</option>
126        <option>50</option>
127        <option selected="selected">100</option>
128        <option>200</option>
129      </select>
130    </fieldset>
131    <fieldset class="filters">
132      <legend>Filters</legend>
133      <fieldset id="FilterExceptionDate" class="filterContainer">
134        <legend>Date</legend>
135        <label>Start</label>
136        @Html.TextBox("ExceptionStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
137        <label>End</label>
138        @Html.TextBox("ExceptionEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
139      </fieldset>
140      <fieldset id="FilterExceptionUser" class="filterContainer">
141        <legend>User</legend>
142        <select id="ExceptionUserList">
143        </select>
144      </fieldset>
145      <button id="ExcpetionApply">Apply</button>
146    </fieldset>
147    <section id="ExceptionContainer" class="tabDataContainer"></section>
148  </section>
149}
150
151@section Styles {
152  @Styles.Render("~/Styles/jqPlot/jquery.jqplot")
153  @Styles.Render("~/Content/themes/base/css")
154}
155
156@section Scripts {
157  @Scripts.Render("~/bundles/jqueryui")
158  @Scripts.Render("~/Scripts/CollapsingSection.js")
159  @Scripts.Render("~/Scripts/jquery.scrollstop.js")
160  @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot")
161  @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.barRenderer.min.js")
162  @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js")
163  @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.pointLabels.min.js")
164
165  @AdminHelper.UserList("UserList", Url.Action("UserList", "AdminData"), true)
166  @AdminHelper.UserList("TaskUserList", Url.Action("UserList", "AdminData"), false)
167  @AdminHelper.UserList("SlaveUserList", Url.Action("UserList", "AdminData"), false)
168
169  <script>
170    var startDate;
171    var endDate;
172    var selectedUser;
173    var limit;
174    var pageNumber;
175    var userId;
176    var numberTasks = 0;
177
178    $(document).ready(function () {
179      $("#UserStart, #UserEnd").datepicker({
180        dateFormat: "yy-mm-dd",
181        onSelect: function () { RefreshUser(); }
182      });
183      $("#TaskStart, #TaskEnd").datepicker({
184        dateFormat: "yy-mm-dd",
185        onSelect: function () { RefreshTask(); }
186      });
187      $("#SlaveStart, #SlaveEnd").datepicker({
188        dateFormat: "yy-mm-dd",
189        onSelect: function () { RefreshSlave(); }
190      });
191      $("#ExceptionStart, #ExceptionEnd").datepicker({
192        dateFormat: "yy-mm-dd",
193        onSelect: function () { RefreshException(); }
194      });
195    });
196
197    $("#UserApply").button({ icons: { primary: "ui-icon-refresh" } });
198    $("#UserApply").click(function () { RefreshUser(); });
199
200    $("#SlaveApply").button({ icons: { primary: "ui-icon-refresh" } });
201    $("#SlaveApply").click(function () { RefreshSlave(); });
202
203    $("#ExceptionApply").button({ icons: { primary: "ui-icon-refresh" } });
204    $("#ExceptionApply").click(function () { RefreshException(); });
205
206    $("#UserList").change(function () {
207      RefreshUser();
208    });
209
210    $("[name='filterChoice']").click(function () {
211      var filterName = $(this).val();
212      if ($(this).is(':checked')) {
213        $("#Filter" + filterName).css("display", "inline-block");
214      }
215      else {
216        $("#Filter" + filterName).css("display", "none");
217      }
218    });
219
220    function RefreshUser() {
221      selectedUser = $("#UserList").val();
222      limit = $("#UserLimit").val();
223      startDate = null;
224      endDate = null;
225      jobId = null;
226      taskState = null;
227      if ($("[value='UserDate']").is(":checked")) {
228        startDate = $('#UserStart').val();
229        endDate = $('#UserEnd').val();
230      }
231      if ($("[value='JobName']").is(':checked')) {
232        jobId = $('#JobNames').val();
233      }
234      if ($("[value='TaskState']").is(':checked')) {
235        taskState = $('#TaskState').val();
236      }
237      @ExceptionHelper.UserExceptions("TasksContainer", Url.Action("TaskExceptions", "ExceptionData"), "selectedUser", "limit", "startDate", "endDate", "jobId", "taskState")
238      @ChartHelper.TasksForUser("TasksContainer", "Task", Url.Action("UserTask", "ChartData"), "RefreshUser", "selectedUser", "limit", "startDate", "endDate", "jobId", "taskState", "pageNumber")
239      pageNumber = null;
240    }
241
242    @ChartHelper.ResizeTasks("Task")
243    @ExceptionHelper.ScrollToException()
244
245    $("#TaskUserList").change(function () {
246      RefreshTask();
247    });
248
249    function RefreshTask() {
250      selectedUser = $("#TaskUserList").val();
251      startDate = $('#TaskStart').val();
252      endDate = $('#TaskEnd').val();
253      @AdminHelper.UserTaskStats("TaskStatsContainer", Url.Action("TaskStats", "AdminData"), "selectedUser", "startDate", "endDate")
254    }
255
256    $("#SlaveList").change(function () {
257      RefreshSlave();
258    });
259
260    function RefreshSlave() {
261      selectedUser = null;
262      limit = $("#SlaveLimit").val();
263      startDate = null;
264      endDate = null;
265      if ($("[value='SlaveDate']").is(":checked")) {
266        startDate = $('#SlaveStart').val();
267        endDate = $('#SlaveEnd').val();
268      }
269      if ($("[value='User']").is(':checked')) {
270        selectedUser = $('#SlaveUserList').val();
271      }
272      @ChartHelper.SlaveInfoChart("SlavesContainer",Url.Action("SlaveInfo","ChartData"),"limit","startDate","endDate","selectedUser","RefreshSlave","pageNumber")
273      pageNumber = null;
274    }
275
276    $(".tabButton").click(function () {
277      var sender = $(this).attr('id');
278      $(".tabButton").css({'border-bottom' : '1px solid #8297F5', 'background' : 'none' });
279      $(this).css({ 'border-bottom': '1px solid #E0E6FF', 'background-color': '#E0E6FF' });
280      $(".tabSection").css('display', 'none');
281      $("#" + sender.slice(0, -6) + "Tab").css('display', 'block');
282    })
283  </script>
284}
Note: See TracBrowser for help on using the repository browser.