Skip to content

Commit

Permalink
added: new cds-modal-activate-bot while publishing a chatbot
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Panico committed Nov 7, 2023
1 parent e702828 commit 7e7c662
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ <h5 style="color:#D06079;"> {{'AnErroOccurredWhileActivatingTheBot' | translate
<span> {{ "Install" | translate }} </span>
</div>

<button *ngIf="!dept_id && HAS_COMPLETED_HOOK_BOOT_TO_DEPT === false && !DISPLAY_INSTALL_SCRIPT" id="ignoreBtn"
<button *ngIf="!deptSelected && HAS_COMPLETED_HOOK_BOOT_TO_DEPT === false && !DISPLAY_INSTALL_SCRIPT" id="ignoreBtn"
class="btn btn-primary cds-blue-button" (click)="DEPTS_HAS_NOT_A_BOT = !DEPTS_HAS_NOT_A_BOT">
<span> {{ 'Ignore' | translate}} </span>
</button>

<button *ngIf="dept_id && HAS_COMPLETED_HOOK_BOOT_TO_DEPT === false"
<button *ngIf="deptSelected && HAS_COMPLETED_HOOK_BOOT_TO_DEPT === false"
class="btn btn-primary cds-blue-button" (click)="hookBotToDept()">
<i *ngIf="HAS_CLICKED_HOOK_BOOT_TO_DEPT === true && HAS_COMPLETED_HOOK_BOOT_TO_DEPT === false"
class="fa fa-spinner fa-spin"></i>
<span> {{ 'ActivateFor' | translate}} <b>{{selected_bot_name}}</b> </span>
<span> {{ 'ActivateFor' | translate}} <b>{{deptSelected.name}}</b> </span>
</button>

<button *ngIf="HAS_CLICKED_HOOK_BOOT_TO_DEPT === true && HAS_COMPLETED_HOOK_BOOT_TO_DEPT === true"
Expand All @@ -118,7 +118,7 @@ <h5 style="color:#D06079;"> {{'AnErroOccurredWhileActivatingTheBot' | translate

<ng-template #publishStep>
<div class="cds-modal-body" id="publishStep">
<div class="field-box modal-flex">
<div *ngIf="!HAS_COMPLETED_PUBLISH" class="field-box modal-flex">
<label class="title-label"></label>
Publish your flow?
<!-- <h3> {{ 'DoYouWantToActivateTheBotForNewVonversations' | translate: translateparamBotName }} </h3> -->
Expand All @@ -136,7 +136,7 @@ <h5 style="color:#D06079;"> {{'AnErroOccurredWhileActivatingTheBot' | translate
stroke-linecap="round" stroke-miterlimit="10"
points="100.2,40.2 51.5,88.8 29.8,67.5 " />
</svg>
<h5 style="color:#73AF55;"> {{'BotSuccessfullyActivated' | translate }}</h5>
<h5 style="color:#73AF55;"> {{'BotSuccessFullyPublished' | translate }}</h5>
</span>

<span *ngIf="HAS_COMPLETED_PUBLISH_ERROR" class="field-box modal-flex">
Expand All @@ -150,14 +150,14 @@ <h5 style="color:#73AF55;"> {{'BotSuccessfullyActivated' | translate }}</h5>
<line class="path line" fill="none" stroke="#D06079" stroke-width="6" stroke-linecap="round"
stroke-miterlimit="10" x1="95.8" y1="38" x2="34.4" y2="92.2" />
</svg>
<h5 style="color:#D06079;"> {{'AnErroOccurredWhileActivatingTheBot' | translate }}</h5>
<h5 style="color:#D06079;"> {{'AnErroOccurredWhilePublishingTheBot' | translate }}</h5>
</span>
</div>
</div> <!-- /.modal-body -->

<div class="cds-modal-footer" id="publishStep">

<button *ngIf="!HAS_COMPLETED_PUBLISH"
<button *ngIf="!HAS_COMPLETED_PUBLISH" (click)="publish()"
class="btn btn-primary cds-blue-button">
<span> {{ "Publish" | translate }} </span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ export class CdsModalActivateBotComponent implements OnInit {
// PRESENTS_MODAL_ATTACH_BOT_TO_DEPT: boolean = false;
depts_without_bot_array = [];

selected_bot_name: string;
dept_id: string;
selected_dept_name: string;
// dept_id: string;
deptSelected: { id: string, name: string}
HAS_CLICKED_HOOK_BOOT_TO_DEPT: boolean = false;
HAS_COMPLETED_HOOK_BOOT_TO_DEPT: boolean = false;
HAS_COMPLETED_HOOK_BOOT_TO_DEPT_SUCCESS: boolean = false;
Expand Down Expand Up @@ -70,7 +71,7 @@ export class CdsModalActivateBotComponent implements OnInit {

checkDepartmentsForProjectIdHasBot(){
if(this.departments){
this.departments.forEach((dept: any) => {
this.departments.forEach((dept: Department) => {
// this.logger.log('[CDS DSBRD] - DEPT', dept);
if (dept.default === true) {
this.defaultDepartmentId = dept._id;
Expand All @@ -82,7 +83,7 @@ export class CdsModalActivateBotComponent implements OnInit {

if (depts_length === 1) {
this.DISPLAY_SELECT_DEPTS_WITHOUT_BOT = false;
this.dept_id = this.departments[0]['_id']
this.deptSelected = {id: this.departments[0]._id, name: this.departments[0].name}

this.logger.log('[ACTIVATE-BOT-MODAL-COMPONENT] ---> DEFAULT DEPT HAS BOT ', this.departments[0].hasBot);
if (this.departments[0].hasBot === true) {
Expand Down Expand Up @@ -114,20 +115,13 @@ export class CdsModalActivateBotComponent implements OnInit {
}

onSelectDept(event: {id: string, name: string}){
this.logger.log('[ACTIVATE-BOT-MODAL-COMPONENT] ---> onSelectBotId ', event);
this.dept_id = event.id
const hasFound = this.depts_without_bot_array.filter((obj: any) => {
return obj.id === this.dept_id;
});
this.logger.log('[CDS DSBRD] onSelectBotId found', hasFound);
if (hasFound.length > 0) {
this.selected_bot_name = hasFound[0]['name']
}
this.logger.log('[ACTIVATE-BOT-MODAL-COMPONENT] ---> onSelectDept ', event);
this.deptSelected = event
}

hookBotToDept() {
this.HAS_CLICKED_HOOK_BOOT_TO_DEPT = true;
this.departmentService.updateExistingDeptWithSelectedBot(this.dept_id, this.selectedChatbot._id).subscribe((res) => {
this.departmentService.updateExistingDeptWithSelectedBot(this.deptSelected.id, this.selectedChatbot._id).subscribe((res) => {
this.logger.log('[BOT-CREATE] Bot Create - UPDATE EXISTING DEPT WITH SELECED BOT - RES ', res);
}, (error) => {
this.logger.error('[BOT-CREATE] Bot Create - UPDATE EXISTING DEPT WITH SELECED BOT - ERROR ', error);
Expand All @@ -149,13 +143,12 @@ export class CdsModalActivateBotComponent implements OnInit {
this.faqKbService.publish(this.selectedChatbot).subscribe((data) => {
this.logger.log('[CDS DSBRD] publish - RES ', data)
}, (error) => {
this.HAS_COMPLETED_HOOK_BOOT_TO_DEPT = true
this.HAS_COMPLETED_PUBLISH = true
this.HAS_COMPLETED_PUBLISH_ERROR = true
this.logger.error('[CDS DSBRD] publish ERROR ', error);
}, () => {
this.HAS_COMPLETED_HOOK_BOOT_TO_DEPT = true
this.HAS_COMPLETED_PUBLISH = true
this.HAS_COMPLETED_PUBLISH_SUCCESS = true

this.logger.log('[CDS DSBRD] publish * COMPLETE *');
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Deseja ativar o bot <span class='bot_name_bold'>{{bot_name}}</span> para um dos seguintes departamentos?",
"ActivateBot": "Ativar bot",
"BotSuccessfullyActivated": "Bot ativado com sucesso",
"BotSuccessFullyPublished": "Bot publicado com sucesso",
"AnErroOccurredWhileActivatingTheBot": "Ocorreu um erro ao ativar o bot",
"AnErroOccurredWhilePublishingTheBot": "Ocorreu um erro ao publicar o bot",
"SelectDepartment": "Selecionar departamento",
"Ignore": "Ignorar",
"ActivateFor": "Ativar para",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Вы хотите активировать бота <span class='bot_name_bold'>{{bot_name}}</span> для одного из следующих отделов?",
"ActivateBot": "Активировать бота",
"BotSuccessfullyActivated": "Бот успешно активирован",
"BotSuccessFullyPublished": "Бот успешно опубликован",
"AnErroOccurredWhileActivatingTheBot": "Произошла ошибка при активации бота",
"AnErroOccurredWhilePublishingTheBot": "Произошла ошибка при публикации бота.",
"SelectDepartment": "Выберите отдел",
"Ignore": "Игнорировать",
"ActivateFor": "Активировать для",
Expand Down
4 changes: 3 additions & 1 deletion src/assets/i18n/sr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Да ли желите да активирате бот <span class='bot_name_bold'>{{bot_name}}</span> за једно од следећих одељења?",
"ActivateBot": "Активирајте бот",
"BotSuccessfullyActivated": "Бот је успешно активиран",
"AnErroOccurredWhileActivatingTheBot": "Дошло је до грешке при активирању бота",
"BotSuccessFullyPublished": "Бот је успешно објављен",
"AnErroOccurredWhileActivatingTheBot": "Дошло је до грешке приликом активирања бота",
"AnErroOccurredWhilePublishingTheBot": "Дошло је до грешке при објављивању бота",
"SelectDepartment": "Изаберите одељење",
"Ignore": "Игнорирај",
"ActivateFor": "Активирајте за",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Vill du aktivera bot <span class='bot_name_bold'>{{bot_name}}</span> för någon av följande avdelningar?",
"ActivateBot": "Aktivera bot",
"BotSuccessfullyActivated": "Boten har aktiverats",
"BotSuccessFullyPublished": "Boten har publicerats",
"AnErroOccurredWhileActivatingTheBot": "Ett fel uppstod när boten aktiverades",
"AnErroOccurredWhilePublishingTheBot": "Ett fel uppstod när boten skulle publiceras",
"SelectDepartment": "Välj avdelning",
"Ignore": "Strunta i",
"ActivateFor": "Aktivera för",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Aşağıdaki bölümlerden biri için <span class='bot_name_bold'>{{bot_name}}</span> etkinleştirmek istiyor musunuz?",
"ActivateBot": "Botu etkinleştir",
"BotSuccessfullyActivated": "Bot başarıyla etkinleştirildi",
"BotSuccessFullyPublished": "Bot başarıyla yayınlandı",
"AnErroOccurredWhileActivatingTheBot": "Bot etkinleştirilirken bir hata oluştu",
"AnErroOccurredWhilePublishingTheBot": "Bot yayınlanırken bir hata oluştu",
"SelectDepartment": "Departman seçin",
"Ignore": "Göz ardı etmek",
"ActivateFor": "Için etkinleştir",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Бажаєте активувати бота < проміжок class= бот_ім'я }}</проміжок > для одного з наступних відділів?",
"ActivateBot": "Активувати бота",
"BotSuccessfullyActivated": "Бот успішно активований",
"BotSuccessFullyPublished": "Бот успішно опубліковано",
"AnErroOccurredWhileActivatingTheBot": "Під час активації бота сталася помилка",
"AnErroOccurredWhilePublishingTheBot": "Під час публікації бота сталася помилка",
"SelectDepartment": "Виберіть відділ",
"Ignore": "Ігнорувати",
"ActivateFor": "Активувати для",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/uz.json
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,9 @@
"DoYouWantToActivateBotForOneOfTheFollowingDepts": "Quyidagi bo'limlardan biri uchun <span class='bot_name_bold'>{{bot_name}}</span> botni faollashtirmoqchimisiz?",
"ActivateBot": "Botni faollashtirish",
"BotSuccessfullyActivated": "Bot muvaffaqiyatli faollashtirildi",
"BotSuccessFullyPublished": "Bot muvaffaqiyatli chop etildi",
"AnErroOccurredWhileActivatingTheBot": "Botni faollashtirishda xatolik yuz berdi",
"AnErroOccurredWhilePublishingTheBot": "Botni nashr qilishda xatolik yuz berdi",
"SelectDepartment": "Bo'limni tanlang",
"Ignore": "E'tibor bermaslik",
"ActivateFor": "uchun faollashtirish",
Expand Down
3 changes: 2 additions & 1 deletion src/assets/sass/cds/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ $mdb-font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif !default;

$blu: #506493;
$blu-02: rgb(91, 114, 167);
$blu-03: rgb(61,64,68);
$blu-light-01: rgb(244, 246, 251);
$blu-light-02: #b6c2df;
$blu-light-03: rgb(224, 227, 241);
$blu-light-04: rgb(237, 239, 248);
$blu-light-04: rgb(229, 234, 245);
$gray: rgb(112, 112, 112);
$gray-02: rgb(239,241,245);
$gray-light-01: rgb(214, 214, 214);
Expand Down

0 comments on commit 7e7c662

Please sign in to comment.