Log.js 1.14 KB
Ext.define('App.controller.Log', {
    extend : 'Ext.app.Controller',
    
    init : function() {
 
    	this.control({
    		   'toolbar  button[action=loadLog]' : {
                   click : this.onLoadLog
               }
        });
    },
    onLoadLog :function (btn, e, options) {
	
   	 
 	   var form = Ext.getCmp('formlog');
 	   
 	   if (form!=null) {
 	   
 		 
    	
    	
    	 Ext.Ajax.request({
        	  method: "GET",
              url: 'api/log/show',
              headers: {
                  'Accept': 'application/json',
                  'Content-Type': 'application/json'
              },
         
              success: function(response, opts) {
             	 
             	var result = Ext.JSON.decode(response.responseText);
             	var str="";
               	for(var i in result){
               		 str=str+result[i]+"\n";
               	 } 
               	Ext.getCmp('logResult').setValue(str);
                form.unmask();

    	 }, failure: function(response, opts) {
    		 	form.unmask();
       	  		Ext.Msg.alert('Failure', 'Ошибка связи с сервером');
    	 	}
         });
 	   }
    }
 	   
});