Skip to content

Commit

Permalink
Merge commit 'b299a784e4a80013c8a8a0abed22e24bdc02734e'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Panico committed Oct 31, 2023
2 parents 62bcdf0 + b299a78 commit eeebbf1
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 60 deletions.
13 changes: 10 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,20 @@ export class CdsActionReplyComponent implements OnInit {
} catch (error) {
this.logger.log("error ", error);
}
this.initialize();
// this.initialize();
}



// ngOnChanges(changes: SimpleChanges): void {
// console.log('ActionReplyComponent ngOnChanges:: ', this.action);
// if(this.action && this.intentSelected)this.initialize();
// }
/**
*
* @param changes
* IMPORTANT! serve per aggiornare il dettaglio della action nel pannello
*/
ngOnChanges(changes: SimpleChanges): void {
console.log('ActionReplyComponent ngOnChanges:: ', changes);
if(this.action && this.intentSelected) this.initialize();
}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
[text]="response.text"
[minRow]="1"
popoverVerticalAlign="above"
(blur)="onBlur($event)"
(changeTextarea)="onChangeTextarea($event)">
</cds-textarea>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ export class CdsActionReplyFrameComponent implements OnInit {
onChangeTextarea(text:string) {
if(!this.previewMode){
this.response.text = text;
this.changeActionReply.emit();
// this.changeActionReply.emit();
}
}

onBlur(event){
console.log('[ACTION REPLY TEXT] onBlur', event);
this.changeActionReply.emit();
}


/** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ export class CdsActionReplyRedirectComponent implements OnInit {
onChangeTextarea(text:string) {
if(!this.previewMode){
this.metadata.src = text;
this.changeActionReply.emit();
// this.changeActionReply.emit();
}
}

onBlur(event){
console.log('[ACTION REPLY TEXT] onBlur', event);
this.changeActionReply.emit();
}

/** onButtonToogleChange */
onButtonToogleChange(event){
console.log('onButtonToogleChange::: event', event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class CdsActionReplyTextComponent implements OnInit {
}

onBlur(event){
console.log('[ACTION REPLY TEXT] onBlur', event);
// console.log('[ACTION REPLY TEXT] onBlur', event);
this.changeActionReply.emit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export class CdsCanvasComponent implements OnInit {
@ViewChild('drawer_of_items_to_zoom_and_drag', { static: false }) drawerOfItemsToZoomAndDrag: ElementRef;

@Output() testItOut = new EventEmitter();
// @Output() closePanelWidget = new EventEmitter();

@Input() onHeaderTestItOut: Observable<Intent | boolean>

id_faq_kb: string;
Expand Down Expand Up @@ -117,9 +115,6 @@ export class CdsCanvasComponent implements OnInit {
this.stageService.setDrawer();
this.connectorService.initializeConnectors();
this.addEventListener();
// setTimeout(()=> {
// let newPos = scaleAndcenterStageOnCenterPosition(this.listOfIntents)
// }, 1000)
}

private async setStartIntent(){
Expand All @@ -135,8 +130,6 @@ export class CdsCanvasComponent implements OnInit {
if(startElement){
this.stageService.centerStageOnHorizontalPosition(startElement);
}
// let startElement = document.getElementById(intentSelected.intent_id);
// }
}
}

Expand Down Expand Up @@ -236,12 +229,9 @@ export class CdsCanvasComponent implements OnInit {
private initListOfIntents() {
this.listOfIntents.forEach(intent => {
if (intent.actions) {
intent.actions = intent.actions.filter(obj => obj !== null); //patch if action is null
intent.actions = intent.actions.filter(obj => obj !== null);
}
});
// this.updatePanelIntentList = !this.updatePanelIntentList;
/* variabile booleana aggiunta per far scattare l'onchange nei componenti importati dalla dashboard
* ngOnChanges funziona bene solo sugli @import degli elementi primitivi!!! */
this.refreshIntents();
}

Expand All @@ -250,10 +240,10 @@ export class CdsCanvasComponent implements OnInit {
* create connectors
*/
private refreshIntents() {
setTimeout(() => {
//setTimeout(() => {
this.setDragAndListnerEventToElements();
this.connectorService.createConnectors(this.listOfIntents);
}, 0);
//}, 0);
}

// ---------------------------------------------------------
Expand Down
76 changes: 41 additions & 35 deletions src/app/chatbot-design-studio/services/connector.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,39 +77,13 @@ export class ConnectorService {
*
*/
public createConnectors(intents){
this.logger.log('[CONNECTOR-SERV] -----> createConnectors::: ', intents);
// this.logger.log('[CONNECTOR-SERV] -----> createConnectors::: ', intents);
intents.forEach(intent => {
this.createConnectorsOfIntent(intent);
});
}

// /**
// * createConnectorFromId
// * @param fromId
// * @param toId
// * @returns
// */
// public async createConnectorFromId_old(fromId, toId, save=false, undo=false) {
// this.logger.log('[CONNECTOR-SERV] createConnectorFromId fromId ', fromId, ' toId ', toId);
// const connectorID = fromId+'/'+toId;
// // let connector = await isElementOnTheStage(connectorID); // sync
// const isConnector = document.getElementById(connectorID);
// if (isConnector) {
// this.logger.log('[CONNECTOR-SERV] il connettore esiste già', connectorID);
// // this.deleteConnector(connectorID);
// // return true;
// }
// let isOnTheStageFrom = await isElementOnTheStage(fromId); // sync
// this.logger.log('[CONNECTOR-SERV] isOnTheStageFrom', isOnTheStageFrom);
// let isOnTheStageTo = await isElementOnTheStage(toId); // sync
// this.logger.log('[CONNECTOR-SERV] isOnTheStageFrom', isOnTheStageFrom);
// if(isOnTheStageFrom && isOnTheStageTo){
// const result = await this.tiledeskConnectors.createConnectorFromId(fromId, toId, save, undo);
// return result;
// } else {
// return false;
// }
// }


/**
* createConnectorFromId
Expand All @@ -127,13 +101,22 @@ export class ConnectorService {
this.tiledeskConnectors.updateConnectorsOutOfItent(connectorID);
return true;
}
let isOnTheStageFrom = await isElementOnTheStage(fromId); // sync
this.logger.log('[CONNECTOR-SERV] isOnTheStageFrom', isOnTheStageFrom);
let isOnTheStageTo = await isElementOnTheStage(toId); // sync
this.logger.log('[CONNECTOR-SERV] isOnTheStageFrom', isOnTheStageFrom);
if(isOnTheStageFrom && isOnTheStageTo){
const fromEle = document.getElementById(fromId);
const toEle = document.getElementById(toId);

let fromEle = document.getElementById(fromId);
if(!fromEle) {
fromEle = await isElementOnTheStage(fromId); // sync
this.logger.log('[CONNECTOR-SERV] isOnTheStageFrom', fromEle);
}

let toEle = document.getElementById(toId);
if(!toEle) {
toEle = await isElementOnTheStage(toId); // sync
this.logger.log('[CONNECTOR-SERV] isOnTheStageFrom', toEle);
}

if(fromEle && toEle){
// const fromEle = document.getElementById(fromId);
// const toEle = document.getElementById(toId);
const fromPoint = this.tiledeskConnectors.elementLogicCenter(fromEle);
const toPoint = this.tiledeskConnectors.elementLogicTopLeft(toEle);
this.tiledeskConnectors.createConnector(fromId, toId, fromPoint, toPoint, save, undo);
Expand All @@ -144,6 +127,29 @@ export class ConnectorService {
}

























/**
* refreshConnectorsOfIntent
* @param intent
Expand Down
2 changes: 1 addition & 1 deletion src/app/chatbot-design-studio/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export function convertJsonToArray(jsonData:any){
}

export async function isElementOnTheStage(elementId:string): Promise<any>{
// if(document.getElementById(elementId)) return true;

return new Promise((resolve) => {
let intervalId = setInterval(async () => {
const result = document.getElementById(elementId);
Expand Down
4 changes: 4 additions & 0 deletions src/assets/js/tiledesk-stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ export class TiledeskStage {
// console.log("tcmd:", tcmd);
// console.log("transform:", tcmd);

this.scale = 1;
this.tx = newX;
this.ty = newY;

setTimeout(() => {
this.drawer.style.removeProperty('transition');
// remove class animation
Expand Down

0 comments on commit eeebbf1

Please sign in to comment.