2015-05-28 12:56:27 +03:00
/ * T h i s c l a s s d e f i n e s t h e " C l u s t e r l o g " t a b o f t h e b o t t o m s t a t u s p a n e l
* A log entry is a timestamp associated with an action on a cluster
* /
2015-05-27 17:23:37 +03:00
Ext . define ( 'PVE.dc.Log' , {
extend : 'Ext.grid.GridPanel' ,
alias : [ 'widget.pveClusterLog' ] ,
2021-01-19 19:39:15 +03:00
initComponent : function ( ) {
2021-05-18 15:45:55 +03:00
let me = this ;
2015-05-27 17:23:37 +03:00
2021-05-18 15:45:55 +03:00
let logstore = Ext . create ( 'Proxmox.data.UpdateStore' , {
2015-05-27 17:23:37 +03:00
storeid : 'pve-cluster-log' ,
2017-12-11 16:46:51 +03:00
model : 'proxmox-cluster-log' ,
2015-05-27 17:23:37 +03:00
proxy : {
2017-12-11 16:46:51 +03:00
type : 'proxmox' ,
2021-01-19 19:31:03 +03:00
url : '/api2/json/cluster/log' ,
} ,
2015-05-27 17:23:37 +03:00
} ) ;
2021-05-18 15:45:55 +03:00
let store = Ext . create ( 'Proxmox.data.DiffStore' , {
2015-05-27 17:23:37 +03:00
rstore : logstore ,
2021-01-19 19:31:03 +03:00
appendAtStart : true ,
2015-05-27 17:23:37 +03:00
} ) ;
Ext . apply ( me , {
store : store ,
stateful : false ,
viewConfig : {
trackOver : false ,
2015-08-18 15:43:32 +03:00
stripeRows : true ,
2015-05-27 17:23:37 +03:00
getRowClass : function ( record , index ) {
2021-05-18 15:45:55 +03:00
let pri = record . get ( 'pri' ) ;
2015-05-27 17:23:37 +03:00
if ( pri && pri <= 3 ) {
2018-01-15 17:18:01 +03:00
return "proxmox-invalid-row" ;
2015-05-27 17:23:37 +03:00
}
2021-05-18 15:45:55 +03:00
return undefined ;
2021-01-19 19:31:03 +03:00
} ,
2015-05-27 17:23:37 +03:00
} ,
sortableColumns : false ,
columns : [
2021-01-19 19:29:55 +03:00
{
header : gettext ( "Time" ) ,
2015-05-27 17:23:37 +03:00
dataIndex : 'time' ,
2015-06-15 16:31:12 +03:00
width : 150 ,
2021-01-19 19:29:55 +03:00
renderer : function ( value ) {
return Ext . Date . format ( value , "M d H:i:s" ) ;
2021-01-19 19:31:03 +03:00
} ,
2015-05-27 17:23:37 +03:00
} ,
2021-01-19 19:29:55 +03:00
{
header : gettext ( "Node" ) ,
2015-05-27 17:23:37 +03:00
dataIndex : 'node' ,
2021-01-19 19:31:03 +03:00
width : 150 ,
2015-05-27 17:23:37 +03:00
} ,
2021-01-19 19:29:55 +03:00
{
header : gettext ( "Service" ) ,
2015-05-27 17:23:37 +03:00
dataIndex : 'tag' ,
2021-01-19 19:31:03 +03:00
width : 100 ,
2015-05-27 17:23:37 +03:00
} ,
2021-01-19 19:29:55 +03:00
{
header : "PID" ,
2015-05-27 17:23:37 +03:00
dataIndex : 'pid' ,
2021-01-19 19:31:03 +03:00
width : 100 ,
2015-05-27 17:23:37 +03:00
} ,
2021-01-19 19:29:55 +03:00
{
header : gettext ( "User name" ) ,
2015-05-27 17:23:37 +03:00
dataIndex : 'user' ,
2020-04-30 17:04:19 +03:00
renderer : Ext . String . htmlEncode ,
2021-01-19 19:31:03 +03:00
width : 150 ,
2015-05-27 17:23:37 +03:00
} ,
2021-01-19 19:29:55 +03:00
{
header : gettext ( "Severity" ) ,
2015-05-27 17:23:37 +03:00
dataIndex : 'pri' ,
renderer : PVE . Utils . render _serverity ,
2021-01-19 19:31:03 +03:00
width : 100 ,
2015-05-27 17:23:37 +03:00
} ,
2021-01-19 19:29:55 +03:00
{
header : gettext ( "Message" ) ,
2015-05-27 17:23:37 +03:00
dataIndex : 'msg' ,
2020-04-30 17:04:19 +03:00
renderer : Ext . String . htmlEncode ,
2021-01-19 19:31:03 +03:00
flex : 1 ,
} ,
2015-05-27 17:23:37 +03:00
] ,
listeners : {
2020-04-09 17:45:22 +03:00
activate : ( ) => logstore . startUpdate ( ) ,
deactivate : ( ) => logstore . stopUpdate ( ) ,
destroy : ( ) => logstore . stopUpdate ( ) ,
2021-01-19 19:31:03 +03:00
} ,
2015-05-27 17:23:37 +03:00
} ) ;
me . callParent ( ) ;
2021-01-19 19:31:03 +03:00
} ,
2017-12-11 14:05:39 +03:00
} ) ;