コード例 #1
0
        public override void Execute()
        {
            WriteLiteral("\r\n");



            #line 13 "..\..\Dashboard\Pages\Html\Logging.cshtml"

            Layout = new LayoutPage("Logs");
            var loggerContext = new LoggerContext();

            string jobId = Util.GetFileNameFromURL(RequestPath);

            if (!int.TryParse(Query("from"), out int from) ||
                !int.TryParse(Query("count"), out int perPage))
            {
                from    = 0;
                perPage = 10;
            }

            var totalLogs = loggerContext.GetCounterValue(Storage.GetConnection(), jobId);
            var jobLogs   = loggerContext.GetLogMessagesByJobId(Storage.GetConnection(), jobId, ++from, perPage);

            var pager = new Pager(from, perPage, totalLogs);



            #line default
            #line hidden
            WriteLiteral("\r\n<div class=\"row\">\r\n    <div class=\"col-md-3\">\r\n        ");



            #line 34 "..\..\Dashboard\Pages\Html\Logging.cshtml"
            Write(Html.JobsSidebar());


            #line default
            #line hidden
            WriteLiteral("\r\n    </div>\r\n    <div class=\"col-md-9\">\r\n        <h1 class=\"page-header\">Logs</h" +
                         "1>\r\n");



            #line 38 "..\..\Dashboard\Pages\Html\Logging.cshtml"

            if (!jobLogs.Any())
            {
            #line default
            #line hidden
                WriteLiteral("                <div class=\"logs\">\r\n                    There are no logs found y" +
                             "et.\r\n                </div>\r\n");



            #line 44 "..\..\Dashboard\Pages\Html\Logging.cshtml"
            }
            else
            {
            #line default
            #line hidden
                WriteLiteral("                <div class=\"table-responsive\">\r\n                    ");



            #line 48 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                Write(Html.PerPageSelector(pager));


            #line default
            #line hidden
                WriteLiteral(@"
                    <table class=""table"">
                        <thead>
                            <tr>
                                <th class=""min-width"">Log Level</th>
                                <th>Message</th>
                                <th class=""min-width align-right"">Date</th>
                            </tr>
                        </thead>
                        <tbody>
");



            #line 58 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                foreach (var log in jobLogs)
                {
                    var logColor = Util.GetColorByLogLevel(log.LogLevel);



            #line default
            #line hidden
                    WriteLiteral("                                <tr class=\"js-jobs-list-row\">\r\n                  " +
                                 "                  <td class=\"min-width\">\r\n                                      " +
                                 "  <span class=\"badge\" style=\"background-color: rgba(");



            #line 64 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(logColor.R);


            #line default
            #line hidden
                    WriteLiteral(", ");



            #line 64 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(logColor.G);


            #line default
            #line hidden
                    WriteLiteral(", ");



            #line 64 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(logColor.B);


            #line default
            #line hidden
                    WriteLiteral(", ");



            #line 64 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(logColor.A);


            #line default
            #line hidden
                    WriteLiteral(");\">\r\n                                            <span class=\"text-center\" style" +
                                 "=\"text-decoration: none;\">");



            #line 65 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(log.LogLevel);


            #line default
            #line hidden
                    WriteLiteral("</span>\r\n                                        </span>\r\n                       " +
                                 "             </td>\r\n                                    <td>");



            #line 68 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(log.Message);


            #line default
            #line hidden
                    WriteLiteral("</td>\r\n                                    <td class=\"min-width align-right\">");



            #line 69 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                    Write(Html.RelativeTime(@log.DateCreation));


            #line default
            #line hidden
                    WriteLiteral("</td>\r\n                                </tr>\r\n");



            #line 71 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                        </tbody>\r\n                    </table>\r\n                 " +
                             "   ");



            #line 74 "..\..\Dashboard\Pages\Html\Logging.cshtml"
                Write(Html.Paginator(pager));


            #line default
            #line hidden
                WriteLiteral("\r\n                </div>\r\n");



            #line 76 "..\..\Dashboard\Pages\Html\Logging.cshtml"
            }



            #line default
            #line hidden
            WriteLiteral("    </div>\r\n</div>");
        }