Skip to content

Commit

Permalink
Improve bot workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jun 8, 2018
1 parent 5c6d060 commit 87cfb21
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
36 changes: 24 additions & 12 deletions lhc_web/design/defaulttheme/js/lh.js
Original file line number Diff line number Diff line change
Expand Up @@ -3161,19 +3161,20 @@ function lh(){
'class': 'message-row pending-storage pending-storage-bot',
text: 'Processing...'
}).appendTo(messageBlock);
var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

this.syncroRequestSend = true;
clearTimeout(this.userTimeout);

$.get(this.wwwDir + 'genericbot/buttonclicked/'+this.chat_id+'/'+this.hash,{payload: payload, id : id, processed : (typeof notHide === 'undefined' || notHide == false)},function(data){
if (typeof notHide === 'undefined' || notHide === false){
$('.meta-message-'+id).remove();
}

processing.remove();

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

lhinst.forceBottomScroll = true;
lhinst.syncroRequestSend = false;
lhinst.syncusercall();
Expand All @@ -3194,19 +3195,19 @@ function lh(){
text: 'Processing...'
}).appendTo(messageBlock);

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

this.syncroRequestSend = true;
clearTimeout(this.userTimeout);

$.get(this.wwwDir + 'genericbot/buttonclicked/'+this.chat_id+'/'+this.hash+'/(type)/editgenericstep',{payload : step,id : id},function(data){

processing.remove();

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

lhinst.forceBottomScroll = true;
lhinst.syncroRequestSend = false;
lhinst.syncusercall();

}).fail(function() {
lhinst.syncroRequestSend = false;
lhinst.syncusercall();
Expand All @@ -3229,15 +3230,18 @@ function lh(){
text: 'Processing...'
}).appendTo(messageBlock);

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

this.syncroRequestSend = true;
clearTimeout(this.userTimeout);

$.get(this.wwwDir + 'genericbot/buttonclicked/'+this.chat_id+'/'+this.hash+'/(type)/triggerclicked',{payload: payload, id : id, processed : (typeof notHide === 'undefined' || notHide == false)},function(data){
$.get(this.wwwDir + 'genericbot/buttonclicked/'+this.chat_id+'/'+this.hash+'/(type)/triggerclicked',{payload: payload, id : id, processed : (typeof notHide === 'undefined' || notHide == false)},function(data) {
if (typeof notHide === 'undefined' || notHide === false){
$('.meta-message-'+id).remove();
}

processing.remove();

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

Expand Down Expand Up @@ -3267,15 +3271,18 @@ function lh(){
text: 'Processing...'
}).appendTo(messageBlock);

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

lhinst.syncroRequestSend = true;
clearTimeout(this.userTimeout);

$.get(this.wwwDir + 'genericbot/updatebuttonclicked/'+this.chat_id+'/'+this.hash,{payload: payload, id : id, processed : (typeof notHide === 'undefined' || notHide == false) },function(data){
if (typeof notHide === 'undefined' || notHide === false){
$('.meta-message-'+id).remove();
}

processing.remove();

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

Expand All @@ -3296,18 +3303,23 @@ function lh(){
btn.attr("disabled","disabled");
btn.text("Processing...");
}

var messageBlock = $('#messagesBlock');
var processing = jQuery('<div/>', {
'class': 'message-row pending-storage pending-storage-bot',
text: 'Processing...'
}).appendTo($('#messagesBlock'));
}).appendTo(messageBlock);

var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

if ($('#generic_list-'+id).val() != '') {
this.syncroRequestSend = true;
clearTimeout(this.userTimeout);
$.get(this.wwwDir + 'genericbot/buttonclicked/'+this.chat_id+'/'+this.hash+'/(type)/valueclicked',{payload: $('#id_generic_list-'+id).val(), id : id},function(data){
$('.meta-message-'+id).remove();

processing.remove();
var scrollHeight = messageBlock.prop("scrollHeight");
messageBlock.stop(true,false).animate({ scrollTop: scrollHeight }, 500);

lhinst.forceBottomScroll = true;
lhinst.syncroRequestSend = false;
Expand Down
Loading

0 comments on commit 87cfb21

Please sign in to comment.