Skip to content

Commit

Permalink
Merge branch 'DS-dario'
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
dariodepa75 committed Nov 15, 2023
2 parents 6634499 + 4f24e3c commit 000471d
Show file tree
Hide file tree
Showing 13 changed files with 13,643 additions and 69 deletions.
13,639 changes: 13,603 additions & 36 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function uploadFactory(http: HttpClient, appConfig: AppConfigService, app
BotsBaseComponent,
UnauthorizedComponent,
HomeComponent,
NotFoundComponent,
NotFoundComponent
],
imports: [
// TooltipModule.forRoot(CutomTooltipOptions as TooltipOptions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class CdsActionJsonConditionComponent implements OnInit {
}

onChangeExpression(event){
this.connectorService.updateConnector(this.intentSelected.intent_id);
// this.connectorService.updateConnector(this.intentSelected.intent_id);
this.updateAndSaveAction.emit({type: TYPE_UPDATE_ACTION.ACTION, element: this.action});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export class CdsActionReplyComponent implements OnInit {
private initialize() {
this.openCardButton = false;
this.arrayResponses = [];

this.intentName = '';
this.intentNameResult = true;
this.textGrabbing = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class CdsActionReplyTextComponent implements OnInit {
this.checkButtons();
this.buttons = this.intentService.patchButtons(this.buttons, this.idAction);
this.idIntent = this.idAction.split('/')[0];

if(this.response && this.response._tdJSONCondition && this.response._tdJSONCondition.conditions.length > 0){
this.filterConditionExist = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>

<div #drawer_of_items_to_zoom_and_drag id="tds_drawer" class="tds-drag-drawer box-right-content">
<cds-intent *ngFor="let intent of listOfIntents"
<cds-intent *ngFor="let intent of listOfIntents"
[id]="intent.intent_id"
class="panel-intent tds_input_block tds_draggable"
[style.top.px]="getIntentPosition(intent.intent_id).y"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class CdsCanvasComponent implements OnInit {
IS_OPEN_PANEL_CONNECTOR_MENU: boolean = false;
mousePosition: any;
connectorSelected: any;

private logger: LoggerService = LoggerInstance.getInstance()
constructor(
private intentService: IntentService,
Expand Down Expand Up @@ -596,7 +596,7 @@ export class CdsCanvasComponent implements OnInit {
*/
private async updateIntent(intent, time=0, undo=false) {
this.logger.log('[CDS-CANVAS] updateIntent: ');
this.connectorService.updateConnector(intent.intent_id);
// this.connectorService.updateConnector(intent.intent_id);
const response = await this.intentService.onUpdateIntentWithTimeout(intent, time, undo);
if (response) {
this.logger.log('[CDS-CANVAS] OK: intent aggiornato con successo sul server', this.intentSelected);
Expand Down Expand Up @@ -666,7 +666,7 @@ export class CdsCanvasComponent implements OnInit {
this.updateIntent(intentPrevious, 0, false);
setTimeout(()=> {
// ATTENZIONE!!! trovare il modo di refreshare i connettori SOLO quando la action viene eliminata fisicamente dallo stage!!!
this.connectorService.updateConnector(intentPrevious.intent_id);
// this.connectorService.updateConnector(intentPrevious.intent_id);
}, 0);
}
}
Expand Down Expand Up @@ -1062,4 +1062,5 @@ export class CdsCanvasComponent implements OnInit {
}
}
// --------------------------------------------------------- //

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="panel-intent-content tds_draggable" [class.isStart]="isStart" [id]="'intent-content-'+ intent?.intent_id">
<div #resizeElement class="panel-intent-content tds_draggable" [class.isStart]="isStart" [id]="'intent-content-'+ intent?.intent_id">

<cds-panel-intent-controls
[isInternalIntent]="isInternalIntent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
cursor: grab;
position: relative;
margin: 0px;

background-color: var(--intent-background);
padding: var(--base-padding-preview);
border-radius: var(--base-border-radius-preview);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges, ViewChild, ElementRef, OnChanges, OnDestroy } from '@angular/core';
import { Renderer2, Component, OnInit, Input, Output, EventEmitter, SimpleChanges, ViewChild, ElementRef, OnChanges, OnDestroy } from '@angular/core';
import { Form, Intent } from 'src/app/models/intent-model';
import { Action, ActionIntentConnected } from 'src/app/models/action-model';
import { Subject, Subscription } from 'rxjs';
Expand Down Expand Up @@ -54,6 +54,7 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
@Output() testItOut = new EventEmitter<Intent>();
@Output() deleteIntent = new EventEmitter();

@ViewChild('resizeElement', { static: false }) resizeElement: ElementRef;
@ViewChild('openActionMenuBtn', { static: false }) openActionMenuBtnRef: ElementRef;

subscriptions: Array<{ key: string, value: Subscription }> = [];
Expand Down Expand Up @@ -95,7 +96,8 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
private connectorService: ConnectorService,
private stageService: StageService,
private controllerService: ControllerService,
private elemenRef: ElementRef
private elemenRef: ElementRef,
private renderer: Renderer2
) {
this.initSubscriptions()
}
Expand Down Expand Up @@ -233,6 +235,7 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
}

ngOnChanges(changes: SimpleChanges): void {

// Fixed bug where an empty intent's action placeholder remains visible if an action is dragged from the left action menu
this.logger.log('[CDS-INTENT] hideActionPlaceholderOfActionPanel (dragged from sx panel) ', this.hideActionPlaceholderOfActionPanel)
if (this.hideActionPlaceholderOfActionPanel === false) {
Expand All @@ -250,6 +253,22 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
}
}


ngAfterViewInit() {
const resizeObserver = new ResizeObserver(entries => {
for (const entry of entries) {
const nuovaAltezza = entry.contentRect.height;
// console.log('Nuova altezza del div:', nuovaAltezza);
this.connectorService.updateConnector(this.intent.intent_id);
}
});
const elementoDom = this.resizeElement.nativeElement;
resizeObserver.observe(elementoDom);
// Per smettere di osservare, puoi chiamare resizeObserver.disconnect();
// nel lifecycle hook ngOnDestroy o in un'altra posizione appropriata.
}


ngOnDestroy() {
this.unsubscribe();
}
Expand Down Expand Up @@ -628,7 +647,7 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
this.logger.log("[CDS-INTENT] onDropAction sto spostando una action all'interno dello stesso intent: ", event, this.intent.actions);
this.controllerService.closeAllPanels();
this.intentService.setIntentSelected(this.intent.intent_id);
this.connectorService.updateConnector(this.intent.intent_id);
// this.connectorService.updateConnector(this.intent.intent_id);
const response = await this.intentService.onUpdateIntentWithTimeout(this.intent);
if (response) {
// this.connectorService.updateConnector(this.intent.intent_id);
Expand Down Expand Up @@ -681,7 +700,7 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
}
setTimeout(()=> {
// ATTENZIONE!!! trovare il modo di refreshare i connettori SOLO quando la action viene eliminata fisicamente dallo stage!!!
this.connectorService.updateConnector(this.intent.intent_id);
// this.connectorService.updateConnector(this.intent.intent_id);
}, 0);
}
this.setActionIntent();
Expand Down Expand Up @@ -775,6 +794,4 @@ export class CdsIntentComponent implements OnInit, OnDestroy, OnChanges {
/** ******************************
* intent controls options: END
* ****************************** */


}
14 changes: 7 additions & 7 deletions src/app/chatbot-design-studio/services/intent.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export class IntentService {
});
currentIntent.actions.splice(event.currentIndex, 0, newAction);
this.behaviorIntent.next(currentIntent);
this.connectorService.updateConnector(currentIntent.intent_id);
// this.connectorService.updateConnector(currentIntent.intent_id);
this.onUpdateIntentWithTimeout(currentIntent, 0, true);
// setTimeout(async () => {
// const responseCurrentIntent = await this.onUpdateIntentWithTimeout(currentIntent, 0, true);
Expand Down Expand Up @@ -633,8 +633,8 @@ export class IntentService {
// console.log('moveActionBetweenDifferentIntents: ', event, this.listOfIntents, currentIntentId, currentIntent, previousIntent);
currentIntent.actions.splice(event.currentIndex, 0, action);
previousIntent.actions.splice(event.previousIndex, 1);
this.connectorService.updateConnector(currentIntent.intent_id);
this.connectorService.updateConnector(previousIntent.intent_id);
// this.connectorService.updateConnector(currentIntent.intent_id);
// this.connectorService.updateConnector(previousIntent.intent_id);
this.connectorService.deleteConnectorsFromActionByActionId(action._tdActionId);
const responsePreviousIntent = this.onUpdateIntentWithTimeout(previousIntent, 0, false);
if(responsePreviousIntent){
Expand Down Expand Up @@ -779,7 +779,7 @@ export class IntentService {
return intent;
});
this.refreshIntent(intentToUpdate);
this.connectorService.updateConnector(intentToUpdate.intent_id);
// this.connectorService.updateConnector(intentToUpdate.intent_id);
this.controllerService.closeAllPanels();
// this.connectorService.deleteConnectorsFromActionByActionId(this.actionSelectedID);
const responseIntent = this.onUpdateIntentWithTimeout(intentToUpdate, 0, true);
Expand Down Expand Up @@ -946,7 +946,7 @@ export class IntentService {


public patchButtons(buttons, idAction){
// console.log('patchButtons:: ', buttons);
console.log('patchButtons:: ', buttons);
buttons.forEach((button, index) => {
const checkUid = buttons.filter(btn => btn.uid === button.uid);
if (checkUid.length > 1 || !button.uid && button.uid == undefined) {
Expand Down Expand Up @@ -1262,7 +1262,7 @@ export class IntentService {
this.connectorService.deleteConnectorsOutOfBlock(intent.intent_id, false, false, false); // false, false
// this.connectorService.deleteConnectorsBrokenOutOfBlock(intent.intent_id); // false, false
this.connectorService.createConnectorsOfIntent(intent); // false, false
this.connectorService.updateConnector(intent.intent_id);
// this.connectorService.updateConnector(intent.intent_id);
// cancello tutti i connettori in uscita e li ricreo
}, 100);
this.intentSelected = intent;
Expand All @@ -1275,7 +1275,7 @@ export class IntentService {
this.connectorService.deleteConnectorsOutOfBlock(intent.intent_id, false, false, false); // false, false
// this.connectorService.deleteConnectorsBrokenOutOfBlock(element.intent_id); // false, false
this.connectorService.createConnectorsOfIntent(element); // false, false
this.connectorService.updateConnector(element.intent_id);
// this.connectorService.updateConnector(element.intent_id);
}, 100);
this.updateIntent(element); // async
}
Expand Down
3 changes: 0 additions & 3 deletions src/assets/js/tiledesk-connectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,8 @@ export class TiledeskConnectors {
}
this.#drawConnector(conn.id, conn.fromPoint, conn.toPoint);
conn['notify']='';

const event = new CustomEvent("connector-updated", { detail: { connector: conn } });
document.dispatchEvent(event);


}
};
}
Expand Down
9 changes: 2 additions & 7 deletions src/assets/js/tiledesk-stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,17 @@ export class TiledeskStage {

this.drawer.style.transition = "transform 0.3s ease-in-out";
var originRec = this.container.getBoundingClientRect();

let newX = (50)-(x+w/2);
let newX = (90)-(x+w/2);
// console.log('newX:', newX);

let newY = (originRec.height/2)-(y+h/2);
let newY = (originRec.height/2)-(y+h/2)-20;
// console.log('newX:', newY);

let tcmd = `translate(${newX}px, ${newY}px)`;
let scmd = `scale(${1})`;
// let scmd = `scale(${this.scale})`;
const cmd = tcmd + " " + scmd;
this.drawer.style.transform = cmd;

// console.log("tcmd:", tcmd);
// console.log("transform:", tcmd);

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

0 comments on commit 000471d

Please sign in to comment.