File size: 2,630 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<script>
Ext.onReady(main);
var infoGrid;
var store;

function main()
{
    store = new Ext.data.Store( {
        autoLoad: true,
        proxy: new Ext.data.HttpProxy({
            url: '../adminProxy/getMaintenanceInfo',
            method: 'POST'
        }),
        baseParams : { request : 'info'},
        reader : new Ext.data.JsonReader( {
            root : 'info',
            fields : [
                {name : 'client_id'},
                {name : 'name'},
                {name : 'value'},
                {name : 'value_ok'},
                {name : 'option'}
            ]
        })
    });

    infoGrid = new Ext.grid.GridPanel({
        title : 'Maintenance',
        stripeRows : true,
        autoHeight : true,
        width : 600,
        enableColumnHide: false,
        enableColumnResize: false,
        enableHdMenu: false,
        disableSelection: true,
        trackMouseOver:false,
        columnLines: true,
        loadMask: true,
        store : store,
        columns : [
            {
                id : 'client_id',
                header : 'Client ID',
                width : 160,
                sortable : false,
                dataIndex : 'client_id'
            }, {
                id : 'name',
                header : 'Application',
                width : 250,
                sortable : false,
                dataIndex : 'name'
            }, {
                header : 'Status',
                width : 100,
                sortable : false,
                dataIndex : 'value',
                renderer: function(val, el, row){
                    if(row.data.value_ok) {
                        return '<font color="green">'+val+'</font>';
                    } else {
                        return '<font color="red">'+val+'</font>';
                    }
                }
            }, {
                header : '',
                width : 100,
                sortable : false,
                dataIndex : 'option',
                renderer: function(val, el, row){
                    return '<a href="#" onclick="'+val.action+'(); return false;">'+val.label+'</a>';
                }
            }
        ]
    });

    infoGrid.render(document.body)
}

function doRegisterPMDesignerClient()
{
    Ext.Ajax.request({
        url: '../adminProxy/registerPMDesignerClient',
        method: 'POST',
        params: {},
        waitMsg: 'Registering, please wait!',
        success: function(r, o){
            var resp = Ext.util.JSON.decode(r.responseText);

            console.log(resp);
            store.reload();
        }
    });

    return false;
}

</script>