Skip to content

Commit

Permalink
minor bug fix form and question components
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Panico committed Oct 6, 2023
1 parent 0449a52 commit 31c987f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ACTIONS_LIST } from '../../../../../utils';
import { ACTIONS_LIST, INTENT_ELEMENT } from '../../../../../utils';
import { Action } from 'src/app/models/action-model';
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
Expand Down Expand Up @@ -34,8 +34,19 @@ export class CdsActionDescriptionComponent implements OnInit {
this.elementType = this.actionSelected._tdActionType;
}
try {

switch(this.elementType){
case 'form':
case 'question':
case 'answer':
this.element = Object.values(INTENT_ELEMENT).find(el => el.type === this.elementType)
break;
default:
this.element = Object.values(ACTIONS_LIST).find(el => el.type === this.elementType)
break;
}
// this.element = ELEMENTS_LIST.find(item => item.type === this.elementType);
this.element = Object.values(ACTIONS_LIST).find(el => el.type === this.elementType)

if(this.actionSelected._tdActionTitle && this.actionSelected._tdActionTitle != ""){
this.dataInput = this.actionSelected._tdActionTitle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class CdsSidebarComponent implements OnInit {

getUserRole() {
this.projectService.getProjectUserByUserId(this.projectID, this.user.uid).pipe( takeUntil(this.unsubscribe$)).subscribe((projectUser: ProjectUser) => {
// console.log('[CDS-SIDEBAR] - SUBSCRIPTION TO USER ROLE »»» ', userRole)
console.log('[CDS-SIDEBAR] - SUBSCRIPTION TO USER ROLE »»» ', projectUser)
if (projectUser[0].role !== undefined) {
this.USER_ROLE = projectUser[0].role;
}
Expand Down
6 changes: 6 additions & 0 deletions src/app/chatbot-design-studio/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ export function calculatingRemainingCharacters(text: string, limit: number): num
}
}

export const INTENT_ELEMENT = {
FORM: { name: 'Form', type: TYPE_INTENT_ELEMENT.FORM, src: "assets/images/form.svg", description: "Add a Form to ask user data"},
// ANSWER: { name: 'Answer', type: TYPE_INTENT_ELEMENT.ANSWER, src: "assets/images/form.svg", description: "Add an Answer"},
QUESTION: { name: 'Question', type: TYPE_INTENT_ELEMENT.QUESTION, src: "assets/images/form.svg", description: "Add a Question"},
}


export const ACTIONS_LIST: {[key: string]: {name: string, category: TYPE_ACTION_CATEGORY, type: TYPE_ACTION, src: string, status: 'active' | 'inactive' | 'beta', description?: string}}= {
REPLY : { name: 'Reply', category: TYPE_ACTION_CATEGORY.MOST_USED, type: TYPE_ACTION.REPLY, src:"assets/images/actions/reply.svg", status: "active" ,description: '<b>Pro tip</b>: Turn this block into a programmed proactive message. <a href=https://www.youtube.com/embed/SgDGwvVoqWE target=_blank>Here is how!</a> '},
Expand Down

0 comments on commit 31c987f

Please sign in to comment.