<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RebootLog.aspx.cs" Inherits="GigaTech.CMS.Web.Apps.DeviceSystem.RebootLog" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>


</head>
     <script language="javascript">
         Ext.onReady(function () {
             Ext.QuickTips.init();

             var gridStore = Ext.create('Ext.data.Store', {
                 pageSize: 50,
                 remoteSort: true,
                 autoLoad: true,
                 fields: ['Ident', 'MAC', 'Code', 'SubCode', 'ID', 'SubID', 'IP', 'AlarmDesc', 'AlarmDateTime', 'Name', 'Location', 'Parents', 'Processed', 'Porcesser', 'ProcessDateTime', 'ProcessDesc'],
                 proxy: {
                     type: 'ajax',
                     url: 'Handler.ashx?action=GetGridRebootData',
                     reader: {
                         type: 'json',
                         root: 'items',
                         totalProperty: 'totalCount'
                     },
                     simpleSortMode: true
                 },
                 sorters: [{
                     property: "AlarmDateTime",
                     direction: "DESC"
                 }]
             });

             var grid = Ext.create('Ext.grid.Panel', {
                 id:'AlarmGrid',
                region: 'center',
                store: gridStore,
                tbar: [
                    {
                        text: 'Export to CSV',
                        cls: 'x-btn-default-small',
                        border: 1,
                        style: {
                            borderColor: 'gray',
                            borderStyle: 'solid'
                        },
                        handler: function () {
                            try {
                                parent.CMSClientDownload("/Apps/DeviceSystem/ImportExport.ashx?action=ExportCSV&tableName=system_device_reboot_log");
                            } catch (e) {
                                window.open("ImportExport.ashx?action=ExportCSV&tableName=system_device_reboot_log", "CMSDownloadIFrame");
                            }
                            //window.open("ImportExport.ashx?action=ExportCSV&tableName=system_device_reboot_log", "CMSDownloadIFrame");
                        }
                    }
                ],
                columns: [
                    { text: '<%=GetGlobalResourceObject("CMSResource", "DeviceName")%>', dataIndex: 'Name', flex: 1, sortable: false },
                    { text: '<%=GetGlobalResourceObject("CMSResource", "DeviceLocation")%>', dataIndex: 'Location', flex: 1, sortable: false },
                    { text: '<%=GetGlobalResourceObject("CMSResource", "DeviceID")%>', dataIndex: 'ID', width: 80},
                    { text: '<%=GetGlobalResourceObject("CMSResource", "IPAddress")%>', dataIndex: 'IP', width: 90 },
                    { text: '時間', dataIndex: 'AlarmDateTime', width: 150 }
                ],
                dockedItems: [{
                    xtype: 'pagingtoolbar',
                    store: gridStore,
                    dock: 'bottom',
                    displayInfo: true
                }]
            });

            Ext.create('Ext.container.Viewport', {
                layout: {
                    type: 'border'
                },
                items: [grid]
            });

         });

    </script>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
        <iframe id="CMSDownloadIFrame" name="CMSDownloadIFrame" style="width:0px;height:0px"></iframe>
    </form>
</body>
</html>

