Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 11053 was 11053, checked in by mroscoe, 10 years ago
File size: 11.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    <section id="TasksContainer" class="tabDataContainer"></section>
66  </section>
67  //Task overview
68  <section id="TaskOverviewTab" class="tabSection">
69    <fieldset id="TaskUsers" class="usersField">
70      <legend>Users</legend>
71      <select id="TaskUserList" class="mainList">
72      </select>
73      <label>Start</label>
74      @Html.TextBox("TaskStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
75      <label>End</label>
76      @Html.TextBox("TaskEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
77    </fieldset>
78    <section id="TaskStatsContainer" class="tabDataContainer taskOverview"></section>
79  </section>
80  //Slave overview
81  <section id="SlaveOverviewTab" class="tabSection">
82    <fieldset class="filterChoices">
83      <legend>Filter by</legend>
84      <label>Date</label>
85      <input type="checkbox" name="filterChoice" value="SlaveDate" checked="checked">
86      <label>Users</label>
87      <input type="checkbox" name="filterChoice" value="User">
88      <label>Limit</label>
89      <select id="SlaveLimit">
90        <option>10</option>
91        <option>50</option>
92        <option selected="selected">100</option>
93        <option>200</option>
94      </select>
95    </fieldset>
96    <fieldset class="filters">
97      <legend>Filters</legend>
98      <fieldset id="FilterSlaveDate" class="filterContainer">
99        <legend>Date</legend>
100        <label>Start</label>
101        @Html.TextBox("SlaveStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
102        <label>End</label>
103        @Html.TextBox("SlaveEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
104      </fieldset>
105      <fieldset id="FilterUser" class="filterContainer">
106        <legend>User</legend>
107        <select id="SlaveUserList">
108        </select>
109      </fieldset>
110      <button id="SlaveApply">Apply</button>
111    </fieldset>
112    <section id="SlavesContainer" class="tabDataContainer"></section>
113  </section>
114  //Exception overview
115  <section id="ExceptionOverviewTab" class="tabSection">
116    <fieldset class="filterChoices">
117      <legend>Filter by</legend>
118      <label>Date</label>
119      <input type="checkbox" name="filterChoice" value="ExceptionDate" checked="checked">
120      <label>Slave</label>
121      <input type="checkbox" name="filterChoice" value="ExceptionSlave">
122      <label>Limit</label>
123      <select id="ExceptionLimit">
124        <option>20</option>
125        <option>50</option>
126        <option selected="selected">100</option>
127        <option>200</option>
128      </select>
129    </fieldset>
130    <fieldset class="filters">
131      <legend>Filters</legend>
132      <fieldset id="FilterExceptionDate" class="filterContainer">
133        <legend>Date</legend>
134        <label>Start</label>
135        @Html.TextBox("ExceptionStart", (DateTime.Now - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
136        <label>End</label>
137        @Html.TextBox("ExceptionEnd", (DateTime.Now + new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd"), new { @class = "date" })
138      </fieldset>
139      <fieldset id="FilterExceptionSlave" class="filterContainer">
140        <legend>Slave</legend>
141        @Html.DropDownList("Slaves")
142      </fieldset>
143      <button id="ExceptionApply">Apply</button>
144    </fieldset>
145    <section id="ExceptionContainer" class="tabDataContainer"></section>
146  </section>
147  <button id="ScrollTop">^</button>
148}
149
150@section Styles {
151  @Styles.Render("~/Styles/jqPlot/jquery.jqplot")
152  @Styles.Render("~/Content/themes/base/css")
153}
154
155@section Scripts {
156  @Scripts.Render("~/bundles/jqueryui")
157  @Scripts.Render("~/Scripts/CollapsingSection.js")
158  @Scripts.Render("~/Scripts/jquery.scrollstop.js")
159  @Scripts.Render("~/Scripts/jqPlot/jquery.jqplot")
160  @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.barRenderer.min.js")
161  @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js")
162  @Scripts.Render("~/Scripts/jqPlot/plugins/jqplot.pointLabels.min.js")
163
164  @AdminHelper.UserList("UserList", Url.Action("UserList", "AdminData"), true)
165  @AdminHelper.UserList("TaskUserList", Url.Action("UserList", "AdminData"), false)
166  @AdminHelper.UserList("SlaveUserList", Url.Action("UserList", "AdminData"), false)
167
168  <script>
169    var startDate;
170    var endDate;
171    var selectedUser;
172    var selectedSlave;
173    var limit;
174    var pageNumber;
175    var userId;
176
177    $(document).ready(function () {
178      $("#UserStart, #UserEnd").datepicker({
179        dateFormat: "yy-mm-dd",
180        onSelect: function () { RefreshUser(); }
181      });
182      $("#TaskStart, #TaskEnd").datepicker({
183        dateFormat: "yy-mm-dd",
184        onSelect: function () { RefreshTask(); }
185      });
186      $("#SlaveStart, #SlaveEnd").datepicker({
187        dateFormat: "yy-mm-dd",
188        onSelect: function () { RefreshSlave(); }
189      });
190      $("#ExceptionStart, #ExceptionEnd").datepicker({
191        dateFormat: "yy-mm-dd",
192        onSelect: function () { RefreshException(); }
193      });
194    });
195
196    $("#UserApply").button({ icons: { primary: "ui-icon-refresh" } });
197    $("#UserApply").click(function () { RefreshUser(); });
198
199    $("#SlaveApply").button({ icons: { primary: "ui-icon-refresh" } });
200    $("#SlaveApply").click(function () { RefreshSlave(); });
201
202    $("#ExceptionApply").button({ icons: { primary: "ui-icon-refresh" } });
203    $("#ExceptionApply").click(function () { RefreshException(); });
204
205    $("#UserList").change(function () {
206      RefreshUser();
207    });
208
209    $("[name='filterChoice']").click(function () {
210      var filterName = $(this).val();
211      if ($(this).is(':checked')) {
212        $("#Filter" + filterName).css("display", "inline-block");
213      }
214      else {
215        $("#Filter" + filterName).css("display", "none");
216      }
217    });
218
219    $(".tabButton").click(function () {
220      var sender = $(this).attr('id');
221      $(".tabButton").css({ 'border-bottom': '1px solid #8297F5', 'background': 'none' });
222      $(this).css({ 'border-bottom': '1px solid #E0E6FF', 'background-color': '#E0E6FF' });
223      $(".tabSection").css('display', 'none');
224      $("#" + sender.slice(0, -6) + "Tab").css('display', 'block');
225    })
226
227    //User Overview
228    function RefreshUser() {
229      selectedUser = $("#UserList").val();
230      limit = $("#UserLimit").val();
231      startDate = null;
232      endDate = null;
233      jobId = null;
234      taskState = null;
235      if ($("[value='UserDate']").is(":checked")) {
236        startDate = $('#UserStart').val();
237        endDate = $('#UserEnd').val();
238      }
239      if ($("[value='JobName']").is(':checked')) {
240        jobId = $('#JobNames').val();
241      }
242      if ($("[value='TaskState']").is(':checked')) {
243        taskState = $('#TaskState').val();
244      }
245      @ExceptionHelper.UserExceptions("TasksContainer", Url.Action("TaskExceptions", "ExceptionData"), "limit", "selectedUser", "startDate", "endDate", "jobId", "taskState")
246      @ChartHelper.TasksForUser("TasksContainer", "Task", Url.Action("UserTask", "ChartData"), "RefreshUser", "selectedUser", "limit", "startDate", "endDate", "jobId", "taskState", "pageNumber")
247      pageNumber = null;
248    }
249
250    @ChartHelper.ResizeTasks("Task")
251    @ExceptionHelper.ScrollToException()
252
253    //Task Overview
254    $("#TaskUserList").change(function () {
255      RefreshTask();
256    });
257
258    function RefreshTask() {
259      selectedUser = $("#TaskUserList").val();
260      startDate = $('#TaskStart').val();
261      endDate = $('#TaskEnd').val();
262      @AdminHelper.UserTaskStats("TaskStatsContainer", Url.Action("TaskStats", "AdminData"), "selectedUser", "startDate", "endDate")
263    }
264
265    //Slave Overview
266    function RefreshSlave() {
267      selectedUser = null;
268      limit = $("#SlaveLimit").val();
269      startDate = null;
270      endDate = null;
271      if ($("[value='SlaveDate']").is(":checked")) {
272        startDate = $('#SlaveStart').val();
273        endDate = $('#SlaveEnd').val();
274      }
275      if ($("[value='User']").is(':checked')) {
276        selectedUser = $('#SlaveUserList').val();
277      }
278      @ChartHelper.SlaveInfoChart("SlavesContainer", Url.Action("SlaveInfo", "ChartData"), "limit", "startDate", "endDate", "selectedUser", "RefreshSlave", "pageNumber")
279      pageNumber = null;
280    }
281
282    @ChartHelper.ResizeSlaves()
283
284    //Exceptions Overview
285    $("#ExceptionSlaveList").change(function () {
286      RefreshException();
287    });
288
289    function RefreshException() {
290      selectedSlave = null;
291      limit = $("#ExceptionLimit").val();
292      startDate = null;
293      endDate = null;
294      if ($("[value='ExceptionDate']").is(":checked")) {
295        startDate = $('#ExceptionStart').val();
296        endDate = $('#ExceptionEnd').val();
297      }
298      if ($("[value='ExceptionSlave']").is(':checked')) {
299        selectedSlave = $('#Slaves').val();
300      }
301      @ExceptionHelper.UserExceptions("ExceptionContainer", Url.Action("TaskExceptions", "ExceptionData"), "limit", null, "startDate", "endDate", null, null)
302      @ExceptionHelper.ShowErrors("ExceptionContainer")
303      @ExceptionHelper.ErrorsOnSlaves("ExceptionContainer",Url.Action("SlaveExceptions", "ExceptionData"),"limit","startDate", "endDate","selectedSlave")
304    }
305    @*@ExceptionHelper.ShowSlaveInfo(Url.Action("SlaveInfo", "ChartData"),"limit","startDate","endDate")*@
306  </script>
307}
Note: See TracBrowser for help on using the repository browser.